Plugin: Add a system for logging events related to pledges and contributors (#54)

Uses action hooks to capture relevant events as log entries on a per-pledge basis. This provides a running history of a pledge and can be used as an audit log if questions arise about changes to a pledge or there are weird bugs.

Fixes #39
This commit is contained in:
Corey McKrill 2019-10-29 12:46:13 -07:00 committed by GitHub
parent 6209060eb2
commit 5c5ae83287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 424 additions and 18 deletions

View file

@ -28,9 +28,11 @@ add_action( 'added_post_meta', __NAMESPACE__ . '\update_generated_meta', 10, 4
/**
* Define pledge meta fields and their properties.
*
* @param string $context Optional. The part of the config to return. 'user_input', 'generated', or 'all'.
*
* @return array
*/
function get_pledge_meta_config( $context = '' ) {
function get_pledge_meta_config( $context = 'all' ) {
$user_input = array(
'org-description' => array(
'single' => true,
@ -283,6 +285,7 @@ function update_generated_meta( $meta_id, $object_id, $meta_key, $_meta_value )
case META_PREFIX . 'org-name':
if ( 'updated_postmeta' === current_action() ) {
wp_update_post( array(
'ID' => $object_id,
'post_title' => $_meta_value,
) );
}