The Birthday Mod is requiered.
PCP is NOT requiered.
Since it looks as there is no mod for displaying birthdays on the Topic Calendar I sat down for an hour and wrote this.
It's my first mod (I never wanted to write one, but I looked two days for a right mod for me...)
It needs to be optimized - I'll do that in the next days.
But it does it's work.
Here is a link what it looks when installed: http://www.webdesign4all.biz/forum/calendar.php
Actual Version: 0.9.1
fixed: - Date Problem
- where to include the function call.
Code: Select all
##############################################################
## MOD Title: Birthday Extension for Topic Calender & Birthday Mod
## MOD Author: Flani < info@flanisoft.at >
## MOD Description: This mod will add birthdays to your Topic Calender.
## You don't need the PCP for it.
## MOD Version: 0.9.1
## MOD Compatibility: 2.0.6
##
## Requierements: Topic Calender
## Birthday Mod (Niels < ncr@db9.dk > (Niels Chr. Rød) )
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit: 2
## includes/functions_calender.php
## language/lang_english/lang_extend_topic_calendar.php
##
## Included Files: 0
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## 1. Full MOD description
## -----------
## This mod, will add all members birthdays to the Topic Calender.
## You'll need Topic Calender and the Birthday Mod installed to run this Mod.
## A link leads to the users profile.
##
## 2. Official last version link
## -----------
## ??
##
## 3. Todo - Next Version
## -----------
## Optimizing.
## Read only informations out that are valid for a specific timerange
##
##
##
##############################################################
## MOD History:
##
##
## 2004-02-04 - Version 0.9.0
## - initial beta
##
## 2004-02-06 - Version 0.9.1
## - Date problem fixed
## should now work with any dateformat
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions_calendar.php
#
#-----[ FIND ]------------------------------------------------
#
//
// birthday (only with PCP)
//
#
#-----[ BEVORE, ADD ]------------------------------------------
#
//
// Birthday Mod for Topic Calendar & Birthday Mod wihout PCP
//
function get_birthday(&$events, &$number, $start_date, $end_date, $limit=false, $start=0, $max_limit=-1)
{
global $template, $lang, $images, $userdata, $board_config, $db, $phpbb_root_path, $phpEx;
$sql = "SELECT u.*
FROM " . USERS_TABLE . " AS u
WHERE u.user_id <> " . ANONYMOUS . "
AND u.user_birthday <> 999999
ORDER BY username";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not read user table to get birthday today info', '', __LINE__, __FILE__, $sql);
}
// get the number of occurences
$number = $db->sql_numrows($result);
// if limit per page asked, limit the number of results
// read users
while ($row = $db->sql_fetchrow($result))
{
$user_id = $row['user_id'];
$username = $row['username'];
$user_birthday = realdate($lang['DATE_FORMAT'], $row['user_birthday']);
$ignore = $row['user_ignore'];
$friend = $row['user_friend'];
$always_visible = $row['user_visible'];
$username_link = append_sid($phpbb_root_path . "./profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");
$event_day = realdate('d',$row['user_birthday']);
$event_month = realdate('n',$row['user_birthday']);
$event_year2 = realdate('Y',$row['user_birthday']);
$start_month = intval(date('m', $start_date));
$event_year = intval(date('Y', $start_date));
if ($event_month < $start_month) $event_year++;
$event_time = mktime( 0,0,0, $event_month, $event_day, $event_year );
$tmp_message = sprintf($lang['birthday'],$username);
$message = htmlspecialchars("<table cellspacing='1' cellpadding='2' border='0' width='100%' class='forumline'><tr><td class='row1' nowrap='nowrap'><b>".$lang['birthday_header']."</b><span class='topictitle'></span><hr /><span class='genmed'>".$tmp_message."</span></td></tr></table>");
$message = preg_replace("/[\n\r]{1,2}/", '', $message);
$new_row = array();
$new_row['event_id'] = POST_USERS_URL . $user_id;
$new_row['event_author_id'] = $user_id;
$new_row['event_author'] = $username;
$new_row['event_time'] = $event_time;
$new_row['event_last_author_id'] = '';
$new_row['event_last_author'] = '';
$new_row['event_last_time'] = '';
$new_row['event_replies'] = '';
$new_row['event_views'] = '';
$new_row['event_type'] = POST_BIRTHDAY;
$new_row['event_vote'] = '';
$new_row['event_status'] = '';
$new_row['event_moved_id'] = '';
$new_row['event_last_id'] = '';
$new_row['event_forum_id'] = '';
$new_row['event_forum_name'] = '';
$new_row['event_icon'] = '';
$new_row['event_title'] = $username;
$new_row['event_short_title'] = $username;
$new_row['event_message'] = $message;
$new_row['event_calendar_time'] = $event_time;
$new_row['event_calendar_duration'] = '';
$new_row['event_link'] = $username_link;
$new_row['event_txt_class'] = $txt_class;
$new_row['event_type_icon'] = '<img src="' . $images['icon_tiny_profile'] . '" border="0" align="absbottom" hspace="2" />';
$events[] = $new_row;
}
}
#
#-----[ FIND ]------------------------------------------------
#
# around line 401
#
$message = $row['post_text'];
#
#-----[ REPLACE WITH ]------------------------------------------------
#
$message = htmlspecialchars($row['post_text']);
#
#-----[ FIND ]------------------------------------------------
#
get_event_PCP_birthday($events, $number, $start_date, $end_date);
#
#-----[ AFTER, ADD ]------------------------------------------------
#
get_birthday($events, $number, $start_date, $end_date);
#
#-----[ OPEN ]------------------------------------------------
#
# do the same with all other languages you've installed
#
language/lang_english/lang_extend_topic_calendar.php
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
$lang['birthday_header'] = 'Happy Birthday!';
$lang['birthday'] = '<b>%s</b> has birthday today!';
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM