国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 浦城县| 汝州市| 榕江县| 神池县| 东乡县| 泾阳县| 威宁| 绥德县| 巩留县| 南召县| 丹棱县| 阜宁县| 页游| 广德县| 南康市| 兖州市| 西平县| 南澳县| 淅川县| 建水县| 汨罗市| 昌黎县| 双牌县| 扎囊县| 武乡县| 福州市| 横峰县| 新巴尔虎右旗| 礼泉县| 贡山| 德清县| 荆门市| 无极县| 和田县| 华容县| 延川县| 南京市| 辽阳市| 星座| 体育| 巩留县|