The invocation of email_confirm in other modules does not seem to fire. For email_change yes, but not for email_confirmation.
So, the following line seems to be completely ignored:
module_invoke_all('email_confirm', 'email confirmation', $account->uid, $account->mail, $new_mail);
A scope issue of some sort? Because when I copy the line to the function invoking the email_confirm hook for email_change, then it works!
Comments
Comment #1
PWG commentedbump
Comment #2
jaydub commentedCan you show your code that attempts to implement the hook? You should note that the 'email confirmation' operation of the hook will only be fired when a user clicks the email confirmation link in the email sent to their new email address AND all the validation tests pass and their email address is updated. You can look at the function email_confirm_user_change_mail() to see the tests that are applied to the confirmation link when it is clicked to see all the conditions that are checked before changing the user's email.
A quick check on my end implementing a hook works on both the email change and upon successful email confirmation.
Comment #3
PWG commentedHi jaydub! Thanks for responding.
Here is what I do:
1. I change the email address of a user. The email_confirm hook (see below) has been called according to the system log
2. I click the confirmation link in the email sent to the new address. The drupal site opens, stating that the email address has been changed.
3. I check the system log and find the message "User johndoe used one-time e-mail change link at time 1264855579". So all validation tests should have been passed
4. This time, though, the email_confirm hook (see below) has not been executed.
function mymodule_email_confirm($op, $uid, $old_email, $new_email) {
watchdog('mymodule', 'In email confirm: '.$op, null, WATCHDOG_ERROR, l(t('view'), null));
}
Any ideas?
Comment #4
PWG commentedComment #5
jaydub commentedhmm I am able to successfully implement the hook in my testing.
Can you edit the module source directly and try to add some debugging?
I don't know the line number in the 6.x-1.4 release as I am looking at the latest in CVS but if you can add some debugging to the email_confirm_user_change_mail() function where you see the call to module_invoke_all() then perhaps we can see whether that code path is being called in your case.
look for this code block:
and insert a watchdog() call or error_log or whatever you want to debug before and after the module_invoke_all() call
if it's being called and passed the right values then you'd have to add debugging to your hook implementation.
Comment #6
PWG commentedI already did that before I posted this issue. That's when I started to get confused. :)
Comment #7
jaydub commentedSo what exactly were the results of your debugging? From #6 I can't tell what debugging you did specifically and what results you found...
Comment #8
robby.smith commentedsubscribing
Comment #9
jaydub commentedComment #10
PWG commentedHi jaydub,
In #5 you suggested to "add some debugging to the email_confirm_user_change_mail() function". I inserted a watchdog before the line
module_invoke_all('email_confirm', 'email confirmation', $account->uid, $account->mail, $new_mail);The watchdog message was never called. That's when I posted my initial posting #1 and that is what I meant with the line above never firing.
As I never managed to get it to work, I'm not using the email confirmation module. If I'm the only one with this problem, feel free to close this issue.
Thanks!
Petter
Comment #11
PWG commentedI finally figured it out, and it had nothing to do with the module.
I had put the call in a Services module and that is why the hook was never called.