PDA

View Full Version : Autostarting Music


Tasking Mickey
04-16-2011, 11:22 PM
Hi there,

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

<!-- Music MP3 -->
<if condition="$userinfo[field45]">
<div id="$id" class="tborder content_block">
<h4 class="thead block_title">
<a href="#top" class="collapse_gadget" onclick="return toggle_collapse('$id')"><img id="collapseimg_$id" src="$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_$id" style="{$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

<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

<!-- Music MP3 -->
<if condition="$userinfo[field45]">
<div id="$id" class="tborder content_block">
<h4 class="thead block_title">
<a href="#top" class="collapse_gadget" onclick="return toggle_collapse('$id')"><img id="collapseimg_$id" src="$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_$id" style="{$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:

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. ;)