Schedule Email Plugin selected email addresses

stevelis

Member
I need to replicate the following Form Email Plugin Email To (Eval) code, to use in the Schedule Email Plugin to obtain the email addresses.
$db =& JFactory::getDBO(); $query = "SELECT `Email` FROM `steward` WHERE `id` IN ('{calendar___chairsteward_raw}','{calendar___steward2_raw}','{calendar___steward3_raw}','{calendar___steward4_raw}')"; $db->setQuery($query); $results = $db->loadColumn();
$email_list = implode(',',$results); return $email_list;

I have copied the calendar List, added two pre-filters to provide the events within the next 7 days and setup the Schedule with an email plugin to send emails reminding the stewards of their next event. This all works when I manually type in an addresses or multiple addresses in the Email to section of the schedule email plugin.
The Schedule Email Plugin doesn't have the Email to (Eval) option.
How can I setup the email reminder to select the required email addresses?

Steve
Australia
 
Hi troester
In the Schedule PHP plugin there is the PHP Script and PHP Setup options
With my very limited PHP skills, have I got this understanding correct:-
PHP Setup would use the above coding to select the email addresses?
And the PHP Script would be the 'message' of the email?

Thanks
Steve
 
How would I write the code for a Schedule PHP Plugin to send reminder emails to the recipients of the above query and then include a sentence in the email reminder.
For the email addresses, the List elements are the same in the code above for the Form Email Plugin.
The values from the following elements, calendar___StartDate and calendar___Event would be used in the sentence (email message)
i.e. Your next event is the calendar___Event starting on the calendar___StartDate

Any php help appreciated

Steve
 
Well, first thing is to make sure that query is working. So put ...

Code:
var_dump((string)$query);exit;

... before the setQuery(), run the script from the Fabrik backend by hand (the Run button), and see what that says, make sure it's a valid query.

-- hugh
 
Although looking at your code in the OP, that won't be valid, as there is no "form data" to do replacement on when running as a cron task.

And if you are using prefilters on your list to achieve the selection you want, then you don't want to be querying the table by hand, you need to be looking at the $data we make available, where we pre-load the table data for you.

However, if your list setu is how I think it is, then it may be better NOT to use prefilters and our pre-prepared data ... otherwise you'll have to do a lot of individual queries to pick up the emails from the stewards table. It'd look something like this ...

Code:
foreach ($data as $group) {
  foreach ($group as $row) {
      // do a database query to get the steward emails for this row, using $row->calendar___chairsteward, $row->calendar___steward1, etc
      // send the email
  }
}

Which may be OK if you don't have that many rows you are dealing with, but could get very heavy duty if you do have a lot of rows.

So ... first question ... what is the maximum number of rows you expect to be processing, ballpark?

The more efficient alternative would be to set the plugin NOT to have us do the list load, and instead build your own query, which filters out the dates you need, AND does LEFT JOIN's on the stewards table, so it picks up all the emails, and you are only doing one query instead of (potentially) hundreds, or whatever your row count may be.

-- hugh[/code]
 
Hi Hugh
The ball park maximum figure would be 12 rows.
Each row may have up to 3 stewards to send an email to.

I thought I would quickly reply with the info you requested, whilst I read and fully understand your reply

Thanks
Steve
 
Hugh
As suggested, the above query don't produce any records.
Your last suggestion with the LEFT JOIN's sounds promising but haven't been able to achieve the desired result
Looking further for examples for query and LEFT JOIN's
Steve
 
For the last 2 days I have tried writing different scripts but with no luck. Now confused even more.

Unfortunately, I was not able to find an example to follow and change the fields etc., as I don?t know enough about PHP at this stage.
Would a professional subscription provide me with a php script to send email reminders to the event appointed officials 8 days prior to the event commencing date, for the Schedule Cron PHP Plugin?

Have two Lists, calendar and steward with the email being based on the following elements from the respective Lists. Both Lists have the standard Fabrik id element.

steward___Fname and steward___Lname, and steward___email

calendar___StartDate and calendar___Event and calendar ___Location

The calendar list has 3 database join dropdown elements; calendar___chairsteward, calendar___steward2 and calendar___steward3 to add the appointed officials to each event.

The dropdown value is a concate of the Fname & Lname in the dbase join element.

Currently have a copied calendar List called calemailremind where a pre filter achieve step 1.
However, Hugh in an earlier post has suggested one query with Left Join would be the way to go.

  1. Select from calendar all events that have a calendar___StartDate of 8 days from today?s date (date emails sent from Schedule Cron)
  2. Send an email reminder to each appointed official, calendar___chairsteward, calendar___steward2 and calendar___steward3
  3. Email message to include, Reminding you of your stewarding appointment at calendar___event at calendar___Location on the calendar___StartDate

Steve
 
Pro subs don't really cover complete custom coding solutions, unless we balance that against the level of support. Basically a Pro sub covers about an hour of our time. So I could spend an hour working on this. But that would then mean having to compromise on any additional support for the balance of the month. It's a really difficult balancing act, trying to provide value for money, and not short changing you, or having us take a bath on the hours we have to work.

Which is why we prefer to simply quote you a price if you want a specific plugin or custom script written, rather than promising to do it for the cost of a sub. Subs are more about how fast we respond, and the level of support (as opposed to custom coding) we can afford to provide, rather than a promise to write custom code.

However, from this thread, it looks like this is about an hours work, once all is said and done. So yeah, I could probably do it if you took out a Pro sub, with the proviso from the first paragraph above.

-- hugh
 
Hi Hugh
Fully understand and appreciate your time.
Have upgraded and I will wait to hear from you on what you require
Once again thanks
Steve
 
Hi Hugh
Please ignore the requirement for any coding relating to {calendar___steward4_raw} in the first post above. This element is not a requirement.
  1. Select from calendar all events that have a calendar___StartDate of 8 days from today?s date (date emails sent from Schedule Cron)
  2. Send an email reminder to each appointed official, calendar___chairsteward, calendar___steward2 and calendar___steward3
  3. Email message to include, Reminding you of your stewarding appointment at calendar___event at calendar___Location on the calendar___StartDate
'My site' have a login setup, if needed
Steve
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top