Email on Birthday

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

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
damienhbg
Registered User
Posts: 255
Joined: Thu May 08, 2008 8:45 pm
Location: Central PA
Contact:

Re: Email on Birthday

Post by damienhbg » Sat Oct 04, 2008 10:17 pm

I'm going over my edits, and one of the edits for the index.php file specify around line 94...

however, i remember having trouble with this, this is the code from my index.php file between lines 81 and 160... could someone please look it over see if i have it correct, thanks

Code: Select all

}
$result = $db->sql_query($sql);

$legend = '';
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';

	if ($row['group_name'] == 'BOTS')
	{
		$legend .= (($legend != '') ? ', ' : '') . '<span' . $colour_text . '>' . $user->lang['G_BOTS'] . '</span>';
	}
	else
	{
		$legend .= (($legend != '') ? ', ' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
	}
}
$db->sql_freeresult($result);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = array();

if ($config['load_birthdays'] && $config['allow_birthdays'])
{
	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
	$sql = 'SELECT user_id, username, user_colour, user_birthday, user_email, user_lang, user_notify_type, user_jabber 
		FROM ' . USERS_TABLE . "
		WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
			AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		if ($age = (int) substr($row['user_birthday'], -4))
		{
			$birthday_list .= ' (' . ($now['year'] - $age) . ')';
		}
			if (trim($row['user_email']) && $config['birthday_emails'])
		{
			$bd_list_ary[] = array(
				'method'	=> $row['user_notify_type'],
				'email'		=> $row['user_email'],
				'jabber'	=> $row['user_jabber'],
				'name'		=> $row['username'],
				'lang'		=> $row['user_lang']
			);
		}
	}
	$db->sql_freeresult($result);

	$nowvar = getdate(time() + ($config['board_timezone'] + $config['board_dst'])*3600 - date('Z'));

	if ( sizeof($bd_list_ary) && $config['birthday_run'] < mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']) && $config['birthday_emails'] )
   {
   set_config('birthday_run', mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']));

   include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
	$messenger = new messenger();

	foreach ($bd_list_ary as $pos => $addr)
	{
		$messenger->template('birthday_email', $addr['lang']);

		$messenger->to($addr['email'], $addr['name']);
		$messenger->im($addr['jabber'], $addr['name']);

		$messenger->assign_vars(array(
			'USERNAME'		=> htmlspecialchars_decode($addr['name'])
		));

		$messenger->send($addr['method']);
	}
	unset($bd_list_ary);

	$messenger->save_queue();
	unset($messenger);
	}
	$cache->destroy('config');
	


}
My coolest mods: My Page; User Reminder; PJIRC CHAT

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Re: Email on Birthday

Post by lefty74 » Sun Oct 05, 2008 9:23 am

had a quick look and it seems to look exactly like the index.php from my testboard.
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

damienhbg
Registered User
Posts: 255
Joined: Thu May 08, 2008 8:45 pm
Location: Central PA
Contact:

Re: Email on Birthday

Post by damienhbg » Sun Oct 05, 2008 9:34 pm

thanks lefty, i'll continue over the edits now ;) look for anything else that might not look right ;) :geek: thanks again
My coolest mods: My Page; User Reminder; PJIRC CHAT

User avatar
Sunka
Registered User
Posts: 566
Joined: Wed Mar 26, 2008 2:48 pm
Location: Croatia, Zvoneca

Re: Email on Birthday

Post by Sunka » Sun Oct 12, 2008 5:00 pm

Nice MOD lefty :mrgreen:

inayan
Registered User
Posts: 41
Joined: Fri Apr 13, 2007 9:25 pm
Location: Knoxville, TN

Re: Email on Birthday

Post by inayan » Thu Oct 16, 2008 6:24 pm

I attempted to install this last night and did something wrong.

I tried back tracking all the changes I made and thought I got everything back to where it was when I started but... this morning when accessing only certain parts of the ACP (such as Board Settings, Board Features etc) I get this error:

[phpBB Debug] PHP Notice: in file /adm/index.php on line 150: Cannot modify header information - headers already sent by (output started at /includes/acp/acp_board.php:834)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 152: Cannot modify header information - headers already sent by (output started at /includes/acp/acp_board.php:834)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 153: Cannot modify header information - headers already sent by (output started at /includes/acp/acp_board.php:834)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 154: Cannot modify header information - headers already sent by (output started at /includes/acp/acp_board.php:834)


Can anyone help me out?

inayan
Registered User
Posts: 41
Joined: Fri Apr 13, 2007 9:25 pm
Location: Knoxville, TN

Re: Email on Birthday

Post by inayan » Thu Oct 16, 2008 7:26 pm

Never mind - I uploaded a fresh acp_board.php and all seems well now.

Thank you!

kickasgamer
Registered User
Posts: 32
Joined: Tue Jul 04, 2006 12:37 pm
Location: Belgium |GMT+1|

Re: Email on Birthday

Post by kickasgamer » Tue Dec 02, 2008 3:00 pm

when i try to update my DB with this query:

INSERT INTO phpbb_config (config_name, config_value) VALUES ('birthday_emails', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('birthday_run', '');

but i'm getting this error:

#1062 - Duplicate entry 'birthday_emails' for key 1

how do i solve this ?

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Re: Email on Birthday

Post by lefty74 » Tue Dec 02, 2008 5:57 pm

please purge your cache. you should not need to add this to your database anymore as it appears its already in there.
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

TwiztedIndian
Registered User
Posts: 53
Joined: Sat Dec 27, 2008 8:25 pm

Re: Email on Birthday

Post by TwiztedIndian » Sun Dec 28, 2008 10:43 pm

I am running into an issue with your mod and it seems to be centered around this code from your mod

Code: Select all

		if (trim($row['user_email']) && $config['birthday_emails'])
		{
			$bd_list_ary[] = array(
				'method'	=> $row['user_notify_type'],
				'email'		=> $row['user_email'],
				'jabber'	=> $row['user_jabber'],
				'name'		=> $row['username'],
				'lang'		=> $row['user_lang']
			);
		}
	}
	$db->sql_freeresult($result);

	$nowvar = getdate(time() + ($config['board_timezone'] + $config['board_dst'])*3600 - date('Z'));

	if ( sizeof($bd_list_ary) && $config['birthday_run'] < mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']) && $config['birthday_emails'] )
   {
   set_config('birthday_run', mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']));

   include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
	$messenger = new messenger();

	foreach ($bd_list_ary as $pos => $addr)
	{
		$messenger->template('birthday_email', $addr['lang']);

		$messenger->to($addr['email'], $addr['name']);
		$messenger->im($addr['jabber'], $addr['name']);

		$messenger->assign_vars(array(
			'USERNAME'		=> htmlspecialchars_decode($addr['name'])
		));

		$messenger->send($addr['method']);
	}
	unset($bd_list_ary);

	$messenger->save_queue();
	unset($messenger);
	}
	$cache->destroy('config');
I do just as the install instructions tell me to and replace this code snippit below with the above code.

Code: Select all

	}
	$db->sql_freeresult($result);
The problem I am having is this. I am running a portal called bbdkp which consists of several core file edits and using their index.php and renaming the original forum index.php to forum.php

After installing your mod it seemed fine and you could navigate from the main index.php (portal) to forum.php (the forum secion) and it looks just fine. BUT, if you refresh while you are on the forum (forum.php) the page looses all formating from the stylesheet and such. If I remove the first code above (from your mod) from forum.php it works fine OR if I leave the code in and always navigate to the forum.php from the portal index.php it seems to work fine until you refresh/reload the page while still on forum.php... I can't seem to figure out why it is happening but if someone could please help me with this I would appreciate it.

P.S. I have purged the cache many times and it HAS to be something with the code above thats not working correctly...

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Re: Email on Birthday

Post by lefty74 » Sun Dec 28, 2008 11:15 pm

could you pse put what you have as code in your file (after the edit).
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

TwiztedIndian
Registered User
Posts: 53
Joined: Sat Dec 27, 2008 8:25 pm

Re: Email on Birthday

Post by TwiztedIndian » Mon Dec 29, 2008 1:10 am

This is my portals index.php

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 8638 2008-06-09 17:11:26Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*
*	Powered by EQdkp © 2003 The EQdkp Project Team
*
*	If you use this software and find it to be useful, we ask that you
*	retain the copyright notice below.  While not required for free use,
*	it will help build interest in the EQdkp project.
*
*
*	Integrated by:
*	bbDKP
*	http://code.google.com/p/bbdkp/
*
*	$Id: index.php,v 1.0 2007/05/19 18:45:33 ippehe Exp $
*	$Id: index.php,v 1.2 2008/11/26 Sajaki $
*
*******************************/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);

// bossprogress plugin
$bpshow = false;
$bp1 = 'includesdkp/bossprogress/bp_functions.php';
$bp2 = 'includesdkp/bossprogress/bp_block.php';
$bp3 = 'includesdkp/bossprogress/extfunc.php';
if (file_exists($bp1) && file_exists($bp2) && file_exists($bp3))
{
	$bpshow = true;
	require ($bp1);
	require ($bp2);
	include_once($bp3);
}

// Start session management
$user->session_begin();
$auth->acl($user->data);
include($phpbb_root_path . 'menu.' . $phpEx);
$user->add_lang(array('mods/bossbase'));


// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts	= $config['num_posts'];
$total_topics	= $config['num_topics'];
$total_users	= $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend = 1
		ORDER BY group_name ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend = 1
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = '';
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';

	if ($row['group_name'] == 'BOTS')
	{
		$legend .= (($legend != '') ? ', ' : '') . '<span' . $colour_text . '>' . $user->lang['G_BOTS'] . '</span>';
	}
	else
	{
		$legend .= (($legend != '') ? ', ' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
	}
}
$db->sql_freeresult($result);

// Generate birthday list if required ...
$birthday_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
	$sql = 'SELECT user_id, username, user_colour, user_birthday
		FROM ' . USERS_TABLE . "
		WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
			AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

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

//-- mod: top five ---------------------------------------------------------//
	include($phpbb_root_path . 'includes/top_five.' . $phpEx);
//-- end: top five ---------------------------------------------------------//

// Assign index specific vars
$template->assign_vars(array(
	'TOTAL_POSTS'	=> sprintf($user->lang[$l_total_post_s], $total_posts),
	'TOTAL_TOPICS'	=> sprintf($user->lang[$l_total_topic_s], $total_topics),
	'TOTAL_USERS'	=> sprintf($user->lang[$l_total_user_s], $total_users),
	'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),

	'LEGEND'		=> $legend,
	'BIRTHDAY_LIST'	=> $birthday_list,

	'FORUM_IMG'				=> $user->img('forum_read', 'NO_NEW_POSTS'),
	'FORUM_NEW_IMG'			=> $user->img('forum_unread', 'NEW_POSTS'),
	'FORUM_LOCKED_IMG'		=> $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
	'FORUM_NEW_LOCKED_IMG'	=> $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

	'S_LOGIN_ACTION'			=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,

	'U_MARK_FORUMS'		=> ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}forum.$phpEx", 'mark=forums') : '',
	'U_MCP'				=> ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);

// News
$sql = 'SELECT *
        FROM ' . TOPICS_TABLE . ' t
		WHERE forum_id = ' . $forum_id . '
        ORDER BY  topic_time DESC
        LIMIT 0,' . $n_news . ' ';

$result = $db->sql_query($sql);
$previous_date = null;
$bbcode_bitfield = $force_encoding = '';

while ( $news = $db->sql_fetchrow($result) )
{
	$template->assign_block_vars('date_row', array(
		'DATE' => date('F j, Y', $news['topic_time'])
	));

	$sql2 = 'SELECT *
			FROM ' . POSTS_TABLE . ' n
			WHERE topic_id =  '. $news["topic_id"] .' AND post_time =  '. $news["topic_time"] .' ';
	$result2 = $db->sql_query($sql2);

	while ( $row = $db->sql_fetchrow($result2) )
    {
		$message = $row['post_text'];
		// Second parse bbcode here
		include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
		$bbcode = new bbcode(base64_encode($bbcode_bitfield));

		$message = censor_text($row['post_text']);
		$message = str_replace("\n", '<br />', $message);

		if ($row['bbcode_bitfield'])
		{
			$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
		}
			$message = bbcode_nl2br($message);
			$message = smiley_text($message);
			$message = itemstats_parse($message);
	}


	$template->assign_block_vars('date_row.news_row', array(
		'HEADLINE' 	=> stripslashes($news['topic_title']),
		'AUTHOR' 	=> $news['topic_first_poster_name'],
		'TIME' 	=> date('h:ia T', $news['topic_time']),
		'MESSAGE' 	=> $message,
		'LINK' 	=> 'viewtopic.php?f='. $n_news .'&t=' .$news['topic_id'],
		'MORE' 	=> $news['topic_replies']
	));
}
$db->sql_freeresult($result);

$template->assign_block_vars('uusi', array(
	'MORE' => sprintf('viewforum.php?f='.$n_news .'')
));

/********* bossprogress block *************/
if ($bpshow == true)
{

	$bb_conf = bb_get_parse_config();
	$bb_pzone = bb_get_parse_zone();
	$bb_pboss = bb_get_parse_boss();

	$bp_conf = bp_get_config();

	$bzone = bb_get_bzone();
	$sbzone = bp_get_visible_bzone($bzone, $bp_conf);

	# Get data from database
	####################################################
	if ($bb_conf['source'] == 'database'){
		$data = bp_init_data_array($bzone);
		$data = bp_fetch_bzi($sbzone, $data, $bb_conf, $bb_pzone, $bb_pboss);
	}
	if ($bb_conf['source'] == 'offsets'){
		$bb_boffs = bb_get_boss_offsets();
		$bb_zoffs = bb_get_zone_offsets();
		foreach($bzone as $zone => $bosses){
			$data[$zone]['fvd'] = $bb_zoffs[$zone]['fd'];
			$data[$zone]['lvd'] = $bb_zoffs[$zone]['ld'];
			$data[$zone]['vc'] = $bb_zoffs[$zone]['co'];
			foreach($bosses as $boss){
				$data[$zone]['bosses'][$boss]['fkd'] = $bb_boffs[$boss]['fd'];
				$data[$zone]['bosses'][$boss]['lkd'] = $bb_boffs[$boss]['ld'];
				$data[$zone]['bosses'][$boss]['kc'] = $bb_boffs[$boss]['co'];
			}
		}
	}
	if ($bb_conf['source'] == 'both'){
		$bb_boffs = bb_get_boss_offsets();
		$bb_zoffs = bb_get_zone_offsets();
		foreach($bzone as $zone => $bosses){
			$data[$zone]['fvd'] = $bb_zoffs[$zone]['fd'];
			$data[$zone]['lvd'] = $bb_zoffs[$zone]['ld'];
			$data[$zone]['vc'] = $bb_zoffs[$zone]['co'];
			foreach($bosses as $boss){
				$data[$zone]['bosses'][$boss]['fkd'] = $bb_boffs[$boss]['fd'];
				$data[$zone]['bosses'][$boss]['lkd'] = $bb_boffs[$boss]['ld'];
				$data[$zone]['bosses'][$boss]['kc'] = $bb_boffs[$boss]['co'];
			}
		}
		$data = bp_fetch_bzi($sbzone, $data, $bb_conf, $bb_pzone, $bb_pboss);
	}


	switch ($bp_conf['style'])
	{
		case 0:	$bpout = bp_block_html_get_zoneinfo_bp($bp_conf, $data, $sbzone);
				break;
		case 1: $bpout = bp_html_get_zoneinfo_bps($bp_conf, $data, $sbzone);
				break;
		case 2: $bpout = bp_html_get_zoneinfo_rp2r($bp_conf, $data, $sbzone);
				break;
		case 3: $bpout = bp_html_get_zoneinfo_rp3r($bp_conf, $data, $sbzone);
				break;
	}

}
else
{
	 $bpout = '';
}


/*  end bossprogress block ***/

$template->assign_vars(array(
	'GAME' => $config['default_game'],
	'BPBLOCK' => $bpout,
	'S_BPSHOW' => $bpshow,

));


$title = 'News';
// Output page
page_header($title);

$template->set_filenames(array(
	'body' => 'dkp/news_body.html')
);

page_footer();

?>
This is the forum index.php (now named forum.php for the portal)

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 8987 2008-10-09 14:17:02Z acydburn $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

display_forums('', $config['load_moderators']);

// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts	= $config['num_posts'];
$total_topics	= $config['num_topics'];
$total_users	= $config['num_users'];

$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';

// Grab group details for legend display
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
	$sql = 'SELECT group_id, group_name, group_colour, group_type
		FROM ' . GROUPS_TABLE . '
		WHERE group_legend = 1
		ORDER BY group_name ASC';
}
else
{
	$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
		FROM ' . GROUPS_TABLE . ' g
		LEFT JOIN ' . USER_GROUP_TABLE . ' ug
			ON (
				g.group_id = ug.group_id
				AND ug.user_id = ' . $user->data['user_id'] . '
				AND ug.user_pending = 0
			)
		WHERE g.group_legend = 1
			AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
		ORDER BY g.group_name ASC';
}
$result = $db->sql_query($sql);

$legend = array();
while ($row = $db->sql_fetchrow($result))
{
	$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
	$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];

	if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
	{
		$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
	}
	else
	{
		$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
	}
}
$db->sql_freeresult($result);

$legend = implode(', ', $legend);

// Generate birthday list if required ...
$birthday_list = '';
$bd_list_ary = array();
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
	$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
	$sql = 'SELECT user_id, username, user_colour, user_birthday, user_email, user_lang,user_notify_type, user_jabber
		FROM ' . USERS_TABLE . "
		WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
			AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
	$result = $db->sql_query($sql);

	while ($row = $db->sql_fetchrow($result))
	{
		$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);

		if ($age = (int) substr($row['user_birthday'], -4))
		{
			$birthday_list .= ' (' . ($now['year'] - $age) . ')';
		}
	if (trim($row['user_email']) && $config['birthday_emails'])
			{
				$bd_list_ary[] = array(
					'method'	=> $row['user_notify_type'],
					'email'		=> $row['user_email'],
					'jabber'	=> $row['user_jabber'],
					'name'		=> $row['username'],
					'lang'		=> $row['user_lang']
				);
			}
		}
		$db->sql_freeresult($result);

		$nowvar = getdate(time() + ($config['board_timezone'] + $config['board_dst'])*3600 - date('Z'));

		if ( sizeof($bd_list_ary) && $config['birthday_run'] < mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']) && $config['birthday_emails'] )
	   {
	   set_config('birthday_run', mktime(0, 0, 0, $nowvar['mon'], $nowvar['mday'], $nowvar['year']));

	   include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
		$messenger = new messenger();

		foreach ($bd_list_ary as $pos => $addr)
		{
			$messenger->template('birthday_email', $addr['lang']);

			$messenger->to($addr['email'], $addr['name']);
			$messenger->im($addr['jabber'], $addr['name']);

			$messenger->assign_vars(array(
				'USERNAME'		=> htmlspecialchars_decode($addr['name'])
			));

			$messenger->send($addr['method']);
		}
		unset($bd_list_ary);

		$messenger->save_queue();
		unset($messenger);
		}
		$cache->destroy('config');

}

//-- mod: top five ---------------------------------------------------------//
	include($phpbb_root_path . 'includes/top_five.' . $phpEx);
//-- end: top five ---------------------------------------------------------//

// Assign index specific vars
$template->assign_vars(array(
	'TOTAL_POSTS'	=> sprintf($user->lang[$l_total_post_s], $total_posts),
	'TOTAL_TOPICS'	=> sprintf($user->lang[$l_total_topic_s], $total_topics),
	'TOTAL_USERS'	=> sprintf($user->lang[$l_total_user_s], $total_users),
	'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),

	'LEGEND'		=> $legend,
	'BIRTHDAY_LIST'	=> $birthday_list,

	'FORUM_IMG'				=> $user->img('forum_read', 'NO_NEW_POSTS'),
	'FORUM_NEW_IMG'			=> $user->img('forum_unread', 'NEW_POSTS'),
	'FORUM_LOCKED_IMG'		=> $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
	'FORUM_NEW_LOCKED_IMG'	=> $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),

	'S_LOGIN_ACTION'			=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
	'S_DISPLAY_BIRTHDAY_LIST'	=> ($config['load_birthdays']) ? true : false,

	'U_MARK_FORUMS'		=> ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("forum.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
  	'U_MCP'				=> ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);

// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
	'body' => 'index_body.html')
);

page_footer();

?>
Hope you can make heads or tails of it because I sure cant...

User avatar
lefty74
Registered User
Posts: 3649
Joined: Wed Sep 14, 2005 8:26 pm
Location: NL
Contact:

Re: Email on Birthday

Post by lefty74 » Mon Dec 29, 2008 10:56 am

i have no idea why you experience this to be honest but looking at the files you can also put the code in your index.php, it should not really matter.
lefty74
zoocrew.eu - help us save our wildlife
My MODS | Due to lack of time I unfortunately am unable to work on my mods anymore, anyone who has ideas to improve them and would like to take any of them over, please PM me.

TwiztedIndian
Registered User
Posts: 53
Joined: Sat Dec 27, 2008 8:25 pm

Re: Email on Birthday

Post by TwiztedIndian » Mon Dec 29, 2008 12:32 pm

I am not sure how that would fix it actually since the problem is when you refresh the page in the forums is when the problem occurs but I will try putting your code into the portal to see what it does later this evening.

photosa
Registered User
Posts: 214
Joined: Wed Mar 23, 2005 2:35 pm
Location: South Africa
Contact:

Re: Email on Birthday

Post by photosa » Thu Jan 22, 2009 5:51 am

Does this MOD work in 3.0.4 ?

User avatar
DragonMaster1
Registered User
Posts: 994
Joined: Tue Aug 17, 2004 11:04 am
Name: Terry
Contact:

Re: Email on Birthday

Post by DragonMaster1 » Thu Jan 22, 2009 6:06 am

yes and very well

Locked

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