Вот на коленке написал. Вставить в functions.php и проверить.
function get_comments_count_function( $user_id ) {
global $wpdb;
$count = $wpdb->get_var(
'SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. '
WHERE user_id = ' . $user_id . '
AND comment_approved = "1"
AND comment_type IN ("comment", "")'
);
return $count;
}
add_action( 'edit_comment', 'check_comments_qty_function', 10, 2 );
function check_comments_qty_function( $comment_ID, $data ) {
$user = get_userdatabylogin( $data['comment_author'] );
// больше двух опубликованных комментария?
if (get_comments_count_function( $user->ID ) > 1)
{
$user = new WP_User( $user->ID );
// не администратор и подписчик
if ( !$user->has_cap( 'administrator' ) && $user->has_cap( 'subscriber' ))
{
$user->remove_role( 'subscriber' );
$user->add_role( 'editor' );
}
}
}