Board Statistics Issue..

Black Angel

Resident
Joined
Sep 3, 2007
Messages
713
Reaction score
8
FP$
1,634
Hi, I was following along with this post regarding how to add an icon to the board stats, and although I've managed to get it working for every other area, I can't seem to make it work with the Forum Age plugin area of the board stats.

Is there any way to make this work with the Forum Age plugin?

Everything I've tried results in this..

MIfCrjk.png


For example, this was what the template area for that plugin looked like before.

yDEXUOm.png


And this is what it looked like after I tried to add the code to it..

CFUF8zr.png


And this was the result..

MIfCrjk.png


Nothing I've tried since then has worked, and it seems like it would be simple enough to do, but I can't seem to get it working.

Is there any way to make this happen?

Thanks in advance for the help.
 
Uhm, have you simply tried adding an image to it?

Instead of the text:
Code:
<span class="smalltext">Text or image here.</span>

. . . you could put an image tag like this:

Code:
<img src="your-image-url" alt="Age Image" />
 
Hi, thanks for responding, I havent added the images yet, thats why the text is still there, my problem is that I want the forum age info, to be in the larger, blank cell, so that I can add an icon next to it, like I plan to do with the others.

But as you can see, despite the code in that template, the forum age info remains scrunched in the smaller cell.

But I will try that and see how it goes.
 
Oh, I see now. Well, your code is correct to add the image like you want.

Did you "rebuild theme cache" after making the changes?
 
Try this:

Admin CP -> Tools & Maintenance -> Cache Manager -> (Rebuild & Reload All)

If that doesn't fix it, I'll need a link to your forum to see what html is being printed to the browser to ensure it's proper.
 
Thanks, I'll try this, in the meantime you can access my forum by going to the old one in my sig.. the link is at the bottom of the notice.

I hadn't updated my sig yet here..
 
Your {$fa_final} is being written but it already has the html table code as part of it:

Code:
<!-- start: fa_template -->
<tr>
<td class="tcat" colspan="2"><span class="smalltext"><strong>Forum Age</strong></span></td>
</tr>
<tr>
<td class="trow2" width="10%"><span class="smalltext">Text or image here.</span></td>
 <td class="trow1" width="90%"><span class="smalltext"><tr>
                        <td class="trow1">
                        <span class="smalltext">
                                Board started on <b>01-12-2008</b> and existed for 7 years, 0 months, 7 days, 23 hours and 45 minutes. 
                        </span>
                        </td>
                      </tr></span></td>
</tr>
<!-- end: fa_template -->

Notice the extra code:

Code:
 <td class="trow1" width="90%"><span class="smalltext"> STARTS HERE<tr>
                        <td class="trow1">
                        <span class="smalltext">
                                Board started on <b>01-12-2008</b> and existed for 7 years, 0 months, 7 days, 23 hours and 45 minutes. 
                        </span>
                        </td>
                      </tr></span> ENDS HERE</td>

Notice the <tr><td class="trow1"><span class="smalltext">INFO</span></td></tr> being written in the middle of your <span> tag?

Your going to have to find out where that bit of code is being written to populate the {$fa_final} variable and edit it to remove the td, tr and span for your code to work properly. It will be part of the plugin coding you are using.

Easy enough to fix 🙂
 
Yeah I put the html code there to try and set it up like the other cells, but it didnt work, originally, it was empty except for the {fa_final} part..

I removed the extra coding so that you could see what I mean..
 
I understand you, but you aren't understanding me.

The plugin is evidently adding html to the variable {$fa_final}.

In the plugin code itself, when it writes the "Board started on 01-12-2008 and existed for 7 years, 0 months, 8 days, 0 hours and 2 minutes." part, it's adding the html coding as well. So when you put the variable {$fa_final}, it's not just text being written to the users browser, it's also writing the html WITH the text.

You'll need to go into the plugin file and find where it's writing the extra html code and remove it for it be displayed properly.
 
Ah, I gotcha.. here is the entirety of the "forumage.php" on my forum.. I wouldn't know where to make the edit..

Code:
<?php
/*
    @author     : Surdeanu Mihai ;
    @date       : 20 august 2010 ;
    @version    : 1.0 ;
    @mybb       : compatibility with MyBB 1.4.x and with MyBB 1.6.x;
    @description: This plugin show the forum age on index page (on footer page)!
    @homepage   : http://homesoftcenter.com/forum ! Please visit us now!
    @copyright  : GPL License. All rights reserved. 
*/
//Test myBB
if(!defined("IN_MYBB"))
{
    die("Acest fisier nu poate fi accesat direct.");
}
//Our hook
$plugins->add_hook("index_start", "forumage_start");
//Plugin information
function forumage_info()
{
    return array(
        "name"				=> "Forum Age by HSC Community",
        "description"		=> "Show your forum age.",
        "website"			=> "http://www.homesoftcenter.com/forum",
        "author"			=> "Mihu",
        "authorsite"		=> "mailto:[email protected]",
        "version"			=> "1.0",
		"guid"				=> "b6ad0bfae46d194b803e5c5389c7ebf1",
		'compatibility'     => '14*,16*',
                );
}
//Activate plugin
function forumage_activate()
{
	global $db;
	$grup_de_setari = array(
		"gid"               => NULL,
		"name"              => "fa_hsc",
		"title"             => "Forum Age",
		"description"       => "What is your forum age?",
		"disporder"         => "35",
		"isdefault"         => "no"
                           );
	$db->insert_query("settinggroups", $grup_de_setari);
	$gid = $db->insert_id();
    $setare_1 = array(
        "sid"               => NULL,
        "name"              => "fa_enabled",
        "title"             => "Is enabled?",
        "description"       => "Can this plugin do his job?",
        "optionscode"       => "yesno",
        "value"             => "no",
        "disporder"         => "1",
        "gid"               => intval($gid)
                     );
    $setare_2 = array(
        "sid"               => NULL,
        "name"              => "fa_mode",
        "title"             => "What is your mode?",
        "description"       => "Please specify your custom mode! (if you have a theme without icons on Who`s Online then you must select Simple Mode, else you have to select Advanced Mode)",
        "optionscode"       => "select\n0=Simple Mode\n1=Advanced Mode",
        "value"             => "0",
        "disporder"         => "2",
        "gid"               => intval($gid)
                     );
    $setare_3 = array(
        "sid"               => NULL,
        "name"              => "fa_list",
        "title"             => "Display list:",
        "description"       => "Please select your display list!",
        "optionscode"       => "select\n0=Years,Months,Days\n1=Years,Months,Days,Hours\n2=Years,Months,Days,Hours,Minutes",
        "value"             => "0",
        "disporder"         => "3",
        "gid"               => intval($gid)
                     );
	$db->insert_query("settings", $setare_1); 
    $db->insert_query("settings", $setare_2);  
    $db->insert_query("settings", $setare_3);  
    rebuild_settings(); 
    $sablon = array(
		"tid"		=> NULL,
		"title"		=> "fa_template",
		"template"	=> "{\$fa_final}",
		"sid"		=> "-1"
	                 );
	$db->insert_query("templates", $sablon);
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("index_boardstats", '#{\$forumstats}#', "{\$forumstats}\n{\$faforumage}");
}
//Deactivate plugin
function forumage_deactivate()
{
	global $db;
    $db->delete_query('settings', 'name IN("fa_enabled","fa_mode","fa_list")');
    $db->delete_query('settinggroups', 'name = "fa_hsc"');
    rebuild_settings();
    $db->delete_query('templates', 'title = "fa_template"');  
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("index_boardstats", '#(\n?){\$faforumage}#', '', 0);
}
//Aditional functions
function forumage_get($diferenta)
{
    $ani = floor($diferenta / (365*60*60*24));
    $luni = floor(($diferenta - $ani * 365*60*60*24) / (30*60*60*24));
    $zile = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24)/ (60*60*24));
    $ore = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24)/ (60*60)); 
    $minute = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24 - $ore*60*60)/ 60);  
    return "".$ani."|".$luni."|".$zile."|".$ore."|".$minute."";
}
function forumage_parse($ani,$luni,$zile,$ore,$minute,$timp)
{
    global $lang,$mybb;
    $lang->load("forumage");  
    $v = ",";
    $a = $lang->fa_and;
    if (($ani == "0")&&($luni == "0"))
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."."; 
        break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
        break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
        break;
        }
    else
    {
    if ($ani == "0")
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days."."; 
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }
    else
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days.".";
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }   
    }
}
//Functia de initializare
function forumage_start()
{
    //Variabile globale
    global $db, $mybb, $faforumage, $templates;
    //Variabile de lucru
    $final = "";
    if ($mybb->settings['fa_enabled'] == 1)  
    {
        //Se realizeaza interogarea
        $interogare = $db->simple_select("users","regdate","",array("order_by"=>'uid',"limit"=>1));
        //Se intoarce din baza de date primul user inregistrat pe forum (admin)
        $user = $db->fetch_array($interogare);
        $data_inregistrarii = $user['regdate'];
        $data_acum = time();
        //Diferenta de timp este = ...
        $diferenta = $data_acum - $data_inregistrarii;
        $rezultat = explode('|',forumage_get($diferenta)); 
        //Se parseaza datele obtinute si se formeaza string-ul final 
        $final = forumage_parse($rezultat[0],$rezultat[1],$rezultat[2],$rezultat[3],$rezultat[4],$data_inregistrarii);  
        if ($mybb->settings['fa_mode'] == 1)  
        {  
        //Advanced Mode - template
        $fa_final = "<tr>
                        <td class=\"trow1 smalltext\" align=\"center\" width=\"1\"><img src=\"images/fa_image.png\" alt=\"Group Legend\" />
                        </td>
                        <td colspan=\"6\" class=\"trow1\">
                        <span class=\"smalltext\">
                                ".$final."
                        </span>
                        </td>
                      </tr>";
        }
        else
        {
        //Simple Mode - template    
        $fa_final = "<tr>
                        <td class=\"trow1\">
                        <span class=\"smalltext\">
                                ".$final." 
                        </span>
                        </td>
                      </tr>";
        }
    }
    else
    {
        $fa_final = "";
    }
	eval("\$faforumage = \"".$templates->get("fa_template")."\";"); 
}
?>
 
Okay, put back your original code in the fa_template.

Then, use this for your forumage.php file:

Code:
<?php
/*
    @author     : Surdeanu Mihai ;
    @date       : 20 august 2010 ;
    @version    : 1.0 ;
    @mybb       : compatibility with MyBB 1.4.x and with MyBB 1.6.x;
    @description: This plugin show the forum age on index page (on footer page)!
    @homepage   : http://homesoftcenter.com/forum ! Please visit us now!
    @copyright  : GPL License. All rights reserved. 
*/
//Test myBB
if(!defined("IN_MYBB"))
{
    die("Acest fisier nu poate fi accesat direct.");
}
//Our hook
$plugins->add_hook("index_start", "forumage_start");
//Plugin information
function forumage_info()
{
    return array(
        "name"            => "Forum Age by HSC Community",
        "description"      => "Show your forum age.",
        "website"         => "http://www.homesoftcenter.com/forum",
        "author"         => "Mihu",
        "authorsite"      => "mailto:[email protected]",
        "version"         => "1.0",
      "guid"            => "b6ad0bfae46d194b803e5c5389c7ebf1",
      'compatibility'     => '14*,16*',
                );
}
//Activate plugin
function forumage_activate()
{
   global $db;
   $grup_de_setari = array(
      "gid"               => NULL,
      "name"              => "fa_hsc",
      "title"             => "Forum Age",
      "description"       => "What is your forum age?",
      "disporder"         => "35",
      "isdefault"         => "no"
                           );
   $db->insert_query("settinggroups", $grup_de_setari);
   $gid = $db->insert_id();
    $setare_1 = array(
        "sid"               => NULL,
        "name"              => "fa_enabled",
        "title"             => "Is enabled?",
        "description"       => "Can this plugin do his job?",
        "optionscode"       => "yesno",
        "value"             => "no",
        "disporder"         => "1",
        "gid"               => intval($gid)
                     );
    $setare_2 = array(
        "sid"               => NULL,
        "name"              => "fa_mode",
        "title"             => "What is your mode?",
        "description"       => "Please specify your custom mode! (if you have a theme without icons on Who`s Online then you must select Simple Mode, else you have to select Advanced Mode)",
        "optionscode"       => "select\n0=Simple Mode\n1=Advanced Mode",
        "value"             => "0",
        "disporder"         => "2",
        "gid"               => intval($gid)
                     );
    $setare_3 = array(
        "sid"               => NULL,
        "name"              => "fa_list",
        "title"             => "Display list:",
        "description"       => "Please select your display list!",
        "optionscode"       => "select\n0=Years,Months,Days\n1=Years,Months,Days,Hours\n2=Years,Months,Days,Hours,Minutes",
        "value"             => "0",
        "disporder"         => "3",
        "gid"               => intval($gid)
                     );
   $db->insert_query("settings", $setare_1); 
    $db->insert_query("settings", $setare_2);  
    $db->insert_query("settings", $setare_3);  
    rebuild_settings(); 
    $sablon = array(
      "tid"      => NULL,
      "title"      => "fa_template",
      "template"   => "{\$fa_final}",
      "sid"      => "-1"
                    );
   $db->insert_query("templates", $sablon);
   require MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("index_boardstats", '#{\$forumstats}#', "{\$forumstats}\n{\$faforumage}");
}
//Deactivate plugin
function forumage_deactivate()
{
   global $db;
    $db->delete_query('settings', 'name IN("fa_enabled","fa_mode","fa_list")');
    $db->delete_query('settinggroups', 'name = "fa_hsc"');
    rebuild_settings();
    $db->delete_query('templates', 'title = "fa_template"');  
   require MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("index_boardstats", '#(\n?){\$faforumage}#', '', 0);
}
//Aditional functions
function forumage_get($diferenta)
{
    $ani = floor($diferenta / (365*60*60*24));
    $luni = floor(($diferenta - $ani * 365*60*60*24) / (30*60*60*24));
    $zile = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24)/ (60*60*24));
    $ore = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24)/ (60*60)); 
    $minute = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24 - $ore*60*60)/ 60);  
    return "".$ani."|".$luni."|".$zile."|".$ore."|".$minute."";
}
function forumage_parse($ani,$luni,$zile,$ore,$minute,$timp)
{
    global $lang,$mybb;
    $lang->load("forumage");  
    $v = ",";
    $a = $lang->fa_and;
    if (($ani == "0")&&($luni == "0"))
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."."; 
        break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
        break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
        break;
        }
    else
    {
    if ($ani == "0")
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days."."; 
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }
    else
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days.".";
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }   
    }
}
//Functia de initializare
function forumage_start()
{
    //Variabile globale
    global $db, $mybb, $faforumage, $templates;
    //Variabile de lucru
    $final = "";
    if ($mybb->settings['fa_enabled'] == 1)  
    {
        //Se realizeaza interogarea
        $interogare = $db->simple_select("users","regdate","",array("order_by"=>'uid',"limit"=>1));
        //Se intoarce din baza de date primul user inregistrat pe forum (admin)
        $user = $db->fetch_array($interogare);
        $data_inregistrarii = $user['regdate'];
        $data_acum = time();
        //Diferenta de timp este = ...
        $diferenta = $data_acum - $data_inregistrarii;
        $rezultat = explode('|',forumage_get($diferenta)); 
        //Se parseaza datele obtinute si se formeaza string-ul final 
        $final = forumage_parse($rezultat[0],$rezultat[1],$rezultat[2],$rezultat[3],$rezultat[4],$data_inregistrarii); 
        if ($mybb->settings['fa_mode'] == 1)  
        {  
        //Advanced Mode - template
        $fa_final = "<tr>
                        <td class=\"trow1 smalltext\" align=\"center\" width=\"1\"><img src=\"images/fa_image.png\" alt=\"Group Legend\" />
                        </td>
                        <td colspan=\"6\" class=\"trow1\">
                        <span class=\"smalltext\">
                                ".$final."
                        </span>
                        </td>
                      </tr>";
        }
        else
        {
        //Simple Mode - template    
        $fa_final = $final;
        }
    }
    else
    {
        $fa_final = "";
    }
   eval("\$faforumage = \"".$templates->get("fa_template")."\";"); 
}
?>

Let me know how that works.
 
It put the forum age info on top of the boards stats, and when I re-added the html I removed, it added the table as it should be, but the board age is still on top of the board stats and the cells are still empty..
 
Okay, try putting this in your forumage.php file:

Code:
<?php
/*
    @author     : Surdeanu Mihai ;
    @date       : 20 august 2010 ;
    @version    : 1.0 ;
    @mybb       : compatibility with MyBB 1.4.x and with MyBB 1.6.x;
    @description: This plugin show the forum age on index page (on footer page)!
    @homepage   : http://homesoftcenter.com/forum ! Please visit us now!
    @copyright  : GPL License. All rights reserved. 
*/
//Test myBB
if(!defined("IN_MYBB"))
{
    die("Acest fisier nu poate fi accesat direct.");
}
//Our hook
$plugins->add_hook("index_start", "forumage_start");
//Plugin information
function forumage_info()
{
    return array(
        "name"            => "Forum Age by HSC Community",
        "description"      => "Show your forum age.",
        "website"         => "http://www.homesoftcenter.com/forum",
        "author"         => "Mihu",
        "authorsite"      => "mailto:[email protected]",
        "version"         => "1.0",
      "guid"            => "b6ad0bfae46d194b803e5c5389c7ebf1",
      'compatibility'     => '14*,16*',
                );
}
//Activate plugin
function forumage_activate()
{
   global $db;
   $grup_de_setari = array(
      "gid"               => NULL,
      "name"              => "fa_hsc",
      "title"             => "Forum Age",
      "description"       => "What is your forum age?",
      "disporder"         => "35",
      "isdefault"         => "no"
                           );
   $db->insert_query("settinggroups", $grup_de_setari);
   $gid = $db->insert_id();
    $setare_1 = array(
        "sid"               => NULL,
        "name"              => "fa_enabled",
        "title"             => "Is enabled?",
        "description"       => "Can this plugin do his job?",
        "optionscode"       => "yesno",
        "value"             => "no",
        "disporder"         => "1",
        "gid"               => intval($gid)
                     );
    $setare_2 = array(
        "sid"               => NULL,
        "name"              => "fa_mode",
        "title"             => "What is your mode?",
        "description"       => "Please specify your custom mode! (if you have a theme without icons on Who`s Online then you must select Simple Mode, else you have to select Advanced Mode)",
        "optionscode"       => "select\n0=Simple Mode\n1=Advanced Mode",
        "value"             => "0",
        "disporder"         => "2",
        "gid"               => intval($gid)
                     );
    $setare_3 = array(
        "sid"               => NULL,
        "name"              => "fa_list",
        "title"             => "Display list:",
        "description"       => "Please select your display list!",
        "optionscode"       => "select\n0=Years,Months,Days\n1=Years,Months,Days,Hours\n2=Years,Months,Days,Hours,Minutes",
        "value"             => "0",
        "disporder"         => "3",
        "gid"               => intval($gid)
                     );
   $db->insert_query("settings", $setare_1); 
    $db->insert_query("settings", $setare_2);  
    $db->insert_query("settings", $setare_3);  
    rebuild_settings(); 
    $sablon = array(
      "tid"      => NULL,
      "title"      => "fa_template",
      "template"   => "{\$fa_final}",
      "sid"      => "-1"
                    );
   $db->insert_query("templates", $sablon);
   require MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("index_boardstats", '#{\$forumstats}#', "{\$forumstats}\n{\$faforumage}");
}
//Deactivate plugin
function forumage_deactivate()
{
   global $db;
    $db->delete_query('settings', 'name IN("fa_enabled","fa_mode","fa_list")');
    $db->delete_query('settinggroups', 'name = "fa_hsc"');
    rebuild_settings();
    $db->delete_query('templates', 'title = "fa_template"');  
   require MYBB_ROOT."/inc/adminfunctions_templates.php";
   find_replace_templatesets("index_boardstats", '#(\n?){\$faforumage}#', '', 0);
}
//Aditional functions
function forumage_get($diferenta)
{
    $ani = floor($diferenta / (365*60*60*24));
    $luni = floor(($diferenta - $ani * 365*60*60*24) / (30*60*60*24));
    $zile = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24)/ (60*60*24));
    $ore = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24)/ (60*60)); 
    $minute = floor(($diferenta - $ani*365*60*60*24 - $luni*30*60*60*24 - $zile*60*60*24 - $ore*60*60)/ 60);  
    return "".$ani."|".$luni."|".$zile."|".$ore."|".$minute."";
}
function forumage_parse($ani,$luni,$zile,$ore,$minute,$timp)
{
    global $lang,$mybb;
    $lang->load("forumage");  
    $v = ",";
    $a = $lang->fa_and;
    if (($ani == "0")&&($luni == "0"))
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."."; 
        break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
        break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
        break;
        }
    else
    {
    if ($ani == "0")
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days."."; 
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }
    else
        switch ($mybb->settings['fa_list'])
        {
        case 0 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months." ".$a." ".$zile."".$lang->fa_days.".";
            break;
        case 1 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days." ".$a." ".$ore."".$lang->fa_hours."."; 
            break;
        case 2 :
            return $lang->fa_boardstartedon1."".date('m-d-Y',$timp)."".$lang->fa_boardstartedon2."".$ani."".$lang->fa_years."".$v." ".$luni."".$lang->fa_months."".$v." ".$zile."".$lang->fa_days."".$v." ".$ore."".$lang->fa_hours." ".$a." ".$minute."".$lang->fa_minutes."."; 
            break;
        }   
    }
}
//Functia de initializare
function forumage_start()
{
    //Variabile globale
    global $db, $mybb, $faforumage, $templates;
    //Variabile de lucru
    $final = "";
    if ($mybb->settings['fa_enabled'] == 1)  
    {
        //Se realizeaza interogarea
        $interogare = $db->simple_select("users","regdate","",array("order_by"=>'uid',"limit"=>1));
        //Se intoarce din baza de date primul user inregistrat pe forum (admin)
        $user = $db->fetch_array($interogare);
        $data_inregistrarii = $user['regdate'];
        $data_acum = time();
        //Diferenta de timp este = ...
        $diferenta = $data_acum - $data_inregistrarii;
        $rezultat = explode('|',forumage_get($diferenta)); 
        //Se parseaza datele obtinute si se formeaza string-ul final 
        $final = forumage_parse($rezultat[0],$rezultat[1],$rezultat[2],$rezultat[3],$rezultat[4],$data_inregistrarii);
        if ($mybb->settings['fa_mode'] == 1)  
        {  
        //Advanced Mode - template
        $fa_final = "<tr>
                        <td class=\"trow1 smalltext\" align=\"center\" width=\"1\"><img src=\"images/fa_image.png\" alt=\"Group Legend\" />
                        </td>
                        <td colspan=\"6\" class=\"trow1\">
                        <span class=\"smalltext\">
                                ".$final."
                        </span>
                        </td>
                      </tr>";
        }
        else
        {
        //Simple Mode - template    
        $fa_final = " ".$final." ";
        }
    }
    else
    {
        $fa_final = "";
    }
   eval("\$faforumage = \"".$templates->get("fa_template")."\";"); 
}
?>
 
Nope, no change..

Edit: 1:35 AM EST

ok, the strangest thing just happened, after seeing a really weird warning about tid and sid, after logging back into my ACP,

I re-added the code I had earlier and it worked!

Thank you vey much Skyon, you have no idea how much you've helped me.

I asked for help on this on MyBB support and the post still has yet to receive a reply.

Thank you very, very much for your help, it really means a lot to me. 😎
 
Back
Top Bottom