Changeset 5408
- Timestamp:
- 06/16/2014 08:45:38 PM (12 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
-
core/actions.php (modified) (1 diff)
-
topics/functions.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/core/actions.php
r5405 r5408 263 263 add_action( 'bbp_spam_reply', 'bbp_decrease_user_reply_count' ); 264 264 265 // Topic status transition helpers for replies 266 add_action( 'bbp_trash_topic', 'bbp_trash_topic_replies' ); 267 add_action( 'bbp_untrash_topic', 'bbp_untrash_topic_replies' ); 268 add_action( 'bbp_delete_topic', 'bbp_delete_topic_replies' ); 269 add_action( 'bbp_spam_topic', 'bbp_spam_topic_replies' ); 270 add_action( 'bbp_unspam_topic', ' bbp_unspam_topic_replies' ); 271 265 272 // User status 266 273 // @todo make these sub-actions -
trunk/src/includes/topics/functions.php
r5407 r5408 2772 2772 } 2773 2773 2774 // Bail if already open2774 // Bail if not closed 2775 2775 if ( bbp_get_closed_status_id() !== $topic->post_status ) { 2776 2776 return false; … … 2781 2781 2782 2782 // Get previous status 2783 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 2783 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 2784 2785 // If no previous status, default to publish 2786 if ( empty( $topic_status ) ) { 2787 $topic_status = bbp_get_public_status_id(); 2788 } 2784 2789 2785 2790 // Set previous status … … 2834 2839 do_action( 'bbp_spam_topic', $topic_id ); 2835 2840 2836 // Trash replies to the topic2837 bbp_spam_topic_replies();2838 2839 2841 // Set post status to spam 2840 2842 $topic->post_status = bbp_get_spam_status_id(); 2841 2843 2842 2844 // Empty the topic of its tags 2843 $topic->tax_input = bbp_spam_topic_tags( );2845 $topic->tax_input = bbp_spam_topic_tags( $topic_id ); 2844 2846 2845 2847 // No revisions … … 2971 2973 // Execute pre unspam code 2972 2974 do_action( 'bbp_unspam_topic', $topic_id ); 2973 2974 // Untrash the replies to a previously spammed topic2975 bbp_unspam_topic_replies();2976 2975 2977 2976 // Get pre spam status … … 3079 3078 */ 3080 3079 function bbp_stick_topic( $topic_id = 0, $super = false ) { 3080 3081 // Validation 3081 3082 $topic_id = bbp_get_topic_id( $topic_id ); 3082 3083 3083 3084 // Bail if a topic is not a topic (prevents revisions as stickies) 3084 if ( ! bbp_is_topic( $topic_id ) ) 3085 if ( ! bbp_is_topic( $topic_id ) ) { 3085 3086 return false; 3087 } 3086 3088 3087 3089 // We may have a super sticky to which we want to convert into a normal … … 3114 3116 $success = !empty( $super ) ? update_option( '_bbp_super_sticky_topics', $stickies ) : update_post_meta( $forum_id, '_bbp_sticky_topics', $stickies ); 3115 3117 3116 do_action( 'bbp_st icked_topic', $topic_id, $super, $success );3118 do_action( 'bbp_stuck_topic', $topic_id, $super, $success ); 3117 3119 3118 3120 return (bool) $success; … … 3134 3136 * @uses delete_post_meta() To delete the forum stickies meta 3135 3137 * @uses update_post_meta() To update the forum stickies meta 3136 * @uses do_action() Calls 'bbp_unst icked_topic' with the topic id and success3138 * @uses do_action() Calls 'bbp_unstuck_topic' with the topic id and success 3137 3139 * @return bool Always true. 3138 3140 */ … … 3161 3163 } 3162 3164 3163 do_action( 'bbp_unst icked_topic', $topic_id, $success );3165 do_action( 'bbp_unstuck_topic', $topic_id, $success ); 3164 3166 3165 3167 return (bool) $success; … … 3189 3191 $topic_id = bbp_get_topic_id( $topic_id ); 3190 3192 3191 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) {3193 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) { 3192 3194 return false; 3193 3195 } 3194 3196 3195 3197 do_action( 'bbp_delete_topic', $topic_id ); 3196 3197 bbp_delete_topic_replies( $topic_id );3198 3198 } 3199 3199 … … 3253 3253 $topic_id = bbp_get_topic_id( $topic_id ); 3254 3254 3255 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) {3255 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) { 3256 3256 return false; 3257 3257 } 3258 3258 3259 3259 do_action( 'bbp_trash_topic', $topic_id ); 3260 3261 bbp_trash_topic_replies( $topic_id );3262 3260 } 3263 3261 … … 3326 3324 3327 3325 do_action( 'bbp_untrash_topic', $topic_id ); 3328 3329 bbp_untrash_topic_replies( $topic_id );3330 3326 } 3331 3327 … … 3373 3369 $topic_id = bbp_get_topic_id( $topic_id ); 3374 3370 3375 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) )3371 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) { 3376 3372 return false; 3373 } 3377 3374 3378 3375 do_action( 'bbp_deleted_topic', $topic_id ); … … 3389 3386 $topic_id = bbp_get_topic_id( $topic_id ); 3390 3387 3391 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) )3388 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) { 3392 3389 return false; 3390 } 3393 3391 3394 3392 do_action( 'bbp_trashed_topic', $topic_id ); … … 3405 3403 $topic_id = bbp_get_topic_id( $topic_id ); 3406 3404 3407 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) )3405 if ( empty( $topic_id ) || ! bbp_is_topic( $topic_id ) ) { 3408 3406 return false; 3407 } 3409 3408 3410 3409 do_action( 'bbp_untrashed_topic', $topic_id ); … … 3617 3616 3618 3617 // Bail if not editing a topic 3619 if ( ! bbp_is_topic_edit() )3618 if ( ! bbp_is_topic_edit() ) { 3620 3619 return; 3620 } 3621 3621 3622 3622 // User cannot edit topic, so redirect back to topic … … 3641 3641 3642 3642 // Bail if not editing a topic tag 3643 if ( ! bbp_is_topic_tag_edit() )3643 if ( ! bbp_is_topic_tag_edit() ) { 3644 3644 return; 3645 } 3645 3646 3646 3647 // Bail if current user cannot edit topic tags
Note: See TracChangeset
for help on using the changeset viewer.