Birthdays

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
151
66%
Very Good
39
17%
Good
21
9%
Fair
5
2%
Poor
12
5%
 
Total votes: 228

Leona
Registered User
Posts: 5
Joined: Sun Sep 23, 2007 4:00 am

Re: Birthdays

Post by Leona »

I installed the MOD a few months ago and my board members love it! I have a small challenge now, though. Since the calendar changed to 2008, the age displayed in parentheses in the Today's Birthdays section is advanced one year. My ladies are not excited to have the computer say they are a year older than they really are! For example: if I am turning 40, I expect to see Leona(40). Instead it displays Leona(41).

I am wondering if some of the code is based on a calculation from the server's system clock? Or any other ideas?

Thanks!
Primy
Registered User
Posts: 109
Joined: Sat Dec 01, 2007 5:11 pm

Re: Birthdays

Post by Primy »

Hi! ive installed this mod and it's great! Just ive some question:

1. Is it possible to add a function so that when a user has a birthday, the smaller pie image appears in viewtopic near the profile and emali buttons? Like in phpbb Orion...

2. Why near the birth date in viewprofile there is "12:00"? Is it my problem or depends on the GTM set?

3. About the popup, precisely when do it appears? At the moment im working in local, so i try with false users...If i set the birth date to the current date, no popup appears me. Maybe, it concerns the ip address which is always the same, and recognized as admin ip. Is it possible?

Sorry for my language, im italian! :mrgreen:
Thanks for the help! See ya!
TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Birthdays

Post by TerraFrost »

silverstreek - In index_body.tpl, find the following:

Code: Select all

  <!-- BEGIN birthdays -->
  <tr>
   <td class="catHead" colspan="2" height="28"><span class="cattitle">{L_TODAYS_BIRTHDAYS}</span></td>
  </tr>
  <tr>
   <td class="row1" colspan="2"><table cellpadding="0" cellspacing="0" border="0">
      <tr>
         <td align="center" valign="middle" style="padding-right: 3px"><img src="templates/subSilver/images/icon_birthday.gif" alt="{L_VIEW_BIRTHDAYS}" /></td>
         <td align="left" width="100%">
           <span class="gensmall">{BIRTHDAYS}
           <!-- BEGIN upcoming -->
           <br />{UPCOMING}
           <!-- END upcoming -->
           </span>
         </td>
        </tr>
   </table></td>
  </tr>
  <!-- END birthdays -->
<!--
// ****************************
// MOD: Show last visited users
// BEGIN: AFTER, ADD
// ****************************
//-->
  <tr>
   <td class="row1" align="left"><span class="gensmall">{LAST_VISIT_USER_LIST}</span></td>
  </tr>
<!--
// ****************************
// MOD: Show last visited users
// END: AFTER, ADD
// ****************************
//-->
</table>
...and replace it with this:

Code: Select all

<!--
// ****************************
// MOD: Show last visited users
// BEGIN: AFTER, ADD
// ****************************
//-->
  <tr>
   <td class="row1" align="left"><span class="gensmall">{LAST_VISIT_USER_LIST}</span></td>
  </tr>
<!--
// ****************************
// MOD: Show last visited users
// END: AFTER, ADD
// ****************************
//-->
  <!-- BEGIN birthdays -->
  <tr>
   <td class="catHead" colspan="2" height="28"><span class="cattitle">{L_TODAYS_BIRTHDAYS}</span></td>
  </tr>
  <tr>
   <td class="row1" colspan="2"><table cellpadding="0" cellspacing="0" border="0">
      <tr>
         <td align="center" valign="middle" style="padding-right: 3px"><img src="templates/subSilver/images/icon_birthday.gif" alt="{L_VIEW_BIRTHDAYS}" /></td>
         <td align="left" width="100%">
           <span class="gensmall">{BIRTHDAYS}
           <!-- BEGIN upcoming -->
           <br />{UPCOMING}
           <!-- END upcoming -->
           </span>
         </td>
        </tr>
   </table></td>
  </tr>
  <!-- END birthdays -->
</table>
Leona - v2.0.2 of this MOD had an issue sorta like that. Is that the version you're using? If you're running 3.0.0, however, then I'll need FTP access to further debug this issue.

Primy -
  1. I'm not sure what you mean. Can you post a screenshot with the pie image and without it?
  2. The time is being displayed because $lang['DATE_FORMAT'] in your lang_main.php is telling it to output the time. Most, however, don't. The reason it says 12:00 as opposed to 0:00 or 0:01 or whatever is because of this.
  3. There would appear to be a bug that prevents birthday greetings from being sent out between New Years and now. To fix it, you'll need to do the following:

    Code: Select all

    #
    #-----[ OPEN ]------------------------------------------
    #
    includes/page_header.php
    #
    #-----[ FIND ]------------------------------------------
    #
    // the greeting will be sent up to seven days after the birthday
    if ( $userdata['birthday_greeting'] != 0 && ( $userdata['user_next_birthday'] < gmdate('Y',$current_time)+1 ) &&
    	$userdata['user_birthday'] >= gmdate('md0000',$start_time) && $userdata['user_birthday'] <= gmdate('md9999',$current_time) )
    #
    #-----[ REPLACE WITH ]----------------------------------
    #
    $start = gmdate('md0000',$start_time);
    $end = gmdate('md9999',$current_time);
    $in_range = $start > $end ?
    	$userdata['user_birthday'] >= $start || $userdata['user_birthday'] <= $end : 
    	$userdata['user_birthday'] >= $start && $userdata['user_birthday'] <= $end;
    if ( $userdata['birthday_greeting'] != 0 && ( $userdata['user_next_birthday'] < gmdate('Y',$current_time)+1 ) && $in_range )
    That said, Birthdays Greetings, by default, are disabled. You'll need to first enable them in the ACP and then you'll need to enable them a second time in the UCP.
silverstreek
Registered User
Posts: 49
Joined: Mon Apr 16, 2007 7:20 am

Re: Birthdays

Post by silverstreek »

thanks terrafrost, that did the trick! :mrgreen:
Primy
Registered User
Posts: 109
Joined: Sat Dec 01, 2007 5:11 pm

Re: Birthdays

Post by Primy »

Thanks for ur answer Terra!

Well, about the first point, u can look these 2 images:

When some user hasn't a birthday:
Image

When some user has a birthday:
Image

----------------------------------------------------------------

About the second point, i dont understand very well, anyway can i do something or it isnt a serious problem and i can leave it like that?

----------------------------------------------------------------

Ive replaced the code in page_header, and now the popup appears, but it contains the forum index and not the birthday wishes...why?

Thanks a lot for ur help!
See ya soon!
Primy
Registered User
Posts: 109
Joined: Sat Dec 01, 2007 5:11 pm

Re: Birthdays

Post by Primy »

Terra ive found an other problem with the code change in page_header. Ive installed this mod for the topic number (relative to the topic id)

Code: Select all

############################################################## 
## MOD Title: post numbers 
## MOD Author: emrag < emrah987@hotmail.com > (Emrah Türkmen)  www.canver.net
## MOD Description: with this hack all messages will have a number.
##		    in all topics this number will start from one (1)
##		    when you click this number you will see this message's direct link.
##		    now when you want to show any messages to your friend send this link
##		    He/she will go direct to your showed message.
##
##
## MOD Version: 1.0.2
## 
## Installation Level: Easy
## Installation Time : ~5 minutes 
## Files to Edit: viewtopic.php
##		  includes/page_header.php
##		  language/lang_english/lang_main.php
##		  templates/subsilver/viewtopic_body.tpl
##		  templates/subsilver/overall_header.tpl
##
## Ýncluded Files: n/a
############################################################## 
##
## Author Note: i saw this feature in invision power boards and adapt it to phpBB ;)
## 
##############################################################
##
## MOD History: 11.02.2005 - 1.0.0
##		- First release
##
##		11.02.2005 - 1.0.1
##		- added a forgotten line ;)
##
##		11.02.2005 - 1.0.2
##		- fixed a bug
##
##############################################################
##
## Before Adding This Hack To Your Forum, You Should Back Up All Files Related To This Hack  
##
############################################################## 
# 
#-----[ OPEN ]------------------------------------------ 
# 

viewtopic.php

#
#----[ FIND ]------------------------------------------ 
#

//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
//
for($i = 0; $i < $total_posts; $i++)
{

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

	$post_number = $i+$start;
	$post_number = $post_number+1;
	$post_id = $postrow[$i]['post_id'];

#
#----[ FIND ]------------------------------------------ 
#

		'POST_DATE' => $post_date,
		'POST_SUBJECT' => $post_subject,
		'MESSAGE' => $message,

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

		'POST_NUMBER' => $post_number,
		'POST_ID' => $post_id,

#
#----[ FIND ]------------------------------------------ 
#

		'L_MINI_POST_ALT' => $mini_post_alt,

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

		'L_POST' => $lang['Post'],

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/page_header.php

#
#----[ FIND ]------------------------------------------ 
#

	'SITENAME' => $board_config['sitename'],
	'SITE_DESCRIPTION' => $board_config['site_desc'],

#
#----[ BEFORE, ADD ]------------------------------------------ 
# 

	'SERVER_NAME' => $board_config['server_name'],
	'SCRIPT_PATH' => $board_config['script_path'],
	'PHPEX' => $phpEx,
	'POST_POST_URL' => POST_POST_URL,
	'COPY' => $lang['Copy'],

# 
#-----[ OPEN ]------------------------------------------ 
# 

language/lang_english/lang_main.php

#
#----[ FIND ]------------------------------------------ 
#

?>

#
#----[ BEFORE, ADD ]------------------------------------------ 
# 

$lang['Copy'] = 'Copy this message\'s direct link';

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/subsilver/viewtopic_body.tpl

#
#----[ FIND ]------------------------------------------ 
#

				<td width="100%"><a href="{postrow.U_MINI_POST}"><img src="{postrow.MINI_POST_IMG}" width="12" height="9" alt="{postrow.L_MINI_POST_ALT}" title="{postrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {postrow.POST_DATE}<span class="gen">&nbsp;</span>&nbsp; &nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>

#
#----[ IN LINE FIND ]------------------------------------------ 
# 

<td width="100%">

#
#----[ IN LINE AFTER, ADD ]------------------------------------------ 
#

<span class="postdetails"><b>{postrow.L_POST}: <a onclick="link_to_post({postrow.POST_ID}); return false;" href="#">#{postrow.POST_NUMBER}</a></b></span>&nbsp; &nbsp;

# 
#-----[ OPEN ]------------------------------------------ 
# 

templates/subsilver/overall_header.tpl

#
#----[ FIND ]------------------------------------------ 
#

-->
</style>

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

<script language="Javascript" type="text/javascript">
<!--
function link_to_post(pid)
{
	temp = prompt( "{COPY}", "http://" + "{SERVER_NAME}" + "{SCRIPT_PATH}" + "viewtopic" + "." + "{PHPEX}" + "?" + "{POST_POST_URL}" + "=" + pid + "#" + pid );

	return false;
}
-->
</script>

#
#-----[ SAVE ALL FILES/CLOSE ]------------------------------------------ 
#
# EoM
Now the topic number in viewtopic_body is 12280001 instead of 1, 12280002 instead of 2, etc. If i insert the first code, the original in the install file of the birthday mod, everything change back ok but the problem about the greetings popup remains . What can i do?
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21161
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Birthdays

Post by RMcGirr83 »

Primy wrote:Terra ive found an other problem with the code change in page_header. Ive installed this mod for the topic number (relative to the topic id)

Now the topic number in viewtopic_body is 12280001 instead of 1, 12280002 instead of 2, etc. If i insert the first code, the original in the install file of the birthday mod, everything change back ok but the problem about the greetings popup remains . What can i do?
change this

Code: Select all

$start = gmdate('md0000',$start_time);
$end = gmdate('md9999',$current_time);
$in_range = $start > $end ?
   $userdata['user_birthday'] >= $start || $userdata['user_birthday'] <= $end :
   $userdata['user_birthday'] >= $start && $userdata['user_birthday'] <= $end;
if ( $userdata['birthday_greeting'] != 0 && ( $userdata['user_next_birthday'] < gmdate('Y',$current_time)+1 ) && $in_range )
to this

Code: Select all

$start_date = gmdate('md0000',$start_time);
$end_date = gmdate('md9999',$current_time);
$in_range = $start_date > $end_date ?
   $userdata['user_birthday'] >= $start_date || $userdata['user_birthday'] <= $end_date :
   $userdata['user_birthday'] >= $start_date && $userdata['user_birthday'] <= $end_date;
if ( $userdata['birthday_greeting'] != 0 && ( $userdata['user_next_birthday'] < gmdate('Y',$current_time)+1 ) && $in_range )
because the variable $start is used by the other mod...so just change it to $start_date
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions | My extensions are updated regularly on github
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored
Primy
Registered User
Posts: 109
Joined: Sat Dec 01, 2007 5:11 pm

Re: Birthdays

Post by Primy »

Thanks RMc!! Now it's ok, but it remains the problem that in the popup there's the index and not the greetings... :|

This is my page_header:

Code: Select all


<?php
/***************************************************************************
 *                              page_header.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: page_header.php,v 1.106.2.25 2005/10/30 15:17:14 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}	$language = $board_config['default_lang'];
	
	if (!file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_quiz.' . $phpEx))
	{
	$language = 'english';
	}
	
	include($phpbb_root_path . 'language/lang_' . $language . '/lang_quiz.' . $phpEx);

define('HEADER_INC', TRUE);


// begin phpBB2 Image Shack Integration
$image_shack = '<iframe src="http://www.imageshack.us/iframe.php?txtcolor=111111&type=blank&size=30" scrolling="no" allowtransparency="true" frameborder="0" width="280" height="85"></iframe>';
// end phpBB2 Image Shack Integration
//
// gzip_compression
//
$do_gzip_compress = FALSE;
if ( $board_config['gzip_compress'] )
{
	$phpver = phpversion();

	$useragent = (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) ? $HTTP_SERVER_VARS['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');

	if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
	{
		if ( extension_loaded('zlib') )
		{
			ob_start('ob_gzhandler');
		}
	}
	else if ( $phpver > '4.0' )
	{
		if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
		{
			if ( extension_loaded('zlib') )
			{
				$do_gzip_compress = TRUE;
				ob_start();
				ob_implicit_flush(0);

				header('Content-Encoding: gzip');
			}
		}
	}
}

//
// Parse and show the overall header.
//
$template->set_filenames(array(
	'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);

//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
	$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
	$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
else
{
	$u_login_logout = 'login.'.$phpEx;
	$l_login_logout = $lang['Login'];
}

$s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : '';


// Start add - Last visit MOD
if ( !$userdata['user_level']==MOD )
{
	$template->assign_block_vars('switch_user_is_not_moderator', array());
} else
{
	$template->assign_block_vars('switch_user_is_moderator', array());
}
// End add - Last visit MOD
//
// Get basic (usernames + totals) online
// situation
//
$logged_visible_online = 0;
$logged_hidden_online = 0;
$guests_online = 0;
$online_userlist = '';
$l_online_users = '';

if (defined('SHOW_ONLINE'))
{

	$ranks_sql= " SELECT * from " . WHOSONLINE_RANKS_TABLE . " ORDER BY whosonline_rank_order";
		if ( !($ranks_result = $db->sql_query($ranks_sql)) )
		{
			message_die(GENERAL_MESSAGE, 'Fatal Error into getting whos is online color');
		}

	while( $rank_row = $db->sql_fetchrow($ranks_result) )
	{
		if ($rank_row['whosonline_lang_key'] && isset($lang[ $rank_row['whosonline_rank_name'] ]))	
		$rank_name = $lang[ $rank_row['whosonline_rank_name'] ];
		else
		$rank_name = $rank_row['whosonline_rank_name'];

		$whosonline_color .= "[ <span style=\"color:". $rank_row['whosonline_rank_color'] ."\"><b>". $rank_name . "</b></span> ]&nbsp;&nbsp;";
		$id_color[ $rank_row['whosonline_rank_id'] ] = $rank_row['whosonline_rank_color'];
	}

	if ( $board_config['allow_group_index'] )
	{

	$group_user_sql= "SELECT ug.group_id, ug.user_id, g.group_color from " . USER_GROUP_TABLE . " ug," . GROUPS_TABLE . " g, " . WHOSONLINE_RANKS_TABLE . " wr
		WHERE  ug.group_id=g.group_id
			AND g.group_color <> '0' 
			AND ug.user_pending <> '1'
			AND wr.whosonline_rank_id = g.group_color
		ORDER BY wr.whosonline_rank_order DESC";

		if ( !($group_user_result = $db->sql_query($group_user_sql)) )
		{
			message_die(GENERAL_MESSAGE, 'Fatal Error into getting user in group');
		}

	while( $group_user_row = $db->sql_fetchrow($group_user_result) )
 	 {
	 	$user_group_color[ $group_user_row['user_id'] ] = $id_color[ $group_user_row['group_color'] ];
  	 }
	}
	       	$template->assign_vars(array(
      	    'WHOSONLINE_LEGEND' => "$whosonline_color")
			);	$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
	$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, u.user_whosonline_color, s.session_logged_in, s.session_ip
		FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
		WHERE u.user_id = s.session_user_id
			AND s.session_time >= ".( time() - 300 ) . "
			$user_forum_sql
		ORDER BY u.username ASC, s.session_ip ASC";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
	}

	$userlist_ary = array();
	$userlist_visible = array();

	$prev_user_id = 0;
	$prev_user_ip = $prev_session_ip = '';

	while( $row = $db->sql_fetchrow($result) )
	{
		// User is logged in and therefor not a guest
		if ( $row['session_logged_in'] )
		{
			// Skip multiple sessions for one user
			if ( $row['user_id'] != $prev_user_id )
			{
				$style_color = '';
								if ( $row['user_whosonline_color'] )
				{
					$row['username'] = '<b>' . $row['username'] . '</b>';
					$style_color .= 'style="color:' . $id_color[$row[user_whosonline_color]] . '"';
				}

				else if ( $row['user_level'] == ADMIN )
				{
					$row['username'] = '<b>' . $row['username'] . '</b>';
					$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
				}				else if ( $row['user_level'] == MOD )
				{
					$row['username'] = '<b>' . $row['username'] . '</b>';
					$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
				}

				else if ( $user_group_color[$row['user_id']] )
				{
					$row['username'] = '<b>' . $row['username'] . '</b>';
					$style_color .= 'style="color:' . $user_group_color[$row['user_id']] . '"';
				}				if ( $row['user_allow_viewonline'] )
				{
					$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
					$logged_visible_online++;
				}
				else
				{
					$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
					$logged_hidden_online++;
				}

				if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
				{
					$online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link;
				}
			}

			$prev_user_id = $row['user_id'];
		}
		else
		{
			// Skip multiple sessions for one user
			if ( $row['session_ip'] != $prev_session_ip )
			{
				$guests_online++;
			}
		}

		$prev_session_ip = $row['session_ip'];
	}
	$db->sql_freeresult($result);

	if ( empty($online_userlist) )
	{
		$online_userlist = $lang['None'];
	}
	$online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist;

	$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;

	if ( $total_online_users > $board_config['record_online_users'])
	{
		$board_config['record_online_users'] = $total_online_users;
		$board_config['record_online_date'] = time();

		$sql = "UPDATE " . CONFIG_TABLE . "
			SET config_value = '$total_online_users'
			WHERE config_name = 'record_online_users'";
		if ( !$db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not update online user record (nr of users)', '', __LINE__, __FILE__, $sql);
		}

		$sql = "UPDATE " . CONFIG_TABLE . "
			SET config_value = '" . $board_config['record_online_date'] . "'
			WHERE config_name = 'record_online_date'";
		if ( !$db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Could not update online user record (date)', '', __LINE__, __FILE__, $sql);
		}
	}

	if ( $total_online_users == 0 )
	{
		$l_t_user_s = $lang['Online_users_zero_total'];
	}
	else if ( $total_online_users == 1 )
	{
		$l_t_user_s = $lang['Online_user_total'];
	}
	else
	{
		$l_t_user_s = $lang['Online_users_total'];
	}

	if ( $logged_visible_online == 0 )
	{
		$l_r_user_s = $lang['Reg_users_zero_total'];
	}
	else if ( $logged_visible_online == 1 )
	{
		$l_r_user_s = $lang['Reg_user_total'];
	}
	else
	{
		$l_r_user_s = $lang['Reg_users_total'];
	}

	if ( $logged_hidden_online == 0 )
	{
		$l_h_user_s = $lang['Hidden_users_zero_total'];
	}
	else if ( $logged_hidden_online == 1 )
	{
		$l_h_user_s = $lang['Hidden_user_total'];
	}
	else
	{
		$l_h_user_s = $lang['Hidden_users_total'];
	}

	if ( $guests_online == 0 )
	{
		$l_g_user_s = $lang['Guest_users_zero_total'];
	}
	else if ( $guests_online == 1 )
	{
		$l_g_user_s = $lang['Guest_user_total'];
	}
	else
	{
		$l_g_user_s = $lang['Guest_users_total'];
	}

	$l_online_users = sprintf($l_t_user_s, $total_online_users);
	$l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
	$l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
	$l_online_users .= sprintf($l_g_user_s, $guests_online);
}

//
// Obtain number of new private messages
// if user is logged in
//
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
 
	if ( $userdata['user_new_privmsg'] )
	{
		$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
		$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);

		if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
		{
			$sql = "UPDATE " . USERS_TABLE . "
				SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
				WHERE user_id = " . $userdata['user_id'];
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
			}

			$s_privmsg_new = 1;
			$icon_pm = $images['pm_new_msg'];
		}
		else
		{
			$s_privmsg_new = 0;
			$icon_pm = $images['pm_new_msg'];
		}
	}
	else
	{
		$l_privmsgs_text = $lang['No_new_pm'];

		$s_privmsg_new = 0;
		$icon_pm = $images['pm_no_new_msg'];
	}

	if ( $userdata['user_unread_privmsg'] )
	{
		$l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
		$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
	}
	else
	{
		$l_privmsgs_text_unread = $lang['No_unread_pm'];
	}
}
else
{
	$icon_pm = $images['pm_no_new_msg'];
	$l_privmsgs_text = $lang['Login_check_pm'];
	$l_privmsgs_text_unread = '';
	$s_privmsg_new = 0;
}

//
// Generate HTML required for Mozilla Navigation bar
//
if (!isset($nav_links))
{
	$nav_links = array();
}

$nav_links_html = '';
$nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";
while( list($nav_item, $nav_array) = @each($nav_links) )
{
	if ( !empty($nav_array['url']) )
	{
		$nav_links_html .= sprintf($nav_link_proto, $nav_item, append_sid($nav_array['url']), $nav_array['title']);
	}
	else
	{
		// We have a nested array, used for items like <link rel='chapter'> that can occur more than once.
		while( list(,$nested_array) = each($nav_array) )
		{
			$nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']);
		}
	}
}

// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
$l_timezone = explode('.', $board_config['board_timezone']);
$l_timezone = (count($l_timezone) > 1 && $l_timezone[count($l_timezone)-1] != 0) ? $lang[sprintf('%.1f', $board_config['board_timezone'])] : $lang[number_format($board_config['board_timezone'])];
//
// The following assigns all _common_ variables that may be used at any point
// in a template.
//
$template->assign_vars(array(
		
'SERVER_NAME' => $board_config['server_name'],
	'SCRIPT_PATH' => $board_config['script_path'],
	'PHPEX' => $phpEx,
	'POST_POST_URL' => POST_POST_URL,
	'COPY' => $lang['Copy'],
'SITENAME' => $board_config['sitename'],
	'SITE_DESCRIPTION' => $board_config['site_desc'],
	'PAGE_TITLE' => $page_title,
	'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit),
	'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])),
	'TOTAL_USERS_ONLINE' => $l_online_users,
	'LOGGED_IN_USER_LIST' => $online_userlist,
	'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])),
	'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
	'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
	'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,

 
// begin phpBB2 Image Shack Integration
	'IMAGE_SHACK' => $image_shack,
// end phpBB2 Image Shack Integration	
'PRIVMSG_IMG' => $icon_pm,

	'L_USERNAME' => $lang['Username'],
	'L_PASSWORD' => $lang['Password'],
	'L_LOGIN_LOGOUT' => $l_login_logout,
	'L_LOGIN' => $lang['Login'],
	'L_LOG_ME_IN' => $lang['Log_me_in'],
	'L_AUTO_LOGIN' => $lang['Log_me_in'],
	'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
	'L_REGISTER' => $lang['Register'],
	'L_PROFILE' => $lang['Profile'],
	'L_SEARCH' => $lang['Search'],
	'L_TEAM' => $lang['Team_page'],
	'U_TEAM' => append_sid("team.$phpEx"),	'L_PRIVATEMSGS' => $lang['Private_Messages'],
	'L_WHO_IS_ONLINE' => $lang['Who_is_Online'],
	'L_MEMBERLIST' => $lang['Memberlist'],
	'L_FAQ' => $lang['FAQ'],
	'L_USERGROUPS' => $lang['Usergroups'],
	'L_SEARCH_NEW' => $lang['Search_new'],
	'L_SEARCH_UNANSWERED' => $lang['Search_unanswered'],
	'L_SEARCH_SELF' => $lang['Search_your_posts'],
	'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>'),
	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),

	'L_QUIZ' => $lang['Quiz_quizzes'],
	'U_QUIZ' => append_sid("quiz.$phpEx"),	'U_SEARCH_UNANSWERED' => append_sid('search.'.$phpEx.'?search_id=unanswered'),
	'U_SEARCH_SELF' => append_sid('search.'.$phpEx.'?search_id=egosearch'),
	'U_SEARCH_NEW' => append_sid('search.'.$phpEx.'?search_id=newposts'),
	'U_INDEX' => append_sid('index.'.$phpEx),
	'U_REGISTER' => append_sid('profile.'.$phpEx.'?mode=register'),
	'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'),
	'U_PRIVATEMSGS' => append_sid('privmsg.'.$phpEx.'?folder=inbox'),
	'U_PRIVATEMSGS_POPUP' => append_sid('privmsg.'.$phpEx.'?mode=newpm'),
	'U_BIRTHDAYS_POPUP' => append_sid('profile.'.$phpEx.'?mode=birthday_popup'),	'U_SEARCH' => append_sid('search.'.$phpEx),
	'U_MEMBERLIST' => append_sid('memberlist.'.$phpEx),
	'U_RABBITOSHI' => append_sid('rabbitoshi.'.$phpEx),
	'L_RABBITOSHI' => $board_config['rabbitoshi_name'],
	'L_RABBITOSHI_POSTS' => $lang['Rabbitoshi_topic'],	'U_MODCP' => append_sid('modcp.'.$phpEx),
	'U_FAQ' => append_sid('faq.'.$phpEx),
	'U_VIEWONLINE' => append_sid('viewonline.'.$phpEx),
	'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
	'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),

	// Mighty Gorgon - Full Album Pack - BEGIN
	'L_ALBUM' => $lang['Album'],
	'U_ALBUM' => append_sid('album.'.$phpEx),
	'L_PIC_NAME' => $lang['Pic_Name'],
	'L_DESCRIPTION' => $lang['Description'],
	'L_GO' => $lang['Go'],
	'L_SEARCH_CONTENTS' => $lang['Search_Contents'],
	'L_SEARCH_MATCHES' => $lang['Search_Matches'],
	// Mighty Gorgon - Full Album Pack - END	'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
	'S_CONTENT_ENCODING' => $lang['ENCODING'],
	'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
	'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
	'S_TIMEZONE' => sprintf($lang['All_times'], $l_timezone),
	'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),

	'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
	'T_BODY_BACKGROUND' => $theme['body_background'],
	'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'],
	'T_BODY_TEXT' => '#'.$theme['body_text'],
	'T_BODY_LINK' => '#'.$theme['body_link'],
	'T_BODY_VLINK' => '#'.$theme['body_vlink'],
	'T_BODY_ALINK' => '#'.$theme['body_alink'],
	'T_BODY_HLINK' => '#'.$theme['body_hlink'],
	'T_TR_COLOR1' => '#'.$theme['tr_color1'],
	'T_TR_COLOR2' => '#'.$theme['tr_color2'],
	'T_TR_COLOR3' => '#'.$theme['tr_color3'],
	'T_TR_CLASS1' => $theme['tr_class1'],
	'T_TR_CLASS2' => $theme['tr_class2'],
	'T_TR_CLASS3' => $theme['tr_class3'],
	'T_TH_COLOR1' => '#'.$theme['th_color1'],
	'T_TH_COLOR2' => '#'.$theme['th_color2'],
	'T_TH_COLOR3' => '#'.$theme['th_color3'],
	'T_TH_CLASS1' => $theme['th_class1'],
	'T_TH_CLASS2' => $theme['th_class2'],
	'T_TH_CLASS3' => $theme['th_class3'],
	'T_TD_COLOR1' => '#'.$theme['td_color1'],
	'T_TD_COLOR2' => '#'.$theme['td_color2'],
	'T_TD_COLOR3' => '#'.$theme['td_color3'],
	'T_TD_CLASS1' => $theme['td_class1'],
	'T_TD_CLASS2' => $theme['td_class2'],
	'T_TD_CLASS3' => $theme['td_class3'],
	'T_FONTFACE1' => $theme['fontface1'],
	'T_FONTFACE2' => $theme['fontface2'],
	'T_FONTFACE3' => $theme['fontface3'],
	'T_FONTSIZE1' => $theme['fontsize1'],
	'T_FONTSIZE2' => $theme['fontsize2'],
	'T_FONTSIZE3' => $theme['fontsize3'],
	'T_FONTCOLOR1' => '#'.$theme['fontcolor1'],
	'T_FONTCOLOR2' => '#'.$theme['fontcolor2'],
	'T_FONTCOLOR3' => '#'.$theme['fontcolor3'],
	'T_SPAN_CLASS1' => $theme['span_class1'],
	'T_SPAN_CLASS2' => $theme['span_class2'],
	'T_SPAN_CLASS3' => $theme['span_class3'],

	'NAV_LINKS' => $nav_links_html)
);

//
// Login box?
//
if ( !$userdata['session_logged_in'] )
{
	$template->assign_block_vars('switch_user_logged_out', array());
	//
	// Allow autologin?
	//
	if (!isset($board_config['allow_autologin']) || $board_config['allow_autologin'] )
	{
		$template->assign_block_vars('switch_allow_autologin', array());
		$template->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array());
	}
}
else
{
	$template->assign_block_vars('switch_user_logged_in', array());

	if ( !empty($userdata['user_popup_pm']) )
	{
		$template->assign_block_vars('switch_enable_pm_popup', array());
	}
}

$current_time = time() + (3600 * $board_config['board_timezone']);
$start_time = ( $board_config['bday_lookahead'] > 0 ) ? strtotime('-'.$board_config['bday_lookahead'].' day') : $current_time;

$start_date = gmdate('md0000',$start_time);
$end_date = gmdate('md9999',$current_time);
$in_range = $start_date > $end_date ?
   $userdata['user_birthday'] >= $start_date || $userdata['user_birthday'] <= $end_date :
   $userdata['user_birthday'] >= $start_date && $userdata['user_birthday'] <= $end_date;
if ( $userdata['birthday_greeting'] != 0 && ( $userdata['user_next_birthday'] < gmdate('Y',$current_time)+1 ) && $in_range )
{
	$sql = "UPDATE ".USERS_TABLE. "
		SET user_next_birthday = ".(gmdate('Y',$current_time)+1)."
		WHERE user_id = ".$userdata['user_id'];

	if ( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Could not update birthday information', '', __LINE__, __FILE__, $sql);
	}

	switch ( $userdata['birthday_greeting'] )
	{
		case BIRTHDAY_EMAIL:
			include($phpbb_root_path . 'includes/emailer.'.$phpEx);
			$emailer = new emailer($board_config['smtp_delivery']);

			$emailer->from($board_config['board_email']);
			$emailer->replyto($board_config['board_email']);

			$emailer->use_template('user_birthday',stripslashes($userdata['user_lang']));
			$emailer->set_subject($lang['View_Birthdays']);
			$emailer->email_address($userdata['user_email']);

			$emailer->assign_vars(array(
				'SITENAME' => $board_config['sitename'],
				'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '')
			);

			$emailer->send();
			$emailer->reset();

			break;
		case BIRTHDAY_PM:
			// PM support is not currently enabled.
			break;
		case BIRTHDAY_POPUP:
			$template->assign_block_vars('switch_birthday_popup',array());
	}
}
// Add no-cache control for cookies if they are set
//$c_no_cache = (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_data'])) ? 'no-cache="set-cookie", ' : '';

// Work around for "current" Apache 2 + PHP module which seems to not
// cope with private cache control setting
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
{
	header ('Cache-Control: no-cache, pre-check=0, post-check=0');
}
else
{
	header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
header ('Expires: 0');
header ('Pragma: no-cache');

$template->pparse('overall_header');

?>
Ive tried many times to restart the code's modify in page_header, but the problem remains...Anyway thanks a lot for ur help! At leass ive learned an other thing about the codes! :)

P. from Italy
TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Birthdays

Post by TerraFrost »

1. After having looked at the pictures... it's possible. I'm not particurarly interested in doing it, myself, but maybe someone else will pick up the torch, so to speak, and go with it :)

And who knows - maybe I'll be willing to do it at some point, too. Then again, though, maybe I won't - I really can't say.

2. I don't consider it to be a serious problem. If you do, just change the $lang['DATE_FORMAT'] thing in lang_main.php

3. You'll have to give me an FTP account to resolve the index appearing in the popup. I have no clue what could be causing it.
bigshooteer
Registered User
Posts: 14
Joined: Wed Feb 01, 2006 3:18 pm

Re: Birthdays

Post by bigshooteer »

I'm sure this has been asked in the 197 pages but........can this be installed via EasyMod? I have tried, but I keep getting this critical error:

Code: Select all

Critical Error

FIND FAILED: In file [templates/subSilver_mobile/index_body.tpl] could not find:

<tr> 
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td> 
</tr>


I have a template installed called subsilver_mobile for users on mobile phones, this birthday mod says it only modifies these files:

Code: Select all

##      admin/admin_board.php
##      admin/admin_users.php
##      includes/constants.php
##      includes/functions_selects.php
##      includes/page_header.php
##      includes/template.php
##      includes/usercp_avatar.php
##      includes/usercp_register.php
##      includes/usercp_viewprofile.php
##      language/lang_english/lang_admin.php
##      language/lang_english/lang_main.php
##      templates/subSilver/admin/board_config_body.tpl
##      templates/subSilver/admin/user_edit_body.tpl
##      templates/subSilver/index_body.tpl
##      templates/subSilver/memberlist_body.tpl
##      templates/subSilver/overall_header.tpl
##      templates/subSilver/profile_add_body.tpl
##      templates/subSilver/profile_view_body.tpl
##      templates/subSilver/viewtopic_body.tpl
##      index.php
##      memberlist.php
##      profile.php
##      privmsg.php
##      viewtopic.php
so why would it be trying to open & modify in templates/subSilver_mobile? I've even tried deleting the subSilver_mobile template, then run this mod, but something is still referrencing to subsilver_mobile and I get a similar error.

Any help would be appreciated!
Primy
Registered User
Posts: 109
Joined: Sat Dec 01, 2007 5:11 pm

Re: Birthdays

Post by Primy »

Hi Terra! Thanks again for ur support!
2. I don't consider it to be a serious problem. If you do, just change the $lang['DATE_FORMAT'] thing in lang_main.php
Ok, this is good! I dont know how to do, if u can tell me what i must change in that part, ill very grateful to u. Ive readed ur link about this problem but ive language problem. Anyway, it's important that it isnt a serious problem ;)
3. You'll have to give me an FTP account to resolve the index appearing in the popup. I have no clue what could be causing it.
I would willingly do it Terra, but at the moment im working in local and ive not ftp. If u tell me at least what file i must check, maybe i could solve without annoying u :) In page_header ive checked many times but all seems ok. What could be the problems and where?

Thanks for all!
User avatar
Sandie437
Registered User
Posts: 12
Joined: Sun Jul 30, 2006 5:23 pm
Contact:

Re: Birthdays

Post by Sandie437 »

I have installed this mod and have an unusual problem.

It works and I get no errors.

BUT...In the profile there is no place to enter birthdays. There is a drop down menu about how much to display. Just no place to actually put in the birthday data.

In ACP there is in each persons profiles. But not in the actual profiles for members.

Hope I have explained this properly.
Peter77sx
Registered User
Posts: 3259
Joined: Wed Nov 09, 2005 2:51 pm

Re: Birthdays

Post by Peter77sx »

In your ACP settings, if you have Disallow Date of Birth Changes checked to Yes, then you will not see that entry space anymore... even as an Admin. See if that's the problem.
User avatar
Sandie437
Registered User
Posts: 12
Joined: Sun Jul 30, 2006 5:23 pm
Contact:

Re: Birthdays

Post by Sandie437 »

Have checked that and registered a new account and even as a new registration I never saw a enter birthdate part.

Just a what to show option....
User avatar
Sandie437
Registered User
Posts: 12
Joined: Sun Jul 30, 2006 5:23 pm
Contact:

Re: Birthdays

Post by Sandie437 »

Oops. sorry to do this. But somehow it has righted itself and I can now see it.

I am not sure entirely what I did...Apart from ticking that it was compulsory to have a birthdate.

That seems to have made it show it up.

Thanks for an awesome mod.
Post Reply

Return to “[2.0.x] MOD Database Releases”