Hooks for custom activity log add-ons in WP Activity Log

You are here:

When using WP Activity Log, you can develop your own activity log extension. You might need one to keep a log of changes that take place on a custom-built theme or plugin. Or you might want to keep a log of changes on a plugin that we do not support yet.

Building an activity log add-on for WP Activity Log is very simple. In this page we list the hooks you need to use when developing your own activity logs add-on to:

  • declare new event type and object (refer to activity log metadata for more information on what these are),
  • change the text and URL of the link to post editor in the event message

For more information and detailed code examples of how to develop custom activity log add-ons refer to the custom activity log events documentation.

Event types and objects hooks

Adding new event types

Filter: wsal_event_type_data
Purpose:
Use this filter to add a new event type in the activity log. This filter is passed as an array where the key is the event handle, and the value is the text to be shown in lists.

Code example

Adding new objects

Filter: wsal_event_objects
Purpose: The same process we have for event types applies to new objects. Use this  filter to add new objects to lists. Use the wsal_event_object_text filter to add the display text for the new objects used in other places, such as the viewer.

Code example

Hook to change the anchor text and URL of the editor link in the event message

When the plugin reports a change in a post or a user profile, it adds a link in the event message for the user to open the post in the editor or the user profile page. Such links are highlighted in the below screenshot:

The link to the editor or user profile in the activity log message

However, in your custom activity log add-on you might be monitoring something else, such as forms, or products. In such case use the below filter to change the anchor test and URL .

Filter: wsal_link_filter

Code example