vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=253)
-   -   VB IF with custom field (https://vborg.vbsupport.ru/showthread.php?t=306154)

thenashy 12-22-2013 10:28 AM

VB IF with custom field
 
I'm not very familiar with VB IF statements. I don't even know if I'm calling it the right thing. However, I do remember using an example I found on here some time ago to make text appear only for a certain usergroup.

I'm wondering if it is possible to link this with a custom field.

Basically, I want to be able to allow the user to select if they want avatars on or off, on a particular template.

Any help would be greatly appreciated.

Lynne 12-22-2013 04:10 PM

If you set up a custom user field (fieldx) and then if you want to turn off avatars if that is set to yes, then you could just write a plugin to do it or you could modify the template to do it. Something like:

<if condition="$bbuserinfo['fieldx'] == 'yes'">
stuff
</if>

ozzy47 12-22-2013 04:18 PM

That would be:

<vb:if condition="$bbuserinfo['fieldx'] == 'yes'">
stuff
</vb:if>

Lynne 12-22-2013 04:43 PM

Whoops, Ozzy is correct. For some reason I thought I was in the vB3 forum, not the vB4 forum.

thenashy 12-22-2013 08:58 PM

Thanks guys. I'll give it a go!

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

Hi guys,

I tried the above with no luck. Can you see if I've done something wrong here?

Code:

                <p>       
           
                      <vb:if condition="$bbuserinfo['field19'] == 'On'"><a></a>
                      <vb:else />       
           
                        <vb:if condition="$show['avatar'] AND $post['avatarurl']">
                                <img src="{vb:raw post.avatarurl}" alt="{vb:rawphrase xs_avatar, {vb:raw post.username}}" />
                        <vb:else />
                                <img src="{vb:stylevar imgdir_misc}/unknown.gif" />
                        </vb:if>
            </vb:if>
                        </p>
                </a>

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

I got it to work by taking out the else statement and only using the conditional.

Thanks very much guys, appreciate it!


All times are GMT. The time now is 12:44 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.01696 seconds
  • Memory Usage 1,715KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete