Quote:
francis wrote:
but I don't understand where to put the code you mention. What to insert into notification.php?
Umm...
Quote:
I wrote like this:
I think you can easily solve this trouble by adding some codes to /html/class/xoopsmailer.php.
$pm_handler->setFromdelete($pm)[after $pm_handler->insert($pm)]
^^;;(Not test yet...but..it may work^^)
I mentioned notification.php just to show that auto-notification uses xoopsmailer.php to send PM.
So... you don't have to modify notification.php.
Just Add $pm_handler->setFromdelete($pm); to xoopsmailer.php
like This^^
/html/class/xoopsmailer.php
// private
function sendPM($uid, $subject, $body)
{
global $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$pm =& $pm_handler->create();
$pm->setVar("subject", $subject);
// RMV-NOTIFY
$pm->setVar('from_userid', !empty($this->fromUser) ? $this->fromUser->getVar('uid') : $xoopsUser->getVar('uid'));
$pm->setVar("msg_text", $body);
$pm->setVar("to_userid", $uid);
if (!$pm_handler->insert($pm)) {
return false;
}
//start
$pm_handler->setFromdelete($pm);
//end
return true;
}
Umm...
I tested and confirmed it works well this evening.
So..
I think other PMs(sent automatically from other modules)..also will be deleted automatically from OUTBOX/SENTBOX in the same way.
^^
Quote:
For me this is definitely a bug. Why do other users (non-admins) have Automatic Notifications in their SENT-Box? I thought that the admin sent the notifications and not the users?
^^...I also checked what you said above.
but...On my test-server..and public server....It works well..without any trouble.
If user has automatic notification PM in his/her postbox(outbox/sentbox/psavebox),
the reason is simply because that PM has his/her uid as from_userid.
^^
This is part of the criteria of OUTBOX.
Do you think OUTBOX can have PM which has other's uid as from_userid ?
$criteria = new CriteriaCompo(new Criteria('from_userid', $xoopsUser->getVar('uid')));
$criteria->add(new Criteria('read_msg', 0));
$criteria->add(new Criteria('from_delete', 0));
$criteria->add(new Criteria('to_delete', 0));
$criteria->add(new Criteria('from_save', 0));
Anyway...I think this line in xoopsmailer.php may cause PM(sent automatically) to have other' uid besides Admin as from_userid.
$pm->setVar('from_userid', !empty($this->fromUser) ? $this->fromUser->getVar('uid') : $xoopsUser->getVar('uid'));
As you know, it basically decides from_userid like this.(notification.php)
case XOOPS_NOTIFICATION_METHOD_PM:
$xoopsMailer->usePM();
$config_handler =& xoops_gethandler('config');
$xoopsMailerConfig =& $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
$xoopsMailer->setFromUser($member_handler->getUser($xoopsMailerConfig['fromuid']));
foreach ($tags as $k=>$v) {
$xoopsMailer->assign($k, $v);
}
break;