Created
October 15, 2017 18:53
-
-
Save vince844/85f1bb816a56bdd57f90912702feb275 to your computer and use it in GitHub Desktop.
MyCred custom column for mycred_history log shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the following code to the functions.php code it will add a new column in the mycred_history with the user fisrt name and last name | |
function mycredpro_add_log_column( $columns ) { | |
// Add our own column | |
$columns['user-data'] = 'Utente'; | |
return $columns; | |
} | |
add_filter( 'mycred_log_column_headers', 'mycredpro_add_log_column' ); | |
function mycred_pro_user_data_content( $content, $entry ) { | |
$adjusted_by = get_userdata( (int) $entry->user_id ); | |
if ( isset( $adjusted_by->ID ) ) | |
return $adjusted_by->first_name.' '.$adjusted_by->last_name; | |
} | |
add_filter( 'mycred_log_user-data', 'mycred_pro_user_data_content', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, do you know how to add this new column to the file that exports the log in csv?
Thanks in advance
Note: I'm not a programmer at all