Pledge Log: Log user of CLI actions.

This commit is contained in:
Ian Dunn 2019-11-07 11:31:00 -08:00
parent c524d1b21b
commit 18228d367c
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
2 changed files with 11 additions and 3 deletions

View file

@ -117,6 +117,9 @@ function add_log_entry( $pledge_id, $type, $message, array $data = array(), $use
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;
} elseif ( 'cli' === php_sapi_name() ) {
$entry['user_id'] = gethostname();
}
add_post_meta( $pledge_id, LOG_META_KEY, $entry, false );