Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] Adding a New Tab in Member Profile
Dylanblitz
Join Date: Oct 2005
Posts: 732

 

OC, California
Show Printable Version Email this Page Subscription
Dylanblitz Dylanblitz is offline 02-13-2010, 10:00 PM

If you are using anything above vB4.0.8 then refer to cellarius' updated article.
https://vborg.vbsupport.ru/showthread.php?p=2214470


I haven't seen a tutorial on doing this and I had to do it for a mod of mine, so I figured I would share. It is actually quite a bit easier to do in vb4 then it was before.

You will need 4 templates and 2 plugins. You could reduce it down to 2 templates but mine is used for distribution so I have to account for all versions.

First Template: This will create the tab next to About Me, Friends, etc

(my_data_tab)
Quote:
<dd<vb:if condition="$selected_tab == 'test'"> class="selected"</vb:if>><a id="test-tab" href="{vb:raw relpath}#test" onclick="return tabViewPicker(this);">Test</a></dd>
Where the text is red you can either leave it or replace it with your own reference. Just make sure it is the same throughout.

Second Template: The data you want to show.

(my_data_data)
Quote:
<div id="view-test" class="<vb:if condition="$selected_tab == 'test'">selected_view_section<vb:else />view_section</vb:if>">
<div class="blockbody">
<div class="blockrow">
<ul class="friends_list floatcontainer">
{vb:raw new_user_data}
</ul>
</div>
</div>
</div>
Same thing here, change the text in red to match the previous template.

Third Template: This will create the tab next to About Me, Friends, etc (4.0.8+)

(my_data_tab_408)
Quote:
<style>
#test'-tab, #test'-tab a:hover {height:25px; display:inline; background-color:transparent; margin:0px; padding:0px; text-align:center; border:none;}
a:hover#test'-tab {background:transparent;}
</style>

<dd<vb:if condition="$selected_tab == 'test''"> class="userprof_module" <vb:else /> class="userprof_moduleinactive"</vb:if>><a id="test'-tab" href="{vb:raw relpath}?tab=test'#test'-content" onclick="return tabViewPicker(this);">Test</a></dd>
Where the text is red you can either leave it or replace it with your own reference. Just make sure it is the same throughout.

Fourth Template: The data you want to show (4.0.8+).

(my_data_data_408)
Quote:
<div id="view-test'-content" class="<vb:if condition="$selected_tab == 'test''">selected_view_section<vb:else />view_section</vb:if>">
<div class="blockbody">
<div class="blockrow">
<ul class="friends_list floatcontainer">
{vb:raw new_user_data}
</ul>
</div>
</div>
</div>
Same thing here, change the text in red to match the previous template.



Now the first plugin
Hook Location: member_build_blocks_start
Title: Whatever you want to call it
Plugin Code
PHP Code:

if ($vbulletin->versionnumber "4.0.8")
{
$templater vB_Template::create('my_data_tab');
} else {
$templater vB_Template::create('my_data_tab_408');
}

$templater->register('selected_tab'$selected_tab);
$templater->register('relpath'$relpath);

if (
$vbulletin->versionnumber "4.0.2")
{
$template_hook['profile_left_last'] .= $templater->render();
} else {
$template_hook['profile_tabs_last'] .= $templater->render();
}


//Do your processing to get your data ready here.
$new_user_data "Data for the new tab";


if (
$vbulletin->versionnumber "4.0.8")
{
$templater vB_Template::create('my_data_data');
} else {
$templater vB_Template::create('my_data_data_408');
}

$templater->register('selected_tab'$selected_tab);
$templater->register('new_user_data'$new_user_data);

    if (
$vbulletin->versionnumber "4.0.2")
    {
$template_hook['profile_left'] .= $templater->render();
    } else {
$template_hook['profile_tabs'] .= $templater->render();
    } 
Second plugin
Hook Location: cache_templates
Title: Whatever you want to call it
PHP Code:
if (THIS_SCRIPT == 'member')
{
    if (
$vbulletin->versionnumber "4.0.8")
    {
    
$cache[] = 'my_data_tab';
    
$cache[] = 'my_data_data';
    } else {
    
$cache[] = 'my_data_tab_408';
    
$cache[] = 'my_data_data_408';
    }

And the result
Attached Images
File Type: png new_tab.png (6.0 KB, 0 views)
Reply With Quote
  #52  
Old 06-27-2011, 08:49 PM
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Posts: 292
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reply With Quote
  #53  
Old 06-27-2011, 09:39 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I do not understand your comments about an echo statement. An echo will not put the text where you want it - it will put it wherever it feels like it (if at all). You need to assign the text that you want output to the $template_hook['profile_tabs'].

What does your template "bbebs_memberinfo_data" look like?
Reply With Quote
  #54  
Old 06-27-2011, 10:37 PM
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Posts: 292
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reply With Quote
  #55  
Old 06-28-2011, 03:52 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reply With Quote
  #56  
Old 06-28-2011, 04:43 AM
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Posts: 292
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reply With Quote
  #57  
Old 06-28-2011, 04:52 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've already written to the author of this tutorial, but received no answer so far. If he is no longer around or does not want to actualize the firstpost with the information already presented in this thread, I will post a new version myself.
Reply With Quote
  #58  
Old 06-28-2011, 06:25 PM
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Posts: 292
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good on you. An update is definitely needed.
Reply With Quote
  #59  
Old 06-29-2011, 07:41 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10359 seconds
  • Memory Usage 2,325KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (9)post_thanks_box
  • (1)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete