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. |
#22
|
|||
|
|||
I can get the tab to show custom profile fields, but i want the same fields to be removed from the about me section - how would this be achieved?
|
#23
|
||||
|
||||
This is quite helpful. Is there any way to add dynamic content to the tab, however? I've tried everything I can think of to achieve this, but the scope of the class won't allow for it. Is this method relegated to static content, or can this be done?
|
#24
|
||||
|
||||
Im using this in my plugin, but the tab disappeared
Code:
function prepare_output($id = '', $options = array()) { $this->block_data['custom'] = $this->profile->userinfo['field17'] : "Stuff: $this->profile->userinfo['field17']" ? "Nothing to see here"; } ok I got it working with this code, but it looks like it wont custom html by my users like this Code:
$blocklist = array_merge($blocklist, array( 'customcode' => array( 'class' => 'CustomCode', 'title' => 'My Media', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_CustomCode extends vB_ProfileBlock { var $template_name = 'memberinfo_block_customcode'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['customcode'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['customcode'] = $this->profile->userinfo['field17']; } } |
#25
|
||||
|
||||
How would i add a custom template to be put inside the block?
|
#26
|
|||
|
|||
A very helpful article thank you, just not quite enough help for non coders like me.
I successfully created new tab and with the following code I now get output of "field 12" showing but not "field 11" instead of both showing, am also having difficulty inserting the field title in the output. A little help maybe. Code:
$blocklist = array_merge($blocklist, array( 'checklist' => array( 'class' => 'checklist', 'title' => 'Checklist (Work in Progress)', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_checklist extends vB_ProfileBlock { var $template_name = 'memberinfo_block_checklist'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['checklist'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['checklist'] = $this->profile->userinfo['field11']; $this->block_data['checklist'] = $this->profile->userinfo['field12']; } } I would really appreciate a little help with this as its so close to working fully - Bump |
#27
|
||||
|
||||
Quote:
Code:
function prepare_output($id = '', $options = array()) { $this->block_data['checklist'] = $this->profile->userinfo['field11']; $this->block_data['checklist'] = $this->profile->userinfo['field12']; } } Code:
function prepare_output($id = '', $options = array()) { $this->block_data['checklist'] = $this->profile->userinfo['field11']; $this->block_data['checklist'] .= $this->profile->userinfo['field12']; } } My question here... In vBulletin 3.6.* I had such code in product: Code:
<plugin active="1" executionorder=5" product="test"> <title>Test - member complete</title> <hookname>member_complete</hookname> <phpcode><![CDATA[if (THIS_SCRIPT == 'member') { $test = "Hellow!"; if ($vbulletin->options[test_auto]) { $footer = $test.$footer; } }]]></phpcode> </plugin> This one doesn't work: Code:
function prepare_output($id = '', $options = array()) { $this->block_data['test'] = "$test"; } |
#28
|
|||
|
|||
Thank you Makc666.
Moving on LOL. New Tab is now outputting what I want. Next issue and I'm sure others need to know this as well. On the "About tab" is the option "simple link" - View your "About Me" as seen by everyone else. situated on the left which calls member.php?u=1&tab=aboutme&simple=1 I have reproduced this on my new tab which calls member.php?u=1&tab=newtab&simple=1 exept it doesnt it just reloads the main memberinfo page. Any pointers??? |
#29
|
||||
|
||||
Quote:
The code that you had added. |
#30
|
|||
|
|||
My Custom template called for the tab
Code:
<div class="alt1 block_row" align="right"> <if condition="$show['simple_link']"> <div id="simple_experience"><a class="smallfont" href="member.php?$session[sessionurl]u=$bbuserinfo[userid]&tab=experience&simple=1">$vbphrase[view_your_extra_options]</a></div> </if> <if condition="$show['edit_link']"> <div id="simple_experience_link"><a class="smallfont" href="member.php?$session[sessionurl]u=$bbuserinfo[userid]&tab="profile_left_last">$vbphrase[edit_extra_options]</a></div> </if> <div class="alt1 block_row" align="left"> <ul class="list_no_decoration"> $block_data[experience] <!-------------------------Extra option profile fields--------> <dt class="shade" id="profilefield_title_$profilefield[profilefieldid]">$profilefield[title]</dt> <br> <if condition="$userinfo[field11]">Field Title 11 $userinfo[field11]<br /></if> <br> <if condition="$userinfo[field12]">Field Title 12 $userinfo[field12]<br /></if> <br> <if condition="$userinfo[field14]">Field Title 14 $userinfo[field14]<br /></if> <br> <if condition="$userinfo[field13]">Field Title 13 <br> $userinfo[field13]<br /></if> <br> <if condition="$userinfo[field15]">Field Title 15 </if> <if condition="$comma = ''"></if> <if condition="$userinfo['field15'] & 1"> $comma Option A <if condition="$comma = ', '"></if> </if> <if condition="$userinfo['field15'] & 2"> $comma Option B <if condition="$comma = ', '"></if> </if> <if condition="$userinfo['field15'] & 4"> $comma Option C <if condition="$comma = ', '"></if> </if> <if condition="$userinfo['field15'] & 8"> $comma Option D <if condition="$comma = ', '"></if> </if> <if condition="$userinfo['field15'] & 16"> $comma Option E <if condition="$comma = ', '"></if> </if> <br> <br> <if condition="$userinfo[field16]">My Yes/No answer is: $userinfo[field16]<br /></if> <br> <if condition="$userinfo[field17]">My Selection Menu Choice is: $userinfo[field17]<br /></if> </ul> </div> </div> Code:
$blocklist = array_merge($blocklist, array( 'checklist' => array( 'class' => 'experience', 'title' => 'My Experience', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_experience extends vB_ProfileBlock { var $template_name = 'memberinfo_block_experience'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['experience'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['experience'] = 'My Experience:'; } } |
#31
|
||||
|
||||
Sorry, but I was not able to display your template.
It always show we blank. You can upload a ready test product for us to try if you want. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|