Changeset 8428
- Timestamp:
- 05/16/2014 01:05:35 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r8237 r8428 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 … … 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; … … 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 … … 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 -
trunk/src/bp-activity/bp-activity-template.php
r8404 r8428 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 * @return string HTML for <option> values. 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 3419 // select box options. 3420 foreach ( buddypress()->activity->actions as $actions ) { 3421 foreach ( $actions as $action ) { 3422 if ( ! in_array( $context, (array) $action['context'] ) ) { 3423 continue; 3424 } 3425 3426 // Friends activity collapses two filters into one 3427 if ( in_array( $action['key'], array( 'friendship_accepted', 'friendship_created' ) ) ) { 3428 $action['key'] = 'friendship_accepted,friendship_created'; 3429 } 3430 3431 $filters[ $action['key'] ] = $action['label']; 3432 } 3433 } 3434 3435 /** 3436 * Modify the filter options available in the activity filter dropdown. 3437 * 3438 * @since BuddyPress (2.1.0) 3439 * 3440 * @param array $filters Array of filter options for the given 3441 * context, in the following format: 3442 * $option_value => $option_name 3443 * @param string $context Context for the filter. 'activity' 3444 * 'member', 'member_groups', 'group'. 3445 */ 3446 $filters = apply_filters( 'bp_get_activity_show_filters', $filters, $context ); 3447 3448 // Build the options output 3449 $output = ''; 3450 3451 if ( ! empty( $filters ) ) { 3452 foreach ( $filters as $value => $filter ) { 3453 $output .= '<option value="' . esc_attr( $value ) . '">' . esc_html( $filter ) . '</option>' . "\n"; 3454 } 3455 } 3456 3457 return apply_filters( 'bp_get_activity_show_filters', $output, $filters, $context ); 3458 } -
trunk/src/bp-blogs/bp-blogs-activity.php
r8345 r8428 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 } … … 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 … … 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 -
trunk/src/bp-friends/bp-friends-activity.php
r8259 r8428 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 … … 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 -
trunk/src/bp-groups/bp-groups-activity.php
r8259 r8428 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 … … 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 … … 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 -
trunk/src/bp-templates/bp-legacy/buddypress/activity/index.php
r7965 r8428 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' ); ?> -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/activity.php
r7965 r8428 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' ); ?> -
trunk/src/bp-templates/bp-legacy/buddypress/members/single/activity.php
r6284 r8428 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> -
trunk/src/bp-xprofile/bp-xprofile-activity.php
r8306 r8428 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 … … 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 … … 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 … … 310 314 * 311 315 * @since BuddyPress (2.0.0) 316 * @todo Mark as deprecated 312 317 */ 313 318 function xprofile_activity_filter_options() { … … 318 323 <?php 319 324 } 320 add_action( 'bp_activity_filter_options', 'xprofile_activity_filter_options' );
Note: See TracChangeset
for help on using the changeset viewer.