By stopofeger on
Hi there,
Im trying to execute some codes when users login. Im using hook_user and defined a function as follows.
function firstsignin_user($op, &$edit, &$account, $category = NULL) {
var_dump($op);
if(empty($account->access) && $op=="login") {
}
return;
}
But the login op doesn't get fired at all. I did a var_dump of op to see which op gets fired i see only view,load, register. Why the login op is not being fired? im using drpal 5.7
Comments
me too ... drupal6
im a newbie, i'm want to interfere when the op='login' but it never seems to happen
if you found the answer pls post back
Same for me
Anyone enter a bug report?
I've had no issues with the
I've had no issues with the login $op. Not sure why it's not working...
I assume that your module is
I assume that your module is called firstsignin.module?
This is the code I use, to register each login for every user and it works perfectly.
You could do the same and add an if statment for the access after the case 'login' or before the switch ($op) {
James T
Action Medical Research - www.action.org.uk
James T
Action Medical Research - www.action.org.uk
I was using a print
I was using a print statement to see what was in the $op var. This wasn't working so I never saw login. Using drupal_set_message() fixed this for me. Now I see it. Sorry for the confusion.
FYI, this is proably
FYI, this is proably because:
a) your webserver is buffering output from "print"
b) after login, drupal redirects to a different page, which resets this buffer
If you really want to see the output from print, you can call flush() - however this will prevent the post-login redirect from functioning (since HTTP can't redirect if the page output has started)
Watchdog entry not being added at $op == 'login'
I'm unable to get watchdog() to fire (or anything else) at login:
case 'login':
watchdog('user', 'I am just logging in now.');
break;
Doesn't work. I can get case 'load' to work in my module no problem. I'm using Drupal 6.9.
Can anyone get the login op to fire?
Not working for me either.
Not working for me either. What the heck is going on?
Doesn't get called. The same code for other ops does. In Drupal 6.17.
Check for a drupal_goto()
Check for a
drupal_goto()call in one of the moduls you use or for other methods of redirection (e.g. when using Rules) when logging in.drupal_goto()callsexitwhich just stops code execution. After the redirect the user is already logged in and that means the login operation of your module'shook_user()will never be called.I had this problem as well
I had this problem as well and it was because of the drupal_goto().
We are using the login destination module, which uses drupal_goto() when someone logins, rendering the 'login' operation useless when using hook_user
-----
BeFused - Drupal tutorials
Set module weight to -1
Set module weight to -1