Action
uncanny-automator
automator_after_activity_stream_init
Fires after the activity stream has been successfully initialized and is ready for use.
add_action( 'automator_after_activity_stream_init', $callback, 10, 1 );
Description
Fires after the Activity Log class is loaded but before it's initialized. Developers can use this hook to modify the activity log class loading process or perform actions immediately after the class is available for use in the core WordPress admin.
Usage
add_action( 'automator_after_activity_stream_init', 'your_function_name', 10, 1 );
Examples
add_action( 'automator_after_activity_stream_init', function( $classes ) {
// This action hook fires after the activity stream classes have been initialized.
// We can use this to perform custom actions, like adding additional meta data
// to the activity log or modifying the way the activity stream is displayed.
// For example, let's imagine we want to log a custom message every time the
// activity stream is initialized.
// In a real-world scenario, you might want to check for specific conditions
// or user roles before logging.
$user_id = get_current_user_id();
if ( $user_id ) {
// Using the WordPress logger for demonstration.
// In a real plugin, you might integrate with your plugin's logging system.
error_log( "User ID {$user_id} triggered an activity stream initialization." );
// If this were a filter hook that modified the $classes array,
// we would ensure a return statement:
// return $classes;
}
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/class-automator-load.php:736
public function activity_stream_classes( $classes = array() ) {
do_action( 'automator_before_activity_stream_init' );
$classes['Activity_Log'] = UA_ABSPATH . 'src/core/admin/class-activity-log.php';
do_action( 'automator_after_activity_stream_init' );
return $classes;
}