First of all, i want to remind you that i don't know much information about coding. Most of the things i try to do are put stuff together
This is my function in include.php file in my custom module
function myFonksiyon_daily_maintenance_listener($_data, $_user, $_conf, $_args, $event)
{
$bir = date("md", strtotime("+1 days"));
$iki = date("md", strtotime("+2 days"));
$uc = date("md", strtotime("+3 days"));
$dort = date("md", strtotime("+4 days"));
$bes = date("md", strtotime("+5 days"));
$alti = date("md", strtotime("+6 days"));
$yedi = date("md", strtotime("+7 days"));
$_sp = array(
'search' => array(
"event_date like %$bir || event_date like %$iki || event_date like %$uc || event_date like %$dort || event_date like %$bes || event_date like %$alti || event_date like %$yedi",
"event_type = birth || event_type = death || event_type = marriage"
),
'return_keys' => array('event_date', 'event_type'),
'skip_triggers' => true,
'privacy_check' => false,
'ignore_pending' => true,
'no_cache' => true,
'limit' => 5
);
$_rt = jrCore_db_search_items('jrGenEvent', $_sp);
if ($_rt && is_array($_rt) && isset($_rt['_items'])) {
$_us = array(
'search' => array(
"user_email like %",
),
'return_keys' => array('_user_id', 'user_name'),
'limit' => 1000
);
$_mg = jrCore_db_search_items('jrUser', $_us);
if ($_mg && is_array($_mg['_items'])) {
foreach (($_mg['_items']) as $item) {
$userid = $item['_user_id'];
$_rp['username'] = $item['user_name'];
$_rp['bir'] = $bir;
$_rp['iki'] = $iki;
$_rp['uc'] = $uc;
$_rp['dort'] = $dort;
$_rp['bes'] = $bes;
$_rp['alti'] = $alti;
$_rp['yedi'] = $yedi;
list($sub, $msg) = jrCore_parse_email_templates('myFonksiyon', 'yildonumleri', $_rp);
jrUser_notify($userid, 0, 'myFonksiyon', 'yildonumleri', $sub, $msg);
}
}
}
}
And it uses this email template
Merhaba {$username},
Önümüzdeki hafta gerçekleşecek yıldönümüleri var:
{capture name="s_tpl" assign="s_tpl"}
{literal}
{if isset($_items)}
{foreach $_items as $item}
{if $item.event_type == 'marriage'}
{if $item.profile_gender == 'female'}
{$item.event_date|jrGenCore_get_day} {$item.event_date|jrGenCore_get_readable_month} {$item.event_date|jrGenCore_get_year} {$item.profile_first_name} ve {$item.event_linked_person|iyelikin} evlilik yıldönümü
{/if}
{else}
{$item.event_date|jrGenCore_get_day} {$item.event_date|jrGenCore_get_readable_month} {$item.event_date|jrGenCore_get_year} {$item.profile_name|iyelikin} {if $item.event_type == 'birth'}doğumgünü{elseif $item.event_type == 'death'}ölüm yıldönümü{/if}
{/if}
{/foreach}
{/if}
{/literal}
{/capture}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$bir" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$iki" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$uc" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$dort" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$bes" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$alti" template=$s_tpl privacy_check=false}
{jrCore_list module="jrGenEvent" search1="event_type = birth || event_type = death || event_type = marriage" search2="event_date like %$yedi" template=$s_tpl privacy_check=false}
I know that this worked for a while. There were also some other parts of it but i deleted them during trials. For example there was a line for it just to work once a week.
I tried many things but in the end i gave up and decided to ask you.
updated by @melih: 07/16/16 10:41:11AM