discuz回贴通知插件实现-获取邮件内容

//自定义钩子函数,命名:模块_函数名_output()或模块_函数名()
//一个是模块执行完,模板输出前执行。一个是模块执行前
//post_reply_output函数会在所有post操作中都会执行,通过$params['message']来区别
public function post_reply_output($params) {
    global $_G;

    //判断是否为主题回复成功时
    if($params['message'] != 'post_reply_succeed') {
        return;
    }

    //如果操作的是系统表,先获得系统表的模型,
    //在discuz目录的source/class/table下
    $mForumThread = C::t('forum_thread');
    $tid = $params['values']['tid'];
    $thread = $mForumThread->fetch($tid);
    //主题作者ID
    $authorId = $thread['authorid'];
    //判断作者是否开启回贴通知
    $mForumPostNotice = C::t('#post_notice#forum_post_notice');
    $isNotice = $mForumPostNotice->getNoticeState($authorId);
    if($isNotice) {
        $mCommonMember = C::t('common_member');
        $author = $mCommonMember->fetch($authorId);
        $email = $author['email'];
        $subject = '您的贴子有回复了!';
        $body = $author['username'] . "\n";
        $body .= "您的主题:" . $thread['subject'] . "有回复了!\n";
        $body .= "复制链接查看:" . $_G['siteurl'] . "forum.php?mod=viewthread&tid=" . $tid . "\n";
        
        //判断后台是否开启了添加回贴内容
        if($_G['cache']['plugin']['post_notice']['add_postcont']) {
            //回复内容
            $mForumPost = C::t('forum_post');
            $pid = $params['values']['pid'];
            $post = $mForumPost->fetch($thread['posttableid'],$pid);
            $body .= "回复内容:\n" . $post['message'];
        }
        
        //发送邮箱
        
    } else {
        return;
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值