Board start date MOD

Support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Forum rules
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

Sorry, I forgot to mention it :D In the above text, there is no space between year and day. Actually, I would prefer the word 'and' between the two.

Forum started on Dec 22, 2004, 17.26 and in existence for 8 Years3 Days
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Board start date MOD

Post by RMcGirr83 »

and the code you are using to get that would be?
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

This one that you so kindly provided in May :)
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Board start date MOD

Post by RMcGirr83 »

Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

Aaand we have a winner!

Code: Select all

Forum started on Dec 22, 2004, 17.26 and in existence for 8 Years and 3 Days • 


Image
Filipe Freitas
New member
New member
Posts: 4
Joined: 04 Nov 2012, 18:32
Location: Rio de Janeiro
Contact:

Re: Board start date MOD

Post by Filipe Freitas »

RMcGirr83 wrote:
mikef35 wrote:This is what is running your countdown, I am looking for a different way.

Code: Select all

$(document).ready(function(){
   $("#online").countdown({
      date: "07 Aug 2012, 00:48:13",
      leadingZero: true,
      offset: -1,
      yearsAndMonths: true,
      htmlTemplate: "<span class='cd-online'>and in existence for</span> <strong>%y</strong> <span class=\"cd-online\">Years</span> <strong>%m</strong> <span class=\"cd-online\">Months</span>  <strong>%d</strong> <span class=\"cd-online\">Days</span> <strong>%h</strong> <span class=\"cd-online\">Hours</span> <strong>%i</strong> <span class=\"cd-online\">Minutes</span> <strong>%s</strong> <span class=\"cd-online\">Seconds</span>",
      direction: "up"
   });


Uhmmm, yeah that isn't the code I am using.


RMcGirr83 how i can add in memberlist_view? i have in my board Forum like u have, but in memberlist, i have problens....
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

The MOD is still not exactly accurate with leap years. Has there been a fix for that? It's not a biggie, just asking. :)
Oyabun1
New member
New member
Posts: 34
Joined: 16 Sep 2009, 08:16

Re: Board start date MOD

Post by Oyabun1 »

For those who have a server running PHP 5.3+ and care about leap years being preoperly counted you can replace all the code in /includes/functions_board_start_date.php with this code:

Code: Select all

<?php
/**
 * @package board start date
 * @version 
 * @copyright (c) 2012 RMcGirr83 & 2015 Oyabun1
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 */
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
    exit;
}

/**
 * board_start_date
 *
 * @return the start date of the board and time in years, months and days
 *
*/
function board_start_date ()
{
    global $config, $user;
    
    $board_for = '';
    $started = new DateTime($user->format_date($config['board_startdate']));
    $today = new DateTime($user->format_date(time()));
    $board_length = $started->diff($today);
    $byears = $board_length->y;
    $bmonths = $board_length->m;
    $bdays = $board_length->d;

    if ($board_length)
    {
        if ($byears >= 1)
        {
            $board_for .= $byears > 1 ? ($byears . ' ' . $user->lang['BOARD_YEARS']) : ($byears . ' ' . $user->lang['BOARD_YEAR']);
        }
        if ($bmonths)
        {
            $bsep = !empty($byears) ? $user->lang['COMMA_SEPARATOR'] : '';
            $bmonths = $bmonths > 1 ? ($bsep . $bmonths . ' ' . $user->lang['BOARD_MONTHS']) : ($bsep . $bmonths . ' ' . $user->lang['BOARD_MONTH']);
            
            $board_for .= $bmonths;
        }
        if ($bdays)
        {
            $band = !empty($bmonths) ? ' ' . $user->lang['BOARD_AND'] . ' ': '';
            $bdays = $bdays > 1 ? ($band . $bdays . ' ' . $user->lang['BOARD_DAYS']) : ($band . $bdays . ' ' . $user->lang['BOARD_DAY']);
            $board_for .= $bdays;
        }
    }

    return ($board_for);
}

?>
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

This sounds great!

Where did we go wrong here?

Code: Select all

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (joulu 22, 2004, 17.26) at position 0 (j): The timezone could not be found in the database' in /home/potku/public_html/forum/includes/functions_board_start_date.php:27 Stack trace: #0 /home/potku/public_html/forum/includes/functions_board_start_date.php(27): DateTime->__construct('joulu 22, 2004,...') #1 /home/potku/public_html/forum/includes/hooks/hook_bsd.php(42): board_start_date() #2 [internal function]: hook_bsd(Object(phpbb_hook), 'sn_im_online_li...', false, Object(mobile_template)) #3 /home/potku/public_html/forum/includes/hooks/index.php(141): call_user_func_array('hook_bsd', Array) #4 /home/potku/public_html/forum/includes/template.php(208): phpbb_hook->call_hook(Array, 'sn_im_online_li...', false, Object(mobile_template)) #5 /home/potku/public_html/forum/includes/template.php(243): template->display('sn_im_online_li...', false) #6 /home/potku/public_html/forum/socialnet/includes/socialnet.php(697): tem in /home/potku/public_html/forum/includes/functions_board_start_date.php on line 27
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Board start date MOD

Post by RMcGirr83 »

The timezone could not be found in the database
That's the problem. What version of phpBB are you running?
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

We are still (and for a long time coming, for that matter) with the 3.0 branch. I didn't see a mention about the phpBB version in Oyabun1's post. Our PHP is 5.4.x.x.
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

So, is this revision only for phpBB 3.1 series?
Oyabun1
New member
New member
Posts: 34
Joined: 16 Sep 2009, 08:16

Re: Board start date MOD

Post by Oyabun1 »

No. I didn't try it on 3.1.
Potku
New member
New member
Posts: 42
Joined: 21 Dec 2008, 11:22

Re: Board start date MOD

Post by Potku »

Hmm... What might have caused that error on our board?
Oyabun1
New member
New member
Posts: 34
Joined: 16 Sep 2009, 08:16

Re: Board start date MOD

Post by Oyabun1 »

Maybe answer Rich's question?
RMcGirr83 wrote:What version of phpBB are you running?
Post Reply