I’m running into an issue where a user lost/deleted/maimed their email validation email… and they need a new one. How can I resend their email validation?
This is a longstanding issue and I don’t think there is a way to do that within the software. The workaround is to manually activate the user’s account based on your manual confirmation of their email address.
Hi @ctgraham
I done this code, and work very well. you can add it on UserGridHandller.inc.php
/**
* Developed By: M.babaei
* Resend Validation Mail to user
* @param $args
* @param $request
* @return JSONMessage
*/
function sendValidationMail($args, $request)
{
$user = $request->getUser();
// Identify the user Id.
$userId = $request->getUserVar('rowId');
if (!$userId) $userId = $request->getUserVar('userId');
// Are we enabling or disabling this user.
$enable = isset($args['enable']) ? (bool)$args['enable'] : false;
// Developed By: M.babaei
if ($userId !== null && !Validation::canAdminister($userId, $user->getId(), $request->getContext())) {
// We don't have administrative rights over this user.
return new JSONMessage(false, __('grid.user.cannotAdminister'));
} else {
// Send email validation request to user
import('lib.pkp.classes.mail.MailTemplate');
import('lib.pkp.classes.security.AccessKeyManager');
$accessKeyManager = new AccessKeyManager();
$accessKey = $accessKeyManager->createKey('RegisterContext', $userId, null, Config::getVar('email', 'validation_timeout'));
/** @var UserDAO $userDao */
$userDao = DAORegistry::getDAO('UserDAO');
$requestUser = $userDao->getById($userId);
$mail = new MailTemplate('USER_VALIDATE');
$this->_setMailFrom($request, $mail);
$url = $request->url(null, 'user.grid', 'activateUser', $requestUser->getData('username'), array('username' => $requestUser->getData('username'), 'accesskey' => $accessKey));
$url = str_replace('$$$call$$$/', '', $url);
$url = str_replace('activate-user', 'activateUser', $url);
$mail->assignParams(array(
'userFullName' => $requestUser->getFullName(),
'activateUrl' => $url
));
$mail->addRecipient($requestUser->getEmail(), $requestUser->getFullName());
$mail->send();
unset($mail);
return new JSONMessage(true, __('grid.user.sendValidateMailNotify'));
}
}
then add this line to this path: ‘lib/pkp/pages/user/index.php - line code 32’
case 'activateUser':
Your link should call this function “activateUser” on RegisterationHandller
Have nice time
Thanks, @mbabaei. Would you be able to create a pull request in GitHub for this?
@ctgraham I don’t know exactly how can i do it ?!
Do you have any tutorial for it?
You’ll find a number of good tutorials online, such as: