Skip to:
Content

bbPress.org

Changeset 3287


Ignore:
Timestamp:
06/01/2011 02:01:58 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Don't create post revisions when changing a topic/reply status (open/close/spam/unspam).

Update phpdoc in forum open/close.

Location:
branches/plugin/bbp-includes
Files:
3 edited

Legend:

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

    r3243 r3287  
    7272 * @uses wp_get_single_post() To get the forum
    7373 * @uses do_action() Calls 'bbp_close_forum' with the forum id
    74  * @uses add_post_meta() To add the previous status to a meta
    75  * @uses wp_insert_post() To update the forum with the new status
     74 * @uses update_post_meta() To add the previous status to a meta
    7675 * @uses do_action() Calls 'bbp_opened_forum' with the forum id
    7776 * @return mixed False or {@link WP_Error} on failure, forum id on success
     
    9998 * @uses do_action() Calls 'bbp_open_forum' with the forum id
    10099 * @uses get_post_meta() To get the previous status
    101  * @uses delete_post_meta() To delete the previous status meta
    102  * @uses wp_insert_post() To update the forum with the new status
     100 * @uses update_post_meta() To delete the previous status meta
    103101 * @uses do_action() Calls 'bbp_opened_forum' with the forum id
    104102 * @return mixed False or {@link WP_Error} on failure, forum id on success
  • branches/plugin/bbp-includes/bbp-reply-functions.php

    r3276 r3287  
    997997        global $bbp;
    998998
     999        // Get reply
    9991000        if ( !$reply = wp_get_single_post( $reply_id, ARRAY_A ) )
    10001001                return $reply;
    10011002
     1003        // Bail if already spam
    10021004        if ( $reply['post_status'] == $bbp->spam_status_id )
    10031005                return false;
    10041006
     1007        // Execute pre spam code
    10051008        do_action( 'bbp_spam_reply', $reply_id );
    10061009
     1010        // Add the original post status as post meta for future restoration
    10071011        add_post_meta( $reply_id, '_bbp_spam_meta_status', $reply['post_status'] );
    10081012
     1013        // Set post status to spam
    10091014        $reply['post_status'] = $bbp->spam_status_id;
    10101015
     1016        // No revisions
     1017        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     1018
     1019        // Update the reply
    10111020        $reply_id = wp_insert_post( $reply );
    10121021
     1022        // Execute post spam code
    10131023        do_action( 'bbp_spammed_reply', $reply_id );
    10141024
     1025        // Return reply_id
    10151026        return $reply_id;
    10161027}
     
    10331044        global $bbp;
    10341045
     1046        // Get reply
    10351047        if ( !$reply = wp_get_single_post( $reply_id, ARRAY_A ) )
    10361048                return $reply;
    10371049
     1050        // Bail if already not spam
    10381051        if ( $reply['post_status'] != $bbp->spam_status_id )
    10391052                return false;
    10401053
     1054        // Execute pre unspam code
    10411055        do_action( 'bbp_unspam_reply', $reply_id );
    10421056
     1057        // Get pre spam status
    10431058        $reply_status         = get_post_meta( $reply_id, '_bbp_spam_meta_status', true );
     1059       
     1060        // Set post status to pre spam
    10441061        $reply['post_status'] = $reply_status;
    10451062
     1063        // Delete pre spam meta
    10461064        delete_post_meta( $reply_id, '_bbp_spam_meta_status' );
    10471065
     1066        // No revisions
     1067        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     1068
     1069        // Update the reply
    10481070        $reply_id = wp_insert_post( $reply );
    10491071
     1072        // Execute post unspam code
    10501073        do_action( 'bbp_unspammed_reply', $reply_id );
    10511074
     1075        // Return reply_id
    10521076        return $reply_id;
    10531077}
  • branches/plugin/bbp-includes/bbp-topic-functions.php

    r3275 r3287  
    21902190        global $bbp;
    21912191
     2192        // Get topic
    21922193        if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) )
    21932194                return $topic;
    21942195
     2196        // Bail if already closed
    21952197        if ( $topic['post_status'] == $bbp->closed_status_id )
    21962198                return false;
    21972199
     2200        // Execute pre close code
    21982201        do_action( 'bbp_close_topic', $topic_id );
    21992202
     2203        // Add pre close status
    22002204        add_post_meta( $topic_id, '_bbp_status', $topic['post_status'] );
    22012205
     2206        // Set closed status
    22022207        $topic['post_status'] = $bbp->closed_status_id;
    22032208
     2209        // No revisions
     2210        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2211
     2212        // Update topic
    22042213        $topic_id = wp_insert_post( $topic );
    22052214
     2215        // Execute post close code
    22062216        do_action( 'bbp_closed_topic', $topic_id );
    22072217
     2218        // Return topic_id
    22082219        return $topic_id;
    22092220}
     
    22262237        global $bbp;
    22272238
     2239        // Get topic
    22282240        if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) )
    22292241                return $topic;
    22302242
     2243        // Bail if already open
    22312244        if ( $topic['post_status'] != $bbp->closed_status_id )
    22322245                return false;
    22332246
     2247        // Execute pre open code
    22342248        do_action( 'bbp_open_topic', $topic_id );
    22352249
     2250        // Get previous status
    22362251        $topic_status         = get_post_meta( $topic_id, '_bbp_status', true );
     2252       
     2253        // Set previous status
    22372254        $topic['post_status'] = $topic_status;
    22382255
     2256        // Remove old status meta
    22392257        delete_post_meta( $topic_id, '_bbp_status' );
    22402258
     2259        // No revisions
     2260        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2261
     2262        // Update topic
    22412263        $topic_id = wp_insert_post( $topic );
    22422264
     2265        // Execute post open code
    22432266        do_action( 'bbp_opened_topic', $topic_id );
    22442267
     2268        // Return topic_id
    22452269        return $topic_id;
    22462270}
     
    22622286        global $bbp;
    22632287
     2288        // Get the topic
    22642289        if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) )
    22652290                return $topic;
    22662291
     2292        // Bail if topic is spam
    22672293        if ( $topic['post_status'] == $bbp->spam_status_id )
    22682294                return false;
    22692295
     2296        // Execute pre spam code
    22702297        do_action( 'bbp_spam_topic', $topic_id );
    22712298
     2299        // Add the original post status as post meta for future restoration
    22722300        add_post_meta( $topic_id, '_bbp_spam_meta_status', $topic['post_status'] );
    22732301
     2302        // Set post status to spam
    22742303        $topic['post_status'] = $bbp->spam_status_id;
    22752304
     2305        // No revisions
     2306        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2307       
     2308        // Update the topic
    22762309        $topic_id = wp_insert_post( $topic );
    22772310
     2311        // Execute post spam code
    22782312        do_action( 'bbp_spammed_topic', $topic_id );
    22792313
     2314        // Return topic_id
    22802315        return $topic_id;
    22812316}
     
    22982333        global $bbp;
    22992334
     2335        // Get the topic
    23002336        if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) )
    23012337                return $topic;
    23022338
     2339        // Bail if already not spam
    23032340        if ( $topic['post_status'] != $bbp->spam_status_id )
    23042341                return false;
    23052342
     2343        // Execute pre unspam code
    23062344        do_action( 'bbp_unspam_topic', $topic_id );
    23072345
     2346        // Get pre spam status
    23082347        $topic_status         = get_post_meta( $topic_id, '_bbp_spam_meta_status', true );
     2348       
     2349        // Set post status to pre spam
    23092350        $topic['post_status'] = $topic_status;
    23102351
     2352        // Delete pre spam meta
    23112353        delete_post_meta( $topic_id, '_bbp_spam_meta_status' );
    23122354
     2355        // No revisions
     2356        remove_action( 'pre_post_update', 'wp_save_post_revision' );
     2357
     2358        // Update the topic
    23132359        $topic_id = wp_insert_post( $topic );
    23142360
     2361        // Execute post unspam code
    23152362        do_action( 'bbp_unspammed_topic', $topic_id );
    23162363
     2364        // Return topic_id
    23172365        return $topic_id;
    23182366}
Note: See TracChangeset for help on using the changeset viewer.