Skip to content

Actions and filters

User status: 4 hooks.

Every hook here has a description in the source.

1 action3 filters

filter

davo_user_status_entry

Filters the full status entry array before it is returned.

Parameters of davo_user_status_entry
ParameterTypeDescription
$entryarray<string, mixed>The status entry.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_user_status_entry', 'my_filter_callback', 10, 2 );

/**
 * @param array<string, mixed> $entry
 * @param int $user_id
 */
function my_filter_callback( $entry, $user_id ) {
	// Change $entry as needed, then return it.
	return $entry;
}

src/domains/user-status/helpers.php:158

filter

davo_user_status_entry_status

Filters the computed user status string before it is returned.

Parameters of davo_user_status_entry_status
ParameterTypeDescription
$statusstringComputed status: 'online', 'idle', or 'offline'.
$user_idintWordPress user ID.
$last_activeint|nullRaw last-active Unix timestamp.
$idleboolWhether the client reported the user as idle.
add_filter
add_filter( 'davo_user_status_entry_status', 'my_filter_callback', 10, 4 );

/**
 * @param string $status
 * @param int $user_id
 * @param int|null $last_active
 * @param bool $idle
 */
function my_filter_callback( $status, $user_id, $last_active, $idle ) {
	// Change $status as needed, then return it.
	return $status;
}

src/domains/user-status/helpers.php:130

filter

davo_user_status_threshold

Filters the number of seconds a user remains present after the last heartbeat.

Parameters of davo_user_status_threshold
ParameterTypeDescription
$thresholdintThreshold in seconds.
$user_idintWordPress user ID.
add_filter
add_filter( 'davo_user_status_threshold', 'my_filter_callback', 10, 2 );

/**
 * @param int $threshold
 * @param int $user_id
 */
function my_filter_callback( $threshold, $user_id ) {
	// Change $threshold as needed, then return it.
	return $threshold;
}

src/domains/user-status/repository.php:248

action

davo_user_status_touched

Fires after a user's activity has been recorded.

Parameters of davo_user_status_touched
ParameterTypeDescription
$user_idintWordPress user ID.
$nowintUnix timestamp that was stored.
$idleboolWhether the user was marked idle.
add_action
add_action( 'davo_user_status_touched', 'my_action_callback', 10, 3 );

/**
 * @param int $user_id
 * @param int $now
 * @param bool $idle
 */
function my_action_callback( $user_id, $now, $idle ) {
	// Your code here.
}

src/domains/user-status/repository.php:86

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first