morio (@morio)

Forum Replies Created

Viewing 1 replies (of 1 total)
  • In reply to: Post Moderation

    Simple bbpress topic moderation,this would go in your functions.php

    <br />
    /*<br />
    * all topics published by guests<br />
    * must be approved by admin<br />
    */<br />
    add_action( 'save_post', 'pending_guest_topics' );<br />
    function pending_guest_topics( $post_id ) {<br />
    if ($parent_id = wp_is_post_revision($post_id)) {<br />
    $post_id = $parent_id;<br />
    }</p>
    <p> if(!is_user_logged_in() && current_user_can('manage-options')==false) {<br />
    // unhook this function so it doesn't loop infinitely<br />
    remove_action('save_post', 'pending_guest_topics');<br />
    wp_update_post(array('ID' => $post_id, 'post_status' => 'pending'));</p>
    <p> // re-hook this function<br />
    add_action('save_post', 'pending_guest_topics');<br />
    }<br />

Viewing 1 replies (of 1 total)