• Hi there,

    first of all, thank you for that great plugin!

    We’re trying to solve the following issue:

    We have two WP websites with a Single Sign On.

    Site A (the shop) / Site B (the support center)

    ** On site A **
    Users are signing up on Site A. They get the default core WP role. UM is NOT installed on Site A.
    On top of the “basic” WP role, we have two custom roles that we assigned manually (with the plugin User Role Editor).

    Role “1”
    Role “2”

    When users click on “service center” the are redirected on Site B.

    ** On site B **
    We created exactly the same WP core roles than on site A.

    If use arrive from site A with the role 2, he has the same role on Site B.

    => Ultimate Member.
    We created in UM the two roles and names them like our “core custom worpdress role”: “1” & “2”.

    Now our issue:

    We can synchronize with WP role in the direction UM Role to Worpdress role BUT not the opposite.

    What we would like is that when a user arrive from Site A with the WP Role 2, UM automaticaly asign him the corresponding UM Role.

    In the “For developpers” section of the help there is a code example: ” Conditionally sync UM user role based on WP role (Gravity forms)”

    /* This code will sync the UM role based on WP role using gravity registration */
     
    add_action("gform_user_registered", "um_gravity_user_role_sync", 200, 4);
    function um_gravity_user_role_sync($user_id, $config, $entry, $user_pass) {
     
        $user = new WP_User( $user_id );
        $wp_role = $user->roles[0];
        
        // if WP role is subscriber, set UM role to member
        if ( $wp_role == 'subscriber' ) {
            update_user_meta($user_id, 'role', 'member');
        }
     
    }
    
    

    Is there a way to adapt that code to what we are looking for?

    Thank you VERY much in advance for any help.

    Greetings from Berlin

    Gui

    • This topic was modified 7 years, 6 months ago by guiberlin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WP Role >=> UM Roles both why sy’ is closed to new replies.