For a long time BuddyPress site admins have puzzled over how to create dynamic links within WordPress menus. Although the admin bar provides a comprehensive menu for links related to active components, the process of inserting just one or a few of these links into a regular nav menu is actually quite difficult.
The most common example is when a site admin wants to add a “My Profile” link to the main menu. The link looks something like this in most cases:
However, getting the username for the current logged-in user is impossible when working in the dashboard with WordPress menus. In the past you would either have to manually code your menu or use a plugin to create those dynamic user-specific links.
BuddyPress 1.9 will introduce a BuddyPress links box to nav-menus.php to help users easily add dynamic BuddyPress links to their WordPress menus.
The new menu metabox will include:
- Separate sets of links for logged-in and logged-out users
- Logged-in user links are automatically generated based on the logged-in user. For example, adding a ‘Settings’ item from the BuddyPress menu will create a menu item that points to the logged-in user’s settings page, and will not be shown to logged-out visitors.
- The list of available logged-in links is automatically populated with all components that are registered in the BuddyPress navigation
- Log In and Register links are visible only to logged-out users
The new menu options can be found at Dashboard > Appearance > Menus:
For many BuddyPress users this is like an early Christmas present from Santa. This new addition will make theming BuddyPress much easier for developers and gives more options to site administrators with less technical knowledge. If you’d like to get a quick preview, install the latest trunk from the BuddyPress trac. Please note that this feature is not yet ready to be used in a production environment.
You can expect to see the new dynamic menu options in the 1.9 beta release, which should make an appearance this month. BuddyPress lead developers are working towards another speedy release cycle with a target release date set for November 7, 2013. Lots of architectural improvements and some very exciting enhancements are on the way.