*

salint

  • *
  • 2 posts
History Logger Plugin - additional login place
« on: March 13, 2023, 01:26:22 PM »
Hello everyone.

I would like to add an extra option to the
History Logger Plugin. I need to log logins and logouts of site users. I modified the file function php. I found in function hsl_create_user_log. After this function i add :

// after_login
osc_add_hook('after_login', function($id) {
$user = User::newInstance()->findByPrimaryKey($id);
hsl_create_user_log($user, 'LOGIN');
});

After the change, I don't see any changes in the plugin's operation
What files should I make corrections to?
What hook should I use for this registration?

Regards,
SÅ‚awek

*

MB Themes

Re: History Logger Plugin - additional login place
« Reply #1 on: March 14, 2023, 09:11:52 PM »
@saling

Hook looks like:
Code: [Select]
        osc_run_hook('after_login', $user, osc_user_dashboard_url());

means you want to do:
Code: [Select]
// after_login
osc_add_hook('after_login', function($user) {
  hsl_create_user_log($user, 'LOGIN');
});
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

salint

  • *
  • 2 posts
Re: History Logger Plugin - additional login place
« Reply #2 on: March 17, 2023, 10:47:41 AM »
Everything works fine, but the problem occurs when two-factor authentication is enabled. In cases where a window to enter the code for two-factor authentication appears, it does not save login to the database. I have absolutely no idea why this is happening. How to improve it?

*

MB Themes

Re: History Logger Plugin - additional login place
« Reply #3 on: March 17, 2023, 11:39:03 AM »
Try this.

Code: [Select]
// after_login
osc_add_hook('after_login', function($user) {
  hsl_create_user_log($user, 'LOGIN');
}, 1);
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots