伙计们,我需要知道如何做到以下几点:
当我收到评论时。。。此评论必须由三位版主批准。显示在网站上。
有人知道怎么做吗,或者知道什么插件吗?
伙计们,我需要知道如何做到以下几点:
当我收到评论时。。。此评论必须由三位版主批准。显示在网站上。
有人知道怎么做吗,或者知道什么插件吗?
您可以使用comment_unapproved_to_approved
动作挂钩调用您的函数,该函数将使用commentmeta字段计算该评论被批准的次数或被多少用户批准,如果少于3,则我们将该评论更新为未批准:
<?php
/*
Plugin Name: 3-comment-mod
Plugin URI: http://en.bainternet.info
Description: Answer to http://wordpress.stackexchange.com/questions/15574/3-moderators-to-approve-comment/15595#15595
Version: 1.0
Author: Bainternet
Author URI: http://en.bainternet.info
*/
if(!function_exists(\'check_add_approved_count\')) {
function check_add_approved_count($comment){
global $current_user;
get_currentuserinfo();
//respect the admin comments approved by one approval
if (current_user_can(\'manage_options\')){
return \'\';
}
$mods = get_comment_meta($comment->comment_ID,\'approved_by\',true);
if(!empty($mods) && is_array($mods)){
//only allow each mod to approve once
if (in_array($current_user->ID,$mods)){
return \'\';
}else{
//here we check the count
if (count($mods) < 3){
//if less then 3 then
//we add the current mod to the approving list
$mods[] = $current_user->ID;
update_comment_meta($comment->comment_ID,\'approved_by\',$mods);
//and revert back the comment to not approved
$commentarr = get_comment($comment->comment_ID, ARRAY_A);
$commentarr[\'comment_approved\'] = 0;
wp_update_comment($commentarr);
}
}
}
//if we got here it means that this is the first approval
//so we just add the user to the list and revert back the comment to not approved
$mods[] = $current_user->ID;
update_comment_meta($comment->comment_ID,\'approved_by\',$mods);
//and revert back the comment to not approved
$commentarr = get_comment($comment->comment_ID, ARRAY_A);
$commentarr[\'comment_approved\'] = 0;
wp_update_comment($commentarr);
}
}
add_action(\'comment_unapproved_to_approved\',\'check_add_approved_count\');
?>
嘿,我试着使用wordpress的线程评论功能,但由于自定义主题,所以没有成功。我尝试了wp线程评论插件,它的工作方式很有魅力,但不幸的是,它与FV社区新闻插件有冲突,它在社区新闻区域/小部件上显示了一个回复按钮。所以我试着手动操作。。。没有运气。谁能给我提个建议或者告诉我什么地方我可以得到一些数据来解决这个问题吗。我的wordpress版本是3.0.4cheers当前注释。php<?php // Do not delete these lines if (!empty($_SERV