vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Custom User Profile Fields acting weird (https://vborg.vbsupport.ru/showthread.php?t=278536)

Emeralda 02-13-2012 10:25 PM

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.

kh99 02-13-2012 10:36 PM

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.

Emeralda 02-13-2012 10:44 PM

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>

kh99 02-13-2012 10:48 PM

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.

Emeralda 02-13-2012 11:02 PM

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?

kh99 02-13-2012 11:06 PM

So you want each user to control whether everyone's music will autoplay? Then use bbuserinfo.field8 (and $bbuserinfo[field8] in the condition).

Emeralda 02-13-2012 11:36 PM

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?

kh99 02-13-2012 11:48 PM

bbuserinfo is your info when you're logged in, userinfo is the user whose profile page you're looking at.


All times are GMT. The time now is 05:11 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.01492 seconds
  • Memory Usage 1,726KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete