BP_Activity_List_Table::extra_tablenav( string $which )
Markup for the “filter” part of the form (i.e. which activity type to display).
Description Description
Parameters Parameters
- $which
-
(Required) 'top' or 'bottom'.
Source Source
File: bp-activity/classes/class-bp-activity-list-table.php
function extra_tablenav( $which ) { // Bail on bottom table nav. if ( 'bottom' === $which ) { return; } // Is any filter currently selected? $selected = ( ! empty( $_REQUEST['activity_type'] ) ) ? $_REQUEST['activity_type'] : ''; // Get the actions. $activity_actions = bp_activity_get_actions(); ?> <div class="alignleft actions"> <label for="activity-type" class="screen-reader-text"><?php /* translators: accessibility text */ _e( 'Filter by activity type', 'buddypress' ); ?></label> <select name="activity_type" id="activity-type"> <option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddypress' ); ?></option> <?php foreach ( $activity_actions as $component => $actions ) : ?> <?php // Older avatar activity items use 'profile' for component. See r4273. if ( $component === 'profile' ) { $component = 'xprofile'; } // The 'activity_update' filter is already used by the Activity component. if ( isset( $actions->activity_update ) && 'bp_groups_format_activity_action_group_activity_update' === $actions->activity_update['format_callback'] ) { unset( $actions->activity_update ); } if ( bp_is_active( $component ) ) { if ( $component === 'xprofile' ) { $component_name = buddypress()->profile->name; } else { $component_name = buddypress()->$component->name; } } else { // Prevent warnings by other plugins if a component is disabled but the activity type has been registered. $component_name = ucfirst( $component ); } ?> <optgroup label="<?php echo esc_html( $component_name ); ?>"> <?php foreach ( $actions as $action_key => $action_values ) : ?> <?php // Skip the incorrectly named pre-1.6 action. if ( 'friends_register_activity_action' !== $action_key ) : ?> <option value="<?php echo esc_attr( $action_key ); ?>" <?php selected( $action_key, $selected ); ?>><?php echo esc_html( $action_values[ 'value' ] ); ?></option> <?php endif; ?> <?php endforeach; ?> </optgroup> <?php endforeach; ?> </select> <?php submit_button( __( 'Filter', 'buddypress' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); ?> </div> <?php }
Changelog Changelog
Version | Description |
---|---|
1.6.0 | Introduced. |