Gossamer Forum
Quote Reply
User Logged in for hook
I am using the hook user_login to trap login events for each editor. Should this be a PRE hook or a POST hook?? Still a little confused on PRE and POST. Thanks



Edit: Is there a hook I can use to trap events inside browser.cgi, such as each time an editor logs in, or clicks on a particular function (move, validate etc).... I though of using javascript... but was hoping there would be a way to HOOK-INSmile

So far I have found hooks: modify_category, modify_link, validate_link and user_loging. Am I on the right track here? Are there other hooks I am missing for trapping editor activity?


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: May 28, 2002, 5:19 PM
Quote Reply
Re: [Ian] User Logged in for hook In reply to
There is a good, and maybe there is a bad news.

The browser.cgi dispatches the "handle_editor" hook.
This could be used to trap & handle any editor related event.
This is the good news. Cool

The bad is, that unfortunately it seems the handle_editor hook is missing from the hooks.cfg.
I don't really know, if it does affect the plugin hook handling or not, but I've a bad feeling, that it affects... Unsure

I suggest you to try to use the handle_editor hook, if it works.
Then we will see what's next.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
Thanks webmaster!

I wonder why it is missing? Alex???


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
It doesn't really matter if a hook is not listed in hooks.cfg or not.

hooks.cfg is autogenerated if you set $PROFILE = 1 in the Plugins.pm file. It will record all hooks a program comes across during execution.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] User Logged in for hook In reply to
It is a good news! Cool

So hooks.cfg is just for profiling?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
So this means I should be able to use handle_editor PRE hook somehow, and trap their movements.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
What is the difference between handle_login and user_login hooks?

I am thinking this will work for tracking editor logins: Just not sure if this should be a PRE or POST. If I set to post then, I guess this will only run the sub if the user has successfully logged in? hmmmm

Code:


sub user_login {
# -------------------------------------------------------------------
#
my (@args) = @_;

#find out which user has logged in

#If user is an editor then:
#increment Total_Logins and set Last_Login to current date/time

return @args;
}


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: May 29, 2002, 12:54 PM
Quote Reply
Re: [Ian] User Logged in for hook In reply to
Depends what do you want to do with tracking editor logins?
What do you exactly mean?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
For this part, just each time they log into links, just as any user would. I am just treating this as basic as I can to start off with.

Ultimately I want to track the visits to the editor browser area and the functions within it (modify, validate etc).


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] User Logged in for hook In reply to
First thing I would do, to display all available variables, tags on a page, with <%GT::Template::dump%>. So do it. Then you can see what variables you can work with.

Also your start point should be the Links::User::Editor::handle point. This is where the handle_editors hook starts. Follow the code and check what is doing at some points. You have to understand the code, before you know how to modify it.
Also check the Docs, especially the developer docs, where you may get some help.

It is also possible, that you create a global, what you call on each editor template, using <%myglobal%>, and you do the tracking inside the global. You may have all the info you will need to track.

If you can get the parameters, like who is the current editor, what is the page you browse, then you will be able to track the editors.
Currently I have not enough info, to tell you what to do.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Ian] User Logged in for hook In reply to
handle_login is executed in user.cgi, before calling Links::User::Login::handle. Just before anything happening. So using handle you can even replace or modify all, the login, signup, user validate, etc. functions.

user_login is executed within Links::User::Login::handle, then login_user function is called. You can even replace, modify just this function, using this hook.

But you can also find these info by doing a text search in lsql/admin directory...

handle_login:
'input_params' => [],
'output_params' => [
'SCALAR'
],

user_login hook can have 3 input parameters:
username, password, template page name without .html to display on login success (default is login_success)
No output param.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
Webmaster!! Great pointers.. thank you very much!Smile

I agree with you, I need to scan through the cgi file to see what the hook function actually does... if I can understand itWink

Sorry for the Perl ignorance again, but does this code read in the paramaters from the function the hook is attached to? If so, I just reference these params with something=>something. I am not being lazy here, I am going to look for examples on what this means...

'input_params' => [],
'output_params' => [
'SCALAR'
],

Thanks again.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] User Logged in for hook In reply to
Khm... Sorry. Angelic

I just copied it out the mentioned code from the hooks.cfg.
Nothing special, just to show that there no input is required, and the output is returned in Scalar.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 30, 2002, 9:14 AM
Quote Reply
Re: [webmaster33] User Logged in for hook In reply to
Ahhh, I understand.Smile

I have added $USER to use Links qw/$CFG $IN $DB $USER/; as I am sure I will need this in my plugin module now.

I will post back, when I get a little further.

Thanks.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] User Logged in for hook In reply to
If you add $USER you'll also need:

init_user();

Last edited by:

Paul: May 30, 2002, 9:53 AM
Quote Reply
Re: [Paul] User Logged in for hook In reply to
Yes, thanks Paul...

And do I just put that inside each sub before I want to read in the value for the user, or would an instance at the top of the module suffice?


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] User Logged in for hook In reply to
It should go in the cgi script.