MyBB Community Forums

Full Version: Forum Stats Signature Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey everyone!

I'm not sure if this is the right board to post this on, but does anyone know where I could get a copy of this plugin, or a plugin like it for free?

http://community.mybb.com/thread-66422.html
I use something similar, can't remember where from, it's not identical but it might be of help

Make a file, example MyBBSig.php file in your forum root

<?php


define("IN_MYBB", 1);
define("KILL_GLOBALS", 1);
define("NO_ONLINE", 1);

require "./inc/init.php";

 $stats = $cache->read("stats");

Header ("Content-type: image/png");
$img_handle = imageCreateFromPNG("./images/signature.png");
$imgcolor = ImageColorAllocate ($img_handle, 153, 153, 153);
$imgcolorhead = ImageColorAllocate ($img_handle, 255, 255, 255);
ImageString ($img_handle, 3, 5, 2,  $mybb->settings['homename']." - ". $mybb->settings['homeurl'], $imgcolorhead);
ImageString ($img_handle, 2, 5, 15,  "Total Members: ". my_number_format($stats['numusers']), $imgcolor);
ImageString ($img_handle, 2, 171, 15,  "Total Posts: ". my_number_format($stats['numposts']), $imgcolor);
ImageString ($img_handle, 2, 327, 15,  "Total Threads: ". my_number_format($stats['numthreads']), $imgcolor);
ImagePng ($img_handle);
ImageDestroy ($img_handle);

?>

Now
$img_handle = imageCreateFromPNG("./images/signature.png");
you need an image at /images/signature.png (rename to whatever/wherever you want) that is 468x31px
I have attached a blank green template

When you want to embed it somewhere, you will embed the php file just like an image, example

[img]http://www.yourforum.org/MyBBSig.php[/img]

and it will display.



If you want to change the text color you can by editing the RGB color codes in this lines

$imgcolor = ImageColorAllocate ($img_handle, 153, 153, 153);
$imgcolorhead = ImageColorAllocate ($img_handle, 255, 255, 255);

you can kinda see what goes where, etc etc, adding multiple colors is simple
example, if you want Total Members to display in pink, find
$imgcolor = ImageColorAllocate ($img_handle, 153, 153, 153);
and add this under
$imgcolor2 = ImageColorAllocate ($img_handle,  255, 192, 203);
and change the following line
ImageString ($img_handle, 2, 5, 15,  "Total Members: ". my_number_format($stats['numusers']), $imgcolor);
to
ImageString ($img_handle, 2, 5, 15,  "Total Members: ". my_number_format($stats['numusers']), $imgcolor2);

blah blah you get my drift regarding editing.
http://community.mybb.com/thread-52673.html might still work, though I did make it 5 years ago. xD
Thanks p00lz! I'll try that out. Thanks for explaining how to make changes!

Eric, I found yours previously, and it didn't work quite right for what I was trying to do. Thanks though!