Hook to identify when user logs out

Peter Lane Posted in Component Development 2 years ago

I am looking to carry out an action when the system logs out a user for inactivity, or the logs themselves out.

Replies
gb Peter Lane Replied 2 years ago

It took me some time to figure out all the links, but I now understand a bit more about the process. However, the two page registrations confused me for a while, since the page comment only said how to call one of the pages. I must be growing old to miss the meaning ...

Indonesian Arsalan Shah Replied 2 years ago

Sir your case is always very interesting. I learn new stuff every time , this time I learned error_log params .

 error_log("logout",1,"[email protected]");  

Simply use hello world component, you need to make sure it is working and don't add non php stuff in the component files please, and may try following in old code

if($params['action'] == 'user/logout'){
    file_put_contents(ossn_route()->www . 'testfile.txt', 'somestuff');
}

Dear, I suggest you to hire a developer from upwork or freelancer website because you may break things and get upset later as you may not able to get what you are trying. To be honest from your code experiments I see new things that I never seen on community before :) I wish you good luck with what you trying to achieve and hope you can get it done.

German Michael Zülsdorff Replied 2 years ago

"... I have tested with a script in the root directory ..."
Peter, you have to have in mind that Ossn is initializing its own environment,
thus testing something with a standalone script may give different results.

That's why I strongly recommend to install the HelloWorld component and run these kind of tests inside of it.

gb Peter Lane Replied 2 years ago

@Michael, I was wanting to write a json file, but I wanted it to work for a log file first as a test.

gb Peter Lane Replied 2 years ago

I have tested with a script in the root directory, which writes a log file successfully using similar commands. I have tried the path"/log" as well as just "log", to no avail.

German Michael Zülsdorff Replied 2 years ago

I have no idea where we would have to deal with log_errors additionally.
Can you please explain?

gb Peter Lane Replied 2 years ago

errorreporting and logerrors are turned on.

German Michael Zülsdorff Replied 2 years ago

Why not keeping things simple and use Ossn's pref-configured logging mechanism?
See https://www.opensource-socialnetwork.org/wiki/view/1954/how-to-enable-ossn-error-reporting

This way you would do a

error_log('my var of interest: ' . $any_var);

and that's it.

gb Peter Lane Replied 2 years ago

Didn't realise that Chrome retains cookies when you select "Continue where I left off" !

Indonesian Arsalan Shah Replied 2 years ago

So the error logs are enabled in admin panel?