I have tried, in vain, to invoke hook_civicrm_tokens and hook_civicrm_tokenValues in a Joomla instance in order to add custom tokens (to be specific: relationship information).

I created a Joomla plugin to allow this, as this seems to be the recommended way to implement hooks in Joomla, to no avail. I have been unable to discover how the mail form gets its list of tokens in case I need to prefix the call names with that module, e.g. Mailing_civicrm_tokens. I've looked at:

Create Your Own Tokens for Fun and Profit but it hasn't helped. There is even a reference there to it not working in Joomla that no one has answered the question.

Any suggestions?

1 Answer 1


Here's info about using CiviCRM hooks in Joomla: https://wiki.civicrm.org/confluence/display/CRMDOC/Example+Joomla+Plugin+for+implementing+hooks

But why create a Joomla plugin if you can also use the hooks in a CiviCRM extension? https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension

The advantages of using a CiviCRM extension over a joomla extension:

  • Works on all CMS'es
  • Much more knowledge available in CiviCRM community

The only advantage of Joomla plugins I see would be if you would need to combine CiviCRM functionality with Joomla functionality.

  • is right -- there's really no need to build a Joomla plugin instead of a native CiviCRM extension. That said, either model should work. Try providing some sample code so we can see what you may have done wrong. Mar 28, 2016 at 3:58
  • Thanks for getting back to me. I also tried building a native CiviCRM extension as per the links provided above, but with thesame result - nothing. I don't need a form, I am simply trying to add hooks to add custom tokens in mailings. There isn't space to provide code samples in a comment, but I am probably failing to provide the right class names etc. and have probably misunderstood the instructions somewhere. In the end, I followed the instructions in en.flossmanuals.net/civicrm-developer-guide/hooks to create a file for the hooks I am trying to add, and this seems to be working. Mar 28, 2016 at 8:33
  • This appears to have stopped working with Joomla and CiviCRM 4.7.16. I've tried debugging CiviCRM 4.7.20 and the joomla_civicrm_tokens and joomla_civicrm_tokenValues never appear to be being called. Introducing an error to civicrmHooks.php doesn't cause CiviCRM to fail, so I suspect that civicrmHooks.php is no longer called. Any comments? Jun 21, 2017 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.