Re: punbb adsense advertisement mod?

In the if statement

if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1')

Make it

if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && $pun_user['g_id'] != 'num')

where num is the group you want to hide it from

Re: punbb adsense advertisement mod?

Thanks, works great!

28

Re: punbb adsense advertisement mod?

I'm trying to make it so admins (1), mods (2), and contributors (5) not see it, i'm getting a php error when adding multiple groups, whats the code to add 1, 2, and 5 to it?

if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && $pun_user['g_id'] != '1')

Re: punbb adsense advertisement mod?

Mmm, I'm tempted to add functionality to do this in the future (it will be much easier to do, just check the groups on the plugin screen).
The correct code:

if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && $pun_user['g_id'] > '2' && $pun_user['g_id'] != '5')

30

Re: punbb adsense advertisement mod?

thanks! smile

31 (edited by af3 2005-06-17 06:37)

Re: punbb adsense advertisement mod?

I used the following to hide Ads from certain forum, in this case forum_id=11.

    if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && $cur_topic['forum_id'] != '11') {

Now, how do I hide the ads from a certain category or more  forums?

TQ + regards

32

Re: punbb adsense advertisement mod?

almost_there wrote:

How can I fix this so a certain user group won't see the ads?

If you want only guests to see

if ($pun_user['is_guest']) {
What ever needs to be showed to users, echo it here.
}

If you want all users to see the ads, but not you add:

if ($pun_user['username'] !="YourUseRNaMe") {
What ever needs to be showed to users, echo it here.
}

Re: punbb adsense advertisement mod?

af3 wrote:

I used the following to hide Ads from certain forum, in this case forum_id=11.

    if ($post_count == '1' && $adsense_config['google_adsense_enabled'] == '1' && $cur_topic['forum_id'] != '11') {

Now, how do I hide the ads from a certain category or more  forums?

TQ + regards

Just add more forum ids to the if statement wink

ie: $cur_topic['forum_id'] != '11' && $cur_topic['forum_id'] != '12' && $cur_topic['forum_id'] != '13'
etc

34

Re: punbb adsense advertisement mod?

how abt category hide?

Re: punbb adsense advertisement mod?

You would need to add category to the SQL first wink

So
FIND

if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

REPLACE WITH

if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, f.cat_id, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, f.cat_id, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

Then just use $cur_topic['cat_id']

36

Re: punbb adsense advertisement mod?

;-) tq smart

37

Re: punbb adsense advertisement mod?

Does this plugin place an ad as the second post on only the first page of posts or as the second post on ALL successive pages as well?

If not, can this be done?

Even better, how bout the 'ad post' appearing every 10th posting?

Re: punbb adsense advertisement mod?

masey wrote:

Does this plugin place an ad as the second post on only the first page of posts or as the second post on ALL successive pages as well?

It's on all the pages...
See?!

http://forum.photics.com/viewtopic.php?id=652

Michael Garofalo
Webmaster - Photics.com

Re: punbb adsense advertisement mod?

You can change it if you want to make it appear every 10 posts: however, keep in mind that you're allowed a max of 3 ad blocks per page: someone with, say, 40 posts per page (if that's possible) would have 4.

40

Re: punbb adsense advertisement mod?

Ok, that's not a problem as I'll only have 20-25 posts per page... but how do I change the ad frequency then?

41

Re: punbb adsense advertisement mod?

Hi all ...

Did anyone put this up on their forum yet? I'd like to see what it looks like. Seems like a great idea.

I clicked the above link, but evidently it was already removed. sad

thanks

42

Re: punbb adsense advertisement mod?

look at post #38. that has a link that works. and the mod is the third post down.

Re: punbb adsense advertisement mod?

Gizzmo wrote:

look at post #38. that has a link that works. and the mod is the third post down.

Hey... that's my post! big_smile
...and that's my site! big_smile

Go me! lol

Michael Garofalo
Webmaster - Photics.com

Re: punbb adsense advertisement mod?

i am now tired of PunBB, There is not support available for PunBB 1.34 (current till the date of this post)
Will anyone help me  mad