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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-01-2014, 04:56 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default if conditions inside of an else statement

EDIT I FIXED IT FORGOT MY END " (FIXED IN RED)

But now for users not logged in it's showing 2 avatars =/ so ill leave this see if anyone can help me fix it =)


EDIT 2 this is solved request closed =)

im trying to use this code to show a different default avatar depending on if the user is registered/ male or female.

i set it up to be if user has an avatar display that users avatar, if user doesnt but is registered (i have a required userfield at reg, to get the male/female) display male or female default accordingly, but if user is not registered it will just display a ? avatar.

Code:
<if condition="$navbaravatarurl">
					<img src="$navbaravatarurl" />
				<else />
					<if condition="$bbuserinfo['field5'] == 'Male'">
						<img src="images/misc/nom.png" />
					<else />
						<img src="images/misc/no.png" />
					</if>
					<if condition="$bbuserinfo['field5'] == 'Female'">
						<img src="images/misc/nof.png" />
					<else />
						<img src="images/misc/no.png" />
					</if>
				</if>
although this code gives me an error and says im not closing a statement -_- and ... yeah they're all closed, and if i save anyway it give me a content encoding error.


When i use the code like this it works fine... but kind of kills the way i want to set it up.
Code:
<if condition="$navbaravatarurl">
					<img src="$navbaravatarurl" />
				<else />
					<img src="images/misc/no.png" />
				</if>
so anyone no what im doing wrong, or have another way for me to go about getting this accomplished? thank you =)
Reply With Quote
  #2  
Old 05-01-2014, 05:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think those conditions will work how you want it to anyway. You will end up with two images. Also, is this in the postbit template? $bbuserinfo is the user *viewing* the site, not the poster.

I think you need to do...

if field isn't Male or Female
- no.png
else
- if field is Male
- - nom.png
- else
- - nof.png
- end if
end if
Reply With Quote
  #3  
Old 05-01-2014, 05:26 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i actually been playing with it the whole time not just sitting waiting for some one to spoon me lol, i was just coming back to say i got it =)

but to answer your question, no it's not for the postbit but i might do something similar with the postbit(s) =) this is a sidebar addon im working on you can check out here (toggles on the right side)
i had to take a plugin already made (navbar avatar or something) and ive re-wrote it a little, not quite to where i want it yet plus id rather be able to change the images and things in the CP if i do publicly release it, but its coming along =)

FINAL CODE I ENDED UP USING:
Code:
<if condition="$navbaravatarurl">
<img class="sbav" src="$navbaravatarurl" />
<else />
<if condition="$bbuserinfo['field5'] == 'Male'">
<img class="sbav" width="100px" src="images/misc/nom.png" />
</if>
<if condition="$bbuserinfo['field5'] == 'Female'">
<img class="sbav" width="100px" src="images/misc/nof.png" />
</if>
<if condition="$bbuserinfo['field5'] != 'Female' AND $bbuserinfo['field5'] != 'Male'">
<img class="sbav" width="100px" src="images/misc/no.png" />
</if>
</if>
Reply With Quote
  #4  
Old 05-01-2014, 05:30 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm glad you got it.
Reply With Quote
Благодарность от:
Dr.CustUmz
  #5  
Old 05-01-2014, 05:32 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks =)

and some spoilers =P
Attached Images
File Type: png Capture.PNG (18.5 KB, 0 views)
File Type: png Capture2.PNG (18.7 KB, 0 views)
File Type: png Capture3.PNG (16.4 KB, 0 views)
File Type: png Capture4.PNG (40.8 KB, 0 views)
Reply With Quote
Благодарность от:
Lynne
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 07:30 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.04294 seconds
  • Memory Usage 2,235KB
  • Queries Executed 14 (?)
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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (2)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (4)postbit_attachment
  • (5)postbit_onlinestatus
  • (5)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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete