# Question
Title: How can I make a Custom Search do an initial search?
I have created a custom search, and it works nicely. What I would really like though is to pass default values to the custom search and it doing the initial search with those values.

The user can then change the search criteria if he/she wants another filter.

Is that possible and how can I do that?

# Answer
Even i wanted an easy way of doing this as well but the current architecture of CiviCRM doesn't allow it automatically. I could achieve this by copying few functions(see below) from CRM\_Core\_Form\_Search into my custom search file

```
  /**
   * @return array
   */
  public function getSearchFieldMetadata() {
    $searchFieldMetadata['contact'] = [
      'sort_name' => [
        'title' => ts('Sort Name'),
        'type' => CRM_Utils_Type::T_STRING,
      ]
    ];
    return $searchFieldMetadata;
  }

  /**
   * Get the validation rule to apply to a function.
   *
   * Alphanumeric is designed to always be safe & for now we just return
   * that but in future we can use tighter rules for types like int, bool etc.
   *
   * @param string $entity
   * @param string $fieldName
   *
   * @return string
   */
  protected function getValidationTypeForField($entity, $fieldName) {
    switch ($this->getSearchFieldMetadata()[$entity][$fieldName]['type']) {
      case CRM_Utils_Type::T_BOOLEAN:
        return 'Boolean';

      case CRM_Utils_Type::T_INT:
        return 'CommaSeparatedIntegers';

      case CRM_Utils_Type::T_DATE:
      case CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME:
        return 'Timestamp';

      default:
        return 'Alphanumeric';
    }
  }

  /**
   * Get the defaults for the entity for any fields described in metadata.
   *
   * @param string $entity
   *
   * @return array
   *
   * @throws \CRM_Core_Exception
   */
  protected function getEntityDefaults($entity) {
    $defaults = [];
    foreach (CRM_Utils_Array::value($entity, $this->getSearchFieldMetadata(), []) as $fieldName => $fieldSpec) {
      if (empty($_POST[$fieldName])) {
        $value = CRM_Utils_Request::retrieveValue($fieldName, $this->getValidationTypeForField($entity, $fieldName), NULL, NULL, 'GET');
        if ($value !== NULL) {
          $defaults[$fieldName] = $value;
        }
        if ($fieldSpec['type'] === CRM_Utils_Type::T_DATE || ($fieldSpec['type'] === CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME)) {
          $low = CRM_Utils_Request::retrieveValue($fieldName . '_low', 'Timestamp', NULL, NULL, 'GET');
          $high = CRM_Utils_Request::retrieveValue($fieldName . '_high', 'Timestamp', NULL, NULL, 'GET');
          if ($low !== NULL || $high !== NULL) {
            $defaults[$fieldName . '_relative'] = 0;
            $defaults[$fieldName . '_low'] = $low ? date('Y-m-d H:i:s', strtotime($low)) : NULL;
            $defaults[$fieldName . '_high'] = $high ? date('Y-m-d H:i:s', strtotime($high)) : NULL;
          }
          else {
            $relative = CRM_Utils_Request::retrieveValue($fieldName . '_relative', 'String', NULL, NULL, 'GET');
            if (!empty($relative) && isset(CRM_Core_OptionGroup::values('relative_date_filters')[$relative])) {
              $defaults[$fieldName . '_relative'] = $relative;
            }
          }
        }
      }
    }
    return $defaults;
  }

```

and added below snippet in my custom search file \__construct() function(at the beginning)

```
    $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean');
    if ($this->_force) {
      foreach (array_keys($this->getSearchFieldMetadata()) as $entity) {
        $formValues = array_merge($this->getEntityDefaults($entity), $formValues);
      }
    }

```

HTH

Pradeep
> 3 votes

---
Tags: custom-search
---


# Question
Title: Is it possible to access contribution tokens in hook_civicrm_tokenValues?
I’m trying to make a custom token to present grouped donations in a thank you letter in a friendlier format. If I use the ‘Group contribution by contact’ option the {contribution.total\_amount} and {contribution.receive\_date} tokens generate something like this:

Donation Amount $ 5.00, 10.00

Date of Donation September 14th, 2019, September 12th, 2019

I’ve setup hook functions to define a new token meant to display each donation and date on the same line, and to provide a total at the end of the list. If I could access the donation tokens in my function for hook\_civicrm\_tokenValues I could easily re-arrange the data as desired. But even though the $tokens parameter indicates that my template uses {contribution.total\_amount} and {contribution.receive\_date}, the $values parameter does not include the relevant contribution tokens, just contact tokens:

```
$values (as displayed by a temp debug token)
Array
(
[2] => Array
(
[contact_id] => 2
[display_name] => Don Alexander
[postal_greeting_id] => 1
[postal_greeting_display] => Dear Don
[postal_greeting_custom] =>
[address_id] => 1891
[street_address] => 1069 Steele Hollow Rd
[supplemental_address_1] =>
[city] => Spencer
[postal_code_suffix] => 8133
[postal_code] => 25276
[state_province_id] => 1047
[civicrm_value_spouse_tokens_7_id] => 1
[custom_16] => Mary
[custom_17] => Don Alexander, Mary Wildfire
[postal_greeting] => Dear Don
[state_province_name] => West Virginia
)
)

```

Is there any way to access/modify contribution tokens from within hook\_civicrm\_tokenValues?

# Answer
I think I can self-answer this after exploring various methods to create end of the year thank-you letters for recurring/multiple contributions - the donation tokens are not passed in the $values array, and are not otherwise easily accessible from within the hook function.

In theory it may be possible to access an array of contribution data passed in the Smarty variables, but it was way easier to simply make a custom token that does it's own queries to create a small table showing all donations made in the previous calendar year (including donations made by a spouse)...
> 2 votes

---
Tags: contributions, tokens
---


title: Details not saving

text:
# Question
Title: Details not saving
I use Civi daily. When I speak to a contact, I will often go into Civi and update their details. Lately, this information has not been saving. For example, yesterday I entered two peoples' job titles. After doing so, I received a message saying the information had been saved. I went back into Civi this morning and the information is not there. Could anyone shed any light on this?

# Answer
Can you see apache or nginx error log? Probably you may need to increase post\_max\_size.
> 1 votes

---
Tags: contacts, upgrade, fields
---


# Question
Title: FYI - Sending mail via G Suite - Google announce username/password authentication will be turned off
Google have announced they are turning off access to G Suite via username/password authentication.

My initial concern was this could potentially impact anyone using G Suite for Outbound Mail. However the statement says "*No change is required for scanners or other devices using simple mail transfer protocol (SMTP) or LSAs (less secure apps) to send emails*."

My question is whether CiviCRM are considering OAuth2 authentication (eg Google's XOAUTH2 scheme) when sending mail?

# Answer
> 0 votes
CiviCRM is not responsible for authentication of users (that's the CMS, ie. Drupal or WordPress). Using OAuth2 (or other protocol) for authenticating CiviCRM to another system would be the responsibility of the extension that wants to do that.

Or do you see a reason to include Oauth2 in core CiviCRM?

I'd be hesitant about using Oauth2 before fully understanding what you're getting into - here's a helpful blog w/ links from Colan Schwartz:

https://colan.consulting/blog/authenticating-drupal-users-oauth2

# Answer
> 0 votes
This is an update from 2024.

Google explain how to access accounts when two-step verification (2SV) is not possible. See https://support.google.com/accounts/answer/185833

You turn on 2SV for the account you're using, but create an app password. The app password is what CiviCRM uses, but human access requires 2SV. Convenient and secure.

---
Tags: civimail, email
---


# Question
Title: Bounce processing - will fail for G Suite users when Google disables less secure apps in Feb 2021
Google have announced they are stopping support of less secure apps in G Suite in Feb 2021. No new LSA connections will be allowed after Jun 2020.

Google have advised me that the email accounts I'm using for Bounce Processing and Email-to-Activity Processing are affected by this.

Google's advice is "For any other LSA, contact your admin or ask the developer of the app you are using to start supporting OAuth".

Are there any plans for CiviCRM to support connecting to IMAP or POP using OAuth authentication?

# Answer
> 0 votes
Here's a potential workaround for anyone who can set up a non-G-Suite IMAP account. I haven't implemented or tested this.

1. Continue using your G Suite email address - it has your domain name and Google does SPAM etc processing
2. Forward email to your non-G-Suite account
3. Use this second account for Bounce Processing

# Answer
> 0 votes
Here's a potential workaround for anyone who can set up a Maildir on their server and run jobs. I haven't implemented or tested this.

1. Continue using your G Suite email address - it has your domain name and Google does SPAM etc processing
2. Find an app for your server that can read an IMAP account, uses OAuth for authentication, and populates a Maildir
3. Run the job regularly
4. Use the Maildir for Bounce Processing

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


# Question
Title: Memberships not being inherited by related contacts
I'm working on a new CiviCRM implementation in Wordpress. I have imported contacts with an External ID in each record, imported contributions, memberships and relationships. The related contacts are not showing a valid membership by relationship and the Primary Member's membership record states "One contact is currently eligible to inherit this relationship."

I have tried deleting all records and reimporting in a different order; updating memberships; running update membership scheduled job.

I don't know where else to turn - I don't want to enter all of these manually.

Open to more ideas to solve the issue.

Thanks in Advance

Wordpress 4.5.3 CiviCRM 4.7.9

# Answer
> 1 votes
This is an on-again gone-again bug. At FF Towers we were never able to fix it and ended up writing an extension that did edit save on the membership to get it to work. Horribly hacky but day saved. Recommend more UTs.

# Answer
> 1 votes
I realize this question has been out here a long time, but I recently experienced a similar situation and solved it - my Civi version is 5.3.1 and I'm using it with Drupal version 8.6.3.

In my case, I had accidentally set up the Membership Type to be linked to Organizations, but had defined the Relationship to be "Employee of" rather than "Employer of". This meant that Civi went looking for contacts that the Organization was an "employee of" rather than contacts that the Organization was an "employer of" when it was time to create inherited Memberships.

There appears to be a display bug in Civi in which it detects that an Employer/Employee relationship does exist between the Organization and Individual even if the direction is reversed and it reports it as being "eligible." This seems to account for the reporting of eligible contacts but the failure to create the membership.

When I set up the membership type's relationship direction to use "Employer of," the membership inheritance began working. (In my case, I had to make a direct database update to the civicrm\_membership\_types table because Civi won't let you modify the membership type after memberships have been created. The update caused no data integrity issues for my situation. YMMV)

Or you can use this plugin to modify the relationship https://github.com/agileware/au.com.agileware.membershiprelationshiptypeeditor

# Answer
> 0 votes
Is the Relationship Type set properly in Administer \> Civimember \> Membership Types? Each Membership Type needs the specific kind of relationship (employer of, etc.) specified for inheritance to function correctly.

# Answer
> 0 votes
I've noticed recently that CiviCRM doesn't properly account for relationships that inherently operate in both directions (such as the spouse relationship).

For example, we noticed a wife who did not inherit the membership her husband owns, due to her being contact\_a in the spouse relationship record. Deleting the spouse relationship and re-entering it from the husband's record fixes the issue, at least for the time being (some couples seems to alternate who donates for a membership, which means we'd have to delete and redefine their relationships every year).

---
Tags: civimember, relationships
---


# Question
Title: Admin permissions are required to set 'limit to' or 'also add' participant role for scheduled reminders?
We have noticed that if you don't have CiviCRM:Administer CiviCRM permissions, in scheduled reminders for an event if 'limit to' (or 'also include') is set to 'participant role', the drop-down box for *which* participant role does not appear. So they can select 'limit to' (or 'also include') and 'participant role', but not then select a role.

We would like non-adminstrator level permissions (with all relevant event-level permissions) to be able to select which participant roles an event scheduled reminder is limited to (or adds on).

This feels like a bug to me? Any advice?

# Answer
> 0 votes
Two explanations come to mind:

1. Scheduled reminders are often set up by administrators so in many cases the current arrangement is fine.
2. CiviCRM:Administer CiviCRM is a default requirement so it is possible no-one has worked through what permissions make sense if it is not an administrator configuring the reminders.

I'd suggest you create an issue at https://lab.civicrm.org/dev/core/issues and describe how you think the permissions should work in that area.

However, unless you can contribute code or sponsor someone to do the change, it is unlikely to be implemented quickly - but you might get lucky: sometimes people getting started with Civi development are looking for small changes to work on.

---
Tags: civievent, scheduled-reminders
---


# Question
Title: Why is the content of a Receipt for New Memberships different to that for a Renewed Membership
There is a key data element that is missing from the Renewal receipt. "Financial Type" is present in a receipt for a new Membership but is NOT shown in the receipt for a renewed Membership.

We use Financial Type to differentiate between Member Subscriptions and Annual Donations / Sponsorships. For Tax purposes, the word Donation in the receipt is key for a donor to claim a partial refund.

So the issue is can the Financial Type element be made available for a renewal receipt. Alternatively is there a suggested work around that can be inserted in the HTML code?

# Answer
> 2 votes
The receipt templates are at Mailings \> Message Templates \> System Workflow Messages

Under Memberships, there are two receipt templates for on-line and off-line. From a quick look at those, I'm not clear how your problem arises.

What version are you on? Templates do get changed so your problem may already have been fixed in later versions.

Are you using the default versions? If not, it will show you a 'Revert to Default' and 'View Default' menu link as well as 'Edit'. If changes were made to your templates a while ago then they may be very different to the current default version. In this case, you need to compare your customised version with the default version.

If you are on the default version then you can easily experiment with some changes and use the 'Revert to Default' if you mess up. Otherwise, you can save a copy somewhere, try changes and copy back your original saved version.

Hopefully that gives you enough to get started and narrow down the issue to a specific template and area of the file. If you update your question with more detail someone can help you further.

---
Tags: civimember
---


# Question
Title: On the Campaign dashboard I would like to prevent one specific type from being listed
Unfortunately the searchColumns hook is not called by this form. It is a DataTable, but trying to use the stuff that is documented in the DataTable API (like .rows() or rowCreated do not seem to work either?

How can I manipulate a row from this dataTable and who would like to have a go at adding a dataTables chapter to the Developer Guide (or is it already there and am I missing it?)

# Answer
> 1 votes
There lots of screen that uses datatable to retrieve list of results which do not support any hooks to manipulate results or add additional clause or columns. We have altered the ajax request post/get data using jquery to send filters. In some cases it works, like in your case it may work if you want to filter it using campaign type. Here is a small snippet that i would call on the campaign dashboard page

```
{literal}
<script type="text/javascript">
CRM.$(function($) {
  $(document).ajaxSend(function(event, jqxhr, settings) {
    let url = decodeURIComponent(settings.url);
    if (url.indexOf('datatable/called/url') != -1
      && url.indexOf('[otherparameter]') != -1
    ) {
      if (!$('#campaign_type_id').val()) {
        settings.data = settings.url + '&searchCriteria=campaign_type_id&campaign_type_id=' + '1,2,3';
      }
    }
  });
});
</script>
{/literal}

```

The other alternative method is support hooks like selectWhereClause or rewrite whole logic to use api so that it can altered using hook a and submitting PR.

HTH

Pradeep

---
Tags: search-results, datatables
---


# Question
Title: Issue with CK editor <wbr> tag appearing in Token
In the CK editor, when I add a token and look at the source code, the wbr/\> tags appear in the token breaking the token. I have a feeling this crept in after I enabled Smarty for email. Does anyone know what might be causing this and how it can be fixed?

Thanks

# Answer
Try configuring your ck editor as provided here.

Thanks

Pradeep
> 1 votes

---
Tags: tokens, smarty, ckeditor
---


# Question
Title: Where can I see a contributors phone number and email?
On the contribution page, there is space for the visitor to enter their phone number and email (we need this information).

When I look at the contributions made, this information is not view-able or there at all. I tried to go into the management page for the contribution page to edit the settings, although there is nothing I can find to help me solve this issue.

# Answer
If you click on the contact name ie. 'From' on the form shown on your screen shot it will take you to the contact summary page of the contact where you will get to see all the details of the contact stored for it. If you still can't see the details than your user might not have required permission to view contact details
> 2 votes

---
Tags: contribution-page
---


title: Tracking Yard Signs

text:
# Question
Title: Tracking Yard Signs
Just getting started with CiviCRM and got my voter registration list imported and created contacts. Now we are getting requests for political yard signs coming in. What would be easiest way to track this? As tags, group, or create something in CiviCampaign?

James

# Answer
> 4 votes
I would create a new activity type called ' Yard Sign' with associated custom fields. See below for an example:

---
Tags: groups, tags, civicampaign
---


title: Date in english

text:
# Question
Title: Date in english
Hie When we send tax receipt to members the month of the date is in english. What is the solution to have contribution date in french? Regards P. Rolland

# Answer
Go to Administer/Localization/Date Formats
> 2 votes

---
Tags: date-preferences, language
---


# Question
Title: Can you change Added By information via a profile?
5.21.1 D7

Is it possible to change who added an activity/contribution - someone was logged in as someone else and well - its been an internal problem to say the least. I am being asked to change the Added By to the correct person.

Thoughts?

# Answer
I dont think you can add source contact in profile field and do a bulk update. The options i can think of

1. Run sql query to update contact\_id in civicrm\_activity\_contact table for record\_type\_id = source.
2. Or Export the activities you want to update and import them back with adding source contact id column in the csv file.

Thanks

Pradeep
> 1 votes

---
Tags: civicontribute, profile, activities
---


# Question
Title: How to manage AngularJS dependencies within an extension
I'm creating an extension and using AngularJS within it. I've found a 3rd party AngularJS library that I'd like to use in my extension (in this case ngInfiniteScroll). What is the proper way to make my extension depend on this external library (and to ensure that the library is installed when the extension is installed)?

I'm pretty new to AngularJS development and CiviCRM development, so I still don't have a clear understanding of the difference between npm, webpack, bower, yarn, grunt, gulp, and browserify. Mostly I need to be pointed in the right direction.

# Answer
## An approach: composer-downloads-plugin

`civicrm-core` now uses the https://github.com/civicrm/composer-downloads-plugin for Javascript and CSS libraries. You can use the same technique in an extension. For example, suppose you have an extension `civinfinite` with a `composer.json` file which declares:

```
{
  "name": "example/civinfinite",
  "require": {
    "civicrm/composer-downloads-plugin": "~2.1"
  },
  "extra": {
    "downloads": {
      "ngInfiniteScroll": {
        "url": "https://github.com/sroze/ngInfiniteScroll/archive/1.3.4.zip",
        "path": "extern/ngInfiniteScroll",
        "ignore": ["test"]
      }
    }
  }
}

```

The `zip` file will be downloaded and extracted into your extension's folder (under `extern/ngInfiniteScroll`).

For example, suppose that you install `civinfinite` on a Civi-D7 site under:

```
sites/default/civicrm/ext/civinfinite

```

If you run `composer install`, then the assets will be at:

```
sites/default/civicrm/ext/civinfinite/extern/ngInfiniteScroll

```

At runtime, you can determine the URL as:

```
Civi::resources()->getUrl('civinfinite', 'extern/ngInfiniteScroll/src/infinite-scroll.js');

```

Similarly, if you're registering an Angular module for use in Civi (`hook_civirm_angularModules` or `*.ang.php`), then the registration can reference that path:

```
[
  'ext' => 'civinfinite',
  'basePages' => [],
  'js' => ['extern/ngInfiniteScroll/src/infinite-scroll.js'],
];

```

## Critical analysis

There are many different techniques for managing JS/CSS assets in PHP projects -- D7 modules have `libraries`; Backdrop and WordPress modules tend to embed assets within modules; `composer` has various add-ons like `installer-paths`, `asset-packagist`, `composer-npm-bridge`, `composer-asset-plugin`, etc. Each of these has strengths and weaknesses.

I would submit that the relative strength of this technique is that it is easy for both developers and site-builders to reason about the behavior. (*Tangentially, it's also faster than other composer-based techniques because it has no affect on the size of the dependency graph. But the main purpose is to make it easier to reason.*)

For example: Consider that there are different ways in which people may deploy an extension:

* One may download an extension as a `*.zip` file with all assets bundled in. (This is what happens when using the in-app extension UI or `cv dl` or `Extension` API.) One may not be running `composer` at all.
* One may clone the extension's git repo and run `composer install`.
* One may have a `composer.json` in a site-root (and some open-ended mix of dependencies, plugins, configuration options), and then you add the extension as a dependency.

As a developer, it's hard to predict which mix of techniques are being used by downstream site-builders. In the `composer-downloads-plugin` approach, you can rely on the JS/CSS assets *always* being in the same place (*relative to your code*).

As a site-builder, this approach does not require you to add (or change/update) any "repositories" or "plugins" or configuration-options in a composer root-project. You don't even need to have a composer root-project. (*You probably should for other reasons... but the extension and its assets aren't going to force you into it.*) If a developer changes some small detail of the assets in their package, then it's not your concern.

This approach complies with a simple, pre-existing contract:

* The developer decides what code goes inside their extension.
* The site-builder decides which extensions to get - and where to put them.

A developer is free to use `composer-downloads-plugin` without requiring any changes to that basic contract.
> 1 votes

---
Tags: developer, angular
---


# Question
Title: How to search for contacts by date added or date range added. Alternately: list contacts by date added
How to search for contacts by date added or date range added. Alternately: list contacts by date

# Answer
Under Search - Custom Searches - Date Added to CiviCRM.

Also a variation is under Search - Advanced Search, and expand the Change Log tab.
> 8 votes

---
Tags: search, custom-search, advanced-search
---


title: Weird error 500

text:
# Question
Title: Weird error 500
I'm new to CiviCRM, so please bear with me. I inherited a functioning site with a CiviCRM install (on Wordpress) that was working properly. They asked me to change the domain in use, and after I attempted and failed to make that work I set everything (or at least I thought I got everything) back to how it was on the original domain. I thought everything was working fine, but now certain pages from with CiviCRM fail to load, but most work fine. I tried a bunch of different items in the header bar, but the following fail with an error 500:

Draft and Unscheduled Mailings Scheduled and Sent Mailings

I checked the http access.log file and I didn't see anything relevant other than the reported 500 error. Any idea how to diagnose and fix this?

Thanks!

# Answer
> 3 votes
It appears to be a civicrm version 4.7 bug. I have no idea why it didn't crop up before, the site was like that for years. The solution, as recommended by folks in the chat, was to update to the latest release. The is fully up to date now and working as expected.

---
Tags: error
---


title: Using Views with two sql servers

text:
# Question
Title: Using Views with two sql servers
I am trying to set up Views on my CiviCRM 4.7.10 (Drupal 7.42). My Drupal database is on one SQL server. And my CiviCRM database is on another SQL server. Whenever I try to create a new view, I encounter the following message: SQLSTATE\[42000\]: Syntax error or access violation: 1142 SELECT command denied to user 'xxxxx'@'xxxxxx' for table 'civicrm\_contact' After looking intensively through the documentation, I cannot manage to find the right changes so that Views can connect to the correct SQL server. I have tried changing the file settings.php, but with no success. Could someone kindly tell me what to do so that Views connects correctly to the SQL server where the CiviCRM is? Thanks a lot.

# Answer
> 0 votes
From the manual: 1. If you have different database users for your CiviCRM and Drupal databases, then you need to grant SELECT access for the Drupal user to all the CiviCRM tables.

---
Tags: database, drupal-views, webserver
---


# Question
Title: linking email subsciptions to WordPress blogs to CiviCRM
I am adding a blog to the WordPress site on which I am running CiviCRM. I want to include an email subscription to the blog. Ideally I'd like to link this subscription to the CiviCRM contact (for example: so that I can send subscribers extra emails or that I can send invitations to the blog to non subscribing members)

I have found a couple of solutions to the blog subscription (JetPack and Mailchimp) but neither link with the WordPress users or CiviCRM contacts.

I may well be able to use the Mailchimp CivCRM Integration plugin to link it all up, but I'd still rather avoid using Mailchimp because of the cost if the blog really takes off and I don't need any of the other functionality.

How to automatically create mailings from an RSS feed looks to have some of the functionality, but would still need development beyond my capabilities and I'm not sure its active.

Has anyone found any good solutions to this?

# Answer
I'm not sure if this would work with Wordpress but you could do something like: https://civicrm.org/extensions/content-tokens to pull in the content combined with https://civicrm.org/extensions/scheduled-communication to automatically schedule the mailings.
> 1 votes

---
Tags: wordpress
---


# Question
Title: Conversion tracking with Google Ads on Thank-you pages
My organisation got accepted for the Google Ads Grant. There are several benefits that we can only unlock if we are able to set up conversion tracking. I am trying to get my head around how this would work with civicrm and have not had much luck with an online search.

I'm trying to understand how one would set up the tracking code on the thank you pages since civicrm's thank you pages are automatically and dynamically generated. I'm therefore not sure where one would place the conversion tracking code.

Has anyone here worked out how to achieve conversion tracking with Civicrm?

Ideally the solution would allow us to easily change the tracking code so we can have the conversion of the specific thank you pages match the specific ad. Is there a way to put the tracking code into the Introductory Text or the Footer Text of the Thank-you screen within civicrm events for example?

sorry for the many questions. Just slowly chipping away at features on our wishlist and coming across questions as we tackle them.

Thanks for help here, it has been really appreciated.

# Answer
We are doing this exact thing at the moment. I was kindly given some code that sends events to GA and Facebook pixel on the Thank You page by @jtwyman on Mattermost. A Civi developer worked with us on it to build an extension - and evolved it slightly to respect DO NOT TRACK.

We haven't got it working 100% yet. We have an issue that completed donation £values are not being sent back to GA (membership values are being sent correctly). It's in our Github repo but private at the moment until the issue is fixed, but happy to make public and share when it's working correctly.

I'm not sure how others are handling this.

EDIT: After Googling, I found that Matt Wire released an extension at the same time we had ours developed:

https://civicrm.org/extensions/google-analytics-event-and-e-commerce-tracking

I've raised an issue asking to have our Facebook Pixel and DNT features added so that we can just star using that rather than maintaing our own:

https://lab.civicrm.org/extensions/webtracking/issues/2
> 4 votes

# Answer
It might not work in this case but in case someone is trying for a temporary fix:

Civicrm displays pages using templates. By identifying the template file you can create a file and directory structure that mimics the template used to display the part of civicrm original/path/OriginalTemplate.extra.tpl - but add .extra. into the filename. Civicrm will insert this into the page as per https://civicrm.org/blog/dave-greenberg/now-its-easier-add-custom-behaviors-templates

So for this case you'd need to in an extension or via a custom templates - set the path via Admin-\>System Settings -\> Directories.

Create a file at the following path: custom\_templates\_folder/CRM/Event/Form/Registration/ThankYou.extra.tpl templates/CRM/Event/Form/Registration/ThankYou.extra.tpl

Then add in the html required. You'll want to wrap everything between {literal}{/literal} tags - i.e.

```
{literal}
  <script type="text/javascript">
     Tracking js code here.
  </script>
{/literal}

```

This will insert it onto every Event registration page. If you need different codes/tracking for different pages then there is a way to do this by creating a folder with the relevant id -\> Form/Registration/2/ThankYou.extra.tpl.

However as you can identify this is not an ideal solution if the person generating and updating codes does not have easy access to upload files to your server.
> 3 votes

---
Tags: civievent, civicontribute, tracked-links
---


# Question
Title: How to trouble-shoot 'critical error' while merging duplicates?
Using civicrm-5.21.2-wordpress.zip, (and also 5.20), I get a 'crash' ('There has been a critical error on your website. Please check your site admin email inbox for instructions.') for any attempt to merge contacts.

None of the WordPress trouble-shooting info has helped. I don't get any CiviCRM trace-back or debugging data. I don't see anything in the Apache error.log .

Any other suggestions for trouble-shooting this?

# Answer
I'll dig deeper in another post, but as far as this problem was concerned, I used print and var\_dump to trace the problem to

```
public static function getReferencesToTable
.
.
.
$links = $daoClassName::getReferenceColumns();

```

'crashes' because one of the classes was NULL.

While I work on WHY, I got around the crash with a simple:

```
if ( $daoClassName != NULL)

```

wrapper.
> 0 votes

---
Tags: duplicate-contacts
---


title: CiviCRM_API3_Exception

text:
# Question
Title: CiviCRM_API3_Exception
When I enable or disable an extension I get the error that follows. Enabling or disabling still happens. Advice on resolving this would be gratefully received. This site is running 5.21.2 on Joomla.

```
> CiviCRM_API3_Exception: "API error: Value already exists in the
> database"
>
> #0 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Admin/Form/Extensions.php(178):
> civicrm_api3("Extension", "enable", (Array:2))
> #1 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(479):
> CRM_Admin_Form_Extensions->postProcess()
> #2 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/StateMachine.php(144):
> CRM_Core_Form->mainProcess()
> #3 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(45):
> CRM_Core_StateMachine->perform(Object(CRM_Admin_Form_Extensions),
> "next", "Next")
> #4 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203):
> CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Admin_Form_Extensions),
> "next")
> #5 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103):
> HTML_QuickForm_Controller->handle(Object(CRM_Admin_Form_Extensions),
> "next")
> #6 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(335):
> HTML_QuickForm_Page->handle("next")
> #7 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Page/Basic.php(395):
> CRM_Core_Controller->run()
> #8 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Page/Basic.php(140):
> CRM_Core_Page_Basic->edit(32, NULL)
> #9 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Admin/Page/Extensions.php(105):
> CRM_Core_Page_Basic->run()
> #10 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(268):
> CRM_Admin_Page_Extensions->run((Array:3), NULL)
> #11 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(68):
> CRM_Core_Invoke::runItem((Array:16))
> #12 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(36):
> CRM_Core_Invoke::_invoke((Array:3))
> #13 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm.php(121):
> CRM_Core_Invoke::invoke((Array:3))
> #14 /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm.php(40):
> civicrm_invoke()
> #15 /var/www/clients/client3/web4/web/libraries/src/Component/ComponentHelper.php(402):
> require_once("/var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicr...")
> #16 /var/www/clients/client3/web4/web/libraries/src/Component/ComponentHelper.php(377):
> Joomla\CMS\Component\ComponentHelper::executeComponent("/var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicr...")
> #17 /var/www/clients/client3/web4/web/libraries/src/Application/AdministratorApplication.php(101):
> Joomla\CMS\Component\ComponentHelper::renderComponent("com_civicrm")
> #18 /var/www/clients/client3/web4/web/libraries/src/Application/AdministratorApplication.php(159):
> Joomla\CMS\Application\AdministratorApplication->dispatch()
> #19 /var/www/clients/client3/web4/web/libraries/src/Application/CMSApplication.php(196):
> Joomla\CMS\Application\AdministratorApplication->doExecute()
> #20 /var/www/clients/client3/web4/web/administrator/index.php(51): Joomla\CMS\Application\CMSApplication->execute()
> #21 {main}  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. API error: Value already exists in the
> database Return to home page.

```

# Answer
Are you using CiviCase and do you have a different language than English for you CiviCRM? If so, you might suffer from a bug that has to do with the relationships for the cases. The easiest fix then is to disable the "standard" case types that are shipped with core?
> 0 votes

---
Tags: extension, error, database
---


# Question
Title: Member's only pages in wordpress, for users with a related membership
We have a site Wordpress which offers corporate membership, and this extends by relationship to employees.

The client is having issues where users are booking onto events, after the corporate membership has elapsed.

I've had a quick look at the Wordpress Civi Member plug in, to start creating a member's only section of the site. My main question is:

Can the plug in handle users with related memberships, or does it work best with primary memberships?

And... has anyone got experience of configuring this type of set up? Are there any pitfalls I should be aware of?

Cheers

Craig

# Answer
> 1 votes
CiviCRM WordPress Member Sync functions similarly to CiviMember Role sync. It provides UI to add association rule to sync membership type with wp role. There is no special setting available for this plugin to include only primary or secondary member. There is a setting when to remove from role.

Add association Member sync rule in your site for the membership type and based on wp roles design your membership section or forms.

Thanks

Pradeep

---
Tags: wordpress, civimember
---


# Question
Title: Report: Records that have been updated by owner
Is there a way to go through and create a report (either in Civi or using Drupal Views) that shows what records have been updated by the owner themselves? Such as them going in and updating an employer or address?

# Answer
> 1 votes
There is no such report that filters by logged in user and no integration with views as well AFAIK.

If you want detailed change log than you (system has logging enabled) then you can use Extended logging report. And manipulate report parameter like

```
/civicrm/report/contact/extendedloggingsummary?reset=1&force=1&display_name_value=abc&display_name_op=has

```

Inbuild report

```
/civicrm/report/logging/contact/summary?force=1&reset=1&display_name_value=abc&display_name_id_op=has

```

If you don't have logging enabled than you can use Database log report and build report parameter

```
/civicrm/report/contact/log?reset=1&force=1&sort_name_value=abc&sort_name_op=has

```

If you want to support filtering by logged in user in one of the two above report than you add filter using selectWhereClause or alterReportVar hook.

Support to views won't be difficult by writing an module extending to civicrm entity module. If you can extend views module to support change log than you can filter or retrieve various data of the contact.

Thanks

Pradeep

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


# Question
Title: Contacts unexpectidly added to Mailing Groups (by Admin)
I'm using CiviCRM with Wordpress and have around 1500 contacts.

I have 3 groups with around 120 contacts in each group which I use for mailings.

I sent a bulk email to one of the groups then around 10 minutes later all 3 groups had 550 contacts in them.

When I look in the Groups tab of one of the newly added contacts I can see that they were added to all 3 groups at the same time and says "Added (by Admin)".

Has anyone come across this before or have any idea why it might have happened?

Is there a way to find contacts based on date added to a group so I can search for them and remove them from the groups?

Thanks

# Answer
> 2 votes
From UI i don't think there is any way you can get history of contact being added to group. If you have hands of experience in writing sql statements than you can use `civicrm_subscription_history` table in Civicrm to track down about all history of contact added to group by dates.

---
Tags: groups
---


title: Upgrade fails: 5.17.5 to 5.21.12

text:
# Question
Title: Upgrade fails: 5.17.5 to 5.21.12
We're upgrading from 5.17.5 to 5.21.12 and it fails partway through. Here's what we get:

```
[Error: Re-Create Foreign key between civicrm_dashboard and civicrm_domain correctly]
ERROR FIELD ERROR VALUE
Type    DB_Error
Code    -3
Message DB Error: constraint violation
Mode    16
UserInfo    ALTER TABLE civicrm_dashboard ADD CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY ( `domain_id` ) REFERENCES civicrm_domain ( id ) ON DELETE CASCADE [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`username_civicrm`.`#sql-2966_c5af6`, CONSTRAINT `FK_civicrm_dashboard_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE)]
DebugInfo   ALTER TABLE civicrm_dashboard ADD CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY ( `domain_id` ) REFERENCES civicrm_domain ( id ) ON DELETE CASCADE [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`username_civicrm`.`#sql-2966_c5af6`, CONSTRAINT `FK_civicrm_dashboard_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE)]

PEAR_Exception: DB Error: constraint violation in /home/username/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
- DB_Error: DB Error: constraint violation in unknown on line unknown
Exception trace

No. Function Location

0   CRM_Core_Error::exceptionHandler(Object(DB_Error))  /home/username/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922

1   PEAR_Error->__construct('DB Error: constr…', -3, 16, Array, 'ALTER TABLE civi…')    /home/username/public_html/sites/all/modules/civicrm/packages/DB.php:987

2   DB_Error->__construct(-3, 16, Array, 'ALTER TABLE civi…')   /home/username/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575

3   PEAR->_raiseError(Object(DB_mysqli), null, -3, 16, Array, 'ALTER TABLE civi…', 'DB_Error', true)    /home/username/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223

4   PEAR->__call('raiseError', Array)   /home/username/public_html/sites/all/modules/civicrm/packages/DB/common.php:1920

5   DB_common->raiseError(-3, null, null, 'ALTER TABLE civi…', '1452 ** Cannot a…') /home/username/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php:933

6   DB_mysqli->mysqliRaiseError()   /home/username/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php:403

7   DB_mysqli->simpleQuery('ALTER TABLE civi…') /home/username/public_html/sites/all/modules/civicrm/packages/DB/common.php:1229

8   DB_common->query('ALTER TABLE civi…')   /home/username/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php:2416

9   DB_DataObject->_query('ALTER TABLE civi…')  /home/username/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php:1607

10  DB_DataObject->query('ALTER TABLE civi…')   /home/username/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php:420

11  CRM_Core_DAO->query('ALTER TABLE civi…', false) /home/username/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php:1419

12  CRM_Core_DAO::executeQuery('ALTER TABLE civi…', Array, true, null, false, false)    /home/username/public_html/sites/all/modules/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php:113

13  CRM_Upgrade_Incremental_php_FiveEighteen::recreateDashboardFK(Object(CRM_Queue_TaskContext))    /home/username/public_html/sites/all/modules/civicrm/CRM/Queue/Task.php:72

14  CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))  /home/username/public_html/sites/all/modules/civicrm/CRM/Queue/Runner.php:201

15  CRM_Queue_Runner->runNext(true) /home/username/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php:36

16  CRM_Queue_Page_AJAX::{closure}()    /home/username/public_html/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php:90

17  CRM_Queue_ErrorPolicy->call(Object(Closure))    /home/username/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php:38

18  CRM_Queue_Page_AJAX::runNext()  /home/username/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:234

19  CRM_Core_Invoke::runItem(Array) /home/username/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:68

20  CRM_Core_Invoke::_invoke(Array) /home/username/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:36

21  CRM_Core_Invoke::invoke(Array)  /home/username/public_html/sites/all/modules/civicrm/drupal/civicrm.module:456

22  civicrm_invoke('upgrade', 'queue', 'ajax', 'runNext')   /home/username/public_html/includes/menu.inc:527

23  menu_execute_active_handler()   /home/username/public_html/index.php:21

24  {main}

```

# Answer
> 4 votes
You might have some leftover entries in civicrm\_dashboard that point to a different domain id that no longer exists. It should be safe to delete those rows. i.e. the ones that have a domain\_id that doesn't match an id in civicrm\_domain.

# Answer
> 1 votes
As said by @demerit its because civicrm\_dashboard has some orphan data. You can get rid of it by deleting the entries from the table as it won't be used anywhere. You can run below query after taking backup of database to get rid of cruft records.

```
DELETE cd FROM civicrm_dashboard cd
LEFT JOIN civicrm_domain cdm ON cdm.id = cd.domain_id
WHERE cdm.id IS NULL;

```

---
Tags: upgrade
---


# Question
Title: Listing only some event types with CiviEvent Widget
we are using the CiviEvent Widget, I’m struggling to figure out how to display a list of event ids, but not others using shortcode. I would like for example to list events of id 9,10,11 exclusively. I've tried seperating the id's by coma, semi-colon etc... but have had no success, it usually just displays the first id number i list.

Thanks for your help

# Answer
> 1 votes
The document says you add custom filters on shortcode

try adding

```
[civievent_widget custom_filter='{"start_date":{"IS NOT NULL":1},"id":{"IN":[9,10,11]},"is_public":1,"options":{"sort": "start_date ASC"}}' admin_type="custom" custom_display='{"event_title_infolink":{"title":0,"prefix":null,"suffix":null,"wrapper":1},"description":{"title":1,"prefix":null,"suffix":null,"wrapper":1}}' limit=5]

```

Also you will need to amend the patch below to decode html entities

```
diff --git a/civievent-widget.php b/civievent-widget.php
index e973ce0..c3c2da4 100644
--- a/civievent-widget.php
+++ b/civievent-widget.php
@@ -223,7 +223,7 @@ class civievent_Widget extends WP_Widget {
                                $standardDisplay = true;
                        } else {
                                // Get custom filters.
-                               $customFilters = json_decode( CRM_Utils_Array::value( 'custom_filter', $instance, '' ), true );
+                               $customFilters = json_decode(html_entity_decode(CRM_Utils_Array::value( 'custom_filter', $instance, '' )), true );
                                $filterParams = array(
                                        'start_date' => array( '>=' => date( 'Y-m-d' ) ),
                                        'is_public' => 1,

```

---
Tags: civievent, widget
---


# Question
Title: Drupal views, show 'add to cart' button instead of ''Register now'
I would like show 'add to cart' button instead of ''Register now' for a drupal views I have created for upcoming events, is it possible?

# Answer
Yes, you can rewrite the register now link to or add custom text field with rewrite link as

```
https://domain.org/civicrm/event/add_to_cart?reset=1&id=[event_id]

```

to remove from cart

```
https://domain.org/civicrm/event/remove_from_cart?reset=1&id=[event_id]

```

Thanks

Pradeep
> 2 votes

---
Tags: civievent
---


# Question
Title: How to create a Drupal menu link to a civicrm contact profile
I would like to create a drupal menu link for a logged in user. I have added `civicrm/contact/view`, which seems to only work when the contact profile was viewed once. Otherwise keep getting message `We could not find a contact id`. Can anyone have a quick solution please?

# Answer
> 3 votes
You can use Menu token module and Civicrm token module to create link in drupal module.

```
civicrm/contact/view?cid=[civi:contact_ID]&reset=1

```

Thanks

Pradeep

---
Tags: contacts, checksum, contact-view
---


# Question
Title: Why would CRM_Utils_Hook::entityTypes($entityTypes) return results with a non-civicrm table?
I've traced a crash in dedupe to a NULL entity. I've worked around that, but I should figure out why the entity is NULL. I've gotten as far as CRM\_Utils\_Hook::entityTypes($entityTypes)

it's return value seems to refer to a TEAM table that doesn't exist in CiviCRM. I may have created such a table in the same DB months ago, but I don't think it ever followed a naming convention that would have 'fooled' CiviCRM into categorizing it as a core table.

I plan to keep digging, but now seems like a good time to ask for advice. Anyone seen anything like this before?

# Answer
You might have extension or module that implements entityTypes() hook. Try grepping TEAM inside your module or extension directory, if found either remove the code if its implemented in entityType hook or disable the extension or module if not in use
> 1 votes

---
Tags: core
---


# Question
Title: Prevent users from changing membership type when they renew?
Does anyone know an easy way to prevent users from changing membership type when they renew via the renewal page?

Thanks in advance!

# Answer
Does your membership renewal page show multiple membership-type options?

You may need to set up different membership renewal pages for different membership type.
> 4 votes

---
Tags: civimember, renewals
---


title: Scheduled emails failing - HELP

text:
# Question
Title: Scheduled emails failing - HELP
Configuration: MacOS, MAMP, Wordpress, CiviCRM Individual mail works fine. Messages show up in log. Minimal test config with users and groups marked as not-hold and bulk mail. Users in groups are the same as the ones that work for individual mail.

System cron set and working. Mailing job being executed manually (for now).

Debugging and logging are turned on.

I use New Mailing to create a new mailing job. Recipient group shows members (the same one used for individual mail). Sending to single recipient shows completion with no errors and no log messages. Sending to group shows the same. Following through to schedule the message shows success. Manual triggering of job show success. Job log shows:

2020-02-03 11:31:09 Send Scheduled Mailings Entity: job Action: process\_mailing Summary Finished execution of Send Scheduled Mailings with result: Success (a:1:{s:9:"processed";i:2;}) Details

Parameters parsed (and passed to API method): a:1:{s:7:"version";i:3;}

Full message: Finished execution of Send Scheduled Mailings with result: Success (a:1:{s:9:"processed";i:2;})

Nothing is in the CiviCRM..log

Any suggestions or help would be much appreciated.

# Answer
Lots of digging here: The culprit is Bluehost shared hosting *AND* VERP (variable envelope return processing), which is an interesting hack and very useful for massive systems. (I am a colleague of Ray Tomlinson and something of a dinosaur when it comes to email protocols ...)

Bluehost is my shared hosting provider (no VERP) and VERP is - well, a hack. VERP *SHOULD* be handled with extra header settings but is done as a sender NAME which violates all kinds of identity-based authentication protections - but then I'm a security expert and so I do have opinions.

Technical answer: Bluehost (and most others) do not support VERP unless you pay for a VPS or better plan.

CiviCRM - being intended for big players - requires VERP to handle bounces and other issues when dealing with large mailing lists. (Kudos to CiviCRM)

My 501(c)3 is neither a big player (fewer than 20 recipients) nor willing to pay for a VPS (because we're small ...) and not willing to pay for a for-profit CRM (because we're small).

The answer for people in a similar situation to me is to edit out a portion of smtp.php (in the civicrm folder) and comment out:

```
/*if (!empty($headers['Return-Path'])) {
        $from = $headers['Return-Path'];
    }*/

```

smtp.php = (cd civicrm folder; exec find . -name smtp.php -a -print;)

The CiviCRM people (bless them for their efforts !) will rightfully claim that my, and other's, 'solution' is a hack (VERP is a hack too, but useful ...) that should be deprecated with excessive force, but they should also allow the ability for us small folks who have \*NO OTHER FREE AND OPEN SOURCE SOLUTIONS\* an option as part of the configuration.

Love an kisses ...
> 1 votes

---
Tags: mailing
---


# Question
Title: What's the difference between Job Title and employer relationship description?
The "Current Employer" field seems to be a helper for entering a "Employee of" relationship. Fair enough (although presumably designed back in the good ol' days when the majority of people only had one job).

But the Job Title - which presumably relates to the "Current Employer" does not seem linked to the "Description" field of the "Employee of" relationship; it seems to be a separate field?

Does anyone know how these parts are expected to interact?

# Answer
> 3 votes
Afaik, there is no connection between the "Current Employer" field and the "Job Title" field.

If you select a contact in the "Current Employer" Field it will also create a relationship AND disable an existing "employer relationship" which is marked as "current employer".

If you create a "employer relationship" you will have a little checkbox that says "current employer". If you tick it, it will also fill the "Current Employer" field and uncheck "current employer" with the existing "employer relationship" (but not disable it).

By the way, if you share an address you also have the option to "Set this organization as current employer" - which effects I do not know from the top of my head.

All this "UI magic" has been introduced / revised a while ago and has confused me plenty. It can also be quite complicated when you try to use the API (e.g. for imports) as the "current employer" attribute is not availbale there (at least to my limited knowledge).

Hope this helps a little bit.

---
Tags: contacts
---


# Question
Title: WordPress: Creating new WP Users from CiViCRM Contacts
My situation is I have an Individual database of 11,344 Contacts in Drupal Civi, and I want to turn them all into WP Users. I know I can convert Users into Contacts, but I want to do it the other way around. I have pointed my WordPress CiViCRM to a drupal Civi database which I need very much. I want the CiViCRM members to show under WordPress users but this isn't working. I have downloaded the plugin CiviCRM WordPress Profile Sync; but I can see the plugin on button on my dashboard to even try something. Can you please help me? I really need this issue solved. Thank you

# Answer
How i would do is

1. Export contacts with email address that want to be user.
2. Install Wordpress export/import user plugin.
3. Change the un-supervised dedupe rule to have only email address
4. Import users via Wordpress screen using exported csv from CiviCRM
5. Switch back un-supervised dedupe rule

Thanks

Pradeep
> 1 votes

---
Tags: wordpress, profile, civicrm-contact, sync
---


# Question
Title: Import donations from an external source using Form processor
We have a customised platform where we have been receiving donations before moving to CiviCRM. This platform will continue to be in use.

We would like to import all the donations and the contract data automatically on civicrm whenever it’s submitted. We would also like to send a receipt from civicrm whenever a donation submitted.

I have had a look at “Form Processor” extension and seems to be a viable option for our need. Is it possible to use for importing contribution? What is the risk of importing data this way? Any security concerns? Has anyone used Form processor for this kind of use case? Any tips would be much appreciated. Thanks

# Answer
> 2 votes
We use the Form Processor at a few of our clients for scenario' s like yours. In most cases we use this in a configuration with CiviCRM on another server and outside traffic (including the Form Processor API request) coming in through CiviProxy (https://docs.civicrm.org/civiproxy/en/latest/).

For this we use the CiviMRF framework (https://github.com/CiviMRF/cmrf\_core).

# Answer
> 1 votes
As I understand your question you want to import existing data with the form processor. Is that right?

If so it is possible because the form processor creates an API in CiviCRM and this API can be called with REST from external systems.

The API entity is FormProcessor and the action is the name of your form processor.

You need some bit of custom development which is the collection of the existing data and sending it to the CiviCRM api and that is where the CiviMRF framework comes into place.

---
Tags: contacts, contributions, import, data-import
---


# Question
Title: Setting USPS and recaptcha overrides breaks site
I've successfully set several overrides in civicrm.setting.php according to https://docs.civicrm.org/sysadmin/en/latest/customize/settings/. However, both Recatpcha and the USPS Address standardization tool break the site. Setting USPS provider line does work.

I'm doing this on a WP multisite on CiviCRM 5.20.0.

```
// Set USPS standardization
$civicrm_setting['CiviCRM Preferences']['address_standardization_provider'] = USPS;
$civicrm_setting['CiviCRM Preferences']['address_standardization_userid'] = ***;
$civicrm_setting['CiviCRM Preferences']['address_standardization_url'] = 'http://production.shippingapis.com/shippingapi.dll';

// Misc
$civicrm_setting['CiviCRM Preferences']['recaptchaPublicKey'] = ***;
$civicrm_setting['CiviCRM Preferences']['recaptchaPrivateKey'] =***;

```

# Answer
> 1 votes
My syntax was wrong I needed to use tick marks around the values.

---
Tags: civicrm.settings.php
---


# Question
Title: IMAP authentication error with Smartermail
So, I've spent the last few days running this issue down, and I actually have a solution (or a workaround?), but I just wanted to ask if it's really the best way to handle the situation.

I'm running CiviCRM 5.21.0 on Joomla 3.9.15 and was looking at bounce processing and the Fuzion Transactional Email extension. I was setting up an IMAP account to handle the bounces, but every time I ran the fetch\_bounces scheduled job, it would come back with "The IMAP server did not accept the username and/or password". Well, I know the username and password are correct.

Long story short(er), my mail server (I host in-house), Smartermail 14.7, does the same thing that GMail does - instead of an immediate "OK LOGIN completed" response, it gives the "\* CAPABILITY" line first.

I couldn't find anywhere in the code where it might dynamically figure out that the server is a gmail server, so I just changed the $serverType on line 331 of /administrator/components/com\_civicrm/vendor/zetacomponents/mail/src/transports/imap/imap\_transport.php from null to self::SERVER\_GIMAP, and now the authentication error is gone.

Is this the best way to do this, or is there a better way? I'm guessing that any time I update CiviCRM, I'm going to have to re-do this change.

# Answer
> 1 votes
I think the best approach would be to file an issue at https://github.com/zetacomponents/Mail/issues. It should be addressed in the mail library. There's a comment in the code near that line you changed where they have foreseen that there's this possible todo for other servers.

CiviCRM does support patching the library and does currently do that for something else, so it could be done on the CiviCRM side, but this one seems more appropriate to do in the library itself.

---
Tags: civimail, joomla
---


# Question
Title: Different payment processors for different price fields?
Is it possible to specify different payment processors for different price fields in a price set on a single contribution page?

I have a contribution page with two prices: £A for EFT, and £B for Direct Debit. £A is more expensive than £B to incentivize Direct Debit.

Direct Debit is chosen by the user selecting the Direct Debit price field, £B, selecting the pay later option, and then the user is directed to the DD form which they fill in and send.

However, a user can select price field £B and then select Credit/Debit Cards, thus paying the cheaper £B price.

I've found the extension 'Direct Debit for Membership Extras' (https://civicrm.org/extensions/direct-debit-for-membership-extras), but after testing with it, it still doesn't solve the issue of a user being able to choose the price field without limiting the choice of payment processor. Is this possible? The only workaround I can think of is to have two separate contribution pages, one for EFT price and one for DD price.

I've found some old posts (Fee based on payment processor, Adding a dynamic “cover processing fees” checkbox to CiviCRM contribution form, and https://forum.civicrm.org/index.php?topic=33098.0) but I'm hoping there exists a more recent extension to solve this issue.

# Answer
> 1 votes
Probably not the best solution however you can give the user the option for either payment method on the contribution page.

Then utilise JavaScript to automatically react and select the correct payment method.

This is assuming is a small difference and you don't need it to be 100% secure etc. etc.

# Answer
> 1 votes
We have an extension that adds on a percent and an option fixed amount to any payment via Credit Card - so in theory this may achieve what you are after but via a different method

https://github.com/fuzionnz/nz.co.fuzion.extrafee

---
Tags: civicontribute
---


# Question
Title: outgoing sms activity link to provider when using multiple providers?
I'm testing out multiple sms providers, and I'm using the api to do reads for reporting on the back end, but I can't seem to figure out how the system knows which sms provider sent a particular sms. The Activity table doesn't seem to have provider\_id reference of any kind unless I'm missing it. Is it in an attached table or something? I can't find a list of providers either. Is that in the database?

# Answer
> 1 votes
From the db schema https://doc.symbiotic.coop/dev/civicrm/latest/schema/tables/civicrm\_sms\_provider.html

It looks like you might be after the sms\_provider\_id from the civicrm\_mailing table, or sms\_provider\_id from the civicrm\_action\_schedule table.

---
Tags: api, database, sms, civisms
---


# Question
Title: Assign all contacts created by a user to one group automatically?
Just what it says in the title. I have an issue with ACL where the user that has access to only one group creates a New Individual (through civicrm) winch then they do not have the access to.

My thinking was to create a rule where upon adding a Contact it gets added to a group of my choosing, with the condition that the contact was created by a specific user. That condition doesn't exist in CiviRules, as far as I can tell.

EDIT To make it clear. A user, when creating a contact, can assign the contact to the group they have access to, but this isn't user friendly and feels burdensome. Isn't there an automated way to do this?

# Answer
> 4 votes
As per Erik's suggestion I created a new condition. It will be included in the next version of civirules (2.12). If you would like to get it before the official release of the new version you can always get it from the civirules repo https://lab.civicrm.org/extensions/civirules .

The new condition is called "Contact added by Contact (not) in Group(s)" and it lets you ask if the contact was made by someone in the specified group. My original question was about the specific contact, but the group implementation makes more sense and works better for the ACL functionality which was missing.

# Answer
> 3 votes
You are correct that there is currently no condition to check if a contact was added by a specific user. It would not be too much work (estimate about 2 hours) to add that condition to CiviRules. It would be nice if you would be able to do this, alternatively if you would be happy to fund this drop me a mail (erik.hommel@civicoop.org).

# Answer
> 1 votes
A workaround for the unavailable condition could be that the user adds a tag to a contact they add. This tag could then be the triggering condition for the Rule to add that contact to the specified group.

# Answer
> 1 votes
We are having the same issue and our dirty workaround to prevent errors was to create a tiny extension that adds a formrule. The rule is checking if a group has been selected when an unprivileged user modifies a contact, but only works for the regular contact form.

---
Tags: groups, acl, civirules
---


# Question
Title: Anyone want to try programming an extension for the world's easiest sms provider?
I would really like to have an extension for the NowSMS provider, and I've been through the documentation and creating an extension with civix, but there is just too much of it that is over my head. Would someone please consider creating one?

In my opinion, NowSMS has the easiest API of all the providers since there is no security or encryption of any kind. It's literally just http in and out with 3 variables, the two phone numbers and the message body.

You don't even need a working NowSMS installation to test it. You can use a browser and a small .htm file and a php script that can receive http get variables. As long as it uses http get and supports the three variables, it will work.

Ideally it would support a customizable url, and the attributes block would include the phone number, like any of the other providers.

For a bit of background, NowSMS runs through a cellphone instead of over the internet, so your only bill is to pay the phone bill. At $30 USD for the phone, the tipping point is 4000 texts per month, where NowSMS becomes more cost effective than Twilio.

Another cool feature is that NowSMS runs an app on Android phone, meaning you can use the cell phone as a cell phone, and then you can log into civicrm and send a bulk message, and you'll see it in the phone's text message app. When people reply, the message will be received by the phone's message app as normal, and it will also be copied and received by civicrm. Someone can be using the phone while someone else is using civicrm to send through the phone in the background.

So how about it, anyone interested in releasing a really easy extension?

# Answer
> 1 votes
Looking at the api it seems to be very simple one to implement. You can do it by using reference from https://github.com/osseed/com.osseed.sms.mysmsmantra

---
Tags: extension, sms, civisms
---


# Question
Title: Rebuild Drupal Civi from scratch in WordPress
My situation is I have an Individual database of 11,344 Contacts in Drupal Civi, and I want to turn them all into WP Users. I know I can convert Users into Contacts, but I want to do it the other way around. I have pointed my WordPress CiViCRM to a drupal Civi database which I need very much. I used CiviCRM WordPress Profile Sync plugin to sync CiViCRM users to WordPress users. My request now is that I want to be able to build the old CiviCRM system by importing the data step by step. The reason I want to do that is as I was trying to create a new paid event and set the fees; the fee settings refuses to save and I tried it over and over. If the fee is not saved, registration doesn’t work. The system has been there for a couple of years now.
Mysql contact table is showing 17000 rows whilst contacts in CiviCRM is showing about 11344 contacts, I'm wondering which one to import. The is a difference between the mysql contact table and CiViCRM contacts there. I want to be able to import everything without loosing any data. I'm planning on copying the mysql contat table of Drupal straight to my new Wordpress Civicrm database. Is that a good idea? Can you please help me?

# Answer
Importing contact and its details involves more efforts unless you don't want historical data of the contact like contribution, event registration, activity etc. Would suggest to use the same database for your wordpress and clear CiviCRM cache.

The menu items position may differ based on how old is your CiviCRM compared to newly fresh installed CiviCRM but you can update the position through UI if you want to move to some where else or hide it.

There is a good post that may help you to migrate from drupal to wp. Moving from Drupal to Wordpress
> 1 votes

# Answer
It seems your main reason for rebuilding from scratch is a problem with event fees. As Pradeep says, trying to import all your history is a lot of effort. You are probably better debugging the events problem, or getting someone else to debug it for you.
> 0 votes

---
Tags: wordpress, drupal, contacts, database, import
---


title: Inline styles in Mosaico

text:
# Question
Title: Inline styles in Mosaico
Is it possible to use inline css in Mosaico? I tried it, but it was taken out. It works in Civimail. Thanks. I have been trying to get this working for a while.

# Answer
> 2 votes
I can add inline styles by opening the source code of any text in a block and add in HTML tags with style="" and it works. Are you trying something else? or have I misunderstood your question?

---
Tags: mosaico
---


title: Survey v petition

text:
# Question
Title: Survey v petition
Looking back through SE, forums and docs, I am not seeing a lot of difference between using surveys v. petitions. My use case is conducting surveys for logged in members.

In the docs it says, https://docs.civicrm.org/user/en/latest/survey/what-you-need-to-know/#key-questions

> How many questions do you need to ask? If it is more than one, you will need to create custom fields; if it is more than three, consider using Petition instead of Survey.

Why is this? Surveys require multiple questions so I am curious as to why this says this in the docs.

Seems like an issue in terminology: https://forum.civicrm.org/index.php%3Ftopic=23253.0.html

Using WP, so other than creating the custom fields and applying to an activity type, is there a reason to use Civi for the form or just go with Caldera Forms?

# Answer
> 2 votes
> is there a reason to use Civi for the form?

No.

Caldera form + activity processor allows you to do the same, with much more flexibility on how your form looks

---
Tags: civipetiton, civisurvey
---


# Question
Title: Option to have the employer field being a select with existing orgs?
I want to let members of existing organisations register themselves via CF.

If I let them free type their own organisation name, it's sure they will type the name in very creative ways, that are going to be different than how they are created in CiviCRM and therefore adding duplicates

In the drupal world with webform, you can limit what can be put in the organisation name and instead of a free form, have a select

Is there something similar with CF? having the employer field not a free form but a select with the list of organisations being a select of all the organisations in a group?

# Answer
The contact reference field in caldera forms limiting the entries to a group created containing the employers should work.
> 2 votes

---
Tags: caldera-forms
---


title: Data too long for column breaks export

text:
# Question
Title: Data too long for column breaks export
The error is e.g.

> Data too long for column 'custom\_194' at row 1

Our values are 1 character so we set the DB Field Length to 1. However, this makes exports of this same field fail. It is exporting the label, not the value, so DB Field Length needs to accommodate the label.

Since this is unresolved https://lab.civicrm.org/dev/core/issues/181 is setting a longer DB Field Length my only alternative to letting exports work again?

# Answer
> 2 votes
For the interim to let exports work, I have made the DB Field Length match the longest field label.

---
Tags: custom-fields, export
---


title: Event versus Form

text:
# Question
Title: Event versus Form
If you want to create a form for someone to sign up as a contact or for someone to make a donation, do you create an event? Or, are there forms somewhere to use?

# Answer
Welcome to SE! You certainly don't want to create an event for either of those scenarios. You just need to look at a bit more documentation (daunting at first but well worth looking through it all to see all the capabilities of CiviCRM).

For creating signing up as contact - the use profiles (see https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/)

For the donation you should create an online contribution (see https://docs.civicrm.org/user/en/latest/contributions/online-contributions/)
> 3 votes

---
Tags: civimember
---


# Question
Title: How to export members addresses into spreadsheet for a mailout?
How do I extract members' addresses in our system onto a spreadsheet for a mailout? Thank you so much!

# Answer
> 2 votes
You can use find contact search or Advance search or find membership search. Perform search and then select the contact you want to export and from task drop down select export, and select 'Export PRIMARY fields' or 'Select fields for export' if you don't want all fields.

Ref: https://docs.civicrm.org/user/en/4.6/common-workflows/exporting-your-contacts/

---
Tags: contacts, email, mailing
---


# Question
Title: Has anyone figured out how to deal with "dovecot" email handling on Siteground?
I noticed a post in 2018 about my same issue. I am using siteground with "Localdir" (the other posting used SMTP) because our email blasts are small volumes. The emails go out ok, but the civicrm email reports can't find bounces, and clickthroughs ? A siteground support person spent 2 hours "chatting" online trying to help me, but no success. Siteground uses "dovecot" email and all civicrm emails create folder-level addresses like ".bounces.ignored" and "bounces.processed" with three folders under each - "cur, new, tmp". Not sure how to fix/patch this to work ? I am using drupal 7.69 with civicrm 5.22.

# Answer
I presume that you are talking about bulk mailings. I have got this working for small volumes hosted on Siteground. I had a lot of problems originally with subfolders though can't remember the details. My solution was as follows.

**Outbound** use mail() and in Administer\>\>CiviMail\>\>Mail Setting, set Mailer Batch Limit to 100 and Mailer Cron Job Limit to 1. With the Send Scheduled Mailings cron job running every half hour this throttles the outbound mail within SiteGround's limits.

**Inbound** i set up an account on GMail to handle the bounces so bounce processing account (Adminster\>\>CiviMail\>\>Mail Accounts) was set up using IMAP to GMail and address examplereturn@gmail.com and localpart return+ and email domain of return.example.org. I then forwarded @return.example.org to examplereturn@gmail.com. The GMail account needs some special settings as described in https://docs.civicrm.org/sysadmin/en/latest/setup/civimail/inbound/#return-channel-google-apps. All rather complicated but nothing else I tried worked.

Hope that helps.
> 1 votes

---
Tags: email, mailserver, siteground
---


# Question
Title: Content aggregator for delivering Drupal 8 and CiviMail
There were at least two solutions for this in D7, Eileen's CiviToken extension and Pogstone's Content Token extension

Wondering if anyone has used or knows of something that will provide this for D8.

Goal is to be able to aggregate content (eg based on publish date and a tag) such that Mailings can be sent out with simply a token which then delivers the content in to the mailer.

# Answer
You may want to have a look at this extenion: https://github.com/bjendres/de.systopia.newsstore

It can collect/aggregate content in CiviCRM, e.g. from a RSS feed. Those items can then be sent out with CiviMail. With some additional extensions you could even sent them out automatically.

I do not remember all the details and documentation is a bit sparse but probably artfulrobot could help you as he developed most of it.
> 2 votes

---
Tags: tokens, drupal-8
---


# Question
Title: Case activities are not shown in activity tab but appear in the filter
In the Activity tab for a contact, case activities are not shown. I would rather they were, but I can live without that.

But in the filter for including and excluding activity types from the view, the case activities appear. Surely this is a bug. Since case activities are not shown in the tab, it makes no sense to filter by them.

In an organisation with a large amount of case activity types this makes the filter pretty much unusable because the list is so long and largely irrelevant.

I found the offending line of code, it is line 40 in CRM/Activity/Form/ActivityFilter.php

`$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);`

It seems to be the first parameter being set to TRUE that makes it include case activites.

Should I file a bug, what do you think?

# Answer
> 3 votes
> In the Activity tab for a contact, case activities are not shown. I would rather they were...

Me too! And After a lengthy process I've had this PR 1630 merged into core, should be released in 5.24 I think.

It adds an option (**Administer » CiviCase » CiviCase Settings**) that, if checked, will include case activities in the activities tab (and other activities listings that they were previously hidden from).

I felt that not having these exposed in the normal way led to some really strange situations - like if a case activity is assigned to me, I would not be able to see it from my record at all. You may want to read my rationale for why this option made sense.

---
Tags: civicase, activities, issues
---


# Question
Title: Error when end-users access Contact Dashboard
I want users to have access to the Contact Dashboard on our CiviCRM site. But I'm currently getting the following error when trying to access.  The following permissions I have set.

Authenticated User:

* CiviCRM: access Contact Dashboard

Anonymous:

* CiviCRM: profile create
* CiviEvent: register for events
* CiviEvent: view event info
* CiviDonate: make online contributions
* CiviCampaign: sign CiviCRM Petition

If I give the permissions "CiviCRM: access CiviCRM backend and API" it fixes the issues but do not probably want to do that.

CiviCRM version 5.22

# Answer
You have to have this permission (access CiviCRM backend and API) for anyone to access anything CiviCRM related, it's the minimum permission required for anyone to do anything.

You can have a look at some information regarding this here - https://lab.civicrm.org/dev/drupal/issues/45

There are a lot of other pages that say similar things as well, it sounds like a scary permission to give someone but in reality it's more of a first step kind of thing.

Unfortunately, this means that anyone with the access CiviCRM backend and API permission can see the CiviCRM menu but there are ways of going about this such as the answers on this question - How to remove CIviCRM from menu for some roles
> 2 votes

---
Tags: contacts, contact-view
---


# Question
Title: failed to open stream after PHP upgrade to 7.3
Started getting this error on some Civi pages after upgrading PHP to 7.3 on server running php-fpm and nginx.

Works fine after restarting php-fpm but need to restart every morning to get around with these issue. Has anyone come across this issue?

```
Warning: include(/var/sites/drupalsite/files/civicrm/templates_c/en_GB//%%30/307/307241E0%%Extensions.tpl.php): failed to open stream: No such file or directory in include() (line 1911 of /var/www/drupal759civi5192/sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).

```

# Answer
> 1 votes
May be a stupid question but have you purged caches / cache folders entirely? e.g. Clear the templates\_c folder?

---
Tags: smarty, php7
---


# Question
Title: How to get rid of Â when exporting report to CSV file
How to get rid of Â when exporting report to CSV file. running report

# Answer
This should be solved in version 5.22. It's usually non-english characters where Excel needs a special header to be able to determine the encoding.

See https://github.com/civicrm/civicrm-core/pull/16117 and https://lab.civicrm.org/dev/core/issues/1424
> 2 votes

---
Tags: civireport
---


# Question
Title: Flush system cache does not work during installation of Drupal Profile
I am creating a distribution Drupal profile which is bundling CiviCRM and CiviCRM extensions.

**Background**

Currently, I am having an issue with extensions that CiviCRM settings, for example, Mosaico Extension is using CiviCRM settings for configuration templates, graphic engine etc so after Mosaico extension is completely installed, the Mosaico settings have not been set and you need to flush the system cache.

According to CiviCRM| document https://docs.civicrm.org/dev/en/latest/framework/setting/

> Your setting will not be active until you run flush all caches (e.g cv flush or drush cvapi System.flush)

The current version of CiviCRM, Drupal and the extension that are being used.

* CiviCRM version 5.19.4
* Drupal version 7.69
* Mosaico version 2.3

**Issue**

When I am trying to flush the system cache via CiviCRM API, flush Cache directly via CRM\_Extension\_System class or calling cleanupCaches on the CRM\_Core\_config class. None of these is working.

```
civicrm_api3('System', 'flush');

\CRM_Extension_System::singleton()->getCache()->flush();

$config = \CRM_Core_Config::singleton();
$config->clearModuleList();
$config->cleanupCaches();

```

Is there a way to flush a system cache and load the configuration during Profile installation?

I have also tried to create settings after the extension is installed and got the error so I understand that the settings are not activated yet.

# Answer
Haven't done that, but if the focus is on manipulating the content of the settings, then one of these might help:

1. Try adding calls to `Civi::reset()` and/or `CRM_Core_Config::singleton(TRUE,TRUE)` to clear out any statics/singletons/thread-local caches.

* *Civi's headless unit-tests do this (via `CiviTestListener`). Note that one should only do it while Civi logic is \_not\_ active in the same thread -- e.g. it's OK to run when PHPUnit is doing setup/teardown because the statics/singletons/caches are essentially inert; but if one did this while running `hook_civicrm_config` or a Civi page-controller, then some active function on the call-stack may implicitly rely on them, so the behavior would be ill-defined.*
2. Proactively initialize the settings (`Civi::setting()->set($key, $value)`) *before* activating the extension. Don't rely on the default values for the settings.
3. Try working with the `SettingsManager` (`Civi::service('settings_manager')`). This has its own `flush()` operation.

* *Since this is included in `System.flush`, I don't have high expectations... but it is imaginable that your use-case requires flushing with a different \_sequence\_ of operations.*
> 1 votes

# Answer
After testing on Tim's suggestion.

1. It does not work.
2. Have not tried yet.
3. It works after calling `Civi::service('settings_manager')` on the last tasks before install\_finished task is called during Drupal installation.
> 1 votes

---
Tags: drupal, profile, installation, mosaico
---


# Question
Title: Applying part of a contribution to a Participant Payment
We often have participants for an event who have a portion of their fee paid by another entity. Sometimes, the other entity pays for more than one participant in the same transaction. I realize that Civi doesn't have an out-of-the-box method to handle this, so I've been toying around with an extension to make it happen.

What I don't understand is this: If J.Smith makes a $200 contribution that is to pay for Participant A ($100) and Participant B ($100), it would seem that creating a new entity\_financial\_trxn as follows would do the trick:

* entity\_table = "civicrm\_contribution"
* entity\_id = contribution id of the participant payment
* financial\_trxn\_id = id of the transaction for J.Smith's contribution
* amount = 100

But this applies the full amount of J.Smith's contribution ($200) to the Participant Payment, rather than just $100. This is not what I expect when entity\_financial\_trxn.amount is the "allocated amount of transaction to this entity".

I guess my question is: Is this in fact the intended behavior? If not, what is the purpose of entity\_financial\_trxn.amount?

(I should also note that we do not use civi's accounting features, so maintaining audit-level financial transactions is not a concern.)

Civi 5.19.1

# Answer
I would suggest

1. Create participant for Participant A
2. Create participant for Participant B
3. Create a $200 contribution against J.Smith contact
4. Add line $100 line item for Participant A and Participant B with contribution id from #3
5. Add participant payment entry linking contribution from #3 with participant id from #1 and #2.

If you are using drupal than whole process can be done using webform without any customization. (Probably caldera form for wordpress)

Thanks Pradeep
> 0 votes

---
Tags: contributions, partial-payments
---


# Question
Title: DB Error: constraint violation (WordPress)
I am trying to update an install from CiviCRM version 4.4.5 to the current version.

I was unable to because the WordPress site was using PHP 5.6.

So I installed CiviCRM 4.7.31, and then updated the server to PHP 7.0.

Now when I click the CiviCRM menu link in the dashboard, I get this:

DB Error: constraint violation

# Answer
> 1 votes
Aaron welcome to stack exchange, Can you logout and login again? If its a new install than you contact id might have not set properly in session.

---
Tags: wordpress, error, php7
---


title: Contribution Page Creates Payment

text:
# Question
Title: Contribution Page Creates Payment
I have setup a webform using the Civi/Drupal webform module, which allows people to submit payments they intend to make and keep it as Pending before they make it.

What is happening is the contribution goes in as Pending but when you change the amount and go to record a payment the amount stays as the original amount. This is because a payment was recorded.

How do i stop contribution page from recording a payment and i just want the contribution to be Pending in CiviCRM Contribution Page on that users account.

Thanks

# Answer
Yes, its a bug in civicrm webform module as it doesn't record line item correctly. The price field value and price field id are missing. I have a patch(for 7.x-5.0) that works for contribution amount field but not for line item field in webform. If you are using contribution amount than you can give it a try.

```
diff --git a/includes/wf_crm_webform_postprocess.inc b/includes/wf_crm_webform_postprocess.inc
index ea9dc8f..5a78d2e 100644
--- a/includes/wf_crm_webform_postprocess.inc
+++ b/includes/wf_crm_webform_postprocess.inc
@@ -1552,14 +1552,17 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
     // Contribution
     $fid = 'civicrm_1_contribution_1_contribution_total_amount';
     if (isset($this->enabled[$fid]) || $this->getData($fid) > 0) {
-      $this->line_items[] = array(
-        'qty' => 1,
-        'unit_price' => $this->getData($fid),
+      $params = [
         'financial_type_id' => $this->contribution_page['financial_type_id'],
+        'total_amount' => $this->getData($fid),
+      ];
+      CRM_Price_BAO_LineItem::getLineItemArray($params, NULL, 'contribution');
+      $lineItem = reset(reset($params['line_item']));
+      $this->line_items[] = array_merge($lineItem, [
         'label' => wf_crm_aval($this->node->webform['components'], $this->enabled[$fid] . ':name', t('Contribution')),
         'element' => 'civicrm_1_contribution_1',
         'entity_table' => 'civicrm_contribution',
-      );
+      ]);
     }
     // LineItems
     $fid = "civicrm_1_lineitem_1_contribution_line_total";

```
> 1 votes

---
Tags: drupal, contribution-page, payment
---


# Question
Title: Authorize.net Recurring Payment not being updated
I have 2 or 3 recurring payments with Authorize.net that are not being updated in Civi. Authorize.net shows that these recurring payments are being processed properly. CiviCRM shows the recurring payment as 'in progress' but the payment never shows up in CiviCRM. For the most part, I have no issue with recurring payments, but I'd like to find out if there is a way to troubleshoot these few payments and get things working properly again.

# Answer
> 2 votes
CiviCRM records post parameters send by Authorize.net you can find it in civicrm\_system\_log table. You can also use api explorer to get the data using SystemLog entity.

If you know the system log id than you can replay the ipn request to civicrm.

Ref: https://civicrm.stackexchange.com/a/4510/155

---
Tags: recurring-contributions, authorize.net
---


# Question
Title: How do you make certain category options non-selectable (but still there/reportable)?
Is there an extension available that allows you to make certain category options (on a 'pick list') non-selectable, but are still there/reportable? And can you do this based upon a previous field selection? E.g. The 'pick list' for a field called 'Group Name' doesn't allow an 'old' choice to be selected, but it is still there on other records and is reportable. And could the availability of the pick list be dependent upon a previous choice, e.g. an 'Area' field calculated using address?

# Answer
I'm afraid this isn't a scenario covered by core or an extension. Only custom fields can be set readonly. For a fast but hacky solution you could try a javascript approach.
> 2 votes

# Answer
With regard to the second part of your question - yes, there is my Field Lookup extension which allows you to "chain select" - much like picking a country will limit the choice of available states, you can make one select list dependent on another.

However, it's still in an early (i.e. unfinished) state; I actually have some funding to flesh it out a bit more, but it's not the priority of the client at the moment. If you open a new question around its use, I can document it enough for you to get it working (if it meets your needs without modification; it likely does).
> 1 votes

---
Tags: drupal, database
---


# Question
Title: Invalid currency "$" when sending confirmation and receipt
Running CiviCRM 5.22.0 with WordPress 5.3.2

Whenever a user attempts to create a membership AND record membership payment AND send confirmation and receipt, an **Invalid currency "$"** error is generated. The membership and contribution are recorded in the database, but no e-mail is generated. CiviMail is working in all other contexts.

If a user creates a membership AND records membership payment but does NOT check "Send Confirmation and Receipt?," the transaction completes without error. Editing the membership and selecting "Send Confirmation and Receipt?" will generate the invalid currency error.

I enabled debugging and backtrace and the error displayed with the exception trace is:

```
CRM_Core_Exception: Invalid currency "$" in <docroot>/wp-content/plugins/civicrm/civicrm/CRM/Core/Smarty/plugins/modifier.crmMoney.php on line 35

```

Any thoughts?

# Answer
> 4 votes
We had the same issue. The cause of the membership creation issue is with the email template syntax. Look in your system-generated messages and change the receipt templates you are using with, any instance of:

```
{$line.unit_price|crmMoney:$currency}
{$line.line_total|crmMoney:$currency}
{$formValues.total_amount|crmMoney:$currency}

```

Needs to be changed to:

```
{$line.unit_price|crmMoney}
{$line.line_total|crmMoney}
{$formValues.total_amount|crmMoney}

```

---
Tags: wordpress, civicontribute, civimail, error, currency
---


# Question
Title: Is it safe to remove INDEX keys for multi language installation?
We enabled multi language support in Civi 5.21.1 then tried to create a new custom field group with Select or Radio options. The error from the DB is below (\***edit: This doesn't happen when adding fields to an existing Group):-

```
[db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_custom_field (custom_group_id , name , label , data_type , html_type , default_value , is_required , is_searchable , is_search_range , weight , help_pre , help_post , 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 , filter , in_selector ) VALUES ( 77 , 'Test_2' , 'Test 2' , 'String' , 'Radio' ,  NULL ,  NULL ,  NULL ,  0 ,  2 ,  NULL ,  NULL ,  1 ,  NULL ,  NULL ,  255 ,  NULL ,  NULL ,  NULL ,  NULL ,  60 ,  4 , 'test_2' ,  204 ,  NULL ,  0 )  [nativecode=1062 ** Duplicate entry '77' for key 'UI_label_custom_group_id_en_GB']"]

```

After doing some digging, it seems that two tables now have additional keys:-

custom\_data\_group has the key 'UI\_title\_extends\_en\_GB' custom\_data\_field has the key 'UI\_label\_custom\_group\_id\_en\_GB'

After disabling multi language support, the keys remain and we are still unable to add options.

Removing the keys from MySQL using the commands below resolves the error:-

```
alter table civicrm_custom_field drop index UI_label_custom_group_id_en_GB;

```

and for the group:-

```
alter table civicrm_custom_group drop index UI_title_extends_en_GB

```

Is it safe to enable multi language support without these keys?

# Answer
CiviCRM adds indexes to custom field only if its searchable(checkbox ticked for is searchable field). Removing it might impact performance if your system has lots of records but you won't notice if its only 1k to 10k records.

But you trying to remove index which is not being used, so that should be fine.
> 1 votes

---
Tags: custom-fields, multilingual
---


# Question
Title: Invalid value for field(s) : Individual Prefix
I am importing a new database into CiviCRM using the CSV import method in: Contacts \> Import Contacts. In the downloaded CSV file with the list of errors, I get next error for a lot of entries:

```
Invalid value for field(s) : Individual Prefix

```

I suppose it is related to the list of prefixes I introduced in: Administer \> Customize Data and Screens \> Dropdown Options \> Individual Prefixes

In the CSV file used for importing the contacts, I put the *value* corresponding to the dropdown option. The error above is caused by a lot of entries with "2" as value, when there is actually an option with value "2" present in the different options available.

I wonder what could be the cause this error.

# Answer
Try using option label over value, i know its weird but for some options value doesn't work but label does or vice versa.
> 2 votes

---
Tags: drupal
---