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. |
#112
|
|||
|
|||
this works also in vb4.0
|
#113
|
|||
|
|||
Not true
Plugin=> yes Template not, have to be changed to the vB4 Syntax |
#114
|
|||
|
|||
what is wrong with the template.
on my test site it run's almost oke. only when i call te tab by itself http://xxx/forums/member.php?3-Peter...cation&page=10 my custom code is way below everything what is wrong. When i hit the mymodification tab al is displayed normal. --------------- Added [DATE]1261950936[/DATE] at [TIME]1261950936[/TIME] --------------- is there also a way to call a php page that should display his content in this newly created tab ? |
#115
|
||||
|
||||
Quote:
I have a form users submit their resume's on. It saves it to the database in the table formresults. The information I want to display on the profile is located in a column labeled output in the formresults table. Below is the code I'm using in the member_build_blocks_start hook location. Code:
$blocklist = array_merge($blocklist, array( 'resume' => array( 'class' => 'Resume', 'title' => 'Resume', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_resume extends vB_ProfileBlock { var $template_name = 'memberinfo_block_resume'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['resume'] != ''); } function prepare_output($id = '', $options = array()) { global $db; $sql= $db->query_read("SELECT output FROM " . TABLE_PREFIX . "formresults WHERE userid = '.$this->profile->userinfo[userid].' AND title = 'Resume' "); $test = "<div>"; while($result = mysql_fetch_array($sql)) { $test .= "'.$result['output'].'" "; } $test .= "</div>"; $this->block_data['resume'] = $test; } } I get this error when displaying the memberinfo profile page. Quote:
|
#116
|
||||
|
||||
Anyone?
|
#117
|
||||
|
||||
Too many quotes in this 'line':
PHP Code:
|
#118
|
||||
|
||||
Quote:
I see what you're talking about, thanks for that. While there was some syntax error there, unfortunately it didn't solve my problem. I changed it to this: PHP Code:
Quote:
PHP Code:
|
#119
|
|||
|
|||
shouldn;'t it just be :
PHP Code:
of if you wanted a space after each result PHP Code:
|
#120
|
||||
|
||||
Thank you, that got rid of the annoying error. I really could've sworn I had tried that before but apparently not.
The Resume tab shows up now, unfortunately there is still no data in it. Could it be the type of data that's in there (a mixture of html and php variables) causing it to not show up? --------------- Added [DATE]1262744048[/DATE] at [TIME]1262744048[/TIME] --------------- Hmmm... I guess not. I changed the data in there to be just the string "This is only a test" and still nothing shows up. --------------- Added [DATE]1262744441[/DATE] at [TIME]1262744441[/TIME] --------------- HOLY CRAP! I'm almost there! I've been working on this for like a week and I was almost ready to give up but now I'm ALMOST THERE! The problem was the SQL query was returning no results because apparently this line of code doesn't work the way I thought it did. PHP Code:
--------------- Added [DATE]1262745188[/DATE] at [TIME]1262745188[/TIME] --------------- Quote:
For anyone who's interested in what the code looked like that finally ended up working, here it is. PHP Code:
|
#121
|
||||
|
||||
Is there something else you have to do to add more pages? When I repeat the steps I did to create the first tab the new tab I create replaces the first tab I created instead of appearing next to it.
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|