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

    r8259 r8428  
    2828        'created_group',
    2929        __( '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' )
    3133    );
    3234
     
    3537        'joined_group',
    3638        __( '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' )
    3842    );
    3943
     
    4246    // check for the legacy forums loader class to be extra cautious
    4347    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        );
    4665    }
    4766
Note: See TracChangeset for help on using the changeset viewer.