Changeset 8194
- Timestamp:
- 03/28/2014 11:35:24 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-admin.php
r8193 r8194 1382 1382 // Reply - javascript only; implemented by AJAX. 1383 1383 if ( 'spam' != $item_status ) { 1384 $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) ); 1384 if ( $this->can_comment( $item ) ) { 1385 $actions['reply'] = sprintf( '<a href="#" class="reply hide-if-no-js">%s</a>', __( 'Reply', 'buddypress' ) ); 1386 } else { 1387 $actions['reply'] = sprintf( '<span class="form-input-tip" title="%s">%s</span>', __( 'Replies are disabled for this activity item', 'buddypress' ), __( 'Replies disabled', 'buddypress' ) ); 1388 } 1385 1389 1386 1390 // Edit … … 1489 1493 1490 1494 /** 1495 * Checks if an activity item can be replied to. 1496 * 1497 * This method merges functionality from {@link bp_activity_can_comment()} and 1498 * {@link bp_blogs_disable_activity_commenting()}. This is done because the activity 1499 * list table doesn't use a BuddyPress activity loop, which prevents those 1500 * functions from working as intended. 1501 * 1502 * @since BuddyPress (2.0.0) 1503 * 1504 * @param array $item An array version of the BP_Activity_Activity object. 1505 * @return bool 1506 */ 1507 protected function can_comment( $item ) { 1508 $can_comment = true; 1509 1510 if ( $this->disable_blogforum_comments ) { 1511 switch ( $item['type'] ) { 1512 case 'new_blog_post' : 1513 case 'new_blog_comment' : 1514 case 'new_forum_topic' : 1515 case 'new_forum_post' : 1516 $can_comment = false; 1517 break; 1518 } 1519 1520 // activity comments supported 1521 } else { 1522 // activity comment 1523 if ( 'activity_comment' == $item['type'] ) { 1524 // blogs 1525 if ( bp_is_active( 'blogs' ) ) { 1526 // grab the parent activity entry 1527 $parent_activity = new BP_Activity_Activity( $item['item_id'] ); 1528 1529 // fetch blog post comment depth and if the blog post's comments are open 1530 bp_blogs_setup_activity_loop_globals( $parent_activity ); 1531 1532 // check if the activity item can be replied to 1533 if ( false === bp_blogs_can_comment_reply( true, $item ) ) { 1534 $can_comment = false; 1535 } 1536 } 1537 1538 // blog post 1539 } elseif ( 'new_blog_post' == $item['type'] ) { 1540 if ( bp_is_active( 'blogs' ) ) { 1541 bp_blogs_setup_activity_loop_globals( (object) $item ); 1542 1543 if ( empty( buddypress()->blogs->allow_comments[$item['id']] ) ) { 1544 $can_comment = false; 1545 } 1546 } 1547 } 1548 } 1549 1550 return apply_filters( 'bp_activity_list_table_can_comment', $can_comment ); 1551 } 1552 1553 /** 1491 1554 * Flatten the activity array. 1492 1555 *
Note: See TracChangeset
for help on using the changeset viewer.