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.

Wednesday, June 27, 2012

How to Add Facebook Like, Twitter and Google plus icons in Mybb Forum

This is how my forum header looks after adding those links:


If you want to do the same way here are the steps to do it. Mind you mine is Mybb 1.6.3.
First grab the code from Addthis.com site. I've logged in and taken the code as in here:

Add caption



Now here is code which displays: "Follow us on: Facebook icon/Twitter Icon:

<div>Follow us on: <a href="http://www.facebook.com/IndianWorkingWomen"><img src="http://www.utilitiesindia.com/sites/default/files/img/facebook_22.png" width="22" height="22" alt="Facebook" title="Connect to us on Facebook" style="vertical-align:middle" /></a><a href="https://twitter.com/#!/IndWorkingWomen"><img src="http://www.utilitiesindia.com/sites/default/files/img/twitter_22.png" width="22" height="22" alt="Twitter" title="Connect to us on Twitter" style="vertical-align:middle" /></a></div>


Take care to replace your own Facebook and Twitter links in the above html cod.

Go to Templates & Style -> Templates -> Default Templates ->Header Templates->header and just over <div class="menu> insert the above two codes:
<!-- AddThis Button BEGIN -->

<div class="addthis_toolbox addthis_default_style ">

<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>

<a class="addthis_button_tweet"></a>

<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>

<a class="addthis_counter addthis_pill_style"></a>

</div>

<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4ed5fa1d3aa24279"></script>

<!-- AddThis Button END -->


Now save the template and check your forum.

If you've any better idea or suggestions - don't forget leave them here in comments below.


The full code within "header" looks like this:

<div id="container">
  <a name="top" id="top"></a>
  <div id="header">
   <div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" />  <span id="logotext"> {$mybb->settings['bbname']} </span>     </a></div>
<div style="float:right;margin-top:-55px;margin-right:5px;">Follow us on:  <a href="http://www.facebook.com/pages/India-Consumer-Complaints-Forum/434058009961898"><img src="http://www.utilitiesindia.com/sites/default/files/img/facebook_22.png" width="22" height="22" alt="Facebook" title="Connect to us on Facebook"  style="vertical-align:middle" /></a><a href="https://twitter.com/#!/ConsumerForumIn"><img src="http://www.utilitiesindia.com/sites/default/files/img/twitter_22.png" width="22" height="22" alt="Twitter" title="Connect to us on Twitter" style="vertical-align:middle"  /></a></div>                       
 <div style="float:right;margin-top:-30px;margin-right:5px;">

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4ed5fa1d3aa24279"></script>
<!-- AddThis Button END -->

                        </div>
   <div class="menu">
    <ul>
                                        <li><a href="{$mybb->settings['homeurl']}"><img src="{$theme['imgdir']}/toplinks/home.gif" alt="" title="Go to site Home page" />Home</a></li>

     <li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="" />{$lang->toplinks_search}</a></li>
     <li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>
     <li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$theme['imgdir']}/toplinks/calendar.gif" alt="" title="" />{$lang->toplinks_calendar}</a></li>
                                        <li><a href="{$mybb->settings['bburl']}/misc.php?page=forumrules"><img src="{$theme['imgdir']}/toplinks/forumrules.jpg" alt="" title="Click to read this forum's usage rules" />Forum Rules</a></li>
        <li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><img src="{$theme['imgdir']}/toplinks/help.gif" alt="" title="" />{$lang->toplinks_help}</a></li>
    </ul>
   </div>
   <hr class="hidden" />
   <div id="panel">
    {$welcomeblock}
   </div>
  </div>
  <hr class="hidden" />
  <br class="clear" />
  <div id="content">
   {$pm_notice}
   {$bannedwarning}
   {$bbclosedwarning}
   {$unreadreports}
   {$pending_joinrequests}
   <navigation>
   <br />