Forum Activity for @melih

Melih
@melih
07/16/16 10:26:35AM
198 posts

JrCore_list in email template


Jamroom Developers

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
Melih
@melih
07/16/16 02:33:09AM
198 posts

JrCore_list in email template


Jamroom Developers

I deleted everything and i will start over, so i can't paste it right now :)

It is working on the site and it is working if i triggered the daily maintenance. So the code is woking actually.

I will try debug, thanks for the idea.

It already works when i become online and trigger daily maintenance or when i fire it somehow manually. But it doesn't work when it's fired by the automatic daily maintenance.
Melih
@melih
07/15/16 05:09:01AM
198 posts

JrCore_list in email template


Jamroom Developers

Unfortunately it's not working. I need to check the whole thing again :(
Melih
@melih
07/13/16 01:28:59PM
198 posts

JrCore_list in email template


Jamroom Developers

Thank you Brian, I will try that. I will see the result on the next automatic daily maintenence.
Melih
@melih
07/13/16 01:24:32PM
198 posts

JrCore_list in email template


Jamroom Developers

Whenever a user logs in before the daily_maintenence is done, daily_maintenence gets triggered and my function works normally.
Melih
@melih
07/13/16 01:22:45PM
198 posts

JrCore_list in email template


Jamroom Developers

I meant daily maintenance is triggered when a user loged in if it hasn't done the daily maintenence that day.
Melih
@melih
07/13/16 01:17:14PM
198 posts

JrCore_list in email template


Jamroom Developers

With daily_maintenance_listener
Melih
@melih
07/13/16 11:03:17AM
198 posts

JrCore_list in email template


Jamroom Developers

Dear all,

I am trying to apply a jrCore_list function in a email template. This is triggered by daily_maintenence. Whenever a user logs in before the daily_maintenence is done, it gets triggered and my function works normally. I mean jrCore_list function runs and sends the emails. But if daily_maintenence by itself automaticly without any user loging in or something else to trigger it, jrCore_list function doesn't work. Emails are send with constant text but without jrCore_list output data. Lines comes out empty. This function wokred for a while. I don't know when or why it stoped working properly.
updated by @melih: 10/31/16 09:47:05PM
Melih
@melih
04/19/16 07:01:40AM
198 posts

Email Timeout


Jamroom Developers

Yes Brian, it looks like connecting and sending now. I made it 30 to test it.

Thanks for your assistance, both of you.
Melih
@melih
04/16/16 09:47:39AM
198 posts

Email Timeout


Jamroom Developers

Actually i made it 30 to be able to see wheter it works or not. Since i have found its place i can manually increase it in case any need. Or maybe you can add this as an option to the ACP.
  10