MyBB Community Forums

Full Version: Ads after post plugin on 1.4
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Try this. Make sure you logout and I would try deleting cookies just to make sure.

Find
// Ads after first post
        if ($mybb->settings['adsafp_mode'] == "1") {
            if (($postcounter - 1) % $mybb->settings['postsperpage'] == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        }

        // Ads after first post and then every x posts
        if ($mybb->settings['adsafp_mode'] == "2") {
            if ($postcounter == "1" || ($postcounter - 1) % ($mybb->settings['adsafp_afterxposts']) == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        }
    
        // Ads after every x posts
        if ($mybb->settings['adsafp_mode'] == "3") {
            if ($postcounter % ($mybb->settings['adsafp_afterxposts']) == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        } 


Replace with

if($mybb->user['usergroup'] == "1")
{

// Ads after first post
        if ($mybb->settings['adsafp_mode'] == "1") {
            if (($postcounter - 1) % $mybb->settings['postsperpage'] == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        }

        // Ads after first post and then every x posts
        if ($mybb->settings['adsafp_mode'] == "2") {
            if ($postcounter == "1" || ($postcounter - 1) % ($mybb->settings['adsafp_afterxposts']) == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        }
    
        // Ads after every x posts
        if ($mybb->settings['adsafp_mode'] == "3") {
            if ($postcounter % ($mybb->settings['adsafp_afterxposts']) == "0") {
                $post['adsaf'] = "<div style=\"text-align:".$ads_align.";\">".stripslashes($mybb->settings['adsafp_code'])."</div>";
            }
        }
}
else
{
$post['adsaf'] = "";

}

Make sure you have it enabled in admin cp.

Board settings->Ads after...->Activate/Deactivate

Set to Yes
Still no luck. Looks like it should work. Has anyone else got this working?
I should have tested first.. the original code is not working on my site so there is little hope of getting the hack to work
Replace
if(!$mybb->user['uid'])
with
if($mybb->user['uid'] != "0")

@HARRY256: Make sure the plugin inserted the variable {$post['adsaf']} at the end of the templates postbit and postbit_classic.
Why do you put "" around an integer ?
Just adding this piece under the global vars should work; but even overhere they don't show up =P Although if you echo $post['adsaf'] they appear.
if(!$mybb->user['uid']) 
{
return;
}
(2008-08-10, 11:38 AM)Michael83 Wrote: [ -> ]Replace
if(!$mybb->user['uid'])
with
if($mybb->user['uid'] != "0")

@HARRY256: Make sure the plugin inserted the variable {$post['adsaf']} at the end of the templates postbit and postbit_classic.

OK works for non members if I replace the 0 with a 1 in your code.

What I was not doing was putting the extra line of code in postbit.

Resolved and working at www.ukdivers.com
As requested several times the new version 2.2 which is waiting for validation atm has the functionality to show ads for certain usergroups only.
i just downloaded 2.2 version of the plugin, but the ads are still not showing up.

could someone please tell me what code i need to add to which template?

Thanks!
I don't remember having to make any manual template edits. Make sure you turn off any adblockers Wink.
i dont have any Sad
and if i put an adsense add, lets say in the footer, it shows just fine Sad
Insert the variable {$post['adsaf']} at the end of the templates postbit and postbit_classic if it does not exist.
Pages: 1 2 3