Skip to:

Opened 5 years ago

Closed 5 years ago

#174 closed enhancement (fixed)

Add Login Link In Buddypress Bar

Reported by: trent Owned by: apeatling
Milestone: Priority: minor
Severity: Version:
Component: Keywords: login, admin bar
Cc: deadpan110@…


It would be nice to add a link to login in the buddypress bar when you are viewing a site not logged in.

Attachments (2)

bp-admin-bar-login-signup.patch (1.4 KB) - added by Deadpan110 5 years ago.
I should have tested while logged out and not allowing registrations... last patch had a spelling error... should have been checking the site option 'registration' and not 'registrations'.
bp-admin-bar-login-signup-v2.patch (4.3 KB) - added by Deadpan110 5 years ago.
A better patch allowing FULL admin bar customisations using add_action()

Download all attachments as: .zip

Change History (11)

comment:1 Deadpan1105 years ago

I think it would be nice and easy to add a login link and although not everyone would like a sign up link, I have added one to my custom admin-bar (as well as login).

Although my sign up link is hard coded, a check to see if the current site_id is allowing sign ups could decide if the link would show.

to view my custom admin bar, visit (The site is still being worked on - so excuse the mess and half finished stuffs)

Also in that example, you can see the bar shows when not logged in for ONLY that theme as my BuddyPress option is set to NOT show the bar for non logged in users.

Custom bar was created by copying bp-core/bp-core-adminbar.php into mu-plugins and renaming the file and its functions.

I then added and renamed the bp_core_add_css function from bp-core/bp-core-cssjs.php.

Finally, I used the following to replace the original bar and insert my own:

remove_action( 'wp_footer', 'bp_core_admin_bar' );
remove_action( 'wp_head', 'bp_core_add_css' );
add_action( 'wp_footer', 'my_admin_bar' );
add_action( 'wp_head', 'my_add_css' );

*NOTE: Name your own admin bar php alphabetically higher than 'bp' so it runs AFTER the original actions have been added.

comment:2 Deadpan1105 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

comment:3 Deadpan1105 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened


Deadpan1105 years ago

I should have tested while logged out and not allowing registrations... last patch had a spelling error... should have been checking the site option 'registration' and not 'registrations'.

comment:4 Deadpan1105 years ago

  • Cc deadpan110@… added

'Sign Up' link will only show when 'registration' != 'none'
'Log In' link shows when a user is not logged in (and the admin bar is set to display when not logged in)

Patch needs 'blogadmin_icon.gif' and 'invite_bullet.gif' copied from:




so that the modified css shows the 'Log In' and 'Sign Up' icons

Deadpan1105 years ago

A better patch allowing FULL admin bar customisations using add_action()

comment:5 Deadpan1105 years ago

The bp-admin-bar-login-signup-v2.patch vastly improves the customisation possibilities within the admin bar.

Each individual menu is called by the following:

  • NOTE the use of priorities :)

To add your own menu item between 'Notifications' and 'Authors', do the following within your own plugins:

function my_bp_menu_item() {
    echo '<li><a href="/some/link">My Menu</a></li>';


To replace the BuddyPress logo within your own plugins:

function my_bp_adminbar_logo() {
    echo '<a href="' . get_blog_option( 1, 'siteurl' ) . '"><img id="admin-bar-logo" src="' . site_url() . '/path/to/my/admin_bar_logo.gif" alt="My Site Name" /></a>';

Using combinations of add_action and remove_action for your menu items within your own plugins will enable you to add / remove / reorder your admin bar menus.

  • This patch was created using svn diff from the trunk (revision 557) and will probably not work on top of the 1st patch I submitted.

comment:6 apeatling5 years ago

  • Status changed from reopened to assigned

comment:7 burtadsit5 years ago

Thank you deadpan110 and apeatling for this.

comment:8 Deadpan1105 years ago

Patch applied into trunk as of Rev 627, when I get time - I may add a detailed 'hacking the BuddyPress admin bar howto' into the wiki to make it easier for people to understand some of the finer tips and tricks that are now possible.

Thanks Andy for adding this... and should we now mark this as fixed?

comment:9 trent5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in r627

Note: See TracTickets for help on using tickets.