Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/16/2014 01:05:35 PM (12 years ago)
Author:
boonebgorges
Message:

Introduce bp_activity_show_filters(), and use it for generating dynamic activity filter dropdowns

Activity filter dropdowns were previously hardcoded into templates, with
template-specific hooks for plugins to add their own filter values. This
resulted in an inconsistent and awkward process of maintaining filter lists
between components. The new method introduces new parameters to bp_activity_set_action():
$context (an array of the contexts in which the filter should appear) and
$label (the text that should be used when generating the <option> markup). The
new function bp_activity_show_filter() is then used in the templates to
generate a dynamic list of <option> markup, based on the values registered by
the activity types.

Fixes #5637

Props imath

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/activity.php

    r6284 r8428  
    1919            <select id="activity-filter-by">
    2020                <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
    21                 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
    2221
    23                 <?php
    24                 if ( !bp_is_current_action( 'groups' ) ) :
    25                     if ( bp_is_active( 'blogs' ) ) : ?>
     22                <?php bp_activity_show_filters(); ?>
    2623
    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' ); ?>
    5625
    5726            </select>
Note: See TracChangeset for help on using the changeset viewer.