PDA

View Full Version : User session information outside of vBulletin.


MjrGaelic
12-10-2008, 10:13 PM
What I'm trying to do is disable ads sitewide for subscribers (premium members).

I'm able to do this within vBulletin templates and I'm trying to do so for the mainsite as well and am having some challenges. I think it's a matter of syntax which I'm not very good with at all so I'm reaching out for some help =).

In my header file I have:

chdir('./forums');
require_once('./global.php');
chdir('../');


The part that is killing me now is:

<if condition="!$bbuserinfo['field9']">
banner image code
</if>


So that users in my user group don't see the banner code. Now it works in my vBulletin but doesn't in the other files.. I think it has something to do with the way I'm using IF but if someone could suggest or point me in the right direction I'd be elated.

The rest of the code I'm using is located here (http://www.vbulletin.com/forum/archive/index.php/t-101597.html)

Cheers and thanks in advance.

Dismounted
12-11-2008, 03:20 AM
The "<if>" construct is one specified and used by the vBulletin template parser only. Try using traditional PHP conditionals in your custom file.

Also, $bbuserinfo is only used in templates - use $vbulletin->userinfo everywhere else.

MjrGaelic
12-11-2008, 06:25 AM
Thanks for the nudge in the right direction.. Unfortunatley, after a few rounds of battle I'm still not any further ahead =).

How would you translate:

<if condition="!$bbuserinfo['field9']">
banner image code
</if>


into a traditional php statement?

Alternately and to be more precise I'm looking for - if the user is a member of group id9 then display nothing.. otherwise display the banner code.

Dismounted
12-11-2008, 08:18 AM
if (!is_member_of($vbulletin->userinfo, 9))
{
// echo code here
}

MjrGaelic
12-11-2008, 01:18 PM
That did the trick thank you =0..

When the site is done I'll make sure you get a free premium account 4evar =) (it's a flash arcade)