Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 09-02-2013, 10:20 AM
RickyH RickyH is offline
 
Join Date: Dec 2011
Posts: 86
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would have to edit the memberdisplay template to have the <vb:if condition> code, i'll find it from one of my previous posts for you and add to this reply.


Edit: Code is;
Code:
<vb:if condition="$post['field5']">Field 5:{vb:raw post.field5}</vb:if>
Reply With Quote
  #12  
Old 09-09-2013, 10:06 PM
stoute stoute is offline
 
Join Date: May 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

strangely enough that didn't display anything for me.
Reply With Quote
  #13  
Old 09-09-2013, 11:11 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would have to see your code to see what you are doing wrong. If you care to post it then I would be glad to help.

The $post variable in general is not usually available to the templates in whole, although I have not looked at the code in the profile tabs. My two cents.
Reply With Quote
  #14  
Old 09-09-2013, 11:28 PM
stoute stoute is offline
 
Join Date: May 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

New custom Tab template:
Code:
<div id="view-my_character_bio" class="<vb:if condition="$selected_tab == 'my_character_bio'">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">My Character's Bio</h4>
    </div>
    <div style="margin-left:25px;margin-right:25px">
<br />This is a <b>custom tab</b> test.<br /> 

Code should appear below.<br/>
<vb:if condition="$post['field5']">Field 5:{vb:raw post.field5}<br/></vb:if>
Code should appear above.

</div>
</div>
Plugin to show the custom tab:
Code:
if (isset($vbulletin->GPC['tab']))
{
    $selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = "My Bio";
$blockid = "my_character_bio";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&amp;tab=my_character_bio#my_character_bio";

$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_first'] .= $templater->render();  

// ### Your code to fill the tab ###
// Don't forget you need to register any variables for use in templates 

$templater = vB_Template::create('my_character_bio');
$templater->register('selected_tab', $selected_tab);
$template_hook['profile_tabs'] .= $templater->render();
plugin to make custom tab default:
Code:
if (!$vbulletin->GPC_exists['tab'])
{
    $vbulletin->GPC['tab'] = 'my_character_bio';
}
here is the live link: http://immortalarg.com/forum/member.php?1-stoute
Reply With Quote
  #15  
Old 09-09-2013, 11:31 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And what plugin location are you using to execute the two above?
Reply With Quote
  #16  
Old 09-09-2013, 11:42 PM
stoute stoute is offline
 
Join Date: May 2010
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, I should have added that.

Plugin to show the custom tab: member_complete
Plugin to make custom tab default: member_build_blocks_start
Reply With Quote
  #17  
Old 09-10-2013, 12:15 PM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use $prepared instead of $post. $post is not available to the member profile templates.
Reply With Quote
Благодарность от:
tbworld
  #18  
Old 09-10-2013, 02:51 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Cellarius is of course right. You need to use $prepared. You will also need to add your field to the array in 'class_userprofile.php". You should then be able to use it in your template as a conditional. Make sure you register array $prepared in your template or it will not work. Use hook 'member_build_blocks_start' -- which I already think you are using.

Around line #89 in 'class_userprofile.php'
Code:
    var $auto_prepare = array(
        ..................
        'show',
        'field5',        //Add your fieldxx here to the bottom of the array.
    );
Sorry, I was too tired when I wrote this to see if there was another way to add 'fieldxx' to the 'prepared' array, but at least this will get you started.
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 03:10 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.13733 seconds
  • Memory Usage 2,240KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)post_thanks_box
  • (1)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete