Developer hooks

Use this guide if you are a developer and would like to build custom integrations with Microsoft Graph or Microsoft 365 services such as SharePoint Online, Yammer, Teams that extend the out-of-the-box functionality already provided by the WordPress + Office 365 plugin.

Before you start

  • You must already have configured the single sign-on and optionally the integration capability of the WordPress + Office 365 plugin.
  • You are an Administrator for your WordPress website.
  • You are using one of the premium editions of the plugin (PLUS+, PROFESSIONAL, PREMIUM or INTRANET).

Update v15

With v15 additional hooks have been added.

Hook Arguments Trigger
wpo365/oidc/authenticated
The user's ID Whenever a user signed in with OpenID Connect based Microsoft.
wpo365/saml/authenticated
The user's ID Whenever a user signed in with SAML 2.0 based Microsoft.
wpo365/user/created
The user's ID
Whenever the plugin creates a new WordPress user.
wpo365/wpmu/user_added
The blog's ID
The user's ID
Whenever a user is added to a subsite of a WordPress Multisite.
wpo365/sync/before
The job's parameters Just before user synchronization starts.
wpo365/sync/error
The job's parameters
Whenever an error occurs during user synchronization.
wpo365/sync/user
The user's attributes Whenever user synchronization starts with the processing of a user.
wpo365/sync/after
The job's parameters
As soon as user synchronization has finished.
The hooks listed in the previous table will always fire and do additional configuration is required to fire the hooks.

Allow developer hooks to fire

The plugin provide three hooks that developers can use to build custom integrations with Microsoft Graph or Microsoft 365 services such as SharePoint Online, Yammer, Teams that extend the out-of-the-box functionality already provided by the WPO365 plugin.

  • When a user has just successfully signed in with Microsoft (action hook)
  • When a user has just successfully obtained an access (bearer) token (action hook).
  • When the plugin has finished analyzing reasons to skip authentication (filter hook).

To allow these three hooks to fire, an administrator must update the configuration of the WordPress website and add the following line to the wp-config.php file.

define( 'WPO_ALLOW_DEVELOPER_HOOKS', true );
	
immediately below the line
/* That's all, stop editing! Happy publishing. */
	

If you don’t add this line or add it but set it to false, the developer hooks will not fire.

Examples

Rather than providing an extensive documentation for these three hooks, developers instead can review the samples provided below in the form of a simple WordPress plugin.

Please note that the developer hooks are provided as is and there is no support offered.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us