1
I want to add an option to my XOOPS so that if people choose to, they would be notified when someone else from the same location registeres.
I thought the place to do this would be register.php, so towards the end I now have:
if ($xoopsConfigUser['new_user_notify'] == 1 && !empty($xoopsConfigUser['new_user_notify_group'])) {
$myts =& MyTextSanitizer::getInstance();
//my code starts here
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('user_from', '%'.$myts->addSlashes(trim($HTTP_POST_VARS['user_from'])).'%', 'LIKE'));
$foundusers =& $member_handler->getUsers($criteria, true);
foreach (array_keys($foundusers) as $j) {
$userdata['user_from'] = $foundusers[$j]->getVar("name");
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$member_handler =& xoops_gethandler('member');
$xoopsMailer->setToGroups($userdata['email']);
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG,$myts->oopsStripSlashesGPC($uname)));
$xoopsMailer->send();
}
//end my code
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$member_handler =& xoops_gethandler('member');
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['new_user_notify_group']));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG,$myts->oopsStripSlashesGPC($uname)));
$xoopsMailer->send();
}
The code I added is from the member search module. I was wondering if anyone has any ideas on how to fix this...
I guess one of my problems is that I'm using $HTTP_POST_VARS['user_from'] to search for users, but I'm not sure where is the information for the person that is registering stored (which variable), and how to access it.
Any help will be appreciated.