How do we set priority for the profile menu items?

Allon Prooit Posted in Performance and Scalability 4 weeks ago

In keeping with my previous discussion, its time we make the profiles rock! How do we reprioritize the menu items on the profile page? I for one would like to move the Timeline profile tab right by one and move my new Intro component all the way left to where the Timeline tab is now. Any thoughts on how to make this happen?

Replies
us Allon Prooit Replied 4 weeks ago

This worked great Michael, thanks for the good advice!

German Michael Z├╝lsdorff Replied 4 weeks ago

Hmm ... if I developed my own Intro component just a few days ago I would ask myself:
How did I make my Intro tab appear?
Ah yes, I used a callback:

ossn_register_callback('page', 'load:profile', 'com_intro_profile_intro_menu');

Okay, but do callbacks offer a priority parameter, too - similar to hooks?
(... opening ossn.lib.system.php again... inspecting line 278 ...)

function ossn_register_callback($event, $type, $callback, $priority = 200) {

Great, they do!
Then, all I need is just adding a priority value smaller than 200 to my callback to make it move left?

Yes indeed: Callbacks are using the same priority mechanism as hooks. Without explicit priority all callbacks default to 200, the sort order simply reflects the order the callback get registered (first in - first out). While explicit priorities smaller than 200 would move your callback more towards the beginning, and explicit priorities bigger than 200 more towards the end of the callback collection.