I would like to implement a plugin that requires new users to reply to an email, to verify their email address, on registration. I am already doing extensive codex research, but I am very new and would appreciate some hints, especially regarding keeping the user inactive until they have verified their email. The rest I think I will manage on my own.
|
I had a very similar problem which I solved the other day. In my case I wanted to allow users to choose their own password, and then activate their account via email. There's alot to this, so I'll just outline how to I achieved the e-mail verification. First, I used To prevent an non-activated user from logging in, I added extra checks to the log-in, using the hook Edit
As per the comments, the The edited code returns whatever was passed to it, or an
(you can use Then, in your plug-in, you will need to override Copy the function into your plugin, inside
and then adapt it, so it retrieves and includes the activation key in the message to the user. For the project I was working, I made a link from the activation key that the user could click to activate their account. E.g if their key was 01234ABCDE: http://www.example.com?confirm=01234ABCDE. Using the filter query_vars I registered the variable 'confirm' with WordPress. Then with the This template attempts to retrieve the user with the corresponding key. If it finds them, it deletes the key. They are now activated and able to log-in. If it doesn't it displays an error message (key doesn't exist or account has been activated). If there are multiple users with the same activation key (they shouldn't be!) it throws up an error also. |
|||||||||||
|