The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[HOW TO - vB4] Adding a New Tab in Member Profile - Reloaded
This tutorial is an update of Dylanblitz' howto for older versions. Credits to him, and thanks for giving me green light for building on his ideas. This has been tested with [S]4.1.4[/S] 4.2,[S] but should work as far back as 4.0.8, when profile customization was reintroduced. [/S] [Explanation: At least with version 4.1.8, the template name convention for profile tabs was changed. If you want to code for an earlier version, use custom_profile_tab_test as template name.] First step To create a new member profile tab, create a plugin at hook member_complete Code:
if (isset($vbulletin->GPC['tab'])) { $selected_tab = $vbulletin->GPC['tab']; } $blockinfo['title'] = "Test Title"; $blockid = "test"; $taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=test#test"; $templater = vB_Template::create('memberinfo_tab'); $templater->register('selected_tab', $selected_tab); $templater->register('relpath', $relpath); $templater->register('blockinfo', $blockinfo); $templater->register('blockid', $blockid); $templater->register('taburl', $taburl); $template_hook['profile_tabs_last'] .= $templater->render(); // ### Your code to fill the tab ### // Don't forget you need to register any variables for use in templates $test_tab_content = "Congratulations, you can see me, I'm your PHP Code!"; $templater = vB_Template::create('memberinfo_block_test'); $templater->register('selected_tab', $selected_tab); $templater->register('test_tab_content', $test_tab_content); $template_hook['profile_tabs'] .= $templater->render();
Second step The second step to a custom profile tab is to create a new template. It has to be the name you used in your php code to create it, in our case: memberinfo_block_test. Code:
<div id="view-test" class="<vb:if condition="$selected_tab == 'test'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>"> <div class="blocksubhead subsectionhead userprof_headers userprof_headers_border"> <h4 class="subsectionhead-understate">Test</h4> </div> <br />This is a <b>custom tab</b> test.<br /> {vb:raw test_tab_content} </div>
Direct access If you want to access your custom profile tag directly, append &tab=test#testto the profile URL. That's it |
#32
|
|||
|
|||
How do I do that? Do I press the "Revert" button and that will do it?
|
#33
|
||||
|
||||
Yes.
|
#34
|
|||
|
|||
Still doesn't work......
|
#35
|
||||
|
||||
I have the code from the article working in 4.2.
|
#36
|
|||
|
|||
Can someone please help? I want to have this custom tab added to each person's profile, and have that tab be called "Gallery". When you click on it, it shows all the photos they've uploaded.
Then in the menu at the top of the webpage, I want to have "Gallery" and have that connect to random members' photos, possibly based on their popularity. I hope it's not too much that I'm asking... |
#37
|
||||
|
||||
You'll find the code to create the tab in this article. For all the rest you'll have to create your own thread in the general forums.
|
#38
|
|||
|
|||
now that i have this setup
how do i include custom fields for that tab |
#39
|
||||
|
||||
^^^ This, please.
|
#40
|
||||
|
||||
Quote:
@simonhind i was having your problem and i've done this Create a new plugin and choose "userprofile_create" as hook, use this php code PHP Code:
|
#41
|
|||
|
|||
Is there not a way to have this new tab connect directly to the user's pictures within their profile?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|