Hooks

Actions and filters

With the help of hooks in WordPress you can modify how Simple History works. You can for example change who can see the log and customize what is logged.

Actions and filters are prefixed with simple_history/.

💡

For more information on how to use hooks in WordPress see the hooks documentation on wordpress.org.

Overview

Actions

Filters

Detailed info

Actions


simple_history/add_custom_dropin

Action that dropins can use to add their custom loggers.

See register_dropin() for more info.

do_action( 'simple_history/add_custom_dropin', array $arrDropinsToInstantiate )
  • array $arrDropinsToInstantiate Array with class names

simple_history/add_custom_dropin

Fires after the list of dropins to load are populated.

Can for example be used by dropins can to add their own custom loggers.

See register_dropin() for more info.

do_action( 'simple_history/add_custom_dropin', \SimpleHistory $this )
  • \SimpleHistory $this Simple History instance.

simple_history/add_custom_logger

Action that plugins can use to add their custom loggers.

See register_logger() for more info.

do_action( 'simple_history/add_custom_logger', \SimpleHistory  )
  • \SimpleHistory instance

simple_history/add_custom_logger

Fires after the list of loggers to load are populated.

Can for example be used by plugin to load their own custom loggers.

See register_logger() for more info.

do_action( 'simple_history/add_custom_logger', \SimpleHistory $this )
  • \SimpleHistory $this Simple History instance.

do_action( 'simple_history/admin_footer' )

do_action( 'simple_history/admin_footer' )

simple_history/admin_head

do_action( 'simple_history/admin_head' )

simple_history/admin_head

do_action( 'simple_history/admin_head' )

simple_history/after_init

Fires after Simple History has done it's init stuff

do_action( 'simple_history/after_init', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/after_init

Fires after Simple History has done it's init stuff

do_action( 'simple_history/after_init', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/before_init

Fires before Simple History does it's init stuff

do_action( 'simple_history/before_init', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/before_init

Fires before Simple History does it's init stuff

do_action( 'simple_history/before_init', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/dashboard/before_gui

do_action( 'simple_history/dashboard/before_gui' )

simple_history/dashboard/before_gui

do_action( 'simple_history/dashboard/before_gui' )

simple_history/dropin/sidebar/sidebar_html

Allows to output HTML in sidebar

do_action( 'simple_history/dropin/sidebar/sidebar_html' )

simple_history/dropin/sidebar/sidebar_html

Allows to output HTML in sidebar

do_action( 'simple_history/dropin/sidebar/sidebar_html' )

simple_history/enqueue_admin_scripts

Fires when the admin scripts have been enqueued.

Only fires on any of the pages where Simple History is used

do_action( 'simple_history/enqueue_admin_scripts', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/enqueue_admin_scripts

Fires when the admin scripts have been enqueued.

Only fires on any of the pages where Simple History is used

do_action( 'simple_history/enqueue_admin_scripts', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/history_page/after_gui

Fires after the gui div

do_action( 'simple_history/history_page/after_gui', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/history_page/after_gui

Fires after the gui div

do_action( 'simple_history/history_page/after_gui', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/history_page/before_gui

Fires before the gui div

do_action( 'simple_history/history_page/before_gui', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/history_page/before_gui

Fires before the gui div

do_action( 'simple_history/history_page/before_gui', \SimpleHistory $SimpleHistory )
  • \SimpleHistory $SimpleHistory This class.

simple_history/log/inserted

Fired after an event has been logged.

do_action( 'simple_history/log/inserted', array $context, array $data_parent_row, \SimpleLogger $this )
  • array $context Array with all context data that was used to log event.
  • array $data_parent_row Array with data used for parent row.
  • \SimpleLogger $this Reference to this logger instance.

simple_history/log/inserted

Action that is called after an event has been logged

do_action( 'simple_history/log/inserted', array $context, array $data, array $this )
  • array $context Array with all context data that was used to log event.
  • array $data Array with data used for parent row.
  • array $this Reference to this logger instance

simple_history/loggers_loaded

do_action( 'simple_history/loggers_loaded' )

simple_history/loggers_loaded

do_action( 'simple_history/loggers_loaded' )

Filters


SimpleHistoryFilterDropin/filter_default_loglevel

Filter to control what the default loglevels are.

apply_filters( 'SimpleHistoryFilterDropin/filter_default_loglevel', array  )
  • array Array with loglevel sugs. Default empty = show all.

SimpleHistoryFilterDropin/filter_default_loglevel

Filter to control what the default loglevels are.

apply_filters( 'SimpleHistoryFilterDropin/filter_default_loglevel', array  )
  • array Array with loglevel sugs. Default empty = show all.

SimpleHistoryFilterDropin/filter_default_search_string

Filter to control what the default search string is. Default to empty string.

apply_filters( 'SimpleHistoryFilterDropin/filter_default_search_string', string  )
  • string Default search string

SimpleHistoryFilterDropin/filter_default_search_string

Filter to control what the default search string is. Default to empty string.

apply_filters( 'SimpleHistoryFilterDropin/filter_default_search_string', string  )
  • string Default search string

SimpleHistoryFilterDropin/filter_default_user_ids

apply_filters( 'SimpleHistoryFilterDropin/filter_default_user_ids' )

SimpleHistoryFilterDropin/filter_default_user_ids

apply_filters( 'SimpleHistoryFilterDropin/filter_default_user_ids' )

SimpleHistoryFilterDropin/show_more_filters_on_load

Filter that determines if search filters should be visible directly on page load

Set to true to show the filters when page is loaded If false then user must click "Show options"

apply_filters( 'SimpleHistoryFilterDropin/show_more_filters_on_load', bool $show_more_filters_on_load )
  • bool $show_more_filters_on_load Default false

SimpleHistoryFilterDropin/show_more_filters_on_load

Filter that determines if search filters should be visible directly on page load

Set to true to show the filters when page is loaded If false then user must click "Show options"

apply_filters( 'SimpleHistoryFilterDropin/show_more_filters_on_load', bool $show_more_filters_on_load )
  • bool $show_more_filters_on_load Default false

SimpleHistoryNewRowsNotifier/interval

apply_filters( 'SimpleHistoryNewRowsNotifier/interval' )

SimpleHistoryNewRowsNotifier/interval

apply_filters( 'SimpleHistoryNewRowsNotifier/interval' )

get_avatar

Filter the avatar to retrieve.

Same filter WordPress uses

apply_filters( 'get_avatar', string $avatar, int|object|string $id_or_email, int $size, string $alt )
  • string $avatar Image tag for the user's avatar.
  • int|object|string $id_or_email A user ID, email address, or comment object.
  • int $size Square avatar width and height in pixels to retrieve.
  • string $alt Alternative text to use in the avatar image tag. Default empty.

plugin_locale

apply_filters( 'plugin_locale' )

plugin_locale

apply_filters( 'plugin_locale' )

simple_history/SidebarDropin/default_sidebar_boxes

Filter the default boxes to output in the sidebar

apply_filters( 'simple_history/SidebarDropin/default_sidebar_boxes', array $arrBoxes )
  • array $arrBoxes array with boxes to output. Check the key to determine which box is which.

simple_history/SidebarDropin/default_sidebar_boxes

Filter the default boxes to output in the sidebar

apply_filters( 'simple_history/SidebarDropin/default_sidebar_boxes', array $arrBoxes )
  • array $arrBoxes array with boxes to output. Check the key to determine which box is which.

simple_history/add_admin_bar_menu_item

Filter to control if admin bar shortcut should be added

apply_filters( 'simple_history/add_admin_bar_menu_item', bool  )
  • bool Add item

simple_history/add_admin_bar_menu_item

Filter to control if admin bar shortcut should be added

apply_filters( 'simple_history/add_admin_bar_menu_item', bool  )
  • bool Add item

simple_history/add_admin_bar_network_menu_item

Filter to control if admin bar shortcut should be added

apply_filters( 'simple_history/add_admin_bar_network_menu_item', bool  )
  • bool Add item

simple_history/add_admin_bar_network_menu_item

Filter to control if admin bar shortcut should be added

apply_filters( 'simple_history/add_admin_bar_network_menu_item', bool  )
  • bool Add item

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/admin_location

apply_filters( 'simple_history/admin_location' )

simple_history/allow_db_purge

apply_filters( 'simple_history/allow_db_purge' )

simple_history/allow_db_purge

apply_filters( 'simple_history/allow_db_purge' )

simple_history/categories_logger/skip_taxonomies

apply_filters( 'simple_history/categories_logger/skip_taxonomies' )

simple_history/categories_logger/skip_taxonomies

apply_filters( 'simple_history/categories_logger/skip_taxonomies' )

simple_history/comments_logger/include_spam

Filter option to include spam or not in the gui By default spam is not included, because it can fill the log with too much events

apply_filters( 'simple_history/comments_logger/include_spam', bool $include_spam )
  • bool $include_spam Default false

simple_history/comments_logger/include_spam

Filter option to include spam or not in the gui By default spam is not included, because it can fill the log with too much events

apply_filters( 'simple_history/comments_logger/include_spam', bool $include_spam )
  • bool $include_spam Default false

simple_history/comments_logger/log_failed_password

Maybe store password too Default is to not do this because of privacy and security

apply_filters( 'simple_history/comments_logger/log_failed_password', bool $log_password )
  • bool $log_password

simple_history/comments_logger/log_failed_password

Maybe store password too Default is to not do this because of privacy and security

apply_filters( 'simple_history/comments_logger/log_failed_password', bool $log_password )
  • bool $log_password

simple_history/comments_logger/log_not_existing_user_password

Maybe store password too Default is to not do this because of privacy and security

apply_filters( 'simple_history/comments_logger/log_not_existing_user_password', bool $log_password )
  • bool $log_password

simple_history/comments_logger/log_not_existing_user_password

Maybe store password too Default is to not do this because of privacy and security

apply_filters( 'simple_history/comments_logger/log_not_existing_user_password', bool $log_password )
  • bool $log_password

simple_history/comments_logger/row_details_plugin_info_keys

Fires immediately after a comment is updated in the database.

The hook also fires immediately before comment status transition hooks are fired.

apply_filters( 'simple_history/comments_logger/row_details_plugin_info_keys' )

simple_history/comments_logger/row_details_plugin_info_keys

Fires immediately after a comment is updated in the database.

The hook also fires immediately before comment status transition hooks are fired.

apply_filters( 'simple_history/comments_logger/row_details_plugin_info_keys' )

simple_history/dashboard_pager_size

Filter the pager size setting for the dashboard

apply_filters( 'simple_history/dashboard_pager_size', int $pager_size )
  • int $pager_size

simple_history/dashboard_pager_size

Filter the pager size setting for the dashboard

apply_filters( 'simple_history/dashboard_pager_size', int $pager_size )
  • int $pager_size

simple_history/db_purge_days_interval

Filter to modify number of days of history to keep.

Default is 60 days.

apply_filters( 'simple_history/db_purge_days_interval', int $days )
  • int $days Number of days of history to keep
Example usage
Keep only the most recent 7 days in the log.

```php
add_filter( "simple_history/db_purge_days_interval", function( $days ) {
     $days = 7;
     return $days;
 } );
```
Expand the log to keep 90 days in the log.

```php
add_filter( "simple_history/db_purge_days_interval", function( $days ) {
     $days = 90;
     return $days;
 } );
```

simple_history/db_purge_days_interval

apply_filters( 'simple_history/db_purge_days_interval' )

simple_history/db_table

Filter db table used for simple history events

apply_filters( 'simple_history/db_table', string $db_table )
  • string $db_table

simple_history/db_table

Filter db table used for simple history events

apply_filters( 'simple_history/db_table', string $db_table )
  • string $db_table

simple_history/dropin/load_dropin

Filter to completely skip loading of a dropin

apply_filters( 'simple_history/dropin/load_dropin', bool , string  )
  • bool if to load the dropin. return false to not load it.
  • string slug of dropin

simple_history/dropin/load_dropin

Filter to completely skip loading of a dropin

apply_filters( 'simple_history/dropin/load_dropin', bool , string  )
  • bool if to load the dropin. return false to not load it.
  • string slug of dropin

simple_history/dropin/load_dropin_{$oneDropinFileBasename}

Filter to completely skip loading of dropin complete filer name will be like: simple_history/dropin/load_dropin_SimpleHistoryRSSDropin

apply_filters( 'simple_history/dropin/load_dropin_{$oneDropinFileBasename}', bool  )
  • bool if to load the dropin. return false to not load it.

simple_history/dropin/load_dropin_{$oneDropinFileBasename}

Filter to completely skip loading of dropin complete filer name will be like: simple_history/dropin/load_dropin_SimpleHistoryRSSDropin

apply_filters( 'simple_history/dropin/load_dropin_{$oneDropinFileBasename}', bool  )
  • bool if to load the dropin. return false to not load it.

simple_history/dropins_files

Filter the array with absolute paths to files as returned by glob function.

Each file will be loaded and will be assumed to be a dropin with a classname the same as the filename.

apply_filters( 'simple_history/dropins_files', array $dropinsFiles )
  • array $dropinsFiles Array with filenames

simple_history/dropins_files

Filter the array with absolute paths to files as returned by glob function.

Each file will be loaded and will be assumed to be a dropin with a classname the same as the filename.

apply_filters( 'simple_history/dropins_files', array $dropinsFiles )
  • array $dropinsFiles Array with filenames

simple_history/dropins_to_instantiate

Filter the array with names of dropin to instantiate.

apply_filters( 'simple_history/dropins_to_instantiate', array $arrDropinsToInstantiate )
  • array $arrDropinsToInstantiate Array with class names

simple_history/dropins_to_instantiate

Filter the array with names of dropin to instantiate.

apply_filters( 'simple_history/dropins_to_instantiate', array $arrDropinsToInstantiate )
  • array $arrDropinsToInstantiate Array with class names

simple_history/header_initiator_html_existing_user

Filter the format for the user output

apply_filters( 'simple_history/header_initiator_html_existing_user', string $format. )
  • string $format.

simple_history/header_initiator_html_existing_user

Filter the format for the user output

apply_filters( 'simple_history/header_initiator_html_existing_user', string $format. )
  • string $format.

simple_history/header_initiator_use_you

apply_filters( 'simple_history/header_initiator_use_you' )

simple_history/header_initiator_use_you

apply_filters( 'simple_history/header_initiator_use_you' )

simple_history/header_just_now_max_time

Filter how many seconds as most that can pass since an event occurred to show "just now" instead of exact date

apply_filters( 'simple_history/header_just_now_max_time', int $time_ago_max_time )
  • int $time_ago_max_time Seconds

simple_history/header_just_now_max_time

Filter how many seconds as most that can pass since an event occured to show "just now" instead of exact date

apply_filters( 'simple_history/header_just_now_max_time', int $time_ago_max_time )
  • int $time_ago_max_time Seconds

simple_history/header_time_ago_max_time

Filter how many seconds as most that can pass since an event occurred to show "nn minutes ago" (human diff time-format) instead of exact date

apply_filters( 'simple_history/header_time_ago_max_time', int $time_ago_max_time )
  • int $time_ago_max_time Seconds

simple_history/header_time_ago_max_time

Filter how many seconds as most that can pass since an event occured to show "nn minutes ago" (human diff time-format) instead of exact date

apply_filters( 'simple_history/header_time_ago_max_time', int $time_ago_max_time )
  • int $time_ago_max_time Seconds

simple_history/log/do_log

Filter that makes it possible to shortcut the logging of a message.

Return bool false to cancel logging .

apply_filters( 'simple_history/log/do_log', bool $doLog, string $level, string $message, array $context, \SimpleLogger $this )
  • bool $doLog Wheter to log or not.
  • string $level The loglevel.
  • string $message The log message.
  • array $context The message context.
  • \SimpleLogger $this Logger instance.
Example usage
Do not log some post types, for example pages and attachments in this case

```php
 add_filter(
     'simple_history/log/do_log',
     function ( $do_log = null, $level = null, $message = null, $context = null, $logger = null ) {

         $post_types_to_not_log = array(
             'page',
             'attachment',
         );

         if ( ( isset( $logger->slug ) && ( $logger->slug === 'SimplePostLogger' || $logger->slug === 'SimpleMediaLogger' ) ) && ( isset( $context['post_type'] ) && in_array( $context['post_type'], $post_types_to_not_log ) ) ) {
             $do_log = false;
         }

         return $do_log;
     },
     10,
     5
 );
```
Disable all logging

```php
 // Disable all logging
 add_filter( 'simple_history/log/do_log', '__return_false' );
```

simple_history/log/do_log

Filter that makes it possible to shortcut this log.

Return bool false to cancel.

apply_filters( 'simple_history/log/do_log' )

simple_history/log/do_log/{$this->slug}

Easy shortcut method to disable logging of messages from a specific logger.

Example filter name: simple_history/log/do_log/SimpleUserLogger simple_history/log/do_log/SimplePostLogger

Example to disable logging of any user login/logout/failed login activity: add_filter('simple_history/log/do_log/SimpleUserLogger', '__return_false')

apply_filters( 'simple_history/log/do_log/{$this->slug}' )

simple_history/log/do_log/{$this->slug}

Easy shortcut method to disable logging of messages from a specific logger.

Example filter name: simple_history/log/do_log/SimpleUserLogger simple_history/log/do_log/SimplePostLogger

Example to disable logging of any user login/logout/failed login activity: add_filter('simple_history/log/do_log/SimpleUserLogger', '__return_false')

apply_filters( 'simple_history/log/do_log/{$this->slug}' )

simple_history/log/do_log/{$this->slug}/{$message_key}

Easy shortcut method to disable logging of messages from a specific logger and message.

Example filter name: simple_history/log/do_log/SimpleUserLogger/user_logged_in simple_history/log/do_log/SimplePostLogger/post_updated

apply_filters( 'simple_history/log/do_log/{$this->slug}/{$message_key}' )

simple_history/log/do_log/{$this->slug}/{$message_key}

Easy shortcut method to disable logging of messages from a specific logger and message.

Example filter name: simple_history/log/do_log/SimpleUserLogger/user_logged_in simple_history/log/do_log/SimplePostLogger/post_updated

apply_filters( 'simple_history/log/do_log/{$this->slug}/{$message_key}' )

simple_history/log_argument/context

apply_filters( 'simple_history/log_argument/context' )

simple_history/log_argument/context

apply_filters( 'simple_history/log_argument/context' )

simple_history/log_argument/level

apply_filters( 'simple_history/log_argument/level' )

simple_history/log_argument/level

apply_filters( 'simple_history/log_argument/level' )

simple_history/log_argument/message

apply_filters( 'simple_history/log_argument/message' )

simple_history/log_argument/message

apply_filters( 'simple_history/log_argument/message' )

simple_history/log_arguments

Filter arguments passed to log function

apply_filters( 'simple_history/log_arguments', string $level, string $message, array $context, object  )
  • string $level
  • string $message
  • array $context
  • object SimpleLogger object

simple_history/log_arguments

Filter arguments passed to log funtion

apply_filters( 'simple_history/log_arguments', string $level, string $message, array $context, object  )
  • string $level
  • string $message
  • array $context
  • object SimpleLogger object

simple_history/log_html_output_details_single/html_after_context_table

apply_filters( 'simple_history/log_html_output_details_single/html_after_context_table' )

simple_history/log_html_output_details_single/html_after_context_table

apply_filters( 'simple_history/log_html_output_details_single/html_after_context_table' )

simple_history/log_html_output_details_single/html_before_context_table

apply_filters( 'simple_history/log_html_output_details_single/html_before_context_table' )

simple_history/log_html_output_details_single/html_before_context_table

apply_filters( 'simple_history/log_html_output_details_single/html_before_context_table' )

simple_history/log_html_output_details_table/context_keys_to_show

Filter what keys to show from the row context.

Array is in format:

  Array
  (
      [plugin_slug] => 1
      [plugin_name] => 1
      [plugin_title] => 1
      [plugin_description] => 1
      [plugin_author] => 1
      [plugin_version] => 1
      ...
  )
apply_filters( 'simple_history/log_html_output_details_table/context_keys_to_show', array , object  )
  • array with keys to show. key to show = key. value = boolean to show or not.
  • object log row to show details from
Example usage
Hide some more columns from the detailed context view popup window

```php
 add_filter(
     'simple_history/log_html_output_details_table/context_keys_to_show',
     function ( $logRowContextKeysToShow, $oneLogRow ) {

         $logRowContextKeysToShow['plugin_slug'] = false;
         $logRowContextKeysToShow['plugin_name'] = false;
         $logRowContextKeysToShow['plugin_title'] = false;
         $logRowContextKeysToShow['plugin_description'] = false;

         return $logRowContextKeysToShow;
     },
     10,
     2
 );
```

simple_history/log_html_output_details_table/context_keys_to_show

Filter what keys to show from the row context

Array is in format

Array ( [plugin_slug] => 1 [plugin_name] => 1 [plugin_title] => 1 [plugin_description] => 1 [plugin_author] => 1 [plugin_version] => 1 ... )

apply_filters( 'simple_history/log_html_output_details_table/context_keys_to_show', array , object  )
  • array with keys to show. key to show = key. value = boolean to show or not.
  • object log row to show details from

simple_history/log_html_output_details_table/row_keys_to_show

Filter what keys to show from oneLogRow

Array is in format

 Array
  (
      [id] => 1
      [logger] => 1
      [level] => 1
      ...
  )
apply_filters( 'simple_history/log_html_output_details_table/row_keys_to_show', array , object  )
  • array with keys to show. key to show = key. value = boolean to show or not.
  • object log row to show details from
Example usage
Hide some columns from the detailed context view popup window

```php
 add_filter(
     'simple_history/log_html_output_details_table/row_keys_to_show',
     function ( $logRowKeysToShow, $oneLogRow ) {

         $logRowKeysToShow['id'] = false;
         $logRowKeysToShow['logger'] = false;
         $logRowKeysToShow['level'] = false;
         $logRowKeysToShow['message'] = false;

         return $logRowKeysToShow;
     },
     10,
     2
 );
```

simple_history/log_html_output_details_table/row_keys_to_show

Filter what keys to show from oneLogRow

Array is in format

Array ( [id] => 1 [logger] => 1 [level] => 1 ... )

apply_filters( 'simple_history/log_html_output_details_table/row_keys_to_show', array , object  )
  • array with keys to show. key to show = key. value = boolean to show or not.
  • object log row to show details from

simple_history/log_insert_context

Filters the context to store for this event/row

apply_filters( 'simple_history/log_insert_context', array $context, array $data, array $this )
  • array $context Array with all context data to store. Modify and return this.
  • array $data Array with data used for parent row.
  • array $this Reference to this logger instance.
Example usage
Skip adding things to the context table during logging.
Useful if you don't want to add cool and possible super useful info to your logged events.
Also nice to have if you want to make sure your database does not grow.

```php
 add_filter(
     'simple_history/log_insert_context',
     function ( $context, $data ) {
         unset( $context['_user_id'] );
         unset( $context['_user_login'] );
         unset( $context['_user_email'] );
         unset( $context['server_http_user_agent'] );

         return $context;
     },
     10,
     2
 );
```

simple_history/log_insert_context

Filter the context to store for this event/row

apply_filters( 'simple_history/log_insert_context', array $context, array $data, array $this )
  • array $context Array with all context data to store. Modify and return this.
  • array $data Array with data used for parent row.
  • array $this Reference to this logger instance.

simple_history/log_insert_data

Filter data to be saved to db.

apply_filters( 'simple_history/log_insert_data', array $data )
  • array $data

simple_history/log_insert_data

Filter data to be saved to db.

apply_filters( 'simple_history/log_insert_data', array $data )
  • array $data

simple_history/log_query_inner_where

Filter the sql template limit

apply_filters( 'simple_history/log_query_inner_where', string $limit )
  • string $limit

simple_history/log_query_inner_where

Filter the sql template limit

apply_filters( 'simple_history/log_query_inner_where', string $limit )
  • string $limit

simple_history/log_query_limit

Filter the sql template limit

apply_filters( 'simple_history/log_query_limit', string $limit )
  • string $limit

simple_history/log_query_limit

Filter the sql template limit

apply_filters( 'simple_history/log_query_limit', string $limit )
  • string $limit

simple_history/log_query_sql

Filter the final sql query

apply_filters( 'simple_history/log_query_sql', string $sql )
  • string $sql

simple_history/log_query_sql

Filter the final sql query

apply_filters( 'simple_history/log_query_sql', string $sql )
  • string $sql

simple_history/log_query_sql_template

Filter the sql template

apply_filters( 'simple_history/log_query_sql_template', string $sql_tmpl )
  • string $sql_tmpl

simple_history/log_query_sql_template

Filter the sql template

apply_filters( 'simple_history/log_query_sql_template', string $sql_tmpl )
  • string $sql_tmpl

simple_history/log_query_sql_where

Filter the sql template where clause

apply_filters( 'simple_history/log_query_sql_where', string $where )
  • string $where

simple_history/log_query_sql_where

Filter the sql template where clause

apply_filters( 'simple_history/log_query_sql_where', string $where )
  • string $where

simple_history/logger/interpolate/context

Filters the context used to create the message from the message template.

Can be used to modify the variables sent to the message template.

apply_filters( 'simple_history/logger/interpolate/context', array $context, string $message, array $row )
  • array $context
  • string $message
  • array $row The row. Not supported by all loggers.
Example usage
Example that modifies the parameters sent to the message template.

This example will change the post type from "post" or "page" or similar to "my own page type".

 ```php
 add_filter(
     'simple_history/logger/interpolate/context',
     function ( $context, $message, $row ) {

         if ( empty( $row ) ) {
             return $context;
         }

         if ( $row->logger == 'SimplePostLogger' && $row->context_message_key == 'post_updated' ) {
             $context['post_type'] = 'my own page type';
         }

         return $context;
     },
     10,
     3
 );
```

simple_history/logger/interpolate/context

Filter the context used to create the message from the message template

apply_filters( 'simple_history/logger/interpolate/context' )

simple_history/logger/load_logger

Filter to completely skip loading of a logger

apply_filters( 'simple_history/logger/load_logger', bool , string  )
  • bool if to load the logger. return false to not load it.
  • string basename of logger, i.e. "SimpleCommentsLogger" or "class-privacy-logger"

simple_history/logger/load_logger

Filter to completely skip loading of a logger

apply_filters( 'simple_history/logger/load_logger', bool , string  )
  • bool if to load the logger. return false to not load it.
  • string basename of logger, i.e. "SimpleCommentsLogger" or "class-privacy-logger"

simple_history/logger_db_table_contexts

Filter table name for contexts.

apply_filters( 'simple_history/logger_db_table_contexts', string $db_table_contexts )
  • string $db_table_contexts

simple_history/logger_db_table_contexts

Filter table name for contexts.

apply_filters( 'simple_history/logger_db_table_contexts', string $db_table_contexts )
  • string $db_table_contexts

simple_history/loggers_files

Filter the array with absolute paths to logger files to be loaded.

Each file will be loaded and will be assumed to be a logger with a classname the same as the filename.

apply_filters( 'simple_history/loggers_files', array $loggersFiles )
  • array $loggersFiles Array with filenames

simple_history/loggers_files

Filter the array with absolute paths to logger files to be loaded.

Each file will be loaded and will be assumed to be a logger with a classname the same as the filename.

apply_filters( 'simple_history/loggers_files', array $loggersFiles )
  • array $loggersFiles Array with filenames

simple_history/loggers_to_instantiate

Filter the array with names of loggers to instantiate.

Array ( [0] => SimpleCommentsLogger [1] => SimpleCoreUpdatesLogger ... )

apply_filters( 'simple_history/loggers_to_instantiate', array $arr_loggers_to_instantiate )
  • array $arr_loggers_to_instantiate Array with class names

simple_history/loggers_to_instantiate

Filter the array with names of loggers to instantiate.

Array ( [0] => SimpleCommentsLogger [1] => SimpleCoreUpdatesLogger ... )

apply_filters( 'simple_history/loggers_to_instantiate', array $arr_loggers_to_instantiate )
  • array $arr_loggers_to_instantiate Array with class names

simple_history/loggers_user_can_read

Fires before Simple History does it's init stuff

apply_filters( 'simple_history/loggers_user_can_read', array $arr_loggers_user_can_view, int  )
  • array $arr_loggers_user_can_view Array with loggers that user $user_id can read
  • int user_id ID of user to check read capability for

simple_history/loggers_user_can_read

Fires before Simple History does it's init stuff

apply_filters( 'simple_history/loggers_user_can_read', array $arr_loggers_user_can_view, int  )
  • array $arr_loggers_user_can_view Array with loggers that user $user_id can read
  • int user_id ID of user to check read capability for

simple_history/loggers_user_can_read/can_read_single_logger

Filters who can read/view the messages from a single logger.

apply_filters( 'simple_history/loggers_user_can_read/can_read_single_logger', bool , \SimpleLogger , int $user_id )
  • bool Wheter the user is allowed to view the logger.
  • \SimpleLogger Logger instance.
  • int $user_id Id of user.
Example usage
Modify who can read a logger.

```php
// Modify who can read a logger.
// Modify the if part to give users access or no access to a logger.
add_filter(
  'simple_history/loggers_user_can_read/can_read_single_logger',
  function ( $user_can_read_logger, $logger_instance, $user_id ) {
    // in this example user with id 3 gets access to the post logger
    // while user with id 8 does not get any access to it
    if ( $logger_instance->slug == 'SimplePostLogger' && $user_id === 3 ) {
      $user_can_read_logger = true;
    } elseif ( $logger_instance->slug == 'SimplePostLogger' && $user_id === 9 ) {
      $user_can_read_logger = false;
    }

     return $user_can_read_logger;
   },
 10,
 3
);
```

simple_history/loggers_user_can_read/can_read_single_logger

apply_filters( 'simple_history/loggers_user_can_read/can_read_single_logger' )

simple_history/logrowhtmloutput/classes

Filter to modify classes added to item li element

apply_filters( 'simple_history/logrowhtmloutput/classes',  $classes )

    simple_history/logrowhtmloutput/classes

    Filter to modify classes added to item li element

    apply_filters( 'simple_history/logrowhtmloutput/classes',  $classes )

      simple_history/page_pager_size

      Filter the pager size setting for the history page

      apply_filters( 'simple_history/page_pager_size', int $pager_size )
      • int $pager_size

      simple_history/page_pager_size

      Filter the pager size setting for the history page

      apply_filters( 'simple_history/page_pager_size', int $pager_size )
      • int $pager_size

      simple_history/pager_size

      Filter the pager size setting

      apply_filters( 'simple_history/pager_size', int $pager_size )
      • int $pager_size

      simple_history/pager_size

      Filter the pager size setting

      apply_filters( 'simple_history/pager_size', int $pager_size )
      • int $pager_size

      simple_history/pager_size_dashboard

      Filter the pager size setting

      apply_filters( 'simple_history/pager_size_dashboard', int $pager_size )
      • int $pager_size

      simple_history/pager_size_dashboard

      Filter the pager size setting

      apply_filters( 'simple_history/pager_size_dashboard', int $pager_size )
      • int $pager_size

      simple_history/plugin_logger/row_details_plugin_info_keys

      For bulk updates $arr_data looks like: Array ( [action] => update [type] => plugin [bulk] => 1 [plugins] => Array ( [0] => plugin-folder-1/plugin-index.php [1] => my-plugin-folder/my-plugin.php ) )

      apply_filters( 'simple_history/plugin_logger/row_details_plugin_info_keys' )

      simple_history/plugin_logger/row_details_plugin_info_keys

      For bulk updates $arr_data looks like: Array ( [action] => update [type] => plugin [bulk] => 1 [plugins] => Array ( [0] => plugin-folder-1/plugin-index.php [1] => my-plugin-folder/my-plugin.php ) )

      apply_filters( 'simple_history/plugin_logger/row_details_plugin_info_keys' )

      simple_history/post_logger/context

      Filter to control context sent to the diff output.

      apply_filters( 'simple_history/post_logger/context', array $context, array $old_data, array $new_data, array $old_meta, array $new_meta )
      • array $context Array with context.
      • array $old_data Old/prev post data.
      • array $new_data New post data.
      • array $old_meta Old/prev post meta data.
      • array $new_meta New post meta data.

      simple_history/post_logger/context

      Filter to control context sent to the diff output.

      apply_filters( 'simple_history/post_logger/context', array $context, array $old_data, array $new_data, array $old_meta, array $new_meta )
      • array $context Array with context.
      • array $old_data Old/prev post data.
      • array $new_data New post data.
      • array $old_meta Old/prev post meta data.
      • array $new_meta New post meta data.

      simple_history/post_logger/keys_to_diff

      apply_filters( 'simple_history/post_logger/keys_to_diff' )

      simple_history/post_logger/keys_to_diff

      apply_filters( 'simple_history/post_logger/keys_to_diff' )

      simple_history/post_logger/label_for_key

      apply_filters( 'simple_history/post_logger/label_for_key' )

      simple_history/post_logger/label_for_key

      apply_filters( 'simple_history/post_logger/label_for_key' )

      simple_history/post_logger/post_deleted/ok_to_log

      Filter to control logging.

      apply_filters( 'simple_history/post_logger/post_deleted/ok_to_log', bool $ok_to_log, int $post_id )
      • bool $ok_to_log If this post deletion should be logged.
      • int $post_id

      simple_history/post_logger/post_deleted/ok_to_log

      Filter to control logging.

      apply_filters( 'simple_history/post_logger/post_deleted/ok_to_log', bool $ok_to_log, int $post_id )
      • bool $ok_to_log If this post deletion should be logged.
      • int $post_id

      simple_history/post_logger/post_types

      Filter the post types we are logging information from.

      apply_filters( 'simple_history/post_logger/post_types', array $post_types )
      • array $post_types Core, public and private post types.

      simple_history/post_logger/post_types

      Filter the post types we are logging information from.

      apply_filters( 'simple_history/post_logger/post_types', array $post_types )
      • array $post_types Core, public and private post types.

      simple_history/post_logger/post_updated/context

      Modify the context saved.

      apply_filters( 'simple_history/post_logger/post_updated/context', array $context, \WP_Post $post )
      • array $context
      • \WP_Post $post

      simple_history/post_logger/post_updated/context

      Modify the context saved.

      apply_filters( 'simple_history/post_logger/post_updated/context', array $context, \WP_Post $post )
      • array $context
      • \WP_Post $post

      simple_history/post_logger/post_updated/diff_table_output

      Modify the formatted diff output of a saved/modified post

      apply_filters( 'simple_history/post_logger/post_updated/diff_table_output', string $diff_table_output, array $context )
      • string $diff_table_output
      • array $context

      simple_history/post_logger/post_updated/diff_table_output

      Modify the formatted diff output of a saved/modified post

      apply_filters( 'simple_history/post_logger/post_updated/diff_table_output', string $diff_table_output, array $context )
      • string $diff_table_output
      • array $context

      simple_history/post_logger/post_updated/ok_to_log

      Filter to control logging.

      apply_filters( 'simple_history/post_logger/post_updated/ok_to_log', bool $ok_to_log,  $new_status,  $old_status,  $post )
      • bool $ok_to_log

      simple_history/post_logger/post_updated/ok_to_log

      Filter to control logging.

      apply_filters( 'simple_history/post_logger/post_updated/ok_to_log', bool $ok_to_log,  $new_status,  $old_status,  $post )
      • bool $ok_to_log

      simple_history/post_logger/skip_posttypes

      Filter to log what post types not to log

      apply_filters( 'simple_history/post_logger/skip_posttypes' )

      simple_history/post_logger/skip_posttypes

      Filter to log what post types not to log

      apply_filters( 'simple_history/post_logger/skip_posttypes' )

      simple_history/privacy/anonymize_ip_address

      Filter to control if ip addresses should be anonymized or not.

      Defaults to true, meaning that any IP address is anonymized.

      apply_filters( 'simple_history/privacy/anonymize_ip_address', bool  )
      • bool true to anonymize ip address, false to keep original ip address.
      Example usage
      Disable IP anonymization.
      
      ```php
      add_filter( 'simple_history/privacy/anonymize_ip_address', '__return_false' );
      ```

      simple_history/privacy/anonymize_ip_address

      Filter to control if ip addresses should be anonymized or not.

      apply_filters( 'simple_history/privacy/anonymize_ip_address', bool  )
      • bool true to anonymize ip address, false to keep original ip address.

      simple_history/quick_stats_where

      apply_filters( 'simple_history/quick_stats_where' )

      simple_history/quick_stats_where

      apply_filters( 'simple_history/quick_stats_where' )

      simple_history/row_details_output

      Filter generated output for details

      apply_filters( 'simple_history/row_details_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_details_output

      Filter generated output for details

      apply_filters( 'simple_history/row_details_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_header_date_output

      Filter the output of the date section of the header.

      apply_filters( 'simple_history/row_header_date_output', string $date_html, object $row )
      • string $date_html
      • object $row

      simple_history/row_header_date_output

      Filter the output of the date section of the header.

      apply_filters( 'simple_history/row_header_date_output', string $date_html, object $row )
      • string $date_html
      • object $row

      simple_history/row_header_initiator_output

      Filter generated html for the initiator row header html

      apply_filters( 'simple_history/row_header_initiator_output', string $initiator_html, object $row )
      • string $initiator_html
      • object $row Log row

      simple_history/row_header_initiator_output

      Filter generated html for the initiator row header html

      apply_filters( 'simple_history/row_header_initiator_output', string $initiator_html, object $row )
      • string $initiator_html
      • object $row Log row

      simple_history/row_header_output

      Filter generated html for the log row header.

      apply_filters( 'simple_history/row_header_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_header_output

      Filter generated html for the log row header.

      apply_filters( 'simple_history/row_header_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_header_output/display_ip_address

      Filter if IP Address should be added to header row.

      apply_filters( 'simple_history/row_header_output/display_ip_address', bool , object $row )
      • bool True to show IP address, false to hide it. Defaults to false.
      • object $row Row data

      simple_history/row_header_output/display_ip_address

      Filter if IP Address should be added to header row.

      apply_filters( 'simple_history/row_header_output/display_ip_address', bool , object $row )
      • bool True to show IP address, false to hide it. Defaults to false.
      • object $row Row data

      simple_history/row_header_output/template

      Filter template used to glue together markup the log row header.

      apply_filters( 'simple_history/row_header_output/template', string $template, object $row )
      • string $template
      • object $row Log row

      simple_history/row_header_output/template

      Filter template used to glue together markup the log row header.

      apply_filters( 'simple_history/row_header_output/template', string $template, object $row )
      • string $template
      • object $row Log row

      simple_history/row_plain_text_output

      Filter generated output for plain text output

      apply_filters( 'simple_history/row_plain_text_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_plain_text_output

      Filter generated output for plain text output

      apply_filters( 'simple_history/row_plain_text_output', string $html, object $row )
      • string $html
      • object $row Log row

      simple_history/row_sender_image_output

      Filter generated output for row image (sender image)

      apply_filters( 'simple_history/row_sender_image_output', string $sender_image_html, object $row )
      • string $sender_image_html
      • object $row Log row

      simple_history/row_sender_image_output

      Filter generated output for row image (sender image)

      apply_filters( 'simple_history/row_sender_image_output', string $sender_image_html, object $row )
      • string $sender_image_html
      • object $row Log row

      simple_history/rss_feed_args

      Filters the arguments passed to `SimpleHistoryLogQuery()` when fetching the RSS feed

      apply_filters( 'simple_history/rss_feed_args', array $args )
      • array $args SimpleHistoryLogQuery arguments.
      Example usage
      Change number of posts to retreieve in RSS feed.
      
      // This example changes the number of posts in the RSS feed to 50 from the default 10.
      
      ```php
       add_filter(
         'simple_history/rss_feed_args',
           function( $args ) {
             $args['posts_per_page'] = 50;
             return $args;
          }
      );
      Change number of posts to retreieve in RSS feed.
      
      // This example changes the number of posts in the RSS feed to 20 from the default 10.
      
      ```php
       add_filter(
         'simple_history/rss_feed_args',
           function( $args ) {
             $args['posts_per_page'] = 20;
             return $args;
          }
      );

      simple_history/rss_feed_args

      apply_filters( 'simple_history/rss_feed_args' )

      simple_history/rss_feed_show

      Start new section for RSS feed

      apply_filters( 'simple_history/rss_feed_show' )

      simple_history/rss_feed_show

      Start new section for RSS feed

      apply_filters( 'simple_history/rss_feed_show' )

      Filter the guid/link URL used in RSS feed.

      Link will be esc_url'ed by simple history, so no need to do that in your filter

      apply_filters( 'simple_history/rss_item_link', string $item_guid, object $row )
      • string $item_guid link.
      • object $row

      Filter the guid/link URL used in RSS feed.

      Link will be esc_url'ed by simple history, so no need to do that in your filter

      apply_filters( 'simple_history/rss_item_link', string $item_guid, object $row )
      • string $item_guid link.
      • object $row

      simple_history/settings_page_pager_size

      Filter the pager size setting for the settings page

      apply_filters( 'simple_history/settings_page_pager_size', int $pager_size )
      • int $pager_size

      simple_history/settings_page_pager_size

      Filter the pager size setting for the settings page

      apply_filters( 'simple_history/settings_page_pager_size', int $pager_size )
      • int $pager_size

      simple_history/show_avatars

      Filter to control if avatars should be displayed, even if the show_avatars option is set to false in WordPress discussion settings.

      apply_filters( 'simple_history/show_avatars', bool  )
      • bool Force display. Default false.
      Example usage
      Force display of Gravatars
      
      ```php
       add_filter(
           'simple_history/show_avatars',
           function ( $force ) {
               $force = true;
               return $force;
           }
       );
      ```

      simple_history/show_dashboard_page

      Filter to determine if history page should be added to page below dashboard or not

      apply_filters( 'simple_history/show_dashboard_page', bool  )
      • bool Show the page or not

      simple_history/show_dashboard_page

      Filter to determine if history page should be added to page below dashboard or not

      apply_filters( 'simple_history/show_dashboard_page', bool  )
      • bool Show the page or not

      simple_history/show_dashboard_widget

      Filter to determine if history page should be added to page below dashboard or not

      apply_filters( 'simple_history/show_dashboard_widget', bool  )
      • bool Show the page or not

      simple_history/show_dashboard_widget

      Filter to determine if history page should be added to page below dashboard or not

      apply_filters( 'simple_history/show_dashboard_widget', bool  )
      • bool Show the page or not

      simple_history/show_settings_page

      apply_filters( 'simple_history/show_settings_page' )

      simple_history/show_settings_page

      apply_filters( 'simple_history/show_settings_page' )

      simple_history/simple_logger/log_message_key

      Filter so plugins etc. can shortut logging

      apply_filters( 'simple_history/simple_logger/log_message_key', true , string , string , string , array  )
      • true yes, we default to do the logging
      • string logger slug
      • string messageKey
      • string log level
      • array context

      simple_history/simple_logger/log_message_key

      Filter so plugins etc. can shortcut logging

      apply_filters( 'simple_history/simple_logger/log_message_key', true , string , string , string , array  )
      • true yes, we default to do the logging
      • string logger slug
      • string messageKey
      • string log level
      • array context

      simple_history/user_can_clear_log

      Allows controlling who can manually clear the log.

      When this is true then the "Clear"-button in shown in the settings. When this is false then no button is shown.

      apply_filters( 'simple_history/user_can_clear_log', bool $allow )
      • bool $allow Whether the current user is allowed to clear the log.
      Example usage
      ```php
       // Remove the "Clear log"-button, so a user with admin access can not clear the log
       // and wipe their mischievous behavior from the log.
       add_filter(
           'simple_history/user_can_clear_log',
           function ( $user_can_clear_log ) {
               $user_can_clear_log = false;
               return $user_can_clear_log;
           }
       );
      ```

      simple_history/user_can_clear_log

      apply_filters( 'simple_history/user_can_clear_log' )

      simple_history/user_logger/plain_text_output_use_you

      apply_filters( 'simple_history/user_logger/plain_text_output_use_you' )

      simple_history/user_logger/plain_text_output_use_you

      apply_filters( 'simple_history/user_logger/plain_text_output_use_you' )

      simple_history/view_history_capability

      Filter the capability required to view main simple history page, with the activity feed.

      Default capability is "edit_pages".

      apply_filters( 'simple_history/view_history_capability', string $view_history_capability )
      • string $view_history_capability
      Example usage
      Change the capability required to view the log to "manage options", so only allow admins are allowed to view the history log page.
      
      ```php
       add_filter(
           'simple_history/view_history_capability',
           function ( $capability ) {
               $capability = 'manage_options';
               return $capability;
           }
       );
      ```

      simple_history/view_history_capability

      apply_filters( 'simple_history/view_history_capability' )

      simple_history/view_settings_capability

      apply_filters( 'simple_history/view_settings_capability' )

      simple_history/view_settings_capability

      Filters the capability required to view the settings page.

      apply_filters( 'simple_history/view_settings_capability', string $view_settings_capability )
      • string $view_settings_capability
      Example usage
      Change capability required to view the
      
      ```php
       add_filter(
           'simple_history/view_settings_capability',
           function ( $capability ) {
      
               $capability = 'manage_options';
               return $capability;
           }
       );
      ```

      simple_history_allow_db_purge

      apply_filters( 'simple_history_allow_db_purge' )

      simple_history_allow_db_purge

      apply_filters( 'simple_history_allow_db_purge' )

      simple_history_db_purge_days_interval

      Filter to modify number of days of history to keep.

      Default is 60 days.

      apply_filters( 'simple_history_db_purge_days_interval',  $days )

        simple_history_db_purge_days_interval

        apply_filters( 'simple_history_db_purge_days_interval' )

        simple_history_log

        apply_filters( 'simple_history_log' )

        simple_history_log

        apply_filters( 'simple_history_log' )

        simple_history_log

        Load only the loggers that are specified in the $do_log_us array

        apply_filters( 'simple_history_log' )

        simple_history_log

        Load only the loggers that are specified in the $do_log_us array

        apply_filters( 'simple_history_log' )

        simple_history_log

        apply_filters( 'simple_history_log' )

        simple_history_log

        apply_filters( 'simple_history_log' )

        simple_history_show_as_page

        apply_filters( 'simple_history_show_as_page' )

        simple_history_show_as_page

        apply_filters( 'simple_history_show_as_page' )

        simple_history_show_on_dashboard

        apply_filters( 'simple_history_show_on_dashboard' )

        simple_history_show_on_dashboard

        apply_filters( 'simple_history_show_on_dashboard' )

        simple_history_show_settings_page

        apply_filters( 'simple_history_show_settings_page' )

        simple_history_show_settings_page

        apply_filters( 'simple_history_show_settings_page' )

        simple_history_view_history_capability

        Deprecated, use filter `simple_history/view_history_capability` instead.

        apply_filters( 'simple_history_view_history_capability' )

        simple_history_view_history_capability

        apply_filters( 'simple_history_view_history_capability' )

        simple_history_view_settings_capability

        Old filter name, use `simple_history/view_settings_capability` instead.

        apply_filters( 'simple_history_view_settings_capability' )

        simple_history_view_settings_capability

        apply_filters( 'simple_history_view_settings_capability' )