BP_Core_Members_Switching::action_admin_footer()

Adds a ‘Switch back to {user}’ link to the WordPress footer if the admin toolbar isn’t showing.

Description

Source

File: bp-members/classes/class-bp-core-members-switching.php

445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
public function action_admin_footer() {
    if ( ! function_exists( 'is_admin_bar_showing' ) ) {
        return;
    }
    if ( ! is_admin_bar_showing() ) {
        return;
    }
 
    $old_user = self::get_old_user();
 
    if ( $old_user instanceof WP_User ) {
        $colors = self::admin_bar_link_color_scheme();
        if ( isset( $colors['background'] ) && isset( $colors['color'] ) ) {
            ?>
            <style>
                /* Member Switching */
                #wpadminbar #wp-admin-bar-top-secondary li#wp-admin-bar-switch-back a {
                    background: <?php echo $colors['background'] ?>;
                    color: <?php echo  $colors['color'] ?>;;
                }
            </style>
            <?php
        }
    }
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.