4
Here is my version of the php file; I have made a couple of changes for handling errors and redirecting users by providing the link again.
If you use this version in the php file, you need to replace "YOURDOMAIN" where applicable.Drop this into your XOOPS root directory. Then any user has selected "email notification", will be emailed when a new PM arrives.
You'll also need to drop in the other template files as shown in the readme.txt included with the download.
Kurt
PHP
### ======================================================
### [url=http://www.xoops.net.br/]XOOPS Brasil[/url] - A comunidade diferente!
### ======================================================
### Arquivo para reenvio de Link de Ativação
### Script for resend the activation link
### ======================================================
### Developer: Fernando Santos, fernando@zend.com.br
### Copyright: www.xoops.net.br © 2003-2004
### ------------------------------------------------------
### www.xoops.net.br
### ======================================================
### v.1.0, Sun Dec 19 15:33:59 BRST 2004
### ======================================================
$xoopsOption['pagetype'] = "user";
include "mainfile.php";
include 'header.php';
// Doesn't matter GET or POST
$email = isset($HTTP_GET_VARS['email']) ? trim($HTTP_GET_VARS['email']) : '';
$email = isset($HTTP_POST_VARS['email']) ? trim($HTTP_POST_VARS['email']) : $email;
// If $email is empty, show form for link resend
if ($email == '') {
echo <<< TOPET05
TOPET05;
$email='';
// If $email is not empty, let's verify some things before sending the link
}else{
$myts =& MyTextSanitizer::getInstance();
$member_handler =& xoops_gethandler('member');
// The line below returns an array with all the users registered with the given e-mail, in our case it'll be only the $getuser[0]
$getuser =& $member_handler->getUsers(new Criteria('email', $myts->addSlashes($email)));
// If the e-mail doesn't exist in the database, $getuser returns array()...
if ($getuser == array() ) {
echo "
E-mail "
. $email . " doesn't appear to be registered in our databases!
Please click here to retry.";
include("footer.php");
exit();
}
// If the e-mail doesn't exist in the database, $getuser returns empty...
if (empty($getuser)) {
echo "
The e-mail isn't registered in our databases!
Please click here to retry.";
include("footer.php");
exit();
}
//Verifying if the user is already active...
if($getuser[0]->isActive()){
echo "
The user "
.$getuser[0]->getVar('uname').", registered with e-mail ".$getuser[0]->getVar('email')." is already active!
Please click here to retry.";
include("footer.php");
exit();
}
//Sending it
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('register.tpl');
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
$xoopsMailer->setToUsers($getuser[0]);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf("- Resend - "._US_USERKEYFOR,$getuser[0]->getVar("uname")));
if ( !$xoopsMailer->send() ) {
echo "
It could not be possible to resend the activation link for "
.$getuser[0]->getVar('uname').". Contact the site administrators.
Or click here to retry.";
include("footer.php");
exit();
} else {
echo "
The activation link for "
.$getuser[0]->getVar('uname')." was resent. If you don't receive the e-mail in a few hours, try again or contact the site administrators";
}
}
include("footer.php");
reset ($HTTP_GET_VARS);
reset ($HTTP_POST_VARS);
?>