MyBB Community Forums

Full Version: Forum Age
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Namaless Wrote:question: but is not simple to create a plugin for this modification? O_o

all credit to DrPoodle but i converted it to a plugin to save modifying any files.

NOT TESTED.

<?php
//DrPoodle/Goughy000 -> forumageplugin.php

$plugins->add_hook("global_end","forumageplugin_makevar");


function forumageplugin_info(){    
return array(
        "name"        => "DrPoodle's Forum Age",
        "description"   => "Makes a variable containing the forum age for use in your plugin",
        "website"    => "http://www.drpoodle.com/",
        "author"     => "DrPoodle/Goughy000",
        "authorsite"    => "http://www.byteforums.com/",
        "version"     => "1.0"
      );
}

global $forumage;

function forumageplugin_makevar(){
   global $forumage;

   $age_query = $db->query("SELECT regdate FROM ".TABLE_PREFIX."users ORDER BY regdate LIMIT 1");
   $age_result = $db->fetch_array($age_query);
   $age = time() - $age_result['regdate'];
   $forumage = nice_time($age);
}

?>
goughy000 Wrote:
Namaless Wrote:question: but is not simple to create a plugin for this modification? O_o

all credit to DrPoodle but i converted it to a plugin to save modifying any files.

NOT TESTED.

<?php
//DrPoodle/Goughy000 -> forumageplugin.php

$plugins->add_hook("global_end","forumageplugin_makevar");


function forumageplugin_info(){    
return array(
        "name"        => "DrPoodle's Forum Age",
        "description"   => "Makes a variable containing the forum age for use in your plugin",
        "website"    => "http://www.drpoodle.com/",
        "author"     => "DrPoodle/Goughy000",
        "authorsite"    => "http://www.byteforums.com/",
        "version"     => "1.0"
      );
}

global $forumage;

function forumageplugin_makevar(){
   global $forumage;

   $age_query = $db->query("SELECT regdate FROM ".TABLE_PREFIX."users ORDER BY regdate LIMIT 1");
   $age_result = $db->fetch_array($age_query);
   $age = time() - $age_result['regdate'];
   $forumage = nice_time($age);
}

?>

Maybe you should have tested it..

i get this error
Fatal error: Call to a member function query() on a non-object in C:\Program Files\Abyss Web Server\htdocs\bb\inc\plugins\forumageplugin.php on line 23
jibbajabba Wrote:
goughy000 Wrote:
Namaless Wrote:question: but is not simple to create a plugin for this modification? O_o

all credit to DrPoodle but i converted it to a plugin to save modifying any files.

NOT TESTED.

<?php
//DrPoodle/Goughy000 -> forumageplugin.php

$plugins->add_hook("global_end","forumageplugin_makevar");


function forumageplugin_info(){    
return array(
        "name"        => "DrPoodle's Forum Age (Plugin by Goughy000)",
        "description"   => "Makes a variable containing the forum age for use in your plugin",
        "website"    => "http://www.drpoodle.com/",
        "author"     => "DrPoodle/Goughy000",
        "authorsite"    => "http://www.byteforums.com/",
        "version"     => "1.0"
      );
}

global $forumage;

function forumageplugin_makevar(){
   global $forumage;

   $age_query = $db->query("SELECT regdate FROM ".TABLE_PREFIX."users ORDER BY regdate LIMIT 1");
   $age_result = $db->fetch_array($age_query);
   $age = time() - $age_result['regdate'];
   $forumage = nice_time($age);
}

?>

Maybe you should have tested it..

i get this error
Fatal error: Call to a member function query() on a non-object in C:\Program Files\Abyss Web Server\htdocs\bb\inc\plugins\forumageplugin.php on line 23

haha oops. i missed a global out, here you go:
<?php
//DrPoodle/Goughy000 -> forumageplugin.php

$plugins->add_hook("global_end","forumageplugin_makevar");


function forumageplugin_info(){    
return array(
        "name"        => "DrPoodle's Forum Age",
        "description"   => "Makes a variable containing the forum age for use in your plugin",
        "website"    => "http://www.drpoodle.com/",
        "author"     => "DrPoodle/Goughy000",
        "authorsite"    => "http://www.byteforums.com/",
        "version"     => "1.0"
      );
}

global $forumage;

function forumageplugin_makevar(){
   global $forumage;
   global $db;

   $age_query = $db->query("SELECT regdate FROM ".TABLE_PREFIX."users ORDER BY regdate LIMIT 1");
   $age_result = $db->fetch_array($age_query);
   $age = time() - $age_result['regdate'];
   $forumage = nice_time($age);
}

?>
let me try that,

i will use that.

useful
now available at the mods site.
http://mods.mybboard.net/view/forum-age
at my forum not showed the forum age Sad
what's wrong in my template ?

upload edited global.php
upload forumage's plugin
activated plugin at admincp

and so...? what again ?

anybody help me ?
benks Wrote:at my forum not showed the forum age Sad
what's wrong in my template ?

upload edited global.php
upload forumage's plugin
activated plugin at admincp

and so...? what again ?

anybody help me ?

if you are using the plugin do NOT edit global.php

once activated, you need to add {$forumage} to your template where you want the age to show
forumage problem

Removed script at global.php about forumage and
new install forumage plugin
add {$forumage} at footer template

but, forumage NOT showed too....what its problem ?

this footer.php at my template
<br />
<br />
<div align="center">{$lang->welcome_current_time}</div>		
<br />
			</div>
			<div align="right" class="bottommenu"><span class="smalltext"><a href="{$mybb->settings['contactlink']}">{$lang->bottomlinks_contactus}</a> {$admincplink} - <a href="{$mybb->settings['homeurl']}">{$mybb->settings['homename']}</a> - <a href="<archive_url>">{$lang->bottomlinks_litemode}</a> - <a href="{$mybb->settings['bburl']}/misc.php?action=syndication">{$lang->bottomlinks_syndication}</a> - <a href="#top">{$lang->bottomlinks_returntop}</a></span>
			</div>
			</div>
		<hr class="hidden" />
			<div id="copyright">
				<div id="debug"><debugstuff></div>
				<!-- You may NOT remove, modify or hinder the visibility of the MyBB copyright at any time.
				     It must contain the links to the MyBB website and be formatted appropriately.

					 Failure to comply with the above will result in prosecution to the full extent of the law.
					 This is free software, support us and we'll support you. -->
{$lang->powered_by} <a href="http://www.mybboard.com" target="_blank">MyBB</a> {$mybbversion}<br />
				{$lang->copyright} © 2002-{$copy_year} <a href="http://www.mybboard.com" target="_blank">MyBB Group</a><br />
				Designed by <a href="http://www.patrickjung.info/mybbdesign/" target="_blank">MyBBDesign.com</a><br /><b> Modify themes by: <a href="http://bravoes.com/member.php?action=profile&uid=7" target="_blank">root@Bravoes</a> Team</b>
				<!-- End copyright -->
				<br />
<a href="http://bravoes.com/generalrules.html" target="General Rulez"><b>General Rulez</b></a>

		<br class="clear" /></div><center><SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/c?url=www.bravoes.com%2F'></SCRIPT></center>
<center><a href="http://www.mybbtopsite.net/"><img src="http://www.mybbtopsite.net/button.php?u=benks" alt="MyBB Topsite" border="0" /></a></center>
</div>
<div align="center">{$forumage}</div>
Thank you. That's very good. I'll use it on my some site.
Problem solved !!!
Thanks Big Grin
Pages: 1 2 3 4