• Resolved JosephWesker

    (@josephwesker)


    Hi,

    Is there any way that a different role can be assigned to each provider? Something like:

    [nextend_social_login provider=”facebook” role=”shop-manager”]
    [nextend_social_login provider=”facebook” role=”contributor”]

    I have noticed that more than 1 role can be assigned with each provider, but different roles can not be assigned with the same provider in different places.

    Can you help me find a solution?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @josephwesker!

    I am sorry currently we don’t have such parameter for our shortcode.
    However with the trackerdata parameter which can be used to identify where the registration has happened from and some custom coding you could probably override the default role of the user.
    Here you can read more about the tracker data:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/
    under the section: “Example: using trackerdata to identify the page the user registered”
    and here you can find the parameters of the shortcode:
    https://nextendweb.com/nextend-social-login-docs/theme-developer/#shortcode

    Please note that to achieve your goals, coding knowledge is required, since we can not provide support for custom coding however I can give you some hints:

    So you should probably create a custom plugin as you see in the backend developer documentation above, and you could add an action:
    nsl_<providerIdHere>_register_new_user

    for example:

    add_action('nsl_facebook_register_new_user', 'changeRoleFunction', 11);
    
    function changeRoleFunction($user_id){
        //your logics for trackerdata and to identify the page ...
            $user = new WP_User($user_id);
            //you can user the $user object to change the role of the user
    };

    Best regards,
    Laszlo.

    Thread Starter JosephWesker

    (@josephwesker)

    The code works and was very easy to implement.

    You guys are awesome, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign different roles with the same provider’ is closed to new replies.