This function has been deprecated. BuddyPress 2.1.0 instead.

bp_adminbar_account_menu()

Output the My Account BuddyBar menu.

Description

Return

(false|null) Returns false on failure.

Source

File: bp-core/deprecated/buddypress/2.1.php

204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
function bp_adminbar_account_menu() {
    $bp = buddypress();
 
    if ( empty( $bp->bp_nav ) || ! is_user_logged_in() ) {
        return false;
    }
 
    echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';
    _e( 'My Account', 'buddyboss' ) . '</a>';
    echo '<ul>';
 
    // Loop through each navigation item
    $counter = 0;
    foreach( (array) $bp->bp_nav as $nav_item ) {
        $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
 
        if ( -1 == $nav_item['position'] ) {
            continue;
        }
 
        echo '<li' . $alt . '>';
        echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>';
 
        if ( isset( $bp->bp_options_nav[$nav_item['slug']] ) && is_array( $bp->bp_options_nav[$nav_item['slug']] ) ) {
            echo '<ul>';
            $sub_counter = 0;
 
            foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {
                $link = $subnav_item['link'];
                $name = $subnav_item['name'];
 
                if ( bp_displayed_user_domain() ) {
                    $link = str_replace( bp_displayed_user_domain(), bp_loggedin_user_domain(), $subnav_item['link'] );
                }
 
                if ( isset( $bp->displayed_user->userdata->user_login ) ) {
                    $name = str_replace( $bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name'] );
                }
 
                $alt = ( 0 == $sub_counter % 2 ) ? ' class="alt"' : '';
                echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>';
                $sub_counter++;
            }
            echo '</ul>';
        }
 
        echo '</li>';
 
        $counter++;
    }
 
    $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
 
    echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . wp_logout_url( home_url() ) . '">' . __( 'Log Out', 'buddyboss' ) . '</a></li>';
    echo '</ul>';
    echo '</li>';
}

Changelog

Changelog
Version Description
BuddyPress 2.1.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.