Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Sync Wp role With Ultimate member plugin roles on new users WordPress

  • REFUNDED

Hi there,

I am creating Wp user from APi using:

http://www.parorrey.com/solutions/json-api-user-plus/

I want to send a double opt-in to validate email and sync a role from WP to Ultimate member WP plugin:

https://wordpress.org/plugins/ultimate-member/

_______________________

There is actually a way to sync UM role into Wp role for new users:

add_action('um_after_user_is_approved', 'sync_um_and_wp_role', 99 );
function sync_um_and_wp_role( $user_id ) {
$role = get_user_meta( $user_id, 'role', true);
if ( $role == 'member' ) {
$wp_user_object = new WP_User( $user_id );
$wp_user_object->set_role( 'student' );
}
}


(Ref: https://ultimatemember.com/forums/topic/associate-custom-um-user-roles-with-wordpress-roles/)
_______________________


But,

I need all the way around!!

I mean "Sync Wp role into Ultimate Member Role", so when push user from API-user-plus, and then send double opt in to validate this user and sync role into Ultimate member plugin

Ultimate Member has API and codex show way apparently to set role:

$ultimatemember->user->set_role( $role );

(Ref: https://ultimatemember.com/codex/)


Kindly post code to try it thanks and explain in which file needs to be inserted (functions.php), I am running My Custom Functions plugin.

Thanks

Answers (0)

No answers yet.