MyBB Community Forums

Full Version: HTML Hidden if no user input profile field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
OK so i am using a 1.6 mybb forum (dont ask why) however 1.8 code should still work the same so if you have anything at all dont hesitate to reply.

I have set up my own custom music section on the member profile, the following code has been inserted into my member profile template

 {$userstars}<br />
 <br />
 <strong>{$lang->registration_date}</strong> {$memregdate}<br />
 <strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
 <strong>{$lang->local_time}</strong> {$localtime}<br />
 <strong>{$lang->postbit_status}</strong> {$online_status}
</span>

<div class="audiomargin" title="user policy">
	<audio id="bgmusic" src="{$userfields['fid6']}" type="audio/mpeg" style="width: 274;" controls="" loop="" autoplay=""></audio>
 </div>


</div>

i wish to draw your attention to this code which i have implemented

<div class="audiomargin">
	<audio id="bgmusic" src="{$userfields['fid6']}" type="audio/mpeg" style="width: 274;" controls="" loop="" autoplay=""></audio>
 </div>

the player shows up even if you have no link added to your profile, ( i set up a custom profile field as you can see)

i wish to have it so if no link (text) has been input into the custom user field 6 then this div will not be shown on the users profile.

i do have the php in templates plugin this should help

as you can see i am trying to only show the profile music bar if someone has put there link (text) into the field.

i am not looking to use a music plugin (i dont like the player or the un, nessesery code for vids etc)

any help would be appreciated. i will reliease a how to after so other can do the same.
We no longer support 1.6 forums and we recommend that you should upgrade to 1.8.