Log in

View Full Version : How to turn code on/off over UserCP?


Doc Great
10-12-2005, 07:24 AM
Hello folks,

a little question of mine, how can i set up a profile field to let the users turn on/off a special feature (ads between the posts). I did a new profile filed, and set the following code in front of the ad-code, but i dont know how to get on ...

if ($vbulletin->userinfo['field6'] == 'Off')
{

Adrian Schneider
10-12-2005, 07:53 AM
if ($vbulletin->userinfo['field6'] == 'On')
{
// ad code here
}


Like that?

Doc Great
10-13-2005, 04:22 AM
Doesn't work. Anybody out there :)

if ($vbulletin->userinfo['field6'] == 'On')
{
<if condition="$GLOBALS['adsense_position'] == $post['postcount']">
$spacer_open
<div style="padding:0px 0px $stylevar[cellpadding]px 0px">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead" align="left">Sponsored Links</td>
</tr>
<tr>
<td class="alt1" align="center">

<!-- Werbung -->

</td>
</tr>
</table>

</div>
$spacer_close
</if>
}

Adrian Schneider
10-13-2005, 04:23 AM
Use <if> if you are doing it in the templates.

<if condition="$vbulletin->userinfo['field6'] == 'On'">
your ad code here
</if>

Doc Great
10-13-2005, 04:54 AM
Thanks Aj :) it works. Now it logical, (me :rolleyes: ) look at the first if-condition and then at the second, whats wrong :D:D

Often the answer is in front of you.......