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. |
#52
|
||||
|
||||
Quote:
Code:
$this->profile->userinfo |
#53
|
|||
|
|||
Thanks. Do I have to use $block_data to pass variables to the template or can I use arbitrary variable names?
This code seems to be more complex than needed. |
#54
|
||||
|
||||
I'm still working all that out. It appears that you can use variables when you eval your own templates but you need to use the $this->block_data array for passing things to the main template.
|
#55
|
||||
|
||||
Has anyone using a custom tab stumbled upon the bit of code that allows you to link directly to a tab, like so:
http://www.domain.com/member.php?u=1&tab=contactinfo I'm thinking there's some java code somewhere doing it (I believe the tabs are AJAX), but haven't found the right bit just yet. |
#56
|
|||
|
|||
Quote:
Matt |
#57
|
|||
|
|||
For some hours I try to get photopost pro latest addition to members gallery into a new tab but for some reason (a hook?) it didn't work - it will only work if I place the code in that MEMBERINFO template ...
|
#58
|
||||
|
||||
how would that work if i want to add a varibable like for ishop?
$ishop example? that's the code below Quote:
|
#59
|
||||
|
||||
can't do this!
|
#60
|
||||
|
||||
i can't?
|
#61
|
||||
|
||||
Got it working! thanks
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|