title: Cleaning contacts

text:
# Question
Title: Cleaning contacts
How do I identify the contacts who haven't opened any mailings in the last 3 years?

I'm unsure which are the appropriate fields in the Advanced Search to make this process as easy as possible.

# Answer
> 2 votes
Welcome to SE civicrm. There isn't an easy way to do it, but you do it with some extra clicks.

Step 1:

You can use Mailing Open report(/civicrm/report/Mailing/opened?reset=1), find the mailing opened in the last 3 years, and Add all those contacts into a group using the action drop-down appearing on left side of the report.

Step 2: Using Adv Contact Search(/civicrm/contact/search/advanced?reset=1), find for contacts with Activity type =\> Bulk Email, Activity date =\> last three years =\>\> Search =\>\> Add contact to Smart group

Using Include / Exclude Search(Search \>\> Custom Search) =\> Find for contacts from group created at step2 and excluding from group created at step 3.

HTH

Pradeep

# Answer
> 2 votes
We have used the Synopsis extension to generate a tab like this

An example of the json involved is

{ "Label": "Total Emails opened in last 90 days", "MName": "Total\_Emails\_opened\_in\_last\_90\_days", "DataType": "Integer", "SelectRef": "none", "existing\_field": "0", "Query": "SELECT count(\*) as opened\n FROM\n civicrm\_mailing\_event\_queue q\n INNER JOIN civicrm\_mailing\_event\_opened o ON o.event\_queue\_id = q.id\n WHERE\n q.contact\_id = {contact\_id}\n\t\t\tand CAST(o.time\_stamp AS DATE) BETWEEN DATE\_SUB(NOW(), INTERVAL 90 DAY) AND NOW()\n\n", "Optgroup": "undefined", "Remove": false, "Hidefield": false, "CFID": 200, "Weight": "9", "column\_name": "total\_emails\_opened\_in\_last\_90\_d\_200", "table\_name": "civicrm\_value\_synopsis\_28" }

# Answer
> 1 votes
You can easily do this using GDPR extension https://github.com/veda-consulting-company/uk.co.vedaconsulting.gdpr

Navigate to Contacts \>\> GDPR Dashboard or navigate to civicrm/gdpr/settings

---
Tags: contacts, database
---


# Question
Title: Sending emails to contacts - How to default to general FROM email not user FROM email?
When I am viewing a contact and I click on their email address to send them an email, FROM email defaults to my logged in user email address. I setup a general email address, which I can change to using the dropdown of FROM addresses. But I would like the default FROM email to be the general email addess and not the logged in user email address.

The help menu says: *From Address By default, CiviCRM uses the primary email address of the logged in user as the FROM address when sending emails to contacts. However, users with Administer CiviCRM permission can configure one or more general email addresses that can be selected as an alternative. EXAMPLE: "Client Services" clientservices@example.org Go to Administer CiviCRM » Communications » FROM Email Addresses to add or edit general email addresses. Make sure these email addresses are valid email accounts with your email service provider.*

Is there any way to do this?

# Answer
There’s a setting ‘Allow mail from logged in contact’. If this setting is disabled then only the system configured from email addresses will be available for selection.

Administer \> System Settings \> Outbound Email (SMTP/Sendmail)
> 1 votes

---
Tags: wordpress, civimail, contacts, email
---


# Question
Title: CiviMail issue - "DB Error: no such table" when sending mailing
# Basic Problem

When attempting to send a basic traditional mailing (though it also occurs in Mosaico), attempting to send a test email to a single address or a group fails, showing an error that says "DB error: no such table". Based on debugging info, the table it is trying to access in my WordPress mySQL DB is "civicrm\_search\_segment" which does not show up in PHPmyAdmin for my Civi DB. Why is this table missing/why is the mailing failing?

## More debugging info

* CiviCRM version: 5.50.1 (problem occurred directly after upgrading from 5.49.4, see section below)
* WordPress version: 6.0
* mySQL version: 5.7.32
* PHP Version: 7.40.30
* Specific error text (see below)

## History of the problem:

We started on CiviCRM Spark, and were able to send mailings there through our Gmail account. We decided to switch to a full CiviCRM hosted on a new WordPress site. We migrated from Spark (on Drupal) to the new WordPress site. The migration went okay, except that I could not get the connection to our Gmail account to work. (*One note here: during the migration, I created a new mySQL database in PHPMyAdmin separate from my CMS' database, imported the old Spark mySQL DB, and then changed Civi's config to point to the new database*) I went through the process of connecting Gmail via OAuth, and was able to successfully test the account as a Mail account (Administer \> CiviMail \> Mail Accounts) for bounce processing. I also manually entered the address as our FROM address. This was all in CiviCRM Version 5.49.4 (for WordPress).

When I would try to send test emails, I would get an error saying "Could not identify any recipients. Perhaps the group is empty?" (as mentioned in other questions, \[like this one\]\[1\]). I attempted multiple fixes, from recreating the mailing, ensuring the To addresses were not marked as "On Hold", checking all tokens in the email for missing brackets, recreating the OAuth connection (using GCP and the Civi OAuth extension). Nothing fixed the problem. The last solution I tried was upgrading Civi from 5.49.4 to 5.50.1, which led me to this problem.

Thanks much in advance!

## Specific Error from log:

(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => exceptionHandler
        )

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] => SELECT `a`.`id` AS `id`, `a`.`name` AS `name`, `a`.`label` AS `label`, `a`.`description` AS `description`, `a`.`entity_name` AS `entity_name`, `a`.`items` AS `items`
FROM civicrm_search_segment a
ORDER BY `label` ASC
 [nativecode=1146 ** Table '\<mySQL DB ID\>.civicrm_search_segment' doesn't exist]
    [type] => DB_Error
    [user_info] => SELECT `a`.`id` AS `id`, `a`.`name` AS `name`, `a`.`label` AS `label`, `a`.`description` AS `description`, `a`.`entity_name` AS `entity_name`, `a`.`items` AS `items`
FROM civicrm_search_segment a
ORDER BY `label` ASC
 [nativecode=1146 ** Table '\<mySQL DB ID\>.civicrm_search_segment' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT `a`.`id` AS `id`, `a`.`name` AS `name`, `a`.`label` AS `label`, `a`.`description` AS `description`, `a`.`entity_name` AS `entity_name`, `a`.`items` AS `items`
FROM civicrm_search_segment a
ORDER BY `label` ASC
 [nativecode=1146 ** Table '\<mySQL DB ID\>.civicrm_search_segment' doesn't exist]"]
)```

  [1]: https://civicrm.stackexchange.com/questions/10671/mailing-issue-could-not-identify-any-recipients-perhaps-the-group-is-empty

# Answer
> 0 votes
Yeah, I had that too. You need to do an upgrade of the database on the extensions page.

---
Tags: wordpress, civimail, error, mysql, mailing
---


# Question
Title: Upgrade to 5.50.1 failed with "InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED"
Upgrade to 5.50.1 failed with

\[nativecode=4047 \** InnoDB refuses to write tables with ROW\_FORMAT=COMPRESSED or KEY\_BLOCK\_SIZE.\]

It has MariaDB 10.6.5, which sets the innodb\_read\_only\_compressed by default to ON

https://mariadb.com/docs/reference/mdb/system-variables/innodb\_read\_only\_compressed/

# Answer
To solve this set innodb\_read\_only\_compressed to OFF in my.cnf (or upgrade MariaDB to at least 10.6.6, which sets this value to OFF by default)
> 1 votes

---
Tags: upgrade
---


# Question
Title: Notification for future-dated contribution
We often have new donors that will sign up for a recurring contribution but mark it to start on a future date. With our current setup, they don't receive any sort of confirmation when they set up the contribution. The receipt email doesn't come through until the donation actually processes. This sometimes causes confusion on the part of the donor since they did sign up to donate but may not see a confirmation via email for a few weeks.

Is there a way to send them an email as soon as they schedule a future-dated contribution? I have checked in the "Receipt" tab of the contribution page hoping to find a setting there but I'm not seeing anything there. We are on CiviCRM 5.41.2 on Drupal 7. Payment processor is iATS. Also posting this question to the iATS Github.

# Answer
As a bit of background: the original model for donations was a bit too simple - it was built on the paypal model of instant payment and recurring contributions managed by the payment processor. We're still finding bits of core that carry some of the assumptions of that model.

Secondly, the ability for future-starting recurring contributions was added relatively recently, and (at least initially) only for admin-entered ones. The iATS extension built on this to also offer it as a self-service/public option.

So, when using the public civicrm contribution forms, the emails that go out are a core function, and I believe what happens is that the assumption is that you don't send out the 'receipt' email until the contribution completes.

Note that there's a similar issue with ACH/EFT contributions, which are not completed immediately, and sometimes take a few days.

Of course, one way to work around this issue when using Drupal is to use the civicrm-webform option, where you can manage the sending of 'receipt' type emails based on the submission, rather than the completion, of the donation request.

We could include this function within the iATS extension, which is already handling these future contribution dates, but let's see if anyone else has some ideas related to core function.
> 1 votes

---
Tags: civicontribute, recurring-contributions, iats
---


# Question
Title: Civi Event: Price Set, Additional Registrants ( Hiding the price set for the additional registrant)
For the dinner event I need to be able to track the use of the civi discount code so I set up the additional registrant field to effectively count the number of times the discount code is being used and by whom.

Now, the problem is that when I test-drive the registration page the Price set that I have for the event shows up for each of the additional registrants. So when my attendees register and choose to 2 additional registrants and then click to the next page to enter in the additional contact information they might think that they need to enter 1 in the price set for each of their contacts. This would then have my discount code counting all wrong because instead of calculation two people it has calculated four.

This might actually be a additional registrant problem because one participant is going to be paying for their entire group and I want to be able to hide the price set for the additional registrants.

# Answer
There was this proposed means to hide selected price set rows for additional participants:

CiviDiscount: How do I disable the automatic member discount for additional participants?
> 0 votes

# Answer
We have this exact same use case (i.e., we want the user to make all the price selections on the first page / first participant form, then only require the participant info for the additional participants). Solved it by adding the following to the very end of our version of the AdditionalParticipant.tpl template:

```
{literal}
<script>
if (!document.getElementById("noOfparticipants") && document.getElementById("price_282")) {
document.getElementById("priceset").style.display = "none";
}
</script>
{/literal}

```

This looks for the `noOfparticipants` ID (which only exists on the first participant form, and if not present, and if the price field ID 282 is present, then it hides the entire `priceset` ID element. (Obviously, replace the field ID value as appropriate.)
> 0 votes

---
Tags: civievent, registration, price-sets, cividiscount
---


# Question
Title: Civi CRM - Multiple events / memberships within 1 basket?
Does anyone know if it is possible to integrate the CRM so you can add multiple things (memberships / event tickets etc) into a basket, and then pay for all of these at once?

TIA - I cant find any info on this anywhere!

# Answer
> 2 votes
If you're prepared to install WooCommerce (caveat: it's pretty heavy on a server and some hosts may not support it) then you can achieve what you're after using the Integrate CiviCRM with WooCommerce plugin.

# Answer
> 2 votes
**For adding multiple events into a cart:** Admin \>\> CiviEvent \>\> CiviEvent Component Settings

In there, check off "Use Shopping Cart Style Event Registration" (it says it's in alpha state, and it's been that way ever since we started using CiviCRM, which was in 2014 ... so, there's that. We explored this, and it was completely unusable on a Joomla install; can't comment on other CMS's, but thought I'd mention it in case you were willing to test it on your end)

**For purchasing an event + membership:** https://aghstrategies.com/event-additional-signup-extension/

(it has some drawbacks, described on the page linked above; we had some other specifics for our use case so ended up not using it)

CiviCRM does need a proper shopping cart that will work hand in hand with CiviDiscount (i.e. if you purchase an event and membership, and the membership should give you a discount on the event, it'll get applied correctly in the cart). Assuming this would require a "make it happen" kind of campaign.

The way we work around it we try to curate the user flows. E.g., we know most folks start with purchasing an event so right on the registration form, we tell them "hey, did you know you can get a discount if you become a member - sign up here (link)". It's not perfect, but it's getting us by.

# Answer
> 1 votes
It sounds like price sets is what you're looking for: https://docs.civicrm.org/user/en/latest/membership/membership-price-sets/#non-membership-price-fields

---
Tags: wordpress, payment, integration
---


# Question
Title: When adding a New Org via the Add Relationship link, why does it fail if the relationship uses a sub-type
Scenario is this. If you have a RelType of Indiv (A) and Org subtype x (B), then when you get offered the New Organisation option, it creates the new record as an Org (standard) and hence the Relationship Type is then not valid.

> 1 invalid relationship record 1 relationship record was not created due to an invalid contact type.

How to fix?

# Answer
The issue is fixed if you go to civicrm/admin/uf/group/field?reset=1&action=browse&gid=5 (ie the Admin \> Customise \> Profiles \> Reserved Profiles \> New Organisation

and add a field of type Contact \> Contact subtypes

then when you use the Add Org via the Add Relationship button, you can select the relevant sub-type
> 2 votes

---
Tags: relationships, contact-types, sub-types
---


title: Editing Event on front get an error

text:
# Question
Title: Editing Event on front get an error
i would like certain wp users to use civi on front page. For certain operations it works:

https://domain.com/civicrm/?civiwp=CiviCRM&q=civicrm%2Fa%2F#/status

https://domain.com/civicrm/?civiwp=CiviCRM&q=civicrm%2Fevent%2Fsearch&reset=1

https://domain.com/civicrm/?civiwp=CiviCRM&q=civicrm%2Fcontact%2Fsearch&reset=1

even

https://domain.com/civicrm/?civiwp=CiviCRM&q=civicrm%2Fevent%2Fmanage%2F

it's ok !

but when i try to edit an event directly (with an ID) like this

https://domain.com/civicrm/?civiwp=CiviCRM&q=civicrm%2Fevent%2Fmanage%2Fsettings&reset=1&action=update&id=521

the main page load but when the event inner tabs try to load content via ajax it fails.. i always get an error..

I have this problem on local, on stage and on prod servers..

Have anyone ever experienced the same ?

# Answer
I just upgraded to 5.50.2 and WP 6 and it's working now.

I can edit my event on the front-end

https://domain.ccom/civicrm/?civiwp=CiviCRM&q=civicrm%2Fevent%2Fmanage%2Fsettings&reset=1&action=update&id=521
> 1 votes

# Answer
You can't edit an event using front end url, it should be

https://domain.com/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fmanage%2Fsettings&reset=1&action=update&id=521

Certain tabs/pages require additional admin permission
> 2 votes

---
Tags: wordpress, civievent
---


# Question
Title: Event Registration DB Error: already exists | Duplicate entry [] for key 'UI_uf_name_domain_id'
During any event registration while the user is **not** logged in (i.e., if they are a new user) produces the following error. After doing a bunch of research, the consensus seemed to be that the issue was fixed in an earlier version of CiviCRM. I upgraded Civi to the most recent version to no avail. Here are the following steps I have taken:

1. Cleared Cache
2. Disabled every extension
3. Disabled any custom module using civicrm
4. Upgraded CiviCRM to the most recent version
5. Restarted the entire server, upgraded the server (Probably unnecessary but figured I would since I was already there).

It appears to work fine if the user is already logged in.

CiviCRM: 5.50.1
Drupal: 9.3.16
Ubuntu: 20.04
PHP: 7.4.30
Server version: Apache/2.4.54 (Ubuntu)
MariaDB: 10.3.34

```
[error]  $Fatal Error Details = array:3 [   "message" => "DB Error: already exists"   "code" => null   "exception" => PEAR_Exception {#15678
    #cause: DB_Error {#15680
      +error_message_prefix: ""
      +mode: 16
      +level: 1024
      +code: -5
      +message: "DB Error: already exists"
      +userinfo: "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']"
      +backtrace: array:41 [
        0 => array:6 [
          "file" => "/var/www/website.org/vendor/pear/db/DB.php"
          "line" => 997
          "function" => "__construct"
          "class" => "PEAR_Error"
          "type" => "->"
          "args" => array:5 [
            0 => "DB Error: already exists"
            1 => -5
            2 => 16
            3 => array:2 [
              0 => "CRM_Core_Error"
              1 => "exceptionHandler"
            ]
            4 => "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']"
          ]
        ]

```

Any help would be greatly appreciated. Thank you!

EDIT: Still an issue.

# Answer
> 3 votes
Did you recently migrated from D7 to D9? If so please do the following below

1. Log in as Admin into your website.
2. Navigate to CiviCRM \>\> Contacts \>\> Find and Merge Duplicate Contacts.
3. Check if the Unsupervised Individual rule is set to email only, if not create a new Unsupervised Individual rule with email only and make a not of old unsupervised rule.
4. Take the site offline(maintenance mode ON).
5. Log out from the website.
6. Log in to mysql via phpmyadmin or terminal and run the truncate table command. `TRUNCATE TABLE civicrm_uf_match;`
7. Log in as Admin into your website.
8. Navigate to CiviCRM \>\> Administer \>\> Users and Permissions \>\> Synchronize Users to Contacts
9. Click 'Ok' button.
10. Take the site online(maintenance mode OFF).

HTH

Pradeep

---
Tags: civievent
---


# Question
Title: Network error trying to access Notes tab but Summary access is fine
I have started having an issue when I view a contact where I can view/edit the SUMMARY tab without an issue, but when I click on the NOTES tab I get: Network Error Unable to Reach the Server

But there is no issue with the server (Summary tab has no issues) and no errors that I can find in any error logs.

Any thoughts on why this is occuring or what could be causing this?

NOTE: This is on Wordpress and I have full wordpress and civicrm admin privileges.

# Answer
> 1 votes
So it turns out my error was because of a custom WordPress plugin... deactivating the custom plugin, caused the error to go away and everything to work as expected.

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


# Question
Title: How do I set up a new Drupal website user account and assign them a civi role?
I want to allow someone to view the backend of the website and Drupal but not make any changes.

# Answer
> 2 votes
If you create a Drupal user, and if your CiviCRM integration is set up correctly, then a CiviCRM contact record will be created that is connected to that Drupal user.

If your CiviCRM Contact already exists then you can either

* click on Actions and create CMS User from there or
* create a Drupal user via Drupal and if it matches email then it should connect them.

Then there are then a LOT of civicrm permissions via the Drupal interface that you can set depending on what you want that person to do.

---
Tags: user
---


# Question
Title: After upgrade to 5.49.3 mosiaco preheader is adding full mail address
Upgraded from something pre new form builder stuff to 5.49.3. Now in Mosaico the top block, header, looks fine in the drag and drop stuff but when you view it in html, instead of just see the the unsubscribe and the view in your browser at the top you also see the full mailing address and civicrm/mailing/optout?reset=1&jid=&qid=&h=fakehash above the links.

I've tried to create a new template, same thing.

In the generating HTML to either email or to just view, it's adding in the organization snail mail address from admin organization address and contact info. (I tried changing that info just to verify that's where it's coming from).

# Answer
> 3 votes
Thanks to petednz who pointed to a solution in chat.

The problem was fixed in my case by going to Mailings =\> Headers, Footers, and Automated Messages and looking at all the headers and footers that were marked default. In my case, the first one marked default was the problem. By editing it and unchecking default the problem went away.

Note: it only fixed it on new mailings and on any new mailing copied from an old mailing created before the update.

Edit - this didn't really fix it for mailings copied from old mailings: When the mailing was sent it errored saying it was missing domain.address, action.OptOutURL or action.UnsubscribeURL. I ended up adding a footer id in the message table for that mailing. When creating a new mailing from a template it worked. There is more solutions in the same question comment link above,

---
Tags: mosaico
---


# Question
Title: Create report including data from contact and from related contact
I have contacts who are parents and related to contacts who are children. Child is registered for an event. Parent is not registered for any event.

I want to create a report that lists each child and includes:

* Child's Contact ID,
* Child's name,
* Child's birthdate,
* Child's Event's name,
* Child's Event status (for example 'Registered'),
* Child's custom field data (for several custom fields),
* Parent's Contact ID,
* Parent's name,
* Parent's emails,
* Parent's phone numbers,

I can create reports for all of the Parent's data. I can create reports for a Child's data (events and custom data).

I cannot figure out how to create a report in civi that includes both. How is that possible? What am I missing?

I am using CiviCRM 5.45.6 on Drupal 8

# Answer
> 2 votes
In latest versions of CiviCRM searchkit should do this.

Participant search\> Event Name and Status

Link contact details from Participant record\> Child Data

Parent Details\> Bring in related contacts from child record

This demo from a meetup is as good an intro to Searchkit as I've found https://civicrm.org/blog/wmortada/searchkit-new-way-get-data-out-civicrm

# Answer
> 1 votes
Probably your best option for this would be to use the data processor extension, which allows you to present related information on the same screen. You can then add options to PDF/CSV export if it needs downloading.

https://civicrm.org/extensions/data-processor

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


# Question
Title: How to import a lot of contacts (above 5000)
I need to import a file with individuals (round 5000) and organizations (round 2000), relationships between them and all of them being added to group.

What would you advice: api import? front-end with server settings to optimize time-outs? SQL injection?

# Answer
> 0 votes
After a lot of testing, I ended up using the api csv import extension. Not perfect but at least helped me do the job.

# Answer
> 5 votes
In the very short term, the advimport extension might help: it adds a button to the core contact import to "process with advimport", and it uses its queue for processing. A bit slower, but it won't crash.

In the long term, this is something that a few folks such as Eileen and Tim have been working on improving in core, so hopefully somewhere around CiviCRM 5.51 or 5.52, core import should be much more efficient (PR#23669, for example). There are a few open PRs waiting review, if you are interested to help speed things up.

---
Tags: import
---


# Question
Title: Is there a way to freeze column headers in SearchKit?
Is there a way to freeze a column header on a SearchKit Table display like you would on a spreadsheet? We have several SearchKit Tables that take up more than 1 page and it would be nice to have the have the column labels present when scrolling through the search results.

# Answer
You can add CSS in your theme file

```
div.crm-search-display-table table thead tr {
  position: sticky;
  top: 42px;
  box-shadow: 0 2px 2px -1px rgb(0 0 0 / 40%);
}

```
> 8 votes

---
Tags: searchkit, formbuilder
---


# Question
Title: Possible Deleted Contact - Trying to Restore Records - Possible SQL Solution?
So here is the issue - that I think was caused by a merger of contacts without transferring the related fields to the new contact. I have a contact, that seems to be missing a large number of historical records.

I managed to track down their old contact record ID (13) by having them send me some old emails and found all their old records using phpmyadmin by searching for 13 in column "contact\_ID" in all tables.

Contact ID 13 does not exist in the database.

Can I create a new contact in CiviCRM and then change its ID via phpmyadmin to 13, will it automatically "reconnect" all the records to this newly created contact?

Edit: tried this, got the following error: #1451 - Cannot delete or update a parent row: a foreign key constraint fails

```
(`database_name`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)

```

Or should I just create a contact manually in civicrm\_contact via phpmyadmin and set its id value to 13?

Edit: would I have to create a new hash?

Would either of these options work?

# Answer
In Civi, if you use "Advanced Search" there is an option to Search in Trash which contains deleted contacts. Contacts that have been deleted during the merging process should show up there. You can leave the other search options blank in order to see all previously deleted contacts too. No need to go through the tables in phpmyadmin.
> 0 votes

---
Tags: contacts, database, duplicate-contacts, mysql
---


title: Soft credit amount token

text:
# Question
Title: Soft credit amount token
I'd like to send thankyou letters to soft credit contributors, but I don't find a token for soft credit amount. Not even in CiviToken extension. Is it possible?

# Answer
> 2 votes
You can use my Soft Credit Tokens extension for this. Note that the README points out it only pulls the data for the most recent soft credit on the contact, which may not be the correct one. This was due to a limitation that existed until Civi 5.43 - this *can* be fixed now, but I'm not really using the extension anymore so someone else will have to do it.

---
Tags: civicontribute, soft-credit
---


# Question
Title: Cannot change cases via Drupal Webform after CiviCRM update
We updated two different Test systems with the CiviCRM Security Release (5.50.0, 5.49.4, 5.45.6 ESR) from 1st of June 2022. One test system has Drupal7 and CiviCRM 5.49.4, the other one has Drupal9 and CiviCRM 5.49.4. (We updated the latter to CiviCRM 5.50.1, but the problem persists.)

After the update, we cannot change Cases via Drupal Webform (which is using the CiviCRM API) anymore if we are logged in as a test user. When we try, the webform returns a success message, but the changes are not saved in CiviCRM and in the error protocoll it says:

> The CiviCRM "case create" API returned the error: "Index 0 not found in api results" when called by function "postSave" on line 222 of wf\_crm\_webform\_postprocess.inc with parameters: "Array ( \[medium\_id\] =\> 1 \[case\_type\_id\] =\> 4 \[status\_id\] =\> 1 \[subject\] =\> testsubject \[custom\_118\] =\> \[custom\_283\] =\> 1 \[custom\_6\] =\> Array ( ) \[custom\_9\] =\> \[custom\_120\] =\> \[custom\_11\] =\> \[custom\_128\] =\> 0 \[custom\_12\] =\> \[custom\_307\] =\> 19940614 \[custom\_131\] =\> Array ( ) \[custom\_15\] =\> Array ( ) \[custom\_300\] =\> \[custom\_139\] =\> Array ( ) \[custom\_280\] =\> \[custom\_18\] =\> Array ( ) \[custom\_314\] =\> Array ( ) \[custom\_26\] =\> Array ( ) \[custom\_51\] =\> Array ( ) \[custom\_121\] =\> Array ( ) \[custom\_122\] =\> Array ( ) \[custom\_294\] =\> \[custom\_167\] =\> 0 \[custom\_281\] =\> Array ( ) \[custom\_295\] =\> \[custom\_240\] =\> \[custom\_288\] =\> \[custom\_241\] =\> \[custom\_290\] =\> \[custom\_57\] =\> Array ( ) \[custom\_249\] =\> \[custom\_309\] =\> \[custom\_81\] =\> Array ( ) \[custom\_256\] =\> \[custom\_308\] =\> \[custom\_87\] =\> Array ( ) \[custom\_270\] =\> \[custom\_271\] =\> \[custom\_272\] =\> \[custom\_274\] =\> Array ( ) \[custom\_92\] =\> 0 \[custom\_93\] =\> \[custom\_94\] =\> \[custom\_95\] =\> \[custom\_96\] =\> \[custom\_97\] =\> \[custom\_98\] =\> \[custom\_277\] =\> \[client\_id\] =\> 2016 \[id\] =\> 3845 \[check\_permissions\] =\> \[version\] =\> 3 ) "

We *can* change Cases via Drupal Webform as admins. Creating/changing Cases via the CiviCRM GUI works (as test user and admin), as well as creating/changing Cases using the CiviCRM API3 Explorer (as admin). As the latter works well, the problem cannot lie in the CiviCRM API itself, but it has to be an issue with the way Drupal webform calls the CiviCRM API. On the other hand, as the problem exists in both Drupal7 and Drupal9, and didn't occur in both of these systems before the CiviCRM Update, it cannot really be a problem in Drupal webform as well.

Did anybody meet a similar problem when updating to this Security Release, and found out why? Does anybody know if this update changed something related to permission model / user roles? Any hint is appreciated.

# Answer
We have confirmed that this is a regression in CiviCRM Core by writing an automated test for WFC module. It clearly shows that the latest public 5.45.\* is still green -\> after that -\> red

I have reported the issue in CiviCRM's product management channel. Hopefully it will be addressed quickly for you. Once it has been fixed we will merge this new UpdateCase test into the WFC module Github repo so it will run on every PR as well as against CiviCRM RC and even dev-master to ensure this exact issue will never resurface.

If you want to help contribute to our work and efforts -\> consider making a contribution here -\> https://webform-civicrm.io/form/sponsor-webform-civicrm-module
> 3 votes

# Answer
Note that the issue has now been reported as a gitlab and that is the place to follow along with it https://lab.civicrm.org/dev/core/-/issues/3671
> 2 votes

---
Tags: webform-civicrm, civicase, upgrade
---


# Question
Title: Wordpress anonymous user can not access profile page
So I am trying to setup a profile that the anonymous (not logged in) user can access on CiviCRM with WordPress.

I have read the other threads and tried setting the the WordPress Access Control options as suggested but it still did not work... it keeps re-directing to the home page of the wordpress install.

So then what I tried was ticking ALL boxes for the Anonymous user in the WordPress Access Control (yes every single one) which would theoretically be the same permissions that a CiviCRM administrator would have.

But even with every permission granted, it still does not show the profile and still continues to redirect back to the wordpress homepage.

I then even tried de-activating all wordpress plugins (except civicrm) and had the same behavior.

Any ideas on what I am doing wrong?

EDIT: I am using this to send a link to my anonymous user:

```
https://mydomain.com/civicrm/profile/edit?gid=14&reset=1&cid={contact.id}&{contact.checksum}

```

Which sends me a link something like this:

```
https://mydomain.com/civicrm/profile/edit?gid=14&reset=1&cid=1106&cs=b44ac099f6e0c7624006cc12d5e04509_1655496640_888

```

# Answer
> 1 votes
Well the issue turned out to that I mistakenly used `&cid=` instead of `&id=`

So correct link to send in an email to the user with tokens is:

```
https://mydomain.com/civicrm/profile/edit?gid=14&reset=1&id={contact.id}&{contact.checksum}

```

I will post back with more details shortly about persmissions as well.

---
Tags: wordpress, contacts, profile
---


# Question
Title: Importing a future membership start date: Invalid value for field(s) : Start Date 01/25/2021
I get the above statement when I try to import a membership. I have coded the date in different ways, and eventhough the fields match with my definition I get the same answer. Really I wonder why this field is mandatory and my import fail as a consequence. Can anyone help? I have already registered the Contact so this is step two.

# Answer
It depends on the date format you have selected on Import Membership form when you try to upload the import file
> 0 votes

# Answer
Per your comment Claes Rickeby, you can setup an custom membership status of "Upcoming". This is an example:
> 0 votes

---
Tags: civimember, import
---


# Question
Title: Create Contacts From Inbound Email Body?
Is there a way to have CiviCRM create contacts from email addresses found in the body of an inbound email? We have a number of different sources that send us emails with addresses in the email bodies that we want to capture (for example, we receive volunteer applications from a form on our website, and also from VolunteerMatch - both contain the applicant's email address in the email body). However, it looks like inbound email processing only parses email headers by default. Is there something obvious we're missing?

# Answer
This would require an extension to do.

That said, I'm not sure this is the best approach for your use case.

If you have a form on your website, it seems like it would be better to integrate that form directly with CiviCRM instead of using inbound email processing. For VolunteerMatch, I would use their API with Form Processor to process the message rather than inbound email processing.

That second item is a complex solution if you're new to CiviCRM, but within the reach of a non-coder, as opposed to writing an extension.
> 2 votes

---
Tags: email
---


# Question
Title: create mailing - unable to load recipient group - insufficient permission
I am using Mosaico and have a problem with the selection of Recipients for Mailings. When I try to select a recipient civicrm seems to be searching infinitely for recipient groups and my firefox browser throws an error message refering to a necessary Permission Required: "insufficient permission: require administer CiviCRM"

But why should I require administration Permissions to create an mailing? That does not seem to make sense. User has all permissions related to mailings, but of course no admin-permission.

Does anyone have an idea?

# Answer
> 1 votes
The code is trying to fetch the value of the setting hence it requires administrative permission. Theoretically it should allow minimum permission user to create mailings, looks like a bug.

---
Tags: permissions, mailing, mosaico
---


# Question
Title: How to manually trigger update hook for an extension?
**Question:** When upgrading an extension from the UI on Site A it will update the files and run the update hook. How do I **manually** execute the update hook for the extension on the other Site B, C, etc?

The extension directory on our server is shared between all the sites. This means that when I "upgrade" an extension on Site A the files will be updated for all the sites. However, the "update" hook is only executed on Site A. The result is that the extension files are up-to-date for ALL sites and CiviCRM perceives that Site B, C, etc no longer need to update the extension. This means that I cannot execute any update functions. Is there a way to manually trigger the update function?

**Configuration Information:**

* CiviCRM 5.8
* Drupal 7
* Each of our sites has a separate database (they are not shared).
* Each site is configured in drupal\_root/sites/subdomain.domain.org
* Extensions are installed in a directory shared by all sites (drupal\_root/CustomExtensions).

# Answer
> 1 votes
The extension upgrade command can be executed using API (version 3).

Drush can then be used to execute the command on multiple sites:

```
drush cvapi Extension.upgrade reset=1

```

A refresh may be necessary

```
drush cvapi Extension.refresh

```

Can anyone else verify this works for extension upgrades that require an update?

# Answer
> 1 votes
How about make a backup of the extension folder before the first update, then do on site A, then restore the backup folder, then do site B, etc...

# Answer
> 1 votes
I think there are 2 steps when upgrading an extension:

1. upgrade the extension itself (replacing the old version of the files with the new version) . This is done when you hit the upgrade link in the overview of the extensions. That can easily be done manually by downloading the new extension folder and replacing the existing folder in your extension folder
2. Executing the extension upgrade actions that are triggered by the functions in the Upgrader class. These are the cases where after installing a new version you get the notice in the top right corner when you navigate to Administer\>System Settings\>Extensions. There are based on the current value of the column *schema\_version* in the table *civicrm\_extensions*. As your sites have different databases but share the extensions folder this might get a little confusing. I would check what happens with the files in the different databases, it might be that the *schema\_version* gets updated in all your databases. If that is the case you could set the column to the previous version in the DB, that should trigger the extension update function?

# Answer
> 0 votes
The URL you can use to trigger the extension updates pending: https://xxx/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fextensions%2Fupgrade&reset=1

This is useful when the admin status page doesn't load due to a SQL error.

---
Tags: extension, upgrade, multisite
---


# Question
Title: Trying to bulk update cases through finding them and profile
Steps to Replicate:

1. Find Cases
2. Select All cases
3. Choose update cases from task options
4. Choose profile to update

Hits an error with DB Error: syntax error, was able to replicate on https://dmaster.demo.civicrm.org/

Note: Individual selection of cases works fine, CRM errors when trying update all the results.

# Answer
> 3 votes
Yes, it is a core bug and have submitted a PR for the fix.

---
Tags: civicase
---


# Question
Title: Mosaico 2.9 - Templates: cannot edit existing templates after update
After updating from 2.8 to 2.9 in my sandbox (and updating all URLs in Mosaico tables as a result of site URL change), I notice that the interface to edit existing templates isn't really usable.

Here's what it looked like in 2.8

And here's what it looks like after update to 2.9:

So with 2.9, this new interface doesn't allow me to edit the templates -- nor can I change the template settings....

Any suggestions on how to resolve?

# Answer
I'm providing an update in case anyone else has this issue. The issue was that /wp-content/**uploads**/civicrm/ext contained:

Afform: Core Runtime v 0.5 Search Kit 1.0 beta3

And civiCRM was picking up these two extensions instead of the core versions found at: /wp-content/**plugins**/civicrm/ext

Form Core 5.48.0 Search Kit 5.48.0

To resolve the issue, I:

1. Disabled Mosaico
2. Disabled the Afform extension and deleted the folder /wp-content/**uploads**/civicrm/ext/Afform, did a Extension Refresh, so it found the core version, enabled it and ran the associated database update.
3. Disabled Search Kit and deleted the folder /wp-content/**uploads**/civicrm/ext/SearchKit, , did a Extension Refresh, so it found the core version, enabled it and ran the associated database update.
4. Re-enabled Mosaico

And I was then able to edit the Mosaico templates successfully.
> 2 votes

---
Tags: mosaico
---


# Question
Title: Changes in hook__civicrm_alterMailParams not respected anymore when sending mails to individual contacts
In our development environment I redirect mails following some specific rules. I am quite sure that I achieved that in the past with `hook__civicrm_alterMailParams` where I changed the `$params['toEmail']` to whatever email suited. Additionally I changed `$params['text']`to have some info about the original email address.

Now this logic starts to fail after upgrading from CiviCRM 5.50.0 to 5.50.2 (when you send a mail to an individual contact from the contact view page). The reason is that `$params['toEmail]` has now the value `NULL` instead of a string with the email address. For sending mass mailings this logic still works - for every single email the hook is called with an $params array with 'toEmail' set.

The release notes from 5.50.1 and 5.50.2 did not show any code changes that seem to be related to that. How can I find someone to check that? It seems to be a main issue to me when changes like that are made in core without any information.

# Answer
> 3 votes
The hook\_civicrm\_alterMailParams(&$params, $context) hook is called twice

1. $context == 'messageTemplate' -\> When building the message, at this moment the toEmail is not set
2. $context == 'singleEmail' -\> called when email is build and about to send.

HTH

Pradeep

---
Tags: civimail, hooks, core
---


title: Restrict from address to the domain

text:
# Question
Title: Restrict from address to the domain
Our site is using SparkPost for email delivery which restricts email sending if the domain is not registered with the account. Sometimes user try to setup mailing or reminders or Email-Activity with incorrect from address (yahoo or gmail) causing mailings to bounce or reminders not sent. Is there any way we can restrict the user to select correct from address?

# Answer
There is an extension called Outbound Domain Enforcement for CiviCRM from JMA Consulting. This extension filters the From Email Address options provided to users as they are about to send an email. Only ones that have the same domain as the System-generated Mail Settings From Email Address are exposed, with the others suppressed.

**Note:** This will work only for the single domain i.e, but spark post allows you to set up multiple domains as subaccounts sharing the same API key. So if your CiviCRM site is called www.abc.com and you have two domains registered abc.com and xyz.com at spark post, when sending email from www.abc.com it will allow mails to send from @abc.com but not from @xyz.com
> 2 votes

---
Tags: civimail
---


# Question
Title: Uncaught Error: Class 'CRM_Grant_BAO_Grant'
We are unable to upgrade CiviCRM to 5.50.2, get a fatal error with the message Uncaught Error: Class 'CRM\_Grant\_BAO\_Grant' while running the upgrade from UI or drush. We have Grant extension enabled, Any help would be appreciated.

CiviCRM: 5.46.3 Drupal: 9.4.0 PHP: 7.4

# Answer
Do you have a Grant Application extension or any extension related to CiviGrant installed? If so can you disable the extension, Upgrade CiviCRM, and re-enable the extension?

Have seen a similar issue reported on the Grant application which is now fixed by JMA Consulting but needs some testing. If the error you are facing relates to Grant Application extension then can you apply the patch and Do the Civi upgrade?

HTH

Pradeep
> 2 votes

---
Tags: civigrant
---


# Question
Title: update error - [Error: core-issue#2487 Add / alter defaults for civicrm_contribution_recur]
I have been handed responsibility for a CiviCRM site that is using 5.35.2 on Drupal 7 which fails to update. I'm 100% new to CiviCRM. Can anyone help me fix this issue?

```
[Error: core-issue#2487 Add / alter defaults for civicrm_contribution_recur]

Error Field Error Value

Type    DB_Error

Code    -2

Message DB Error: syntax error

Mode    16

UserInfo    ALTER TABLE `civicrm_contribution_recur` MODIFY COLUMN `start_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The date the first scheduled recurring contribution occurs.', MODIFY COLUMN `create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When this recurring contribution record was created.', MODIFY COLUMN `modified_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Last updated date for this record. mostly the last time a payment was received', MODIFY COLUMN `contribution_status_id` int(10) unsigned DEFAULT , MODIFY COLUMN `frequency_interval` int(10) unsigned NOT NULL DEFAULT 1 COMMENT 'Number of time units for recurrence of payment.'; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' MODIFY COLUMN `frequency_interval` int(10) unsigned NOT NULL DEFAULT 1 CO' at line 5]
DebugInfo   ALTER TABLE `civicrm_contribution_recur` MODIFY COLUMN `start_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'The date the first scheduled recurring contribution occurs.', MODIFY COLUMN `create_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When this recurring contribution record was created.', MODIFY COLUMN `modified_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Last updated date for this record. mostly the last time a payment was received', MODIFY COLUMN `contribution_status_id` int(10) unsigned DEFAULT , MODIFY COLUMN `frequency_interval` int(10) unsigned NOT NULL DEFAULT 1 COMMENT 'Number of time units for recurrence of payment.'; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' MODIFY COLUMN `frequency_interval` int(10) unsigned NOT NULL DEFAULT 1 CO' at line 5]

PEAR_Exception: DB Error: syntax error in /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
- DB_Error: DB Error: syntax error in unknown on line unknown
Exception trace
#   Function    Location
0   CRM_Core_Error::exceptionHandler(Object(DB_Error))  /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
1   PEAR_Error->__construct('DB Error: syntax…', -2, 16, Array, ' ALTER TAB…')  /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/db/DB.php:998
2   DB_Error->__construct(-2, 16, Array, ' ALTER TAB…') /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575
3   PEAR->_raiseError(Object(DB_mysqli), null, -2, 16, Array, ' ALTER TAB…', 'DB_Error', true)  /home/findnm/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223
4   PEAR->__call('raiseError', Array)   /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/common.php:1928
5   DB_common->raiseError(-2, null, null, ' ALTER TAB…', '1064 ** You have…')   /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php:936
6   DB_mysqli->mysqliRaiseError()   /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php:406
7   DB_mysqli->simpleQuery(' ALTER TAB…')   /home/ind/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/common.php:1234
8   DB_common->query(' ALTER TAB…') /home/ind/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php:2696
9   DB_DataObject->_query(' ALTER TAB…')    /home/ind/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php:1829
10  DB_DataObject->query(' ALTER TAB…') /home/ind/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php:454
11  CRM_Core_DAO->query(' ALTER TAB…', true)    /home/ind/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php:1566
12  CRM_Core_DAO::executeQuery(' ALTER TAB…')   /home/ind/public_html/sites/all/modules/civicrm/CRM/Upgrade/Incremental/php/FiveThirtySeven.php:138
13  CRM_Upgrade_Incremental_php_FiveThirtySeven::updateDBDefaultsForContributionRecur(Object(CRM_Queue_TaskContext))    /home/ind/public_html/sites/all/modules/civicrm/CRM/Queue/Task.php:74
14  CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))  /home/ind/public_html/sites/all/modules/civicrm/CRM/Queue/Runner.php:201
15  CRM_Queue_Runner->runNext(true) /home/ind/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php:36
16  CRM_Queue_Page_AJAX::{closure}()    /home/ind/public_html/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php:89
17  CRM_Queue_ErrorPolicy->call(Object(Closure))    /home/ind/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php:38
18  CRM_Queue_Page_AJAX::runNext()  /home/ind/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:279
19  CRM_Core_Invoke::runItem(Array) /home/ind/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:69
20  CRM_Core_Invoke::_invoke(Array) /home/ind/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php:36
21  CRM_Core_Invoke::invoke(Array)  /home/ind/public_html/sites/all/modules/civicrm/drupal/civicrm.module:458
22  civicrm_invoke('upgrade', 'queue', 'ajax', 'runNext')   /home/ind/public_html/includes/menu.inc:527
23  menu_execute_active_handler()   /home/ind/public_html/index.php:21
24  {main}

```

Thanks Bill

# Answer
Looks like in your CiviCRM system, **Pending** contribution recur status(/civicrm/admin/options/contribution\_recur\_status?reset=1) is either disabled or deleted.

Before upgrading CiviCRM can you

1. Enable the **Pending** Contribution recur status.
2. Add **Pending** Contribution recur status if doesn't exist.

Note: You may not be allowed to enable the status from GUI, Try using api explorer or mysql to enable it.

Update:

Looks like in your system Contribution Recur status is missing, run below query to add contribution recur status in your system

```
INSERT INTO `civicrm_option_group`  ( `name`, `title`, `is_active`, `is_reserved`, `is_locked` ) VALUES ('contribution_recur_status', 'Recurring Contribution Status', 1, 1, 1)
ON DUPLICATE KEY UPDATE id=id;;

SELECT @option_group_id_ps := MAX(id) FROM `civicrm_option_group` where name = 'contribution_recur_status';

INSERT INTO `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `weight`, `is_reserved`, `is_active`, `is_default`)
SELECT @option_group_id_ps as option_group_id, `label`, value, ov.name, weight, ov.is_reserved, ov.is_active, is_default
FROM civicrm_option_value ov
INNER JOIN civicrm_option_group og
ON og.id = ov.option_group_id AND og.name = 'contribution_status';

SELECT @maxValue := MAX(CAST(value AS UNSIGNED))  FROM `civicrm_option_value` where option_group_id = @option_group_id_ps;
SELECT @maxWeight := MAX(weight) FROM `civicrm_option_value` where option_group_id = @option_group_id_ps;

INSERT INTO `civicrm_option_value` (
`option_group_id`, `label`, `value`, `name`, `weight`, `is_reserved`, `is_active`, `is_default`
)
VALUES(
 @option_group_id_ps, 'Processing', @maxValue + 1, 'Processing', @maxWeight + 1, 1 , 1 , 0
),
(
@option_group_id_ps, 'Failing', @maxValue + 2, 'Failing', @maxWeight + 2, 1 , 1 , 0
)
ON DUPLICATE KEY UPDATE id=id;

```
> 3 votes

---
Tags: upgrade
---


# Question
Title: How do I get opening rates for my mailings?
I'm trying to figure out how to get opening rates (not the list of the people that opened the mailing) for our newsletter mailings.

Thank you.

# Answer
> 2 votes
Welcome to CiviCRM SE.

In the menus go to Mailings \> Scheduled and Sent Mailing, which lists all the mailings. On the line for the mailing in question and click on Report. This gives you what you are looking for.

# Answer
> 2 votes
Under Reports \> Mailing Reports you will see one for Open and one for ClickThrough.

If you want aggregated data per Mailing then you may need to have a look at SearchKit

---
Tags: civimail, civireport
---


# Question
Title: Massive assignment of Data privacy acceptance (GDPR)
I am importing historical data into CiviCRM where there is the field privacy accepted and the date of acceptance. How can I assign these values in the import? It seems to me that this cannot be done manually either.

Thanks.

!Data policy accettance

# Answer
I'd create a "Data Privacy Acceptance" or "NDA Signed" activity type or something similar and do an activity import with a status of completed and the date they accepted it.

You will need to match the newly created Contact ID back to an activity import file to do the activity import. You can use the external ID field from your legacy database to do a match (vlookup).
> 3 votes

# Answer
Can you create a custom field in CiviCRM and use those to store the data?
> 2 votes

# Answer
As @andy-burns said, I can import the activity "Data Policy Acceptance" for contacts who have already accepted privacy.

The activity type "Data Policy Acceptance" is already created by GDPR Extension.

Thank you.
> 1 votes

---
Tags: gdpr
---


# Question
Title: Is it possbile to use Drupal Views to relate Webform Submissions and CiviCRM Contacts and Cases?
We use Drupal (7) Webforms integrated with CiviCRM for various use cases, particularly recruitment forms.

I can create a Drupal View of *either* Webform Submissions OR CiviCRM Cases, but I cannot combine the two as there is no obvious way of relating a Webform submission to the CiviCRM contact that submitted it unless they are a Drupal User - the vast majority of submissions are not for us.

I can see a Drupal database table called `webform_civicrm_submissions` but this is not your usual SQL table that can be accessed via Views it seems.

Any ideas?!

# Answer
The quickest answer I can give is, no.

I can't think of a way of combining civi information and webform submission details.

What you can do is the use relationships in Civi to start with case data, and then bring into the view other data in civicrm linked to the case. The case contact for example And also data about any case activities

What data from the webform submission are you wanting to show alongside the Civi Contact/ Case Data?

Are you able to give an example?
> 0 votes

# Answer
there may be a gotcha but if you start a View based on webform submissions then you can join (via Relationships) the Drupal user, then you can get to the Contact, and in theory you would then be able to get to the Case.

my quick example didn't work but maybe doing so in reverse
> 0 votes

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


# Question
Title: Help excluding and including contacts in contribution reports
I'd be grateful for any guidance anyone can offer. The answer may be right in front of me, I realize.

**What I'm trying to do:**

1. I want to generate a list of contacts for a *physical, paper mailing* to raise funds.
2. I have a Smart Group (Members new, current, grace), and that is the only subset of contacts that I wish to run this search on.
3. I'd like to find every contact within "Members new, current, grace" who has made a donation up until 4/30/2022.
4. I want to mark/label/identify these contacts, who made a donation up until 4/30/2022 so that I can exclude them from my mailing. But I need the remainder, all those in the group Members New, Current, Grace, who do not fit that category I am excluding, to remain visible and exportable because they are the contacts who should receive the mailing.

My problem is that I can't find a report or search function that lets me choose the necessary variables, and that lets me mark **only** those within the group that have made a contribution in the specified date range. If I can find something like that, I discover when trying to export that Civi will not allow me to export a column for "contributions."

Civi seems to have lots of options for including contacts, but very few for excluding them by parameter without also excluding from view or export the contacts I actually desire.

Here's what the search logic would look like in plain English:

1. Consider only the smart group "Members New, Current, Grace."
2. Then, display the full contact information for everyone in that group, including a US Postal, physical address.
3. Of this set, identify or label the subset who have made a contribution as recently as 4/30/2022.
4. But, leave me with a report that includes everyone on the list, and does not leave me only with the subset I want to exclude. In other words, display for me: All contacts in Members New, Current, Grace. Do not remove or hide from view everyone who doesn't fit the excluded subset. Allow that data to remain visible, because those contacts are the ones who should receive the mailing.

Thank you to anyone who can guide me. Again, I realize that the answer may be very obvious, and it might just be my brain not seeing it. I have tried, but I'm stuck. Cheers.

# Answer
1. Search - Advanced Search
2. In the Groups field, put your smart group.
3. In the contributions section, set the received date for \<= 4/30/2022
4. Search. From the actions dropdown, make a group out of that.
5. Search - Custom Searches - Include/Exclude
6. In the include group put your earlier smart group.
7. In the exclude field put the group you just made.
8. Click on AND (this is a quirk - we don't care about tags but it wants you to pick AND or OR).
9. Then the results are the contacts you seek.
> 2 votes

---
Tags: civicontribute
---


# Question
Title: "DB Error: no database selected in unknown" when trying to upgrade Civicrm
I'm on wordpress 6.0, linux, upgrading from CiviCRM 5.36.0 to 5.50.3.

When I try and run the upgrade script i.e. wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fupgrade&reset=1

I get the following error in my debug and it crashes:

```
[22-Jun-2022 19:05:42 Europe/London] PHP Fatal error:  Uncaught <table style="border: 1px" cellspacing="0">
<tr><td colspan="3" style="background: #ff9999"> <b>PEAR_Exception</b>: DB Error: no database selected in <b>/var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php</b> on line <b>922</b></td></tr>
<tr><td colspan="3" style="background: #ff9999">- <b>DB_Error</b>: DB Error: no database selected in <b>unknown</b> on line <b>unknown</b></td></tr>
<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>
<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>
<tr><td style="text-align: center;">0</td><td>CRM_Core_Error::exceptionHandler()</td><td>/var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922</td></tr>
<tr in /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php on line 955

Jun 22 20:55:26  [debug] $backTrace = #0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(441): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(PEAR_Exception))
#2 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:2))
#3 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress->invoke("")
#4 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
#5 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
#6 /var/www/html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
#7 {main}

Jun 22 20:55:28  [error] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => exceptionHandler
        )

    [code] => -14
    [message] => DB Error: no database selected
    [mode] => 16
    [debug_info] => SELECT *
 FROM   `civicrm_component`

 [nativecode=2006 ** MySQL server has gone away]
    [type] => DB_Error
    [user_info] => SELECT *
 FROM   `civicrm_component`

 [nativecode=2006 ** MySQL server has gone away]
    [to_string] => [db_error: message="DB Error: no database selected" code=-14 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT *
 FROM   `civicrm_component`

 [nativecode=2006 ** MySQL server has gone away]"]
)

Jun 22 20:56:14  [debug] $backTrace = #0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(954): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#2 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: no database selected", -14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...")
#3 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...")
#4 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR::_raiseError(Object(DB_mysqli), NULL, -14, 16, (Array:2), "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...", "DB_Error", TRUE)
#5 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))
#6 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-14, NULL, NULL, "SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n [nativecode=2006 *...", "2006 ** MySQL server has gone away")
#7 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(391): DB_mysqli->mysqliRaiseError(-14)
#8 /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
#9 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common->query("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
#10 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(451): DB_DataObject->_query("SELECT * \n FROM   `civicrm_component`   \n \n \n \n \n \n")
#11 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(74): DB_DataObject->find(FALSE)
#12 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(37): CRM_Core_Component::getComponents()
#13 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(116): CRM_Core_Component::_info(FALSE)
#14 /var/www/html/wp-content/plugins/civicrm-admin-utilities/includes/civicrm-admin-utilities-single.php(2269): CRM_Core_Component::getEnabledComponents()
#15 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_Admin_Utilities_Single->shortcuts_menu_add(Object(WP_Admin_Bar))
#16 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, (Array:1))
#17 /var/www/html/wp-includes/plugin.php(524): WP_Hook->do_action((Array:1))
#18 /var/www/html/wp-includes/admin-bar.php(95): do_action_ref_array("admin_bar_menu", (Array:1))
#19 /var/www/html/wp-includes/class-wp-hook.php(307): wp_admin_bar_render("")
#20 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
#21 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
#22 /var/www/html/wp-admin/admin-header.php(267): do_action("in_admin_header")
#23 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php(312): require_once("/var/www/html/wp-admin/admin-header.php")
#24 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(202): CRM_Utils_System_Base->theme("<div id=\"crm-container\" class=\"crm-container\" lang=\"en\" xml:lang=\"en\"...", FALSE, FALSE)
#25 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(452): CRM_Utils_System::theme("<div id=\"crm-container\" class=\"crm-container\" lang=\"en\" xml:lang=\"en\"...")
#26 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(PEAR_Exception))
#27 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:2))
#28 /var/www/html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress->invoke("")
#29 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
#30 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
#31 /var/www/html/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")

```

any ideas?

# Answer
This indicates that MySQL has crashed. Check your MySQL log for details, and considering increasing the number of open connections.
> 0 votes

---
Tags: upgrade, civicrm-home
---


# Question
Title: Public Autocomplete on Drupal User Registration
I've been testing the Public Autocomplete extension with the hope of using it to prevent duplicate contacts being created if I expose the current employer field in forms. I've got it working for anonymous users on an event registration page but, using the same profile, it doesn't seem to work on the Drupal User Registration form.

Is this be design, or am I doing something wrong? Is there a way to get it working?

# Answer
> 0 votes
I think it might be an ACL or Drupal Permission. I can't get it to work for authenticated users but it does work for Admins. I'm not sure what the fix is.

---
Tags: drupal, registration, autocomplete
---


# Question
Title: How to create a "token" from a custom field
I'm trying to create a token from a custom fields, is there a way to do this?

My specific use case is that I want to have a custom field under Events that includes the Zoom event information (URL and call-in numbers), which I can then insert into email notifications regarding the event.

# Answer
This happens automatically - but you can't use an event token unless you're sending an email that is tied directly to the event. E.g. you can't use CiviMail, because CiviMail doesn't know which event you're referencing. However, Scheduled Reminders and CiviRules can use event tokens.

Because they're not available in CiviMail, they don't appear in the *Tokens* drop-down menu normally. However, they appear if you create a Scheduled Reminder. The format of the token is `{event.custom_X}` where `X` is the custom field ID.

If you go to **Administer menu » Communications » Schedule Reminders**, the *Tokens* menu will have your custom fields listed. You can freely copy the token into other templates that you intend to use with Scheduled Reminders, CiviRules, as well as the "PDF Letters for Participants" action, and possibly some other Participant actions (e.g. Name Badges).
> 5 votes

# Answer
Adding to Jon Gs answer you may want to utilize this extension to send out manual or automated emails containing event & participant token using this extension: https://docs.civicrm.org/eventmessages/en/latest/
> 3 votes

# Answer
Just adding to Jon's comments - if you send an email from the actions on the Find Participants screens event custom field tokens should be availble in the token selector (if you CiviCRM version is fairly recent)
> 1 votes

# Answer
for a general user case, it's easy to create any token using the data processor extension and its addon the data processor token extension.
> 0 votes

---
Tags: tokens
---


# Question
Title: Installation of v5.50 gives me an immediate Bootstrap exception
I have just done an upgrade to v5.50 and get an immediate:

`RuntimeException: CiviCRM has not bootstrapped sufficiently to fire event "hook_civicrm_entityTypes". in Civi\Core\CiviEventDispatcher->dispatch() (line 190 of /var/www/html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php).`

I have a script that does the refresh of a new version and I'm not aware of anything I have changed on my UAT server where I test these things. Has anyone else seen this?

Running on D7 v7.88

# Answer
Firstly check that there are no missing extensions on the system. You may need to apply the patch below or comment out commonMoudleBuildList in Container.php to see the list of missing extensions.

A patch is available https://github.com/civicrm/civicrm-core/commit/91e1627497d53cba04c6919575efb7061daf125a.patch that makes the load order predictable. This patch will enable the list of missing extensions to be displayed.

https://github.com/civicrm/civicrm-core/pull/23716 https://github.com/civicrm/civicrm-core/pull/23268 https://lab.civicrm.org/dev/core/-/issues/3496
> 1 votes

# Answer
I have just run my upgrade script against v5.50.3 and all went well, so I think we are OK on this now.
> 1 votes

# Answer
I have this issue since a long time on D8 and D9, I ended up not using CiviCRM entity after a very painful removal.

Now I see this issue on another site that had been upgraded to 5.50.1 This time I do not want to remove CiviCRM entity. But, sorry, I have no clue how to put CiviCRM entity back on track.
> 0 votes

# Answer
Commenting out commonModuleBuildList in Container.php solves the problem in the short term.

From the git log I see that Container.php had commonModuleBuildList added on 21/4/2022.

Creating a patch in composer that comments out the line maintains git workflow.

The next question is how to get initialize() to be called later. I had the idea to use *hook\_event\_dispatcher*, although it does not work. The fix seems to solve *civicrm\_entity* but then block/user and the core drupal CiviCRM module also has hooks that are not supported by the event dispatcher.
> 0 votes

# Answer
There is another patch available related with this kind of error https://github.com/civicrm/civicrm-core/pull/23739
> 0 votes

---
Tags: upgrade
---


# Question
Title: Why is the custom field "Link" type not displaying as a link?
Is there a reason that the "Link" custom field type is displaying as an Input field instead of rendering an A tag with href? I want to the Link type to render a link as a link.

# Answer
> 1 votes
In edit mode it's an input field. In view mode on the contact summary it is a clickable link.

---
Tags: civievent, custom-fields, custom, hyperlinks
---


# Question
Title: Membership stays on Pending after Payment
I am building a custom plugin to handle Memberships in Wordpress (CiviCRM version 5.50.1). I am using the Order and Payment APIs (version 3 - there doesn't seem to be anything in version 4?) to do this.

My code looks like this for the Order:

```
$params = [
  'membership_type_id' => $price_field_value[0]['membership_type_id'],
  'contact_id' => $contact_id,
  'status_id' => 'Pending',
  'source' => ...,
];

$order_data = [
  'contact_id' => $contact_id,
  'total_amount' => $total_amount,
  'financial_type_id' => $settings['civicrm_contribution_financial_type'],
  'payment_instrument_id' => $settings['civicrm_contribution_payment_instrument'],
  'receive_date' => $date->format('Y-m-d H:i:s'),
  'contribution_page_id' => $contribution_page_id,
  'contribution_status_id' => 'Pending',
  'contribution_source' => ...,
  'line_items' => [
      [
          'params' => $params,
          'line_item' => [
              [
                  'entity_table' => 'civicrm_membership',
                  'price_field_id' => $price_field_value[0]['price_field_id'],
                  'price_field_value_id' => $price_field_value[0]['id'],
                  'qty' => '1',
                  'unit_price' => $total_amount,
                  'line_total' => $total_amount,
              ]
          ]
      ]
  ]
];

$order = civicrm_api3('Order', 'create', $order_data);

```

And like this for the payment:

```
return civicrm_api3('Payment', 'create', [
  'contribution_id' => $contribution_id,
  'total_amount' => $total_amount,
  'trxn_id' => $trxn_id,
  'trxn_date' => $date->format('Y-m-d H:i:s'),
  'receipt_date' => $date->format('Y-m-d H:i:s'),
  'payment_instrument_id' => $settings['civicrm_contribution_payment_instrument'],
  'is_send_contribution_notification' => 0,
]);

```

Once the payment is passed, I can see the completed Contribution linked to the Membership, but the Membership remains as Pending. Am I missing something?

I am having similar difficulties with updating Memberships: when I enter an existing membership in the params array, it stays as expired after payment. Could it be that both problems are related?

# Answer
> 0 votes
I seem to have found a partial solution in this thread: https://forum.civicrm.org/index.php%3Ftopic=13921.0.html

I fixed the issue by changing the Pending status' weight so that it appears further down the list (as in the default settings). However, I am still having an issue with Expired memberships not having their end date changed after an order is created and a payment is passed.

---
Tags: wordpress, civimember, payment
---


# Question
Title: Is there a way to add an activity to a group?
I would like to add an activity to all the records in a query I pulled from Civi. Is there a way to globally add an activity? If possible, I would like to avoid editing each record individually.

# Answer
> 2 votes
From a Search you can use the Actions button to add an Activity to all those contacts. It gives you the option to either create one Activity that all contacts are on, or one per each contact.

---
Tags: activities
---


title: Can I make a price set required?

text:
# Question
Title: Can I make a price set required?
I am trying to create a Price Set with multiple fields, each with multiple options, and require one option from any of the fields. Is it possible to make the Price Set itself required, or can you only make individual fields required?

We have multiple pricing options for Adults, Youth, and Children so each category is its own field. I don't want to make the fields required since a single person isn't an Adult *and* Youth *and* Child. However, if I include 'none' options then it is possible for someone to have no selection at all. It appears this question has been asked before but there was no solution back then. I'm hoping there is one now.

# Answer
As long as there’s a fee for all options then try this method –

When editing or creating a price set, enter a value in the ‘Minimum Amount’ field. In this example, I’ve entered 5, as that’s the smallest fee available for this event.

None of the price fields have ben set to required -

If a participant attempts to select ‘none’ for all of the options, they will be presented with the below message and will not be able to proceed -
> 5 votes

# Answer
Can you just put all the options into one field? Are you separating them into multiple fields purely for visual reasons? If so, then maybe you can use some custom css to do that, e.g. `div.price-set-row.fieldname-row3 { margin-top: 1em; }`
> 2 votes

# Answer
If you need something more custom, and you are not afraid to do a bit of code, you can always add a validation using hook\_civicrm\_validateForm (and optionally using javascript).

For hook\_civicrm\_validateForm, you need to create an extension with the function that looks like :

```
function myextension_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) {

  if ($formName == 'CRM_Event_Form_Registration_Register') {

    $formId = $form->getVar('_id');
    // event id in this case
    if ($formId == 1) {

      // add whatever logic you want
      $price1 = CRM_Utils_Array::value('price_1', $fields);
      $price2 = CRM_Utils_Array::value('price_2', $fields);
      $price3 = CRM_Utils_Array::value('price_3', $fields);

      if (empty($price1) && empty($price2) && empty($price3)) {
        $errors["price_1"] = ts('You must choose one price item');
      }

    }

  }
}

```
> 2 votes

---
Tags: price-sets, payment
---


title: Two log files on Joomla install

text:
# Question
Title: Two log files on Joomla install
Is anyone seeing multiple logs on Joomla installs in the `ConfigAndLog` directory?

Reason we care is items from only one of them get actually rendered in the Log Viewer (in CiviCRM admin UI: Admin \>\> Administration Console \>\> View Log).

This is with CiviCRM 5.50.3, but we've seen this behavior for a while now. Thx.

# Answer
Is it a multilingual site? If yes then this change will be in 5.52 to just have one file: https://github.com/civicrm/civicrm-core/pull/23722
> 0 votes

---
Tags: joomla, logs, errorhandling, configandlog
---


# Question
Title: How can I add Company to billing/pay later fields?
When I activate pay later and force pay later address input on an event I get some fields displayed.

How can I add "Company" to those fields?

I used the hack in How to change order in billing address to tweak the ordering.

The return in `CRM/Core/Payment/Manual.php` looks like this:

```
      return [
        'first_name' => 'billing_first_name',
        'last_name' => 'billing_last_name',
        'street_address' => "billing_street_address-{$billingLocationID}",
        'postal_code' => "billing_postal_code-{$billingLocationID}",
        'city' => "billing_city-{$billingLocationID}",
        'country' => "billing_country_id-{$billingLocationID}",
        'state_province' => "billing_state_province_id-{$billingLocationID}",
      ];

```

I'm not sure what the values in this returned table actually means or how it is used, but I could not find anything like `billing_company` or `billing_organisation` when `grep`-ing the PHP sources.

Is there a way to add the company information to the "pay later" form?

# Answer
> 0 votes
I don't think there is an easy way to add a new field to the billing address instead of changing the core file. But you could do via custom extension using buildform hook

---
Tags: fields, paylater
---


# Question
Title: Reimport users after migration to Wordpress
We're in the process of migrating from Drupal to Wordpress. The initial migration went without a hitch and we're now setting up new contribution forms in the new site. The plan is to reimport the users once we are ready to go live with the Wordpress site as the tables will be out of sync by then. So, is there a way of migrating just the user data at a later date without overwriting the other work we will have done in the system?

Thanks

Chris

# Answer
Assuming you have done something like that :

* install Wordpress
* install an empty CiviCRM on Wordpress
* create the users in Wordpress with the same email as the primary email of their contact in CiviCRM
* copy CiviCRM database and reset the path or update them as needed

You should be able to fix the users / contact link by updating the `civicrm_uf_match` table with a sql query like :

```
UPDATE civicrm_uf_match uf
  INNER JOIN civicrm_email e ON uf.contact_id = e.contact_id AND e.is_primary = 1
  INNER JOIN wp_users u ON u.user_email = e.email
SET uf.uf_id = u.id;

```
> 0 votes

---
Tags: wordpress, drupal, import
---


# Question
Title: How do I change the order of fields in the pay later invoice information?
This is similar to How can I change the order of address field columns on screens and reports?, but relates to the order the fields are show when "pay later" information is requested.

I would like to move the "Postnummer" (post code) to before the "Postadress" (City), because that's the way we do it in many European countries ;-)

And I would like to avoid hacks like the one suggested in How to change order in billing address.

# Answer
> the order the fields are show when "pay later" information is requested

not sure i am answering your question - but this sounds like it is just a Profile and you could look for this in Administer \> Custom \> Profiles, and then tweak the order there
> 0 votes

---
Tags: forms, paylater
---


# Question
Title: CiviCRM's PayPal - Website Payments Pro no longer supported for new PayPal business customers
I have installed CiviCRM (5.50.1) on WordPress (6.0) for an Australian Not-For-Profit (NFP). The NFP has an existing PayPal Business account for credit card payments used with a PayPal button-based shopping-cart .

CiviCRM contribution pages using CiviCRM's *PayPal – Website Payments Pro* payment processor have been successfully tested with the NFP's PayPal sandbox accounts.

CiviCRM returned this error message after I swapped in the live payment API signature from View or remove API signature:

> “Payment Processor Error message: Invalid Configuration This transaction cannot be processed. The merchant's account is not able to process transactions.”

The CiviCRM System Administrator Guide Enable Website Payments Pro for Your Sandbox Account says that I should be able to click on *Apply for Website Payments Pro* in the PayPal account and notes:

> “You will get an error message from the PayPal Payments server if you attempt to do a direct (Website Payments Pro style) transaction before your account is approved.”

Fair enough, but I can't find an *Apply for Website Payments Pro* link in the NFP's PayPal account and PayPal's Website Payments Pro page says:

> “PayPal isn't accepting new users for this feature, and we require existing users to upgrade to our Advanced Debit and Credit solution”.

The links on this page lead me down an SDK rabbit hole, and it's not clear how to upgrade an existing account.

Will the PayPal account's live SOAP API signature work with CiviCRM's *PayPal – Website Payments Pro* payment processor if I upgrade to Advanced Credit and Debit Card Payments?

If so, where on PayPal's site do I apply for Advanced Credit and Debit Card Payments for an existing account?

# Answer
I have received advice from PayPal Merchant Technical Support that it is long longer possible to apply for Website Payments Pro, and that access to Advanced Credit and Debit Card Payments will not provide access to the SOAP API used by Payments Pro, so for new CiviCRM users, PayPal Website Payments Pro is no longer an option as a payment provider
> 2 votes

---
Tags: payment-processor, paypal
---


# Question
Title: I am getting the error '/packages/DB/common.php on line 265' when implementing PHP 8.0
I want to switch to 8.0 as PHP 7.4 is now giving warnings. But, I am getting the error '`com_civicrm/civicrm/packages/DB/common.php on line 265`' when implementing PHP 8.0.

Code written in the relevant line:

```
    function quoteString($string)
{
    $string = $this->quoteSmart($string);
    if ($string{0} == "'") {
        return substr($string, 1, -1);
    }
    return $string;
}

```

When I add /\** to the beginning of the line, the system boots because it does not read the command. But I don't know if this will cause any problems.

Another PHP error I get after the system boots up is '`media/civicrm/templates_c/tr_TR/%%EA/EAA/EAA96A89%%joomla.tpl.php on line 56`'

The command on the line:

```
<?php if ($this->_tpl_vars['localTasks']): ?>

```

I request your support to solve both errors.

# Answer
You must be on a very old version of civi since DB/common.php is now included in vendor not packages since about 2 years ago. Very old versions aren't going to support php 8. I suggest upgrading civi.
> 1 votes

---
Tags: joomla, civicrm-home, php8
---


# Question
Title: Outbound Domain Enforcement extension error
I'm getting the following error and don't understand what it means. Can anyone explain what this means?

The Outbound Domain Enforcement extension has prevented the following From Email Address option(s) from being used as it uses a different domain than the System-generated Mail Settings From Email Address configured at Administer \> Communications \> Organization Address and Contact Info: contact@k9direction.org, jefftawater@k9direction.org You can add another one here.

# Answer
> 1 votes
What are you doing when you get that error? It sounds like you have something configured to have two email addresses separated by a comma. Pick one and use that as the setting.

# Answer
> 0 votes
This problem happens when you send an mailing from CiviCRM and the selected From field domain is different from the domain registered in Administer \> Communications \> Organization Address and Contact Info \> Email.

You have to edit either one. You can edit the From options in Administer \> Communications \> FROM Email Addresses. Find the one that is incorrect and edit it.

Sometimes happen that even though the mailing From field shows the same domain, it is taking another value.

---
Tags: email, domain
---


# Question
Title: After upgrade to CiviCRM 5.48.0, all submissions say "Mailing cannot be sent. There are missing or invalid fields (subject,name,from_name,from_email
After upgrading from CiviCRM 5.46.x to 5.48.0, any attempted mailing creates an error after clicking "Submit Mailing" with "Mailing cannot be sent. There are missing or invalid fields (subject,name,from\_name,from\_email,body)." Those fields are clearly filled in in the mailing, and when submitting a test mailing, it goes through, and the test mailing is sent and delivered.

Anyone else experiencing this, and/or any ideas on how to fix it?

# Answer
I found the solution: Flexmailer is now part of the standard distribution. With Drupal 7, Flexmailer is now located under sites/all/modules/civicrm/ext I had an older version of Flexmailer under sites/default/files/civicrm/ext which caused the problem. To remove it, I had to first disable mosaico, than remove the Flexmailer files, than uninstall Flexmailer (ignore the warning), refresh the list (it then appears again with the right path), and finally reinstall and enable Flexmailer, and re-enable Mosaico.
> 7 votes

# Answer
Per the comment above: Flexmailer version was 5.48.0, but it was not installed. Installing the extension fixed the problem.
> 4 votes

# Answer
I have the same issue with a build in Joomla -

If I disable Mosaic - stop flexmailer and uninstall and reinstall via the extension menu I still get the same error -

Suggestions ?

Thanks
> 0 votes

# Answer
One other possibility here...

I have seen this CiviCRM error message "Could not identify any recipients. Perhaps your test group is empty..." when email attachments are a combined size of \>10MB and get rejected by the sending server.

If you check the logs you should see a more helpful error message that might throw more light on this rather generic and confusing Civi message.
> 0 votes

---
Tags: civimail
---


# Question
Title: Displaying closed cases in the dashboard
I'm using compucorp's fork of civiCase. Nice! Currently in the case manager page, only active cases are displayed (as confirmed by the "Satus: All open cases" placeholder). I'm trying to display by default both active and closed cases.. But I can not find a toggle to do so, any advice?

# Answer
> 1 votes
The code seems to support a "showCasesFromAllStatuses" parameter on that page but I have no idea how to set it.

It looks like they removed the mechanism for it in https://github.com/compucorp/uk.co.compucorp.civicase/pull/825, but left some of the code behind.

As a workaround you can comment out this line, but the text in the dropdown will still default to "All Open Cases", but the table will be showing all statuses. https://github.com/compucorp/uk.co.compucorp.civicase/blob/f815d9886bb8d34d8584b8245339e2cb0b9f3d80/ang/civicase/case/list/directives/case-list-table.directive.js#L383

---
Tags: civicase
---


# Question
Title: <br clear="all"> or similar in CKEditor - Trying to do a clean break
So here is the deal, I am trying to have a clean break between images and text and am unable to use in CKEditor. There is this plugin, but its not available via the CKeditor congfig, and I am not trying to maintain another extension to keep it running every time I update CiviCRM. Is there another way to get the same result using the stock CKEditor that is bundled with CiviCRM? Thanks!

# Answer
Hope I've understood your issue correctly. A workaround here is to use the editor to insert an image in the place where you wish it to appear. Right click on the image to bring up image properties. Select the advanced tag and in style, enter the following CSS "margin-left:auto; margin-right:auto;" (without the quotes). That should centralise the image horizontally on the page. If you want more margin space on the page, you can use the Hspace or Vspace in the Image Info tab in image properties. Hope that helps.
> 0 votes

---
Tags: ckeditor, formatting
---


title: Add new format to civicrm_entity

text:
# Question
Title: Add new format to civicrm_entity
I would like to add a new format to civicrm\_entity. I have tried to create an issue and patch in Github, but I am not experienced so I am stuck what to do next.

Is anyone able to give me a push?

https://github.com/eileenmcnaughton/civicrm\_entity/issues/334

# Answer
Looks like you are mostly there. In the issue link, there is a link to your patch. Click that and you get to your code diff with a 'Create pull request' button at the top. Click that, fill in the information about your change and hit the next 'Create pull request' button.

That will send the request to the repo maintainers who (hopefully) will merge it or request further changes.
> 0 votes

---
Tags: civicrm-entity, git
---


# Question
Title: How to change mailing visibility after sending civimail
My org sent a sensitive civimail to selected constituents and is distressed to realize that they left the visibility setting on "public" as they normally do. How do we change the visibility setting after sending so that the public page is taken down? There is an old thread on a similar question here, but I'm hoping there is a better answer.

# Answer
> 3 votes
You might prefer to use API Explorer rather than SQL.

Using APIv4 Explorer - fill in the ID of your mailing, set the new value of 'visibility' using the dropdown.

# Answer
> 1 votes
In the DB there is a visibility field in the civicrm\_mailing table. Looks like it needs the string rather than a 0/1

---
Tags: civimail
---


# Question
Title: How can I view queued Scheduled Reminders?
Is there a way to view Scheduled Reminders that are scheduled to go out the next time the job runs?

# Answer
> 2 votes
AFAIK Scheduled Reminders are not actually queued, they are selected when the Scheduled Reminders cron job runs. But if they are queued you should be able to see them in the *civicrm\_queue\_item* table.

# Answer
> 2 votes
I had an issue with Scheduled Reminders on Events recently and so looked at this to understand it more, so sharing what I found.

The cron job that fires off Reminders is called **Send Scheduled Reminders**. My issue was it was set to run just daily and thus any intraday reminder would not be sent on time.

Scheduled reminders are stored in the **civicrm\_action\_schedule** table. You can see the ID of the Entity e.g. Event, Contact field etc in the entity\_value column. The 'mapping\_id' column tells you what type of Entity it relates to. Mappings are stored in the **civicrm\_action\_mapping** table. To complete the picture, the **civicrm\_action\_log** table shows you what actions have taken place and with whom.

You can see this system in action most clearly for Events. Create a test Event and then set a reminder e.g. one day before the start of the event, go to your SQL tool of choice and look at the entry in the civicrm\_action\_schedule table. You'll see the ID of the Event itself is shown in that entity\_value column, along with the type of recipient (e.g. participant\_role) in the recipent column. The rest of the columns are pretty much self explanatory and you'll see the mapping\_id relates to the Event entity type if you look.

If you manually create a Scheduled Reminder through Administer \> Communications \> Schedule Reminders for something more obscure e.g. an email going out to a Contact entity on the anniversay of some event marked by a custom field, you'll see the entity\_id as the custom field id stored in the **civicrm\_custom\_field** table.

So, you do need to understand the underlying details of the Entity that the reminder is for, but at least you can see them there!

---
Tags: scheduled-reminders
---


title: Local Extension Updates not appearing

text:
# Question
Title: Local Extension Updates not appearing
How do I make my extension recognise that there is an update available locally?

I have updated the info file, added a function (upgrade 2020) and cleared cache, logged in and out, clicked the refresh button on the extensions page etc.

I've established that even on uninstall and reinstall there is no entry in the civicrm setting table for this extension along the lines of: | 89 | Extension | org.civicoop.civirules:version | s:4:"1005"; | 1 | NULL | 1 | NULL | 2016-03-19 04:28:15 | 203 |

Update: When I go onto the extensions page I encounter: When I go onto the extensions page now I encounter:

Recoverable fatal error: Argument 1 passed to CRM\_Admin\_Page\_Extensions::createExtendedInfo() must be an instance of CRM\_Extension\_Info, null given, called in /var/www/html/civi46/drupal-7.39/sites/all/modules/civicrm/CRM/Admin/Form/Extensions.php on line 75 and defined in CRM\_Admin\_Page\_Extensions::createExtendedInfo() (line 297 of /var/www/html/civi46/drupal-7.39/sites/all/modules/civicrm/CRM/Admin/Page/Extensions.php).

The key variable that it creates the extended info parameter from is null as well. Any ideas?

All suggestions welcome!

Thanks,

JohnFF

# Answer
> 0 votes
For the "CRM\_Admin\_Page\_Extensions::createExtendedInfo() must be an instance of CRM\_Extension\_Info, null given" error: if you cannot get rid of it by clearing the cache and you are sure your extension itself is correct then it can be that the Extensions page is locked in an update.

In this case you can temporary unlock it by commenting and forcing a disabled message

```
//if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
  CRM_Core_Error::statusBounce(ts('The system administrator has disabled this feature.'));
//}

```

then you can get back the admin/extensions page and refresh it.

---
Tags: extension
---


# Question
Title: Payment forms fail with "Unknown api version"
Seemingly after updating CiviCRM to 5.50.3 and webform\_civicrm to 7.x-5.8 on drupal 7.83, webform payments fail. Watchdog says

```
The CiviCRM "contribution transact" API returned the error: "Unknown api version"
when called by function "validate" on line 97 of wf_crm_webform_postprocess.inc
with parameters: "Array ( [credit_card_type] => MasterCard [credit_card_number] => xxxxxxxxxx...[snip]
[form_token] => qnqM4nlUWJSVIPZiCsb57jdigsIZ76jGiG0Aa9a6nyc [form_id] =>
webform_client_form_2556 [op] => Submit [payment_instrument_id] => 1 [payment_processor]
=> 5 [card_type_id] => 2 [pan_truncation] => 7947 [check_permissions] => [version] => 3 )

```

As a result, it appears everything to be handled after payment is not done, storing the payment in civicrm, sending mails/invoices, adding contacts to groups, etc - however, strangely, the payment seems to have been done.

Assuming this string "Unknown api version" comes from Civi/API/Request.php, https://lab.civicrm.org/dev/core/-/blob/fb87724ca7f9fd42560e0729e9e46a3c...

it seems `$params['version']` is not 3 or 4.

It is clear in the error message version is either 3 or '3' - I can't see where the value comes from in `function contributionParams` \- if it comes from a post, it might be a string?

@see https://www.drupal.org/project/webform\_civicrm/issues/3294171

# Answer
Do you have https://civicrm.org/extensions/contribution-transact-api installed? You need that now if using webform with contributions.
> 1 votes

---
Tags: webform-civicrm, payment, drupal-7
---


title: cron jobs not working

text:
# Question
Title: cron jobs not working
Can someone help with debugging why cron jobs aren't activated on my site?

When looking at civiCRM system status under Set-up Cron it says

> No cron runs have been recorded. A cron job is required to execute scheduled jobs automatically.

In the Settings - Scheduled jobs, the Update Membership Statuses (Daily) is activated (along with a few others) with no added parameters but the pop-up window still claims that there is none recorded.

I can execute the job manually but that kind of defeats the purpose.

My CMS guy says that cron works every six hours as per instructions in the docs (picture).

How do I solve this?

Version of Wordpress it's on is 5.9.3

Thanks

# Answer
If you need to use the http method for calling cron, the docs detail That you will need to use wget or curl to pass parameters to the request. The wget will look similiar to:

`wget -O - -q -t 1 'https://example.org/<CONTENT-DIR>/plugins/civicrm/civicrm/bin/cron.php?name=<username>&pass=<password>&key=<site-key>`

I would strongly recommend the wp-cli method in the docs as that will be much more reliable.
> 1 votes

# Answer
You can also call the same url internally with PHP. I found this to be more reliable than an external https call.

Here is an example from the CiviCRM docs. php /your/directory/structure/sites/all/modules/civicrm/bin/cli.php -u user -p password -e Job -a execute
> 0 votes

---
Tags: wordpress, cron
---