Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Solved(?)] [Documentation] How do I add a new Profile Tab at the beginning of the tab list?
businessdad
MVP
Hi all,
I'm trying to add a Profile Tab in User's Profile Page, and, so far, I managed to do it with ProfileController->AddProfileTab()
method. However, this adds my tab after all the other ones, when I'd like to have it as the first (and default) one. What's the easiest way to achieve this?
As usual, thanks in advance for the help.
Tagged:
0
Answers
I found a working answer to my own questions, although it's not optimal. To decide in which orders to render the Tabs in User Profile, Vanilla uses a Sort Order (file tab.php).
This Sort Order can come from two places:
- User Preferences. Specifically, it's taken from
$this->User->Preferences
. The curious thing is that I haven't found any reference to this parameter anywhere in the whole code of Vanilla, therefore I must assume that the feature doesn't exist yet (unless it's delegated to an Addon, of which I ignore the existence).- Application Preferences, i.e. from configuration setting
Garden.ProfileTabOrder
. Not surprisingly, this setting is also not mentioned anywhere else in the code, therefore I make the same assumption as above.The solution
Since there's no interface to change any of the above, I opted for the Application Configuration way. I added the following row in the configuration file:
$Configuration['Garden']['ProfileTabOrder'] = array('MyTab', 'Discussions', 'Thanks', 'Comments', 'Votes');
Magically, the Tabs appear in the order I specify. Users can't change it as there isn't a way for them to do it, but I think I can live with it, at least for now.
My shop | About Me
nice find and fix.
user->preferences - it may be used in these places user->preferences
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine Apologies for the confusion, when I stated "I haven't found any reference to this parameter anywhere", in relation to $User->Preferences, I meant that I couldn't find any place where this parameter is set. As you pointed out, it's used here and there, but Users, apparently, have no way to change it.
Of course, it could be done via code, but I don't think it's a good thing to allow Users to "code their own profile".
Note: by the way, it would be nice if I could accept my own answer, since it's what I was looking for... I'll write a note on QnA plugin.
My shop | About Me
this has been mentioned before - perhaps it will change.
meanwhile just @underdog flag your message and ask him to mark it solved .
and tag it with Documentation
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
To this: $Sender->AddProfileTab('Koppel Social Networks', '/profile/link');
I want to add a "sprite" like this:
Where would I add this ?