Open main menu

Changes

5,321 bytes added ,  10:51, 3 February 2017
Adds old tuturial
== Subscribe ==
{{CompanyName}} offers a [https://equality-tech.com/civicrm/profile/create?gid=14&reset=1 "wiki" mailing list] A low-volume list for product managers or wiki admins that will send you tips, best-practice info, and updates on what's going on in the MediaWiki world. Good for product managers, wiki admins, developers, or advanced users. See [https://equality-tech.com/civicrm/mailing/subscribe all lists].
 
== Setup ==
After the initial checklist in setting up your CiviCRM instance, you'll want to deep-dive into the various aspects of CiviMail
* http://book.civicrm.org/user/email/setup/
 
The documentation is really poor for the mail handling aspects. To be fair, it's complicated. But I wish I had the time to contribute to the documentation. Maybe someday. The best succinct resource I found for adding a 'Newsletter subscription form' is at https://forum.civicrm.org/index.php?topic=18364.0 And this old post from 2013 does a pretty good job of explaining the variations on [https://warrenpost.wordpress.com/2013/09/13/civicrm-mail/ setting up 'Bounce Handling' and 'Email to Activity' handling].
 
== Background ==
I'm working on getting the CiviMail component to work with custom data tokens that are of type "multi-value".
 
Looking at the code, and the bug history, the CiviCRM system creates various categories of tokens (action, component, contact, contribution, custom, domain, entity, greeting, hook, mailing, multiple contribution, org, resubscribe, subscribe invite, subscribe, unsubscribe, user, welcome, required etc.) and has various functions for treating each. Why? Why not just define tokens as <code><nowiki>{{token}}</nowiki></code> and replace them all? I know that for some circumstances you don't want to replace content (e.g. Documentation); and there are some areas that I am not fully aware of (interaction with Smarty templates)<ref>There is a setting (define( 'CIVICRM_MAIL_SMARTY', 1 ); in civicrm.settings.php) that you can turn on to send mail through Smarty for more complex processing</ref>.
 
At the same time, there are changes taking place in the general database interaction. DAO based retrieval is being phased out. These changes may impact this bug, and/or the proper way to fix the issue. Especially in the API area.
 
{{bug}} [https://issues.civicrm.org/jira/browse/CRM-16036 API: searching on custom fields only works for contacts] <br />
[https://github.com/civicrm/civicrm-core/pull/6488/files 10 files in the API] e.g. api/v3/Activity.php associated with the above bug fix
 
{{bug}} [https://issues.civicrm.org/jira/browse/CRM-16137 Allow is_multiple custom group fields in search builder]
 
I'm currently running 4.6.8 and probably should run [http://wiki.civicrm.org/confluence/display/CRMDOC/GitHub+for+CiviCRM gitify] to transform my development host to a proper git clone, which would then allow me to submit patches
== Resources ==
# [http://wiki.civicrm.org/confluence/display/CRMDOC/Customized+%28and+Custom%29+Tokens Customized and Custom Tokens] documentation# [https://issues.civicrm.org/jira/secure/ReleaseNote.jspa?projectId=10050&version=13690 Release Notes for 4.7] (search 'custom')# [https://issues.civicrm.org/jira/secure/ReleaseNote.jspa?projectId=10050&version=15190 Release Notes for 4.8]
# [https://issues.civicrm.org/jira/browse/CRM-16448?jql=text%20~%20%22civimail%22 JIRA Board issues for 'CiviMail']
# {{bug}} [https://forum.civicrm.org/index.php?topic=36693.0 Won't convert custom tokens in email]# [https://civicrm.stackexchange.com/questions/2558/tokens-for-custom-field-set-with-multiple-records Tokens for Custom Field Set with Multiple Records] (StackExchange)# [https://forum.civicrm.org/index.php?topic=30029.0 Custom Fields with multiple value - not available as tokens?] (forum)# {{bug}} [https://issues.civicrm.org/jira/browse/CRM-15623 search events by custom fields] (you can't)# {{bug}} [https://issues.civicrm.org/jira/browse/CRM-8526 Support <nowiki>[contribution.custom_nn]</nowiki> tokens in templates] was identified in 2011, with a patch, but never committed to core and the patch is now stale.
== Tokens ==
The code for <code>[https://github.com/colemanw/civicrm-core/blob/f551f7d327747a4ffc2e34cc7a4be9b044f7004c/CRM/Utils/Token.php Token.php]</code> has changed with [https://github.com/colemanw/civicrm-core/commit/f551f7d327747a4ffc2e34cc7a4be9b044f7004c this commit] to fix tokens in ''greetings'', but I think that might have fixed other issues too because the fix removes the "filter" of the 'contact' key in the $remainingTokens array and now loops through everything/anything in the array.
Additionally, that commit changes the call to <code>CRM_Utils_Token::replaceContactTokens()</code> by setting the <code>$returnBlankToken</code> argument (5) to TRUE. In fact, this part of the change was identified in https://issues.civicrm.org/jira/browse/CRM-17038
 
== API Explorer ==
API Explorer fails to return the same valid results that you can get through the Advanced search form.
 
https://equality-tech.com/civicrm/api/explorer#explorer
 
If you do a 'Custom Value' GET via the API, using the 'entity_id' (contact) 2 (Greg Rundlett), you can see that contact id 2 has a "custom value 40" like 'freephile'
 
 
<source lang="php">
$result = civicrm_api3('CustomValue', 'get', array(
'sequential' => 1,
'entity_id' => 2,
));
</source>
you'll get 31 results:
<pre>
{
"is_error": 0,
"version": 3,
"count": 31,
"values": [
{
"entity_id": "2",
"latest": "https://freephile.org/wiki/Main_Page",
"id": "40",
"18": "https://freephile.org/wiki/Main_Page",
"58": "https://freephile.org/wiki/Main_Page",
"908": "https://freephile.org/wiki/Main_Page",
"909": "https://freephile.org/wiki/Main_Page",
"910": "https://freephile.org/wiki/Main_Page"
},
</pre>
etc....
 
If you do a 'Contact' GET via the API, searching for contacts with a 'custom_40' like 'freephile'
 
<source lang="php">
$result = civicrm_api3('Contact', 'get', array(
'sequential' => 1,
'custom_40' => array('LIKE' => "freephile"),
));
 
</source>
You'll get "no results"
<pre>
{
"is_error": 0,
"version": 3,
"count": 0,
"values": [
]
}
</pre>
 
 
If you do a [https://equality-tech.com/civicrm/contact/search/advanced Advanced Search] (form) on "wUrl Like %freephile%", you'll get 2 contacts.
 
 
{{References}}
4,558

edits