Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/10/2011 10:27:19 PM (13 years ago)
Author:
johnjamesjacoby
Message:

API adjustments:

  • Refactor _status_ vars into callable functions.
  • Audit usage of $bbp global.
  • Perform get_class() checks on extensions to avoid errors if global $bbp is overloaded.
  • Bump DB version to 175.
File:
1 edited

Legend:

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

    r3501 r3505  
    3232    $default_reply = array(
    3333        'post_parent'   => 0, // topic ID
    34         'post_status'   => 'publish',
     34        'post_status'   => bbp_get_public_status_id(),
    3535        'post_type'     => bbp_get_reply_post_type(),
    3636        'post_author'   => 0,
     
    116116        return;
    117117
    118     global $bbp;
    119 
    120118    // Nonce check
    121119    check_admin_referer( 'bbp-new-reply' );
     
    232230            'post_content' => $reply_content,
    233231            'post_parent'  => $topic_id,
    234             'post_status'  => 'publish',
     232            'post_status'  => bbp_get_public_status_id(),
    235233            'post_type'    => bbp_get_reply_post_type()
    236234        );
     
    264262            // If this reply starts as trash, add it to pre_trashed_replies
    265263            // for the topic, so it is properly restored.
    266             if ( bbp_is_topic_trash( $topic_id ) || ( $reply_data['post_status'] == $bbp->trash_status_id ) ) {
     264            if ( bbp_is_topic_trash( $topic_id ) || ( $reply_data['post_status'] == bbp_get_trash_status_id() ) ) {
    267265
    268266                // Trash the reply
     
    282280
    283281            // If reply or topic are spam, officially spam this reply
    284             if ( bbp_is_topic_spam( $topic_id ) || ( $reply_data['post_status'] == $bbp->spam_status_id ) )
    285                 add_post_meta( $reply_id, '_bbp_spam_meta_status', 'publish' );
     282            if ( bbp_is_topic_spam( $topic_id ) || ( $reply_data['post_status'] == bbp_get_spam_status_id() ) )
     283                add_post_meta( $reply_id, '_bbp_spam_meta_status', bbp_get_public_status_id() );
    286284
    287285            /** Update counts, etc... *****************************************/
     
    10781076 */
    10791077function bbp_spam_reply( $reply_id = 0 ) {
    1080     global $bbp;
    10811078
    10821079    // Get reply
     
    10851082
    10861083    // Bail if already spam
    1087     if ( $reply['post_status'] == $bbp->spam_status_id )
     1084    if ( bbp_get_spam_status_id() == $reply['post_status'] )
    10881085        return false;
    10891086
     
    10951092
    10961093    // Set post status to spam
    1097     $reply['post_status'] = $bbp->spam_status_id;
     1094    $reply['post_status'] = bbp_get_spam_status_id();
    10981095
    10991096    // No revisions
     
    11251122 */
    11261123function bbp_unspam_reply( $reply_id = 0 ) {
    1127     global $bbp;
    11281124
    11291125    // Get reply
     
    11321128
    11331129    // Bail if already not spam
    1134     if ( $reply['post_status'] != $bbp->spam_status_id )
     1130    if ( bbp_get_spam_status_id() != $reply['post_status'] )
    11351131        return false;
    11361132
Note: See TracChangeset for help on using the changeset viewer.