Created
August 23, 2012 06:47
-
-
Save thefuxia/3433535 to your computer and use it in GitHub Desktop.
T5 Auto-approve comments from logged in users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Auto-approve comments from logged in users. | |
* Description: Allows users who are logged in to circumvent the moderation for the first comment. | |
* Plugin URI: http://toscho.de/?p=2138 | |
* Version: 2012.08.23 | |
* Author: Thomas Scholz | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
* | |
* T5 No comment moderation for logged in users, Copyright (C) 2012 Thomas Scholz | |
*/ | |
add_filter( 'pre_comment_approved', 't5_approve_logged_in_users' ); | |
/** | |
* Auto-approve comments from logged in users. | |
* | |
* @wp-hook pre_comment_approved | |
* @param int $approved Current approval status, 0 or 1 | |
* @return int | |
*/ | |
function t5_approve_logged_in_users( $approved ) | |
{ | |
return is_user_logged_in() ? 1 : $approved; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment