Created
July 14, 2016 02:24
-
-
Save lukecarbis/2456444da101b0e96b486590a9b5f397 to your computer and use it in GitHub Desktop.
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
public function callback_set_user_role( $user_id, $new_role, $old_roles ) { | |
if ( empty( $old_roles ) ) { | |
return; | |
} | |
$old_roles = array_values( $old_roles ); | |
global $wp_roles; | |
$this->log( | |
_x( | |
'%1$s\'s role was changed from %2$s to %3$s', | |
'1: User display name, 2: Old role, 3: New role', | |
'stream' | |
), | |
array( | |
'display_name' => get_user_by( 'id', $user_id )->display_name, | |
'old_role' => translate_user_role( $wp_roles->role_names[ $old_roles[0] ] ), | |
'new_role' => translate_user_role( $wp_roles->role_names[ $new_role ] ), | |
), | |
$user_id, | |
'profiles', | |
'updated' | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment