Skip to content

Commit

Permalink
v 0.23.0
Browse files Browse the repository at this point in the history
- Log user action in front-end.
- Fix behavior when no users are active.
  • Loading branch information
Darklg committed Sep 4, 2024
1 parent 8950d04 commit 9922668
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions wpuactionlogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpuactionlogs
Update URI: https://github.com/WordPressUtilities/wpuactionlogs
Description: Useful logs about what’s happening on your website admin.
Version: 0.22.0
Version: 0.23.0
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpuactionlogs
Expand All @@ -26,7 +26,7 @@ class WPUActionLogs {
public $baseadmindatas;
public $settings_details;
public $settings;
private $plugin_version = '0.22.0';
private $plugin_version = '0.23.0';
private $plugin_settings = array(
'id' => 'wpuactionlogs',
'name' => 'WPU Action Logs',
Expand Down Expand Up @@ -64,6 +64,9 @@ public function __construct() {
add_action('admin_init', array(&$this,
'log_current_user_action'
));
add_action('wp', array(&$this,
'log_current_user_action'
));
add_action('admin_enqueue_scripts', array(&$this,
'admin_enqueue_scripts'
));
Expand Down Expand Up @@ -889,6 +892,7 @@ public function log_current_user_action() {
if (!$current_page) {
return;
}

$current_user = wp_get_current_user();
set_transient($this->plugin_settings['transient_action_prefix'] . $current_user->ID, $current_page, 60);
}
Expand Down Expand Up @@ -984,7 +988,7 @@ public function get_active_users() {
$users_with_transient[] = str_replace('_transient_' . $this->plugin_settings['transient_action_prefix'], '', $result->option_name);
}
if (!$users_with_transient) {
return false;
return array();
}
return get_users(array(
'include' => $users_with_transient
Expand Down

0 comments on commit 9922668

Please sign in to comment.