mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 18:05:45 +03:00
Log: Use current user ID in log template by default
This commit is contained in:
parent
253e65faca
commit
6873deb7cb
1 changed files with 13 additions and 16 deletions
|
@ -66,7 +66,7 @@ function get_log_entry_template() {
|
||||||
'type' => '',
|
'type' => '',
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'data' => array(),
|
'data' => array(),
|
||||||
'user_id' => 0,
|
'user_id' => get_current_user_id(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,11 @@ function add_log_entry( $pledge_id, $type, $message, array $data = array(), $use
|
||||||
$entry['type'] = $type;
|
$entry['type'] = $type;
|
||||||
$entry['message'] = $message;
|
$entry['message'] = $message;
|
||||||
$entry['data'] = $data;
|
$entry['data'] = $data;
|
||||||
$entry['user_id'] = $user_id;
|
|
||||||
|
if ( $user_id ) {
|
||||||
|
// The template defaults to the current user, so this function parameter shouldn't override unless it's different.
|
||||||
|
$entry['user_id'] = $user_id;
|
||||||
|
}
|
||||||
|
|
||||||
add_post_meta( $pledge_id, LOG_META_KEY, $entry, false );
|
add_post_meta( $pledge_id, LOG_META_KEY, $entry, false );
|
||||||
}
|
}
|
||||||
|
@ -137,8 +141,7 @@ function capture_save_post( $post_ID, $post, $update ) {
|
||||||
'Pledge created. Status set to <code>%s</code>.',
|
'Pledge created. Status set to <code>%s</code>.',
|
||||||
esc_html( get_post_status( $post_ID ) )
|
esc_html( get_post_status( $post_ID ) )
|
||||||
),
|
),
|
||||||
PledgeForm\get_form_submission(),
|
PledgeForm\get_form_submission()
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,8 +177,7 @@ function capture_updated_postmeta( $meta_id, $object_id, $meta_key, $meta_value
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$meta_key => $meta_value,
|
$meta_key => $meta_value,
|
||||||
),
|
)
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,8 +208,7 @@ function capture_added_post_meta( $meta_id, $object_id, $meta_key, $meta_value )
|
||||||
'Pledge email address confirmed.',
|
'Pledge email address confirmed.',
|
||||||
array(
|
array(
|
||||||
'email' => get_post_meta( $object_id, PledgeMeta\META_PREFIX . 'org-pledge-email', true ),
|
'email' => get_post_meta( $object_id, PledgeMeta\META_PREFIX . 'org-pledge-email', true ),
|
||||||
),
|
)
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -245,8 +246,7 @@ function capture_transition_post_status( $new_status, $old_status, WP_Post $post
|
||||||
esc_html( $old_status ),
|
esc_html( $old_status ),
|
||||||
esc_html( $new_status )
|
esc_html( $new_status )
|
||||||
),
|
),
|
||||||
array(),
|
array()
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -262,8 +262,7 @@ function capture_transition_post_status( $new_status, $old_status, WP_Post $post
|
||||||
esc_html( $old_status ),
|
esc_html( $old_status ),
|
||||||
esc_html( $new_status )
|
esc_html( $new_status )
|
||||||
),
|
),
|
||||||
array(),
|
array()
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +286,7 @@ function capture_add_pledge_contributors( $pledge_id, $contributors, $results )
|
||||||
'Contributors added: <code>%s</code>',
|
'Contributors added: <code>%s</code>',
|
||||||
implode( '</code>, <code>', $contributors )
|
implode( '</code>, <code>', $contributors )
|
||||||
),
|
),
|
||||||
$results,
|
$results
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,8 +313,7 @@ function capture_remove_contributor( $pledge_id, $contributor_post_id, $result )
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'previous_status' => $contributor_post->_wp_trash_meta_status,
|
'previous_status' => $contributor_post->_wp_trash_meta_status,
|
||||||
),
|
)
|
||||||
get_current_user_id()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue