国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > CMS > Wordpress > 正文

wordpress自動(dòng)刪除重復(fù)評(píng)論方法

2024-09-07 00:51:50
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

wordpress中,已經(jīng)默認(rèn)加入了重復(fù)評(píng)論的限制,如果需要去掉這個(gè)限制,需要修改相應(yīng)的源代碼,具體如下.

wp-includes 文件夾下面 comment.php:

  1. function wp_allow_comment($commentdata) { 
  2. global $wpdb
  3. extract($commentdata, EXTR_SKIP); 
  4. // Simple duplicate check 
  5. // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content) 
  6. $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' "
  7. if ( $comment_author_email ) 
  8. $dupe .= "OR comment_author_email = '$comment_author_email' "
  9. $dupe .= ") AND comment_content = '$comment_content' LIMIT 1"
  10. // if ( $wpdb->get_var($dupe) ) { 
  11. // do_action( 'comment_duplicate_trigger', $commentdata ); 
  12. // if ( defined('DOING_AJAX') ) 
  13. // die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 
  14. // wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 
  15. // } 
  16. do_action( 'check_comment_flood'$comment_author_IP$comment_author_email$comment_date_gmt ); 
  17. if ( isset($user_id) && $user_id) { 
  18. $userdata = get_userdata($user_id); 
  19. $user = new WP_User($user_id); 
  20. $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1"$comment_post_ID)); 
  21. if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) { 
  22. // The author and the admins get respect. 
  23. $approved = 1; 
  24. else { 
  25. // Everyone else's comments will be checked. 
  26. if ( check_comment($comment_author$comment_author_email$comment_author_url$comment_content$comment_author_IP$comment_agent$comment_type) ) 
  27. $approved = 1;//開源軟件:Vevb.com 
  28. else 
  29. $approved = 0; 
  30. if ( wp_blacklist_check($comment_author$comment_author_email$comment_author_url$comment_content$comment_author_IP$comment_agent) ) 
  31. $approved = 'spam'
  32. $approved = apply_filters( 'pre_comment_approved'$approved$commentdata ); 
  33. return $approved

去掉下面部分即可:

  1. // if ( $wpdb->get_var($dupe) ) { 
  2. // do_action( 'comment_duplicate_trigger', $commentdata ); 
  3. // if ( defined('DOING_AJAX') ) 
  4. // die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 
  5. // wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 
  6. // } 

PS:修改前先記得備份哦.

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 万州区| 富平县| 寿阳县| 芦山县| 察隅县| 连云港市| 怀集县| 阿巴嘎旗| 秭归县| 庆云县| 双江| 茶陵县| 霍山县| 措美县| 丰都县| 新野县| 西青区| 蒙自县| 宜黄县| 安塞县| 乌海市| 石首市| 宝山区| 伊宁县| 蛟河市| 石城县| 从江县| 昌黎县| 灌南县| 宜兴市| 廊坊市| 克山县| 微山县| 株洲市| 绿春县| 阿尔山市| 六安市| 烟台市| 临沂市| 阿合奇县| 阿鲁科尔沁旗|