vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Autostarting Music (https://vborg.vbsupport.ru/showthread.php?t=262119)

Tasking Mickey 04-16-2011 11:22 PM

Autostarting Music
 
Hi there,

I currently have a music player on user's profiles, this being the music code.

PHP Code:

        <!-- Music MP3 -->
<if 
condition="$userinfo[field45]">
<
div id="$idclass="tborder content_block">
    <
h4 class="thead block_title">
        <
a href="#top" class="collapse_gadget" onclick="return toggle_collapse('$id')"><img id="collapseimg_$idsrc="$stylevar[imgdir_button]/collapse_generic{$vbcollapse['collapseimg_'.$id]}.gif" alt="" border="0" /></a>
        <
a name="$id"></a>
        <
span class="block_name">Music</span>
    </
h4>
    <
div class="block_content" id="collapseobj_$idstyle="{$vbcollapse['collapseobj_'.$id]}"><div class="alt1 smallfont block_row block_footer">
<
p align="center">
<
EMBED TYPE="AUDIO/MPEG" SRC="$userinfo[field45]HEIGHT=14 WIDTH=239 AUTOSTART=TRUE
</p>
</
div></div>
</
div>
</if>
<!-- / 
Music MP3 --> 

Notice where it says "AUTOSTART=TRUE" that means when someone goes to someone's profile, it automatically start's playing the music on the profile.

However, I made a User Profile Field, named "Autostart on Profile"

It's Radio Buttons and the choices are Yes or No.

I'm trying to, so that if a user goes into that option and puts "No" it won't start automatically playing on a user's profile. But if they set it to "Yes", it will start automatically playing music.

I got help similar on this for ranks, just wondering if the same code can apply to this feature I currently have.

kh99 04-17-2011 04:14 PM

I think you should just have to find out what field number your custom field is, then surround the AUTOSTART=TRUE with an if, like

Code:

<if condition="$bbuserinfo['fieldX'] == 'Yes'"> AUTOSTART=TRUE </if>

(replace the X with the field number of course).

Tasking Mickey 04-17-2011 04:20 PM

Hmm, here is my code so far with your added if condition

PHP Code:

<!-- Music MP3 -->
<if 
condition="$userinfo[field45]">
<
div id="$idclass="tborder content_block">
    <
h4 class="thead block_title">
        <
a href="#top" class="collapse_gadget" onclick="return toggle_collapse('$id')"><img id="collapseimg_$idsrc="$stylevar[imgdir_button]/collapse_generic{$vbcollapse['collapseimg_'.$id]}.gif" alt="" border="0" /></a>
        <
a name="$id"></a>
        <
span class="block_name">Music</span>
    </
h4>
    <
div class="block_content" id="collapseobj_$idstyle="{$vbcollapse['collapseobj_'.$id]}"><div class="alt1 smallfont block_row block_footer">
<
p align="center">
<
EMBED TYPE="AUDIO/MPEG" SRC="$userinfo[field45]HEIGHT=14 WIDTH=239 <if condition="$bbuserinfo['field43'] == 'Yes'"AUTOSTART=TRUE </if> 

I did like you said, copy and pasted your code into the Music code above, and replaced the XXX with my field number.

I went back to "Edit Options" clicked "Yes", went to a user's profile, the music autostarted. I went back to Edit Options, this time selecting "No" went back to the user's profile, and it still autostarted.

Did I code it wrong?

kh99 04-17-2011 04:27 PM

No, it looks right. Maybe autostarting is the default? OK, try this instead:

Code:

AUTOSTART=<if condition="$bbuserinfo['field43'] == 'Yes'">TRUE<else />FALSE</if>

Tasking Mickey 04-17-2011 04:32 PM

Yes, it worked.

Thank you so much. ;)


All times are GMT. The time now is 01:14 AM.

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.01151 seconds
  • Memory Usage 1,743KB
  • 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
  • (2)bbcode_php_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