• Resolved hkalrain

    (@hkalrain)


    Hello, I must say thanks for providing such a great plugin. I want to ask is there a way to use variable in the redirect option in the Global settings. For example, I have buddypress site and I am able to register using this plugin. Now after registration I want user to be redirected to profile page which looks like localhost/members/<username>/profile. Username will be different for every logged user.

    Please advise me if this is achievable with his plugin. All I want is to redirect user after registration to a dynamic page link.

    Thanks & Regards
    Harish

Viewing 1 replies (of 1 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @hkalrain

    I am sorry, but you can not use variables for our redirect options at our Global Settings > General tab.

    However we offer various filters and actions that you can use to override the default behavior.
    For example:
    -we have the action: “nsl_register_new_user” that is called when a new user is registered with any of our providers. ( With this action you could find out the ID of the registered account. )
    -we have the filter: “{{provider-id}}_register_redirect_url” that defines where the user should be redirected after a successful registration.
    In our documentations you can check their parameters:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/

    So by combining this action and filter you could redirect the user to the page where you intend.

    Please note that we can not provide support for custom coding, but I created an example that does exactly what you were looking for:

    add_action('nsl_register_new_user', function ($user_id, $provider) {
        add_filter($provider->getId() . '_register_redirect_url', function ($redirectURL, $provider) use ($user_id) {
            return 'https://example.com/' . $user_id . '/profile';
        }, 10, 2);
    }, 10, 2);

    Feel free to modify this code for your needs.

    Best regards,
    Laszlo.

Viewing 1 replies (of 1 total)

The topic ‘Using variable in redirect URL in Global settings’ is closed to new replies.