WordPress评论发送短信通知

时间:2012-05-17 | 分类:WordPress,学习园地 | 浏览:8859 | 评论:15 | 发表评论

1、下载PHP飞信发送类,下载地址见//www.poboke.com/study/php-login-wap-fetion-send-message.html

2、将PHP飞信发送类PHPFetion.php放到使用的主题根目录下。

3、进入博客后台,点击“外观”选项卡下的“编辑”选项,进入主题编辑界面,在functions.php文件中的<?php和?>之间添加以下函数即可:

require 'PHPFetion.php';
  
//评论发短信
function comment_fetion_notify($comment_id) {
  
    $comment = get_comment($comment_id);    //获取评论内容
    $spam_confirmed = $comment->comment_approved;    //是否垃圾评论
      
    if($spam_confirmed != 'spam') {
        $author = trim($comment->comment_author);    //作者
        $title = get_the_title($comment->comment_post_ID);   //文章标题
        $comment = trim($comment->comment_content);  //评论内容
        $msg = "【".$author."】评论了《".$title."》:".$comment;
        $fetion = new PHPFetion(手机号, 飞信密码);
        $fetion->send(手机号, $msg);
    }
}
add_action('comment_post', 'comment_fetion_notify');

4、效果预览:

.

标签: , ,
本文链接: WordPress评论发送短信通知
版权所有: 破博客, 转载请注明本文出处。

15个评论

  1. Dash Clothing
    2012/11/18 01:39:12

    My spouse and I stumbled over here different web page and thought I may as well check things out.

    I like what I see so now i’m following you. Look forward to looking at your web page for a second time.

    • admin
      2012/11/20 19:34:01

      You are welcome.

  2. flex belt
    2012/10/11 21:24:56

    I used to be recommended this blog by my cousin.

    I am now not positive whether or not this put up is written via him as nobody else recognise such specific about my difficulty.
    You’re wonderful! Thank you!

    • admin
      2012/11/01 18:47:16

      Thank you,too!

  3. Eddy
    2012/09/27 07:37:05

    It’s going to be finish of mine day, except before end I am reading this great paragraph to increase my knowledge.

    • admin
      2012/09/27 09:00:27

      I think you will become an expert if you can always visit my site.

  4. xilouqingzhu
    2012/09/21 17:07:01

    这个。。又来看博主了,,那些英文好牛叉额。。飞信是免费的把。 手机版的站点应该可以回复评论了。这样直接不用在电脑边了。

    • admin
      2012/09/21 19:36:39

      最近的飞信一直改版,所以自动发飞信经常失效。

  5. Cruz
    2012/09/18 22:06:30

    Everything is very open with a very clear clarification of the challenges.
    It was really informative. Your website is very useful. Many thanks for sharing!

    • admin
      2012/09/19 22:19:16

      You are welcome!

  6. Dorris
    2012/09/13 23:21:36

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your
    point. You obviously know what youre talking about, why
    waste your intelligence on just posting videos to your weblog when you
    could be giving us something enlightening to read?

    • admin
      2012/09/17 13:36:25

      I don’t know what you’re talking about, but I feel it very powerful.

  7. 小爱
    2012/05/18 21:27:46

    :wink: 这个很棒啊!!!博主可以第1时间来查看或回复评论。

    • admin
      2012/05/18 23:45:39

      是啊,不过还要在电脑旁才可以 :sad:

  8. admin
    2012/05/17 13:16:12

    写得太好了