BP_Activity_List_Table::extra_tablenav( string $which )

Markup for the “filter” part of the form (i.e. which activity type to display).

Description

Parameters

$which

(Required) 'top' or 'bottom'.

Source

File: bp-activity/classes/class-bp-activity-list-table.php

450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
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', 'buddyboss' );
        ?></label>
        <select name="activity_type" id="activity-type">
            <option value="" <?php selected( ! $selected ); ?>><?php _e( 'View all actions', 'buddyboss' ); ?></option>
 
            <?php foreach ( $activity_actions as $component => $actions ) : ?>
                <?php
                // Older avatar activity items use 'profile' for component. See r4273.
                if ( $component === 'profile' ) {
                    $component = 'xprofile';
                }
 
                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 );
                }
 
                // Change `Bbpress` to `Forums`
                $component_name = ( 'Bbpress' === $component_name ) ? 'Forums' : $component_name;
                ?>
 
                <optgroup label="<?php esc_html_e( $component_name , 'buddyboss'); ?>">
 
                    <?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', 'buddyboss' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); ?>
    </div>
 
<?php
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.