vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Profile Field Value (https://vborg.vbsupport.ru/showthread.php?t=279838)

RickyH 09-02-2013 09:20 AM

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>

stoute 09-09-2013 09:06 PM

strangely enough that didn't display anything for me.

tbworld 09-09-2013 10:11 PM

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.

stoute 09-09-2013 10:28 PM

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

ozzy47 09-09-2013 10:31 PM

And what plugin location are you using to execute the two above?

stoute 09-09-2013 10:42 PM

sorry, I should have added that.

Plugin to show the custom tab: member_complete
Plugin to make custom tab default: member_build_blocks_start

cellarius 09-10-2013 11:15 AM

Use $prepared instead of $post. $post is not available to the member profile templates.

tbworld 09-10-2013 01:51 PM

@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.


All times are GMT. The time now is 04:38 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02150 seconds
  • Memory Usage 1,736KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete