CiviCRM/CiviMail

From Freephile Wiki
Jump to navigation Jump to search

Subscribe[edit | edit source]

eQuality Technology offers a "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 all lists.

Setup[edit | edit source]

After the initial checklist in setting up your CiviCRM instance, you'll want to deep-dive into the various aspects of CiviMail

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 setting up 'Bounce Handling' and 'Email to Activity' handling.

Background[edit | edit source]

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 {{token}} 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)[1].

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.

Kbugbuster.svgAPI: searching on custom fields only works for contacts
10 files in the API e.g. api/v3/Activity.php associated with the above bug fix

Kbugbuster.svgAllow is_multiple custom group fields in search builder

I'm currently running 4.6.8 and probably should run gitify to transform my development host to a proper git clone, which would then allow me to submit patches

Resources[edit | edit source]

  1. Customized and Custom Tokens documentation
  2. Release Notes for 4.7 (search 'custom')
  3. Release Notes for 4.8
  4. JIRA Board issues for 'CiviMail'
  5. Kbugbuster.svgWon't convert custom tokens in email
  6. Tokens for Custom Field Set with Multiple Records (StackExchange)
  7. Custom Fields with multiple value - not available as tokens? (forum)
  8. Kbugbuster.svgsearch events by custom fields (you can't)
  9. Kbugbuster.svgSupport [contribution.custom_nn] tokens in templates was identified in 2011, with a patch, but never committed to core and the patch is now stale.

Tokens[edit | edit source]

The code for Token.php has changed with 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 CRM_Utils_Token::replaceContactTokens() by setting the $returnBlankToken argument (5) to TRUE. In fact, this part of the change was identified in https://issues.civicrm.org/jira/browse/CRM-17038

API Explorer[edit | edit source]

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'


$result = civicrm_api3('CustomValue', 'get', array(
  'sequential' => 1,
  'entity_id' => 2,
));

you'll get 31 results:

{
    "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"
        },

etc....

If you do a 'Contact' GET via the API, searching for contacts with a 'custom_40' like 'freephile'

$result = civicrm_api3('Contact', 'get', array(
  'sequential' => 1,
  'custom_40' => array('LIKE' => "freephile"),
));

You'll get "no results"

{
    "is_error": 0,
    "version": 3,
    "count": 0,
    "values": [
 
    ]
}


If you do a Advanced Search (form) on "wUrl Like %freephile%", you'll get 2 contacts.


References[edit source]

  1. 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