1. 程式人生 > >discuz增加郵件通知功能

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',             ));         }