discuz增加邮件通知功能

直接上代码
    
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',
            ));
 
        }
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值