Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/02/2011 10:56:32 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Introduce bbp_check_for_moderation() to check moderation_keys and comment_max_links before publishing topics and replies. Also introduces function for getting the pending post status, and adds missing status vars to bbPress class. See #1672.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-functions.php

    r3574 r3581  
    229229                bbp_add_error( 'bbp_topic_duplicate', __( '<strong>ERROR</strong>: Duplicate topic detected; it looks as though you&#8217;ve already said that!', 'bbpress' ) );
    230230
    231         /** topic Blacklist *******************************************************/
     231        /** Topic Blacklist *******************************************************/
    232232       
    233233        if ( !bbp_check_for_blacklist( $anonymous_data, $topic_author, $topic_title, $topic_content ) )
    234234                bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be created at this time.', 'bbpress' ) );
     235
     236        /** Topic Moderation ******************************************************/
     237       
     238        $post_status = bbp_get_public_status_id();
     239        if ( !bbp_check_for_moderation( $anonymous_data, $topic_author, $topic_title, $topic_content ) )
     240                $post_status = bbp_get_pending_status_id();
    235241
    236242        /** Topic Tags ************************************************************/
    … …  
    266272                        'post_parent'  => $forum_id,
    267273                        'tax_input'    => $terms,
    268                         'post_status'  => bbp_get_public_status_id(),
     274                        'post_status'  => $post_status,
    269275                        'post_type'    => bbp_get_topic_post_type()
    270276                );
    … …  
    527533                bbp_add_error( 'bbp_topic_blacklist', __( '<strong>ERROR</strong>: Your topic cannot be edited at this time.', 'bbpress' ) );
    528534
     535        /** Topic Moderation ******************************************************/
     536       
     537        $post_status = bbp_get_public_status_id();
     538        if ( !bbp_check_for_moderation( $anonymous_data, bbp_get_topic_author_id( $topic_id ), $topic_title, $topic_content ) )
     539                $post_status = bbp_get_pending_status_id();
     540
    529541        /** Topic Tags ************************************************************/
    530542
    … …  
    583595                        'post_title'   => $topic_title,
    584596                        'post_content' => $topic_content,
     597                        'post_status'  => $post_status,
    585598                        'post_parent'  => $forum_id,
    586599                        'tax_input'    => $terms,
Note: See TracChangeset for help on using the changeset viewer.