The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[How-to] Add more tabs to the vB 3.7 profile pages
If you want to add more tabs to the vB 3.7 profile pages, assuming JavaScript is enabled, or more blocks if JavaScript is off, then this tutorial is for you. If you like to learn in a trial by fire sort of way, create a new template titled memberinfo_block_mymodification with the following content: Code:
<div class="alt1 block_row"> <ul class="list_no_decoration"> $block_data[mymodification] </ul> </div> Code:
$blocklist = array_merge($blocklist, array( 'mymodification' => array( 'class' => 'MyModification', 'title' => 'My Modification', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_MyModification extends vB_ProfileBlock { var $template_name = 'memberinfo_block_mymodification'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['mymodification'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['mymodification'] = 'Content to show in the tab.'; } } If you want to learn a bit more of the details, first consider this part: Code:
$blocklist = array_merge($blocklist, array( 'mymodification' => array( 'class' => 'MyModification', 'title' => 'My Modification', 'hook_location' => 'profile_left_last' ) )); Next consider the next part: Code:
class vB_ProfileBlock_MyModification extends vB_ProfileBlock { var $template_name = 'memberinfo_block_mymodification'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['mymodification'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['mymodification'] = 'Content to show in the tab.'; } } Now there is the new template itself: Code:
<div class="alt1 block_row"> <ul class="list_no_decoration"> $block_data[mymodification] </ul> </div> Finally there are other things that can be added to modifications such as options, and these can be seen in the vB class_profileblock.php and member.php files, though this tutorial should get you on your way to adding more content to the profile pages via additional tabs, but remember not to go overboard with queries, because even though you need to click the tab to see the content, whatever queries you run get run on page load, not tab click. Enjoy! Fine print: tutorial based on vB 3.7.0 Beta 2, no redistribution without permission. |
#82
|
|||
|
|||
Thought I would give this a bump in hopes of finding a solution. Thanks.
|
#83
|
||||
|
||||
Your spitting it out into an unordered list, <ul>. You will need to explode the ranks and then put an <li> in front of each one. What exactly are you doing with the rank list? Are you exploding it after you get it? Post the code you use to deal with it and spit it out.
|
#84
|
|||
|
|||
lol, Im not that good. Basically Im just manually entering that list of items info into a custom field created in the admin cp under each user and then just calling that field to the tab. Honestly, I have no idea what you're talking about with the "exploding and spit out". There is no code I'm dealing with besides the code in the new template and the pluggin.
Oddly, Right now I also have the custom field in a profile module on the right and it displays as it was typed in the admin cp > users, in a list format. Here's a link to my profile on the site. That <br /> was entered in the admin cp > user > custom field blank. Could there be something I could do in the memberinfo_block_mymodification template code: Code:
<div class="alt1 block_row"> <ul class="list_no_decoration"> $block_data[mymodification] </ul> </div> |
#85
|
||||
|
||||
The thing is, all you have is a bunch of text. If you want it to display a certain way, then you need to have some html in there. You can't just write:
Code:
1. Website Owner 2. 6 month Member 3. 1 year Member Code:
1. Website Owner 2. 6 month Member 3. 1 year Member Code:
</li>1. Website Owner <li>2. 6 month Member <li>3. 1 year Member Code:
</li>Website Owner <li>6 month Member <li>1 year Member |
#86
|
|||
|
|||
Hello,
Is there a way to link to the profile and load a particular tab? Regards, Paul. |
#87
|
|||
|
|||
|
#88
|
|||
|
|||
Thanks very much tagtek.
Kind Regards, Paul. |
#89
|
||||
|
||||
Great article!
I'm not sure how to display the tab for only certain usergroups though. Do I use regular template conditionals? Or a PHP conditional? And where do I put it? Thanks. |
#90
|
|||
|
|||
If I set up a tab to show some custom profile fields, is there a way to let each user define who can see the information on that tab (i.e. Everyone, Registered Users, Contacts, Friends)?
|
#91
|
||||
|
||||
Quote:
A hook needs to be within a particular function to enable privacy settings for custom tabs. Looks like it was already requested in January: http://www.vbulletin.com/forum/showt...cy#post1673419 Quote:
Looks like privacy settings for categories worked in 3.8.0, but was broken in 3.8.1, and fixed in 3.8.2. Here's hoping they did a similar fix for custom blocks in total in 3.8.2 (gotta remember to download it lol). |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|