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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2011, 11:22 PM
Tasking Mickey's Avatar
Tasking Mickey Tasking Mickey is offline
 
Join Date: Jun 2010
Location: United States
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 04-17-2011, 04:14 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 04-17-2011, 04:20 PM
Tasking Mickey's Avatar
Tasking Mickey Tasking Mickey is offline
 
Join Date: Jun 2010
Location: United States
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 04-17-2011, 04:27 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Code:
AUTOSTART=<if condition="$bbuserinfo['field43'] == 'Yes'">TRUE<else />FALSE</if>
Reply With Quote
  #5  
Old 04-17-2011, 04:32 PM
Tasking Mickey's Avatar
Tasking Mickey Tasking Mickey is offline
 
Join Date: Jun 2010
Location: United States
Posts: 148
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, it worked.

Thank you so much.
Reply With Quote
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 05:11 PM.


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.11403 seconds
  • Memory Usage 2,224KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete