Tuesday, August 28, 2012

How to Show Ads Within the First Post in Mybb

If you want to show advertisement within the first post then there is very simple plugin postlite ad. It is little buggy which you can fix yourself: http://community.mybb.com/thread-125186-post-904769.html#pid904769.

Mind you, there does not seem to be any simpler way to do it. There is another but bit complicated way: http://community.mybb.com/thread-125188-post-904952.html#pid904952

A better idea to change this line 129 in the bottom:

$post['message'] = "<div style=\"float:right;\">{$ads}</div>{$post['message']}<div style=\"clear:both;\">";

to

$post['message'] = "<div style=\"float:left;margin: auto 1em 1em auto;\">{$ads}</div>{$post['message']}<br style=\"clear:both;\" />";

PHP 5.2/5.3 issue

This plugin is for PHP 5.2 but call by reference has changed in 5.3. So if your forum is using 5.3 then change the line 121:

function postad_start($post)

to

function postad_start(&$post)

That is just put one "&" before $post.

This issue is explained well in this thread.

No comments:

Post a Comment