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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-13-2012, 10:25 PM
Emeralda's Avatar
Emeralda Emeralda is offline
 
Join Date: Oct 2011
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom User Profile Fields acting weird

I've set up a custom profile music player, so members could put their favourite tracks as, well, their profile music. Then someone requested the ability to pick whether it should be autoplayed or not, so I made this (autoplay=1 OR 0):

http://prntscr.com/647wj http://prntscr.com/647u4

And this is where I encountered 2 problems. First, it didn't want to switch to 0, or rather, it didn't want to save it. Second, even after making 1 the default value, it wouldn't work until the settings were first saved.

It works when I do it like that http://prntscr.com/647wa but it's still quite disheartening.
Reply With Quote
  #2  
Old 02-13-2012, 10:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, for some reason I don't understand, if you add a custom profile field it won't have any value for existing users until they edit their profile, even if you specify a default. Seems kind of like a bug to me, but I guess it's always been that way so maybe there's a reason for it that I don't understand.

In any case, you could probably use if statements to check for no value (!= '') and insert the default.
Reply With Quote
  #3  
Old 02-13-2012, 10:44 PM
Emeralda's Avatar
Emeralda Emeralda is offline
 
Join Date: Oct 2011
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uhm, could you do it please? Ifs were always my weak side, and vB4 has those vbs everywhere compared to vB3.

Code:
<object type="application/x-shockwave-flash" data="audio-player/dewplayer.swf" width="200" height="20" id="dewplayer" name="dewplayer"> <param name="wmode" value="transparent" /><param name="movie" value="audio-player/dewplayer.swf" /> <param name="flashvars" value="mp3={vb:raw userinfo.field7}&amp;autostart={vb:raw userinfo.field8}&amp;showtime=1" /> </object>
Reply With Quote
  #4  
Old 02-13-2012, 10:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<object type="application/x-shockwave-flash" data="audio-player/dewplayer.swf" width="200" height="20" id="dewplayer" name="dewplayer"> <param name="wmode" value="transparent" /><param name="movie" value="audio-player/dewplayer.swf" /> <param name="flashvars" value="mp3={vb:raw userinfo.field7}&amp;autostart=<vb:if condition="$userinfo[field8] != ''">{vb:raw userinfo.field8}<vb:else />1</vb:if>&amp;showtime=1" /></object>

I'm not sure if you wanted the default (for users who haven't chosen) to be 0 or 1. If you want it to be 0, change the red 1 above to 0.
Reply With Quote
  #5  
Old 02-13-2012, 11:02 PM
Emeralda's Avatar
Emeralda Emeralda is offline
 
Join Date: Oct 2011
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rawr, someone just pointed out on the forum it doesn't work as intended. Silly me, I should have noticed myself. Anyway, that userinfo thingie takes music url from the member who's profile you're visiting, right? The same thing is happening in case of autoplay option. So if you set 1 so it would autoplay, it will autoplay for everyone who visit your profile despite their own settings. How to make it so field8 was using their own settings?
Reply With Quote
  #6  
Old 02-13-2012, 11:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So you want each user to control whether everyone's music will autoplay? Then use bbuserinfo.field8 (and $bbuserinfo[field8] in the condition).
Reply With Quote
  #7  
Old 02-13-2012, 11:36 PM
Emeralda's Avatar
Emeralda Emeralda is offline
 
Join Date: Oct 2011
Posts: 202
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rawr, thanks, others confirmed it works~

bbuserinfo is for options that should be taken locally, while userinfo to see what others have set up, right?
Reply With Quote
  #8  
Old 02-13-2012, 11:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bbuserinfo is your info when you're logged in, userinfo is the user whose profile page you're looking at.
Reply With Quote
Благодарность от:
Emeralda
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 12:37 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.04122 seconds
  • Memory Usage 2,237KB
  • 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
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete