CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • New hook for scheduled reminders?
Pages: [1]

Author Topic: New hook for scheduled reminders?  (Read 735 times)

Parvez

  • I post occasionally
  • **
  • Posts: 91
  • Karma: 7
New hook for scheduled reminders?
April 02, 2013, 10:04:06 am
Hi All

So we have a requirement to not send scheduled reminders to certain contacts based on some criteria.

I cant see of way of doing this at the moment so was toying with the idea of having a hook that could be used to do this?

The other option is to allow the user to exclude a group of contacts from the scheduled reminder?

Option two (Exclude Group) is probably going to be a little too much work for us to get done for this requirement so we'll probably head down the Hook route but was wondering if anyone thinks it worthwhile contributing back? If so any particular additional functionality this hook might need to do?

Thanks

Parvez

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: New hook for scheduled reminders?
April 02, 2013, 01:26:24 pm
i took a quick look at it:

CRM/Core/BAO/ActionSchedule.php - function processQueue

Noticed a couple of things and would be good for us to fix this while u r at it:

a. We are not doing any locking while processing a scheduled reminder and we should (we can just use the same code as mailing)

b. Might want to expose a hook (for both mailings and schduled reminders) to alter the list of contacts (both pocesses store this in a table) that a mail / scheduled reminder

ping us on irc and we can bounce a few more ideas / tasks :)

lobo


lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

chiebert

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 1
  • CiviCRM version: 4.3
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: New hook for scheduled reminders?
June 18, 2013, 07:17:52 am
Hi Parvez - did you get any good ideas going down this road? I just finished digging around eying to find a way to alter the list of reminder recipients and, like you, can't find an easy way.

We've got a custom contact reference field on the participant record for one event type (a summer camper), and we'd like to send the reminder to the contact in that field, rather than to the participant contact. So, a hook that fires for each contact lookup - that has the id of the relevant entity (participant, in our case) - would be awesome. Then all we'd have to do is look up the appropriate reference and alter that entry.

Alternatively, some way to alter the query for a custom scheduled reminder would maybe work better? Something analogous to how we can write custom searches/reports now? Lobo, is this possible even now, just not documented anywhere?

Parvez

  • I post occasionally
  • **
  • Posts: 91
  • Karma: 7
Re: New hook for scheduled reminders?
June 18, 2013, 07:23:00 am
Hi - I didn't get any further with this, ended up doing a mini hack to get things working for now.

The scenario you mentioned is exactly the sort of thing I was thinking about.

Best to chat to Lobo, if you need a hand with some code let me know.

Thanks

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • New hook for scheduled reminders?

This forum was archived on 2017-11-26.