Ticket #5637: 5367.diff
File 5367.diff, 14.3 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..baa26ff 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 the label of templates dropdowns. 279 * @param array $scopes to restrict types to. 278 280 * @return bool False if any param is empty, otherwise true. 279 281 */ 280 function bp_activity_set_action( $component_id, $type, $description, $format_callback = false ) {282 function bp_activity_set_action( $component_id, $type, $description, $format_callback = false, $label = false, $scopes = array() ) { 281 283 $bp = buddypress(); 282 284 283 285 // Return false if any of the above values are not set … … function bp_activity_set_action( $component_id, $type, $description, $format_cal 303 305 'key' => $type, 304 306 'value' => $description, 305 307 'format_callback' => $format_callback, 306 ), $component_id, $type, $description, $format_callback ); 308 'label' => $label, 309 'scopes' => $scopes, 310 ), $component_id, $type, $description, $format_callback, $label, $scopes ); 307 311 308 312 return true; 309 313 } … … function bp_activity_register_activity_actions() { 835 839 $bp->activity->id, 836 840 'activity_update', 837 841 __( 'Posted a status update', 'buddypress' ), 838 'bp_activity_format_activity_action_activity_update' 842 'bp_activity_format_activity_action_activity_update', 843 __( 'Updates', 'buddypress' ), 844 array( 'activity', 'groups', 'members') 839 845 ); 840 846 841 847 bp_activity_set_action( 842 848 $bp->activity->id, 843 849 'activity_comment', 844 850 __( 'Replied to a status update', 'buddypress' ), 845 'bp_activity_format_activity_action_activity_comment' 851 'bp_activity_format_activity_action_activity_comment', 852 __( 'Update replies', 'buddypress' ) 846 853 ); 847 854 848 855 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..f1132ce 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 (?) 3379 * 3380 * @param string $scope the scope (activity directory, group's home page, member's activity page) 3381 * @uses bp_get_activity_show_filters() 3382 */ 3383 function bp_activity_show_filters( $scope = 'activity' ) { 3384 echo bp_get_activity_show_filters( $scope ); 3385 } 3386 /** 3387 * Get available filters depending on the scope. 3388 * 3389 * @since BuddyPress (?) 3390 * 3391 * @param string $scope the scope (activity directory, group's home page, member's activity page) 3392 * @uses bp_get_activity_show_filters() 3393 */ 3394 function bp_get_activity_show_filters( $scope = 'activity' ) { 3395 $filters = array(); 3396 3397 // Activity types to exclude on user's profile groups activity page 3398 $exclude = array( 'new_blog_post', 'new_blog_comment', 'friendship_accepted', 'friendship_created' ); 3399 3400 // Walk through the registered actions, and prepare an the select box options. 3401 foreach ( buddypress()->activity->actions as $action ) { 3402 $labels = wp_list_pluck( (array) $action, 'label' ); 3403 3404 foreach ( $labels as $key => $label ) { 3405 3406 if ( ! in_array( $scope, $action->{$key}['scopes'] ) ) 3407 continue; 3408 3409 if ( 'members' == $scope && bp_is_current_action( 'groups' ) && in_array( $key, $exclude ) ) 3410 continue; 3411 3412 // Specific case for friends activity 3413 if ( in_array( $label, $filters ) ) { 3414 $prev_key = array_search( $label, $filters ); 3415 unset( $filters[ $prev_key ] ); 3416 $filters[ $prev_key . ',' . $key ] = $label; 3417 } else { 3418 $filters[ $key ] = $label; 3419 } 3420 3421 } 3422 } 3423 3424 // Build the options output 3425 $output = ''; 3426 3427 if ( ! empty( $filters ) ) { 3428 foreach ( $filters as $value => $filter ) { 3429 $output .= '<option value="' . $value . '">' . $filter . '</option>' . "\n"; 3430 } 3431 } 3432 3433 return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $scope ); 3434 } -
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..b9cba07 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 __( 'Site creations', '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', 'members' ) 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', 'members' ) 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..ec64c8e 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', 'members' ) 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', 'members' ) 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..88cb7db 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', 'members' ) 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', 'groups', 'members' ) 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', 'groups', 'members' ) 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', 'groups', 'members' ) 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..f791cea 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> 79 80 <?php bp_activity_show_filters( 'activity' ); 80 81 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> 109 110 <?php do_action( 'bp_activity_filter_options' ); ?> 82 do_action( 'bp_activity_filter_options' ); ?> 111 83 112 84 </select> 113 85 </li> -
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..b5dad59 100644
8 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> 11 12 <?php bp_activity_show_filters( 'groups' ); 12 13 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> 19 20 <?php do_action( 'bp_group_activity_filter_options' ); ?> 14 do_action( 'bp_group_activity_filter_options' ); ?> 21 15 </select> 22 16 </li> 23 17 </ul> -
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..1d28066 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' ) ) : ?> 26 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; 22 <?php bp_activity_show_filters( 'members' ); 54 23 55 24 do_action( 'bp_member_activity_filter_options' ); ?> 56 25 -
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..f5d7f52 100644
function xprofile_register_activity_actions() { 24 24 25 25 'new_avatar', 26 26 __( 'Member changed profile picture', 'buddypress' ), 27 'bp_xprofile_format_activity_action_new_avatar' 27 'bp_xprofile_format_activity_action_new_avatar', 28 __( 'Profile picture updates' ) 28 29 ); 29 30 30 31 bp_activity_set_action( 31 32 $bp->profile->id, 32 33 'new_member', 33 34 __( 'New member registered', 'buddypress' ), 34 'bp_xprofile_format_activity_action_new_member' 35 'bp_xprofile_format_activity_action_new_member', 36 __( 'New Members', 'buddypress' ), 37 array( 'activity' ) 35 38 ); 36 39 37 40 bp_activity_set_action( 38 41 $bp->profile->id, 39 42 'updated_profile', 40 43 __( 'Updated Profile', 'buddypress' ), 41 'bp_xprofile_format_activity_action_updated_profile' 44 'bp_xprofile_format_activity_action_updated_profile', 45 __( 'Profile Updates', 'buddypress' ), 46 array( 'activity' ) 42 47 ); 43 48 44 49 do_action( 'xprofile_register_activity_actions' ); … … add_action( 'xprofile_updated_profile', 'bp_xprofile_updated_profile_activity', 309 314 * Add filters for xprofile activity types to Show dropdowns. 310 315 * 311 316 * @since BuddyPress (2.0.0) 317 * @todo Mark as deprecated 312 318 */ 313 319 function xprofile_activity_filter_options() { 314 320 ?> … … function xprofile_activity_filter_options() { 317 323 318 324 <?php 319 325 } 320 add_action( 'bp_activity_filter_options', 'xprofile_activity_filter_options' );326 //add_action( 'bp_activity_filter_options', 'xprofile_activity_filter_options' );