SAML SP Premium Plugin Hooks Documentation


WordPress Hooks


WP Actions


1. user_register

do_action( 'user_register', string $user_id );

Description
Available in: Standard & Premium Plans.

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_id string
    User ID

2. wp_login

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

Description
Available in: Standard, Premium, Enterprise, All-Inclusive Plans.

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_login string
    Username
  • $user WP_User
    WP_User object of the logged-in user.

WP Filters


1. pre_user_login

apply_filters( 'pre_user_login', string $sanitized_userName );

Description
Available in: Premium, Enterprise, All-Inclusive Plans.

 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_userName string
    Sanitized Username

Custom Hooks


Actions


1. mo_abr_filter_login

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

Description
Available in: Premium, Enterprise, All-Inclusive Plans.

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

  • $attrs array
    Contains an array of attributes received from the IDP in the SAML Response.
  • $nameId string
    NameId received from the IDP.
  • $sessionIndex string|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
Available in: Premium, Enterprise, All-Inclusive Plans.

 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

  • $userName string
    User's Username
  • $user_email string
    User's Email
  • $first_name string
    User's First Name
  • $last_name string
    User's Last Name
  • $group_value string
    User's Group Name
  • $idp_name string
    IDP Name from which the user performed SSO.
  • $attributes array
    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
Available in: Enterprise, All-Inclusive Plans.

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

Parameters

  • $user_id int
    ID of the current user.
  • $attributes array
    Attributes received from the IDP.
  • $idp_name string
    Name of the IDP using which user is logged in.
  • $sso_plugin string
    Name of the SSO Plugin.
  • $new_user boolean
    Whether the user is new or existing.

Filters


1. mo_remember_me

apply_filters( 'mo_remember_me', boolean $remember );

Description
Available in: Standard, Premium, Enterprise, All-Inclusive Plans.

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

  • $remember boolean
    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
Available in: Premium, Enterprise, All-Inclusive Plans.

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

Parameters

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

For more information visit our SSO for WordPress page.