Ticket #2794: 2794.01.patch
File 2794.01.patch, 5.4 KB (added by , 10 years ago) |
---|
-
src/includes/extend/buddypress/activity.php
diff --git src/includes/extend/buddypress/activity.php src/includes/extend/buddypress/activity.php index 8097692..0cb2ffd 100644
class BBP_BuddyPress_Activity { 103 103 private function setup_globals() { 104 104 105 105 // The name of the BuddyPress component, used in activity streams 106 $this->component = 'bbpress'; 106 $this->component = 'bbpress'; 107 $this->groups_component = buddypress()->groups->id; 107 108 108 109 // Forums 109 110 $this->forum_create = 'bbp_forum_create'; … … class BBP_BuddyPress_Activity { 192 193 public function register_activity_actions() { 193 194 194 195 // Sitewide activity stream items 195 bp_activity_set_action( $this->component, $this->topic_create, esc_html__( 'New forum topic', 'bbpress' ) ); 196 bp_activity_set_action( $this->component, $this->reply_create, esc_html__( 'New forum reply', 'bbpress' ) ); 196 bp_activity_set_action( 197 $this->component, 198 $this->topic_create, 199 esc_html__( 'New forum topic', 'bbpress' ), 200 'bbp_bp_format_activity_action_new_topic', 201 __( 'Topics', 'bbpress' ), 202 array( 'activity', 'member', 'member_groups', 'group' ) 203 ); 204 205 bp_activity_set_action( 206 $this->component, 207 $this->reply_create, 208 esc_html__( 'New forum reply', 'bbpress' ), 209 'bbp_bp_format_activity_action_new_reply', 210 __( 'Replies', 'bbpress' ), 211 array( 'activity', 'member', 'member_groups', 'group' ) 212 ); 213 214 // Group forum activity stream items 215 bp_activity_set_action( 216 $this->groups_component, 217 $this->topic_create, 218 esc_html__( 'New forum topic', 'bbpress' ), 219 'bbp_bp_format_activity_action_new_topic', 220 __( 'Topics', 'bbpress' ), 221 array( 'activity', 'member', 'member_groups', 'group' ) 222 ); 223 224 bp_activity_set_action( 225 $this->groups_component, 226 $this->reply_create, 227 esc_html__( 'New forum reply', 'bbpress' ), 228 'bbp_bp_format_activity_action_new_reply', 229 __( 'Replies', 'bbpress' ), 230 array( 'activity', 'member', 'member_groups', 'group' ) 231 ); 197 232 } 198 233 199 234 /** … … class BBP_BuddyPress_Activity { 275 310 } 276 311 277 312 // Get the activity stream item, bail if it doesn't exist 278 $existing = bp_activity_get_specific( array( 'activity_ids' => $activity_id, 'show_hidden' => true, 'spam' => 'all', ));279 if ( empty( $existing ['total'] ) || ( 1 !== (int) $existing['total']) ) {313 $existing = new BP_Activity_Activity( $activity_id ); 314 if ( empty( $existing->component ) ) { 280 315 return null; 281 316 } 282 317 -
src/includes/extend/buddypress/functions.php
diff --git src/includes/extend/buddypress/functions.php src/includes/extend/buddypress/functions.php index 254266a..f25fad9 100644
function bbp_remove_forum_id_from_all_groups( $forum_id = 0 ) { 537 537 * @param int $forum_id 538 538 * @uses bbp_get_forum_id() To get the forum id 539 539 * @uses bbp_get_forum_group_ids() To get the forum's group ids 540 * @uses apply_filters() Calls 'bbp_forum_is_group_forum' with the forum id 540 * @uses apply_filters() Calls 'bbp_forum_is_group_forum' with the forum id 541 541 * @return bool True if it is a group forum, false if not 542 542 */ 543 543 function bbp_is_forum_group_forum( $forum_id = 0 ) { … … function bbp_group_is_creator() { 710 710 // Return the value 711 711 return (bool) $bbp->current_user->is_group_creator; 712 712 } 713 714 /** BuddyPress Activity Action Callbacks **************************************/ 715 716 function bbp_bp_format_activity_action_new_topic( $action, $activity ) { 717 718 // User link for topic author 719 $user_link = bbp_get_user_profile_link( $activity->user_id ); 720 721 // Topic 722 $topic_id = bbp_get_topic_id( $activity->item_id ); 723 $topic_permalink = bbp_get_topic_permalink( $topic_id ); 724 $topic_title = get_post_field( 'post_title', $topic_id, 'raw' ); 725 $topic_link = '<a href="' . $topic_permalink . '">' . $topic_title . '</a>'; 726 727 // Forum 728 $forum_id = bbp_get_forum_id( $activity->secondary_item_id ); 729 $forum_permalink = bbp_get_forum_permalink( $forum_id ); 730 $forum_title = get_post_field( 'post_title', $forum_id, 'raw' ); 731 $forum_link = '<a href="' . $forum_permalink . '">' . $forum_title . '</a>'; 732 733 // Activity action 734 $action = sprintf( esc_html__( '%1$s started the topic %2$s in the forum %3$s', 'bbpress' ), $user_link, $topic_link, $forum_link ); 735 736 return apply_filters( 'bbp_bp_format_activity_action_new_topic', $action, $activity ); 737 } 738 739 function bbp_bp_format_activity_action_new_reply( $action, $activity ) { 740 741 // User link for topic author 742 $user_link = bbp_get_user_profile_link( $activity->user_id ); 743 744 // Topic 745 $topic_id = bbp_get_topic_id( $activity->secondary_item_id ); 746 $topic_permalink = bbp_get_topic_permalink( $topic_id ); 747 $topic_title = get_post_field( 'post_title', $topic_id, 'raw' ); 748 $topic_link = '<a href="' . $topic_permalink . '">' . $topic_title . '</a>'; 749 750 // Forum 751 $forum_id = bbp_get_topic_forum_id( $topic_id ); 752 $forum_permalink = bbp_get_forum_permalink( $forum_id ); 753 $forum_title = get_post_field( 'post_title', $forum_id, 'raw' ); 754 $forum_link = '<a href="' . $forum_permalink . '">' . $forum_title . '</a>'; 755 756 // Activity action 757 $action = sprintf( esc_html__( '%1$s replied to the topic %2$s in the forum %3$s', 'bbpress' ), $user_link, $topic_link, $forum_link ); 758 759 return apply_filters( 'bbp_bp_format_activity_action_new_topic', $action, $activity ); 760 }