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. |
#92
|
||||
|
||||
NOTE: I'm creating a new mode for Shelfari called "My Shelfari Bookshelf". I reserve this idea, so please don't steal my idea
Having a hard time applying this for a new tab called "Shelfari" (shelfari.com) The template is: memberinfo_block_shelfari Code:
<div class="alt1 block_row"> <ul class="list_no_decoration"> $block_data[shelfari] </ul> </div> Code:
$blocklist = array_merge($blocklist, array( 'mymodification' => array( 'class' => 'Shelfari', 'title' => 'My Shelfari Bookshelf', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_Shelfari extends vB_ProfileBlock { var $template_name = 'memberinfo_block_shelfari'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['shelfari'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['shelfari'] = '<embed width="500" height="500" src="http://www.shelfari.com/ws/shelf.swf" wmode="transparent" FlashVars="UserName=chadi&ShelfType=list&verE=s1.5&ListType=isowned&booksize=large&Alpha=0&BGColor=FFFFFF"></embed>'; } } I tried replacing chadi with $userinfo[field44] and it did not pull correctly. What is the actual proper replacement code to pull whatever content from the user's field44 profile field to replace my actual username? Can some also please explain how to properly create a plugin file for this, so I can share it as a mod? |
#93
|
||||
|
||||
Try $this->profile->userinfo['field44']
|
#94
|
||||
|
||||
Thanks, but the tab doesn't show up now.
Code:
$blocklist = array_merge($blocklist, array( 'mymodification' => array( 'class' => 'Shelfari', 'title' => 'My Shelfari Bookshelf', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_Shelfari extends vB_ProfileBlock { var $template_name = 'memberinfo_block_shelfari'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['shelfari'] != ''); } function prepare_output($id = '', $options = array()) { $this->block_data['shelfari'] = '<embed width="700" height="700" src="http://www.shelfari.com/ws/shelf.swf" wmode="transparent" FlashVars="UserName=$this->profile->userinfo['field44']&ShelfType=list&verE=s1.5&ListType=isowned&booksize=large&AmazonAssociate=taljes-20&Alpha=0&BGColor=FFFFFF"></embed>'; } } |
#95
|
||||
|
||||
Try assigning it to a variable and then use the variable in that line of code:
PHP Code:
|
#96
|
||||
|
||||
Sorry, but I really don't know what you're telling me here. I'm not a coder
Can you give me a hint by pasting what the entire plugin code should look like? It'll be easier for me to dissect it carefully from there. --------------- Added [DATE]1240546636[/DATE] at [TIME]1240546636[/TIME] --------------- Ok, I tried this: Code:
$blocklist = array_merge($blocklist, array( 'mymodification' => array( 'class' => 'Shelfari', 'title' => 'My Shelfari Bookshelf', 'hook_location' => 'profile_left_last' ) )); class vB_ProfileBlock_Shelfari extends vB_ProfileBlock { var $template_name = 'memberinfo_block_shelfari'; function confirm_empty_wrap() { return false; } function confirm_display() { return ($this->block_data['shelfari'] != ''); } function prepare_output($id = '', $options = array()) { $var = $this->profile->userinfo['field44']; $this->block_data['shelfari'] = '<embed width="700" height="700" src="http://www.shelfari.com/ws/shelf.swf" wmode="transparent" FlashVars="UserName' . $var . '&ShelfType=list&verE=s1.5&ListType=isowned&booksize=large&AmazonAssociate=taljes-20&Alpha=0&BGColor=FFFFFF"></embed>'; } } The actual widget is giving an error stating that a username was not provided and must be provided. --------------- Added [DATE]1240547063[/DATE] at [TIME]1240547063[/TIME] --------------- Fixed. I had to had the = after UserName. Thanks Lynne. One quick question, I'd like to make an xml plugin file so people can install this as a product. Could I trouble you to explain how this can be done? |
#97
|
||||
|
||||
Looks like you already figured that out since I saw you released your mod.
|
#98
|
||||
|
||||
Yes, and gave you and Wired1 credit for the help.
Thank you Lynne, appreciate it. PS: would you like me to make you co-author of the mod? I'm honestly not sure how these things work on the forums. I've only started releasing mods a couple days ago. I'm not even a programmer. |
#99
|
||||
|
||||
No, no. I am here just to help out. I really don't know what the co-author thing is for, but just giving you a couple pointers doesn't make me a co-author. You did all the hard work.
|
#100
|
|||
|
|||
Okay, I've installed this properly, and I need a somewhat specific request:
-- Search for all threads started by user, in forumID 12 and all child boards -- [USERNAME]'s Posted Content -- End Link -- Sorry, I really don't know a lot about using variables... |
#101
|
|||
|
|||
If you want to know how to pull HTML from a template rather than writing the HTML in the plugin take a look at what I've wrote.
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|