Ticket #7329: 7329.patch
File 7329.patch, 2.5 KB (added by , 8 years ago) |
---|
-
src/bp-activity/bp-activity-template.php
2234 2234 function bp_activity_comment_depth() { 2235 2235 echo bp_activity_get_comment_depth(); 2236 2236 } 2237 2237 2238 /** 2238 2239 * Return the current activity comment depth. 2239 2240 * 2240 2241 * @since 2.0.0 2241 2242 * 2243 * @param null|BP_Activity_Activity $comment 2244 * 2242 2245 * @return int $depth Depth for the current activity comment. 2243 2246 */ 2244 function bp_activity_get_comment_depth( ) {2247 function bp_activity_get_comment_depth( $comment = null ) { 2245 2248 global $activities_template; 2246 2249 2250 $depth = 1; 2251 2252 if ( ! empty( $comment->depth ) ) { 2253 $depth = $comment->depth; 2254 } elseif ( ! empty( $activities_template->activity->current_comment->depth ) ) { 2255 $depth = $activities_template->activity->current_comment->depth; 2256 } 2257 2247 2258 /** 2248 2259 * Filters the comment depth of the current activity comment. 2249 2260 * … … 2251 2262 * 2252 2263 * @param int $depth Depth for the current activity comment. 2253 2264 */ 2254 return apply_filters( 'bp_activity_get_comment_depth', $ activities_template->activity->current_comment->depth );2265 return apply_filters( 'bp_activity_get_comment_depth', $depth ); 2255 2266 } 2256 2267 2257 2268 /** -
src/bp-blogs/bp-blogs-activity.php
1299 1299 } 1300 1300 1301 1301 // Check comment depth and disable if depth is too large. 1302 if ( isset( buddypress()->blogs->thread_depth[ $comment->item_id] ) ){1303 if ( bp_activity_get_comment_depth( ) > buddypress()->blogs->thread_depth[$comment->item_id] ) {1302 if ( isset( buddypress()->blogs->thread_depth[ $comment->item_id ] ) ) { 1303 if ( bp_activity_get_comment_depth( $comment ) > buddypress()->blogs->thread_depth[ $comment->item_id ] ) { 1304 1304 $retval = false; 1305 1305 } 1306 1306 } 1307 1307 1308 1308 // Check if we should disable activity replies based on the parent activity. 1309 if ( isset( buddypress()->blogs->allow_comments[ $comment->item_id] ) ){1309 if ( isset( buddypress()->blogs->allow_comments[ $comment->item_id ] ) ) { 1310 1310 // The blog post has closed off commenting, so we should disable all activity 1311 1311 // comments under the parent 'new_blog_post' activity entry. 1312 if ( empty( buddypress()->blogs->allow_comments[ $comment->item_id] ) ) {1312 if ( empty( buddypress()->blogs->allow_comments[ $comment->item_id ] ) ) { 1313 1313 $retval = false; 1314 1314 } 1315 1315 }