Currently I have the system redirecting people to /home whenever they login using the "Login Destination" module. That is correct. However there
is another factor I need to take into consideration. There are different account types. For the most part this is fine. However any time someone has an
account time of "Employee" and was added by the user..I need them to redirect to a specific page (but only on their first login). So I guess it's safe to say
that anyone with an account of "Employee" that has never previously logged in before, get's redirected to page '/test' on the first time they login (only) and afterwards any future logins take them back to the place that users are normally redirected to.

Is this possible without writing a custom module?

Comments

WorldFallz’s picture

You can get this granular with the rules module.

infotechnologist’s picture

Very good advice, thank you. However I can't get it to come together. I almost have it..I have the rule setup when the role type is "employee" and I was
trying to do custom PHP code to verify whether or not they had ever logged in before..however executing the following pHP code as a rule doesn't work..

[code]
if ([account:log-since] == 'never') {
return true;
}else {
return false;
}
[/code]

Also is it possible that the destination module might be overwriting the rule?

infotechnologist’s picture

I just tried turning off the destinations module and it's still not working correctly..it's not redirecting under the conditions I specified.

WorldFallz’s picture

I have no idea what [account:log-since] == 'never' is, but you should be able to check for $user->login == 0.

No clue about login_destination overwriting rules-- i've never used it.

infotechnologist’s picture

When i saw a list of users it said "never" as the last online time if they weren't. So I thought that's what it would pass as. I will try what you suggested real quick, thank you very much for the help.

infotechnologist’s picture

I don't know what's going on, that' doesn't work either. What I used earlier was one of the tokens that you can use (replacements).
But I tried what you suggested (and turned off destination modules just to make sure) and for some reason it's still not redirecting them on login.
I made sure it's setup so if there a employee account it redirects..it just doesn't take into account whether or not they are logging in for the first time.
If I open rules (triggered rules) and edit the one I have the first condition is if they are employee account, the second condition is the following php code:
[code]
if ($user->login == 0) {
return true;
}else {
return false;
}
[/code]
For some reason it's still not working.

WorldFallz’s picture

a big fat 'duh' on both of us-- this runs after the user logs in so $user->login can't possibly ever be 0, lol.

I'm not too sure what criteria you can use to see if the user is logging in for the first time-- maybe compare $user->access to $user->login some how?

EDIT:
After a bit of searching I found this: http://drupal.org/node/560214. That should do it.