Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

MyBB monetize Portal and ForumDisplay threadslist with Adsense ads plugin!

Ads
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#1
Support Team
Hello ladies it's been a while since the last time I posted a tutorial on MYBB open source forum script/software.

Now this time I will teach you how to add Adsense or any type of advertising ads to portal and forumdisplay threadslist template specifically the ads will be showing after the first thread/announcement or after some X amount of them it's totally up to you.

To achieve that we will need a plugin that I will include in here and you would also need to have a plugin called "template conditionals" already installed!

Now it's very important for the website start to generate some income as this will make it better because the more money the webmaster makes the more of it will be invested into the development of new tools and features which would make the site better and better it's not all about getting rich is about making it better!

So lets get started!

Here is the plugin simply copy the code into your PHP editor and then save it as monetization.php then upload it to ./inc/plugins directory then activate it from MYBB admin panel.

PHP Code:
<?php

if(!defined("IN_MYBB"))
{
    die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("portal_announcement""monetization");
$plugins->add_hook("forumdisplay_thread""monetization");

function 
monetization_info()
{    
    return array(
                
"name" => "Adsense in portal and forumdisplay threadlist",
                
"description" => "Shows adsense ads after x posts needs template conditional",
                
"website" => "http://letsforum.com",
                
"author" => "Letsforum",
                
"authorsite" => "http://letsforum.com",
                
"version" => "1.0",
                
"compatibility" => "16*"
            
);
}

function 
monetization()
{
if (!isset(
$monetizationcounter)) {
    
$monetizationcounter 0;
}
$monetizationcounter++;
}
?>

Now here is where the magic will happen!

We would need to use these template conditionals in our templates!

For portal_announcement:
PHP Code:
<if ($monetizationcounter Xthen><else>
    
ad code
</if> 

For forumdisplay_thread:
PHP Code:
<if ($monetizationcounter X) % $mybb->settings['threadsperpage'] == "0" then>
    
ad code
</if> 

Replace the X with the value that will represent the number of posts after which the code will show.

Have fun and don't forget to share and love me Smile





User(s) browsing this thread: 1 Guest(s)