PDA

View Full Version : How to exclude a usergroup from seeing the sidebar?


vorphalack
10-12-2004, 10:16 AM
I followed directions I found somewhere on here on how to make a sidebar on your forum pages. Works great, but I was just made aware last night that the Premium (paid subscription) members are seeing the Google ads :( I wanted the ads to be shown only to admins and non-paying visitors (registered or not), and to be able to upgrade their membership and get rid of the ads.

I know the ads are showing up because of the way the Premium membership is set up. I originally had it set up so that the main usergroup was changed from Registered to Premium, and read somewhere that you needed to add the Premium as a secondary usergroup so that when the subscription expires they go back to the original usergroup properly... So I went through and changed them all. The main usergroup for my Premium usergroup is Registered and that is why the ads are showing up. What can I change to make it so that the ads do not show up for these folks? I have checked and the module itself does not have a checkmark to allow the Premium members to view it, and if I change the permissions on the page (in the CMPS admin) you cannot view the entire page at all (which is a bad thing, I have it on the forumhome and removing permission to view the page means you get a no permission error instead of the forum list!)

I am guessing there might be some code I can add to the Google template saying if usergroup=8 to not display the template but I don't really know how to write it and not sure if that would override the CMPS permissions??

Brian
10-12-2004, 10:53 AM
If you have disabled that module for that usergroup then there shouldn't be any reason why they see it. If you'd like to submit a support ticket via the Member's Area here I'll be glad to take a look and see what the problem is.

Our Sponsors
 

vorphalack
10-12-2004, 11:11 AM
I know that they're seeing it because they're members of two usergroups, one that can see it and one that can't see it. I'll fill out a ticket anyway...

KW802
10-12-2004, 11:40 AM
I know that they're seeing it because they're members of two usergroups, one that can see it and one that can't see it. I'll fill out a ticket anyway...
Is their primary group the group that can or can't see it?

I believe that if you have the user in two groups that the primary group takes precedence over the secondary group. What the means is that if your primary group is "Registered Visitors" and you have a secondary group of "Premium Members" and if the first group can see ads but the second group isn't supposed to then people who belong to both groups with "Registered Visitors" as their primary will still see the ads.

Of course this might just be the caffiene speaking. :D

Our Sponsors
 

vorphalack
10-12-2004, 11:46 AM
Is their primary group the group that can or can't see it?

I believe that if you have the user in two groups that the primary group takes precedence over the secondary group. What the means is that if your primary group is "Registered Visitors" and you have a secondary group of "Premium Members" and if the first group can see ads but the second group isn't supposed to then people who belong to both groups with "Registered Visitors" as their primary will still see the ads.

Of course this might just be the caffiene speaking. :D

That's right :) Primary usergroup is Registered, which can see the ads, secondary is Premium which isn't supposed to see them :( I thought I had tested it out well enough, but maybe I had my test account set to Premium being the primary usergroup..

KW802
10-12-2004, 11:57 AM
That's right :) Primary usergroup is Registered, which can see the ads, secondary is Premium which isn't supposed to see them :( I thought I had tested it out well enough, but maybe I had my test account set to Premium being the primary usergroup..
The caffiene is kicking in.... I just read your original message again and went "D'oh! He already knew all that!" :p

For your Google module put this at the top of the module (the very first line before anything else)...<if condition="is_member_of($bbuserinfo, 8)">... and then at the very bottom of the template put </if>That will then prevent the module from appearing to anybody who belongs to usergroup #8 regardless of whether it's their primary or secondary group.

Brian or any of the other guys might be able to shed some light on it but I was under the general impression that as a rule-of-thumb the secondary groups act to give additional permissions to the members and not necessarily to take away permissions (in this case, the permission being to view the ads). That's why when the module is displayed the logic is more or less saying "OK, does this user belong to any groups that have permissions to view this module?" and if the answer is yes it'll display it.

But in the meantime that quick if... condition above will take care of it. :)

vorphalack
10-12-2004, 12:09 PM
Thanks, I added it (seems backwards but what do I know, I am far better with ASP than PHP, and then there's the whole vB thing to figure out....... lol)... Checked it with my Admin account, and the space for the module was there but no module... then checked with a test account i have with the Premium usergroup as a secondary with Registered as primary and the module showed up... :confused: I just checked with another test account, just Registered no Premium, and just like with my Admin account, there is the space for the module but no module :p

you can see this at http://www.nopuppymills.com/forum/index.php

I wanted to eventually add this to most of the pages on the site, giving the option to subscribe and not see the ads...

vorphalack
10-12-2004, 12:22 PM
I just added something that seems to work, but it's still leaving that big space on the side where the module goes...
<if condition="is_member_of($bbuserinfo, 8)">
<else />
...module...
</if>


Is the very very top of the index.php page a bad place to use the condition? I had to add this to the top in order to use the sidebar...
define('VBA_PORTAL', true);
define('VBA_PAGE', 'sidebarads');
and I'm wondering if you could wrap some condition around that so maybe it isn't a vba portal page for the Premium members?

KW802
10-12-2004, 12:27 PM
Thanks, I added it (seems backwards but what do I know, I am far better with ASP than PHP, and then there's the whole vB thing to figure out....... lol)... Checked it with my Admin account, and the space for the module was there but no module... then checked with a test account i have with the Premium usergroup as a secondary with Registered as primary and the module showed up... :confused: I just checked with another test account, just Registered no Premium, and just like with my Admin account, there is the space for the module but no module :p

you can see this at http://www.nopuppymills.com/forum/index.php

I wanted to eventually add this to most of the pages on the site, giving the option to subscribe and not see the ads...
Whoops! I missed an "not" exclamation point in there. Put an "!" in front of "is_member_of" so it looks like... <if condition="!is_member_of($bbuserinfo, 8)">Otherwise nobody will see it except the people in the premium group. :p If you don't have the admin' people in group #8 you can either add them so they don't see the module either or change the if condition to include group #6.

-peace-
11-11-2004, 02:41 PM
Can this work - to allow only a certain group to see a link in a navagation bar.

I added it twice so it will allow the admin to get access to it, admin usergroup is 6 and a custom group is 16

<if condition="$bbuserinfo['usergroupid'] == 16">
<TR $actionMenu""><TD class="row"><img src="/images/navbits_finallink.gif" BORDER=0><a href="http://hrc/reports/cld/login.php">Checklog</a></TD></TR>
</if>

<if condition="$bbuserinfo['usergroupid'] == 6">
<TR $actionMenu""><TD class="row"><img src="/images/navbits_finallink.gif" BORDER=0><a href="http://hrc/reports/cld/login.php">Checklog</a></TD></TR>
</if>


Is there any other better ways?


I noticed this wont work - but is there another way to do it?

<if condition="$bbuserinfo['usergroupid'] == 6,16">
<TR $actionMenu""><TD class="row"><img src="/images/navbits_finallink.gif" BORDER=0><a href="http://hrc/reports/cld/login.php">Checklog</a></TD></TR>
</if>

Brian
11-11-2004, 03:06 PM
<if condition="in_array($bbuserinfo['usergroupid'], array(6,16))">

-peace-
11-12-2004, 09:39 AM
Thank You - works great.