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) »
  • not able to customize Contribution tokens
Pages: [1]

Author Topic: not able to customize Contribution tokens  (Read 346 times)

haggertypat

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal
  • MySQL version: Ver 14.14 Distrib 5.5.35
  • PHP version: 5.4.4-14+deb7u8
not able to customize Contribution tokens
July 03, 2014, 02:20:57 pm
I'm trying to customize the contribution.receipt_date token with help from https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit.

I cannot seem to update the contribution values or even access the contribution tokens or values from the "civicrm_tokenValues" hook.

Quote
function MyModule_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = array(), $context = null) {
    print_r($tokens); // contribution tokens are not listed
    print_r($values); // only contact values are listed
}

Blindly attempting to just set a value for the token doesn't work either, the default value is still used:

Quote
function MyModule_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = array(), $context = null) {
    foreach ($cids as $cid) {
       $values[$cid]['contribution.receipt_date'] = 'test';
       $values[$cid]['receipt_date'] = 'test';
       $values[$cid]['contribution'][0] = 'test';
       $values[$cid]['contribution']['receipt_date'] = 'test';
    }
}

Is there some other hook I should be using? Any other ideas? Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • not able to customize Contribution tokens

This forum was archived on 2017-11-26.