Osclass Support Forums
General osclass questions => Plugins => Topic started by: salint 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
-
@saling
Hook looks like:
osc_run_hook('after_login', $user, osc_user_dashboard_url());
means you want to do:
// after_login
osc_add_hook('after_login', function($user) {
hsl_create_user_log($user, 'LOGIN');
});
-
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?
-
Try this.
// after_login
osc_add_hook('after_login', function($user) {
hsl_create_user_log($user, 'LOGIN');
}, 1);