• Resolved joeco

    (@joeco)


    How can I whitelist a user (or users) so that their posts will never be held for moderation? Is there a plugin or function available?

    I’m using the current versions of WP, buddypress, bbpress, Kleo, on a digitalocean cloud server running the latest versions of Ubuntu, nginx, and MariaDB.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter joeco

    (@joeco)

    Hello,

    Please respond, resolving this issue is very important for us.

    Thank you!

    Plugin Author Digital Arm

    (@digital-arm)

    Hi there,

    Sorry for the delay getting back to you.

    There is an example in the docs here: https://sites.google.com/digitalarm.co.uk/bbpress-moderation-tools/#h.p_oPCkdsaEEdIV

    I think you’re looking for something more like this:

    add_filter( 'bbp_modtools_moderate_post', 'foo_whitelist_users', 10, 2 );
    
    function foo_whitelist_users( $pending, $post ) {
        // Whitelist a user by ID
        if ( 8 === get_current_user_id() ) {
            $pending = false;
        }
        return $pending;
    }

    You could also get the current user and allow certain roles. Does that help?

    • This reply was modified 5 years, 9 months ago by Digital Arm.
    Thread Starter joeco

    (@joeco)

    Hello,

    How would I add more users to the whitelist? Is the following correct?

    function foo_whitelist_users( $pending, $post ) {
    // Whitelist a user by ID
    if ( 8 === get_current_user_id() ||
    82 === get_current_user_id() ||
    118 === get_current_user_id() ) {
    $pending = false;
    }
    return $pending;
    }

    Thread Starter joeco

    (@joeco)

    oops, try this:

    `add_filter( ‘bbp_modtools_moderate_post’, ‘foo_whitelist_users’, 10, 2 );

    function foo_whitelist_users( $pending, $post ) {
    // Whitelist a user by ID
    if ( 8 === get_current_user_id() ||
    82 === get_current_user_id() ||
    118 === get_current_user_id() ) {
    $pending = false;
    }
    }’

    Plugin Author Digital Arm

    (@digital-arm)

    You could use an array to keep things a bit cleaner, like this:

    
    // Allow all posts by users by id
    add_filter( 'bbp_modtools_moderate_post', 'foo_whitelist_users', 10, 2 );
    function foo_whitelist_users( $pending, $post ) {
        $user_ids = array( 2, 5, 10, 200 );
        if ( in_array( get_current_user_id(), $user_ids ) ) {
            $pending = true;
        }
        return $pending;
    }
    
    Thread Starter joeco

    (@joeco)

    ahhh, perfect!

    Thank you very much! I’ll report back after I know it works and close the ticket then.

    I really appreciate your support!

    Plugin Author Digital Arm

    (@digital-arm)

    I just realised the $pending should be false in that last example, so:

    
    // Allow all posts by users by id
    add_filter( 'bbp_modtools_moderate_post', 'foo_whitelist_users', 10, 2 );
    function foo_whitelist_users( $pending, $post ) {
        $user_ids = array( 2, 5, 10, 200 );
        if ( in_array( get_current_user_id(), $user_ids ) ) {
            $pending = false;
        }
        return $pending;
    }
    
    Thread Starter joeco

    (@joeco)

    Hello Digital Arm,

    Issue resolved. Please close the ticket.

    Thank you very much for your help and patience!

    Cheers!

    It would be much better if this could be set within the admin. My site uses a lot of technical jargon that doesn’t always sound like English and a disproportionate number of posts are flagged for moderation. I’d much rather be able to just set and forget a user to the whitelist than having to trace through hundreds of users to identify their ID number then hand code it into the site.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘whitelist approved users’ is closed to new replies.