WP to Ultimate Member sync
-
Hello:
I am putting together a WordPress site using woo commerce and Ultimate Members. The combo is pretty nice!
I do have one problem, though. The plugin developers for UM have set roles in their plugin as priority over WordPress. What I mean by that is when a user role changes they change the role for their app and then change the role in WP. if the WP role changes then the UM role does not.
Woocommerce follows the WP convention and when a user registers through their app they change the WP role.
To get the two systems to play nice, I need to change the UM role when the WP role changes after a user signs into my site through woo.
I found this snippet of code that changes the WP role when the UM role changes. I need to swap things around. Can anyone show me the way?
Here is the snippet:
add_action(‘um_after_user_is_approved’, ‘sync_um_and_wp_role’, 99 );
function sync_um_and_wp_role( $user_id ) {
update_user_meta( $user_id, ‘role’, ‘realtor’);
$wp_user_object = new WP_User( $user_id );
$wp_user_object->set_role( ‘realtor’ );
}Thanks, Rich
- The topic ‘WP to Ultimate Member sync’ is closed to new replies.