Page 1 of 12

[MODDB] Upcoming Birthday list 1.0.0a

Posted: Sat Sep 08, 2007 6:05 pm
by lefty74
MOD Title: Upcoming Birthday list
MOD Description: Shows upcoming birthdays on index page, number of days can be modified via ACP.
MOD Version: 1.0.0a

MOD Download: Upcoming Birthday list 1.0.0a
phpbb3 version: Gold

Demo Board: Demoboard
Demo Username: test
Demo Password: testtest

Screenshots:
Image

Re: [BETA] Upcoming Birthday list

Posted: Sat Sep 08, 2007 6:29 pm
by johnnyvang
Bedankt lefty74

Thanks lefty74

Re: [BETA] Upcoming Birthday list

Posted: Sat Sep 08, 2007 7:33 pm
by saaiberke
Thank you so much Lefty74!!!! ;)

Nic

Re: [BETA] Upcoming Birthday list

Posted: Sat Sep 08, 2007 7:41 pm
by lefty74
:) i would be interested to hear if there are any issues with servers being in different timezones etc. worked for me so hope i managed to get it right.

Re: [BETA] Upcoming Birthday list

Posted: Sat Sep 08, 2007 8:44 pm
by johnnyvang
lefty74 wrote::) i would be interested to hear if there are any issues with servers being in different timezones etc. worked for me so hope i managed to get it right.
If i remember it correct then my server is in the USA and is a linux server.
just installed this mod and tested it, and runs great.
Only 1 thing.
In the installation file you say installation time: ~10minutes
But you can do it within 3 minutes.

Re: [BETA] Upcoming Birthday list

Posted: Sat Sep 08, 2007 9:18 pm
by lefty74
johnnyvang wrote:
lefty74 wrote::) i would be interested to hear if there are any issues with servers being in different timezones etc. worked for me so hope i managed to get it right.
If i remember it correct then my server is in the USA and is a linux server.
just installed this mod and tested it, and runs great.
Only 1 thing.
In the installation file you say installation time: ~10minutes
But you can do it within 3 minutes.
even better :) cheers

Re: [BETA] Upcoming Birthday list

Posted: Sun Sep 09, 2007 5:45 am
by TIM3PORT
lefty keeps coming up with simple things that can be so beneficial thanks once again

Re: [BETA] Upcoming Birthday list

Posted: Sun Sep 09, 2007 7:00 am
by RedTrinity
Awesome!!! My eyes lit up when I saw this MOD listed just now, thanks so much Lefty!!

Off to install now :)

Re: [BETA] Upcoming Birthday list

Posted: Sun Sep 09, 2007 8:52 am
by lefty74
thanks for your comments :)

Re: [BETA] Upcoming Birthday list

Posted: Mon Sep 10, 2007 4:36 am
by Highway311
Thanks to lefty74

German Language:
language/de/common.php

Code: Select all

'BIRTHDAYS_AHEAD'		=> 'Geburtstage in den nächsten %s Tagen',
language/de/acp/board.php

Code: Select all

'ALLOW_BIRTHDAYS_AHEAD'		=> 'Wieviele Tage vor dem Geburtstage sollen angezeigt werden?',
	'ALLOW_BIRTHDAYS_AHEAD_EXPLAIN'	=> 'Zeigt die kommenden Geburtstage auf der Startseite an. Ein 0 schaltet diese Anzeige aus.',

Re: [BETA] Upcoming Birthday list

Posted: Mon Sep 10, 2007 10:13 am
by lefty74
Highway311 wrote:Thanks to lefty74

German Language:
language/de/common.php

Code: Select all

'BIRTHDAYS_AHEAD' => 'Geburtstage in den nächsten %s Tagen',
language/de/acp/board.php

Code: Select all

'ALLOW_BIRTHDAYS_AHEAD' => 'Wieviele Tage der Geburtstage sollen angezeigt werden?',
'ALLOW_BIRTHDAYS_AHEAD_EXPLAIN' => 'Zeigt die kommenden Geburtstage auf der Startseite an. Ein 0 schaltet diese Anzeige aus.',
Thanks very much.

I noticed on my testboard (server is GMT-5) that there are some issues with the time at midnight. i think i fixed this issue though and will post the code changes later tonight (am at work at the moment).

Re: [BETA] Upcoming Birthday list

Posted: Mon Sep 10, 2007 4:42 pm
by lefty74
updated to 0.0.1a
fixed a small error calculating the right time

to upgrade from 0.0.1 to 0.0.1a

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
// Generate birthday ahead list if required ...
$birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
	$sql = 'SELECT user_id, username, user_colour, user_birthday
		FROM ' . USERS_TABLE . "
		WHERE user_birthday <> ''
			AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	$now = getdate();
    $today = (mktime(0, 0, 0, $now[mon], $now[mday], $now[year])) + $user->timezone + $user->dst + date('Z');

	while ($row = $db->sql_fetchrow($result))
	{
       $birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
       $user_birthday = strtotime($birthdaydate) + $user->timezone + $user->dst + date('Z');

	   if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($config['allow_birthdays_ahead'] * 86400) ) )
	   {
		if ($row['user_colour'])
			{
				$user_colour = ' style="color:#' . $row['user_colour'] . '"';
				$row['username'] = '<strong>' . $row['username'] . '</strong>';
			}
		else
			{
				$user_colour = '';
			}

	   $birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '" title="' . date('d M', $user_birthday) . '">' . $row['username'] . '</a>';

		if ( $age = (int) substr($row['user_birthday'], -4) )
		{
			$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
		}
		}
	}
	
	$db->sql_freeresult($result);
}

#
#-----[ REPLACE WITH ]------------------------------------------
#

// Generate birthday ahead list if required ...// Generate birthday ahead list if required ...
$birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
	$sql = 'SELECT user_id, username, user_colour, user_birthday
		FROM ' . USERS_TABLE . "
		WHERE user_birthday <> ''
			AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
    $today = (mktime(0, 0, 0, $now[mon], $now[mday], $now[year]));

	while ($row = $db->sql_fetchrow($result))
	{
       $birthdaydate = (gmdate('Y') . '-' . trim(substr($row['user_birthday'],3,-5)) . '-' . trim(substr($row['user_birthday'],0,-8) ));
       $user_birthday = strtotime($birthdaydate);
	   if ( $user_birthday >= ($today + 86400) && $user_birthday <= ($today + ($config['allow_birthdays_ahead'] * 86400) ) )
	   {
		if ($row['user_colour'])
			{
				$user_colour = ' style="color:#' . $row['user_colour'] . '"';
				$row['username'] = '<strong>' . $row['username'] . '</strong>';
			}
		else
			{
				$user_colour = '';
			}

	   $birthday_ahead_list .= (($birthday_ahead_list != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '" title="' . date('d M', $user_birthday) . '">' . $row['username'] . '</a>';

		if ( $age = (int) substr($row['user_birthday'], -4) )
		{
			$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
		}
		}
	}
	
	$db->sql_freeresult($result);
}

Re: [BETA] Upcoming Birthday list

Posted: Fri Sep 14, 2007 12:37 pm
by joebart72

Code: Select all

[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant mon - assumed 'mon'
[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant mday - assumed 'mday'
[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant year - assumed 'year'
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4267: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4269: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4270: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4271: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
Any idea of the problem ? :shock: Thanks ;)

Re: [BETA] Upcoming Birthday list

Posted: Fri Sep 14, 2007 5:46 pm
by lefty74
can you send me ur index.php pse?

i would like to see whether i get the same error message when i put this on my board.
joebart72 wrote:

Code: Select all

[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant mon - assumed 'mon'
[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant mday - assumed 'mday'
[phpBB Debug] PHP Notice: in file /index.php on line 272: Use of undefined constant year - assumed 'year'
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4267: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4269: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4270: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4271: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3766)
Any idea of the problem ? :shock: Thanks ;)

Re: [BETA] Upcoming Birthday list

Posted: Fri Sep 14, 2007 6:50 pm
by joebart72
Here it is : ;)

INDEX.PHP