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. |
#12
|
|||
|
|||
with:
PHP Code:
PHP Code:
|
#13
|
||||
|
||||
For the contents of the tab how can I pull a custom profile field?
Code:
$blocklist = array_merge($blocklist, array(
'custom' => array(
'class' => 'custom',
'title' => 'Custom Tab (Work in Progress)',
'hook_location' => 'profile_left_last'
)
));
class vB_ProfileBlock_custom extends vB_ProfileBlock
{
var $template_name = 'memberinfo_block_custom';
function confirm_empty_wrap()
{
return false;
}
function confirm_display()
{
return ($this->block_data['custom'] != '');
}
function prepare_output($id = '', $options = array())
{
$this->block_data['custom'] = '<if condition="$userinfo[field8]"><strong>Stuff:</strong> $userinfo[field8]<br /></if> ';
}
}
|
#14
|
|||
|
|||
Thanks for the article!
|
#15
|
||||
|
||||
Quote:
Code:
function prepare_output($id = '', $options = array()) { $this->block_data['custom'] = $this->profile->userinfo['field8'] : "Stuff: $this->profile->userinfo['field8']" ? "Nothing to see here"; } } |
#16
|
||||
|
||||
How can we create similar tab like "About Me" contents of which are user editable on the page itself. This facility should have inbuilt into vbulletin as a default.
|
#17
|
||||
|
||||
just noticed this tut - outstanding!
|
#18
|
||||
|
||||
Was wondering how would i get this peice of code into a block
PHP Code:
|
#19
|
||||
|
||||
Very nice tutorial indeed..thanks a lot but as MSimplay said above, I am also interested in adding some custom DB queries for displaying items from the DB is it possible?
|
#20
|
|||
|
|||
Quote:
|
#21
|
|||
|
|||
A great tutorial! Thanks!
One question, to get this to show you have to click the small arrow at the end; is there any way to get it too show all tabs by default, without having to click the arrow? This only happens when the 'Infraction' tab is showing too...any way to get them all show? Regards Jason |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|