[Add-on] myCalendar vs. Birthday Mod

Mod that adds a birthday field to the users profile, theire age are displayed beside the posts, and on there birthday they will have a greeting popup
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Postby haywood jahelpme on Mon 22. Dec, 2003 16:32

mike96 wrote:I've added support for the mycalendar+ 0.8 and the birthday mod. Here's the code:


Mike: thanks for that. I was about to ask if anyone had this...

One small thing that you should change...
Code: Select all
#
#------[ FIND ]---------------------------
#
$template->set_filenames(array(
'body' => 'mycalendar_body.tpl')
);


should be
Code: Select all
#
#------[ FIND ]---------------------------
#
$template->set_filenames(array(
    'body' => 'mycalendar_mod/mycalendar_body.tpl')
);


Otherwise, that's a heckuva nice hack! Thanks again...
User avatar
haywood jahelpme
Poster
Poster
 
Posts: 17
Joined: Thu 26. Jun, 2003 02:17

Postby duvelske on Sun 11. Jan, 2004 14:12

i have another mod topic callender. Is this also compatible with this mod?

http://rpgnet.clanmckeen.com/demo/viewtopic.php?t=398

is the url to the mod
Greetzzz,
Image
duvelske
Poster
Poster
 
Posts: 194
Joined: Sat 16. Aug, 2003 17:31

Postby helluvaguy2003 on Sun 08. Feb, 2004 14:01

mike96 wrote:I've added support for the mycalendar+ 0.8 and the birthday mod. Here's the code:

Code: Select all
####################################################
## Mod Title: myCalendar+ vs. Birthday Mod
## Mod Version: 1.0
## Author: Mike Chidsey < mikechidsey@hotmail.com >
## Original Author:   Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. Rød) HTTP://mods.db9.dk
##         & his members contribution
##
## Description: This is not exactly a mod, more an extension mod.
##              With this mod your users Birthday will appears with the calendar as an event
##
## Requirements: myCalendar+ 0.8 made by flashdagger http://forum.kuszak.de
##               Birthday Mod v1.4.x made by Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. Rød) HTTP://mods.db9.dk
##
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: 1
##                mycalendar.php
##
## Included Files: N/A
##
####################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
####################################################

#
#------[ OPEN ]---------------------------
#
mycalender.php

#
#------[ FIND ]---------------------------
#
$template->set_filenames(array(
    'body' => 'mycalendar_body.tpl')
);

#
#------[ AFTER, ADD ]---------------------------
#

// For the Birthday Mod
unset($birthdays);

// these aren't really dates, so the hard-coded 31 isn't a problem
$date_start = (strlen($month)==1) ? '0':''. $month.'01';
$date_end =  (strlen($month)==1) ? '0':''. $month.'31';

// load only the birthdays for this month
$sql = "SELECT user_id, username, user_birthday FROM " . USERS_TABLE. " WHERE user_birthday!=999999 AND
   (DATE_FORMAT(addDate('1970-01-01', INTERVAL user_birthday DAY),'%m%d') BETWEEN '$date_start' AND '$date_end') ORDER BY username";

if (!$result = $db->sql_query($sql)){
   message_die(GENERAL_ERROR, 'Error querying birthdays for mycalendar.');
}
while ($birthdayrow = $db->sql_fetchrow($result)){
   $user_birthday = realdate("Ymd",$birthdayrow['user_birthday']);
   // since we loaded the birthdays for this month, save the b-day in the array indexed by day
   $birthdays[intval($user_birthday[6].$user_birthday[7])][] = (
        array(
      'user_id' => $birthdayrow['user_id'],
      'username' => $birthdayrow['username'],
      'display_date' => realdate($lang['DATE_FORMAT'],$birthdayrow['user_birthday']),
      'birthday_year' => $user_birthday[0].$user_birthday[1].$user_birthday[2].$user_birthday[3])
   );
}


#
#------[ FIND ]---------------------------
#
            while ( $day == $event['day']){
            $act_date = "$year-$month-" . sprintf('%02d', $day);
            $cal_date_end = date('Y-m-d', $event['cal_date_end']);
            $cal_date = date('Y-m-d', $event['cal_date']);

#
#------[ Before, ADD ]---------------------------
#

         // list birthdays first
         if (isset($birthdays[$day]))  // see if there is a birthday on this day
            foreach ($birthdays[$day] as $users){
            
               $topic_title = '<b>{TITLE}:</b>&nbsp;{NAME}';
               // $link_text is how the birthday will appear on the calendar (notice the link break <BR>)
               $link_text = str_replace('{TITLE}', $lang['Birthday'], $topic_title);
               $link_text = str_replace('{NAME}', '<br>'.$users['username'], $link_text);

               // $title_text is how the title of the popup will appear
               $title_text = str_replace('{TITLE}', $lang['Birthday'], $topic_title);
               $title_text = str_replace('{NAME}', $users['username'], $title_text);
               
               // prepare the popup text, escaping quotes for java**script
               $u_user = append_sid('profile.' . $phpEx . '?mode=viewprofile&amp;u='.$users['user_id']);
               // calculate the user's age (as of the calendar year)
               $user_age = intval($year)-intval($users['birthday_year']);
               $style  = 'style="height:14px;margin:1px 0px;padding-left:2px;';
               
               $caption  = "<div class=\\"ol_caption\\">" . $title_text . "</div>";
               
               // configure the details section of the popup
               // line 1:             
               $line1 = "<b>".$lang['Name'].":</b>&nbsp;". $users['username'];
               // line2:
               $line2 = "<b>" . $lang['Age'] . ":</b>&nbsp;".$user_age;
               //line 3:
               $line3 = "<b>" . $lang['Date'] . ":</b>&nbsp;".$users['display_date'];
                           
               $tiptext = "<div style=\\"white-space:nowrap;\\">{LINE1}<br>{LINE2}<br>{LINE3}</div>";
               
               $tiptext = str_replace("{LINE1}", $line1, $tiptext);
               $tiptext = str_replace("{LINE2}", $line2, $tiptext);
               $tiptext = str_replace("{LINE3}", $line3, $tiptext);
               
               $tiptext = str_replace("'", "\\'", $tiptext);
               
               // we need to generate a unique topic ID for the js array, so user the
               // userid. To avoid conflicts with Topic IDs, also make it negative
               $ol_topic_id = -1 * intval($users['user_id']);
               $js_arraydata .= "\nol_caps[$ol_topic_id] = "$caption";\nol_texts[$ol_topic_id] = "$tiptext";";
               
               $overlib = "onmouseover="return overlib(INARRAY, $ol_topic_id, CAPARRAY, $ol_topic_id, CSSCLASS, FGCLASS, 'ol_fg', BGCLASS, 'ol_bg', CAPTIONFONTCLASS, 'ol_caption', TEXTFONTCLASS, 'ol_text', STICKY, AUTOCLOSE, NOCLOSE, HAUTO, VAUTO, DELAY, 400);" onmouseout="return nd();"";

               // in order to separate events from birthdays, make the birthdays look different
               // this will display the birthday in a table with a border and white background
               $entry = "<div $style ><span class="gensmall"></span><table cellpadding=1 cellspacing=0 style='background-color: white; border: 1px solid black;' width='100%'><tr><td><a href="$u_user" class="gensmall" style="$style" $overlib >$link_text</a></td></tr></table></div>";
               
               // to dispay birthdays as events, uncomment the following line:
               //$entry = "<div $style ><span class="gensmall"></span>&middot;<a href="$u_user" class="gensmall" style="$style" $overlib >". str_replace('<br>', '', $link_text)."</a></div>";

                              
               $template->assign_block_vars('date_row.date_cell.switch_date_cells.date_event', array(
                     'U_EVENT' => $entry));
                        
         }

#
#------[ SAVE & CLOSE ]---------------------------
# EoM

My compliment for this nice piece of coding. But I would like to know how to change it, so the birthdays aren't displayed first. When they are, they 'mess' with events with a duration of more then 1 day. So it would be easier to read the calendar with that kind of events.
helluvaguy2003
Poster
Poster
 
Posts: 9
Joined: Mon 08. Dec, 2003 17:01

Postby helluvaguy2003 on Tue 17. Feb, 2004 16:56

Is there really noone who can help me with this?
helluvaguy2003
Poster
Poster
 
Posts: 9
Joined: Mon 08. Dec, 2003 17:01

Postby irishclubbing on Sat 10. Apr, 2004 18:06

excellent mod :)
irishclubbing
Poster
Poster
 
Posts: 16
Joined: Mon 07. Apr, 2003 01:12

Postby IrEnE06 on Tue 04. May, 2004 18:40

sorry.. i'm a bit blur..
where can i get the mod for linking up calendar lite with birthday mod? so that birthdays can be shown on the calendar?
IrEnE06
Poster
Poster
 
Posts: 3
Joined: Tue 24. Jun, 2003 07:17

Postby tphi on Sat 08. May, 2004 18:14

euh, vous parlez francais?
can you speak french?
?hola, habla francès?
tphi
Poster
Poster
 
Posts: 1
Joined: Sat 08. May, 2004 14:34

Postby kooky on Mon 10. May, 2004 00:43

tphi wrote:euh, vous parlez francais?
can you speak french?
?hola, habla francès?

lol question ?
kooky
brilliant supporter
 
Posts: 1329
Joined: Tue 31. Dec, 2002 17:52
Location: Au pays des rêves

PreviousNext

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron