Skip to content

Instantly share code, notes, and snippets.

@ultimatemember
Last active January 26, 2018 01:18
Show Gist options
  • Save ultimatemember/962dcd6eaa6db560f6c7 to your computer and use it in GitHub Desktop.
Save ultimatemember/962dcd6eaa6db560f6c7 to your computer and use it in GitHub Desktop.
Sync UM / WP User Role During User Approval
/* 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 );
}
@belial9826
Copy link

@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