1

In my drupal 7 website when a user registers, an email is sent to them. And when they click on the verification link in the email they are redirected to "SITENAME/user" page. I wanna change that. I want the user to be redirected to another page say "SITENAME/upload" page. I have used the user registration password module. The email sent to the user is

[user:name],

Thank you for registering at [site:name]. You may now log in and verify your account by clicking this link or copying and pasting it to your browser:

[user:registrationpassword-url]

This link can only be used once. You will be able to log in at [site:login-url] in the future using:

username: [user:name]
password: Your password

--  [site:name] team

I think I have to change the [user:registrationpassword-url] part. But Im not sure what to change that to.

Thanks

3 Answers 3

1

you don't need to change the url in the email, becase user need to click it to visit the page, but You can use the Rules module to do that "https://www.drupal.org/project/rules". after verifying the user redirect them to the Upload page. Also here is a great video tutorial : https://drupalize.me/videos/overview-actions-conditions-and-events?p=1157 for how to use Rules module if you didn't use it before.

2
  • I've used rules before. But how do I make it specifically for first time login
    – newbie
    Commented Oct 10, 2014 at 21:16
  • Maybe you could check the last login value in the users database table (a User field). Or, if that's not good enough for you you could add a custom user field that is a date of last login, or some/any action date you could repurpose later .... Then rules could use the field(s) in question.
    – tenken
    Commented Oct 10, 2014 at 22:59
1

This is actually very simple in D7 using the Rules module. All you have to do is see if the value of the user's Last Access field is empty. When an account is created, the initial value of the Last Access is empty.

The value of this field is not set until sometime AFTER the rules have been run. So, all you have to do is setup a conditions in rules that check:

Data value is empty
site:current-user:last-access

Here is an export of my rule and it has been working fine. If anyone finds any issues, please let me know. You should be able to import this rule into your site.

{ "rules_first_time_login" : {
"LABEL" : "first time login",
"PLUGIN" : "reaction rule",
"WEIGHT" : "1",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "user_login" : [] },
"IF" : [
{ "data_is_empty" : { "data" : [ "site:current-user:last-access" ] } },
{ "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "16" : "16" } } } }
],
"DO" : [
{ "drupal_message" : { "message" : "Welcome to Drupal Camp Florida. Please submit your session proposal below." } },
{ "redirect" : { "url" : "node/add/sess?destination=/admin/dashboard" } }
]
}
}

The role with a value of "16" is a role of "Speaker".

0

A quick google search offered these modules:
Login Destination
Login Redirect

2
  • I used the Login Destination Module. But I want to have a different redirect page for registration, login and first time login
    – newbie
    Commented Oct 11, 2014 at 9:00
  • The description on the Login Destination module page seems to suggest you can. Specifically where it says, "using a one-time login link" which I think would be the link in your email. The description also says "You may use PHP snippets to provide custom conditions and destinations"
    – 2pha
    Commented Oct 11, 2014 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.