diff --git a/sources/hooks/systems/notifications/cns_self_birthday.php b/sources/hooks/systems/notifications/cns_self_birthday.php new file mode 100644 index 0000000..694b33e --- /dev/null +++ b/sources/hooks/systems/notifications/cns_self_birthday.php @@ -0,0 +1,58 @@ +_all_members_who_have_enabled($notification_code, $category, $to_member_ids, $start, $max); + $members = $this->_all_members_who_have_enabled_with_page_access($members, 'members', $notification_code, $category, $to_member_ids, $start, $max); + + return $members; + } +} diff --git a/sources/hooks/systems/cron/cns_birthdays.php b/sources/hooks/systems/cron/cns_birthdays.php index e77a6a9..7bf922b 100644 --- a/sources/hooks/systems/cron/cns_birthdays.php +++ b/sources/hooks/systems/cron/cns_birthdays.php @@ -71,16 +71,38 @@ class Hook_cron_cns_birthdays ) ); + // Randoms (if not batched)... + + if (count($_birthdays) == 1) { + dispatch_notification('cns_birthday', null, $subject, $mail); + } + + // Friend... + if (addon_installed('chat')) { $friends = $GLOBALS['SITE_DB']->query_select('chat_friends', array('member_likes'), array('member_liked' => $_birthday['id'])); dispatch_notification('cns_friend_birthday', null, $subject, $mail, collapse_1d_complexity('member_likes', $friends)); } - if (count($_birthdays) == 1) { - dispatch_notification('cns_birthday', null, $subject, $mail); - } + // Self... + + $subject_self = do_lang('SELF_BIRTHDAY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $displayname, $username); + $mail_self = do_notification_lang( + 'SELF_BIRTHDAY_NOTIFICATION_MAIL', + comcode_escape(get_site_name()), + comcode_escape($username), + array( + $member_url->evaluate(), + $birthday_url->evaluate(), + comcode_escape($displayname) + ) + ); + + dispatch_notification('cns_self_birthday', null, $subject_self, $mail_self, array($_birthday['id'])); } + // Randoms (if batched)... + if (count($_birthdays) > 1) { $combined_birthdays_subject = do_lang('COMBINED_BIRTHDAY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), integer_format(count($_birthdays))); $combined_birthdays_mail = do_notification_lang('COMBINED_BIRTHDAY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), $combined_birthdays_mail, comcode_escape(integer_format(count($_birthdays)))); diff --git a/lang_custom/EN/cns.ini b/lang_custom/EN/cns.ini new file mode 100644 index 0000000..6e0be91 --- /dev/null +++ b/lang_custom/EN/cns.ini @@ -0,0 +1,47 @@ +SELF_BIRTHDAY_NOTIFICATION_MAIL=Happy Birthday {2}, from your committee members at {1}. We hope you enjoy your special day. diff --git a/lang/EN/cns.ini b/lang/EN/cns.ini index 77b9741..70ae286 100644 --- a/lang/EN/cns.ini +++ b/lang/EN/cns.ini @@ -811,6 +792,7 @@ NOTIFICATION_TYPE_cns_group_declined=Your usergroup join request was declined NOTIFICATION_TYPE_cns_username_changed=Your username changed NOTIFICATION_TYPE_cns_password_changed=Your password changed NOTIFICATION_TYPE_cns_friend_birthday=Your friend's birthday is today +NOTIFICATION_TYPE_cns_self_birthday=Happy Birthday to you NOTIFICATION_TYPE_cns_birthday=A member's birthday today NOTIFICATION_TYPE_cns_club=New club added NOTIFICATION_TYPE_cns_member_joined_group=A member joined a usergroup @@ -822,6 +804,8 @@ NEW_MEMBER_NOTIFICATION_MAIL_SUBJECT={1} has joined {2} NEW_MEMBER_NOTIFICATION_MAIL=A new member, {1}, has joined {2}. You can view his/her profile at:\n[url="{3}"]{3}[/url] BIRTHDAY_NOTIFICATION_MAIL_SUBJECT=It's {2}'s birthday BIRTHDAY_NOTIFICATION_MAIL=It's {{{2}}}'s birthday. Come congratulate them on {1}:\n[url="{4}"]{4}[/url] +SELF_BIRTHDAY_NOTIFICATION_MAIL_SUBJECT=Happy Birthday +SELF_BIRTHDAY_NOTIFICATION_MAIL=Happy Birthday {2}, from all the staff at {1}. We hope you enjoy your special day. COMBINED_BIRTHDAY_NOTIFICATION_MAIL_SUBJECT=Birthday Bonanza COMBINED_BIRTHDAY_NOTIFICATION_MAIL=It is the birthday of {3} members on {1}. Wish them Happy Birthday...{2} COMBINED_BIRTHDAY_NOTIFICATION_MAIL_ITEM=\n - {{{2}}} -- [url="{4}"]{4}[/url]