Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thefuxia/3433535 to your computer and use it in GitHub Desktop.
Save thefuxia/3433535 to your computer and use it in GitHub Desktop.
T5 Auto-approve comments from logged in users
<?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