SAML SP Premium Plugin Hooks Documentation


WordPress Hooks


WP Actions

1. user_register

do_action( 'user_register', string $user_id );

Description
 Fires when a new user is registered on WordPress during Single Sign-On (SSO). This action allows you to perform tasks immediately after a user is registered on the site.

Parameters

  • $user_idstring
    User ID

2. wp_login

do_action( 'wp_login', string $user_login, WP_User $user );

Description
 Fires after the user is successfully logged in via Single Sign-On (SSO). This allows you to perform actions just after a user is logged in to the site.

Parameters

  • $user_loginstring
    Username
  • $userWP_User
    WP_User object of the logged-in user.

WP Filters

1. pre_user_login

apply_filters( 'pre_user_login', string $sanitized_userName );

Description
 Fires just before the user’s username is searched in WordPress for login. This allows you to modify the username (received from the SAML Response) before user login or register.

Parameters

  • $sanitized_userNamestring
    Sanitized Username

Custom Hooks


Actions

1. mo_abr_filter_login

do_action( 'mo_abr_filter_login', array $attrs, string $nameId, string $sessionIndex )

Description
 Fires just before the user is logged in to WordPress via SSO. This allows you to perform actions before the user has logged in and also provides all the user attributes received from the IDP.

Parameters

  • $attrsarray
    Contains an array of attributes received from the IDP in the SAML Response.
  • $nameIdstring
    NameId received from the IDP.
  • $sessionIndexstring|NULL
    The session index of the user on the WP site.

2. mo_saml_attributes

do_action( 'mo_saml_attributes', string $user_name, string $user_email, string $first_name, string $last_name, string $group_value , string $idp_name, array $attributes);

Description
 Fires after a user is created/updated in WordPress for SSO. This allows you to perform actions after the user has logged in and also provides the basic user attributes received from the IDP.

Parameters

  • $userNamestring
    User's Username
  • $user_emailstring
    User's Email
  • $first_namestring
    User's First Name
  • $last_namestring
    User's Last Name
  • $group_valuestring
    User's Group Name
  • $idp_namestring
    IDP Name from which the user performed SSO.
  • $attributesarray
    Default attributes received from IDP for the SSO user.

3. mo_wp_user_attributes

do_action( 'mo_wp_user_attributes', int $user->ID, array $attributes, string $idp_name, string $sso_plugin, boolean $new_user );

Description
 Action when user is logged to get the user details like attributes, IDP name, userID etc.

Parameters

  • $user_idint
    ID of the current user.
  • $attributesarray
    Attributes received from the IDP.
  • $idp_namestring
    Name of the IDP using which user is logged in.
  • $sso_pluginstring
    Name of the SSO Plugin.
  • $new_userboolean
    Whether the user is new or existing.

Filters

1. mo_remember_me

apply_filters( 'mo_remember_me', boolean $remember );

Description
 Fires just before setting the WP authentication cookie. This enables you to maintain user login status by keeping the session intact (passing parameter remember as true).

Parameters

  • $rememberboolean
    The value of the remember me checkbox from the login page.

2. mo_saml_add_custom_css_in_sso_button

apply_filters( 'mo_saml_add_custom_css_in_sso_button', $html );

Description
 Fires just before the SSO Login Button is loaded on the WordPress login page. This allows you to customize the SSO Login button.

Parameters

  • $htmlHTML body
    The current html element of the SSO button as saved in the plugin settings.

For more information visit our WordPress SSO page.