Ticket #5637: 5367.04.patch
File 5367.04.patch, 14.9 KB (added by , 10 years ago) |
---|
-
src/bp-activity/bp-activity-functions.php
diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php index 6e5d93b..507387e 100644
function bp_activity_get_userid_from_mentionname( $mentionname ) { 275 275 * @param string $type The action type. 276 276 * @param string $description The action description. 277 277 * @param callable $format_callback Callback for formatting the action string. 278 * @param string $label String to describe this action in the activity stream 279 * filter dropdown. 280 * @param array $context Activity stream contexts where the filter should appear. 281 * 'activity', 'member', 'member_groups', 'group' 278 282 * @return bool False if any param is empty, otherwise true. 279 283 */ 280 function bp_activity_set_action( $component_id, $type, $description, $format_callback = false ) {284 function bp_activity_set_action( $component_id, $type, $description, $format_callback = false, $label = false, $context = array() ) { 281 285 $bp = buddypress(); 282 286 283 287 // Return false if any of the above values are not set … … function bp_activity_set_action( $component_id, $type, $description, $format_cal 303 307 'key' => $type, 304 308 'value' => $description, 305 309 'format_callback' => $format_callback, 306 ), $component_id, $type, $description, $format_callback ); 310 'label' => $label, 311 'context' => $context, 312 ), $component_id, $type, $description, $format_callback, $label, $context ); 307 313 308 314 return true; 309 315 } … … function bp_activity_register_activity_actions() { 835 841 $bp->activity->id, 836 842 'activity_update', 837 843 __( 'Posted a status update', 'buddypress' ), 838 'bp_activity_format_activity_action_activity_update' 844 'bp_activity_format_activity_action_activity_update', 845 __( 'Updates', 'buddypress' ), 846 array( 'activity', 'group', 'member', 'member_groups' ) 839 847 ); 840 848 841 849 bp_activity_set_action( 842 850 $bp->activity->id, 843 851 'activity_comment', 844 852 __( 'Replied to a status update', 'buddypress' ), 845 'bp_activity_format_activity_action_activity_comment' 853 'bp_activity_format_activity_action_activity_comment', 854 __( 'Activity Comments', 'buddypress' ) 846 855 ); 847 856 848 857 do_action( 'bp_activity_register_activity_actions' ); -
src/bp-activity/bp-activity-template.php
diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php index 1acafeb..2224a7a 100644
function bp_activity_sitewide_feed() { 3371 3371 <?php 3372 3372 } 3373 3373 add_action( 'bp_head', 'bp_activity_sitewide_feed' ); 3374 3375 /** 3376 * Display available filters depending on the scope. 3377 * 3378 * @since BuddyPress (2.1.0) 3379 * 3380 * @param string $context The current context. 'activity', 'member', 3381 * 'member_groups', 'group' 3382 * @uses bp_get_activity_show_filters() 3383 */ 3384 function bp_activity_show_filters( $context = '' ) { 3385 echo bp_get_activity_show_filters( $context ); 3386 } 3387 /** 3388 * Get available filters depending on the scope. 3389 * 3390 * @since BuddyPress (2.1.0) 3391 * 3392 * @param string $context The current context. 'activity', 'member', 3393 * 'member_groups', 'group' 3394 * @uses bp_get_activity_show_filters() 3395 */ 3396 function bp_get_activity_show_filters( $context = '' ) { 3397 // Set default context based on current page 3398 if ( empty( $context ) ) { 3399 if ( bp_is_user() ) { 3400 switch ( bp_current_action() ) { 3401 case bp_get_groups_slug() : 3402 $context = 'member_groups'; 3403 break; 3404 3405 default : 3406 $context = 'member'; 3407 break; 3408 } 3409 } else if ( bp_is_active( 'groups' ) && bp_is_group() ) { 3410 $context = 'group'; 3411 } else { 3412 $context = 'activity'; 3413 } 3414 } 3415 3416 $filters = array(); 3417 3418 // Walk through the registered actions, and prepare an the select box options. 3419 foreach ( buddypress()->activity->actions as $actions ) { 3420 foreach ( $actions as $action ) { 3421 if ( ! in_array( $context, (array) $action['context'] ) ) { 3422 continue; 3423 } 3424 3425 // Friends activity collapses two filters into one 3426 if ( in_array( $action['key'], array( 'friendship_accepted', 'friendship_created' ) ) ) { 3427 $action['key'] = 'friendship_accepted,friendship_created'; 3428 } 3429 3430 $filters[ $action['key'] ] = $action['label']; 3431 } 3432 } 3433 3434 // Build the options output 3435 $output = ''; 3436 3437 if ( ! empty( $filters ) ) { 3438 // Allow plugins/themes to modify (mostly restrict) the list of options 3439 $filters = apply_filters( 'bp_get_activity_modify_filters', $filters, $context ); 3440 3441 foreach ( $filters as $value => $filter ) { 3442 $output .= '<option value="' . esc_attr( $value ) . '">' . esc_html( $filter ) . '</option>' . "\n"; 3443 } 3444 } 3445 3446 return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $context ); 3447 } -
src/bp-blogs/bp-blogs-activity.php
diff --git src/bp-blogs/bp-blogs-activity.php src/bp-blogs/bp-blogs-activity.php index 70ea20a..19f567b 100644
function bp_blogs_register_activity_actions() { 32 32 $bp->blogs->id, 33 33 'new_blog', 34 34 __( 'New site created', 'buddypress' ), 35 'bp_blogs_format_activity_action_new_blog' 35 'bp_blogs_format_activity_action_new_blog', 36 __( 'New Sites', 'buddypress' ) 36 37 ); 37 38 } 38 39 … … function bp_blogs_register_activity_actions() { 40 41 $bp->blogs->id, 41 42 'new_blog_post', 42 43 __( 'New post published', 'buddypress' ), 43 'bp_blogs_format_activity_action_new_blog_post' 44 'bp_blogs_format_activity_action_new_blog_post', 45 __( 'Posts', 'buddypress' ), 46 array( 'activity', 'member' ) 44 47 ); 45 48 46 49 bp_activity_set_action( 47 50 $bp->blogs->id, 48 51 'new_blog_comment', 49 52 __( 'New post comment posted', 'buddypress' ), 50 'bp_blogs_format_activity_action_new_blog_comment' 53 'bp_blogs_format_activity_action_new_blog_comment', 54 __( 'Comments', 'buddypress' ), 55 array( 'activity', 'member' ) 51 56 ); 52 57 53 58 do_action( 'bp_blogs_register_activity_actions' ); -
src/bp-friends/bp-friends-activity.php
diff --git src/bp-friends/bp-friends-activity.php src/bp-friends/bp-friends-activity.php index 92ab0bf..f5e32ed 100644
function friends_register_activity_actions() { 96 96 $bp->friends->id, 97 97 'friendship_accepted', 98 98 __( 'Friendships accepted', 'buddypress' ), 99 'bp_friends_format_activity_action_friendship_accepted' 99 'bp_friends_format_activity_action_friendship_accepted', 100 __( 'Friendships', 'buddypress' ), 101 array( 'activity', 'member' ) 100 102 ); 101 103 102 104 bp_activity_set_action( 103 105 $bp->friends->id, 104 106 'friendship_created', 105 107 __( 'New friendships', 'buddypress' ), 106 'bp_friends_format_activity_action_friendship_created' 108 'bp_friends_format_activity_action_friendship_created', 109 __( 'Friendships', 'buddypress' ), 110 array( 'activity', 'member' ) 107 111 ); 108 112 109 113 // < BP 1.6 backpat -
src/bp-groups/bp-groups-activity.php
diff --git src/bp-groups/bp-groups-activity.php src/bp-groups/bp-groups-activity.php index b7f1b1b..5b78069 100644
function groups_register_activity_actions() { 27 27 $bp->groups->id, 28 28 'created_group', 29 29 __( 'Created a group', 'buddypress' ), 30 'bp_groups_format_activity_action_created_group' 30 'bp_groups_format_activity_action_created_group', 31 __( 'New Groups', 'buddypress' ), 32 array( 'activity', 'member', 'member_groups' ) 31 33 ); 32 34 33 35 bp_activity_set_action( 34 36 $bp->groups->id, 35 37 'joined_group', 36 38 __( 'Joined a group', 'buddypress' ), 37 'bp_groups_format_activity_action_joined_group' 39 'bp_groups_format_activity_action_joined_group', 40 __( 'Group Memberships', 'buddypress' ), 41 array( 'activity', 'group', 'member', 'member_groups' ) 38 42 ); 39 43 40 44 // These actions are for the legacy forums 41 45 // Since the bbPress plugin also shares the same 'forums' identifier, we also 42 46 // check for the legacy forums loader class to be extra cautious 43 47 if ( bp_is_active( 'forums' ) && class_exists( 'BP_Forums_Component' ) ) { 44 bp_activity_set_action( $bp->groups->id, 'new_forum_topic', __( 'New group forum topic', 'buddypress' ) ); 45 bp_activity_set_action( $bp->groups->id, 'new_forum_post', __( 'New group forum post', 'buddypress' ) ); 48 bp_activity_set_action( 49 $bp->groups->id, 50 'new_forum_topic', 51 __( 'New group forum topic', 'buddypress' ), 52 false, 53 __( 'Forum Topics', 'buddypress' ), 54 array( 'activity', 'group', 'member', 'member_groups' ) 55 ); 56 57 bp_activity_set_action( 58 $bp->groups->id, 59 'new_forum_post', 60 __( 'New group forum post', 'buddypress' ), 61 false, 62 __( 'Forum Replies', 'buddypress' ), 63 array( 'activity', 'group', 'member', 'member_groups' ) 64 ); 46 65 } 47 66 48 67 do_action( 'groups_register_activity_actions' ); -
src/bp-templates/bp-legacy/buddypress/activity/index.php
diff --git src/bp-templates/bp-legacy/buddypress/activity/index.php src/bp-templates/bp-legacy/buddypress/activity/index.php index de21b63..09edc01 100644
76 76 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 77 77 <select id="activity-filter-by"> 78 78 <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option> 79 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>80 79 81 <?php if ( bp_is_active( 'blogs' ) ) : ?> 82 83 <option value="new_blog_post"><?php _e( 'Posts', 'buddypress' ); ?></option> 84 <option value="new_blog_comment"><?php _e( 'Comments', 'buddypress' ); ?></option> 85 86 <?php endif; ?> 87 88 <?php if ( bp_is_active( 'forums' ) ) : ?> 89 90 <option value="new_forum_topic"><?php _e( 'Forum Topics', 'buddypress' ); ?></option> 91 <option value="new_forum_post"><?php _e( 'Forum Replies', 'buddypress' ); ?></option> 92 93 <?php endif; ?> 94 95 <?php if ( bp_is_active( 'groups' ) ) : ?> 96 97 <option value="created_group"><?php _e( 'New Groups', 'buddypress' ); ?></option> 98 <option value="joined_group"><?php _e( 'Group Memberships', 'buddypress' ); ?></option> 99 100 <?php endif; ?> 101 102 <?php if ( bp_is_active( 'friends' ) ) : ?> 103 104 <option value="friendship_accepted,friendship_created"><?php _e( 'Friendships', 'buddypress' ); ?></option> 105 106 <?php endif; ?> 107 108 <option value="new_member"><?php _e( 'New Members', 'buddypress' ); ?></option> 80 <?php bp_activity_show_filters(); ?> 109 81 110 82 <?php do_action( 'bp_activity_filter_options' ); ?> 111 83 -
src/bp-templates/bp-legacy/buddypress/groups/single/activity.php
diff --git src/bp-templates/bp-legacy/buddypress/groups/single/activity.php src/bp-templates/bp-legacy/buddypress/groups/single/activity.php index ff2c6d9..7d0637d 100644
5 5 <?php do_action( 'bp_group_activity_syndication_options' ); ?> 6 6 7 7 <li id="activity-filter-select" class="last"> 8 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 8 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 9 9 <select id="activity-filter-by"> 10 10 <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option> 11 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>12 11 13 <?php if ( bp_is_active( 'forums' ) ) : ?> 14 <option value="new_forum_topic"><?php _e( 'Forum Topics', 'buddypress' ); ?></option> 15 <option value="new_forum_post"><?php _e( 'Forum Replies', 'buddypress' ); ?></option> 16 <?php endif; ?> 17 18 <option value="joined_group"><?php _e( 'Group Memberships', 'buddypress' ); ?></option> 12 <?php bp_activity_show_filters( 'group' ); ?> 19 13 20 14 <?php do_action( 'bp_group_activity_filter_options' ); ?> 21 15 </select> -
src/bp-templates/bp-legacy/buddypress/members/single/activity.php
diff --git src/bp-templates/bp-legacy/buddypress/members/single/activity.php src/bp-templates/bp-legacy/buddypress/members/single/activity.php index 06e9263..6589a02 100644
18 18 <label for="activity-filter-by"><?php _e( 'Show:', 'buddypress' ); ?></label> 19 19 <select id="activity-filter-by"> 20 20 <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option> 21 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>22 21 23 <?php 24 if ( !bp_is_current_action( 'groups' ) ) : 25 if ( bp_is_active( 'blogs' ) ) : ?> 22 <?php bp_activity_show_filters(); ?> 26 23 27 <option value="new_blog_post"><?php _e( 'Posts', 'buddypress' ); ?></option> 28 <option value="new_blog_comment"><?php _e( 'Comments', 'buddypress' ); ?></option> 29 30 <?php 31 endif; 32 33 if ( bp_is_active( 'friends' ) ) : ?> 34 35 <option value="friendship_accepted,friendship_created"><?php _e( 'Friendships', 'buddypress' ); ?></option> 36 37 <?php endif; 38 39 endif; 40 41 if ( bp_is_active( 'forums' ) ) : ?> 42 43 <option value="new_forum_topic"><?php _e( 'Forum Topics', 'buddypress' ); ?></option> 44 <option value="new_forum_post"><?php _e( 'Forum Replies', 'buddypress' ); ?></option> 45 46 <?php endif; 47 48 if ( bp_is_active( 'groups' ) ) : ?> 49 50 <option value="created_group"><?php _e( 'New Groups', 'buddypress' ); ?></option> 51 <option value="joined_group"><?php _e( 'Group Memberships', 'buddypress' ); ?></option> 52 53 <?php endif; 54 55 do_action( 'bp_member_activity_filter_options' ); ?> 24 <?php do_action( 'bp_member_activity_filter_options' ); ?> 56 25 57 26 </select> 58 27 </li> -
src/bp-xprofile/bp-xprofile-activity.php
diff --git src/bp-xprofile/bp-xprofile-activity.php src/bp-xprofile/bp-xprofile-activity.php index 23b9dc2..737a922 100644
function xprofile_register_activity_actions() { 21 21 // older avatar activity items use 'profile' for component 22 22 // see r4273 23 23 'profile', 24 25 24 'new_avatar', 26 25 __( 'Member changed profile picture', 'buddypress' ), 27 'bp_xprofile_format_activity_action_new_avatar' 26 'bp_xprofile_format_activity_action_new_avatar', 27 __( 'Updated Avatars', 'buddypress' ) 28 28 ); 29 29 30 30 bp_activity_set_action( 31 31 $bp->profile->id, 32 32 'new_member', 33 33 __( 'New member registered', 'buddypress' ), 34 'bp_xprofile_format_activity_action_new_member' 34 'bp_xprofile_format_activity_action_new_member', 35 __( 'New Members', 'buddypress' ), 36 array( 'activity' ) 35 37 ); 36 38 37 39 bp_activity_set_action( 38 40 $bp->profile->id, 39 41 'updated_profile', 40 42 __( 'Updated Profile', 'buddypress' ), 41 'bp_xprofile_format_activity_action_updated_profile' 43 'bp_xprofile_format_activity_action_updated_profile', 44 __( 'Profile Updates', 'buddypress' ), 45 array( 'activity' ) 42 46 ); 43 47 44 48 do_action( 'xprofile_register_activity_actions' ); … … add_action( 'xprofile_updated_profile', 'bp_xprofile_updated_profile_activity', 309 313 * Add filters for xprofile activity types to Show dropdowns. 310 314 * 311 315 * @since BuddyPress (2.0.0) 316 * @todo Mark as deprecated 312 317 */ 313 318 function xprofile_activity_filter_options() { 314 319 ?> … … function xprofile_activity_filter_options() { 317 322 318 323 <?php 319 324 } 320 add_action( 'bp_activity_filter_options', 'xprofile_activity_filter_options' );