xoops forums

OldFriend

Just popping in
Posted on: 2006/11/24 13:19
OldFriend
OldFriend (Show more)
Just popping in
Posts: 99
Since: 2005/10/28
#1

Enhanced PM notification.

On other forums that I visit, if someone PMs me, then I receive an email to my registered email address to tell me that I have a PM waiting for me.

This is extremely useful for sites that you don't visit every day and I think is something lacking in XOOPS PM module.

Are there any plans to add this feature?

aph3x

Theme Designer
Posted on: 2006/11/24 14:00
aph3x
aph3x (Show more)
Theme Designer
Posts: 834
Since: 2004/12/26
#2

Re: Enhanced PM notification.

Till then...maybe THIS thread will help
Everything I'm not made me everything I am
The Themes

khuhner

Quite a regular
Posted on: 2006/11/24 14:08
khuhner
khuhner (Show more)
Quite a regular
Posts: 232
Since: 2006/1/6 3
#3

Re: Enhanced PM notification.

Quote:

OldFriend wrote:
On other forums that I visit, if someone PMs me, then I receive an email to my registered email address to tell me that I have a PM waiting for me.

This is extremely useful for sites that you don't visit every day and I think is something lacking in XOOPS PM module.

Are there any plans to add this feature?


Also see this forum:

https://xoops.org/modules/newbb/viewto ... id=241873#forumpost241873

I downloaded the code and loaded it onto my site. It works as advertised. IF a user has email notification in their profile, THEN they will get an email when a PM arrives!

Good luck,
Kurt

khuhner

Quite a regular
Posted on: 2006/11/26 20:43
khuhner
khuhner (Show more)
Quite a regular
Posts: 232
Since: 2006/1/6 3
#4

Re: Enhanced PM notification.

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
<fieldset style="padding: 10px;">
  <legend style="font-weight: bold;">Resend activation link</legend>
  <div><br />Fill in the e-mail you registered with and we will resend the activation email.<br /><br />
  Be sure to check your "Spam" folder.</div>
  <form action="
$_SERVER[PHP_SELF]" method="post">
    Registered E-mail: <input type="text" name="email" size="26" maxlength="60" />&nbsp; <input type="submit" value="Send" />
  </form>
</fieldset>
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 
"<br><br><h3>E-mail " $email " doesn't appear to be registered in our databases!</h3><br><br>Please click <a href=http://www.YOURDOMAIN.com/ActivateResend.php>here</a> to retry.";
    include(
"footer.php");
    exit();
}

// If the e-mail doesn't exist in the database, $getuser returns empty...
if (empty($getuser)) {
echo 
"<br><br><h3>The e-mail isn't registered in our databases!</h3><br><br>Please click <a href=http://www.YOURDOMAIN.com/ActivateResend.php>here</a> to retry.";
include(
"footer.php");
    exit();
}
//Verifying if the user is already active...
if($getuser[0]->isActive()){
echo 
"<br><br><h3>The user ".$getuser[0]->getVar('uname').", registered with e-mail ".$getuser[0]->getVar('email')." is already active!</h3><br><br>Please click <a href=http://www.YOURDOMAIN.com/ActivateResend.php>here</a> 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 
"<br><br><h3>It could not be possible to resend the activation link for ".$getuser[0]->getVar('uname').". Contact the site <a href=http://www.YOURDOMAIN.com/modules/contact_plus/index.php>administrators</a>.</h3><br><br>Or click <a href=http://www.YOURDOMAIN.com/ActivateResend.php>here</a> to retry.";
    include(
"footer.php");
    exit();
    } else {
    echo 
"<br><br><h3>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 <a href=http://www.YOURDOMAIN.com/modules/contact_plus/index.php>administrators</a></h3>";
    }
}
include(
"footer.php");
reset ($HTTP_GET_VARS);
reset ($HTTP_POST_VARS);
?>