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/activity/index.php

    r7965 r8428  
    7777                <select id="activity-filter-by">
    7878                    <option value="-1"><?php _e( 'Everything', 'buddypress' ); ?></option>
    79                     <option value="activity_update"><?php _e( 'Updates', 'buddypress' ); ?></option>
    8079
    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(); ?>
    10981
    11082                    <?php do_action( 'bp_activity_filter_options' ); ?>
Note: See TracChangeset for help on using the changeset viewer.