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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Do token hooks work with scheduled mailings?
Pages: [1]

Author Topic: Do token hooks work with scheduled mailings?  (Read 559 times)

ldgpangeo

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: drupal-7.17
  • MySQL version: 5.5.23
  • PHP version: 5.3.13
Do token hooks work with scheduled mailings?
May 02, 2014, 06:45:53 pm
Using CiviCRM 4.3.3.

I have created some custom email tokens using the documented hooks functions from the CiviCRM and Drupal  documentation.  These provide additional information not included within the default set of email tokens.

They work fine when sending emails via the standard web forms.

The same tokens return blank values when the same email template is sent via the Administration > Communications > Schedule Reminders.

Does the schedule reminders batch job implement the same hooks as the regular email forms?


petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Do token hooks work with scheduled mailings?
May 03, 2014, 09:34:54 pm
can you be clearer about your new tokens?

yes i expect tokens to work in Scheduled Reminders inc. checksums and last membership etc
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

ldgpangeo

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: drupal-7.17
  • MySQL version: 5.5.23
  • PHP version: 5.3.13
Re: Do token hooks work with scheduled mailings?
May 04, 2014, 05:18:23 pm
I've written some custom hooks based on the documentation at
http://wiki.civicrm.org/confluence/display/CRMDOC42/hook_civicrm_tokens
http://wiki.civicrm.org/confluence/display/CRMDOC42/hook_civicrm_tokenValues

The hook basically does a database call to permit including the individual's total contribution amount for a preset time period into the email.  We are using it along with a membership renewal for a top-end membership category where the donors often contribute more than the basic membership fee.  It allows us to inform the member that last year they gave $XXX.

It works fine when used in an email template and also in a bulk mailing, but does nothing when used in the "schedule reminders" mailings which is what gets used to send out membership renewals. 

I need to figure out if the "schedule reminders" is different from the other methods or if I have some subtle flaw in my hook code the only manifests when run by the scheduler (although the bulk mailing also relies on the scheduler).

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Do token hooks work with scheduled mailings?
May 04, 2014, 05:35:02 pm
not really my area of strength but expect the above will help someone else provide a pointer

just re "It works fine when used in an email template". this is working when you send via Actions having eg done a Search and 'display' the results as 'contacts', or as 'contributions' or both

(just thinking that we have or had some eg membership based tokens that only fill if we are sending after 'display = memberships')

and what is the Scheduled Reminder firing off? An Activity or a Membership or ....
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

ldgpangeo

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: drupal-7.17
  • MySQL version: 5.5.23
  • PHP version: 5.3.13
Re: Do token hooks work with scheduled mailings?
May 05, 2014, 05:08:35 pm
>  and what is the Scheduled Reminder firing off? An Activity or a Membership or

Triggering off 30 days before membership expiration.

It correctly retrieves the membership level which is a built-in token, but fails on the custom token that I wrote.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Do token hooks work with scheduled mailings?

This forum was archived on 2017-11-26.