title: Gravity Forms and CiviCRM

text:
# Question
Title: Gravity Forms and CiviCRM
Anyone have success integrating Gravity Forms with CiviCRM? Alternatively is there another WP form plugin that works with WPML and CiviCRM. A plugin would be great. We are looking at the CiviCRM API, but hope to get advice from someone that has done this before. Thanks.

# Answer
There are currently two Wordpress integrations that I know of:

1) Contact Form 7 integration, developed by CiviCoop, here more info about it, I haven't tried it yet but looks promising.

2) Gravity Forms integration (paid for add-on) developed by Civivip, link to their shop, it supports Contacts and Activities entities.

**Edit**

Here's the Caldera Forms integration that I'm working on (the one I mentioned in the comment), is still in progress but is usable, if anyone wants to try it I recommend doing it in test environment first.

Github repository: caldera-forms-civicrm

You will need the Caldera Forms plugin installed previously, and of course CiviCRM, for it to work.
> 6 votes

# Answer
We've had a lot of users adopting the Gravity Forms + CiviCRM integration and are looking to take it to the next level. (Thanks Andrei for referencing it.) Currently, as Andrei alluded to, it supports Contacts and Activities entities. This includes custom fields added to these entities and the ability to create relationships between multiple contacts as well as multiple types of contacts on form submission. We'd like to extend this to Events, Memberships, and Contributions but don't have an ETA yet. If anyone has had a chance to use it and has feedback, we'd love to hear it! View specific GF Form integration details with screenshots here.
> 3 votes

# Answer
Though this question is a bit older: We have made very good experience with Calderaforms together with the Caldera Forms CiviCRM integration Plugin mentioned above. However at some point we needed a bit more and thanks to the help of Jaap from CiviCoop there is now also a integration of Caldera Forms with the CiviCRM Form Processor ready allowing more flexibility handling submissions, prefilling Calderaforms etc.
> 3 votes

---
Tags: wordpress, integration
---


# Question
Title: How to have one custom field open one or more other fields in a frontend form?
I need to have a checkbox or yes/no radio field that opens 'Preferred Language field when value=1 or affirmative choice. How is this done?

A more exact use-case: To choose Language Interpretation: Custom Field: Language Interpretation (Please choose): Yes | No

1. If No, then nothing further appears, move to next step in process flow.
2. If Yes, then Preferred Language menu (system field) appears to choose language and that entry is amended to Contact record.

# Answer
> 1 votes
I both D7 and D8 you would use Conditionals to show/hide fields. Any field can be hidden/shown -\> here's an example of a checkbox which when checked shows First and Last Name

---
Tags: custom-fields
---


title: Wordpress base page error

text:
# Question
Title: Wordpress base page error
I need help with base pages for wordpress.

I am getting a civicrm system error:

**CiviCRM relies upon a base page in WordPress, but it is not published.**

On the setting page, there is the text:

**By default, CiviCRM will generate front-facing pages using the home page at https://idahonativeplants.org/ as its base. If you want to use a different template for CiviCRM pages, set the path here.**

The base page is set to the default home page of the site. I do not understand why I get this error, the page most definitely is published.

Wordpress Version 5.5.1 CiviCRM 5.29.1

# Answer
That message is misleading and we'll need to fix that. Using the home page as the base page just won't work. A WP Page needs to be created and set as the base page.

There should be (depending on your version) a System Alert that reads:

```
CiviCRM relies upon a base page in WordPress at http://example.org/, but it is missing. The default is https://example.org/civicrm, which does exist on this site. You can set the correct base page in the WordPress integration settings.

```

CiviCRM needs a WP page set as the basepage. This should be set in `wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/setting/uf&reset=1` New installs create 'civicrm' as a WP Page and set that as the basepage.
> 3 votes

---
Tags: settings, base-page
---


# Question
Title: PayPal standard recurring payments fail with "Access Denied"
CiviCRM version 5.30.0, Wordpress 5.5.1, PHP 7.2.34

Single payments passed to PayPal proceed fine, but recurring payments are blocked by PayPal, reporting "Access Denied.

You don't have permission to access "/subscriptions?business=info \[...\]

PayPal technical support claims "Since your query parameter strings was passed with the special characters like "/wordpress/civicrm/?Dcivicrm%252F" which causing the access denied issues. "

We are using the standard CiviContribute resources with no special templates or other items.

Has anyone else hit this brick wall? How did you manage to resolve it?

Incidentally, we were able to create new recurring contributions until about 2 weeks ago with no system changes around the time of the failure.

# Answer
PayPal appears to have resolved whatever firewall blockage was preventing access to their subscription services. We are again able to set up recurring contributions without having changed anything within our site configuration.
> 0 votes

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


# Question
Title: Is it possible, using ACLs, for a group to have only 'create' access to contact custom data and another group to have 'edit'?
My user would like one group of users to be able to have only 'create' only access to a custom field set that will be in a contact's tab, and for another group to be able to have 'edit' access. I have tried this out and it doesn't seem to be possible using ACLs - at least not 'out of the box' (unless there's an extension that will help with this?). There's a message on the 'Manage ACLs' screen that says "NOTE: For Custom Data ACLs, the 'View' and 'Edit' operations currently do the same thing". This kind of requirement is perfectly reasonable and probably not unusual - but is it possible for contact custom data?

# Answer
> 0 votes
One way of doing this, if you were using Drupal, would be to use Views and Webforms. This is our 'go to' approach when needing to finesse who can see/do what.

I would use Contextual Filters to show the logged in users the data they should be able to access, and then use links to take that Contact ID over in to a webform\_civicrm form for doing any editing.

---
Tags: custom-fields, acl
---


# Question
Title: How can I add a "Recurring" filter to core "Repeat contribution" report?
I need a particular type of report which I could not find in core or extended reports.

So I thought of modifying the core report PHP and place it in custom PHP directory. I have manage to add "payment instrument" filter to this particular report.

```
        'payment_instrument_id' => array(
        'title' => ts('Payment Instrument'),
        'type' => CRM_Utils_Type::T_INT,
        'operatorType' => CRM_Report_Form::OP_MULTISELECT,
        'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
      ),

```

However, I need to add another item to the group to filter the result limited to recurring contribution. It could be a checkbox or a Yes/No. Can anyone suggest how can I add it please? Thanks

# Answer
> 2 votes
Over-riding core file would be last thing we should do unless there are no other option, since you need to port the file in each incremental upgrade.

Instead I would do one of the below

1. To add filtes, fields etc to report i would implement hook\_civicrm\_alterReportVar via extension or module or plugin
2. If the requirement is too complex than i would create new report file extending Repeat Contribution report(see example)

---
Tags: civireport, reports, custom-reports
---


title: CiviMail User Information Not Displayed

text:
# Question
Title: CiviMail User Information Not Displayed
When I add a person to the CiviCRM "Assigned to" section, that person receives an e-mail. However, the data in the tables containing the user information does not appear, instead the code is output. I would like information about the cause and solution.

With Contact(s) name\_18606 Created By name\_78220 Reported By name\_78220 Assigned to name\_78220

Joomla, CiviCRM 5.29.0.

# Answer
> 1 votes
It sounds like you have civicase enabled and have the setting Redact Activity Emails turned on. Under Admin - CiviCase - CiviCase Settings.

---
Tags: civimail, joomla, activities
---


# Question
Title: Webform contact default token doesn't work - why?
I have a webform with an existing contact, which is normally prefilled but can be changed with autoselect, then up to 5 new contacts. The existing contact can then enter up to 5 new contacts. By the way, the existing contact is a person who is nominating children for Christmas presents! It all works well, however I'd like the existing contact name that's selected to be stored in the new contact records, in a custom field (so we can quickly see who added the record). I've not found a way to do this, so have tried to default it from the token \[current-user:civicrm-contact\]. This doesn't work, and also saw this from 2016 but that didn't work. Any ideas on how to fix this, or any alternative methods? Civi is at 5.28.3 and of course it's Drupal 7.

# Answer
> 1 votes
"I'd like the existing contact name that's selected to be stored in the new contact records, in a custom field" -\>

Quick solution and better from a data point of view -\> use Relationships.

That way you can not only see who has nominated a child for a present but also get a list of all kids nominated by a certain contact.

Cool project!

---
Tags: webform-civicrm
---


# Question
Title: Getting Groups Associated with Campaigns using REST API
CiviCampaign allows you to 'include group(s)' as a part of a Campaign. Is there a way to 'get' which groups have been associated for a given campaign ID using the REST API? The GET API for Campaign doesn't provide this information.

(Sample result below of a GET for Campaign)

```
{

"is_error": 0,
"version": 3,
"count": 1,
"id": 9,
"values": [
    {
        "id": "9",
        "name": "AAA",
        "title": "AAA",
        "start_date": "2020-10-19 13:35:00",
        "campaign_type_id": "5",
        "is_active": "1",
        "created_id": "202",
        "created_date": "2020-10-19 13:36:07",
        "last_modified_id": "202",
        "last_modified_date": "2020-10-19 13:36:07"
    }
]}

```

# Answer
You can download and install Campaign Group API3 extension, this extension should provide Campaign Group api which you can either use as chain api in Campaign api or you can use base as Campaign Group api and fetch all details of campaign by doing join on.

HTH

Pradeep
> 1 votes

---
Tags: api, groups, civicampaign, rest
---


# Question
Title: Event registrant cancel/transfer error - getFieldValue failed - in SelfSvcUpdate.php
Here is backtrace:

```
0   CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Ev…', null, 'title') /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/SelfSvcUpdate.php:132
1   CRM_Event_Form_SelfSvcUpdate->preProcess()  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:602
2   CRM_Core_Form->buildForm()  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php:76
3   CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Event_Form_SelfSvcUpdate), 'display') /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203
4   HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_SelfSvcUpdate), 'display')  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103
5   HTML_QuickForm_Page->handle('display')  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:347
6   CRM_Core_Controller->run()  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php:98
7   CRM_Utils_Wrapper->run('CRM_Event_Form_S…', 'Self-service Reg…', Array) /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:285
8   CRM_Core_Invoke::runItem(Array) /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:68
9   CRM_Core_Invoke::_invoke(Array) /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
10  CRM_Core_Invoke::invoke(Array)  /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/civicrm.php:1644
11  CiviCRM_For_WordPress->invoke() /home/bbcadmin2016/public_html/wp-content/plugins/civicrm/includes/civicrm.basepage.php:352
12  CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))    /home/bbcadmin2016/public_html/wp-includes/class-wp-hook.php:287
13  WP_Hook->apply_filters(null, Array) /home/bbcadmin2016/public_html/wp-includes/class-wp-hook.php:311
14  WP_Hook->do_action(Array)   /home/bbcadmin2016/public_html/wp-includes/plugin.php:544
15  do_action_ref_array('wp', Array)    /home/bbcadmin2016/public_html/wp-includes/class-wp.php:758
16  WP->main('')    /home/bbcadmin2016/public_html/wp-includes/functions.php:1285
17  wp()    /home/bbcadmin2016/public_html/wp-blog-header.php:16
18  require('/home/bbcadmin20…')    /home/bbcadmin2016/public_html/index.php:17
19  {main}

```

# Answer
Do you have pid supplied as param in cancel/transfer url? Does the requested participant has event id attached? Does this error is consistent?
> 0 votes

---
Tags: civievent, error
---


# Question
Title: Adding a field to the Create Activity Form
I'd like to change the form that opens when adding an Activity to a Case (depending on activity type). Specifically, I'd like to add a field. I tried finding the fields I want to change in sites/all/modules/civicrm/CRM/Case/Form/Activity.php but couldn't find them. It seems like the buildQuickForm() function is only creating some of the visible fields but not all. I also thought about writing an extension based on the hook\_civicrm\_buildForm function. I want to start checking if `$formName == 'CRM_Case_Form_Activity'` but after that I don't really know where to start. Can anyone give me a hint?

Edit: I found an extension changing the same location looking like this (How can I set "Assigned To" for an Activity to default to the logged-in user name?):

```
function myextension_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Activity_Form_Activity' && $form->getAction() == CRM_Core_Action::ADD) {
    $form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
  }
}

```

Is there anything like `$form->addField` or something?

# Answer
> 1 votes
you need to create an extension and use the buildForm hook.

More information on creating an extension can be found here: https://docs.civicrm.org/dev/en/latest/extensions/

More information on the buildForm hook: https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_buildForm/ This contains an example of adding a field.

Another example of adding a field with the buildForm hook:

```
if ($studyNumber) {
  $form->addElement('text', 'study_number', "Study Number", ['readonly' => 'readonly']);
  $form->setDefaults(['study_number' => $studyNumber]);
  CRM_Core_Region::instance('page-body')->add(['template' => 'CRM/Nihrbackbone/nbr_study_number.tpl',]);
}

```

---
Tags: civicase, hooks
---


# Question
Title: I get a bunch of identical messages "Notice: Trying to access array offset on value of type int in element_children() ..."
My system upgraded from MySQL 5.7.30 to 8.0.

After that, CiviCRM was broken and I had to downgrade. I did it to Mysql 5.7.31 and the database ran again, but with a bunch of identical error messages at the top of my pages:

> Notice: Trying to access array offset on value of type int in element\_children() (line 6656 of /usr/share/drupal/includes/common.inc).

I still have to perform some upgrades from CiviCRM 5.26.0 to 5.30.0

My additional question is: is it sufficient to upgrade CiviCRM to make the errors disappear or do I have to fix first the errors. In case I have to upgrade, I would like to know if it is better to upgrade in one shot from 5.26.0 to 2.30.0 or will I do it step by step?

# Answer
> 1 votes
There are a few items here:

* It's safe to upgrade CiviCRM from 5.26 to 5.30 in a single step. As always, back up your database first, and if you need to restore it, it's safest to drop the existing contents before reimporting the backup.
* Notices should not be configured to appear on a production site, they're mainly of concern to developers. Since you use Drupal you can turn notices off from the UI. Other should change their php.ini.

Regardless, notices shouldn't prevent an upgrade, and moreover, the notices appear to be coming from Drupal, not CiviCRM.

Finally - I noticed that MySQL 5.7.31 doesn't like to export data unless you a) grant all privileges, or b) pass `--no-tablespaces` to `mysqldump`. Either approach is fine.

---
Tags: civimember
---


title: Create Role in WP from Group in CiviCRM

text:
# Question
Title: Create Role in WP from Group in CiviCRM
In WP 5.5/CiviCRM 5.29 I have only one membership type at the organization level and 2 groups of beneficiaries depending on some criteria. I have all the needed extensions from Christian Wach.

I need to synchronize the groups into WP Roles and not groups in order to let them access to personalized content defined with Elementor.

It seems that this is not yet possible but maybe I'm wrong.

Does anyone know about this setting?

# Answer
You can go one better than syncing to roles using the CiviCRM Groups Sync plugin instead. It keeps Contacts in CiviCRM Groups in sync with WordPress Users in groups provided by the Groups plugin. That way you are free to adjust your users' roles without affecting the sets of permissions that they have which are related to CiviCRM or member-only content.
> 2 votes

---
Tags: wordpress, groups, roles
---


# Question
Title: Membership Expiration Date Report Filter is Ignored
In CiviCRM membership reports, the Membership Expiration Date filter is ignored, and all records are returned no matter what parameters you try. We started experiencing this around CiviCRM 5.11. We are currently on CiviCRM 5.21.3 on Drupal 7.7.3. Seems odd that no one else appears to have reported this after many months.

# Answer
I just tested on dmaster ie 5.32 which is always a good way to test something before flagging it as it may already have been fixed :-)

I get

when I apply

compared to

when I apply no filter

I don't know which specific report you mean, but good if you can test on dmaster and then if there is still an issue, report back here and we can help confirm if it is a bug. hope that helps you
> 0 votes

---
Tags: civimember, civireport
---


# Question
Title: CiviCRM menu not displaying properly or useably in wordpress
!(https://imgur.com/a/Q1PCgMe)

This is standard install of wordpress with the default theme, I've tried changing the theme and the settings in the Civicrm Admin Utilities plugin but to no avail. The menu appaers fully displayed below the dash board but is fully obscured by the wp menu, and only visible when that is collapsed. I'm aware this is a formatting issue, but I wondered if anybody had seen it before in a fresh wordpress install

# Answer
For WordPress 5.5.1 the minimum CiviCRM version is 5.26.2. I'd recommend 5.28.4 as that is the security release.

Due to changes in WP you may also have to update your settings.

For reference: https://civicrm.org/blog/kcristiano/civicrm-526-and-wordpress-important-notice

Even though the changes discussed come into effect in 5.29 this doc: https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/#civicrm-529 is a good explanation of paths for CiviCRM and WP
> 1 votes

---
Tags: wordpress, menu, theme, display
---


# Question
Title: Adding a column for Document Links to the Activity table in CaseView
In the CiviCRM Case View, I want to add another column to the Activities table. Right now, the last column contains some links ("View", "Edit", "Delete") and one link to an attached document if existent. I want to split this last column in two, so the link to attachments and the other links are in two different columns.

Therefore, I doubled the last column inside the sites/all/modules/civicrm/templates/CRM/Case/Form/ActivityTab.tpl template:

```
<th data-data="links" data-orderable="false" class="crm-case-activities-status"> </th>
<th data-data="links" data-orderable="false" class="crm-case-activities-status"> </th>

```

Then, I adapted the first column like this:

```
<th data-data="links" class="crm-case-activities-status"> Dokumente </th>
<th data-data="links" data-orderable="false" class="crm-case-activities-status"> </th>

```

Now, I am stuck at the content part. Does anyone know from which location "links" is called or created? I read that the html "data" attribute can be used by a JavaScript script. As I need only the links to any attached documents, but not the others, I would need to alter that script.

Edit: Alternatively, it would be helpful to know where the Activity table is created (`<table id="case_id_{$caseid}" class="nestedActivitySelector crm-ajax-table" data-page-length="100">`).

Edit: Reading Demerit's answer, I have checked the addCaseActivityLinks() function. To adapt it for my documents column, I thought about copying the function, renaming it, adapting it, and make the ActivityTab.tpl call it inside my document tag. Another solution would be to use an existing param of the addCaseActivityLinks() function in order to determine with which value of data-data the function has been called (`data-data="links"` or `data-data="documents"`). These existing params are: `$caseID, $contactID, $userID, $context, $dao, $allowView = TRUE`

I think I am still missing understanding of how/where the addCaseActivityLinks() function is called, so I would be able to implement one of the abovementioned solutions. I searched the whole project for a fucntion call, but couldn't find one. Any hint anyone?

# Answer
> 2 votes
Finally, I solved the problem like this:

1. sites/all/modules/civicrm/templates/CRM/Case/Form/ActivityTab.tpl -\> add another cell to the activity table: `<th data-data="document_links" data-orderable="false" class="crm-case-activities-status"> Dokumente </th>`
2. sites/all/modules/civicrm/CRM/Case/Selector/Search.php -\> add the function `addDocumentLinks()` that is basically only the document-link part of the original function `addCaseActivityLinks()`:

```
public static function addDocumentLinks($caseID, $contactID, $userID, $context, $dao, $allowView = TRUE) {
$caseDeleted = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseID, 'is_deleted');
$actionLinks = self::actionLinks();
// Check logged in user for permission.
if (CRM_Case_BAO_Case::checkPermission($dao->id, 'view', $dao->activity_type_id, $userID)) {
$permissions[] = CRM_Core_Permission::VIEW;
  }
if (!$allowView) {
unset($actionLinks[CRM_Core_Action::VIEW]);
  }
$linksMarkup = "";
// if there are file attachments we will return how many and, if only one, add a link to it
if (!empty($dao->attachment_ids)) {
$linksMarkup .= implode(' ', CRM_Core_BAO_File::paperIconAttachment('civicrm_activity', $dao->id));
  }
return $linksMarkup;
}

```
3. sites/all/modules/civicrm/CRM/Case/Selector/Search.php -\> delete the document-link part from the original function `addCaseActivityLinks()`:

```
public static function addCaseActivityLinks($caseID, $contactID, $userID, $context, $dao, $allowView = TRUE) {
$caseDeleted = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseID, 'is_deleted');
$actionLinks = self::actionLinks();
// Check logged in user for permission.
if (CRM_Case_BAO_Case::checkPermission($dao->id, 'view', $dao->activity_type_id, $userID)) {
$permissions[] = CRM_Core_Permission::VIEW;
  }
if (!$allowView) {
unset($actionLinks[CRM_Core_Action::VIEW]);
  }
if (!$dao->deleted) {
// Activity is not deleted, allow user to edit/delete if they have permission
    // hide Edit link if:
    // 1. User does not have edit permission.
    // 2. Activity type is NOT editable (special case activities).CRM-5871
if (CRM_Case_BAO_Case::checkPermission($dao->id, 'edit', $dao->activity_type_id, $userID)) {
$permissions[] = CRM_Core_Permission::EDIT;
    }
if (in_array($dao->activity_type_id, CRM_Activity_BAO_Activity::getViewOnlyActivityTypeIDs())) {
unset($actionLinks[CRM_Core_Action::UPDATE]);
    }
if (CRM_Case_BAO_Case::checkPermission($dao->id, 'delete', $dao->activity_type_id, $userID)) {
$permissions[] = CRM_Core_Permission::DELETE;
    }
unset($actionLinks[CRM_Core_Action::RENEW]);
  }
$extraMask = 0;
if ($dao->deleted && !$caseDeleted
&& (CRM_Case_BAO_Case::checkPermission($dao->id, 'delete', $dao->activity_type_id, $userID))) {
// Case is not deleted but activity is.
    // Allow user to restore activity if they have delete permissions
unset($actionLinks[CRM_Core_Action::DELETE]);
$extraMask = CRM_Core_Action::RENEW;
  }
if (!CRM_Case_BAO_Case::checkPermission($dao->id, 'Move To Case', $dao->activity_type_id)) {
unset($actionLinks[CRM_Core_Action::DETACH]);
  }
if (!CRM_Case_BAO_Case::checkPermission($dao->id, 'Copy To Case', $dao->activity_type_id)) {
unset($actionLinks[CRM_Core_Action::COPY]);
  }
$actionMask = CRM_Core_Action::mask($permissions) | $extraMask;
$values = [
'aid' => $dao->id,
'cid' => $contactID,
'cxt' => empty($context) ? '' : "&context={$context}",
'caseid' => $caseID,
  ];
$linksMarkup = CRM_Core_Action::formLink($actionLinks,
$actionMask,
$values,
ts('more'),
FALSE,
'case.tab.row',
'Activity',
$dao->id
);

// deleted part

return $linksMarkup;
}

```
4. sites/all/modules/civicrm/CRM/Case/BAO/Case.php -\> add the function call for `addDocumentLinks()` inside the function `getCaseActivity()` inside the while loop `while($dao->fetch()) { }` (approx. line 1091):

```
$caseActivities[$caseActivityId]['document_links']
        = CRM_Case_Selector_Search::addDocumentLinks($caseID, $contactID, $userID, $context, $dao);

```

# Answer
> 1 votes
It's in CRM/Case/Selector/Search.php in addCaseActivityLinks().

But on a more general note, between this and your other questions there's a lot of customizing going on and it may make upgrading difficult. At some point you might want to consider something like webform to customize forms or even going full custom and making your own pages/forms in an extension and using the api to pull in just the data you need.

---
Tags: civicase
---


# Question
Title: How to prevent public use of profile, while still allowing use via HTML snippet
I would like to disable access to specific profiles via their public URL, while still allowing HTML snippet access, i.e. I'd like to allow POST only. Is this possible?

We have fake spam contacts entering our database from https://secure.wildsight.ca/civicrm/profile/create?gid=56&reset=1. This profile is only used via HTML snippet on our other website and there is no need for it be available at this URL.

Disabling use of the profile for Standalone Form or Directory prevents any submissions from the snippet. ReCaptcha doesn't seem to be preventing these submissions.

# Answer
> 1 votes
You could probably do it at the webserver level, e.g. in apache using `<LocationMatch>` and then `<Limit>`. Untested, and you might have to fiddle or put it in the right place for clean/non-clean urls, or for specific gid params:

```
<LocationMatch "^/civicrm/profile/create">
  <Limit GET>
    # allow just my own IP
    Require ip my.own.ip.address
  </Limit>
</LocationMatch>

```

---
Tags: profile
---


title: How to pre-populate a caldera form?

text:
# Question
Title: How to pre-populate a caldera form?
I'm using a caldera form to register beneficiaries (they become member throughout their organization) and I want to have the 'organization name' field pre-populated from the url. And I don't want to show the name of the organization on a public form with a select list.

I read on the documentation that it is possible with example.com/some-page?cid={contact.contact\_id}&{contact.checksum} but where do I find the contact cheksum and how do I insert it in the form?

Any experience connected to this topic?

# Answer
> 1 votes
Actually, the process is easy:

1. In the Caldera form \> tab Builder, add an hidden field with the value {get:field\_name} (replace field\_name by the desired value)
2. In the Caldera form \> tab Process, add a CiviCRM process and match the needed field with the one from Caldera with the magic field syntax, so here %field\_name%. (In my case, 'employee of' matches with '%organization\_name%')
3. create an url to the page with the form: www.domain.com/form/ and add ?field\_name=YOURVALUE so it shows up like www.domain.com/form/?organization\_name=YOURVALUE. You can also add several variables using '&' between them.
4. Add the User registration Process with password creation
5. Send the email from inside CiviCRM using such a syntax: https://domain.com/form/?organization\_name={contact.organization\_name}

When processed, the new user gets a CiviCRM membership as a relation to the organization and can access specified content of the WordPress site!

Source: Caldera form documentation

# Answer
> 0 votes
How to use tokens such as checksum is covered here and is how you would send out a checksum via a bulk mailing

The extension Contact Checksum UI adds ability to create an email for a one-off email to a Contact via the Actions button on the contact record.

---
Tags: caldera-forms
---


title: Record audio/video fields for contacts?

text:
# Question
Title: Record audio/video fields for contacts?
I'm using CiviCRM + Drupal 8.

I'd like to be able to add fields to contacts that can record audio &/or video, so that we can collect interviews with our contacts.

Is it possible to add "recording" fields that will allow you to record from within CiviCRM?

If not, what's the best way to set up contact fields to allow you to upload an audio/video file to a contact's record?

# Answer
I don't know about recording directly, but in any case the resulting data would likely be large and would probably run into timeouts or other technical limits. I'd probably suggest storing the video files elsewhere and just adding a custom field to the stock Interview activity type in civi called e.g. "Audio/Video link" that's of type "Link", and then put the url to the video file in that field.
> 4 votes

---
Tags: custom-fields
---


# Question
Title: How to provide custom token for subscription related automated messages?
I'm trying to privide a token for mailing related automated messages. I followed the instructions about `hook_civicrm_tokens` and `hook_civicrm_tokenValues` but it does only work for "CiviMail" mails. In mails for group subscriptions (at least "Subscribe Message", "Resubscribe Message", "Unsubscribe Message" and "Welcome Message") the custom token will not be replaced.

```
function mysite_civicrm_tokens(&$tokens){
  // Define tokens for date (like today's year)
  $tokens['date'] = [
    'date.year' => ts("Today's Date: year")
  ];
}

 function mysite_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = [], $context = null) {
  // Set tokens values for date
  if(isset($tokens['date'])) {
    // TODO: Check if token is required.
    foreach ($cids as $cid) {
      $values[$cid]['date.year'] = date("Y");
    }
  }
}

```

The custom token defined in `mysite_civicrm_tokens` is not availible in `mysite_civicrm_tokenValues` although I have placed it inside the mailing components under *civicrm/admin/component*.

I know that those mails are handled different from CiviMail mails so I guess there might be another way to solve this.

# Answer
> 1 votes
Those are Smarty templates, and don't use regular CiviCRM tokens - which is confusing because the tokens can look the same.

Fortunately, Smarty is a full-fledged templating language. You can do date formatting pretty easily. I think you want this:

```
{$smarty.now|date_format:"%Y"}

```

---
Tags: tokens, hooks, message-templates, subscribe
---


# Question
Title: How do I import contact records with phone numbers without overwriting existing phone numbers?
If I import a spread sheet with contacts and phone numbers and:

* I choose to update duplicate contacts
* I choose the same phone location and phone type of an existing, matching contact

Then, the existing phone number will be replaced with the one I'm importing.

That is reasonable for many workflows - but what if I want to add the number to the record and not overwrite anything? I know I can create more and more phone types but maybe there is a better way?

# Answer
Use the API CSV Importer and import to the Phone entity which will always add new entries.
> 2 votes

# Answer
Andy's answer is correct, but perhaps the more correct answer is "you don't want to". When you have multiple phones of the same location/phone type, saving one overwrites the others.

There's been a lot of debate about this, but ultimately, having multiple of the same phone/location type means that some can't ever be exported/found in reports.
> 1 votes

---
Tags: import, phone
---


# Question
Title: Getting Drupal error messages with Silent User Registration extension
Drupal 7.72
Civi 5.28.2
Silent User 1.0
I just installed the extension and setup the CiviRule per the pics on GitHub. My CiviRule trigger is a new contact created with condition of "these" sources (sources are webform civi integration forms that we use for contributions).

When I make a contribution as a new user, I get 2 Drupal error messages  The contribution does process in Civi and it does include a Name and Email. But a user is not created in Drupal. I added a 3 minute delay in the CiviRule and tested it with and without rechecking the condition. Now it does not show the Drupal errors as above but it still does not create a Drupal user.

In the Civilogs I see this (I assume it is related) \[warning\] Report Error Extension could not send since no email address was set.

In the Drupal Logs, I had the following Notice: Undefined index: template\_id in CRM\_Emailapi\_CivirulesAction\_Send-\>userFriendlyConditionParams() (line 122 of /sites/default/files/civicrm/extensions/org.civicoop.emailapi/CRM/Emailapi/CivirulesAction/Send.php).

But I no longer get the log errors since I added the delay.

# Answer
I got some help from a friend and we got it working. The problem seems to be that the database was not finished writing to the email table when the CiviRule fires. We switched the rule to Trigger on "Email is created".
> 3 votes

---
Tags: extension, cms-integration
---


# Question
Title: How to Contribute on behalf of an individual instead of organisation for Member Dues?
Under Contribution Configurations, I see "Allow individuals to contribute and/or signup for membership on behalf of an organization?" checkbox is available by default,
is there any way we can contribute on behalf of individual for Member Dues without using family relationship type?

# Answer
> 1 votes
You can do so by adding query parameter cid=0 in the url So if the url is

```
/civicrm/?civiwp=CiviCRM&q=civicrm/Fcontribute/transact&reset=1&id=10

```

You need to add cid=0 to the url as shown below

```
/civicrm/?civiwp=CiviCRM&q=civicrm/Fcontribute/transact&cid=0&reset=1&id=10

```

---
Tags: contributions
---


title: Why can't the asset builder find

text:
# Question
Title: Why can't the asset builder find
With Drupal 8 + CiviCRM 5.30.1

The asset builder is unable to find the crm-menubar.css file, i.e. this url:

https://example.org/civicrm/asset/builder?an=crm-menubar.css

gives me:

Unrecognized asset name: crm-menubar.css

\[after updating /Civi/Core/AssetBuilder.php to catch the error, previously it was generating error pages\]

Any thoughts about how to debug this? I've checked and re-checked the urls/paths and everything else seems to be found properly. I see the crm-menubar.css file in the locations I would expect ...

The Drupal asset injector is installed - is it possible that might be interfering?

# Answer
> 5 votes
## Answer to the Issue

The origin of the problem is when you ignore this: https://civicrm.org/blog/daved/action-required-drupal-8-installs-and-upgrades-composer-and-patches

To fix an existing installation which was upgraded or installed without the 'enable-patching' configuration, you can can do this:

```
composer config 'extra.enable-patching' true
composer update civicrm/civicrm-asset-plugin civicrm/civicrm-core civicrm/civicrm-drupal-8 civicrm/civicrm-packages  --with-dependencies

```

## Original Post

I figured out that if you run

```
composer config 'extra.enable-patching' true

```

straight after

```
composer create-project ...

```

installation is going to work.

Background: We have a scripted install which worked fine with 5.28.4 so I thought to upgrade to 5.30.1 but got the following message at

```
cv upgrade:db

```

```
vendor/bin/cv upgrade:db
Found CiviCRM database version 5.28.4.
Found CiviCRM code version 5.30.1.
Checking pre-upgrade messages...
_Pre-announcement for upcoming version 5.30_: If your composer
configuration or composer.json does not enable patching, you MUST do that
BEFORE running composer to update your files to version 5.30. Either by
using `composer config 'extra.enable-patching' true`, or updating the top
level composer.json's extra section with `"enable-patching": true`. See
Drupal 8 installation guide [1] for details.
The default copies of the message templates listed below will be updated to
handle new features or correct a problem. Your installation has customized
versions of these message templates, and you will need to apply the updates
manually after running this upgrade. Click here [2] for detailed
instructions.

    * _Events - Registration Confirmation Invite_ - Support negative hours for
cancellation/transfer
    * _Events - Registration Confirmation and Receipt (on-line)_ - Support
negative hours for cancellation/transfer

The default copies of the message templates listed below will be updated to
handle new features or correct a problem. Your installation has customized
versions of these message templates, and you will need to apply the updates
manually after running this upgrade. Click here [2] for detailed
instructions.

    * _Contributions - Invoice_ - Ensure that amount paid is shown even when
fully paid

Links:
------
[1] https://docs.civicrm.org/installation/en/latest/drupal8
[2] https://docs.civicrm.org/user/en/latest/email/message-templates/#modifying-system-workflow-message-templates

```

I hope that helps.

# Answer
> 0 votes
We had the same problem - I think it came down to CiviCRM being installed incorrectly.

This is how the files sit in the now working copy:

```
user@server /var/www/html/site/drupal $ find -type d -name civicrm
./web/modules/contrib/civicrm
./web/sites/default/files/civicrm
./web/sites/all/modules/contrib/civicrm
./web/libraries/civicrm
./vendor/civicrm
user@server /var/www/html/site/drupal $ ls -l web/modules/contrib/civicrm
total 212
-rw-rwxr--+  1 user dev  1686 Aug 21 09:50 civicrm.config.php.drupal
-rw-rwxr--+  1 user dev   275 Aug 21 09:50 civicrm.info.yml
-rw-rwxr--+  1 user dev  5386 Aug 21 09:50 civicrm.install
-rw-rwxr--+  1 user dev   102 Aug 21 09:50 civicrm.libraries.yml
-rw-rwxr--+  1 user dev   134 Aug 21 09:50 civicrm.links.menu.yml
-rw-rwxr--+  1 user dev   346 Aug 21 09:50 civicrm.links.task.yml
-rw-rwxr--+  1 user dev 11690 Aug 21 09:50 civicrm.module
-rw-rwxr--+  1 user dev    73 Aug 21 09:50 civicrm.permissions.yml
-rw-rwxr--+  1 user dev   866 Aug 21 09:50 civicrm.routing.yml
-rw-rwxr--+  1 user dev   471 Aug 21 09:50 civicrm.services.yml
-rw-rwxr--+  1 user dev  2492 Aug 21 09:50 civicrm.user.inc
-rw-rwxr--+  1 user dev   765 Aug 21 09:50 composer.json
-rw-rwxr--+  1 user dev   649 Aug 21 09:50 COPYRIGHT.txt
drwxrwxr-x+  2 user dev  4096 Aug 21 09:50 css
drwxrwxr-x+  2 user dev  4096 Aug 21 09:50 drush
drwxrwxr-x+  6 user dev  4096 Aug 21 09:50 icons
-rw-rwxr--+  1 user dev 35147 Aug 21 09:50 LICENSE.txt
drwxrwxr-x+  3 user dev  4096 Aug 21 09:50 modules
-rw-rwxr--+  1 user dev  2989 Aug 21 09:50 README.md
drwxrwxr-x+ 10 user dev  4096 Aug 21 09:50 src
drwxrwxr-x+  2 user dev  4096 Aug 21 09:50 templates
user@server /var/www/html/site/drupal $ ls -l vendor/civicrm/
total 48
drwxrwxr-x+  5 user dev 4096 Oct 19 11:51 civicrm-asset-plugin
drwxrwxr-x+ 25 user dev 4096 Oct 19 11:51 civicrm-core
drwxrwxr-x+  6 user dev 4096 Oct 19 11:51 civicrm-cxn-rpc
drwxrwxr-x+ 30 user dev 4096 Oct 19 11:52 civicrm-packages
drwxrwxr-x+  4 user dev 4096 Oct 19 11:51 composer-downloads-plugin
drwxrwxr-x+  5 user dev 4096 Oct 19 11:52 cv

```

Hope that helps.

if you need any more let me know.

---
Tags: drupal-8
---


title: Report on Cases and Activities

text:
# Question
Title: Report on Cases and Activities
I need a dashlet for a user which lists scheduled activity details filtered on the 'case type' the activity sits in. I can find these in search but cant seem to get a report to work - closest I can get is extended report - Activity Pivot Chart (CiviCase)

# Answer
> 0 votes
If I can perform a straight forward query in search with regard to finding an “activity type’ within a specified ‘case type’ would it not be a significant progression for the CRM to be able to perform this as a report.

As an implementor I finally got around the problem using smart groups, but .. seeing as the table join is already part of the ‘extended report’ functionality would it not be a massive progression for Civi report to offer this in a more direct way.

Many thanks to the suggestions to make a view and incorporate as a block, I can do this, I appreciate the power of the views module, should it be necessary. The push to make civiCRM a software capable of case management and it being really useful to organisations who wish to manage actual case requirements means that a fairly simple code change could offer significant Implementor level advancement.

I really don’t want to try and remember how to code, yours in eternal laziness x

# Answer
> 0 votes
These days you have more options. You can install the dataprocessor extension (see https://lab.civicrm.org/extensions/dataprocessor), which gives you the option to create custom searches by only using the interface. It is a bit like drupal views, but it works inside CiviCRM. And you can publish the search as a dashlet.

---
Tags: civireport
---


title: Is SITE_KEY in a table in the database?

text:
# Question
Title: Is SITE_KEY in a table in the database?
I've cloned a website to make it a sandbox and I changed the site key in civicrm.settings.php following this post.

My question is: do I also need to change this value in some table in the database?

# Answer
> 2 votes
No. As far as I'm aware the sole entry is in civicrm.settings.php

---
Tags: civicrm.settings
---


title: More Actions menu missing in Shoreditch

text:
# Question
Title: More Actions menu missing in Shoreditch
I'm finding the More actions link that appears at the righthand end of CiviCRM displays to be missing in Shoreditch. Presumably this is not by design? Some actions appear to only be accessible through that menu.

# Answer
The latest version from https://github.com/civicrm/org.civicrm.shoreditch/releases (1.0.0-beta.2) has the fix included for the above problem. Pls upgrade.
> 4 votes

# Answer
try adding below line in your theme css file

```
.crm-container span.btn-slide {
    display: unset !important;
}

```

Thanks

Pradeep
> 3 votes

---
Tags: shoreditch
---


# Question
Title: Enter Phone Number, Show Contact Details with API?
There is a system where we answer calls from our members. We save all of these calls by creating contact information on CiviCRM and create the conversation in an activity.

People answering the calls create a contact by entering different information on the same number. I don't want that to happen. So, Can she create an API to enter a phone number and output a name?

# Answer
You can, certainly - but it sounds like what you really want to do is set the Supervised Dedupe rule to dedupe on phone number. That way, when someone enters a new contact, when they try to save it, it will recognize the person as a duplicate.
> 1 votes

# Answer
> Can she create an API to enter a phone number and output a name

If I understand the question right, the API is already available. If you simply need an api that provides the name based on phone number, you can use -

```
$contact = civicrm_api3('Phone', 'get', [
  'sequential' => 1,
  'return' => ["contact_id"],
  'is_primary' => 1,
  'phone_numeric' => <numeric value of the phone number>, // 12345678 if phone number is 12-345-678
  'api.Contact.get' => ['id' => "\$value.contact_id"],
]);

```

$contact has all the information related to contact. You can try more such API combination from the API explorer
> 0 votes

---
Tags: contacts, joomla, search
---


# Question
Title: DB error for sort_name when adding contacts with long names in 2 bytes UTF8 characters
The problem occurs when I try to add a contact (in the example it's an organization) with long name in Cyrillic (multiple words in it's name). I get the **nativecode=1406 \** Data too long for column 'sort\_name' at row 1** DB error. I presume it has something to do with how sortname shortening works and the number of bytes per character.

I haven't been able to replicate this on the Agiliway's demo site, so I suspect it has something to do with my MySQL/php configuration.

How can I resolve this issue?

Here is the backTrace

```
#0 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Error.php(148): CRM_Core_Error::backtrace()
#1 /var/www/civi/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/civi/sites/all/modules/civicrm/packages/DB.php(998): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...")
#3 /var/www/civi/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...")
#4 /var/www/civi/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...", "DB_Error", TRUE)
#5 /var/www/civi/sites/all/modules/civicrm/packages/DB/common.php(1925): PEAR->__call("raiseError", (Array:7))
#6 /var/www/civi/sites/all/modules/civicrm/packages/DB/mysqli.php(936): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...", "1406 ** Data too long for column 'sort_name' at row 1")
#7 /var/www/civi/sites/all/modules/civicrm/packages/DB/mysqli.php(406): DB_mysqli->mysqliRaiseError()
#8 /var/www/civi/sites/all/modules/civicrm/packages/DB/common.php(1231): DB_mysqli->simpleQuery("INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...")
#9 /var/www/civi/sites/all/modules/civicrm/packages/DB/DataObject.php(2696): DB_common->query("INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...")
#10 /var/www/civi/sites/all/modules/civicrm/packages/DB/DataObject.php(1245): DB_DataObject->_query("INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phon...")
#11 /var/www/civi/sites/all/modules/civicrm/CRM/Core/DAO.php(620): DB_DataObject->insert()
#12 /var/www/civi/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(189): CRM_Core_DAO->save()
#13 /var/www/civi/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(290): CRM_Contact_BAO_Contact::add((Array:128))
#14 /var/www/civi/sites/all/modules/civicrm/CRM/Contact/Form/Contact.php(980): CRM_Contact_BAO_Contact::create((Array:128), TRUE, FALSE, TRUE)
#15 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Form.php(504): CRM_Contact_Form_Contact->postProcess()
#16 /var/www/civi/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(153): CRM_Core_Form->mainProcess()
#17 /var/www/civi/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(120): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Contact_Form_Contact), "upload")
#18 /var/www/civi/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contact_Form_Contact), "upload")
#19 /var/www/civi/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Contact), "upload")
#20 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Controller.php(347): HTML_QuickForm_Page->handle("upload")
#21 /var/www/civi/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run()
#22 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Invoke.php(285): CRM_Utils_Wrapper->run("CRM_Contact_Form_Contact", "New Contact", (Array:1))
#23 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:13))
#24 /var/www/civi/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
#25 /var/www/civi/sites/all/modules/civicrm/drupal/civicrm.module(454): CRM_Core_Invoke::invoke((Array:3))
#26 /var/www/civi/includes/menu.inc(527): civicrm_invoke("contact", "add")
#27 /var/www/civi/index.php(21): menu_execute_active_handler()
#28 {main}

```

And here is the db error

```
 [error] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => INSERT INTO `civicrm_contact` (`contact_type` , `do_not_email` , `do_not_phone` , `do_not_mail` , `do_not_sms` , `do_not_trade` , `is_opt_out` , `external_identifier` , `sort_name` , `display_name` , `nick_name` , `legal_name` , `preferred_communication_method` , `preferred_language` , `preferred_mail_format` , `hash` , `source` , `communication_style_id` , `email_greeting_custom` , `postal_greeting_custom` , `addressee_custom` , `organization_name` , `sic_code` , `modified_date` ) VALUES ('Organization' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 ,  NULL , 'асдадасда шшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшш�' , 'асдадасда шшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшш�' ,  NULL ,  NULL ,  NULL , 'en_US' , 'Both' , 'a41da843b02fd831936f9bb2107d1d53' ,  NULL ,  1 ,  NULL ,  NULL ,  NULL , 'асдадасда шшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшшш' ,  NULL ,  NULL )  [nativecode=1406 ** Data too long for column 'sort_name' at row 1]
    [type] => DB_Error

```

CiviCRM version 5.28.3

PHP version 7.1.33-19

MySQL version 5.7.31

Engine: InnoDB

Collation: utf8\_unicode\_ci

# Answer
> 1 votes
Ok so based on comments it's that using substr() still results in the byte length being too long. Have added https://lab.civicrm.org/dev/core/-/issues/2146 for now.

EDIT: Will be fixed in version 5.32.0 via https://github.com/civicrm/civicrm-core/pull/18862

---
Tags: contacts, database, php, mysql
---


# Question
Title: Adding URL path to webform stops contact prefill - why?
I added a URL path to a working Drupal webform, and emailed users were given this link to the webform (which went through Civimail) :
https://www.example.org/christmasconnection?cid1={contact.contact\_id}&{contact.checksum}.
Later I found that the existing contact wasn't being prefilled. Eventually I figured it was this change that had caused the problem. When I changed the link back to the usual Drupal format with 'node':
https://www.example.org/node/82?cid1={contact.contact\_id}&{contact.checksum}
the contact prefill worked. Why is this? We will now email users to give them the working link, but is there a way of fixing this so either works? Is this a bug or a 'feature'! (screenshot added)

# Answer
Let's take out CiviMail from the equation -\> are you able to do this:
> 0 votes

---
Tags: webform-civicrm, urls, paths
---


# Question
Title: report to show all my outstanding activity
I want to be able to pull a report that shows all the activity that i have recorded, for scheduled, completed and ongoing. How do i do this please?

# Answer
> 1 votes
You could base the report on the standard Activity report which can be found at Reports\>All Reports\>Activity Details.

If you are not too familiar with how reports and report templates work check this chapter of the User Guide: https://docs.civicrm.org/user/en/latest/reporting/what-is-civireport/

---
Tags: civireport, reports
---


# Question
Title: Sort function for Activities in CaseView
I want to sort the Activity Types that appear in the dropdown menue in CaseView, when clicking "Add Activity". It should be sorted according to a determined order (based on frequency of use).

Therefore, I built a custom sort function that I included in sites/all/modules/civicrm/CRM/Case/Form/CaseView.php:

```
  public function compareToSample($aTypes, $sample_array) {
    $new_array = array();
    $size_sample = count($sample_array);
    // search for first element of $samplearray in $atypes
    for ($newarrayindex = 0; $newarrayindex < $size_sample; $newarrayindex++) {
      $key = array_search($sample_array[$newarrayindex], $aTypes, FALSE);
      if($key) {
        // found an element -> save at the end of $new_array
        array_push($new_array, $aTypes[$key]);
        unset($aTypes[$key]); // delete it from $aTypes
      }
    }
    // if after the whole process $aTypes is not empty, add the rest of elements to end of $new_array
    if(!(empty($aTypes))) {
      if(empty($new_array)) {
        // no element in common
        return $aTypes;
      }
      else {
        $new_array = array_merge($new_array, $aTypes);
      }
    }
    return $new_array;
  }

public function mySort($array_to_sort) {
    $sample_array = array(...some string elements representing the activity types in the right order...);
    if(empty($array_to_sort)) {
      return null; // EXCEPTION
    }
    $result = $this->compareToSample($array_to_sort, $sample_array);
    return $result;
  }

```

I am calling this function with `$aTypes = $this->mySort($aTypes);` inside the `buildQuickForm()` function in CaseView.php. (I am calling it just after the place where the original code is also sorting `$aTypes`, that is, just after:

```
if (!$xmlProcessor->getNaturalActivityTypeSort()) {
      asort($aTypes);
    }

```

The problem is now that the function only seems to sort the *labels* of the Activity Types, but not the Types themselves. So when clicking on one type, it will create an activity with another type of the list. How can I get the function to sort the real elements? Any hint is appreciated :)

# Answer
> 2 votes
I think my mistake was using the functions array\_push and array\_merge, as they assigned new keys to the array elements (activity types). Therefore, the single activity types couldn't be found in the following code anymore.

I changed these two expressions to:

```
$new_array[$key] = $aTypes[$key]; /// instead of: array_push($new_array, $aTypes[$key]);

```

and

```
$new_array = $new_array + $aTypes; /// instead of: $new_array = array_merge($new_array, $aTypes);

```

With that, it seems to work now.

---
Tags: civicase, activities
---


# Question
Title: Permissions for new files under tempates_c/en_US created using 751 permission which does not allow write for group
After templates\_c and en\_US files are removed/deleted, Civi will recreate new folders and files. (This is recommended when upgrading Civi). Running as Apache these folders/files are then re-created with Apache as owner and group along with a 751 permission

This creates other problems. Drush running as a different user (other than Apache) can be denied access. Changing owners via other commands can cause other failures - as only Apache as owner has write access.

If these permissions were set as 775 (or 771), the problem would not occur. Is there a reason why these are set to 751? Where is this permission defined when new folders and files are created? There are workarounds but but have other consequences that are not desirable. (Other SE postings suggest things like 777 permissions - also not good.)

# Answer
I always `# sudo -u apache drush [command]` when running drush anyway. That way if drush creates new files or directories they JustWork(tm) in drupal.
> 3 votes

# Answer
If you getting the error: *Uncaught PHP Exception Unable to write to the* ...`/files/civicrm/templates_c` directory.

You probably have used drush cache clear run under your user account and that created the temp files owned by the user running drush.

So you can do what the first answer says and "run drush as the webserver user". But, since the files are there, you have to change permissions.

Look at the location `[.../sites/mysite/files/civicrm/templates_c]` and after you find the "*civicrm*" folder at the **top**, just change ownership to Apache/nginx so the web server can read & write cached files.

then cache clear as Apache/nginx

```
sudo -u apache drush cr

```
> 1 votes

---
Tags: permissions
---


# Question
Title: CiviCRM rebuilding templates_c with permissions
I have just upgraded from 4.3.8 to 4.7.15 on Drupal 7.50. Everything went well except the `<drupal_root>sites/default/files/civicrm/templates_c` directory is rebuilt with the wrong file permissions. The owner should be fclub, not www-data, I think. For example, if I delete this directory in order to solve cached template loading problems and reload the page, it rebuilds itself.

```
drwxr-sr-x 3 www-data www-data  4096 Jan 11 14:24 templates_c

```

If I change the owner manually to the correct owner, as all other files and directories, there is an error message about not being able to write to temp files in templates\_c.

This seems to be the residual affect of something that is causing multiple problems, including possibly outgoing mail, scheduled jobs and showing the menu.

Edit: Here is what it looks like after upgrading on an exact copy/dev site:

`drwxrwsr-x 3 fclub www-data 4096 Jan 8 21:30 templates_c`

# Answer
Actually that looks good - your webserver user www-data needs to be able to write to files/ (and anything below it);
> 2 votes

# Answer
If you getting the error: Uncaught PHP Exception Unable to write to the .../files/civicrm/templates\_c" directory.

You have probably used drush cache clear run under your account and that created the temp files owned by the user running drush. SO you can "run drush as the web server user"

```
sudo -u apache drush cr

```

or you can just look at the location \[/files/civicrm/templates\_c\] and after you find the "civicrm" folder at the top, just change ownership so web server can read & write that location (cached files).
> 0 votes

---
Tags: drupal, upgrade, permissions, templates
---


# Question
Title: How to include token or variable for Invoice number under the message templates for Memberships - Receipt (on-line)
I need to send Invoice number in the message templates for Membership Receipt Online, but I don't see any token or variables associated for Invoice Number which I can use to place it

is there any way we can place the invoice number in the message templates ?

# Answer
> 3 votes
The tokens you can use in a message template are a bit random, just what the developer added to the template. In this case, the contribution id can be found with `{$contributionID}`. However, that is not the same as the `invoice_number`. I could not find a token for the invoice number. But the templates are generated by smarty, and in smarty you can use the CiviCRM api. So the following line gets the invoice number:

```
{crmAPI var='invoiceReference'
        entity='Contribution'
        action='getvalue'
        return="invoice_id"
        id=$contributionID}

```

You can print it with `{$invoiceReference}`

# Answer
> 2 votes
I think this answer is outdated, I can see that the {$invoiceReference} variable is available in the message template - Contributions - Receipt (on-line).

Use the Smarty function in the template to see all the available Smarty variables and their values: **{debug output=html}**

---
Tags: wordpress, message-templates, invoice
---


# Question
Title: Issue field DEDUPE "0 Argument 1 passed to"
After upgrading to civicrm version 5.21 we detected a problem in one of the fields of the form linked to a custom profile.

For some reason, every time you try to insert that data from the form in the frontend it returns the error message:

0 Argument 1 passed to civicrm\_api3() must be of the type string, null given, called in /public\_html/administrator/components/com\_civicrm/civicrm/CRM/Dedupe/BAO/Rule.php on line 62

It is an alphanumeric text field, the same as others that populate the form. Has anyone else come across this problem? What can it be caused by?

EDIT - the field in question is used for DEDUPE RULE (for control of duplicate entries), looks like there is something broke with that

# Answer
We are experiencing a similar type error on staging site running 5.21

-we have created a custom field in the civicrm profile used for site registration, e.g. that matches on a unique identifier (card Number)

-The error we are getting looks likes this :

TypeError: Argument 1 passed to civicrm\_api3() must be of the type string, null given, called in /home/ibew90v2/master/sites/all/modules/civicrm/CRM/Dedupe/BAO/Rule.php on line 62 in civicrm\_api3() (line 84 of /home/ibew90v2/master/sites/all/modules/civicrm/api/api.php). ERROR The website encountered an unexpected error. Please try again later.

The error appears to state that it is looking for null value (?) and cannot handle any input (alphanumeric or otherwise in the field) Placing nothing in the custom field it allows the profile submission and creates the account.

The latest release notes here reference a change to the api https://github.com/civicrm/civicrm-core/blob/master/release-notes/5.21.0.md https://github.com/civicrm/civicrm-core/pull/15817

"Fixes a formatting issue in the api explorer output where IS NULL and IS NOT NULL clauses would output invalid code due to the missing value piece of the clause." it appears that the api did not update, somehow when doing the upgrade, that it is still referencing the apiv3 folder .

Notes :

first part of the error references line 66 in the rule.php file, e.g. /home/ibew90v2/master/sites/all/modules/civicrm/api/v3/Rule.php "This api exposes CiviCRM (dedupe) rules."

The second part of the error references the api.php file at /home/ibew90v2/master/sites/all/modules/civicrm/api/api.php it is breaking down here, line 84 : function civicrm\_api3(string $entity, string $action, array $params = \[\]) { $params\['version'\] = 3;

However 5.21 per release notes is using api v4 -- are these old files ? need to be replaced or updated?

Possible fix here : https://github.com/civicrm/civicrm-core/pull/15817/files
> 0 votes

# Answer
On further debugging, I see that this function isn't returning anything CRM\_Core\_DAO\_AllCoreTables::getClassForTable($this-\>rule\_table). (Line 61 Dedupe/BAO/Rule.php)

So, in getClassForTable, the list of tables doesn't include 'civicrm\_view\_members\_1' and therefore

$entity = CRM\_Core\_DAO\_AllCoreTables::getBriefName(CRM\_Core\_DAO\_AllCoreTables::getClassForTable($this-\>rule\_table));

$entity is set to null. which then gives the error Argument 1 passed to civicrm\_api3() must be of the type string, null given.

I will have to check if its related to the api version problem.

Edit: Added this check here after line 62 in civicrm/CRM/Dedupe/BAO/Rule.php

```
// if $entity is not set, setting it to empty string because of type declarations
$entity = $entity ? $entity : '';

```

It seems to have fixed the issue and dedupe on the custom field also looks ok.
> 0 votes

# Answer
Thanks mmk. I also encountered this issue on CIVICRM5.21.2/Wordpress 5.4.2. This phenomena appeared to me when I tried to find duplicates using a dedupe rule based on a custom field. it would crash at WP end. I followed you instruction above and it works, only slight modification to your instruction that it the check should be inserted after line 61 where "$entity = CRM\_Core\_DAO\_AllCoreTables..." is called. thanks again.
> 0 votes

---
Tags: custom-fields, profile, duplicate-contacts
---


# Question
Title: List all Profiles in a group when using "Profile Search Form" as a Joomla menu item
I have a Job Postings profile that gets recorded on a contribution form. The user is then added to a "Job Postings" group. I'd like to have a Profile Search Form on a Joomla page (menu item) that automatically loads every profile record in that group into a list.

Currently, I have it set up to where the user would have to hit search without any filters to populate the list. Like in these images below:

*What you see on page load:*

*What you see after the user hits "Search" with no filters. (all records are returned):*

I'd like the query in that second image ("Displaying Results where: Groups(s) in Job Posting...AND...Group Status 'Added') to be the default search on page load, so that the user gets the whole list of job postings automatically, and then can filter with the search criteria if he or she likes.

Right now I am looking into the Listing.tpl file located at: `/administrator/components/com_civicrm/civicrm/templates/CRM/Profile/Page` and have noticed a variable named `$qill` that seems to hold the search criteria, and some other variables like `$row` and `$search` that also control how information is shown on these types of pages. Maybe there is something that can be done with these variables somehow (if I can find where they get defined)? Is there a simple answer to this I am missing?

# Answer
It looks like force=1 url searching works for profiles too, so just provide a menu link to the page with force=1 on the end of the url, e.g. `https://your.site/civicrm/profile?gid=1&reset=1&force=1`

See https://docs.civicrm.org/user/en/latest/the-user-interface/searching-url-support/
> 1 votes

---
Tags: profile, search, templates
---


# Question
Title: How do you handle searching and reports on contributions with line items from Webform CiviCRM
Webform CiviCRM for Drupal 7 allows one to set multiple line items with different financial types for one contribution. In this case, a charitable donation and a non-charitable event ticket.

If I set the charitable donation as the primary contribution and the event ticket as the additional line item, this works fine to set the tax receipt correctly for only the amount of the charitable donation (if the non-charitable event ticket is primary, you can't send a tax receipt).

What I don't understand is how to handle contribution searches or reports in this case. If I want to know how much we received in donations last year, I would normally use a search or a report. However, I believe these would both now be incorrect as they would show a $X+Y donation, when I actually have a $X donation and a $Y event ticket. Does this mean I can only use line item reports and can't use regular contribution reports or contribution searches if I have contributions generated in this way?

Is there a way to create two separate contributions instead?

# Answer
> 2 votes
Have a look at the Extended Report extension

It offers new reports like Extended Report - Price Set Line Items

---
Tags: webform-civicrm, line-items
---


# Question
Title: Unsubscribe URLs in emails being altered by firewalls
We are experiencing a significant number of links in our emails being altered by email firewalls resulting in recipients experiencing peculiar unsubscribe form behavior that is troublesome. For example, one firewall product replaces any email address in our unsubscribe URLs with mail=nobody@mycraftmail.com.

Has anyone explored an alternative method for unsubscribe links that works well? We are considering using cid and checksum, but the form won't work once the token expires. We are using CiviCRM 5.21.3 on Drupal 7.73. Thanks for any suggestions you may have.

# Answer
You may want to have a look at the Advanced Newsletter Management Extension. It allows you to configure mailing subscription preference pages in CiviCRM. The extension will then make this information available via its REST API and an external system can generate the pages and present them to your contacts.

As it does require some work to set up mailing preference forms separately from CiviCRM, it's not a quick and easy fix.
> 2 votes

---
Tags: email, unsubscribe
---


# Question
Title: Avoid an activity entry for each recipient contact of a mass mailing
We are facing a huge database growth as we send newsletters to a growing recipients list. The newsletter is sent with CiviCRM Mail to a contacts group. I realized that the biggest table in our project is the civicrm\_activity\_contact table - and I am quite sure that most of the entries are those entries generated when a contact received the newsletter.

As there is a tab "Mailings" for each contact where all these newsletter mailings are listed I wonder why there are activities created additionally? Is there a need for these activities? Can I turn off activity creation for mass mailings somewhere?

# Answer
> 3 votes
I think I found it: Administer \> CiviMail \> CiviMail Component Settings \> "Enable CiviMail to create activities on delivery" is checked in our project.

---
Tags: civimail, activities, mailing
---


# Question
Title: CiviRules: Is there a trigger that can be used if a groupcontact is deleted?
The trigger "Contact is removed from Group" doesn't fire if the groupcontact is deleted (and not removed). Is there a trigger, that can be used to react on the deletion of a groupcontact?

# Answer
> 0 votes
If it is not in the list it does not exist yet :-). As long as the pre hook is used in the group delete it should not be hard to add. Are you in a position to check this and add it?

---
Tags: civirules
---


# Question
Title: AGPL: Should sites provide public download links for CiviCRM extensions?
I guess this question has a few parts:

* Are CiviCRM extensions are considered to be modifications of CiviCRM?
* Are custom file overrides considered to be modifications of CiviCRM?
* If so, then under CiviCRM's AGPL license, are sites running extensions and custom file overrides required to make those modifications available for download to people who use the site?

For example, if custom code (file override or extension) modifies functionality of a public-facing event registration page, does that page need to contain links to download the modified code?

# Answer
> 1 votes
I'm certainly not a lawyer, but I've always assumed the answer to all three questions is "Yes".

That said, I haven't made a comprehensive effort to do so - though my *current* policy is to post all extensions on Github (and I only use overrides within an extension framework). I wouldn't want to make my clients post a link, but in theory my Github page would be a single point of download.

To date I don't believe the AGPL has been tested in court though - so I'd expect lawyers to make the argument, perhaps successfully, that the AGPL isn't (always) binding. Given that many nations' jurisdictions have upheld similar arguments against the GPL, that argument would have an uphill climb.

My take is that the main beneficiaries of the AGPL are the organizations who use CiviCRM vis-a-vis developers they hire. It's a very powerful tool against vendor lock-in!

# Answer
> 0 votes
> For example, if custom code (file override or extension) modifies functionality of a public-facing event registration page, does that page need to contain links to download the modified code?

I would say no to this. I think if I am hosting that site for a client, I am required to make the code available to the client if it's requested, but to make the code available to anyone who uses the site seems sort of crazy to me, not to mention a possible security risk, no?

---
Tags: extension, custom-templates
---


# Question
Title: Getting error when using civix generate:module or civix generate:entity curly braces no longer supported in phar
Getting this error when using civix to generate a module or an entity:

```
Fatal error: Array and string offset access syntax with curly braces is no longer supported in phar:///usr/local/bin/civix/vendor/civicrm/cv/src/BuildkitReader.php on line 38

```

Can anyone explain what could be causing this and what I could do?

# Answer
> 1 votes
**UPDATE 2**: The PR was merged so now the latest civix phar download supports php 7.4 (insert emoji yay! here)

---

**UPDATE**: PR submitted to update civix to update its version of cv: https://github.com/totten/civix/pull/200

---

Are you on php 7.4? You have an old version of cv within your civix phar. I'd download a new copy of civix.

i.e. https://github.com/civicrm/cv/commit/018c667429653ca06bc1dff6a93fdec87d9171bc

# Answer
> 1 votes
I thought I downloaded the latest version but my local PHP was 8.0. Switched to 7.2 (which is the one my local apache is using) and it works again.

---
Tags: civix
---


# Question
Title: How to list search results in edit mode like a spreadsheet for easy data entry on WordPress platform?
I have custom profiles I would like our team to be able to edit directly in the search results display so they don't have to click into each record individually... much like a spreadsheet... to ease data entry.

# Answer
> 1 votes
Can only think of finding the contacts and doing batch update via profile, this will allow you to update the contact like spreadsheet. But its only limited to few contacts at a time

---
Tags: search-results
---


# Question
Title: Civi site is not verifying reCAPTCHA solutions
Testing use of recaptcha v2. Have set up on site (Civi 5.12.3) and it is showing up on contribution pages as expected.

On Google site, shows this message.

We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information.

Any suggestions or ideas on what might be missing?

# Answer
> 3 votes
This has been fixed recently as a bug. I would expect to see this in 5.32 or 5.33. It may make a patch release and be available sooner.

Link to PR

---
Tags: recaptcha
---


title: Image cropping with TinyMCE in Mosaico

text:
# Question
Title: Image cropping with TinyMCE in Mosaico
Does anyone have image editing enabled in Mosaico through TinyMCE?

I assume it is possible through Mosaico Toolbar Configurator.

Additionally, what would be truly wonderful is if there was a way to crop images within Mosaico to a specific aspect ratio. One big problem we have is users who are unable or unwilling to crop images on their computer, especially to a specified aspect ratio. If there were some way to make this possible in Mosaico, that would save a lot of headache.

As far as I can tell, this isn't possible in TinyMCE image editor. In MoxieManager for TinyMCE, it is in theory possible to specify the width of an image and then crop to a specific height, but that relies on either carefully selecting exactly the height you want or entering it (which doesn't allow you to select the image area to crop to).

# Answer
I implemented an image editor which you can grab here: https://github.com/lcdservices/biz.lcdservices.mosaicoimageeditor

I built it for a specific client and have not yet tested how portable it is in other installations. But at the very least it should get you started.

Actually -- just reviewing it, and the method for storing the image via API is client specific. At some point I'll generalize it so it's useful for the community. It implements: https://github.com/scaleflex/filerobot-image-editor
> 1 votes

---
Tags: mosaico, images, tinymce
---


# Question
Title: Mailing to contacts in a group - deleted contacts were included to the list of recipients
We discovered a bug on this weekend with our last newsletter. We use CiviMail to send our newsletter to all contacts within our "Newsletter" group. As usual we collected the group as the recipients in the mailing form. After the update to CiviCRM 5.29.1 we made last week we realized that the newsletter was sent to group members which are delete already.

I checked if these contacts were included to the newsletter recipients before but I did not find deleted contacts in the list of recipients for newsletters sent before this update.

# Answer
> 2 votes
It seems that the bugfix which fixed this for smart groups also did it for the groups. Our last mailing sending after upgrading to CiviCRM 5.30.1 resolved this issue. No mails have been sent to contacts in trash.

---
Tags: civimail, contacts, groups, deleted, civigroup
---


# Question
Title: How to import/create multiple events from .csv?
how do one import/create multiple events from an existing .csv file?

I checked the "API csv Import"-Extension (https://civicrm.org/extensions/api-csv-import-gui). But this only updates existing events.

1. Does anybody know a different method?

or

2. I thought of creating multiple "empty" events with only an event-id and then updating it through the api-csv-import-ui. Can somebody give me a hint how to do that? (I am not super experienced with the api). Or even providing me with a code snippet, for create multiple events with event-ids from x-y.

Thanks in advance. Stefan

---

I am using

* drupal7
* CiviCRM 5.30.1.

# Answer
Yes you can use the API CSV extension to import new events. Here is a good guide to do so: https://wapix.co/importing-events-to-civicrm/.
> 3 votes

---
Tags: civievent, api
---


title: Which SMS provider would you recommend?

text:
# Question
Title: Which SMS provider would you recommend?
We want to implement a SMS gateway for a client and we are wondering about which one to choose.

I found and read this post from 2016 and I'd like to know if there are new solutions or positive feedbacks with one of the four providers mentioned.

SMS would be sent / received in France.

# Answer
I guess its based on which provider you choose based on the budget or sms gateway fees. There few extension provided by Organization that integrates with SMS gateway

1. Clickatell
2. Twilio
3. Message Media
4. My sms myntra

You may also find more if you try to search for SMS gateway name with CiviCRM.

We have few clients using Twilio and have positive response so far, few others use different providers because of budget constraint and SMS charges, so we have implemented extension to support that(very simple to integrate).
> 2 votes

---
Tags: sms
---


# Question
Title: "QuickForm Error: nonexistent html element" on New Contacts (all types) - Joomla 3.9.22, CiviCRM 5.30.1
When trying to create a New Contact of any type: Organization, Household, or Individual, the system reports "**Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.**" ***As a result, I cannot create contacts of any type***. Any help would be appreciated, but this looks internal; perhaps some sort of installation issue. Thanks in advance!

Error message details are below:

```
backTrace

#0 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(148): CRM_Core_Error::backtrace()
#1 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(HTML_QuickForm_Error))
#2 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm.php(2088): PEAR_Error->__construct("nonexistent html element", -3, 16, (Array:2), "Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()")
#3 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): HTML_QuickForm_Error->__construct(-3, 16, (Array:2), "Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()")
#4 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(236): PEAR::_raiseError(NULL, NULL, -3, 16, (Array:2), "Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()", "HTML_QuickForm_Error", TRUE)
#5 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm.php(1632): PEAR::__callStatic("raiseError", (Array:7))
#6 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/CustomField.php(972): HTML_QuickForm->freeze((Array:1))
#7 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/CustomGroup.php(1561): CRM_Core_BAO_CustomField::addQuickFormElement(Object(CRM_Contact_Form_Contact), "custom_1_-1", "1", "0")
#8 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Custom/Form/CustomData.php(170): CRM_Core_BAO_CustomGroup::buildQuickForm(Object(CRM_Contact_Form_Contact), (Array:1))
#9 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Edit/CustomData.php(63): CRM_Custom_Form_CustomData::buildQuickForm(Object(CRM_Contact_Form_Contact))
#10 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Contact.php(796): CRM_Contact_Form_Edit_CustomData::buildQuickForm(Object(CRM_Contact_Form_Contact))
#11 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(623): CRM_Contact_Form_Contact->buildQuickForm()
#12 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(76): CRM_Core_Form->buildForm()
#13 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contact_Form_Contact), "display")
#14 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Contact), "display")
#15 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(347): HTML_QuickForm_Page->handle("display")
#16 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run()
#17 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(285): CRM_Utils_Wrapper->run("CRM_Contact_Form_Contact", "New Contact", (Array:1))
#18 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:13))
#19 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
#20 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm.php(121): CRM_Core_Invoke::invoke((Array:3))
#21 /home/redacted/public_html/redacted/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
#22 /home/redacted/public_html/redacted/libraries/src/Component/ComponentHelper.php(402): require_once("/home/redacted/public_html/redacted/administrator/components/com_civicrm/civic...")
#23 /home/redacted/public_html/redacted/libraries/src/Component/ComponentHelper.php(377): Joomla\CMS\Component\ComponentHelper::executeComponent("/home/redacted/public_html/redacted/administrator/components/com_civicrm/civic...")
#24 /home/redacted/public_html/redacted/libraries/src/Application/AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent("com_civicrm")
#25 /home/redacted/public_html/redacted/libraries/src/Application/AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch()
#26 /home/redacted/public_html/redacted/libraries/src/Application/CMSApplication.php(196): Joomla\CMS\Application\AdministratorApplication->doExecute()
#27 /home/redacted/public_html/redacted/administrator/index.php(51): Joomla\CMS\Application\CMSApplication->execute()
#28 {main}

Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => QuickForm Error: nonexistent html element
    [mode] => 16
    [debug_info] => Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()
    [type] => HTML_QuickForm_Error
    [user_info] => Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()
    [to_string] => [html_quickform_error: message="nonexistent html element" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="QuickForm Error: " info="Nonexistant element(s): 'custom_1_-1' in HTML_QuickForm::freeze()"]
)

```

In response to the first person who answered, below is the result of a query of the civicrm\_custom\_fields table from phpMyAdmin.

```
SELECT * FROM civicrm_custom_field WHERE id = 1

1   1   Areas   Areas   String  Multi-Select
    NULL
    0   1   0   1
    NULL

    NULL

    NULL

    NULL

    NULL
    1   1
    NULL
    255
    NULL

    NULL

    NULL

    NULL
    60  4   areas   96  0
    NULL
    0

```

Here's the same table data expressed as an SQL INSERT query (also exported from phpMyAdmin). This one gives the column names.

```
INSERT INTO `civicrm_custom_field` (`id`, `custom_group_id`, `name`, `label`, `data_type`, `html_type`, `default_value`, `is_required`, `is_searchable`, `is_search_range`, `weight`, `help_pre`, `help_post`, `mask`, `attributes`, `javascript`, `is_active`, `is_view`, `options_per_line`, `text_length`, `start_date_years`, `end_date_years`, `date_format`, `time_format`, `note_columns`, `note_rows`, `column_name`, `option_group_id`, `serialize`, `filter`, `in_selector`) VALUES
(1, 1, 'Areas', 'Areas', 'String', 'Multi-Select', NULL, 0, 1, 0, 1, NULL, NULL, NULL, NULL, NULL, 1, 1, NULL, 255, NULL, NULL, NULL, NULL, 60, 4, 'areas', 96, 0, NULL, 0);

```

Regarding the possibility of the Areas extension being installed, unless that content came with the installation of Civi, I don't know how it got there. I don't see an Areas extension here.

# Answer
> 1 votes
That backtrace is very helpful.

The issue has something to do with your custom field with an ID of 1. I've seen this when, for instance, the "Search by Range" option was set on a field that displays as an option value. Somewhere in the field's definition are conflicting settings.

If this isn't enough to track down the issue, please run this SQL command:

```
SELECT * FROM civicrm_custom_field WHERE id = 1;

```

and edit your question to include the results.

# Answer
> 0 votes
I finally gave up and renamed the com\_civicrm folder in file manager and removed all the civi records from the extensions table. Got my site back at least. But now I have to start over again with Civi. Oh well. Maybe phpMyAdmin will let me drop all those tables and maybe it won't.

Thanks everyone for trying to help, but this was very broken. I'll recover.

---
Tags: contacts, joomla, issues, quickform
---


title: How do I locate the Financial Type ID?

text:
# Question
Title: How do I locate the Financial Type ID?
I am trying to import hundreds of contribution records and it is requiring I include the Financial Type ID when importing. Simply having the word Donation is not enough! When I visit Administer - CiviContribute - Financial Types, it does not display the Financial Type ID.

# Answer
> 5 votes
When importing contributions, you must specify the Financial Type in the form of the Financial Type ID. Unfortunately going to Administer - CiviContribute - Financial Types does not display the Financial Type ID. You must get the Financial Type ID from the API Explorer

Go to Support - Developer - then one of the following:

**API Explorer V3**

* Entity: Financial Type
* Action: getlist
* Parameters: Leave blank
* Execute

You will revive a list of all the Financial Type labels and their ID numbers.

For example:

```
  "id": "7",
        "label": "Money Donations",
        "description": [
            "For all monetary donations.  "

```

In this case **7** is the Financial Type ID for **Money Donations**

**API Explorer V4**

* Good luck and
* don't !@#$ it up.

So pretty much use V3 as v4 does not use getlist. ;)

# Answer
> 3 votes
For those who want to do this via the UI I believe this is as simple as going to civicrm/admin/financial/financialType?reset=1 and mousing over or clicking on Edit for each Financial Type and the ID will show in the url

# Answer
> 1 votes
For anyone else looking for this, you can use the getFields action on the Contribution entity to locate the options for the Financial Type ID.

```
$fields = \Civi\Api4\Contribution::getFields()
  ->setLoadOptions([
    'id',
    'name',
    'label',
    'abbr',
    'description',
    'color',
    'icon',
  ])
  ->addWhere('options', '!=', FALSE)
  ->addWhere('name', '=', 'financial_type_id')
  ->execute();

```

---
Tags: civicontribute, import, financial-types
---


# Question
Title: CiviCRM exports displayed in browser – no download / header missing
We're facing an issue with contact exports. They become displayed in the browsers as raw text.

We recently updated to php 7.1 and CiviCRM 5.25.0 but unfortunately and due to infrequent use of the export functionality we can't say if any of these changes directly led to the problem.

Does anybody has the slightest idea what could be causing this?

-- **Update 2020-11-03** --

I'm stuck with this til today. I tried literally any detection method.

And exporting reports works.

When stracing apache for setting the header while exporting contacts or participants:

```
strace -fyp $(pgrep apache2|sed ':a;N;$!ba;s/\n/,/g') -s 30000 |& grep -i 'Content-Disposition:'

```

I get no results.

It would be too nice if anybody may shed some more light on this.

-- **/Update** --

Thx in advance

# Answer
> 0 votes
After upgrading to 5.30 the error seems to be gone.

# Answer
> 2 votes
If you have something like a file with a blank line at the top that might get output before the export data and cause the output to be interpreted as http content-type text instead of a download.

Check civicrm.settings.php or extensions or files in the CMS that might have changed.

You could also try running this from the root folder of your CMS:

`find . -type f -exec awk 'NR==1&&/^$/{print FILENAME}' \{\} \;`

or maybe this if the line isn't completely blank, like a couple tabs:

`find . -type f -exec awk 'NR==1&&/^\s*$/{print FILENAME}' \{\} \;`

https://askubuntu.com/a/1072314

---
Tags: export, core
---


# Question
Title: Is there any way to search for contacts with special characters using other characters in the CiviCRM search?
E.g. ss = ß, ae = ä, ue = ü, oe = ö

Our language is German but English-speaking colleagues should be able to search for German contacts without having to copy a character from the character table. In addition, as native speakers, we sometimes don't know whether a surname is spelled with ß or ss. We then always have to look for both variants.

Is there a solution for this?

# Answer
> 1 votes
You can use MySQL wildcards in most search fields. Using a percentage sign will find either character - e.g. `G%nther` will find `Gunther`, `Günther`, and `Guenther`. Note that this slows down searches, especially if it's at the very front of the search.

# Answer
> 0 votes
Also in case of the German "Umlaute" you should be able to simply type a/o/u instead of ä/ö/ü in most searches. Searching for "Jurgen" would for example also yield all "Jürgen" in the database.

Afaik, a coherent phonetic search does not exist for CiviCRM yet.

---
Tags: search
---


# Question
Title: Mailchimp CiviCRM Integration: "Sync Contacts" buttons don't show up on "Mailchimp Pull/Push Sync" screens
When trying to sync CiviCRM contacts to Mailchimp or updating CiviCRM from Mailchimp, the buttons "***Sync contacts***" don't show up on both screens: "***Mailchimp Pull Sync***" and "***Mailchimp Push Sync***".

I've got installed **CiviCRM 5.21.1** and I've tested it with **Mailchimp CiviCRM** extension versions **2.0** and **2.0.1**. Any help will be very much appreciated.

# Answer
The reason why the buttons weren't appearing was because I hadn't **linked** **the Groups** in CiviCRM with Mailchimp through "**Manage Groups**" funcionality in CiviCRM.

Once I linked them, the buttons showed up.
> 3 votes

---
Tags: extension, mailchimp
---


# Question
Title: Mailing only works when executed manually, not scheduled
I am trying to executed a job to send out a mailing via CiviMail. This works when I do this manually, but fails when scheduled:

> permission check failed for Group/get call; insufficient permission: require access CiviCRM

What permission should I add to which user?

I am using Drupal 7 cron.

# Answer
> 2 votes
Solution:

* create a new user, add permissions:
    + View all contacts
    + Access CiviCRM
    + Access CiviMail
* go to admin/config/civicrm/civicrm-cron

See also: https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#choosing-a-cms-user

# Answer
> 0 votes
You should give the permission to cron user.

---
Tags: civimail, cron-job, scheduled-job
---


# Question
Title: How do I find the number of our association's members at the end of each calendar year?
I'm using Reports, Membership Reports, Membership Summary. In the filter section it seems to require "Member

# Answer
The CiviCRM Membership records themselves don't provide a complete or reliable history of memberships, which is why reports based on them (i.e. the Membership reports) aren't useful to you for this purpose.

They do contain a "join" date separately from the "start" date which could be used to make a reasonable guess about membership totals in the past, but this isn't reliable (e.g. if a membership is deleted, or if this field is not used as expected.)

The churn extension, as well as the membership dashboard, make use of the CiviCRM Activity records to calculate when a new membership is created or renewed or expires (because each of those leave behind an activity record). This is probably the best tool for what you want, though it can be misleading as well (especially if you've imported your membership records into CiviCRM from a different sytem).

I haven't seen any off-the-shelf Civi Reports that make use of these records.

My general advice to anyone who wants to have historical comparisons of membership data is to download the membership data at defined intervals.
> 1 votes

# Answer
This extension may help similar questions in future
> 1 votes

---
Tags: database
---


# Question
Title: Fresh installation gets 403 error when non-administrator user tries to access a page
I've just made a fresh installation of Wordpress/CiviCRM, followed installation instructions and hope to have installation requirements fully satisfied. I can get access to the dashboard and everything looks fine when I log in as administrative privileges, but when using another user to login (with Wordpress "Editor" priviliges for example), i get a 403 errore while trying to access the dashboard. What could be wrong in my setup?

I also have another question: which is the default URL I could give my users to access the dashboard? should I give them https:///wp-admin/admin.php?page=CiviCRM or does exists by default another path like https:///civicrm/dashboard ?

Thanks a lot in advance

# Answer
What do you have at `/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Faccess%2Fwp-permissions&reset=1`? You probably just need to set up permissions.

More info here: https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control/
> 0 votes

---
Tags: wordpress, error
---


# Question
Title: Problems installing CiviCRM under Drupal 7 on Windows?
I have just tried installing CiviCRM 5.30.1 using Drupal 7 under WIMP, i.e. Windows, IIS, MySQL and PHP 7.4, and was unable to do so, as I got a message telling me that \sites\default was not writable. On investigation, it seems that the PHP function is\_writable will *always* return false under Windows. This means that it seems you can't install CiviCRM under Windows any more, as the IsCreatable function in \sites\all\modules\civicrm\setup\src\Setup\FileUtil.php relies on the is\_writable function to test if the above folder is writable during the setup process. I got round it with the following code snippet.

```
public static function isCreateable($file) {
    if (file_exists($file)) {
      return is_writable($file);
    }

    $next = dirname($file);
    do {
      $current = $next;
        // Under Windows, it seems that folder are never writable      if (file_exists($current)) {
        if( is_writable($current)) {
          return true;
        } else {
          //Try to create a file
            $result = fopen("Test.tmp", "w");
            if ($result) {
            // Close the file.
            fclose($result);
            // Delete it.
            unlink("Test.tmp");
            return true;
            } else {
              return false;
            }
        }
      $next = dirname($current);
    } while ($current && $next && $current != $next);

    return FALSE;
  }

```

No doubt some of you CiviCRM experts will have a comment.

# Answer
> 1 votes
In windows to change the folder permissions use `attrib -r path\to\sites\default` (can be a relative or absolute path).

---
Tags: installation, windows
---