Last active
January 26, 2018 01:18
-
-
Save ultimatemember/962dcd6eaa6db560f6c7 to your computer and use it in GitHub Desktop.
Sync UM / WP User Role During User Approval
This file contains 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
/* This example syncs both UM / WP role during user approval */ | |
add_action('um_after_user_is_approved', 'sync_um_and_wp_role', 99 ); | |
function sync_um_and_wp_role( $user_id ) { | |
// Get UM role | |
$role = get_user_meta( $user_id, 'role', true ); | |
// Set WordPress role for same user | |
$wp_user_object = new WP_User( $user_id ); | |
$wp_user_object->set_role( $role ); | |
} |
@jdeblase I know it's a bit late, but I hope it helps you. The code is put in the functions.php of the active theme.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where in the UM plugin directory would this script be placed or in which file would it need to be added?