Changeset 8697
- Timestamp:
- 07/27/2014 03:01:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r8685 r8697 1636 1636 global $activities_template; 1637 1637 1638 if ( !$activity ) 1638 // Try to use current activity if none was passed 1639 if ( empty( $activity ) && ! empty( $activities_template->activity ) ) { 1639 1640 $activity = $activities_template->activity; 1640 1641 if ( isset( $activity->current_comment ) ) 1641 } 1642 1643 // If current_comment is set, we'll use that in place of the main activity 1644 if ( isset( $activity->current_comment ) ) { 1642 1645 $activity = $activity->current_comment; 1643 1646 } 1647 1648 // Assume the user cannot delete the activity item 1644 1649 $can_delete = false; 1645 1650 1646 if ( bp_current_user_can( 'bp_moderate' ) ) 1647 $can_delete = true; 1648 1649 if ( is_user_logged_in() && $activity->user_id == bp_loggedin_user_id() ) 1650 $can_delete = true; 1651 1652 if ( bp_is_item_admin() && bp_is_single_item() ) 1653 $can_delete = true; 1654 1655 return apply_filters( 'bp_activity_user_can_delete', $can_delete, $activity ); 1651 // Only logged in users can delete activity 1652 if ( is_user_logged_in() ) { 1653 1654 // Community moderators can always delete activity (at least for now) 1655 if ( bp_current_user_can( 'bp_moderate' ) ) { 1656 $can_delete = true; 1657 } 1658 1659 // Users are allowed to delete their own activity. This is actually 1660 // quite powerful, because doing so also deletes all comments to that 1661 // activity item. We should revisit this eventually. 1662 if ( $activity->user_id === bp_loggedin_user_id() ) { 1663 $can_delete = true; 1664 } 1665 1666 // Viewing a single item, and this user is an admin of that item 1667 if ( bp_is_single_item() && bp_is_item_admin() ) { 1668 $can_delete = true; 1669 } 1670 } 1671 1672 return (bool) apply_filters( 'bp_activity_user_can_delete', $can_delete, $activity ); 1656 1673 } 1657 1674
Note: See TracChangeset
for help on using the changeset viewer.