Remove ads for some users?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Remove ads for some users?

Post by alecrust » Tue Nov 11, 2008 9:57 pm

Hi everyone,

I have been running a Honda Civic Forum for a while now, and I'm looking to monetize it more.

Currently I have one banner ad in the top header, but this pushes the search box down on a 1024px monitor, something I don't want. I don't want to change the size of the logo, I need the banner and my users need the search functionality.

So what I'm proposing to do is relocate the banner to a separate DIV below the header. This makes the banner far more obvious. I'd then like to place a small link above it saying "Donate to remove all adverts".

I'm sure you can see where I'm headed with this. I'd like to basically be able to prevent a DIV from showing for users I specify.

Can I have some suggestions on the best way to achieve this?

Many thanks!

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50895
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Remove ads for some users?

Post by stevemaury » Tue Nov 11, 2008 10:24 pm

Add the paid users to a separate group that has the same permissions as Registered users and make it their default group. Then you can use:

Code: Select all

<!-- IF GROUP_ID !=N --> ad code <!-- ENDIF -->
N= the group id of the paid users group.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Tue Nov 11, 2008 10:40 pm

Perfect! Thanks so much Steve.

One last thing. I'd also like it to not display for Administrators and Moderators. How can I add other groups to that if statement?

Thanks

blakebowling
Registered User
Posts: 775
Joined: Sun Apr 27, 2008 4:49 am
Location: 127.0.0.1

Re: Remove ads for some users?

Post by blakebowling » Tue Nov 11, 2008 10:42 pm

just add administrators and moderators to that group

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Tue Nov 11, 2008 10:55 pm

Thanks blakebowling. Good idea but I'd prefer just to add it to the IF statement.

It doesn't seem to be working actually. The group ID for "Paid users" is 7. This is what I have:

Code: Select all

<!-- IF GROUP_ID !=7 -->
ad code here
<!-- ENDIF -->
Which doesn't seem to do anything. What I really need is an if statement that shows the DIV to all but:
- 4 (Global moderators)
- 5 (Administrators)
- 7 (Paid users)

Hope that makes sense! Thanks.

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50895
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Remove ads for some users?

Post by stevemaury » Tue Nov 11, 2008 11:42 pm

ACtually, != might be not eq. Or try IF not GROUP_ID = N. I am on a different computer so I don't have my cheat sheet in front of me, or my test board. Also, remember that you have to make the group the users DEFAULT group. AND you have to refresh the template in the ACP Styles tab.

You kinda changed the question on me. But you should be able to make 3 switches and nest them. Get it working with one first.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Wed Nov 12, 2008 12:09 am

Hi Steve,

Unfortunately <!-- IF not GROUP_ID =7 --> seemed to hide it for everyone!

Ah yes good idea I'll just nest all my group conditions separately.

If you could update this topic when you know the IF statement that would be great!

Thanks again

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Wed Nov 12, 2008 10:32 am

Are you sure this IF statement is even possible? I can't find anything related to it anywhere...

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Mon Nov 17, 2008 6:49 pm

Can anybody help with this?

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50895
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Remove ads for some users?

Post by stevemaury » Mon Nov 17, 2008 7:25 pm

Sorry, I forgot that I had made a code change to create the switch.



Open includes/functions.php

FIND

Code: Select all

		'SITE_LOGO_IMG'			=> $user->img('site_logo'))
	);
AFTER ADD

Code: Select all

    if ( !function_exists('group_memberships') )
    {
        include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
    }
    $groups = group_memberships(false,$user->data['user_id']);
    foreach ($groups as $grouprec)
    {
        $template->assign_vars(array(
        'S_GROUP_' . $grouprec['group_id'] => true
        ));
    }
then use the switch like so

Code: Select all

<!-- IF not S_GROUP_2 -->ad code here<!-- ENDIF -->
(Thanks to RMcGirr83 for this code).
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Mon Nov 17, 2008 8:18 pm

Perfect!

That worked brilliantly thanks:

Code: Select all

<!-- IF not S_GROUP_7 -->
  <!-- IF not S_GROUP_5 -->
    <!-- IF not S_GROUP_4 -->
      ad code
    <!-- ENDIF -->
  <!-- ENDIF -->
<!-- ENDIF -->

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Remove ads for some users?

Post by RMcGirr83 » Mon Nov 17, 2008 9:14 pm

You may even be able to get away with this

Code: Select all

<!-- IF not S_GROUP_7 or not S_GROUP_5 or not S_GROUP_4 -->
      ad code
    <!-- ENDIF -->
 
That may and may not work...haven't tried it.

Thanks for the "Thanks" Steve! :)
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Mon Nov 17, 2008 9:23 pm

Unfortunately that didn't work :(

No matter, the first solution was fine.

Thanks for your help everyone!

maclanes
Registered User
Posts: 37
Joined: Thu Mar 09, 2006 2:53 am

Re: Remove ads for some users?

Post by maclanes » Sat Feb 14, 2009 7:06 pm

RMcGirr83 wrote:You may even be able to get away with this

Code: Select all

<!-- IF not S_GROUP_7 or not S_GROUP_5 or not S_GROUP_4 -->
      ad code
    <!-- ENDIF -->
 
That may and may not work...haven't tried it.

Thanks for the "Thanks" Steve! :)
PHPBB uses "and" logic. This WILL work. ;)

Code: Select all

<!-- IF not S_GROUP_7 and not S_GROUP_5 and not S_GROUP_4 -->
      ad code
<!-- ENDIF -->

User avatar
alecrust
Registered User
Posts: 348
Joined: Thu Mar 27, 2008 11:24 am
Location: London, UK
Contact:

Re: Remove ads for some users?

Post by alecrust » Sat Feb 14, 2009 7:25 pm

Is there any speed improvement or other reason why I should have it all in one?

Thanks for the tip :)

Locked

Return to “[3.0.x] Support Forum”