您的位置:首页 > 其它

discuz增加邮件通知功能

2016-03-13 22:44 405 查看
helper_notification.php

notification_add函数靠后部分修改:

require_once libfile('function/mail');
$mail_subject = lang('notification', 'mail_to_user');
if(empty($oldnote['new'])) {
C::t('common_member')->increase($touid, array('newprompt' => 1));
$newprompt = C::t('common_member_newprompt')->fetch($touid);
if($newprompt) {
$newprompt['data'] = unserialize($newprompt['data']);
if(!empty($newprompt['data'][$categoryname])) {
$newprompt['data'][$categoryname] = intval($newprompt['data'][$categoryname]) + 1;
} else {
$newprompt['data'][$categoryname] = 1;
}
C::t('common_member_newprompt')->update($touid, array('data' => serialize($newprompt['data'])));
} else {
C::t('common_member_newprompt')->insert($touid, array($categoryname => 1));
}

sendmail_touser($touid, $mail_subject, $notestring, $frommyapp ? 'myapp' : $type);

}
$user = getuserbyuid($touid);
sendmail($user['email'], $mail_subject, $notestring);

model_forum_post.php 修改:

if方法最后多加一个通知
if(!empty($this->param['noticeauthor']) && !$this->param['isanonymous'] && !$this->param['modnewreplies']) {
list($ac, $nauthorid) = explode('|', authcode($this->param['noticeauthor'], 'DECODE'));
if($nauthorid != $this->member['uid']) {
if($ac == 'q') {
notification_add($nauthorid, 'post', 'reppost_noticeauthor', array(
'tid' => $this->thread['tid'],
'subject' => $this->thread['subject'],
'fid' => $this->forum['fid'],
'pid' => $this->pid,
'from_id' => $this->pid,
'from_idtype' => 'quote',
));

} elseif($ac == 'r') {
notification_add($nauthorid, 'post', 'reppost_noticeauthor', array(
'tid' => $this->thread['tid'],
'subject' => $this->thread['subject'],
'fid' => $this->forum['fid'],
'pid' => $this->pid,
'from_id' => $this->thread['tid'],
'from_idtype' => 'post',
));

}
}
$thapost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($this->thread['tid'], 0);
notification_add($thapost['authorid'], 'post', 'reppost_noticeauthor', array(
'tid' => $this->thread['tid'],
'subject' => $this->thread['subject'],
'fid' => $this->forum['fid'],
'pid' => $this->pid,
'from_id' => $this->thread['tid'],
'from_idtype' => 'post',
));

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: