vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   Using your User Profile Fields in your postbit templates (w/ all plugin method) (https://vborg.vbsupport.ru/showthread.php?t=250418)

DreadsUK 04-30-2014 08:57 PM

oh man im so shit at this lol

ok, so vB4.2.2 and editing in postbit template

The field i've created is gender with 2 options male or female.

http://s9.postimg.org/5qp9yvmf3/Scre...t_06_38_27.png

Here is the code i've got in there. Its not working and i bet one of you guys will take 1 look and it will be so obvious lol

https://vborg.vbsupport.ru/external/2014/04/1.png

Lynne 05-01-2014 05:05 PM

It's "field7", not "Field7".

DreadsUK 05-02-2014 06:05 PM

<vb:if condition="$post['field7']"><dt>Gender</dt> <dd>{vb:raw post.field7}</dd></vb:if>

Not working

Mark.B 05-02-2014 06:22 PM

Take off the conditionals so you just have this:
Code:

<dt>Gender</dt> <dd>{vb:raw post.field7}</dd>
Does anything show up now?

This is really a test that you are editing the correct template in the correct style, since now, even if your field id was wrong you should at least see "Gender" in the postbit.

Lynne 05-02-2014 06:27 PM

Are you sure the poster has even set the gender in their profile?

DreadsUK 05-02-2014 06:34 PM

Quote:

Originally Posted by Lynne (Post 2495885)
Are you sure the poster has even set the gender in their profile?

Yea, the poster is me hehe. good question tho :p

--------------- Added [DATE]1399059505[/DATE] at [TIME]1399059505[/TIME] ---------------

AHHHH, i was editing

'postbit' not 'postbit_legacy'

Mark.B 05-02-2014 07:13 PM

Quote:

Originally Posted by Mark.B (Post 2495883)
This is really a test that you are editing the correct template

Quote:

Originally Posted by DreadsUK (Post 2495889)
AHHHH, i was editing

'postbit' not 'postbit_legacy'

The old ones are the best. ;)

jagtpf 06-23-2015 11:13 AM

Have been trying to use method 2 ...

This works >>>>

if ($post[field40])
{
$ImagePath = vB_Template_Runtime::fetchStyleVar('imgdir_misc'). '/critique/nocritique.png';
$template_hook['postbit_userinfo_right_after_posts'] .=
'<br /><dt>Critique Level</dt><br /> <dd><img src="' . $ImagePath . '"/></dd>';
}

Yielding both Critique Level: and an image.

Adding conditional doesn't, if there is just one conditional I get Critique Level: and a broken image link; the only difference is the "& 4" - If I use with three conditionals I get 3 * Critique Level: s and 3 broken image links .... It also seems as though it is ignoring the "if" statement because it shows on every profile.>>>>

if ($post[field40])
{
if ($post[field40] & 4)
$ImagePath = vB_Template_Runtime::fetchStyleVar('imgdir_misc'). '/critique/nocritique.png';
$template_hook['postbit_userinfo_right_after_posts'] .=
'<br /><dt>Critique Level</dt><br /> <dd><img src="' . $ImagePath . '"/></dd>';
}

I can hazard a guess that using three conditionals there could be a confusion over $ImagePath, but surely it should work with just the one condition ?

I'm missing something rather simple I think ?!

Lynne 06-23-2015 04:52 PM

You need some parenthesis after your second condition (why are you using a second one anyway?).

Code:

if ($post[field40])
{
        if ($post[field40] & 4)
        {
        $ImagePath = vB_Template_Runtime::fetchStyleVar('imgdir_misc').'/critique/nocritique.png';
        $template_hook['postbit_userinfo_right_after_posts'] .=
'<br /><dt>Critique Level</dt><br /> <dd><img src="' . $ImagePath . '"/></dd>';
        }
}


jagtpf 06-25-2015 07:08 AM

Not too sure what you mean by "why am I using a second condition...."

I'm following your method 2 :

Quote:

if ($post['fieldx'])
{
$template_hook['postbit_userinfo_right_after_posts'] .= '<dt>My FieldX</dt> <dd>';

if ($post['fieldx'] & 1) $template_hook['postbit_userinfo_right_after_posts'] .= 'Your 1rst option';
if ($post['fieldx'] & 2) $template_hook['postbit_userinfo_right_after_posts'] .= 'Your 2nd option';
if ($post['fieldx'] & 4) $template_hook['postbit_userinfo_right_after_posts'] .= 'Your 3rd option';
if ($post['fieldx'] & 8) $template_hook['postbit_userinfo_right_after_posts'] .= 'Your 4th option';
if ($post['fieldx'] & 16) $template_hook['postbit_userinfo_right_after_posts'] .= 'Your 5th option';

$template_hook['postbit_userinfo_right_after_posts'] .= '</dd>';
}
but for 3 conditions. But even ignoring the conditional, I can't get a true result from conditional statement for any of ; ($post[field40] & 1), ($post[field40] & 2) or ($post[field40] & 4), whilst I can from ($post[field]).

[field40] contains 3 radio buttons.

Looks like I need to keep hammering at it ....


All times are GMT. The time now is 05:33 AM.

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.02722 seconds
  • Memory Usage 1,744KB
  • 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
  • (2)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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