Answers.Body: <p>Here's info about using CiviCRM hooks in Joomla:
  <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Example+Joomla+Plugin+for+implementing+hooks" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Example+Joomla+Plugin+for+implementing+hooks</a></p>
  
  <p>But why create a Joomla plugin if you can also use the hooks in a CiviCRM extension?
  <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension</a></p>
  
  <p>The advantages of using a CiviCRM extension over a joomla extension:</p>
  
  <ul>
  <li>Works on all CMS'es</li>
  <li>Much more knowledge available in CiviCRM community</li>
  </ul>
  
  <p>The only advantage of Joomla plugins I see would be if you would need to combine CiviCRM functionality with Joomla functionality.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T03:58:53.603Z
Answers.Text: 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.
Answers.UserDisplayName: lcdservices
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T08:33:28.010Z
Answers.Text: 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 http://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.
Answers.UserDisplayName: Stephen Palmstrom
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-21T17:38:18.077Z
Answers.Text: 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?
Answers.UserDisplayName: Stephen Palmstrom
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-26T19:47:17.657Z
Answers.LastActivityDate: 2016-03-26T19:47:17.657Z
Answers.UserDisplayName: Catorghans
Body: <p>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).</p>
  
  <p>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:</p>
  
  <p><a href="https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit" rel="nofollow">Create Your Own Tokens for Fun and Profit</a>
  but it hasn't helped.  There is even a reference there to it <a href="https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit#comment-6929" rel="nofollow">not working in Joomla</a> that no one has answered the question.</p>
  
  <p>Any suggestions?</p>
  
Tags: <joomla><hooks><tokens>
Title: Invoking hook_custom_tokens and hook_custom_tokenValues in Joomla
ThreadText: # Invoking hook_custom_tokens and hook_custom_tokenValues in Joomla
  
  (Asked by: username_0 on 2016-03-26)
  
  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](https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit)
  but it hasn't helped. There is even a reference there to it [not working in Joomla](https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit#comment-6929) that no one has answered the question.
  
  Any suggestions?
  
  **Tags:** joomla, hooks, tokens
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-26. Score: 2
  
  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.
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_0**: 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 http://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.  
  > **username_0**: 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?  
  
  ---
  
  