This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

mick11054
mick11054

Hello,

I'd like to perform some custom tasks when a user signs in and signs out of the RainLab User plugin. This is usually achieved with a simple event listener:

Event::listen('auth.login', function($user) {
    // listen for a user login
    Log::info('user signed in.');
});

And is even covered in the documentation here: https://octobercms.com/docs/services/events (though not specific to this plugin)

I'm unable to find any events firing during these actions, though. Am I missing something? If not, how would I extend this plugin to do what I need when the user signs in or out? For now, I've had to make changes to the core files of the plugin, but these won't survive an update.

Thanks for your help.

Last updated

chris10207
chris10207

one idea would be to create your own component extending the Rainlab Account component then i imagine something like

function onMyCustomSignin(){
     if ( parent::signin() ) {
       Event::Fire('MyUserEvent:signin');
   }
}

code not accurate at all, i will try something like this very soon

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.