Table of content

Actions

nsl-add-providers

This action helps you adding new providers to the plugin.

nsl-providers-loaded

This action runs after every provider has been loaded and ordered correctly.
NextendSocialLogin::$providers contains all available providers.
NextendSocialLogin::$enabledProviders contains only the enabled providers.


Connect Flow actions/filters

{{provider-id}}_login_action_before

This action run first after the user clicked the social login button. It has only one parameter, the current provider. It extends from the NextendSocialProvider class.

{{provider-id}}_login_redirect_url

A filter to override the login redirect url. It has two parameters:

  • Fixed redirect URL, if set
  • current provider

It returns the new redirect URL.

Example:

Code

add_filter('facebook_login_redirect_url', function($redirectUrl, $provider){ return $redirectUrl;}, 10, 2);

{{provider-id}}_register_redirect_url

It’s the same as the {{provider-id}}_login_redirect_url. It has the same two parameters, but it happens upon registration:

  • Fixed redirect URL, if set
  • current provider

nsl_register_new_user

This happens when a new user is registered with any of the providers. Parameteres:

  • $user_id
  • provider instance

nsl_{{provider-id}}_register_new_user

This action runs when the user registers with the given provider. Parameters:

  • $user_id
  • provider instance

This filter can prevent linking the user accounts automatically for a user when it returns false.
Parameters:

  • $isAutoLinkAllowed
  • current provider instance
  • $user_id

nsl_{{provider-id}}_is_login_allowed

This filter can prevent the login for the user when it returns false.
Parameters:

  • $isAutoLoginAllowed
  • current provider instance
  • $user_id

nsl_login

This action runs when a user logs in with any of the providers.
Parameters:

  • $user_id
  • provider instance

nsl_{{provider-id}}_login

This action runs when a user logs in with the given provider.
Parameters:

  • $user_id
  • provider instance
  • access_token

nsl_autologin_priority

Our auto-login after social registration may block third-party code hooked to the “user_register” action. Use this filter to delay our auto-login.
Parameters:

  • $autoLoginPriority – Higher numbers correspond with later execution. We suggest not to decrease the value below the default auto-login priority.

nsl_pre_register_new_user

This action runs before the new user is registered.
Parameters:

  • NextendSocialUser class instance

nsl_is_register_allowed

This filter defines whether the user registration is allowed or not.
Parameters:

  • boolean
  • provider instance

Available since: 3.0.4

This action runs when a user link the account to a given provider, registration with the given provider also triggers this hook.
Parameters:

  • $user_id
  • provider id

This action runs when a user unlinks a social media account from a certain provider.
Parameters:

  • $user_id
  • provider id
  • unlinked social media id

Available since: 3.0.28 / “unlinked social media id” parameter added in 3.1.6

nsl_registration_user_data

This filter can be used for overriding certain userdata before the registration or preventing the registration.
Parameters:

  • $userData – associative array – username and email
  • $provider – provider instance, that can be used to retrieve some data of current user.
  • $error – error object, that can be used for preventing the registration.

nsl_disabled_register_redirect_url

This filter can be used for overriding the URL where the user will be redirected, if the registration is disabled.
Parameters:

  • $redirectUrl – string – the url of the page

Available since: 3.0.25

nsl_disabled_register_error_message

This filter can be used for overriding the message that is displayed when the registration is disabled with Nextend Social Login.
Parameters:

  • $errorMessage – string – the error message
  • $provider – provider instance

Starting from version 3.0.28 passing “false” in the return value can be used for disabling the default error message!

Available since: 3.0.25

nsl_{{provider-id}}_auth_url_args

This filter can be used for overriding authorization URL arguments of each provider.
Parameters:

  • $args – associative array – contains the current authorization URL arguments.

Available since: 3.0.26

This filter can be used for overriding the User ID that the social account should be linked to.
Parameters:

  • $user_id – the ID of the WordPress account where the social account should be linked to
  • social user instance
  • current provider instance

Available since: 3.0.26

nsl_disabled_login_redirect_url

This filter can be used for overriding the URL where the user will be redirected, if the login is disabled.
Return value:

  • string – the URL where the user should be redirected

Available since: 3.0.27

nsl_disabled_login_error_message

This filter can be used for overriding the message that is displayed when the login is disabled with Nextend Social Login.
Return value:

  • string – the error message

Available since: 3.0.27

nsl_already_linked_error_message

This filter can be used for overriding the message that is displayed when a person tries to connect with a social media account, that’s email address is registered on the site and has another social media account from the same kind already linked.
Return value:

  • string – the error message

Available since: 3.0.30

nsl_bypass_cache_url

This filter can be used for adding custom GET parameters to the redirect URL, when the “Bypass cache on redirect” setting is enabled. By default the name of the parameter is “nsl_bypass_cache” and its value is a unique hash.
Parameters:

  • $url – string – the URL where the user should be redirected to

Return value:

  • string – the URL where the user should be redirected to ( To attempt bypassing the cache, at least one GET parameter should be added into the URL! )

Example:

Code

add_filter('nsl_bypass_cache_url', function ($url) { return add_query_arg(array("abc" => "123"), $url); });

Available since: 3.1.4

nsl_connect_button_custom_attributes

You can use this filter to add custom attributes to the connect button.

Example:

Code

add_filter('nsl_connect_button_custom_attributes', function ($attr, $provider) {
    $attr['attrbute'] = "value";
    return $attr;
}, 10, 2);

Available since: 3.1.5

nsl_register_roles

You can use this filter to override the role that the user should be registered with.
Parameters:

  • $roles – array – contains the role or roles that the user should be registered with
  • $provider – provider instance, that can be used to retrieve some data of current user.

Available since: 3.1.14