7

When logging in indicates the 'account has not been activated', how do I create a link for resending the activation email?

Update
I want users to be able to enter their email address in an input field and have that resend their activation link. Not in the backend, just frontend only!

2 Answers 2

7

I want to be able that users can enter their emailaddress in an input and that the activation link gets resend

You'll need to write a plugin, which can generate activation URLs using the UsersService:

echo craft()->users->getPasswordResetUrl($user);

If you want to send the user an activation email instead of echoing a link in the frontend, you can use the sendActivationEmail method instead:

craft()->users->sendActivationEmail($user);

Note that for both methods, $user should be an instance of UserModel, meaning you'll first need to pull the relevant user:

$user = craft()->users->getUserByEmail($userEmail);

As for the actual plugin implementation, it depends what you need/want (I'm guessing you're building your own login form/logic?). You could go with a basic template variable to output the activation URL:

<a href="{{ craft.myPlugin.getActivationUrl }}">Click here to activate your account now</a>

...or you could create a controller which would provide a link for re-sending the activation email:

<a href="{{ actionUrl( 'myPlugin/sendActivationEmail' ) }}">Click to resend activation email</a>
5

Go to the Users section of the Control Panel (mysite.com/admin/users/). Click on the user account that needs to be activated. Click on the settings cog on the right side (see attached image), and choose which option works for you.

Hope this helps!

Settings for unverified user

Your Answer

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

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