Skip to content

Commit

Permalink
Upd. Recording and displaying an event from wp_spbc_auth_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonV1211 committed May 28, 2024
1 parent 4284a0e commit bea7907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion inc/spbc-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,11 @@ function spbc_admin_log_action()

if (isset($user->ID) && $user->ID > 0) {
$roles = (is_array($user->roles) && ! empty($user->roles) ? reset($user->roles) : null); // Takes only first role.
$action = spbc_parse_action_from_admin_page_uri(Server::get('REQUEST_URI'));

$log_id = spbc_auth_log(array(
'username' => $user->get('user_login'),
'event' => 'view',
'event' => isset($action["parsed_action"]) ? $action["parsed_action"] : 'view',
'page' => Server::get('REQUEST_URI'),
'blog_id' => get_current_blog_id(),
'roles' => $roles
Expand Down
9 changes: 5 additions & 4 deletions inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1929,6 +1929,8 @@ function spbc_field_2fa__roles()

function spbc_field_security_logs__prepare_data(&$table)
{
global $wpdb;

if ($table->items_count) {
foreach ($table->rows as $row) {
$ips_c[] = $row->auth_ip;
Expand Down Expand Up @@ -1971,10 +1973,9 @@ function spbc_field_security_logs__prepare_data(&$table)
$page = "<a href='" . $url . "' target='_blank'>" . $url . "</a>";
}


$action = spbc_parse_action_from_admin_page_uri($url, $row->id);
$action = !empty($action['parsed_action']) ? $action['parsed_action'] : '';
$is_add_time = !empty($action['add_time']) ? $action['add_time'] : false;
$action = !empty($row->event) ? $row->event : '';
$action_for_add_time = spbc_parse_action_from_admin_page_uri($url, $row->id);
$is_add_time = !empty($action_for_add_time['add_time']) ? $action_for_add_time['add_time'] : false;

switch ($row->event) {
case 'view':
Expand Down

0 comments on commit bea7907

Please sign in to comment.