Changeset 6036 for trunk/src/includes/replies/functions.php
- Timestamp:
- 05/30/2016 10:28:36 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/functions.php
r6032 r6036 66 66 bbp_update_reply( $reply_id, $reply_meta['topic_id'], $reply_meta['forum_id'], array(), $reply_data['post_author'], false, $reply_meta['reply_to'] ); 67 67 68 /** 69 * Fires after reply has been inserted via `bbp_insert_reply`. 70 * 71 * @since 2.6.0 bbPress (r6036) 72 * 73 * @param int $reply_id The reply id. 74 * @param int $reply_meta['topic_id'] The reply topic meta. 75 * @param int $reply_meta['forum_id'] The reply forum meta. 76 */ 77 do_action( 'bbp_insert_reply', (int) $reply_id, (int) $reply_meta['topic_id'], (int) $reply_meta['forum_id'] ); 78 68 79 // Return new reply ID 69 80 return $reply_id; 81 } 82 83 /** 84 * Update counts after a reply is inserted via `bbp_insert_reply`. 85 * 86 * @since 2.6.0 bbPress (r6036) 87 * 88 * @param int $reply_id The reply id. 89 * @param int $topic_id The topic id. 90 * @param int $forum_id The forum id. 91 * 92 * @uses bbp_get_reply_status() To get the reply status 93 * @uses bbp_get_public_status_id() To get the public status id 94 * @uses bbp_increase_topic_reply_count() To bump the topics reply count by 1 95 * @uses bbp_increase_forum_reply_count() To bump the forums reply count by 1 96 * @uses bbp_increase_topic_reply_count_hidden() To bump the topics hidden reply 97 * count by 1 98 * 99 * @return void 100 */ 101 function bbp_insert_reply_update_counts( $reply_id = 0, $topic_id = 0, $forum_id = 0 ) { 102 103 // If the reply is public, update the forum/topic reply counts. 104 if ( bbp_get_reply_status( $reply_id ) === bbp_get_public_status_id() ) { 105 bbp_increase_topic_reply_count( $topic_id ); 106 bbp_increase_forum_reply_count( $forum_id ); 107 108 // If the reply isn't public only update the topic reply hidden count. 109 } else { 110 bbp_increase_topic_reply_count_hidden( $topic_id ); 111 } 70 112 } 71 113 … … 978 1020 979 1021 // Counts 980 bbp_update_topic_voice_count ( $ancestor ); 981 bbp_update_topic_reply_count ( $ancestor ); 982 bbp_update_topic_reply_count_hidden( $ancestor ); 1022 bbp_update_topic_voice_count( $ancestor ); 1023 1024 // Only update reply count if we're deleting a reply, or in the dashboard. 1025 if ( in_array( current_filter(), array( 'bbp_deleted_reply', 'save_post' ), true ) ) { 1026 bbp_update_topic_reply_count( $ancestor ); 1027 bbp_update_topic_reply_count_hidden( $ancestor ); 1028 } 983 1029 984 1030 // Forum meta relating to most recent topic … … 1004 1050 1005 1051 // Counts 1006 bbp_update_forum_reply_count( $ancestor ); 1052 // Only update reply count if we're deleting a reply, or in the dashboard. 1053 if ( in_array( current_filter(), array( 'bbp_deleted_reply', 'save_post' ), true ) ) { 1054 bbp_update_forum_reply_count( $ancestor ); 1055 } 1007 1056 } 1008 1057 }
Note: See TracChangeset
for help on using the changeset viewer.