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
User avatar
mcdanielnc89
Registered User
Posts: 703
Joined: Tue Feb 06, 2007 10:49 pm
Location: Missouri
Contact:

Re: Email on Birthday

Post by mcdanielnc89 » Sun May 04, 2008 9:00 am

Awesome, Thank You very much. Is there a place to see all of the MODS you've released?

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 May 04, 2008 9:43 am

They are all here on phpbb.com.

if you want to see them all together you can have a look at my testboard and login as test user,the mod database will show the mods installed.

alternatively, you can also find them on my own site.
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.

User avatar
mcdanielnc89
Registered User
Posts: 703
Joined: Tue Feb 06, 2007 10:49 pm
Location: Missouri
Contact:

Re: Email on Birthday

Post by mcdanielnc89 » Sun May 04, 2008 7:16 pm

lefty74 wrote:They are all here on phpbb.com.

if you want to see them all together you can have a look at my testboard and login as test user,the mod database will show the mods installed.

alternatively, you can also find them on my own site.
Thanks! :D

User avatar
mcdanielnc89
Registered User
Posts: 703
Joined: Tue Feb 06, 2007 10:49 pm
Location: Missouri
Contact:

Re: Email on Birthday

Post by mcdanielnc89 » Mon May 05, 2008 1:58 am

Hwo do I change the Birthday Email Message?

Anyasha
Registered User
Posts: 704
Joined: Mon Aug 07, 2006 4:02 am
Name: Anyasha

Re: Email on Birthday

Post by Anyasha » Mon May 05, 2008 6:15 am

mcdaniels, open the "birthday_email.txt" file in language/en/email and edit to your liking.
Kiss me, I'm Polish!

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: Email on Birthday

Post by updown » Thu May 08, 2008 10:39 pm

Hi Lefty,

I have a strange issue with this mod for some weeks:

First of all: The Mod itself works fine (Gold 3.0.0.) - on every users birthday the email is beeing sent. But on the next day - when there is no other birthday - the email is beeing sent again for a second time! But when there is a new birthday, only the new birthday's email is beeing sent.

I double-checked everything and have no explanation for this. Perhaps: May there be an issue with daylight-saving-time? So the mod thinks, it's still the day before the next day and sends out the email again? But why is this only, when there is no next birthday? I'm confused... :?

Anyone else with this issue? Lefty, can you help?

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 » Fri May 09, 2008 10:21 am

hmm, i have this installed on my testboard for a long time and never had this problem.

could you post, pm or link your index.php page?

cheers
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.

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: Email on Birthday

Post by updown » Mon May 12, 2008 11:59 pm

Hi Lefty,

I double-checked again and again - and I've no clue... Here is my index.php:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php,v 1.176 2007/10/05 14:30:06 acydburn Exp $
* @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');

//global announcements
$user->add_lang('mcp');

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';

//MOD Latest Posts
//check whether all conditions are met before proceeding to show latest posts
if ($config['latest_posts'] && ($config['allow_guests_latest_posts'] || $user->data['is_registered']) && $config['num_posts'])
{
	//get in an array all the readable forums
	$forum_ary = array();

	// include those forums the user is having read access to...
	$forum_read_ary = $auth->acl_getf('f_read');

	foreach ($forum_read_ary as $forum_id => $is_allowed)
	{
		if ($is_allowed['f_read'])
		{
			$forum_ary[] = (int) $forum_id;
		}
	}
	$forum_ary = array_unique($forum_ary);
	$forum_ary[] = 0; //for global topics
	$first_readable_forum = isset($forum_ary[0]) ? $forum_ary[0] : false; //again for global topics
	$forum_sql = ' AND ' . $db->sql_in_set("p.forum_id", $forum_ary, false, true);

	//free some memory
	unset($forum_ary);
	unset($forum_read_ary);

	//the sql query... we combine data from the 3 tables (for data about post subject, poster, time ... username, user colour ...
	//and forum name)
	//only approved posts from readable forums are chosen
	//user can view the subject, username, forum name and post time along with appropriate links...
	if ($first_readable_forum)
	{
		$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.poster_id, p.icon_id, p.post_time, p.post_subject, u.username, u.user_colour, f.forum_name
			FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u, ' . FORUMS_TABLE . ' f
			WHERE p.post_approved = 1
				AND p.poster_id = u.user_id ' . '
				AND (p.forum_id = f.forum_id OR (p.forum_id = 0 AND f.forum_id = ' . $first_readable_forum . ')) ' . $forum_sql .
		' ORDER BY p.post_id DESC';

		//query the db
		$result = $db->sql_query_limit($sql, $config['latest_posts']);

		$latest_posts = array();
		while ($latest_post = $db->sql_fetchrow($result))
		{
			$latest_posts[] = $latest_post;
		}
		$db->sql_freeresult($result);
		if (sizeof($latest_posts))
		{
			$template->assign_var('S_SHOW_LATEST_POSTS', true); //assign the template to show latest posts section
			//get the post icons
			$post_icons = $cache->obtain_icons();
			//loop to display each of the latest posts
			foreach ($latest_posts as $latest_post)
			{
				$template->assign_block_vars('latest_post_row', array(
				'POST_TIME' => $user->format_date($latest_post['post_time']),
				'POST_SUBJECT' => $latest_post['post_subject'] != '' ? $latest_post['post_subject'] : '(Kein Betreff)',
			//	'POST_ICON_IMG' => $post_icons[$latest_post['icon_id']]['img'],
				'POST_AUTHOR_FULL' => get_username_string('full', $latest_post['poster_id'], $latest_post['username'], $latest_post['user_colour']),
				'U_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($latest_post['forum_id']) ? 'f=' . $latest_post['forum_id'] . '&' : '') . 't=' . $latest_post['topic_id'] . '&p=' . $latest_post['post_id']) . '&#p' . $latest_post['post_id'],
				'FORUM_NAME' => $latest_post['forum_name'],
				'U_FORUM' => ($latest_post['forum_id']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $latest_post['forum_id']) : '',
				'IS_GLOBAL'	=> (!$latest_post['forum_id']),
				));
			}
			unset($post_icons);
			unset($latest_posts);
			unset($latest_post);
		}
	}
}
//end MOD


// 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 = '';
$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->bcc($config['board_email'], '');
		$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');
}

// Generate birthday ahead list if required ...
if ($config['load_birthdays'] && $config['allow_birthdays'] && ( $config['allow_birthdays_ahead'] > 0 ) )
{
	include_once($phpbb_root_path . 'includes/functions_upcbirthdays.' . $phpEx);
	get_upcbirthdays();
}

// AJAX-Chat Shoutbox
include($phpbb_root_path . 'includes/functions_shoutbox.' . $phpEx);
include($phpbb_root_path . 'includes/functions_chatusers.' . $phpEx);

// ACP Announcement Centre
if ( $config['announcement_show_index'] && $config['announcement_enable'] )
{
	if (!function_exists('get_announcement_data'))
	{
		include_once($phpbb_root_path . 'includes/functions_announcements.' . $phpEx);
	}
	get_announcement_data();
}

// 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}index.$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) : '')
);

// Output page
page_header($user->lang['INDEX']);
include($phpbb_root_path . 'includes/functions_wwh.' . $phpEx);

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

page_footer();

?>
Thanks in advance for your support :roll:
(My only personal code-add is the "$messenger->bcc"-line, without that I wouldn't have recognized these double-mails at all...)

edit: may there be a "birthday-check-lack" when the board-dst is set, but the user's dst is not? :geek:
Last edited by updown on Tue May 13, 2008 12:12 am, edited 1 time in total.

User avatar
mcdanielnc89
Registered User
Posts: 703
Joined: Tue Feb 06, 2007 10:49 pm
Location: Missouri
Contact:

Re: Email on Birthday

Post by mcdanielnc89 » Tue May 13, 2008 12:10 am

will this be able to edit from the ACP on the nexst release?

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: Email on Birthday

Post by updown » Tue May 13, 2008 12:18 am

mcdanielnc89 wrote:will this be able to edit from the ACP on the nexst release?
the advantage of the email-txt-file is, that you can use it for as many languages at a time as you want to. in an acp-solution, you would have to have edit-fields for every users' language - so, from an international point of view, Lefty did a good job on deciding to do this the way it is... (just my two cents ;-))

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 May 13, 2008 10:27 am

updown,
your index.php looks fine on first glance. did your users report that second email as well?

I don't know what could cause this at the moment as I have not had any problems at all. Will have to look into it more if i find a moment.

mcdanielnc89,
as updown wrote, their won't be an acp field where you can edit the text as it is a. very easy to edit .txt email templates plus you can use different languages this way. ;)
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.

Evil20071
Registered User
Posts: 63
Joined: Mon Feb 04, 2008 7:43 am
Contact:

Re: Email on Birthday

Post by Evil20071 » Wed May 14, 2008 4:04 am

Lefty, I posted the problem I am having on your forum, but I guess you haven't gotten around to it, but here goes:

My forum crashed (FTP transfer goofed and files were totally lost) so I had to re-install it from scratch. Now, I can't find the mod ANYWHERE in the ACP. Not even in the mods control section under system. I've followed the same instructions both times, from the SQL Injection at the beginning, to all of the php edits, but still nothing. What should I do?

strykerm
Registered User
Posts: 2
Joined: Wed May 14, 2008 5:18 pm

Re: Email on Birthday

Post by strykerm » Wed May 14, 2008 5:24 pm

nice mod!!!

updown
Registered User
Posts: 542
Joined: Sat Jan 05, 2008 6:53 am

Re: Email on Birthday

Post by updown » Tue May 20, 2008 2:07 am

lefty74 wrote:updown,
your index.php looks fine on first glance. did your users report that second email as well?
yes, it has nothing to do with the mail-system. I still think it has something to do with the board-dst with activated summertime. Have you already checked this possibility: At the next day between 0:01am and 1:00am, the birthday-last-send-day in the database is the day before, but the user-birthday-check outputs still a birthday for this new day? Since this only happens when there in no new birthday in the birthday-list for this day, I think there must be the bug!

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 May 20, 2008 10:05 am

hi, no i have not had a chance to look at it at all.
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.

Locked

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