Toolbar Explained

Overview

It seems that there is a lot of confusion about what JomSocial Toolbar is and how does it work.
This article will explain what actually toolbar is and what can you expect from it.

History

To better understand the JomSocial Toolbar we need to go back in time and see how it evolved

JomSocial 1

Toolbar1.0.png

At the early stage, JomSocial had pretty much basic toolbar which was used as internal navigation system
This toolbar was very hard to manage. Including additional items to it was a nightmare for most users because it was only possible by creating plugin which will add the new set of menus, or, by hacking the core files which never was a good practice.
Toolbar with more or less this design lingered till JomSocial 1.8
JomSocial 2 brought up some massive redesign and changes in functionality

JomSocial 2

Toolbar2.8.png

Series 2 of JomSocial introduced redesigned toolbar, adding icons to the mix with tabs, notification system as well as few hard options such are returning back to "home" and "logout" but most noticeable improvement was possibility to add new menu items through Joomla Menu Manager.
This possibility however brought up new confusion which will be explained later through this article.

JomSocial 3

Toolbar3.0.png

Except redesign to fit into new JomSocial layout, Toolbar in series 3 didn't suffer any changes in functionality. It is the same old toolbar JomSocial 2 users used to, but wrapped into different style powered by Twitter Bootstrap
Because it is built with bootstrap, JomSocial toolbar is also responsive

Toolbar3.0responsive.png


JomSocial 4

Jomsocial4-newtoolbar.jpeg

Except redesign to fit into new JomSocial layout, Toolbar in series 4 didn't suffer any changes in functionality like in toolbar 3. It is the same old toolbar JomSocial 2 users used to, but wrapped into different style powered by Twitter Bootstrap
Because it is built with bootstrap, JomSocial toolbar is also responsive

Toolbar3.0responsive.png

What toolbar is used for?

The main purpose of JomSocial Toolbar is to provide internal navigation within component
As said in History section of this article, earlier version of JomSocial had toolbar integrated into core code and it was really hard to add new items to it. Modern toolbar allows site admin to do that easily through Joomla menu manager but, due to this fact, it often creates the illusion that toolbar can be used as any other standard Joomla menu.

Working Principle

To fully understand how JomSocial toolbar works, you will first need to disable SEF on your site. On Joomla 2.5 and above, SEF links are enabled by default, so you will have to navigate to the site backend and from dropdown menu select

  • Site -> Global Configuration on Joomla 2.5
  • System -> Global configuration on Joomla 3.x

Option Search Engine Friendly URLs must be set to No

Seo.png

Then proceed with JomSocial installation

Note on disabling SEF - it is very common practice to disable sef when you debug the navigation problems. It should be first thing to do when there is some navigation or module assignment problem on your site

After JomSocial is installed you will notice two very important things
1. JomSocial Toolbar menu is created with entire internal navigation for JomSocial

Jstoolbarmenu.png

2. Component Entry Page is created in main menu

Entrypage.png
Entry page is usually created in Main Menu. If you dont have this menu, JomSocial entry page will be created in the menu where your home page is.

We will also need to know what is the Entry page item ID
To see this, open the JomSocial link that was automaticaly created during installation and edit it

Entrypageid.png

As you can see on the image above, this menu item ID which will serve as entry page have id of 491 but on your installation it will most likely be different value. Remember it
If we now go to any page in JomSocial component, we will notice that no matter what item in toolbar we click, this itemid will always be taken

491.png
Important - The picture above shows group page opened. It is however just for showing. ALL items in toolbar will always take the ID of Entry Page

Things to Know

  • You can have multiple entry pages If you set the menu item outside JomSocial Toolbar which will link to say.... photos page, whenever you visit photos page by using the toolbar navigation, the respective id from that menu will be taken. Again, this is why is so important to know how to properly use non-saf links when it comes to debugging. Feel free to try it
  • Toolbar items DO NOT follow Joomla ACL - Because JomSocial will always use the entry page which is available for current page, Joomla ACL does not makes sense. You will need to set the ACL on entry page level
  • Modules can NOT be assigned to toolbar items - Same as with ACL. You can't assign modules to items in JomSocial Toolbar, but you can assign them to the entry page
  • Only one level of dropdowns are allowed in toolbar - Toolbar is displayed through JomSocial template file. It is not a standard Joomla menu and it is not designed to support more then 1 level dropdown menu.
  • When link in address bar have ID from one of the toolbar item - it is an indication of a problem. This should never happen and will only break your site instead doing anything good.

Common Mistakes

  • Setting the toolbar item as home page - JomSocial Toolbar is intended to serve as an internal navigation for JomSocial component. Setting the site home page within toolbar will always lead to unexpected behaviors to your navigation system
  • Trying to assign modules to toolbar items - It will never work, as Joomla modules are binded to itemid's. As explained above, JomSocial will always take the ID's of entry pages.
  • Trying to restrict items with Joomla ACL - Again, toolbar is not a classic Joomla Menu. We simply used Joomla menu manager to allow users to easily add new items to the toolbar which is internal component navigation'. As such it does not respect Joomla ACL as JomSocial can't support it yet.
  • Trying to use JomSocial Toolbar as main site navigation - This is wrong by design. Toolbar is only visible to registered users by default and having it as main site navigation is a bad choice. Not to mention an ID's mess you'll inevitably have to live with.
  • Creating duplicate entry pages all over the site navigation - For example, if you have two menus outside JomSocial Toolbar menu that leads to say, all videos page, JomSocial will always take one with lower ID as entry page

Best Practices

Here are some best practices and tricks to make a proper navigation on your site

Very simple - 1 entry page navigation

This is most basic setup and hence proven to work best in every environment.
In this scenario site navigation have only one (1) entry page for JomSocial component. This is also a default setup when you first time install JomSocial
It consists from:

  1. JomSocial Toolbar Menu - With unlimited number of items within
  2. Component Entry Page - Usually created in Main Menu

Working like this, JomSocial will always take the ID of entry page, no matter what item in toolbar you click

Going Complex - Adding More Entry Pages

In some cases, you will want to show some modules only on designated area of JomSocial. For example, Profile page.
With just one (1) entry page this will be impossible to do, because if you assign module to that page it will be shown everywhere, JomSocial-wide
Therefore, we now need to create a separate entry menu item for profile page.
Please, follow the steps outlined bellow:

  1. Go to site backend and in Menu Manager create new menu named "JomSocial Entry Pages"
  2. In this new menu, create new item and point it to JomSocial profile page.
593.png

Notice that id of this new page is 593. If we now go back to JomSocial component and click on the Profile tab, this id will be taken as entry page

Profileentrypage.png

Similarly you can add unlimited entry pages for every view in JomSocial which will allow you to assign different modules to different menus.
To some extend, it will even work for restricting areas with Joomla ACL but drawback of this is that if for example, you want to disable JomSocial Events for certain user group, that group will still see the Events tab in toolbar navigation, though it wont be able to access it.

Conclusion

First of all, it is now safe to enable SEF back if you want to.
Through this article, we have learned that JomSocial Toolbar is not a standard Joomla Menu, but rather internal navigation system for JomSocial component. We simply used the Joomla menu manager to allow users to add new items to toolbar much easier.
When component uses Joomla Menu Manager to add internal navigation, it is virtually impossible to achieve what one would expect from standard Joomla menu.
Everything described here also applies to other components as well. For example, Kunena Forum also use Joomla Menu manager to add internal navigation and it works on exactly same basis.
This article also taught how important is to disable SEF when debugging navigation and module assignment issues.

See Also