1
I installed XOOPS last week and have got everthing going almost how I want, there is just one last thing that I really really want to be able to do.
I have a number of groups on my XOOPS website, I want to send an e-mail to a user when I add them to a particular group. I have got most of the way there, but I can't seem to bring it home. The script is definately running through and variables are assigned correctly at the appropriate time (ie. when the group is question is modified). The member is added to the appropriate group, but no e-mail is sent. :(
Can anyone see any holes in my script as to why it won't send e-mails. Please please help, I want this site to go live tomorrow but don't want it to go live till this is fixed.
Here is the script as it stands at the moment:
case "addUser":
if (!$GLOBALS['xoopsSecurity']->check()) {
redirect_header("admin.php?fct=groups&op=adminMain", 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors()));
}
$member_handler =& xoops_gethandler('member');
$size = count($uids);
for ( $i = 0; $i < $size; $i++ ) {
$thisuser =& $member_handler->getUser($uids[$i]);
$thisuseremail = $thisuser->getvar('email');
$member_handler->addUserToGroup($groupid, $uids[$i]);
}
if ($groupid == 4) {
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);
$myts =& MyTextSanitizer::getInstance();
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setTemplate('activated.tpl');
$xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
$xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
$xoopsMailer->assign('SITEURL', XOOPS_URL."/");
$xoopsMailer->setToUsers($thisuseremail);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT,$xoopsConfig['sitename']));
include 'header.php';
if ( !$xoopsMailer->send() ) {
printf(_US_ACTVMAILNG, $thisuser->getVar('uname')); // Script doesn't use this line (but it should due to no e-mail being sent?)
} else {
redirect_header("admin.php?fct=groups&op=modify&g_id=".$groupid."",0,_AM_DBUPDATED); // This line is run
}
include 'footer.php';
}
redirect_header("admin.php?fct=groups&op=modify&g_id=".$groupid."",0,_AM_DBUPDATED); // This line is run when using a different group.
break;