# Question
Title: How to troubleshoot "Expected one CustomField but found 0" error?
When I try to open **Contacts** of some Smart Groups, CiviCRM gives me error:

**Expected one CustomField but found 0**

All parent Smart Groups that include faulty Smart Groups are also rendering the same error (can't open contacts).

If I try to delete these Smart Groups, I get Network Error.

When in **Groups tab of Contact profile** I open Smart Groups subsection, it remains empty (no Smart groups are listed). Not sure if for all contacts or only those that are included in faulty smart groups.

How can I fix this error?

CiviCRM 4.7.14 on Drupal 7.59

# DEBUG INFO (sample 1)

CiviCRM\_API3\_Exception: "Expected one CustomField but found 0"

```
#0 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4491): civicrm_api3("CustomField", "getvalue", (Array:3))
#1 sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(452): CRM_Contact_BAO_Query::isCustomDateField("custom_52")
#2 sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(111): CRM_Contact_BAO_SavedSearch::decodeRelativeFields((Array:11), "custom_52", ">=", "35")
#3 sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(197): CRM_Contact_BAO_SavedSearch::getFormValues("custom_52")
#4 sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(590): CRM_Contact_BAO_SavedSearch::getSearchParams("88")
#5 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3054): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
#6 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2947): CRM_Contact_BAO_Query->addGroupContactCache("132", NULL, "contact_a", "=")
#7 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(1794): CRM_Contact_BAO_Query->group((Array:5))
#8 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2021): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), NULL)
#9 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(502): CRM_Contact_BAO_Query->whereClause(NULL)
#10 sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(466): CRM_Contact_BAO_Query->initialize(NULL)
#11 sites/all/modules/civicrm/CRM/Contact/Selector.php(236): CRM_Contact_BAO_Query->__construct((Array:1), (Array:9), (Array:16), FALSE, FALSE, 1, FALSE, TRUE, FALSE, NULL, 1)
#12 sites/all/modules/civicrm/CRM/Contact/Form/Search.php(832): CRM_Contact_Selector->__construct(NULL, (Array:5), (Array:1), (Array:9), 256, FALSE, TRUE, "smog", (Array:9))
#13 sites/all/modules/civicrm/CRM/Contact/Form/Search/Basic.php(188): CRM_Contact_Form_Search->postProcess()
#14 sites/all/modules/civicrm/CRM/Contact/Form/Search.php(718): CRM_Contact_Form_Search_Basic->postProcess()
#15 sites/all/modules/civicrm/CRM/Contact/Form/Search/Basic.php(134): CRM_Contact_Form_Search->preProcess()
#16 sites/all/modules/civicrm/CRM/Core/Form.php(531): CRM_Contact_Form_Search_Basic->preProcess()
#17 sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
#18 sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contact_Form_Search_Basic), "display")
#19 sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Search_Basic), "display")
#20 sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
#21 sites/all/modules/civicrm/CRM/Core/Invoke.php(310): CRM_Core_Controller->run((Array:3), (Array:0))
#22 sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#23 sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#24 sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#25 /includes/menu.inc(527): civicrm_invoke("group", "search")
#26 /index.php(21): menu_execute_active_handler()
#27 {main}

```

# DEBUG INFO (sample 2)

CiviCRM\_API3\_Exception: "Expected one CustomField but found 0"

```
#0 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4491): civicrm_api3("CustomField", "getvalue", (Array:3))
#1 /sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(452): CRM_Contact_BAO_Query::isCustomDateField("custom_21")
#2 /sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(111): CRM_Contact_BAO_SavedSearch::decodeRelativeFields((Array:10), "custom_21", "BETWEEN", (Array:2))
#3 /sites/all/modules/civicrm/CRM/Contact/BAO/SavedSearch.php(197): CRM_Contact_BAO_SavedSearch::getFormValues("custom_21")
#4 /sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(590): CRM_Contact_BAO_SavedSearch::getSearchParams("54")
#5 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3054): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
#6 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2947): CRM_Contact_BAO_Query->addGroupContactCache("89", NULL, "contact_a", "=")
#7 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(1794): CRM_Contact_BAO_Query->group((Array:5))
#8 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2021): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), NULL)
#9 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(502): CRM_Contact_BAO_Query->whereClause(NULL)
#10 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(466): CRM_Contact_BAO_Query->initialize(NULL)
#11 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4330): CRM_Contact_BAO_Query->__construct((Array:1), (Array:1), (Array:16), TRUE, FALSE, 1, TRUE, TRUE, FALSE, NULL, "AND", NULL)
#12 /sites/all/modules/civicrm/CRM/Contact/BAO/Group.php(200): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:1), NULL, NULL, 0, 0, FALSE)
#13 /sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(704): CRM_Contact_BAO_Group::getMember("89", FALSE)
#14 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3054): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
#15 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2947): CRM_Contact_BAO_Query->addGroupContactCache("77", NULL, "contact_a", "=")
#16 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(1794): CRM_Contact_BAO_Query->group((Array:5))
#17 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2021): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), NULL)
#18 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(502): CRM_Contact_BAO_Query->whereClause(NULL)
#19 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(466): CRM_Contact_BAO_Query->initialize(NULL)
#20 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4330): CRM_Contact_BAO_Query->__construct((Array:1), (Array:1), (Array:16), TRUE, FALSE, 1, TRUE, TRUE, FALSE, NULL, "AND", NULL)
#21 /sites/all/modules/civicrm/CRM/Contact/BAO/Group.php(200): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:1), NULL, NULL, 0, 0, FALSE)
#22 /sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(704): CRM_Contact_BAO_Group::getMember("77", FALSE)
#23 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3054): CRM_Contact_BAO_GroupContactCache::load(Object(CRM_Core_DAO))
#24 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2947): CRM_Contact_BAO_Query->addGroupContactCache((Array:1), NULL, "contact_a", "IN")
#25 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(1794): CRM_Contact_BAO_Query->group((Array:5))
#26 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(2021): CRM_Contact_BAO_Query->whereClauseSingle((Array:5), NULL)
#27 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(502): CRM_Contact_BAO_Query->whereClause(NULL)
#28 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(466): CRM_Contact_BAO_Query->initialize(NULL)
#29 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4330): CRM_Contact_BAO_Query->__construct((Array:1), (Array:1), (Array:16), TRUE, FALSE, 1, TRUE, TRUE, FALSE, NULL, "AND", NULL)
#30 /sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(229): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:1), NULL, NULL, 0, 0, FALSE)
#31 /sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php(208): CRM_Contact_BAO_GroupContactCache::add((Array:206))
#32 /sites/all/modules/civicrm/CRM/Group/Page/Group.php(144): CRM_Contact_BAO_GroupContactCache::loadAll()
#33 /sites/all/modules/civicrm/CRM/Core/Page/Basic.php(172): CRM_Group_Page_Group->browse(NULL, NULL)
#34 /sites/all/modules/civicrm/CRM/Core/Invoke.php(310): CRM_Core_Page_Basic->run((Array:2), NULL)
#35 /sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#36 /sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:2))
#37 /sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:2))
#38 /includes/menu.inc(527): civicrm_invoke("group")
#39 /index.php(21): menu_execute_active_handler()
#40 {main}

```

Could it be connected with some **Summary Fields extension** that has somehow messed up some custom fields? In any case, disabling **Summary Fields**, changing its settings or updating to newest version **does not** solve the issue.

# Answer
> 1 votes
These smart groups include custom fields that no longer exist. In the first case, it's the custom field with id of 52; in the second the id is 21. These smart groups should have their criteria modified to reflect the fact that these groups no longer exist.

# Answer
> 1 votes
@junglebird on https://chat.civicrm.org/civicrm provided a solution to delete such groups via API Explorer.

Smart groups also have an entry in **civicrm\_saved\_search**. I think it would be safer to make a list of the group IDs, go to **Support \>\> Developer \>\> API Explorer** and select Entity of **Group**, Action of **Delete**, and set the ID accordingly.

---
Tags: custom-fields, error
---


title: Where does "Added By" value come from?

text:
# Question
Title: Where does "Added By" value come from?
I logged into the back end as "Joomla Administrator". I manually processed a new membership for user "Sheridan Test14". The renewal correctly shows in the membership, contribution, and activity for Sheridan Test14. However, the activity indicated added by "Gmail Test." Test GMail contact has activity that matches the activity in Sheridan Test14. Why is the transaction associated with the contact "Test Gmail" and not contact "Joomla Administrator"?

The membership form uses a price set, price field = Membership Dues financial type and price field 2 = Publications. Does it matter that a Price set is used? Thanks, Kate

\[

# Answer
When you access Civi, you log into your CMS (Joomla in this case) with a CMS account. That CMS account "Joomla Administrator" will be linked to a Civi contact. My guess is that your "Joomla Administrator" account is linked to the "Test Gmail" Civi contact. You can check this by looking at "Test Gmail" summary page in Civi: "Contact ID / User ID" will show Civi's ID for the contact and Joomla's ID for any linked account. A Joomla ID will have a clickable link that will take you to the Joomla Account profile.
> 3 votes

---
Tags: civicontribute, price-sets
---


# Question
Title: Webform-Civicrm issue on iPhone and Safari Browser
I created a simple webform with contribution form integration.

The form will not submit on Safari Browsers and on iPhones regardless whether they are using Chrome or Safari.

Instead of submited the form is reloaded. This only happens when payments are being submitted.

I've addressed all js errors and error still persists.

Using civicrm 5.10.4, webform 4.18 & webform\_civicrm 4.26

# Answer
> 1 votes
It seems to be a problem specific to Stripe and Webform. I opened an issue on Gitlab.

---
Tags: webform-civicrm
---


# Question
Title: Change MailStore from Gmail to Outlook on cloud
Civicrm/Joomla/AWS.

Just changed our email from GSuite to Outlook.

I see from Fetch Bounces error log "could not connect to mailstore @imap.gmail.com.

Where is the file to update this?

# Answer
See https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/#adding-an-incoming-email-account-for-processing-bounces-andor-email-to-activities. Go to admin - civimail - mail accounts.
> 1 votes

---
Tags: joomla
---


title: Dedupe contact subtype field?

text:
# Question
Title: Dedupe contact subtype field?
All volunteer detained migrant visitation and advocacy organization running Civi 5.10.4. under Wordpress 5.1.1. ICE uses an A# to identify people and we'd like to use this number to track folks as well. I set up a detained persons individual contact subtype and placed the A# field under this contact type.

We're trying to use caldera forms for our volunteers to enter data about letters, phone calls, visits for detained persons. When entering data based on name and A# I'm getting duplicate records from identical information. I tried to create a dedupe rule, but don't find fields associated with detained persons individual contact subtype. **Is there a way I can dedupe based on A# which is a detained person specific field?**

# Answer
I made the A# field part of Individual rather than the Detained Persons an Individual sub-type. Many non-detained persons have A#'s so its appropriate. Now that A# is at the Individual level, it was possible to add it to an unsupervised dedupe rule like email. This seems to be working.
> 2 votes

---
Tags: duplicate-contacts
---


# Question
Title: How to fix Undefined index notice in contribution_date_relative?
When I try to **Update Smart Group Counts** in Manage Groups, the CiviCRM provides me with numerous notices.

What is wrong and where do I fix that?

```
Notice: Undefined index: contribution_date_relative in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 204 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_low in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 205 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_high in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 206 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_relative in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 204 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_low in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 205 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_high in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 206 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_relative in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 204 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_low in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 205 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_high in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 206 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_relative in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 204 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_low in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 205 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).
Notice: Undefined index: contribution_date_high in CRM_Contact_Form_Search_Custom_ContributionAggregate->where() (line 206 of /crm/sites/all/modules/civicrm/CRM/Contact/Form/Search/Custom/ContributionAggregate.php).

```

# Answer
> 2 votes
Aivars,

Have logged an issue for this in CiviCRM here and submitted a PR for this fix. Can you please test by applying patch from here? If it works for you than please add a comment on PR which will help to get this fix in core and have it available in next release.

Cheers

Pradeep

# Answer
> 0 votes
Those are php notices. It looks like you are running drupal so see this answer https://stackoverflow.com/a/6363323/8332458

---
Tags: smartgroups, issues
---


# Question
Title: HTTP 500 error trying to import contacts
Running CiviCRM 5.11 plugin on WordPress. This is a fresh install.

Running on a shared hosting service (Arvixe).

PHP release is 7.1

The Import file is less than 10,000 records. One time, it was successful but all subsequent attempts with different files fail with an HTTP 500 Internal Server Error.

Arvixe tech support has set file/directory permissions but won't tell me exactly what they did.

Time out is set to 300 in PHP

What else can I do?

# Answer
I am switching to DigitalOcean. Works fine there. Bye bye Arvixe.
> 1 votes

---
Tags: import, 500
---


# Question
Title: Network error: Unable to reach the server WordPress/CiviCRM
Running CiviCRM 5.11 plugin on WordPress. This is a fresh install on DigitalOcean.

In the WordPress Settings\>General, there is a place to specify a URL, which I did using the URL for the website as registered in DNS.

When I first installed this, the setting used the IP address of the server, for example http://nnn.nn.nnn.nnn

With this setting, no problems.

After I was sure my DNS was pointing to this IP address and that it had propagated, I changed the setting to use the correct URL.

I can log in to WordPress okay but, when I click on the link to CiviCRM, I get a pop-up that says "Network Error: Unable to reach the server. Please refresh the page in your browser and try again. I do that and have to log in again.

All of the WordPress links are working fine. It only is a problem when I click on CiviCRM.

I changed it back to the IP address and CiviCRM works fine

# Answer
> 1 votes
Oops...I needed to make changes to civicrm.settings.php. All fixed

---
Tags: wordpress
---


title: CiviCase Attachment

text:
# Question
Title: CiviCase Attachment
1) I would like to know where the attachments for CiviCase are kept ? Can we configure it to use an external storage like Firebase storage.

2) How do you use the APIs to put the attachment as well ?

# Answer
Under admin - system settings - directories there is a setting for custom files directory. They are stored on disk in that folder. By default on drupal for example this is sites/default/files/civicrm/custom.

For the api see Uploading files through the API
> 1 votes

---
Tags: civicase
---


title: Programmatically Re-Use CiviMail Emails

text:
# Question
Title: Programmatically Re-Use CiviMail Emails
I am trying to write an extension that monthly will send a series of CiviMai emails. Basically, it would be the same if a user went to the *Sent* mailings and clicked *Re-Use* and sent the email again without any changes to the email at all.

Obviously, I need the email to be sent the first time but after that, I am not sure how I would use the API to duplicate the email and then schedule it to send.

Any help is greatly appreciated. I am using Drupal 7 and CiviCRM 5.11.

Thanks, Josh

# Answer
Look at the bottom lines here to get you started: https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/Controller/Send.php

i.e. `$clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));` and then follow thru the rest of the code.
> 1 votes

# Answer
We have an extension that does something similar i.e. injects emails into the civimail queue. If your interested drop me a line.
> 0 votes

---
Tags: civimail, api
---


title: Prettify CiviCRM pages

text:
# Question
Title: Prettify CiviCRM pages
Total newbie. Don't know what I don't know...

I am trying Civi with WP. Tried with Joomla. I loved Drupal in another life. :-)

Is there a simple way to make the output pages for Civi (like events, registration, etc.) prettier - more in line with the types of pages you see in a typical website? I guess I'm spoiled with all these builders these days.

Like a theme of some sort? Or an addon?

The presentation here is gorgeous: https://www.cividesk.com/civicrm/event/register?id=611&reset=1

But (1) I think that's Drupal and (2) I think it's custom.

I just can't seem to find a way (short of modifying .tpl files) to make Civi look a bit better.

Thoughts?

Thanks, Mark

# Answer
You can create your own event registration pages using HTML and profiles. You can use the APIs if you want to create different administration pages
> 1 votes

# Answer
With Drupal you can use Webform and CiviCRM Webform Integration. These give you a lot of flexibility in designing forms that look more current. CSS is simple with this since it is built into Webform. Example of a contribution page-- https://secure.radiusinternational.org/give-financially
> 1 votes

---
Tags: wordpress, templates
---


title: Civimail gives a blank page

text:
# Question
Title: Civimail gives a blank page
Upgrading to Civi 5.11.0 in a Joomla 3.9.4 site (with templates & cache flushed) has left Civimail (via New Mail or Reuse) producing only blank pages (with menus and Civi's footer).

There is no error message with or without 'Enable Debugging' and 'Display Backtrace' turned on. However, just toggling 'Enable Debugging' ON makes the problem go away, while OFF brings it back, again with no error messages.

Any clues?

# Answer
Sorry, should have searched more carefully. Found the answer here:

Status page angular load error
> 2 votes

---
Tags: civimail, upgrade, debugging
---


# Question
Title: CIVICRM Create API for event participate
I create an event. I need to create an API for Event Participate(Registration) page. I also retrieve all participates users data via API too. Please let me know . I just go API v3 . And see there is Event in Entity fields. I choose it. I choose get .I see there is return form too.I need all participates information . what their address,nationality and some customs fields too. I see there is create function but I don't know how can I add fields.please let know.

# Answer
> 3 votes
Md Maidul Islam,

Bit difficult to understand from your question what you want to achieve.

1 - Do you mean to add participant for an event? Then you can use Entity = Participant and Action = Create api

```
$result = civicrm_api3('Participant', 'create', [
  'event_id' => 3,
  'contact_id' => 51,
]);

```

2 - Do you mean to add participant for an event with all contact details in one call ? Then you can use Entity = Contact and Action = Create chain api

```
$params = [
    'display_name' => 'batman',
    'contact_type' => 'Individual',
    'api.address.create' => [
      'contact_id' => '$value.id',
      'location_type_id' => 6,
      'street_name' => 'Ambachtstraat',
      'street_number' => '23',
      'street_address' => 'Ambachtstraat 23',
      'postal_code' => '6971 BN',
      'country_id' => '1152',
      'city' => 'Brummen',
      'is_primary' => 1,
    ],
    'api.email.create' => [
      'contact_id' => '$value.id',
      'location_type_id' => 'Main',
      'email' => 'api@a-team.com',
      'is_primary' => 1,
    ],
    'api.phone.create' => [
      'contact_id' => '$value.id',
      'location_type_id' => 6,
      'phone' => '(123) 456-7890',
      'is_primary' => 1,
      'phone_type_id' => 1,
    ],
    'api.participant.create' => [
      'contact_id' => '$value.id',
      'event_id' => 2,
      'status_id' => 1,
      'role_id' => 1,
      'register_date' => '2007-07-21 00:00:00',
      'source' => 'Online Event Registration: API Testing',
      'custom_1' => 'custom string',
    ],
  ];
$result = civicrm_api3('Contact', 'create', $params);

```

3 - Do you mean to get participant of an event with all contact details in one call ?

```
   $params = array(
    'contact_id' => 2,
    'event_id' => 3,
    'api.contact.get' => 1,
    'api.email.get' => ['contact_id' => '$value.contact_id'],
    'api.address.get' => ['contact_id' => '$value.contact_id'],
    'api.phone.get' => ['contact_id' => '$value.contact_id'],
  );

```

HTH

Pradeep

Note: The params build above are not tested, but its the syntax on how one can build params when using chain api.

HTH

Pradeep

---
Tags: civievent, participants
---


# Question
Title: Error: more than 'max_user_connections' active connections
Several times a day on our Civi site (CiviCRM 5.11.0 with Drupal 7.64) we are experiencing the following error:

> PDOException: SQLSTATE\[HY000\] \[1203\] User xxx already has more than 'max\_user\_connections' active connections in lock\_may\_be\_available() (line 167 of /includes/lock.inc).

The error causes the site to crash and lasts for about a minute or two.

We are on a shared hosting platform, and I contacted support about this. They gave us the following information about the issue:

> *You have a limit of 40 connections per user which is being exceeded. The problem is that your database is not optimized, and 95% of the queries to it take an average of eight seconds to be executed. Each query goes through more than 12 billion rows. This is causing connections to overlap, hence the error.*

They suggested I should *'optimise the database'*. I am not completely sure what I should do to optimise the database. Can anyone give me any advice on what I can do to help prevent this error?

The support people also sent me an excerpt from the MySQL slow query log:

```
# Current date: Mon Apr 1 17:20:26 2019
# Overall: 18.13k total, 902 unique, 0.13 QPS, 0.32x concurrency _________
# Time range: 2019-03-31T00:27:16 to 2019-04-01T17:20:06
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 45692s 100ms 52s 3s 8s 3s 1s
# Lock time 16s 0 4s 857us 366us 28ms 108us
# Rows sent 28.16M 0 3.17M 1.59k 964.41 28.34k 964.41
# Rows examine 12.25G 0 3.18M 708.38k 2.15M 753.22k 362.29k
# Rows affecte 4.70M 0 1.23M 271.74 0.99 12.94k 0
# Bytes sent 15.78G 11 2.63G 912.46k 830.38k 23.41M 790.84k
# Query size 323.12M 6 4.15M 18.25k 1.86k 140.56k 51.63

# Query 1: 0.08 QPS, 0.31x concurrency, ID 0x1859D41021C2B8A4 at byte 62429572
# This item is included in the report because it matches --limit.
# Scores: V/M = 1.44
# Time range: 2019-03-31T01:01:42 to 2019-04-01T17:20:06
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 59 10837
# Exec time 94 43287s 100ms 16s 4s 8s 2s 4s
# Lock time 20 3s 50us 51ms 294us 176us 2ms 113us
# Rows sent 36 10.33M 0 1000 999.72 964.41 15.04 964.41
# Rows examine 96 11.86G 19.53k 2.85M 1.12M 2.26M 694.00k 1.03M
# Rows affecte 0 0 0 0 0 0 0 0
# Bytes sent 54 8.59G 2.15k 846.53k 831.20k 830.38k 23.42k 790.84k
# Query size 0 555.76k 51 53 52.51 51.63 0.45 51.63
# String:
# Databases wfto_civicrm
# Hosts localhost
# Last errno 0
# Users wfto
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms ########
# 1s ################################################################
# 10s+ #
# Tables
# SHOW TABLE STATUS FROM `wfto_civicrm` LIKE 'log_civicrm_group'
# SHOW CREATE TABLE `wfto_civicrm`.`log_civicrm_group`
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM `log_civicrm_group` LIMIT 2047000, 1000

# Query 2: 0.01 QPS, 0.01x concurrency, ID 0x9BE31CBEA5AB2481 at byte 154842157
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.09
# Time range: 2019-03-31T00:59:00 to 2019-04-01T16:23:24
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 9 1726
# Exec time 1 772s 100ms 1s 447ms 777ms 202ms 433ms
# Lock time 3 533ms 60us 50ms 308us 204us 2ms 119us
# Rows sent 5 1.64M 0 1000 996.96 964.41 51.88 964.41
# Rows examine 2 361.70M 31.25k 381.79k 214.59k 362.29k 95.30k 211.82k
# Rows affecte 0 0 0 0 0 0 0 0
# Bytes sent 2 387.79M 3.55k 276.83k 230.07k 233.54k 17.06k 222.42k
# Query size 0 99.19k 58 59 58.85 56.92 0 56.92
# String:
# Databases wfto_civicrm
# Hosts localhost
# Last errno 0
# Users wfto
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms ################################################################
# 1s #
# 10s+
# Tables
# SHOW TABLE STATUS FROM `wfto_civicrm` LIKE 'log_civicrm_custom_field'
# SHOW CREATE TABLE `wfto_civicrm`.`log_civicrm_custom_field`
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM `log_civicrm_custom_field` LIMIT 367000, 1000

```

# Answer
Do you perhaps have turned on 'Detailed Logging'? If so, turn it off at

Administer -\> System Settings -\> Misc

See also:

https://docs.civicrm.org/sysadmin/en/latest/setup/logging/
> 1 votes

---
Tags: error, mysql, performance
---


# Question
Title: How do you input Virgin Money Giving Donations into CiviCRM?
Just a quick question, is there any better way to get donations from outside services like Virgin Money Giving or Facebook that just manual input?

At the moment, I'm just assuming that we add the contact/donation manually into the system with the source being "Facebook Page" or "Virgin Money Giving" or whatever it may be.

Any suggestions on how any other NFPs are doing this with Civi at the moment?

Thanks.

# Answer
If you can export the donations out of those systems in a CSV then you could import the contributions to Civi.

There is fairly old extension for importing Just Giving donations. Don't know whether it still works but would be a base for developing an automated import. Once it is working you could add a Scheduled Job to do the import regularly. Obviously you need to be careful to avoid importing the same donation in multiple batches.
> 2 votes

---
Tags: donations, facebook
---


# Question
Title: Inline editing of website field deletes it
When inline editing a website field, it deletes the field completely.

Inline adding a website does work, and it doesn't occur when editing the complete contact. I cannot find anybody else having this issue. Everybody can reproduce this on the demo site at:

https://civicrm.demo.civihosting.com/civicrm/contact/view?reset=1&cid=205

but it also occurs on my own 5.11.0 (In Drupal 7.65) site. Does anybody have a solution for this?

Steps to reproduce:

* open an existing contact with filled website field, or create one
* click on 'Add or edit website' next to the url
* edit the url and press Enter or click 'Save'

The website field is empty now.

# Answer
Michael,

Have logged an issue for this here and have also provided a fix for this issue. Can you please apply patch from here and test if it solves your problem? Also please try to comment on PR if the patch works for you. This will fasten process of merging PR into core so that it can be available in next release.

HTH

Pradeep
> 4 votes

---
Tags: bug-reporting
---


# Question
Title: Recurring Contributions consistently stuck in Pending Status
We've been noticing a trend over the last few months that typically around the 21-23 of the month several of our recurring contributions end up not being processed by iATS and then get stuck with a Pending status. Where are the first places that I should look to figure out the problem of why there is this pattern? We are using Civi 5.10.4 and iATS Extension 1.6.2.

# Answer
> 0 votes
First place to look is to ensure your cron is running properly. The verification is managed by two scheduled jobs: one to pull in the journal from iATSpayments.com and one to the verify (checks the journal entries to see if any of your contributions have been completed).

---
Tags: iats
---


title: Importing contact from excel file

text:
# Question
Title: Importing contact from excel file
How can I import contacts to a group in CiviCRM from an excel file?

Kind regards,

Alexia

# Answer
> 3 votes
You can use Import contact screen to add contact in a group. On preview page of import i.e 3rd page, the screen provides ability to add imported contacts into group. Selecting group from the dropdown would add contact(s) to group.

HTH

Pradeep

---
Tags: contacts
---


# Question
Title: Searches generate error 'CiviCRM_API3_Exception: "Constructor failed"'
Either toolbar searches or advanced searches on Joomla/Civi latest version generate the following error (with full debugging/backtrace on - and reformatting to make more legible, the actual error looks like below):

```
CiviCRM_API3_Exception: "Constructor failed"
#0 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(1394): civicrm_api3("address", "getoptions", (Array:4))
#1 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Search/Criteria.php(415): CRM_Core_Form->addSelect("world_region", (Array:3))
#2 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Search/Advanced.php(150): CRM_Contact_Form_Search_Criteria::location(Object(CRM_Contact_Form_Search_Advanced))
#3 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(606): CRM_Contact_Form_Search_Advanced->buildQuickForm()
#4 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Refresh.php(62): CRM_Core_Form->buildForm()
#5 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Contact_Form_Search_Advanced), "refresh")
#6 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Search_Advanced), "refresh")
#7 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("refresh")
#8 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller->run((Array:4), (Array:0))
#9 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#10 /var/www/html/sitename/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#11 /var/www/html/sitename/administrator/components/com_civicrm/civicrm.php(121): CRM_Core_Invoke::invoke((Array:4))
#12 /var/www/html/sitename/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
#13 /var/www/html/sitename/libraries/src/Component/ComponentHelper.php(402): require_once("/var/www/html/sitename/administrator/components/com_civicrm/...")
#14 /var/www/html/sitename/libraries/src/Component/ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent("/var/www/html/sitename/administrator/components/com_civicrm/...")
#15 /var/www/html/sitename/libraries/src/Application/AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent("com_civicrm")
#16 /var/www/html/sitename/libraries/src/Application/AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch()
#17 /var/www/html/sitename/libraries/src/Application/CMSApplication.php(196): Joomla\CMS\Application\AdministratorApplication->doExecute()
#18 /var/www/html/sitename/administrator/index.php(51): Joomla\CMS\Application\CMSApplication->execute()
#19 {main}

```

This is happening on two Joomla 3.9.4 & CiviCRM 5.11.0 sites.

# Answer
On the surface this was a memory issue - increasing PHP memory limit from 512mb to 900mb fixed the error and let search work as before.

The most likely cause was the ICU update for PHP 7.2.16 - http://site.icu-project.org/download/64 \- which came out & was merged into FreeBSD the night before the problems emerged. I can't really take it any further than that. The ICU update referenced "Various Out-Of-Memory (OOM) issues have been fixed" so maybe that's a clue if someone else had the same problem and can't increase PHP memory limit further.
> 1 votes

---
Tags: joomla, error, search
---


# Question
Title: The versafix-1 template on the mosaico site has editing options I don't see in civi. Any chance of getting them?
I'm trying to get my users off of creating an email in mailchimp and importing the html into civi. Mosaico seems to fit the bill. I showed it to the main user today and, of course, they had issues. Mainly with centering of things.

I later went and looked at the template in the mosaico site, https://mosaico.io/ and noticed that there are more editing options there than in the implementation on civi.

So the question is do I have something set wrong so I'm missing these or is there a later version of the versafix-1 template out there that just hasn't been upgraded yet in civi?

Examples of options not available in civi. If you pick the block with an image at the top, a title below it, body text below that and a button (the third block from the top of the list of bocks), there is an option to pick the size of the image. The image is centered (in civi, it's left justified), you can edit the style and center the title, center the button.

Using mosaico extension version 2.0-beta4.1528762072. I'm not using shoreditch. I couldn't get it to work and since it says it optional...

# Answer
we're looking to upgrade the mosaico library in CiviCRM to the latest version in the next few weeks. After we do that the extra features will become available.
> 4 votes

# Answer
Much of what you're looking to do can now be done via an extension. There's an extension that's not pretty but does the trick called Mosaico Toolbar Config from Ginkgo Street Labs.
> 2 votes

---
Tags: mosaico
---


title: Contribution tokens

text:
# Question
Title: Contribution tokens
I am working on a new template for thank you letters and I can't find the contribution tokens that I used in the past. Unfortunately I deleted the old templates, so I don't remember what they were exactly. Now I only see tokens that relate to the contact and not the contribution itself, e.g. latest contribution.

Did those tokens disappear? What am I missing?

# Answer
It may be an issue with where you are trying to create your email template. If you do this via Find Contributions (eg then Action = Send Email) you should find that all your Contribution tokens are available for usage.
> 1 votes

---
Tags: contributions
---


# Question
Title: Deprecated function in CiviEvent error logging (Drupal 7)
Running Civi 5.10.4 and Drupal 7.65.

One of our staff reported that they received an error message when they tried to send out a mailing to attendees at one of our events, through CiviEvent \> Email all participants.

She sent out the email at the same time that our monthly newsletter was going out (2500 contacts), and we have a limit set on how many emails are sent per hour. (Settings are below.)

I checked Drupal error logs and found this log but I have no clue what it means:

```
Deprecated function CRM_Event_BAO_Event::checkPermission, use CRM_Event_BAO_Event::getAllPermissions. Array ( [civi.tag] => deprecated )

```

I'm thinking our staff member got an error message because she sent out the email at the same time that we had our newsletter queued for delivery, but haven't been able to find any confirmation of this (or any information on why her CiviEvent email to 12 people wasn't just queued to be delivered after the newsletter was delivered).

Would appreciate help on interpreting that error message, or modifying settings so that this doesn't happen again. I guess a workaround solution is to ask staff not to send emails out at certain times to allow the newsletter to go out, though ideally I'd be able to do this without affecting other staff member's workflows.

EDIT: The adjacent error messages are as below (with a variety of referrers, all 'page not found' errors):

```
sites/default/files/civicrm/css

```

# Answer
That message shouldn't affect your usage of CiviCRM.

A deprecated function is typically one that works, but is no longer recommended for use. The message is only applicable to developers.

To take an example with a visible component: You may have noticed that CiviCRM has two different calendar widgets. The older one isn't accessible to folks using screen readers (i.e. Braille or text-to-speech). However, each date field needs to be converted separately - a lot of work! Rather than do them all at once, we have both calendar widgets in CiviCRM, but the first is marked "deprecated" so folks are warned not to use it in new code, and to remove it from old code when they touch that section. In time, that code will be removed - but for now, it works as it always has.

Unless you have an extension that uses this deprecated function, there's no action you need to take. While it's unlikely you have an extension that uses this, you can double-check by searching your extensions directory for the text `CRM_Event_BAO_Event::checkPermission`.
> 1 votes

---
Tags: civievent, drupal, civimail
---


title: City shows 'contact.city' on Summary

text:
# Question
Title: City shows 'contact.city' on Summary
I'm not sure if this is a bug or a problem that I need to fix - one of my sites doesn't display the City on the Summary and only shows 'contact.city', e.g.

It's a multi-site running v5.10.4

# Answer
> 4 votes
I believe the 'Address Display Format' is not set properly in your system. Navigate to CiviCRM \>\> Administrator \>\> Localization \>\> Address Settings. Check values in 'Address Display Format' field. The **contact.city** should be inside open and closed curly braces eg **{contact.city}**.

Default value of 'Address Display Format'

```
{contact.address_name}
{contact.street_address}
{contact.supplemental_address_1}
{contact.supplemental_address_2}
{contact.supplemental_address_3}
{contact.city}{, }{contact.state_province}{ }{contact.postal_code}
{contact.country}

```

HTH

Pradeep

---
Tags: contacts
---


# Question
Title: CiviCRM upgrade can't find core module in Drupal
I'm trying to run a civicrm core module upgrade on a drupal 7 site. I follow all of the posted instructions, but when I run the civicrm/upgrade I get a white screen. When I return to the drupal modules the main civicrm core module is no longer listed. If I run the drupal upgrade script I get an error message that civicrm module is missing ... but I can see the module loaded on the server, with all it's files, in the correct location.

I shouldn't have to uninstall the module because I'm upgrading. I disabled all of the civi helper modules, but made sure to leave the main civicrm module enabled, but I still get the missing module message.

Any help would be greatly appreciated.

# Answer
Since it's no longer listed and it says it can't be found, it's usually one of these two things:

* your files are uploaded into the wrong spot
* your files have the wrong permissions and/or user attached
> 1 votes

---
Tags: drupal, upgrade, core
---


title: passing POST payload in Content Body

text:
# Question
Title: passing POST payload in Content Body
I'm unhappy at the prospect of passing sensitive data like contact details as URI parameters for a POST (where they will show in logs, etc.). Is it possible to pass the details in the content body instead? This is standard practice for RESTful APIs and I'm surprised that it is not the standard for civi.

# Answer
> 1 votes
Yes the civicrm extern/rest.php will merge GET and POST parameters.

Regarding security, while yes it is better to send private data in POST, it's not necessarily that much more secure since POST data can be logged too, just you're right not usually by default. See also https://security.stackexchange.com/questions/30754/is-there-a-difference-between-get-and-post-for-web-application-security. For real privacy it would need to be encrypted, and then have some way to decrypt it at the civicrm end.

---
Tags: contacts, api
---


title: cms.root Setting

text:
# Question
Title: cms.root Setting
When i set up the Settings this way: http://example.com/civicrm/admin/setting/url?reset=1

```
[cms.root]/libraries/civicrm

```

It tries to resolve resources from:

```
http://default/...

```

When i change to absolute path:

```
http://example.com/libraries/civicrm

```

it works. But should't the example above be correct?

**SOLVED Edit:**

as @Demerit and @Aidan corectly pointed out, that setting was in

```
civicrm.settings.php

```

in

```
web/sites/default/

```

TY!

# Answer
> 1 votes
This may not be relevant, as the URLs don't look like Wordpress, but I had a similar problem when I had a dev version on dev.example.com. The absolute path is

> https://dev.example.com/wp-content/plugins/civicrm/civicrm/

But \[civicrm.root\] is

> https://dev.example.com/dev/wp-content/plugins/civicrm/civicrm/

The problem is that the files are held in subdirectory dev but this is handled by a redirect in the CMS hosting service.

There was no problem when the URL was just example.com. So also depends on the actual URL you use for CiviCRM.

# Answer
> 1 votes
I think I'd agree with @Aidan it's probably in civicrm.settings.php. Based on your other question you've used composer to install, and then likely used drush to enable the civicrm module. If you do that you need sometimes to pass the -l parameter to drush otherwise it puts "default" in for the domain name in civicrm.settings.php.

---
Tags: civicrm.settings
---


# Question
Title: (Solved) Undefined function in webform_civicrm
Drupal 7, Civi 7.x-5.11.0

I've installed the latest webform module and the most recent webform\_civicrm from Github.

I'm getting the following error when submitting or trying to access webform submissions:

Error: Call to undefined function wf\_crm\_apivalues() in webform\_civicrm\_webform\_submission\_load() (line 316 of /sites/all/modules/webform\_civicrm/webform\_civicrm.module).

Any ideas where I can look or advice to fix?

Thanks, Davy

# Answer
> 5 votes
Thanks for letting us know about the problem. I've just pushed a fix into the 7.x-4.x branch to ensure the function gets loaded. You can update your local copy of the module (`cd /path/to/modules/webform_civicrm && git pull`) and try again.

# Answer
> 1 votes
If you've installed from github you're installing a beta or maybe even alpha version. In fact I can see that line 316 listed in the error message was only added 6 days ago! There are links at the bottom of the drupal project page to stable versions - use those instead. https://www.drupal.org/project/webform\_civicrm

---
Tags: drupal, webform-civicrm
---


title: Membership Renewal Reminder Issue

text:
# Question
Title: Membership Renewal Reminder Issue
We have been having issues trying to add a scheduled email reminder for members that have a membership expiring in two weeks. Every time we try - CiviCRM stalls and the logo simply spins.

Only error I can find is

```
send @ jquery.min.js?r=kX8Gx:4
/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FscheduleReminders&action=add&snippet=json:1 Failed to load resource: the server responded with a status of 403 ()

```

also the warning:

```
send @ jquery.min.js?r=kX8Gx:4
/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FscheduleReminders&action=add&snippet=json:1 Failed to load resource: the server responded with a status of 403 ()

```

I was not able to duplicate in the demo - any idea what is happening?

Latest wordpress and CiviCRM

# Answer
Turns out Wordfence was blocking the param for the following reason:

blocked by firewall for XSS: Cross Site Scripting in POST body: User in city left https://domain.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FscheduleReminders&reset=1 and was blocked by firewall for XSS: Cross Site Scripting in POST body: html\_message=%3Cp%3E%26nbsp%3B%3C%2Fp%3E%0A%0A%3Cp%3E%3Cmeta%20charset%3D%22utf-8%22%20%2F%3E%3C%2Fp%3E%0A%0A%3Cp… at https://domain.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2FscheduleReminders&action=add&sni
> 3 votes

---
Tags: wordpress, scheduled-reminders
---


# Question
Title: API problem regarding to Word Replacement
I want to replace a word. I was trying to insert using API3 but it is not working properly.

> Word replacement API3

```
$result = civicrm_api3('WordReplacement', 'create', [
  'find_word' => "Contacts",
  'replace_word' => "Data",
  'id' => 1,
]);

```

> Output {

```
"is_error": 0,
"version": 3,
"count": 1,
"id": 1,
"values": {
    "1": {
        "id": "1",
        "find_word": "Contacts",
        "replace_word": "Data",
        "is_active": "",
        "match_type": "",
        "domain_id": "1"
    }
}

```

---

But the values are not stored in 'civicrm\_word\_replacement' table. Please give some suggestion. When I am trying to insert a value using custom php script then it is showing me a following error.
```
PHP Fatal error:  Uncaught Error: Call to undefined function _drupal_flush_css_js() in C:\xampp\htdocs\copy\sites\all\modules\civicrm\CRM\Utils\System\DrupalBase.php:300

```

# Answer
> 1 votes
Your code includes `'id' => 1`

`create` with an id is for updating an existing value. Do you already have a WordReplacement with id=1 ?

If you are wanting to create a new one rather than update, just omit `'id' => 1`

# Answer
> 1 votes
It looks like you are creating it disabled?

> ```
>     "is_active": "",
>
> ```

---
Tags: api, php
---


# Question
Title: Change Reply-To for System Workflow Messages?
Is it possible to change the reply-to for system workflow messages?

# Answer
> 1 votes
This is similar but slightly different from How to send email report FROM other than default email address?

So a similar workaround would be to use hook\_civicrm\_alterMailParams.

---
Tags: system-workflow-messages
---


title: Reserved de-dupe rules

text:
# Question
Title: Reserved de-dupe rules
I'm wanting to refine the de-duping rules, but first of all I'd like to find out exactly what the predefined rules are before I create my own. They are reserved, so you can't edit them, which is fine, but it only tells you which fields they use and not what the weights and thresholds are so the full behaviour is not clear.

# Answer
Demerit's and Mick's answers are incorrect for the (built-in) reserved rules - though it's definitely confusing!

If a RuleGroup has a value in the `name` field, and that name corresponds to a filename in CRM/Dedupe/BAO/QueryBuilder, then the customized SQL in those files will be used. The existing entries in `civicrm_rule` for those RuleGroups are holdovers from before that system existed, and editing them has no effect.

"Standard" dedupe rules with multiple criteria are very inefficient compared to handwritten SQL, which is why this is a valuable technique. You can create your own handwritten queries with hook\_civicrm\_dedupe, and the Veda dedupe extension has a number of excellent examples. Note that this extension doesn't work on modern Civi because of some of its other functions, but the dedupe rules can be ripped out into something else.

Finally - I learned just yesterday that the built-in handwritten dedupe rules seem to execute different SQL when comparing in Unsupervised/Supervised mode (a single contact) vs. General mode (find all dupes). While I haven't proved it, I suspect that if you're in the rare scenario of needing to optimize your unsupervised/supervised dedupes, creating a new class to extend `CRM_Dedupe_BAO_QueryBuilder` is the way to go. I just posted org.agbu.optimizeddedupe to provide an example of this.

UPDATE: More clarification.

To understand how the queries work, it's best to look at an example, eg IndividualUnsupervised.php.

The `internal` function is used if you go to **Contacts » Find and Merge Duplicate Contacts** and click **Use Rule**. The SQL query is:

```
            SELECT contact1.id as id1, contact2.id as id2, {$rg->threshold} as weight
            FROM civicrm_contact as contact1
              JOIN civicrm_email as email1 ON email1.contact_id=contact1.id
              JOIN civicrm_contact as contact2 ON
                contact1.first_name = contact2.first_name AND
                contact1.last_name = contact2.last_name
              JOIN civicrm_email as email2 ON
                email2.contact_id=contact2.id AND
                email1.email=email2.email
            WHERE contact1.contact_type = 'Individual'"

```

First, note that the weight is set to `$rg->threshold` \- that is, the threshold in `civicrm_rule_group`. In other words, if this SQL matches, these records automatically meet the threshold for that rule. Hopefully that answers your main question! If you remove that field, you can run this SQL as-is in a SQL client and get a complete list of the duplicates it would return.

To further clarify - unlike "regular" rules which are the result of several queries, each with their own weight - this runs a SINGLE query, and sets the weight equal to the rule's threshold. So it's a straight yes/no answer whether a record is a duplicate, based on whether the SQL finds them.

That's not to say that you can't simulate length/weight, but it's tricky. My `org.agbu.optimizeddedupe` rule has a SQL statement you can look at which gives the same results as this rule:

However, it took about 5 seconds to compare even a single submitted contact against the existing 165,000 contacts in this databse with the existing rule. Now it's almost instantaneous.
> 4 votes

# Answer
EDIT: This answer is wrong. See Jon's answer. The reserved rules don't use the values in the database they use custom queries.

---

If you have access to the database type

`SELECT * from civicrm_dedupe_rule r inner join civicrm_dedupe_rule_group rg on rg.id = r.dedupe_rule_group_id;`

which will give you a table which isn't pretty but is mostly understandable.
> 2 votes

---
Tags: duplicate-contacts
---


title: Report with Payment Processor

text:
# Question
Title: Report with Payment Processor
I'm trying to get a report with the name of the Payment Processor that was used for each online Payment. I'm not able to get this to work. Been though the API trying to track the data but not that familiar where that is stored.

It looks like this data is shown on the Contribution view. "PayPal" on the image is the name of the Processor and other Contributions have the name of my other Payment processor. Any ideas?

# Answer
> 1 votes
I had the same problem, wanting to reconcile against the PayPal account. I'm not sure why there isn't a *Payment Method* column in any of the reports.

I

1. Created a new 'Asset' type financial account under CiviContribute \> Financial account. If you leave it as 'Revenue' type it does not appear under the payment processor form list
2. Changed the Financial Account under System Settings \> Payment processors.
3. The bookkeeping report from extended reports (dmaster.demo.civicrm.org) has this column, but it cannot sort by transaction date as per How do I sort the bookkeeping report by date? so export and sort with the spreadsheet program.

# Answer
> 0 votes
Try using book keeping report which provides additional filters and fields related to accounting. You can also search transactions based on account being used.

Hth Pradeep

---
Tags: civicontribute, civireport, contributions
---


# Question
Title: How to set a permission using drupal ACL?
I am developing an extension. I want to provide permissions using drupal.

I am using following hook for creating a permission

```
hook_civicrm_permission(&$permissions);

```

But, how to do that (means can view or edit some custom data)? Please suggest some similar extensions.

# Answer
There is a example and information on the hook here. Throw the hook into your custom module and it should work. The below example includes a version check that you likely won't need.

```
function civimonitor_civicrm_permission(&$permissions) {
  $version = CRM_Utils_System::version();
  if (version_compare($version, '4.6.1') >= 0) {
    $permissions += array(
      'access CiviMonitor' => array(
        ts('Access CiviMonitor', array('domain' => 'com.aghstrategies.civimonitor')),
        ts('Grants the necessary API permissions for a monitoring user without Administer CiviCRM', array('domain' => 'com.aghstrategies.civimonitor')),
      ),
    );
  }
  else {
    $permissions += array(
      'access CiviMonitor' => ts('Access CiviMonitor', array('domain' => 'com.aghstrategies.civimonitor')),
    );
  }
}

```
> 1 votes

---
Tags: drupal, extension, permissions, hooks
---


# Question
Title: (SOLVED) String impossible to translate Civicontribute
It seems that i can't translate, even within word replacement, the 'Credit Card Information' string. I am using Stripe as payment processor. Would this be related to them and not CiviCRM? Has anybody successfully translated it?

# Answer
> 4 votes
This is a good question.

The word "Information" is being translated SEPARATELY from the words "Credit Card". You can see this if you switch the language to Spanish for example. It will then say "Informacion Credit Card".

But the "Credit Card" part is intended to be coming from the label for the payment type as defined in the admin section for payment methods. However the code in CRM\_Core\_Payment::getPaymentTypeLabel() has a comment that this was never finished, and so it has the words "Credit Card" hardcoded.

If you want a hack then you can edit the line in templates/CRM/Core/BillingBlock.tpl where it says `<legend>{$paymentTypeLabel}</legend>` to say `<legend>Desired Text</legend>`, but this will get overridden each time you upgrade.

---
Tags: civicontribute
---


title: CKEditor / wysiwyg for public profile

text:
# Question
Title: CKEditor / wysiwyg for public profile
I have a custom data field that is a profile that I'm sharing via the frontend of my web site (to Registered users).

I'm using Joomla 3.8.x and civiCRM 5.10.0 -- I've set the custom field as "Note Rich Text Editor" but when include the field in a profile to allow registered users to complete the field, the editor doesn't appear -- just a text box.

Any ideas why this would be?

# Answer
\[civicrm.root\] wrongly evaluated on Joomla. See: https://lab.civicrm.org/dev/joomla/issues/5

A fix for your particular issue is: Create an override file in your Custom PHP Directory for CRM/Core/Resources.php

On Line: 738 CHANGE:

```
'wysisygScriptLocation' => Civi::paths()->getUrl("[civicrm.root]/js/wysiwyg/crm.ckeditor.js"),

```

TO:

```
'wysisygScriptLocation' => Civi::paths()->getUrl(Civi::settings()->get('userFrameworkResourceURL')."/js/wysiwyg/crm.ckeditor.js"),

```
> 1 votes

---
Tags: ckeditor
---


# Question
Title: Any reason why an organisation should NOT register for an event?
I have a draft webform set up to allow an organisation to register for an event (for an exhibition stand booking). Is there any reason NOT to do this?

Civi 5.11, Drupal 7.

# Answer
There is no reason why an Organisation contact can't register for Event. ATM its not supported through CiviCRM online registration form however you can use Drupal Webform to register Organisation for event.

HTH

Pradeep
> 3 votes

# Answer
Here’s a reason:

There will be a person/(Individual) that will show up at the Event to staff a booth, to join an opening reception. The invoice will typically also go to an Individual Attn of: working for a company.

So best way to handle this is to add two Contacts to your webform: one of Contact Type Individual and one of Contact Type Organization. You can connected the two with Current Employer field for the Individual.

Then you can have the information you need to print a Name Tag, send a Thank you letter etc.
> 3 votes

---
Tags: civievent, drupal, webform-civicrm
---


# Question
Title: By mistake manually entered a recurring donation under the wrong account
By mistake manually entered a recurring donation under the wrong account. Basically I have two users same name. So By confusion add recurring on wrong account. SO Now i want to move it from one account transaction to another account. I know i can disable the recurring on one account and enabled on another account. But i am founding the way to move recurring transaction one account to another account. Stripe payment processor is working.

# Answer
Did any monies get processed when you added the recurring Donation? If it did (or did not) will depend on your Payment processor and what pathway you used in CiviCRM to add the Contribution.

If Monies were transacted -\> then you'll not just want to Delete the Contribution and re-enter or you'll charge the Credit Card (or Bank Account) again. If you can add some more details to your original question then we can help you find a solution that will work for you.
> 2 votes

# Answer
Welcome to CiviCRM. I think the easiest way to deal with this is to delete the contribution and re-enter it in the correct record, by doing this:

1. Select the record of the contact who has been credited with the contribution. In their contribution tab, look over to the far right where you will see a "Delete" option against the appropriate payment.
2. After taking note of the caption "Deleting this contribution will result in the loss of the associated financial transactions if any", confirm "Delete".
3. Re-enter the payment in the record of the correct contact.

Hope this helps.
> 0 votes

---
Tags: drupal, recurring-contributions
---


title: Mailchimp/Civicrm synchronization

text:
# Question
Title: Mailchimp/Civicrm synchronization
I just recently upgraded to Civicrm 5.9.1. I had used the Mailchimp extension in the past in test mode previous to our current Civicrm upgrades, and now want to implement it. I was behaving weirdly after the upgrade, so I uninstalled it and then reinstalled it.

I have the newest 2.0.1 version installed, the permissions should be correct since I've assigned all user roles to the Mailchimp: allow webhook posts, and I've verified the webhook is running (doing a Mailings -\> Mailchimp settings -\> Save and Test responds that the API is returning the correct information from Mailchimp). We're still running Wordpress 4.9.9.

When I attempt a manual sync in one of the Mailchimp sync choices under Mailings, I get a description screen, but no ability to do anything. Has anyone else seen this behaviour or have insights?

There's nothing in error logs that indicate anything is happening with PHP. We're running PHP 7.1.26.

# Answer
I did the change suggested here to get rid of the php problems and then reset everything and that seems to have solved the problem. Not sure what was happening, but at least things are working now. mailchimp extension error, php 7.1, civi 5.10.4, drupal 7.x
> 1 votes

---
Tags: wordpress, mailchimp
---


# Question
Title: Membership renewal forms - am I handling this correctly?
I just wanted to clarify if what I'm doing is best practice.

When a user signs up as a member for the first time we ask the standard core info and payment information (we give the option of using GoCardless or Stripe) we also ask a few personal optional questions about the user.

It's an annual membership so one year on, when they renew, they are directed to another page which basically is basically a clone of the sign up page with core info, payment, but doesn't include the questions we asked the first time around.

Is this the best way to do this?

# Answer
> 1 votes
What i do is I have the same profile, but since they see the info filled in, they can just browse over that area. I have found it helpful as some people like to update info, such as, in our case, emergency contact, and volunteering preferences.

---
Tags: civimember, forms
---


title: My contribution pages have gone blank

text:
# Question
Title: My contribution pages have gone blank
Joomla 3.8.5 CiviCRM 4.7.29 PHP 7.0.7 I have four contribution pages for different membership levels, Bronze, Silver, Gold and Platinum. Everything seemed to be working and I had members signed up through all four pages. At some point, not sure when, three of them stopped working - Bronze, Silver and Platinum. I only found out because potential members emailed me to tell me they couldn't access the pages. I checked from the front end by selecting the appropriate menu items and found that only the Gold went to a contribution page, the other three only produced a blank whit page. I can't find anything in the log that helps.

# Answer
> 2 votes
Ok, so here is where I am after some head scratching and some inspiration from @IowaBoy. All of my contribution pages are now working, having recreated the problem ones from scratch instead of copying a working one. All of the contribution pages that had problems were created about a year ago and they were working as we had membership sign-ups from all of them. I now think that they stopped working after my upgrade from CiviCRM 4.7.27 to 4.7.29. I suspect this as that I started receiving notifications about the problem some time after the upgrade.

In my investigation of the problem, I verified that a new test contribution page made by copying the working one also did not work. I further verified that a new test contribution page made from scratch worked as expected. I have recreated our non-working contribution pages from scratch and so far they seem to be working. I stronly suspect that something in the 4.7.29 release has broken the process of creating a contribution page by copying. Thanks to IowaBoy for stimulating my thinking process.

# Answer
> 2 votes
Can I make a suggestion, as i had a similar issue and it showed up after the upgrade. I had to modify the user.ini from PHP to give more resources, and voila! It mas magic everything came back. I bumped up a few things while I was at it: max\_execution\_time is now at 90 max\_input\_time doubled it to 180 I think the max\_execution\_time was it, and civi just needs more time in the newer versions. We're at now 5.11.0 on joomla, and just love it. Been using it for a few years now.

---
Tags: joomla, contribution-page
---


title: React with CiviCRM APIs

text:
# Question
Title: React with CiviCRM APIs
I am trying to use the CiviCRM APIs from my React application. Which API methods would be the one recommended or easy to do with React application ? The easiest would be REST but since my page and civicrm will be hosted on the same machine, I prefer not to go down the REST route.

I read that CiviMobile uses react but didn't get too much information on its implementation.

Any recommendation and also examples or tutorials that I can reference ?

thanks.

# Answer
> 0 votes
I have no idea what your React application is so I am not going to be able to answer your question easily :-)

There is an API section in the CiviCRM Developer Guide that should help you: https://docs.civicrm.org/dev/en/latest/api/

---
Tags: api
---


# Question
Title: CiviVolunteer will not install or uninstall
So we are playing around with extensions that might help us, and tried to install civivolunteer. It is on my extension list, and the option is to "install". When I click this I get an error about Field: `name` must be unique. An conflicting entity already exists - id: 113

Other people have had similar errors, however, we have an additional issue. We now have the option to create a volunteer, we now have search options related to volunteers, but we do not have any civivolunteer menu options. We want all this stuff gone if we can't install it, we only really wanted it to try and track volunteer times, and this "half install" is not helpful. We want to uninstall it , but as I said above it only gives us the option to install it.

We have tried looking in /var/www/sites/all/modules/civicrm/ext$ but I cannot find the extension to just try and remove it like that. Where would it be installed? How can I get rid of these leftover parts of the volunteer extension?

# Answer
Go to the extensions page (`Administer > System Settings > Extensions`) then click the arrow/triangle next to the extension name to expand the section. That will show `Local path` where the extension files are.

Just removing the files won't remove the leftover bits of the extension from the database. If it is partially installed but doesn't offer the option to uninstall then things are more awkward. If you have command line access you could try `cv ext:uninstall ...`. Failing that you need to look at the install script in the extension, figure out what it adds to the db then manually remove those things.
> 3 votes

---
Tags: extension, civivolunteer
---


# Question
Title: How to modify System workflow message with a modern look Header?
I would like to add some fancy CSS and HTML in the system workflow messages. I know there’s a section to add a header logo. But I was wondering if there’s an ideal way to make the entire format responsive like modern emails. I have tried copying and pasting some CSS HTML from mail chimp although it works but In th drupal log there’s 100s error (User error: smarty......) gets registered per email is sent.

If someone has done already something like this I would be very grateful if you share your sample code please. Or even some suggestions would be greatly appreciated.

# Answer
> 6 votes
Put your css inside {literal}{/literal} tags to prevent smarty from processing them.

---
Tags: css, system-workflow-messages, html
---


# Question
Title: How to set a default value for a custom field
**EDIT: this is NOT working, at least in CiviCRM 5.24.2**
~~**EDIT: this is done automatically by CiviCRM from 5.18+**~~

I have a custom fieldset on Contributions that uses an option list. The option list has a default value set, but when contributions are created by non-UI processes (e.g. API) they do not have this default value; the field is empty/null/not there.

The fieldset is created by an extension. How could I ensure the default is set for all contributions?

Seems the options might be:

* Use hook\_civicrm\_post then use the API to make a call.
* Or could hook\_civicrm\_pre be used for this? Can you set custom fields in this part of the process?
* or a horrible way would be to write an API job to somehow create default entries and run this by cron. Perhaps this might be necessary to set a default for existing contributions though?

Anyone done this? If so, how d'ya do it?

# Answer
## Used to work, before CiviCRM v5.18

Here's how I've opted to do it. Please do submit alternative answers if there's a better way.

Use the civicrm\_post hook like this:

**Note that you need to replace `N` with your custom field's ID number**

```
function myext_civicrm_post($op, $objectName, $objectId, &$objectRef) {

  if ($objectId && $op == 'create' && $objectName == 'Contribution') {

    // See if we have a field that belongs to the fieldset.
    $result = civicrm_api3('CustomValue', 'get', [
      'sequential' => 1,
      'entity_id' => $objectId,
      'entity_type' => "Contribution",
      'return.custom_N' => 1,
    ]);

    if ($result['count'] == 0) {
      // Create the default entry.
      $result = civicrm_api3('CustomValue', 'create', [
        'sequential' => 1,
        'entity_id' => $contribution_id,
        'entity_type' => "Contribution",
        'custom_N' => 'unknown',
        // custom_M ...
      ]);
    }

  }
}

```

Then when you create a Contribution, the defaults are properly set.

### Interesting observations

My interest was in creating the default record when the contribution was created by the API. But I thought I'd look into how this works with using the UI too.

If you use the web UI to create a contribution then the code above gets in before the main process creates/sets the custom values. i.e. This is the order of things:

1. User creates a contribution record.
2. Contribution record created.
3. Our hook runs, no custom value exists so it creates the default record.
4. The user-entered values (inc. the defaults that were set up in the form) overwrite the default created by our hook.

The same process happens when you use the API to create a contribution but include values for the custom data also.

### Why this no longer works

The above worked fine until sometime around CiviCRM version 5.18 at which point it stopped working. It stopped because during creation of a contribution this code would run, creating a custom data record, then the calling code would also try to create the same custom data record - causing a database error.

## Works, if you don't need to use phpunit (so, doesn't really work!)

I found that I could acheive what I had been trying to do as follows:

```
function myext_civicrm_post($op, $objectName, $objectId, &$objectRef) {

  if ($objectId && $op == 'create' && $objectName == 'Contribution') {
     CRM_Core_Transaction::addCallback(
       CRM_Core_Transaction::PHASE_POST_COMMIT,
       'myfixercallback', [$objectId]);
  }
}

```

Then `myfixercallback` would do the same work. However, if you are using this then beware phpunit tests that use transaction interface: your code won't run until the test ends - which is too late!

**However!** ~~it seems that CiviCRM - at least from 5.18, possibly earlier, now properly creates default custom data. So this hack is simply not needed any more.~~ Sorry, certainly 5.24.2 does not do this.

## API Wrapper solution (tested with 5.24.2)

You can implement an API wrapper, but you need to implement it for both API3 and API4.

```

function giftaid_civicrm_apiWrappers(&$wrappers, $apiRequest) {
  if ($apiRequest['entity'] === 'Contribution' && $apiRequest['action'] === 'create') {
    $wrappers[] = new CRM_MyApiWrapperContributionCreate();
  }
}

// ... Implement the class ...

class CRM_MyApiWrapperContributionCreate implements API_Wrapper {

  public function fromApiInput($apiRequest) {

    if ($apiRequest instanceof Civi\Api4\Generic\AbstractAction) {
      // APIv4
      $params = $apiRequest->getParams();
      if (empty($params['id']) && noneOfTheCustomFieldsAreDefinedApi4($apiRequest)) {
        $apiRequest->addValue('my_fieldset_name.my_field_name', '');
      }
    }
    if (empty($apiRequest['params']['id']) && noneOfTheCustomFieldsAreDefinedApi3($apiRequest)) {
        $apiRequest['params']['custom_1234'] = '';
      }
    }
    return $apiRequest;
  }

  public function toApiOutput($apiRequest, $result) {
    return $result;
  }
}

```

In this example

* `my_fieldset_name` is the custom fieldset, in which `my_field_name` is a field that has `''` as a default value, and an internal ID of 1234 which explains where `custom_1234` comes from.
* Rather than relying on setting a value to `''` you could look up the default value for a field, but if you're doing this for a specific solution you can do it this way to be more efficient.
* `noneOfTheCustomFieldsAreDefinedApi3` needs to scan the params for fields named `custom_N` where `N` is the known ID value of each of your fields. And `noneOfTheCustomFieldsAreDefinedApi4` needs to scan the params for keys beginning with `my_fieldset_name.`
> 4 votes

# Answer
Based on the answer of @artfulrobot (thanks!), i have made a version of the code that use the definition of the custom field itself. If we have a default value, then force the creation of the field, otherwise, just ignore. Of course, it's probably a bit slower because we do some extra api calls, but it means we could change the defaults in the UI without changing the code.

```

function myext_civicrm_post($op, $objectName, $objectId, &$objectRef) {

  if ($objectName == 'Contribution') {

    $result = civicrm_api3('CustomField', 'get', [
      'sequential' => 1,
      'return' => ["default_value", "custom_group_id", "name"],
      'default_value' => ['IS NOT NULL' => 1],
      // use your own custom group id
      'custom_group_id.id' => 1,
    ]);
    if ($result['count']) {
      // use the first one (any will do because we know that we are in one custom group)
      $check_field = 'custom_' . $result['values'][0]['id'];

      // See if we have a field that belongs to the fieldset.
      $existResult = civicrm_api3('CustomValue', 'get', [
        'sequential' => 1,
        'entity_id' => $objectId,
        'entity_type' => "Contribution",
        'return.' . $check_field => 1,
      ]);

      if ($existResult['count'] == 0) {
        // insert a new entry with defaults values
        $p = [
          'sequential' => 1,
          'entity_id' => $objectId,
          'entity_type' => 'Contribution'
        ];
        foreach ($result['values'] as $row) {
          $id = $row['id'];
          $p['custom_' . $id] = $row['default_value'];
        }

        // Create the default entry.
        $result = civicrm_api3('CustomValue', 'create', $p);
      }
    }

  }

}

```

I guess with a bit of extra effort, one could make a generic extension that works for any custom fields that attach to any entity type.
> 1 votes

# Answer
I've handled this using hook\_civicrm\_custom. This fires after the db write, which isn't ideal, but has a much simpler set of params than hook\_civicrm\_pre.
> 0 votes

---
Tags: api, developer, hooks
---


# Question
Title: Unable to cancel a PayPal_Standard recurring transaction
I created a contribution page using the PayPal\_Standard payment processor. When I used it to set up a recurring contribution, it seemed to be set up ok, but I was unable to cancel it, either using the link in the email or from with CiviCRM. I am using CiviCRM 4.7.30 and Drupal. Is there any other config for recurring payments in CiviCRM?

# Answer
As far as i know, Paypal Standard doesn't support cancellation of recurring payment from within CiviCRM. You need to cancel it from your Paypal account.

If you want to have this ability, you need to either upgrade to Paypal Pro or find a payment processor that support it.

Although I can't find a documentation that clearly state if the payment processor support the cancellation or not, the ones that are listed as SSL (Users submit their credit card directly on your site) in https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/ should be able to do it.
> 2 votes

---
Tags: paypal, recurring-contributions
---


# Question
Title: facilitators viewing registration responses
We have co-facilitators for our instructional events who are not staff. We want them to be able to view the complete registration profile responses (i.e. 'registration info') prior to their event in order to know how many and who are registered, plan the event content based on registration responses, etc. There may be several events concurrently registering, with different facilitators.

We have created the custom fields and registration profiles and a report that shows responses, and that is working well. Just not sure how to have others view it. Event registration includes some questions common to all events (contact-level), and some custom fields that are event-specific (i.e. participant, not contact, level- such as previous experience with the topic, contexts in which they use the topic, familiarity with the content, etc.)

What's the best way to do this? I am a non-developer user and we don't have IT staff.

Ideas for how to do this include: a) creating a 'facilitator' role (Drupal 7), which would include permissions to view only the report that contains that event's registration info. Not sure how to do this, might require ACL's?

b) customizing the participant listing to include event-specific registration responses, and sending the link to that. Not sure how to do this, but can look into it if this is the way to go.

c) ?is there a way to get a checksum or profile link that would say ‘here’s our registration’ with an expiration date

Thanks!

# Answer
The simplest non-IT solution is to create a participant report in CiviCRM with the information you need and then under Actions, Export it and email it to them.

The next option would be to do as you described with Drupal Roles and ACLs. The down side is the learning curve for them to learn to filter and sort the Civi Reports to get the data they need. In the ACL settings you will probably need to give them access to everything that Donors have access to plus: CiviCRM view all contacts, CiviCRM view all activities, CiviCRM access backend and API, CiviCRM access CiviEvents, (depending on the level of access you want you can give the edit events), CiviCRM acess Report criteria (so they can change the filter/sort/group)

The third easiest would be to use CiviCRM WebForm Integration module Create your event registration form with Webform. You will then have several easy options to get them the registrations. a) You can give the "Facilitators" access to the Webform Submissions, b) you can set the submission emails so that a copy of the registration is sent to them when it is submitted, c) you can schedule a regular submission results (weekly, monthly) to be emailed to them, d) you can download the results and email it to them.

Another way is to create Drupal View page with this information on it. You can create a Drupal Role of "Facilitator" and restrict access to the page to Admin & Facilitator. This option would give you a url that they can access to see and sort the data as they need.
> 4 votes

---
Tags: civievent, custom-fields, civireport
---


# Question
Title: Manage Case ─ display activities in chronological order
Joomla 3.9.2
CiviCRM 5.12.0

On the Manage Case page, the activities are now displayed in a clever order (overdue first, then the rest in newest-to-oldest order). I can imagine that this makes sense in some situations, but it doesn't in ours, so I need to tweak the code to have a simple ASCENDING order (oldest last). Previously, I had tweaked civicrm/templates/CRM/Case/Form/ActivityTab.tpl to replace
class="nestedActivitySelector crm-ajax-table" data-page-length="10" with
class="nestedActivitySelector crm-ajax-table" data-page-length="50" data-order='\[\[0,"asc"\]\]'\>
(see also this post), but this tweak no longer has any effect.

Can some kind developer please point to the part of the code which I need to change? Thank you.

# Answer
> 2 votes
As mentioned in the comments, it turns out the problem was one of numptitude, not a problem with CiviCRM. In fact the tweak works fine, as Demerit kindly confirmed.

---
Tags: civicase, activities
---


title: Billing Name and Address

text:
# Question
Title: Billing Name and Address
I understand that on contribution pages the "Billing Name and Address" block pops up in default - for most payment types. Where can I set what fields I want to have displayed -\> I don't want the "middle name" and I certainly don't want a "State/Province" field when it's mandatory to start with. I can CSS them out -\> but is there a back office way to choose what is shown? Cheers.

This is Wordpress.

# Answer
To my Knowledge:-

For some reason billing address field selection is hard coded in core files

getBillingAddressFields()

so you are forced to list all the listed fields details - if you dont want to display specific details then:

* you need to overriding the core files Or
* A JAVA script to hide the fields and unset the fields in formbuild

I guess this helps !!!
> 1 votes

# Answer
Thanks, I changed the file Core/Payment.php file at lines 863 and 901 for both credit cards and checks.

You can set the paramaters that are needed for the billing address by adding comment in the `wp-content/plugins/civicrm/civicrm/CRM/Core/Payment.php`. For example for the middle name that we don't use in France:

line 901

```
/** $metadata['billing_middle_name'] = array( 'htmlType' => 'text', 'name' => 'billing_middle_name', 'title' => ts('Billing Middle Name'), 'cc_field' => TRUE, 'attributes' => array( 'size' => 30, 'maxlength' => 60, 'autocomplete' => 'off', ), 'is_required' => FALSE, ); */

```
> 3 votes

---
Tags: wordpress, civicontribute, contribution-page
---


# Question
Title: What is the purpose of the active / disabled buttons for campaigns?
I feel like this answer will be super obvious, but I'm unable to find an answer in Civi's documents. I feel like the campaign status sums up the state of the campaign so I'm just wondering what info the active / disabled fields capture.

Thanks all!

# Answer
This is so that you can temporarily or permanently remove a campaign from being selected. If you have say 30 campaigns and 20 of them are completed, you don't really want them cluttering up the drop down lists when you create events etc. You only want the active campaigns.
> 3 votes

---
Tags: database, civicampaign
---


# Question
Title: Outlook Extension / Filing previously sent emails into CiviCRM
I just installed the CiviCRM Outlook extension and am finding it useful. However, the right click menu option for recording emails that have already sent isn't appearing. Changing my ribbon settings in Outlook are also not working. Anyone have an idea of what to do? Are there other ways to record sent emails to CiviCRM?

# Answer
> 2 votes
You can also use the email processor, described at https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/inbound/#autofiling-email-activities-via-emailprocessor.

You can either set it up where you make a subfolder in your outlook and then anything you drag in there gets filed into CiviCRM, or you can set up a separate shared email address and forward emails to it to have them go into CiviCRM.

The downside to the first one is you have to give civi access to your own mailbox by storing your password in civi. The downside to the second one ***for emails you've already sent*** is that they all get filed under your own contact, but if you're sending a new email you can bcc the shared address and then it gets filed on the correct contacts.

---
Tags: email, outlook
---


# Question
Title: How to generate a report on VAT collected (HST in my case)
I'm sure I'm missing something obvious since I'm not an accountant or bookkeeper. I think I have everything set up to collect HST using the information at https://docs.civicrm.org/user/en/latest/contributions/sales-tax-and-vat/

The correct rate is charged and the receipt the constituent gets all look good. However the bookkeeping transaction report shows everything except the HST part of the transaction. I've tried playing with filters and columns to no avail.

Any thoughts?

# Answer
Keith, Welcome to SE. Did you try extended report extension? It provides additional reports with useful columns example

**Extended Report - Bookkeeping with extra fields**

HTH

Pradeep
> 3 votes

---
Tags: reports
---


# Question
Title: Dedupe using postcode match - DB error - Array
We have a similar error to this post, but with Joomla 5.9.2 and CiviCRM 5.12.0. Error happens when trying to merge two contacts with Postcode match. Backtrace is below. Any ideas what could be causing this error? Thanks.

```
    #0 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(232): CRM_Core_Error::backtrace("backTrace", TRUE)
    #1 site_root/administrator/components/com_civicrm/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
    #2 site_root/administrator/components/com_civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #3 site_root/administrator/components/com_civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #4 site_root/administrator/components/com_civicrm/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...", "DB_Error", TRUE)
    #5 site_root/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1907): PEAR->__call("raiseError", (Array:7))
    #6 site_root/administrator/components/com_civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, "INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...", "1054 ** Unknown column 'Array' in 'on clause'")
    #7 site_root/administrator/components/com_civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
    #8 site_root/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #9 site_root/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2415): DB_common->query("INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #10 site_root/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1607): DB_DataObject->_query("INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #11 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(438): DB_DataObject->query("INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #12 site_root/administrator/components/com_civicrm/civicrm/CRM/Dedupe/BAO/RuleGroup.php(281): CRM_Core_DAO->query("INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id...")
    #13 site_root/administrator/components/com_civicrm/civicrm/CRM/Dedupe/Finder.php(81): CRM_Dedupe_BAO_RuleGroup->fillTable()
    #14 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/PrevNextCache.php(414): CRM_Dedupe_Finder::dupes("2", (Array:0), TRUE, NULL)
    #15 site_root/administrator/components/com_civicrm/civicrm/CRM/Dedupe/Merger.php(1996): CRM_Core_BAO_PrevNextCache::refillCache("2", NULL, "merge_Organization_2_0_0_46533", (Array:0), TRUE, NULL)
    #16 site_root/administrator/components/com_civicrm/civicrm/CRM/Contact/Page/DedupeFind.php(185): CRM_Dedupe_Merger::getDuplicatePairs("2", NULL, TRUE, 0, NULL, "", FALSE, (Array:0), TRUE, NULL)
    #17 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Contact_Page_DedupeFind->run((Array:3), NULL)
    #18 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
    #19 site_root/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
    #20 site_root/administrator/components/com_civicrm/civicrm.php(121): CRM_Core_Invoke::invoke((Array:3))
    #21 site_root/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
    #22 site_root/libraries/src/Component/ComponentHelper.php(402): require_once("site_root/administrator/components/com_civic...")
    #23 site_root/libraries/src/Component/ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent("site_root/administrator/components/com_civic...")
    #24 site_root/libraries/src/Application/AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent("com_civicrm")
    #25 site_root/libraries/src/Application/AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch()
    #26 site_root/libraries/src/Application/CMSApplication.php(196): Joomla\CMS\Application\AdministratorApplication->doExecute()
    #27 site_root/administrator/index.php(51): Joomla\CMS\Application\CMSApplication->execute()
    #28 {main}

```

Error in log (formatting's a bit wonky - should all be one block):

```
[info] $Fatal Error Details = Array

```

( \[callback\] =\> Array ( \[0\] =\> CRM\_Core\_Error  =\> handle )

```
[code] => -19
[message] => DB Error: no such field
[mode] => 16
[debug_info] => INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_address t1 INNER JOIN civicrm_address t2 ON (t1.postal_code IS NOT NULL AND t2.postal_code IS NOT NULL AND t1.postal_code = t2.postal_code AND t1.postal_code <> '' AND t2.postal_code <> '' AND Array) WHERE t1.contact_id < t2.contact_id GROUP BY id1, id2, weight ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1054 ** Unknown column 'Array' in 'on clause']
[type] => DB_Error
[user_info] => INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_address t1 INNER JOIN civicrm_address t2 ON (t1.postal_code IS NOT NULL AND t2.postal_code IS NOT NULL AND t1.postal_code = t2.postal_code AND t1.postal_code <> '' AND t2.postal_code <> '' AND Array) WHERE t1.contact_id < t2.contact_id GROUP BY id1, id2, weight ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1054 ** Unknown column 'Array' in 'on clause']
[to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO dedupe (id1, id2, weight) SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_address t1 INNER JOIN civicrm_address t2 ON (t1.postal_code IS NOT NULL AND t2.postal_code IS NOT NULL AND t1.postal_code = t2.postal_code AND t1.postal_code <> '' AND t2.postal_code <> '' AND Array) WHERE t1.contact_id < t2.contact_id GROUP BY id1, id2, weight ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1054 ** Unknown column 'Array' in 'on clause']"]

```

)

# Answer
The problem is here: https://github.com/civicrm/civicrm-core/blob/master/CRM/Dedupe/BAO/Rule.php#L110

Instead of

`$innerJoinClauses[] = ['t1.location_type_id = t2.location_type_id'];`

it should be

`$innerJoinClauses[] = 't1.location_type_id = t2.location_type_id';`

EDIT: https://github.com/civicrm/civicrm-core/pull/14013
> 2 votes

---
Tags: duplicate-contacts
---


# Question
Title: Alerting admins when certain fields are changed via profile & checksum?
Drupal 7, CiviCRM 5.10

I'd like to send out an "update details" email to contacts - a profile with checksum. It will include some other custom field questions but i want to be alerted specifically if the general contact fields are updated - Address, phone number etc.

I can put those who completed the profile into a group but that won't distinguish between those changed and those whose contact details remain the same..

I don't think i can create a duplicate to dedupe later if using checksum?

The only other idea i had is to have two profiles - one for my custom field questions and another for "change contact details" and rely on contacts only submitting that form if things have been altered - Even then it would be useful to know which field specifically had changed but perhaps that's my only option?

Thanks!

# Answer
If you have hosting that allows you to turn on Detailed Logging, there are two extensions that provide address history. One is in Extended Reports; the other is Joseph Lacey's Address Log report. It should be relatively simple to extend either one to support phone/email/etc.

Another option, low-tech but effective, would be to export the contact details ahead of time, then export again after folks have filled things out. Paste the two spreadsheets into one and use a simple formula. E.g. if old email is in column C and new email in column H, `=IF(C1 != H1, "Changed", "")` in a new column will label any records where the email changed.
> 4 votes

# Answer
I think you can achieve your goal using webforms. It may require a bit of jquery or could possibly be done just with Conditionals. I suspect the latter would require a read-only field 'showing' the data, and another field for the change. Then a conditional that says eg 'if A != B then set value to 'insert email address'. then set up a mailing on that basis.

i am possibly oversimplifying this but would be a route i would check.
> 1 votes

---
Tags: profile, duplicate-contacts, checksum
---


# Question
Title: CiviEvent: Public link for events of a specific type
Running CiviCRM 5.10.4 and Drupal 7.65.

We have several different event types in CiviEvent (e.g. PD Workshops, Volunteer Trainings, etc)

I'd like to be able to have a page on our website which automatically displays all the active events in specific event types. So then e.g. on our Volunteer page, rather than manually updating the page with the event links of upcoming training dates, I could link to another page which lists all the upcoming events that have the event type "Volunteer Training".

Is this possible?

# Answer
You should be able to do this using a drupal view - You might need to enable the civicrm entity module.

You'll want to create a view that lists Civicrm Events then filter down the criteria you are using.
> 4 votes

---
Tags: civievent
---


# Question
Title: (Solved) CiviEvent mandatory key missing error
Drupal 7, Civi 5.12: On submitting a live event booking I receive the following error: *Mandatory key(s) missing from params array: one of (activity\_name, activity\_type\_id, activity\_label)*

The booking does update in Civi (both event and contribution) but the confirmation email and invoice do not get sent.

Any ideas please?

# Answer
> 4 votes
As Jon said, its difficult to say. But its certainly because of com.pesc.sparkpost extension. I believe the extensions is creating activity of type 'Transactional Email' which either missing of disabled.

Troubleshoot: Check under Administer \>\> Customize Data and Screens \>\> Activity types if you can see 'Transactional Email'.

If you can't then add new Activity type named 'Transactional Email'

If you can see then

1. Check if its enabled.
2. Check the machine name for that activity type either in database or using api explorer using params shown in screenshot (civicrm/api). If you dont get result then create a new one.

Thanks Pradeep

# Answer
> 2 votes
This is very hard to read (I recommend always pasting the text in addition to screenshots, makes this searchable for others and easier for folks to help). However, I can see that this is caused by your Sparkpost extension. I would follow up with them directly.

---
Tags: civievent, drupal
---


# Question
Title: Is it possible to find out who installed an extension update?
One of my clients had the API v4 extension updated to 4.3.0 last evening, and so today the contact summary screen was broken - because the API extension isn't compatible with the contact summary extension in 5.10.4. Is there any way of finding out who installed the extension update? Some log somewhere? This is a Drupal site, by the way. One thought (maybe silly!) - the extension wouldn't update itself after a given time, would it?

# Answer
> 3 votes
The extension wouldn't update itself.

If you have Detailed Logging enabled, you should be able to figure out who updated it by checking `log_user_id` in `log_civicrm_extension`. If you don't have that:

You should be able to get an IP address, which, depending on whether folks access the site from one IP or not, should be able to give you your answer.

---
Tags: drupal, api, extension
---