Skip to:
Content

Changeset 8613


Ignore:
Timestamp:
07/15/2014 07:42:39 PM (4 years ago)
Author:
johnjamesjacoby
Message:

Break activity action filters up into groups in Activity admin. (We'll likely expand on this further with helper functions and more appropriate labeling later.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-admin.php

    r8491 r8613  
    12731273     */
    12741274    function extra_tablenav( $which ) {
    1275         if ( 'bottom' == $which )
     1275
     1276        // Bail on bottom table nav
     1277        if ( 'bottom' === $which ) {
    12761278            return;
    1277 
    1278         $selected = !empty( $_REQUEST['activity_type'] ) ? $_REQUEST['activity_type'] : '';
    1279 
    1280         // Get all types of activities, and sort alphabetically.
    1281         $actions  = bp_activity_get_types();
    1282         natsort( $actions );
    1283     ?>
     1279        }
     1280
     1281        // Is any filter currently selected?
     1282        $selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : '';
     1283
     1284        // Get the actions
     1285        $activity_actions = buddypress()->activity->actions; ?>
    12841286
    12851287        <div class="alignleft actions">
    12861288            <select name="activity_type">
    1287                 <option value="" <?php selected( !$selected ); ?>><?php _e( 'Show all activity types', 'buddypress' ); ?></option>
    1288 
    1289                 <?php foreach ( $actions as $k => $v ) : ?>
    1290                     <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $k,  $selected ); ?>><?php echo esc_html( $v ); ?></option>
     1289                <option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option>
     1290
     1291                <?php foreach ( $activity_actions as $component => $actions ) : ?>
     1292
     1293                    <optgroup label="<?php echo ucfirst( $component ); ?>">
     1294
     1295                        <?php foreach ( $actions as $action_key => $action_values ) : ?>
     1296
     1297                            <option value="<?php echo esc_attr( $action_key ); ?>" <?php selected( $action_key,  $selected ); ?>><?php echo esc_html( $action_values[ 'value' ] ); ?></option>
     1298
     1299                        <?php endforeach; ?>
     1300
     1301                    </optgroup>
     1302
    12911303                <?php endforeach; ?>
     1304
    12921305            </select>
    12931306
Note: See TracChangeset for help on using the changeset viewer.