2

I am looking to catch the event when new user updates password after clicking on link in the email, right after one time login.

I actually want to perform an action right after user sets password after validating/clicking on one time login link in welcome email.

I have gone through this: Is there a hook after user confirmation?

However, it does not solve my problem as explained below:

I used this condition to check if user is just created:

if ($account->uid // user is not new && $account->status === "0" && $edit['status']==1)  

The issue with this is it holds usable for me in case if admin approves pending creation. In my case I don't want admin to approve, i want drupal to send email to user for confirmation. According to my workout, when admin approves, then above condition works, because status is changed from 0 to 1 so i can do some work at this change. But without admin, when user creates account, it is automatically activtaed, so I can't grab with this condition to perform my work at this event.

5
  • possible duplicate of Is there a hook after user confirmation?
    – Anil Sagar
    Apr 10 '14 at 10:06
  • Thanks for reply. I worked with following to check if user is just created: if ($account->uid // user is not new && $account->status === "0" && $edit['status']==1) This holds true if admin approves pending creation. In my case I don't want admin to approve, i want it to send email to user on for confirmation. According to my workout, when admin approves, then above condition works, because status is changed from 0 to 1 so i can do some work at this change. But without admin, when user creates account, it is automatically set to active, so I can't grab with this condition.
    – imserious
    Apr 10 '14 at 10:17
  • So I already checked that link: drupal.stackexchange.com/questions/30219/… It didn't work that's why I asked this question.
    – imserious
    Apr 10 '14 at 10:19
  • 2
    I am afraid that as long as there is nothing in the question that tells us that you've already checked that link, it is still a duplicate. You need to tell us what you tried, what the exact outcome was, and any errors you observed. Until you do, this looks like a duplicate to me. PS: Don't add detail in comments, they're for discussion, not for adding detail to a the question. Click the link "edit" to edit the question. Apr 10 '14 at 10:39
  • Thank you for correcting me. I have explained in question above that what i tried and what were results those don't suite my need.
    – imserious
    Apr 10 '14 at 19:21
0

I also updated the link your posted to.

If you're using the LoginToboggan module for e-mail validation and you don't wish to use the rules module you can simply mimic the module's validation response (exploiting a temporary logintoboggan_email_validated = TRUE account property that's pushed to hook_user_update) yourself in code:

 /**
 * Implement hook_user_update()
 *
 */
function yourcustommodule_user_update(&$edit, $account) {
  if (!empty($account->logintoboggan_email_validated) && !isset($account->your_custom_action)) {
        $account->your_custom_action = TRUE;

        // Do what you want here

  }
}

Since core and other modules will also invoke hook_user_update you'd want to implement something to avoid repeated actions. In this example I set another property on the $account once the action is initiated but you can impose finer control if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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