Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/16/2014 01:05:35 PM (11 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/groups/single/activity.php

    r7965 r8428  
    66
    77        <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>
    99            <select id="activity-filter-by">
    1010                <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
    11                 <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
    1211
    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' ); ?>
    1913
    2014                <?php do_action( 'bp_group_activity_filter_options' ); ?>
Note: See TracChangeset for help on using the changeset viewer.