# Question
Title: CiviMail - Bounces with "Failed to set sender"
Emails in CiviMail are bouncing with the following error message:

> Failed to set sender: b.17.13.b9ecea4c55fed5e3@example.com \[SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Admi

Outbound email settings are good and test emails sent from there work.

Taking a cue from this post, I looked at "Administer - CiviMail - Mail Accounts."

When using IMAP there, I get the following error:

> An error occured while sending or receiving mail. Failed to connect to the server: my.example.com:143. (See log for more details.)

The log is as follows:

```
Apr 14 06:41:17  [warning] MailSettings: Failed to establish test connection
Array
(
    [exception] => ezcMailTransportException: "An error occured while sending or receiving mail. Failed to connect to the server: my.example.com:143."
#0 /app/data/wp-content/plugins/civicrm/civicrm/vendor/zetacomponents/mail/src/transports/imap/imap_transport.php(403): ezcMailTransportConnection->__construct()
#1 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore/Imap.php(58): ezcMailImapTransport->__construct()
#2 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore.php(76): CRM_Mailing_MailStore_Imap->__construct()
#3 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Mailing/MailStore.php(53): CRM_Mailing_MailStore::{closure}()
#4 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Action/MailSettings/TestConnection.php(28): CRM_Mailing_MailStore::getStore()
#5 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicBatchAction.php(92): Civi\Api4\Action\MailSettings\TestConnection->doTask()
#6 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicBatchAction.php(75): Civi\Api4\Generic\BasicBatchAction->processBatch()
#7 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(72): Civi\Api4\Generic\BasicBatchAction->_run()
#8 /app/data/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(158): Civi\Api4\Provider\ActionObjectProvider->invoke()
#9 /app/data/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(250): Civi\API\Kernel->runRequest()
#10 /app/data/wp-content/plugins/civicrm/civicrm/api/api.php(85): Civi\Api4\Generic\AbstractAction->execute()
#11 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/MailSettings.php(214): civicrm_api4()
#12 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(573): CRM_Admin_Form_MailSettings->postProcess()
#13 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(152): CRM_Core_Form->mainProcess()
#14 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(119): CRM_Core_QuickForm_Action_Upload->realPerform()
#15 /app/data/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform()
#16 /app/data/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle()
#17 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle()
#18 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(334): CRM_Core_Controller->run()
#19 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(140): CRM_Core_Page_Basic->edit()
#20 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Core_Page_Basic->run()
#21 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#22 /app/data/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#23 /app/data/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke()
#24 /app/code/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke()
#25 /app/code/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#26 /app/code/wp-includes/plugin.php(517): WP_Hook->do_action()
#27 /app/code/wp-admin/admin.php(259): do_action()
#28 {main}

)

```

(This is not surprising as my server uses a different port for IMAP, but I'm not sure where to change that in CiviCRM.)

However, the connection succeeds when the Maildir protocol is selected.

I'm not sure if "Administer - CiviMail - Mail Accounts" has anything to do with the bounces in CiviMail, but any help regarding next steps is appreciated.

Using CiviCRM 5.57.0 with Wordpress 6.2.

# Answer
Turns out I needed to enable masquerading on my server which "allows users and apps to send emails with an arbitrary username in the FROM address."

I am now able to send through CiviMail.

I thought of this as the tail end of the error message was:

> (code: 550, response: Authenticated user user@example.com cannot send mail as b.17.14.5c9e67488c7c2078@example.com)
> 3 votes

---
Tags: bounce
---


# Question
Title: Can wildcards be used in Areas Extension?
Areas Extension allows for areas to be defined by postal code. Is it also possible to define areas with postal codes that include wildcards? For example, I might want all the postal codes in the form A1A \*** to be included in my area (otherwise, I have to list the thousands of possible postal codes). Has anyone got something working along these lines? None of the obvious wildcard options seems to work.

# Answer
> 2 votes
I think you'd either have to hack this line https://lab.civicrm.org/extensions/areas/-/blob/e5579b00c9826cfb27cc1bfbdaca932e4cbc5864/Civi/Areas/DefinitionType/PostalCode.php#L40, or do like this example, and in the getWhereClause() do that logic.

---
Tags: untagged
---


# Question
Title: How Do You Generate a Report for Number of Mail Clickthroughs and What The Most Popular Links Were For a Campaign
Here is the scenario: We send daily news updates, they are all assigned the same campaign. I want to be able to see what was the most clicked URL for a given campaign.

Currently I have to export the mail clickthrough report and use the countif and unique functions in excel but that comes with its challenges.

Is there a built in or extension report that I can build something like this?

Wordpress 6.2 and CiviCRM 5.59

# Answer
> 2 votes
This will be possible with SearchKit soon. Mail clicks was just added to APIv4 and SearchKit last week: https://github.com/civicrm/civicrm-core/pull/26016

So you won't be able to use it yet, but it will be possible soon.

---
Tags: civimail, civireport, urls, links, tracked-links
---


title: WordPress Signing Key Required

text:
# Question
Title: WordPress Signing Key Required
WordPress v6.1.1 CiviCRM v5.59.3

So, this is the new thing added for the current CiviCRM. In all honesty, I have no idea what is going on with it or why I need it. I followed the link from inside our CiviCRM to the page that created the Key and added it accordingly, as seen from the image below with respect to adding it after the site key.

# Answer
> 0 votes
No idea why, but apparently the original data never saved. It now works.

Thanks!

---
Tags: wordpress
---


# Question
Title: Email drip campaigns through CiviRules or Chasse?
Edited: specifying our goals.

I'd like to know the process of setting up email "drip" campaigns or marketing series through CiviRules and Chasse.

Could someone explain how each one works? What are the benefits of one over the other?

We'd like to set up three email series:

* A welcome series for non-members with a series of messages asking folks to donate memberships (and ending the campaign if they do buy a membership) _ A welcome series for members thanking them and telling them where their investment will go
* A re-engagement series for people who haven't opened an email in more than a year

# Answer
> 1 votes
We currently use Chasse.

Pros:

* Really great UI.
* Setting up DRIP campaigns is clear
* Integration with Mosaico is good
* We can see where a person is in a DRIP campaign from their contact record
* We can see where a campaign is in its flow through the UI

Cons:

* Only one, but it's major...an individual person can only be part of one campaign at a time.

This one con may cause us to stop using Chasse.

For example, if we have a new member and they get enrolled in the new member campaign, if they then enroll in a year-long class that itself has a DRIP email flow - bingo, that won't work with Chasse.

So. If you are confident that your people will only need to be in one DRIP campaign at a time -- Chasse is fantastic. As soon as that is not the case, Chasse unfortunately is no longer an option.

# Answer
> 0 votes
Welcome to SE!

Chasse is intended for that purpose and is pretty well explained in its documentation here. Ask if there's something specific you don't understand but it's easy enough to install it and experiment.

CiviRules is a more general-purpose tool. It could be used for what you want but will take more setup effort.

---
Tags: civimail, email
---


# Question
Title: How can I include custom field data in an iCal feed?
One of the organisations I work with runs perhaps 70 events or more over the course of a year. Many of these are invitation only, so while we use Civi to handle these events most of them are set as active, but not public, so they don't appear in our main iCal feed, which we use to promote public-facing events.

I'm looking at using the Private iCal extension which gives me the ability to publish feed URLs for events that are not public and filtered by type, which is great. But what I ideally want to do is include in the iCal entry the content of a customer field that I've created for Events.

Any idea how I might go about this?

# Answer
> 1 votes
I've ended up using the Event ICS extension: https://lab.civicrm.org/extensions/eventics – which in its most recent form provides the ability to override the event location by entering whatever you want into the location field provided by the extension on a per-event basis. This lets me keep Zoom URLs off public-facing event information pages whilst still giving useful information to the people registering for the event.

# Answer
> 2 votes
This is an old thread, but we had the same need for passing custom fields for CiviCRM events into a 3rd party calendar app, and figuring it out took a bit of sweat equity so hopefully this will help someone in the future.

You can add the following (or similar) to the **/CRM/Core/Calendar/ICal.tpl** file (ideally save it off into your template folder so it doesn't get overriden with CiviCRM upgrade):

```
{assign var="shortuid" value=$event.uid|substr:16}
{assign var="position" value="$shortuid|strpos:'_'}
{assign var="evid" value=$shortuid|truncate:$position:""}
X-MYCUSTOMFIELD:{crmAPI var='evt_info' entity='Event' action='get' return="custom_45" id=$evid}{foreach from=$evt_info.values item=evt}{foreach from=$evt.custom_45 item=ch name=chapter}
{if $smarty.foreach.chapter.first}{$ch}{else},{$ch}{/if}
{/foreach}{/foreach}

```

It's not super elegant, but I couldn't, for the life of me, figure out how to get the event ID ($event.id or $event\_id or $eventid didn't work) so had to extract it from the $event.uid variable.

---
Tags: civievent
---


# Question
Title: How do I set a default From email in CiviCRM to be used when assigning Activities?
A little help please I am working on a civi system for an organisation that has volunteer supervisors manning the phones and assigning "Activities" to other volunteers. The email to the volunteer should come from a standard email address - Dutyofficer@...

However, the system defaults to the Volunteer supervisors email address and not the Dutyofficer one which is set up and used as default

Any ideas please

# Answer
You could try adding Dutyofficer@... to each volunteer supervisor's record as an Other e-mail address perhaps and making that the Primary address for each - temporarily. That might work. Each volunteer may have to choose to send using that Dutyofficer@... address.
> 2 votes

# Answer
In `Administer -> System Settings -> Outbound Email (SMTP/Sendmail)` there is a setting labelled "Allow mail from logged in contact". If you set this to no, then all assigned activity email will be sent from the default system-wide email address instead of the owner of the activity.

This setting should probably be off by default since email sent from your CiviCRM installation that claims to be from domain names not under your control (like Gmail or Yahoo) will be rejected as fraudulent by most email for providers (for failing SPF and DKIM checks).
> 1 votes

# Answer
Each Volunteer acting as a Duty officer has a login into the wordpress web site which is linked to Civicrm.

I tried adding the Duty officer email address as primary for a test account and added an activty using that account and recieved an email from the personal email address.

The aim of the service is a Good Neighbour scheme - Volunteers will help local people with anything from gardening to hospital visits The process Each person who acts as a duty officer has editor access to the CiviCRM Each Volunteer is a contact (Duty officers are also Volunteers) A person requesting help is logged as a contact.

A telephone call is taken by the duty officer (VOIP system) this request is entered as an Activity - the duty officer assigns task against a volunteer with appropriate skills and times. Civi then sends a confirmation email to the volunteer with details of the activity.

The From email address should be the duty officer - so that reponses are sent back to the logged email address and the private email adresses of volunteers are not shared.

The system also needs to track who is making changes for auditing etc.

Also many thanks Joe for taking the time to look at this
> 0 votes

---
Tags: email
---


# Question
Title: Getting You need to define CIVICRM_DSN in civicrm.settings.php on backdrop
Afternoon everyone,

I'm testing out Civicrm using backdrop and am getting the "You need to define CIVICRM\_DSN in civicrm.settings.php" error. I decided to dig around in /modules/civicrm and noticed the file doesn't seem to exist. There is a template in /templates/crm/common. But it doesn't seem there is a working copy. Just to check I dug around the zipped file and it seems to have the same resultes. Any idea what's going on? Did the install fail or did backdrop not generate civicrm.settings.php during install?

# Answer
This seems to be a bug, but I'm not going to file one for you :-)

You need to create or fix the reference in civicrm.settings.php manually and edit it according to your server settings.

```
<?php
define('CIVICRM_SETTINGS_PATH', '<your server webroot joomla directory>/administrator/components/com_civicrm/civicrm.settings.php');
$error = @include_once( '<your server webroot joomla directory>/administrator/components/com_civicrm/civicrm.settings.php' );
if ( $error == false ) {
    echo "Could not load the settings file at: /usr/www/users/helenmdfpt/joomla/administrator/components/com_civicrm/civicrm.settings.php
";
    exit( );
}

// Load class loader
require_once $civicrm_root . '<your server webroot joomla directory>/administrator/components/com_civicrm/civicrm/CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();

```
> 0 votes

---
Tags: backdrop
---


# Question
Title: I am suddenly receiving the message, "Your database is configured to use the MyISAM database engine
I am suddenly receiving the message, "Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.

I'm running 5.26.1

How will this affect my Wordpress site?

Thank, dt

# Answer
> 0 votes
It happened to me too after upgrading from 5.52.3 to 5.60. This post showed how to fix the 5 temp tables in my system: CiviCRM still creates MyISAM tables which results in Warning It looked like this: mysql\> alter table civicrm\_temp\_2281c543efe9ebaa8e9fd6331f53600d ENGINE=InnoDB; Query OK, 9274 rows affected (0.13 sec) Records: 9274 Duplicates: 0 Warnings: 0 I did that for each InnoDB table it found. Should I change the default\_storage\_engine global from InnoDB to ISAM?

---
Tags: mysql
---


title: Gift Aid reports

text:
# Question
Title: Gift Aid reports
Is anyone aware of any guidance for running a report within Civi for a UK HMRC Gift Aid claim please? I am not a techy person, but a user of Civi for financial reporting for our organisation. Many thanks.

# Answer
I think there is an extension which can do this for you: https://docs.civicrm.org/ukgiftaid/en/latest/submission/
> 2 votes

---
Tags: civireport
---


# Question
Title: System Status Warning can't be resolved - Wordpress Permalinks cache needs to be refreshed
After upgrading from CiviCRM 5.50.1 to 5.59.3 on WordPress 6.0 I am receiving a CiviCRM System Status page warning "Wordpress Permalinks cache needs to be refreshed." Following the link to click "Save" on the Wordpress permalinks page and clicking "Save" doesn't resolve the problem.

Other than clicking the Hide button on the warning, is there another way of resolving this?

# Answer
A minor tweak to the CiviCRM settings.php files fixed the problem on my sites. Here's what I found:

CiviCRM checks the url of active contribution pages to be sure they can be accesed, and if one can't be loaded, assumes that the problem is the wordpress permalink cache. I inserted a little test code on my development server and discovered CiviCRM was actually testing the wrong url for the contribution pages. For example, CiviCRM was checking http://wvecouncil.org/wp/civicrm/contribute/transact/?reset=1&id=1, but the page is actually at http://wvecouncil.org/civicrm/contribute/transact/?reset=1&id=1 (the WordPress subdirectory is in the test url but not the working url).

A few years ago CiviCRM changed how it dealt with front-end urls in WordPress, which eliminated the WordPress subdirectory from the CiviCRM user-front-end url (at least for wp sites configured not to include the wordpress subdirectory in post and page urls). After the change CiviCRM apparently no longer uses the constant named ‘CIVICRM\_UF\_BASEURL’ when constructing the urls for contribution pages (the urls shown in ‘links’ for a contribution page). But the code now checking whether contribution pages can be loaded is using the CIVICRM\_UF\_BASEURL constant from settings.php to construct the test url. If the constant has not been updated since the change, contribution pages will not load during the test, causing the permalink cache warning.

In the case of wvecouncil. org, changing

define( 'CIVICRM\_UF\_BASEURL' , 'https://wvecouncil.org/wp/');

in settings.php to

define( 'CIVICRM\_UF\_BASEURL' , 'https://wvecouncil.org/');

cleared the permalink cache warning. Since this constant being a bit off never caused a problem until recently, I suspect that none of the components enabled on my sites were referencing CIVICRM\_UF\_BASEURL until relatively recently when the contribution page tests were added to CiviCRM.
> 3 votes

# Answer
(Note: I probably should have posted this as a comment rather than an answer, but will leave it since there are relevant comments. My other answer contains a solution).

I manage 3 sites running CiviCRM, all on the same host. After updating to version 5.60.0, two sites have this problem while one does not (the same is true on a development server running on my laptop).

The site not warning about the Permalinks cache problem is not running the CiviContribut component. When I temporarily disable CiviContribute on the other sites the warning no longer appears, so the errant warning seems to be related to the CiviContribute component.
> 0 votes

---
Tags: wordpress, upgrade
---


# Question
Title: Prevent contact from being created with duplicate email (make email unique)
Is there a way to prevent a new contact from being created if the email already exists with another contact?

When a new contact is added, if the email already exists, I would like an error saying that contact can not be created because email already exists.

Thanks

UPDATE: So to add further details about my question...

**OTHER AREAS LIKE EVENTS** One of the comments below stated "if an existing contact tries to use a registration form do you allow or disallow that record to be updated?". So I am not sure exactly how CiviCRM works, but in this case above, I would want the existing contact information to be used, and would not want a new contact created. So I do not want to prevent updating of existing records, I would just want to prevent a duplicate contact with a duplicate email as being created. This particular scenario is probably something I will come across in the near future as we move forward with CiviCRM implementation, but is currently not an issue I have to deal with (yet).

**IMPORTING** I did notice that when I import contacts, I can choose DeDupe rule of EMAIL (RESERVED), and this will correctly skip importing any contact if the email already exists. So this is solved and is not an issue.

**MANUAL ADDING CONTACT** When manually adding a contact though, I am unable to prevent a user from adding a new contact with a duplicate email. I see there is a button that says CHECK FOR MATCHING CONTACT(S) ... If the EMAIL (RESERVED) rule is set to Unsupervised, then click this button does not find a match (even when one exists). If I change the rule to Supervised, then clicking the button will find a match. However this is still not the functionality that I want, as it still does not prevent the user from adding the contact if they either forget to click the CHECK FOR MATCHING CONTACT(S) button or if they choose to ignore the message that it found a match... This is

So what I want to be able to do, specifically for Manually Adding Contacts, is that when the SAVE button is clicked it will just give an error message saying "Contact Email already exists. Can not add new contact", or "Contact Email already exists. Would you like to add it anyways?"

I looked at CiviRules but did not see how I can implement this using that module.

# Answer
> 2 votes
You probably want to reconsider what you want. Having unique email addresses is generally a good thing, and CiviCRM can be set up to help you keep them unique. But there are good reasons that this is not hard-wired as you'll probably discover.

If duplicate emails are getting created that are not what you want, then you probably want to review how that is happening and fix that particular workflow. For example, it might be an employee that is importing contacts without using the dedupe option. Or it might be a registration form that is not configured to dedupe on creation. etc.

In theory, your "supervised" dedupe rule should kick in when an administrator tries to create a new contact with an existing contact's address, but my experiment wasn't successful in testing this theory. If this is working as designed, then you could just update your supervised rule.

But, even without this, you should see super useful messages pop up as you create a new contact using the admin interface, showing potential duplicates.

Perhaps that functionality is not working? Or you might need some training so that you notice it?

A hard "never create contacts with duplicate email addresses" is almost surely going to create new and gnarlier challenges (e.g. if an existing contact tries to use a registration form - do you allow or disallow that record to be updated?).

For completeness, and to answer your question: the civirules extension would likely allow you to create a rule such as you are describing. Caveat Implementor!

# Answer
> 0 votes
Thanks for this information. One of the worst issues with NationBuilder is that email addresses are unique. This is fine until one has to manage partners who use the same email address. This is not uncommon for married couples, especially seniors.

---
Tags: contacts
---


title: DB update failure after update 5.60

text:
# Question
Title: DB update failure after update 5.60
After upgrade to 5.60.0 , I got an error when updating the database :

Error: Add foreign key from civicrm\_job\_log to civicrm\_job

ALTER TABLE civicrm\_job\_log ADD CONSTRAINT FK\_civicrm\_job\_log\_job\_id FOREIGN KEY ( `job_id` ) REFERENCES civicrm\_job ( id ) ON DELETE SET NULL \[nativecode=1025 \** Error on rename of './xxxxxxxx/civicrm\_job\_log' to './xxxxxxxx/#sql-backup-32ca-2de3f' (errno: 168 "Unknown (generic) error from engine")

PEAR\_Exception: DB Error: unknown error in /xxxxx/administrator/components/com\_civicrm/civicrm/packages/PEAR.php on line 921

* DB\_Error: DB Error: unknown error in unknown on line unknown

The site is in Joomla 3.10.11 I tried to restore the DB, and relaunch DB upgrade, but same error.

Any idea how I can solve this issue ?

Antoine

# Answer
> 3 votes
I can also confirm this error occurs on Wordpress CMS.

It stuck at: `[Executed: Add column civicrm_custom_field.fk_entity]`

**SOLUTION**:

After restoring the CiviCRM database from the backup, I did the following:

1. Removed all records from `civicrm_job_log` table by command:

`DELETE FROM civicrm_job_log;`

2. Re-run the update process from CiviCRM main window, and it finished successfully.

# Answer
> 0 votes
We have seen the same error on Drupal 7.x and PHP 7.4. Holding at 5.59 for the timebeing. This is from our post on mattermost:

Hi All,

I'm trying to update to Civi 5.60 from 5.59.4, however once i perform the database upgrades for 5.60 it shows an error near the end with this message: \[Error: Add foreign key from civicrm\_job\_log to civicrm\_job\]

DB Error: constraint violation

Debug info: ALTER TABLE civicrm\_job\_log ADD CONSTRAINT FK\_civicrm\_job\_log\_job\_id FOREIGN KEY ( `job_id` ) REFERENCES civicrm\_job ( id ) ON DELETE SET NULL \[nativecode=1452 \** Cannot add or update a child row: a foreign key constraint fails (`bitnami_civicrm`.`#sql-alter-1820-61d`, CONSTRAINT `FK_civicrm_job_log_job_id` FOREIGN KEY (`job_id`) REFERENCES `civicrm_job` (`id`) ON DELETE SET NULL)\]

I have only found 1 solution on google about this issue, and it didn't seem to work, heres the link to that: CiviCRM Upgrade to 5.60, civicrm\_job\_log foreign key constraint

I was hoping someone here might have any other ideas?

---
Tags: upgrade, joomla
---


# Question
Title: Is there a way to install civiCRM using strapi as CMS
I found that we cannot install CiviCRM independently, and that it requires Wordpress, Joomla, Drupal or Backdrop as CMS. Is there a way to use Strapi instead of these.

# Answer
> 2 votes
Welcome to SE! Short answer: no, CiviCRM requires one of those CMSes.

There is also work underway to revive a standalone version.

If you want to use Strapi (or anything else) for your front-end website then create a separate installation for Civi with a minimal configuration of one of the supported CMSes for the back-end. You can find many other posts on here about integrating separate front-end and back-end sites.

---
Tags: cms-integration
---


# Question
Title: How to get an event registration invoice to the right person?
On a site that I manage we encourage our member contacts to set up and use a user account. This enables us to use automatically applied discount codes for events. We often have a situation where an administrator from one our member organisations is registering multiple people for an event, but not registering themselves.

This ends up with something of a mess in terms of the invoice for the event registrations. The person doing the registration receives nothing, even though they are logged in and therefore presumably known to CiviCRM. Civi assumes that the first registered participant is making the contribution (not the person making the payment), and so the invoice is incorrect, and a copy of this invoice is then sent to everyone other than the person doing the registration. All very messy.

I'd love to have scenario whereby the person making the registrations (regardless of whether they include themselves as a participant) is the person - and the only person - that gets an invoice, and everyone else just gets a notification to confirm that they have registered.

# Answer
> 3 votes
This is a question that comes up quite a lot (assistants registering their bosses, parents registering their kids for summer camps, etc) and there isn't a good solution currently. It would be a great feature if someone wanted to take it on or fund it.

One option is to use a free event fee or price set option that is just for the person who is doing the registering (something like Option A, Option B, I'm just registering other people). Then the person doing the registering is "registered" for the event, but you don't treat that registration option as a real registration — but the downside is this can make registration limits more complicated than they would be otherwise and makes searching and reports more of a pain.

The other option is to use a Webform without registering the first contact for the event and then send the email you want to send via the Webform.

---
Tags: civievent, invoice, participants
---


# Question
Title: Unable to install CiviCRM on Joomla 4.2.9 and 4.3.0 (updated)
We have been fruitlessly trying to install v 5.60.0 in Joomla. At first we tried php 8.2, but had to give up without success. Back to 8.1 gives no better results.

The latest error with php 8.2 is:

```
Failed to start the session because headers have already been sent by "/usr/www/users/helenmdfpt/joomla/libraries/vendor/joomla/database/src/Mysql/MysqlDriver.php" at line 121.

```

Is PHP 8.1 or 8.2 a problem in general with CiviCRM? We have had a large number of error from database tables that can't be created to all sorts of others like this one above.

We always start with a clean slate, delete the previous database, so everything is started from scratch and we've been at this for literally days! Surely this is not normal, but what it wrong here?

Joomla debug is enabled.

```
2023-04-18T18:07:45+00:00       CRITICAL 197.214.119.150        error   Uncaught Throwable of type RuntimeException thrown with message "Failed to start the session because headers have already been sent by "[ROOT]/libraries/vendor/joomla/database/src/Mysql/MysqlDriver.php" at line 121.". Stack trace: #0 [ROOT]/libraries/src/Session/Storage/JoomlaStorage.php(295): Joomla\Session\Storage\NativeStorage->start()
#1 [ROOT]/libraries/vendor/joomla/session/src/Session.php(406): Joomla\CMS\Session\Storage\JoomlaStorage->start()
#2 [ROOT]/libraries/vendor/joomla/session/src/Session.php(333): Joomla\Session\Session->start()
#3 [ROOT]/libraries/src/Session/Session.php(191): Joomla\Session\Session->has('registry')
#4 [ROOT]/libraries/src/Application/CMSApplication.php(656): Joomla\CMS\Session\Session->get('registry')
#5 [ROOT]/libraries/src/Application/AdministratorApplication.php(162): Joomla\CMS\Application\CMSApplication->getUserState('application.lan...')
#6 [ROOT]/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\AdministratorApplication->doExecute()
#7 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#8 [ROOT]/administrator/index.php(32): require_once('/usr/www/users/...')
#9 {main}
2023-04-18T18:08:02+00:00       CRITICAL 197.214.119.150        error   Uncaught Throwable of type RuntimeException thrown with message "Failed to start the session because headers have already been sent by "[ROOT]/libraries/vendor/joomla/database/src/Mysql/MysqlDriver.php" at line 121.". Stack trace: #0 [ROOT]/libraries/src/Session/Storage/JoomlaStorage.php(295): Joomla\Session\Storage\NativeStorage->start()
#1 [ROOT]/libraries/vendor/joomla/session/src/Session.php(406): Joomla\CMS\Session\Storage\JoomlaStorage->start()
#2 [ROOT]/libraries/vendor/joomla/session/src/Session.php(333): Joomla\Session\Session->start()
#3 [ROOT]/libraries/src/Session/Session.php(191): Joomla\Session\Session->has('registry')
#4 [ROOT]/libraries/src/Application/CMSApplication.php(656): Joomla\CMS\Session\Session->get('registry')
#5 [ROOT]/libraries/src/Application/AdministratorApplication.php(162): Joomla\CMS\Application\CMSApplication->getUserState('application.lan...')
#6 [ROOT]/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\AdministratorApplication->doExecute()
#7 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#8 [ROOT]/administrator/index.php(32): require_once('/usr/www/users/...')
#9 {main}
2023-04-18T18:08:04+00:00       CRITICAL 197.214.119.150        error   Uncaught Throwable of type RuntimeException thrown with message "Failed to start the session because headers have already been sent by "[ROOT]/libraries/vendor/joomla/database/src/Mysql/MysqlDriver.php" at line 121.". Stack trace: #0 [ROOT]/libraries/src/Session/Storage/JoomlaStorage.php(295): Joomla\Session\Storage\NativeStorage->start()
#1 [ROOT]/libraries/vendor/joomla/session/src/Session.php(406): Joomla\CMS\Session\Storage\JoomlaStorage->start()
#2 [ROOT]/libraries/vendor/joomla/session/src/Session.php(333): Joomla\Session\Session->start()
#3 [ROOT]/libraries/src/Session/Session.php(191): Joomla\Session\Session->has('registry')
#4 [ROOT]/libraries/src/Application/CMSApplication.php(656): Joomla\CMS\Session\Session->get('registry')
#5 [ROOT]/libraries/src/Application/AdministratorApplication.php(162): Joomla\CMS\Application\CMSApplication->getUserState('application.lan...')
#6 [ROOT]/libraries/src/Application/CMSApplication.php(294): Joomla\CMS\Application\AdministratorApplication->doExecute()
#7 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#8 [ROOT]/administrator/index.php(32): require_once('/usr/www/users/...')
#9 {main}

```

Finally we switched to Joomla's formally recommended PHP 8.0 and now we get:

```
42S22, 1054, Unknown column 'm.home' in 'field list'

```

everthing.pphp has

```
#
#<?php die('Forbidden.'); ?>
#Date: 2023-04-18 18:29:38 UTC
#Software: Joomla! 4.2.9 Stable [ Uaminifu ] 14-March-2023 15:00 GMT

#Fields: datetime   priority clientip   category    message
2023-04-18T18:29:38+00:00   WARNING 197.214.119.150 jerror  42S22, 1054, Unknown column 'm.parent_id' in 'where clause'
2023-04-18T18:30:01+00:00   CRITICAL 197.214.119.150    error   Uncaught Throwable of type Joomla\Database\Exception\ExecutionFailureException thrown with message "42S22, 1054, Unknown column 'm.home' in 'field list'". Stack trace: #0 [ROOT]/libraries/vendor/joomla/database/src/DatabaseDriver.php(1375): Joomla\Database\Pdo\PdoDriver->execute()
#1 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(809): Joomla\Database\DatabaseDriver->loadObjectList()
#2 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(834): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadXml(Object(SimpleXMLElement), Object(Joomla\CMS\Menu\AdministratorMenuItem), Array)
#3 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(666): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadXml(Object(SimpleXMLElement), Object(Joomla\CMS\Menu\AdministratorMenuItem))
#4 [ROOT]/administrator/modules/mod_menu/src/Menu/CssMenu.php(120): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadPreset('default')
#5 [ROOT]/administrator/modules/mod_menu/mod_menu.php(19): Joomla\Module\Menu\Administrator\Menu\CssMenu->load(Object(Joomla\Registry\Registry), true)
#6 [ROOT]/libraries/src/Dispatcher/ModuleDispatcher.php(52): include('/usr/www/users/...')
#7 [ROOT]/libraries/src/Dispatcher/ModuleDispatcher.php(55): Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}('/usr/www/users/...', NULL)
#8 [ROOT]/libraries/src/Helper/ModuleHelper.php(281): Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch()
#9 [ROOT]/libraries/src/Helper/ModuleHelper.php(161): Joomla\CMS\Helper\ModuleHelper::renderRawModule(Object(stdClass), Object(Joomla\Registry\Registry), Array)
#10 [ROOT]/libraries/src/Document/Renderer/Html/ModuleRenderer.php(99): Joomla\CMS\Helper\ModuleHelper::renderModule(Object(stdClass), Array)
#11 [ROOT]/libraries/src/Document/Renderer/Html/ModulesRenderer.php(50): Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render(Object(stdClass), Array, NULL)
#12 [ROOT]/libraries/src/Document/HtmlDocument.php(565): Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render('menu', Array, NULL)
#13 [ROOT]/libraries/src/Document/HtmlDocument.php(848): Joomla\CMS\Document\HtmlDocument->getBuffer('modules', 'menu', Array)
#14 [ROOT]/libraries/src/Document/HtmlDocument.php(633): Joomla\CMS\Document\HtmlDocument->_renderTemplate()
#15 [ROOT]/libraries/src/Application/CMSApplication.php(1017): Joomla\CMS\Document\HtmlDocument->render(false, Array)
#16 [ROOT]/libraries/src/Application/AdministratorApplication.php(417): Joomla\CMS\Application\CMSApplication->render()
#17 [ROOT]/libraries/src/Application/CMSApplication.php(299): Joomla\CMS\Application\AdministratorApplication->render()
#18 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#19 [ROOT]/administrator/index.php(32): require_once('/usr/www/users/...')
#20 {main}

```

I retried the whole thing over on a clean new Ubuntu 22.04 Joomla 4.3.0 installation with XAMPP. It uses PHP 8.2, Apache2 and MariaDB and Joomla works 100%. When I install CiviCRM 5.60.0 though, the installation crashes with error 500. After restoring a snapshot I took before I did the installation, I retried and got this error:

```
2023-04-19T18:06:37+00:00       CRITICAL 192.168.101.11 error   Uncaught Throwable of type Error thrown with message "Failed opening required '[ROOT]/administrator/components/com_civicrm/civicrm.settings.php' (include_path='.:/opt/lampp/lib/php')". Stack trace: #0 [ROOT]/plugins/user/civicrm/civicrm.php(91): plgUserCivicrm->civicrmResetNavigation(0)
#1 [ROOT]/libraries/src/Plugin/CMSPlugin.php(284): plgUserCivicrm->onUserLogin(Array, Array)
#2 [ROOT]/libraries/vendor/joomla/event/src/Dispatcher.php(486): Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}(Object(Joomla\Event\Event))
#3 [ROOT]/libraries/src/Application/EventAware.php(111): Joomla\Event\Dispatcher->dispatch('onUserLogin', Object(Joomla\Event\Event))
#4 [ROOT]/libraries/src/Application/CMSApplication.php(866): Joomla\CMS\Application\WebApplication->triggerEvent('onUserLogin', Array)
#5 [ROOT]/libraries/src/Application/AdministratorApplication.php(341): Joomla\CMS\Application\CMSApplication->login(Array, Array)
#6 [ROOT]/administrator/components/com_login/src/Controller/DisplayController.php(82): Joomla\CMS\Application\AdministratorApplication->login(Array, Array)
#7 [ROOT]/libraries/src/MVC/Controller/BaseController.php(678): Joomla\Component\Login\Administrator\Controller\DisplayController->login()
#8 [ROOT]/libraries/src/Dispatcher/ComponentDispatcher.php(143): Joomla\CMS\MVC\Controller\BaseController->execute('login')
#9 [ROOT]/administrator/components/com_login/src/Dispatcher/Dispatcher.php(45): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()
#10 [ROOT]/libraries/src/Component/ComponentHelper.php(361): Joomla\Component\Login\Administrator\Dispatcher\Dispatcher->dispatch()
#11 [ROOT]/libraries/src/Application/AdministratorApplication.php(143): Joomla\CMS\Component\ComponentHelper::renderComponent('com_login')
#12 [ROOT]/libraries/src/Application/AdministratorApplication.php(186): Joomla\CMS\Application\AdministratorApplication->dispatch()
#13 [ROOT]/libraries/src/Application/CMSApplication.php(293): Joomla\CMS\Application\AdministratorApplication->doExecute()
#14 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#15 [ROOT]/administrator/index.php(32): require_once('/opt/lampp/htdo...')
#16 {main}

```

\[UPDATE\] So I tried again, but without enabling full error reporting, and just "log almost everything" enabled. Here's the log:

```
#
#<?php die('Forbidden.'); ?>
#Date: 2023-04-19 18:46:41 UTC
#Software: Joomla! 4.3.0 Stable [ Bora ] 18-April-2023 16:00 GMT

#Fields: datetime   priority clientip   category    message
2023-04-19T18:46:41+00:00   WARNING 192.168.101.11  jerror  42S22, 1054, Unknown column 'm.parent_id' in 'where clause'
2023-04-19T18:46:42+00:00   CRITICAL 192.168.101.11 error   Uncaught Throwable of type Joomla\Database\Exception\ExecutionFailureException thrown with message "42S22, 1054, Unknown column 'm.home' in 'field list'". Stack trace: #0 [ROOT]/libraries/vendor/joomla/database/src/DatabaseDriver.php(1375): Joomla\Database\Pdo\PdoDriver->execute()
#1 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(809): Joomla\Database\DatabaseDriver->loadObjectList()
#2 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(834): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadXml(Object(SimpleXMLElement), Object(Joomla\CMS\Menu\AdministratorMenuItem), Array)
#3 [ROOT]/administrator/components/com_menus/src/Helper/MenusHelper.php(666): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadXml(Object(SimpleXMLElement), Object(Joomla\CMS\Menu\AdministratorMenuItem))
#4 [ROOT]/administrator/modules/mod_menu/src/Menu/CssMenu.php(120): Joomla\Component\Menus\Administrator\Helper\MenusHelper::loadPreset('default')
#5 [ROOT]/administrator/modules/mod_menu/mod_menu.php(19): Joomla\Module\Menu\Administrator\Menu\CssMenu->load(Object(Joomla\Registry\Registry), true)
#6 [ROOT]/libraries/src/Dispatcher/ModuleDispatcher.php(52): include('/opt/lampp/htdo...')
#7 [ROOT]/libraries/src/Dispatcher/ModuleDispatcher.php(55): Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}('/opt/lampp/htdo...', NULL)
#8 [ROOT]/libraries/src/Helper/ModuleHelper.php(281): Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch()
#9 [ROOT]/libraries/src/Helper/ModuleHelper.php(161): Joomla\CMS\Helper\ModuleHelper::renderRawModule(Object(stdClass), Object(Joomla\Registry\Registry), Array)
#10 [ROOT]/libraries/src/Document/Renderer/Html/ModuleRenderer.php(99): Joomla\CMS\Helper\ModuleHelper::renderModule(Object(stdClass), Array)
#11 [ROOT]/libraries/src/Document/Renderer/Html/ModulesRenderer.php(50): Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render(Object(stdClass), Array, NULL)
#12 [ROOT]/libraries/src/Document/HtmlDocument.php(566): Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render('menu', Array, NULL)
#13 [ROOT]/libraries/src/Document/HtmlDocument.php(849): Joomla\CMS\Document\HtmlDocument->getBuffer('modules', 'menu', Array)
#14 [ROOT]/libraries/src/Document/HtmlDocument.php(634): Joomla\CMS\Document\HtmlDocument->_renderTemplate()
#15 [ROOT]/libraries/src/Application/CMSApplication.php(1025): Joomla\CMS\Document\HtmlDocument->render(false, Array)
#16 [ROOT]/libraries/src/Application/AdministratorApplication.php(425): Joomla\CMS\Application\CMSApplication->render()
#17 [ROOT]/libraries/src/Application/CMSApplication.php(298): Joomla\CMS\Application\AdministratorApplication->render()
#18 [ROOT]/administrator/includes/app.php(61): Joomla\CMS\Application\CMSApplication->execute()
#19 [ROOT]/administrator/index.php(32): require_once('/opt/lampp/htdo...')
#20 {main}

```

It seems the actual error is: "Unknown column 'm.parent\_id' in 'where clause'"

Where do I log a bug?

# Answer
php 8.2 is not supported yet. You will likely not succeed without getting pretty active with the development team: CiviCRM requirements and PHP version notes

I suggest you focus on 8.1 and post a new question with any issues on that path.

For a more sure thing, you may need to find a host that still offers php 7.4
> 0 votes

---
Tags: joomla, php
---


# Question
Title: Use CiviCRM tokens in Drupal welcome e-mails?
I have a site set up using a Drupal rule to create a new user account when a new membership is created.

The new account creation triggers a Drupal welcome e-mail to the user, as defined in the Drupal Account Settings, so it's populated using Drupal variables, e.g. 'Dear \[user:name\]'.

I'm using e-mail addresses for Drupal usernames, but I don't especially want our welcome e-mails to be addressed using only e-mail address. Is there a way to use CiviCRM tokens in Drupal welcome e-mails, so I can address them by name from the contact record?

Even better, most of our individual users inherit their membership from an organisation. If the above is possible, is there also way to use a CiviCRM token to refer to the primary membership? So, for example, I could write something along the lines of, 'An account has been created for you because of your volunteer role with \[parent organisation\]'?

# Answer
You might be able to do something with Drupal Entities and Drupal Tokens. You would replace the default welcome emails with one created by rules. CiviCRM Tokens are used exclusively within CiviCRM.

-Josh
> 1 votes

# Answer
You can use CiviCRM Token module, still in sandbox/development, but it should work. For D8, I've converted this module and it's available at: GitHub.

List of tokens which can support:

```
CiviCRM civi    Tokens related to CiviCRM.
Contact Dashboard   [civi:contact_dashboard]    CiviCRM contact dashborad of current user.
Contact Email   [civi:contact_email]    CiviCRM contact email of current user.
Contact First Name  [civi:contact_first_name]   CiviCRM contact first name of current user.
Contact ID  [civi:contact_ID]   CiviCRM contact ID of current user.
Contact Last Name   [civi:contact_last_name]    CiviCRM contact last name of current user.
Contact Phone Number    [civi:contact_telephone]    CiviCRM contact telephone number of current user.

```
> 1 votes

# Answer
If you use Fuzion's CiviToken, you can get the Drupal username and user ID from within CiviCRM.

You might then be able to create a custom token for use with CiviToken to generate a one-time login URL as a token in some way (user\_pass\_reset\_url?) Use the CiviToken examples and put your custom token in `custom_php/tokens`. (You could also make a custom token to pull the organization name.)

Then you could turn off the Drupal notifications for new accounts and just include these tokens in an email from CiviCRM for new memberships.
> 0 votes

# Answer
You could perhaps sidestep Drupal and

* use CMS User extension to create the Drupal User. this then has the option of using or not using Drupal 'welcome email', therefore do not use it
* use CiviRules to send out the welcome email instead (and perhaps that means you have to just include the link to pw reset rather than include a one-time login as drupal would)
> 0 votes

---
Tags: drupal, tokens, user-account
---


# Question
Title: How to list records from the given custom group via API?
I've custom data stored in custom fields. I've submitted few records as part of the same Contact.

I can use the following API to fetch information about custom group by:

```
$result = civicrm_api3('CustomGroup', 'get', ['id' => 77]);

```

which returns:

```
{

    "is_error": 0,
    "version": 3,
    "count": 1,
    "id": 77,
    "values": [
        {
            "id": "77",
...
            "table_name": "civicrm_value_myform_77",
...
        }
    ]
}

```

In that SQL table, I can see multiple records which belong to Contact (`entity_id=2`).

How I can list those records using API3? In the format that I can count how many records there are.

I can't list based on Contact, because these records belong to the same one.

Basically I'm looking for something like:

```
SELECT COUNT(id) FROM civicrm_value_myform_77 WHERE entity_id = 2

```

# Answer
> 1 votes
First of all I would recommend using API4 for this. If you want to get the custom data with API3 you should be able to do this by returning the "custom\_" + id of the custom field like so:

```
$result = civicrm_api3('Contact', 'get', [
  'sequential' => 1,
  'return' => ["custom_4"],
]);

```

And perhaps you can achieve what you want with something like:

```
$result = civicrm_api3('Contact', 'getcount', [
  'custom_4' => ['IS NOT NULL' => 1],
]);

```

---
Tags: drupal, custom-fields, api, multi-record
---


# Question
Title: Search kit broken and templates not parsed
I have 1 local environment, 1 dev, 1 staging and 1 prod.

Everything is fine on local and dev, but on staging and prod, the SearchKit page looks like that:

The console says:

```
Error: [$injector:unpr] Unknown provider: savedSearchesProvider <- savedSearches <- searchList
https://errors.angularjs.org/1.8.2/$injector/unpr?p0=savedSearchesProvider%20%3C-%20savedSearches%20%3C-%20searchList
    Angular 39
    jQuery 2
    <anonymous> Angular
    jQuery 7
    <anonymous> Common.js:1606
    jQuery 8
 <div ng-view="" class="ng-scope">

```

I tried to cleanup groups and saved searches, as suggested in Search kit list display broken with no results.

I've cleaned-up the cache to.

Why am I stuck like this?

# Answer
> 2 votes
Just found out!

The call was made by **searchList.controller.js** which is automatically loaded from *civicrm/ext/search\_kit/ang/crmSearchAdmin/*

But this file has been removed in CiviCRM 5.42 and its deletion was omitted in one of my upgrades.

just cleaned-up the directory:

```
rm civicrm/ext/search_kit/ang/crmSearchAdmin/searchList.*

```

and everything goes fine.

---
Tags: searchkit, angular
---


# Question
Title: "Update indices" fails because of `foreign key constraint`
A site that was running fine on 5.60.0 for a week or so with no notices. I see today that there is a notice about missing indices:

Ok. I can follow instructions. However on pressing the "Update indices" button I get an error pop-up:

`Operation failed: Update Indices DB Error: unknown error Debug information: DROP INDEX UI_case_contact_id ON civicrm_case_contact [nativecode=1553 ** Cannot drop index 'UI_case_contact_id': needed in a foreign key constraint]`

In poking around here on Stack Exchange I see issues related to the update indices process popping up, but they seem adjacent to my problem rather than the same. I am also struggling to make sense of their solutions, which seem very specific and none of which seem to involve a `foreign key constraint`.

# Answer
I wasn't getting good hits on searching, but following re-links in comments on questions related to indices problems, I found this Question with an accepted answer that solved my problem:

Problem fixing missing indexes after upgrade to 4.7
> 0 votes

---
Tags: database, indices
---


# Question
Title: How fix 'permission denied' on the default /civicrm url in a new install?
CiviCRM is generally working. The default myhost.com/civicrm url has a 'permission denied' error.

The dashboard when using the full link works

# Answer
This is caused by setting the civicrm files directory be under /web/. The web server does not allow directory browsing.

Things that didn't work

* menu rebuild
* cache rebuild
* checking permissions
* comparing the installation
* overriding hook\_toolbar
* debugging AccessManager.php

Looking at the web server error logs, and seeing that 403 was on the directory provided the hint.
> 1 votes

---
Tags: installation
---


# Question
Title: JSON syntax to set custom date field with current date/time using a civirules action
In a civirules action I would like to set a custom participant field to the current date/time using the action 'Set Custom Field on any entity'

What json can I use for current date/time to set a custom date? (or might there be another smart workaround)

> $now() does not do the job

# Answer
This exact thing came up for me this week.

Just use the word "now", without quotes. No json.

It uses api3 to set the value so anything api3 understands will work.
> 2 votes

---
Tags: civirules, participants
---


# Question
Title: How to replace deprecated CRM_Core_OptionGroup::getValue with CRM_Core_PseudoConstant::getKey
I am trying to fix problems in an extension that relies on the deprecated (now removed) `CRM_Core_OptionGroup::getValue` but am unsure of the details of the new code.

The Developed Docs give useful details of the suggested replacement, e.g. (`CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status', 'Completed')`): https://docs.civicrm.org/dev/en/latest/framework/pseudoconstant/

* How do I identify the relevant BAO name for this, however?
* And what is the appropriate replacement for `CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL);`?

Is there any developer documentation about how to replace deprecated methods in general?

# Answer
You can use API4 to fetch the Options or value of the option

```
$optionValue = \Civi\Api4\OptionValue::get()
  ->addSelect('value')
  ->addWhere('name', '=', 'Completed')
  ->addWhere('option_group_id:name', '=', 'contribution_status')
  ->execute()
  ->first()['value'];

```
> 1 votes

---
Tags: extension
---


# Question
Title: Membership Import Fails on Queue Runner After Upgrade to 5.52
We recently upgraded all our sites running Civi 5.50 to 5.52. Now we cannot complete membership imports. We weren't timing out previously on data sets of up to 1,000, sometimes more. But now we cannot get past the "queue runner" screen. Checking the logs we see an ajax error of the type that it fails to complete or get to the next task.

We've been reading through the notes on the latest commits herehttps://lab.civicrm.org/dev/core/-/issues/1031 as well as the documentation here : https://docs.civicrm.org/dev/en/latest/framework/queues to try to figure out what could be going on.

This appears to be a change that was made to the import process in 5.51 per the release notes https://civicrm.org/blog/dev-team/civicrm-551-release

interestingly, the contact imports seem to work even tho it hangs on the same screen.

but the membership wont update or allow "insert new."

We see this error:

> $CRM\_Queue\_Page\_AJAX\_runNext\_error = Exception: "Failed to claim next task" #3098 -then- civicrm/CRM/Queue/Page/AJAX.php(36): CRM\_Queue\_Runner-\>runNext(TRUE) #1 (closed) civicrm/CRM/Queue/ErrorPolicy.php(89): CRM\_Queue\_Page\_AJAX::{closure}() #2 (closed) civicrm/CRM/Queue/Page/AJAX.php(38): CRM\_Queue\_ErrorPolicy-\>call(Object(Closure)) #3 (closed) civicrm/CRM/Core/Invoke.php(285): CRM\_Queue\_Page\_AJAX::runNext() #4 civicrm/CRM/Core/Invoke.php(69): CRM\_Core\_Invoke::runItem((Array:17)) #5 civicrm/CRM/Core/Invoke.php(36): CRM\_Core\_Invoke::\_invoke((Array:4)) #6 (closed) civicrm/drupal/civicrm.module(471): CRM\_Core\_Invoke::invoke((Array:4)) #7 (closed)

More details here: https://lab.civicrm.org/dev/core/-/issues/1031

is there something that needs to be enabled or installed to get the imports to run successfully and previously?

Since we have multiple sites all using civimember - any assistance appreciated.

# Answer
> 2 votes
I do not want to take credit for this solution because I worked with @eileen to do this. I do however want this to be easy for someone else to find.

I ran the following queries and this issue (in my case for contact imports) was solved.

1.

```
DELETE FROM civicrm_queue WHERE runner IS NULL;

```
2. DELETE FROM civicrm\_user\_job;

As always you should always backup your database before running any queries on it.

# Answer
> 0 votes
If you have access to the database you should be able to find the created import temp table - if so - is the `_status_message` column populated?

---
Tags: civimember, data-import
---


title: Soft Credits Section Does Not Load

text:
# Question
Title: Soft Credits Section Does Not Load
When I try to add an offline contribution the soft credits portion of the screen shows a PHP Warning rather than the fields for the soft credit.

The warning is

> Warning: Undefined array key "siteHasPCPs" in /var/www/private\_fs/civicrm/templates\_c/en\_US/%%6F/6F7/6F7BB438%%Contribution.tpl.php on line 378

The only solution I have found is changing line 378.

The line I have is `<?php if ($this->_tpl_vars['siteHasPCPs'] && ! $this->_tpl_vars['payNow']): ?>`

If I add `?? NULL` after `$this->_tpl_vars['siteHasPCPs']` the line becomes  `<?php if ($this->_tpl_vars['siteHasPCPs'] ?? NULL && ! $this->_tpl_vars['payNow']): ?>`

This change makes the form load as expected.

Before making changes to the code I tried flushing the caches and deletting the templates so that CiviCRM can regenerate them. For each of these attempts I get no change to the issue.

I am running CiviCRM 5.59.3 with Drupal 9.5.5.

I think this was happening before the upgrade but I cannot be positive. I Googled with some different terms this morning and found an issue related to this on the CiviCRM GitLab instance. https://lab.civicrm.org/dev/core/-/issues/4006#register-pane

If I get an answer there I will update this question.

Thanks!!

# Answer
> 0 votes
This fix on GitLab solves the problem for this specific file. I found other places that this is happening and I will need to work on those on their own.

---
Tags: forms, soft-credit
---


# Question
Title: How to specify database on D9 installation
This question was asked regarding wordpress but is also an issue for D9. When installing from the extend page in Drupal, there is no option to specify the schema for Civi, so all the tables end up mixed with Drupal. The solution of manually moving the tables and editing civicrm\_settings.php seems hackish.

Did I just miss the configuration step for this?

# Answer
> 1 votes
If you start by configuring the separate database in civicrm\_settings.php before enabling the module, the database tables will be created in the seperate database.

If you already have half installed CiviCRM, like me, with the drupal module installed but not the database then cv is your answer. CV allows you to specify the database connection string

```
cv core:install --cms-base-url=https://www.doinggood.org/ --db mysql://doinggood_crm:pass@localhost/doinggood_user

```

---
Tags: installation
---


title: Automatically renew Free Membership

text:
# Question
Title: Automatically renew Free Membership
We have 3x Membership types, two paid and the other free. All appear on the same signup form.

When a free membership is created, the auto-renew flag is set correctly, and a Recurring Contribution is created for $0. However when the membership is due to be renewed the membership does not renew and it goes into an inactive state.

I am able to search for the members and manually update the expiry date but I would like to find a way to automatically do this (even if it's via CiviRules). I can create a Smart Group which contains all the relevant members, but I can't use CiviRules to renew the membership.

Does anyone know the best way to automatically renew $0.00 (free) memberships on their renewal date?

System:

* CiviCRM 5.59.3
* WordPress 5.2
* CiviRules 2.47

# Answer
So far as I know, autorenew is driven by the payment processor: Stripe, PayPal, GoCardless etc determine that a new payment is due based on the payment schedule that has been setup. They charge the customer and notify CiviCRM via a webhook of the new payment. CiviCRM then records the payment and updates the membership.

In the case of free membership, there is no external payment processor to trigger that renewal. There may not be a CiviRules action for that, but it shouldn't be too hard to write. But since core's UI lets you create an autorenewing free membership it would seem there should be a core method for doing the renewal, probably as a scheduled job. I'd suggest writing it up as an enhancement suggestion on https://lab.civicrm.org/dev/core/-/issues
> 1 votes

---
Tags: civimember, civirules, auto-renew, renewals
---


# Question
Title: Schedule reminder send also to the staff
Currently, our members receive a reminder one day before their membership is about to expire. We'd like that inside the team 2 persons receive as well this reminders so we can reply to this automatic message and follow it by something more personal to the member category.

Is this possible using CiviCRM? We use Wordpress. Thank you in advance for all the help!

# Answer
> 2 votes
Take a look at using the "Also include" option: https://docs.civicrm.org/user/en/latest/email/scheduled-reminders/#limiting-or-adding-to-your-recipient-list

"If you want to send a scheduled reminder to contact(s) who do not meet the general criteria for that reminder you should set **Limit or Add Recipients** to **Also include.** You can then select a group of contacts or an individual who will receive the reminder even if they don't meet the other criteria."

So you can then put your 2 staff members in a group or manually add both.

---
Tags: scheduled-reminders
---


# Question
Title: I there way to intercept the API4 call made for SearchDisplay run
We are building a search form using a search kit. Based on saved search name

```
    [
      [
        "SearchDisplay",
        "run",
        {
          "return": "page:1",
          "savedSearch": "Member_Player_Search",
          "display": "Table",
          "sort": [
            [
              "sort_name",
              "ASC"
            ]
          ],
          "limit": 50,
          "seed": 1682511192645,
          "filters": {
            "last_name": "test",
            "first_name": "user"
          },
          "afform": "afsearchPlayerSearch"
        }
      ]
    ]

```

Example :

```
if (!empty($filter['last_name'])) {
  $filter['custom_123'] = 1;
}
// custom_123 is boolean field of Yes/No.

```

If the last name is not empty in the filter then I want to add an additional filter before making a call to contact api. (through hook)

Is this feasible ?

I tried using the search kit tool **fx** `if/else` functionality but was not able to figure it out in the UI to make the same condition.

Drupal 9, CiviCRM 5.57

# Answer
I think the apiWrapper hook can do this (it's deprecated, but scroll down to see how to implement it the new way)
> 1 votes

---
Tags: searchkit, search-builder
---


# Question
Title: Send "Thank you" after bulk import contributions
I'd like to import a lot of contributions monthly. After import is done, I can create a custom search, to find all members, who's contributions are imported, and can send them a "Thank You"-letter, but my question is, if is it possible to send "Thank You" emails immediately, automatically after the import? (I've tried to create a rule in CiviRule, but I Can't find out, how to send "thank You" mail.)

CMS: Drupal 7, CRM: CiviCRM 5.60

Thank you!

# Answer
> 2 votes
In CiviRules, you can add a `Send E-mail` Action with an email template that you've created at Administer - Communications - Message Templates. You can use a `Contribution is added` Trigger, but you'll need to figure out a condition that will only select your imported contributions. Maybe Financial Type, Campaign or Payment Method would work? Or perhaps you could use a custom Contribution Status and then change them all after?

---
Tags: contributions
---


title: Running CiviCRM on WordPress.com?

text:
# Question
Title: Running CiviCRM on WordPress.com?
Has anyone run CiviCRM on WordPress.com?

In a chat with WordPress.com, they said it would run (given that you had the business plan which allows plugins).

However, I feel like CiviCRM is more than just a typical WordPress plugin. :)

# Answer
> 0 votes
https://stats.civicrm.org/?tab=sites says there are ~2,800 WP sites with CiviCRM.

And yes it is more than a typical WP Plugin. It is a whole CRM - with a level of 'potential' (or complexity) that WP itself offers.

Hosting of CiviCRM is also an important consideration: https://docs.civicrm.org/installation/en/latest/planning/hosting/

---
Tags: wordpress.com
---


# Question
Title: Show source code in HTML / wysiwyg editor in Events
The source code button is missing from certain areas, such as event summary and event description. Any ideas on how to access it?

# Answer
It's possible to have different config for ckeditor for civievent. See https://yoursite.org/civicrm/admin/ckeditor?preset=civievent. (Replace `yoursite` with your actual site.)
> 0 votes

---
Tags: civievent, ckeditor
---


# Question
Title: how to manipulate attachments using API V4 in CiviCRM 5.60
So I am kinda new to civiCRM, I am using the API v4 and creating cases with it. but I have two questions about the attachments. the attachments are linked to the activity and the activity is linked to the case. so in order to get the attachements we need to get throw all those tables.

*PS: attachments are referred as File in the api explorer.*

in the API V4 explorer, we notice that we need a join in order to link the activity and case and for that we have an entity bridge called caseActivity it works just fine. but for the File and Activity entities we don't have an entity bridge like caseActivity. so my question is how can we link between Activity and File entities knowing that we have a SQL table called civicrm\_entity\_file that has the data we need for the join.

so the final goal is to get a case based on it's ID and get the attachments and the activity.

Another question I have : how to do the upload (File) using the API v4 ?

# Answer
> 1 votes
There was an ongoing discussion at chat.civicrm.org and also at https://github.com/civicrm/civicrm-core/pull/25845. Short answer is it's not implemented yet.

---
Tags: wordpress, civicrm-entity
---


# Question
Title: What should be included in /web/libraries/civicrm/packages?
This related to CiviCRM 5.60.0 running on Drupal 9.

We recently upgraded from Drupal 7 to Drupal 9, and found a problem in uploading images when editing message templates, which was traced to the `kcfinder` directory missing from `/web/libraries/civicrm/packages`. This was replaced with the copy from the Drupal 7 site, which solved the problem.

However, while I have identified two corresponding 'package' directories in D7 and D9 ( `/sites/all/modules/civicrm/packages` and `/vendor/civicrm/civicrm-packages` ) in D9 there is also `/web/libraries/civicrm/packages`. I have no reference to know if there is anything else missing from the latter; is the following list correct?

With thanks, Tony

# Answer
It's supposed to contain a copy of "web-accessible resources" from vendor/civicrm, meaning jpg, css, etc files.

Sometimes it gets out of sync. You can fix with `composer civicrm:publish`. Add the `-D` flag to do a complete wipe+copy.

(Ideally, instead of copies, civi would make these files available the "drupal" way, as assets declared and provided by the module, but civi is not *really* a drupal module.)

Kcfinder is known to be problematic though with civi+drupal 9 for other reasons too. You might want to give https://lab.civicrm.org/extensions/summernote a try, since last I checked it had a working file browser, and had some advantages over ckeditor5 (like a view-source button). I don't know the timeline for ckeditor4, but replacing it solves the file browser problem.
> 0 votes

# Answer
I have carried out "composer require ..." commands as in the live site composer.json file (into a scratch directory) and it installs the libraries shown above (at least the top-level directories), except IDS, but no others.

Unless running the install process creates some more, then it looks as if our site is now complete - though I have no idea what caused kcfinder to go missing in the first place.
> 0 votes

---
Tags: install
---


# Question
Title: Sending membership renewal / expired reminders is not working
All,

I've read the similar questions to this and that hasn't given me any solution yet.

CiviCRM currently 5.58.1, WordPress 6.2. We've had this website up for a bit over a year now so we just started running into having annual memberships require renewing. Memberships were not given the auto renew option at all because of a prior bug that broke payment processing, but thankfully that has since been resolved so I re-enabled auto-renew as an optional thing, so the membership scheduled reminder UI at least gives me something now.

I also just enabled the 'Update Membership Statuses' job, which I thought I did before but clearly didn't. That at least makes the New members Current, and the two members who are past their end date who haven't manually gone to renew their membership are now status of Grace.

Other schedule reminders work just fine (e.g. for events), so that mechanism is working.

I'm trying to set up three distinct scheduled reminders:

One for Membership Renewal reminders Entity Membership, types selected, Renewal Reminder (non-auto-renew memberships only) Trigger date 7 days before membership end date. Record activity for automated email checked Was going to try repetition every 3 days until 1 hour before membership end date, but currently do not have repeat enabled to just get this to work. Effective start date was last beginning of last month. From name and email entered, checked Scheduled Reminder active. Filled out email template etc. (Although I'll have to look more closely at how to use tokens, as some like membership.end\_date seem to be just for filling that value into the email, but others like membership.membership\_type\_id:label and contribution.contribution\_page\_id:label seem to either be also to fill in the value (membership type) or require you to specify which e.g. contribution page you want. Will work on that once I see some emails being sent...)

One for auto-renewal reminder: Entity Membership, types selected, for Auto-renew Memberships Only trigger 7 days before membership end date Record activity for automated email checked No repeat From name, email, set Scheduled Reminder Active checkbox set Email template created

And finally, one for Expired membership Entity Membership, type selected, Reminder for Both for auto renew options Trigger 1 hour after membership end date Record activity for automated email checked Effective start date beginning of this month From name, email, etc. etc. all set like above (different template of course)

Scheduled jobs log says everything's being processed, but no emails are being sent.

Does the membership Status have to be Expired? As in, will this be sent to Grace member status folks, even though the end date is past? I don't see anything about membership status in the reminder configuration, so am assuming it doesn't matter here.

Do these not trigger unless the condition (e.g. 7 days before) is exactly met, which would make it hard to catch folks who slipped through the cracks already?

Any other ideas as to what I'm not doing right?

Thanks.

Michael

# Answer
Once again, just asking the question by writing it down led me to try more things. The culprit seems to have been me not understanding those tokens; once I fixed that after getting a fatal error message and log file, emails were sent. And it does catch any member who should have gotten a notification at, e.g., T-7 days before membership end, so the trigger date does not have to be exactly as specified.
> 2 votes

---
Tags: civimember, scheduled-reminders
---


# Question
Title: Is there a clean URL for upgrading the CiviCRM database (WordPress)?
Is there a clean URL equivalent of the database upgrade URL? I can use
**example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fupgrade&reset=1**
but **example.org/civicrm/upgrade&reset=1** doesn't do anything?

Thanks.

# Answer
> 2 votes
AFAIK - you need another /civicrm in your url, but that loads the content on your front end pages - clean URLs as you present are mainly for front end no?

for example

https://example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Ftag&reset=1 becomes https://example.org/civicrm/civicrm/tag/

---
Tags: wordpress, upgrade, clean
---


# Question
Title: Emails being send to explicitly excluded contacts
In a recent mailing we noted that CiviMail is not respecting the "excluded" groups option. In this case, we were contacting people to respond to a survey, and created a group for those who had already responded. The intention was to send reminders only to those that did not yet respond, so logically the email recipients would be "Survey group" (parent group) minus "Responded group" (child group). However, multiple contacts in the "Responded group" received the email (though not all contacts). Is there a way to troubleshoot why this isn't working as expected, or are our expectations wrong? Could this be because we sent the mailing to a parent group of the "Responded group"? Running CiviCRM 5.58.1 on Joomla 3.10.11.

# Answer
Rather than sending the follow up to the Parent Group, why not send it to the recipients of the first email, rather than to the Group that was the target of the first email - which might avoid any such parent/child confuddling, if that was in fact the issue
> 2 votes

---
Tags: civimail, groups
---


# Question
Title: Is there a way to use css pagination / repeating elements with dompdf?
Is there a way to use css pagination with the current version of dompdf shipped with CiviCRM? Like:

```
@page :footer {content: "page " decimal(pageno);}

```

The issue is that I want some content that is repeated on every page. In a dompdf issue on Github it is claimed that using fixed positioning is another way to achieve this. But we have tried this solution in CiviCRM PDF templates and it does not have that effect.

# Answer
To self-answer my question after 2 years+, too: In the meantime, we have decided to rely on wkhtmltopdf and solve the problem there with a custom wrapper script, with which page numbers, headers, footers etc. can be defined as needed. Of course, this would also be a solution for dompdf.

As @Fabian mentioned, Civioffice is certainly also a good solution for the problem according to usecase.
> 1 votes

# Answer
The dompdf in civi is the latest 0.8.6. If you're asking if dompdf itself supports pagination, I don't know offhand - that would be a dompdf question.
> 0 votes

---
Tags: pdf, css
---


# Question
Title: what is the format or encoding of files in the content property when creating an attachment entity in civicrm API V3
I tried many things like base 64 or just using the php function `file_get_contents` but when i check the civicrm UI and click on the attachment it doesn't work (for images for example it says unrecognized format). So what is the proper way to use the content property in the create action in the API V3

# Answer
> 0 votes
There's a unit test at https://github.com/civicrm/civicrm-core/blob/3a822c76c86397199c53f750e71081d548f45a96/tests/phpunit/api/v3/AttachmentTest.php#L93-L100 and https://github.com/civicrm/civicrm-core/blob/3a822c76c86397199c53f750e71081d548f45a96/tests/phpunit/api/v3/AttachmentTest.php#L316-L319 that together describe how to use this. Putting them together it would be:

```
civicrm_api3('Attachment', 'create', [
  'entity_table' => 'civicrm_activity',
  'entity_id' => $activityId,
  'name' => 'example.png',
  'mime_type' => 'image/png',
  'description' => 'My test description',
  'options' => [
    'move-file' => 'temporary/path/to/example.png',
  ],
]);

```

---
Tags: civicrm-entity, files
---


# Question
Title: Is there any way to conduct an online survey?
According to Civi Documentation, "CiviCampaign has a feature that enables offline surveys...", which implies that there is no way to "send" a survey to a group/set of contacts (like online event registrations). Is this correct, or is there a way to create a survey, and send it to a group/list, etc. of contacts to complete & submit the survey?

Using CiviCRM version 5.52.2

Thank you!

# Answer
> 2 votes
You can conduct a simple survey in civicrm by creating a Profile with the Custom Fields you need for the survey, and then either expose this form publicly or send out a link with a checksum to give existing contacts access to the form without needing to re-enter their contact details

# Answer
> 1 votes
Webform CiviCRM is pretty good fur surveys, if you're using Drupal.

---
Tags: civicampaign, civisurvey
---


# Question
Title: CiviEvent - On Waitlist will not Enable in Participant Status - Wordpress site - "Enable" word toggle greyed out - how to Enable?
Testing out CiviEvent. We whish to enable waitlists, but when we go to the Participant Status window, the line for "On Waitlist" and "Pending from Waitlist" are greyed out. Trying to click on "Enable" does nothting.
How can we get waitlists enabled for events? Wordpress site with Civc CRM as a plugin

# Answer
> 0 votes
Looks like you have a problem that jQuery isn't loading. I see this in the console:

```
Mixed Content: The page at 'https://conordicclub.org/cagney/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fparticipant_status&reset=1' was loaded over HTTPS, but requested an insecure script 'http://conordicclub.org/cagney/wp-content/plugins/civicrm/civicrm/js/jquery/jquery.crmEditable.js?r=YrcT7en_US'. This request has been blocked; the content must be served over HTTPS.

```

Seems like some kind of issue with the base url or something along those lines.

---
Tags: civievent, waitlist
---


# Question
Title: Where does the QR Code Extension store the value "enable qr code token for this event" in Database?
I installed the "QR Code Checkin" Extension in CiviCRM 5.58.1 with Drupal. When I create a new event, I can activate "enable qr code token for this event". Now, I want to update my event registration confirmation email text (custom System workflow message template for events): I want to check if the QR Code token is enabled for this event, and if yes, include the QR Code. So I think I need to access the "enable qr code token for this event" variable via the API (Smarty).

Does anybody know how I can access this variable via API/Smarty? Or where the QR Code Extension stores this variable in the database? I checked in the table `civicrm_event` but couldn't find this variable. There is no other table having sth like "token" in the name except "payment token". Any hint is appreciated.

# Answer
I don't know where it is in the database, but on the Online registration tab of each event after installing the module I now have that selection and the token is available to use in emails.
> 0 votes

---
Tags: civievent, extension, api
---


# Question
Title: Creating a contact view that includes custom profile fields
Struggling with this one so hope the wiser heads on here can help.

I've created some custom fields for my volunteers and created a profile so I can view these

So running this "advanced search" then displays the list of contacts with the fields I want to be able to see at a glance

However I cannot work out how to make this a saved search that other users can easily run whenever they want.

Everything I have tried has resulting in losing the extra fields I want to display.

# Answer
You set the profile in the Civi \>\> Admin \>\> Customize data and screens \>\> Save Preference. This will keep the column same for all contact search result.

Alternatively you can use searchkit to build your own search with columns and filters.
> 1 votes

---
Tags: contact-view
---


# Question
Title: Filter two activities by date in same searchkit query
I've built a stack exchange query

Search for activity type a

* return "with" contact, actiivity date- some custom data

I want to add in custom data from another activity (type B) that happened on the same day for the same contact

So i can include activity contacts activities- where type is type b

Some contacts have more than one type b activity

But the ones I'm interested in happen on the same day as the type a activity

Can I use activity date a as a filter/comparison to limit the type b activities that show in mmy search?

Does this even make sense? Is it possible?

Any answers appreciated- here to learn!

# Answer
The SearchKit interface does not let you do that (yet!). But if you get the query close to what you want and export it into a `.mgd.php` in your extension, then you might be able to add in the missing condition by hand.
> 1 votes

---
Tags: searchkit
---


# Question
Title: Error TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars()
I've just updated to Drupal 9.5.9 and CiviCRM 5.60.0 and I'm getting the following error when trying to load the System Status page:

```
TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() (line 432 of /home/xxxxx/www/www/web/core/lib/Drupal/Component/Utility/Html.php)

#0 /home/xxxxx/www/www/web/core/lib/Drupal/Component/Utility/Html.php(432): htmlspecialchars(Array, 11, 'UTF-8')
#1 /home/xxxxx/www/www/web/core/lib/Drupal/Component/Render/FormattableMarkup.php(270): Drupal\Component\Utility\Html::escape(Array)
#2 /home/xxxxx/www/www/web/core/lib/Drupal/Component/Render/FormattableMarkup.php(216): Drupal\Component\Render\FormattableMarkup::placeholderEscape(Array)
#3 /home/xxxxx/www/www/web/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat('CiviCRM', Array)
#4 /home/xxxxx/www/www/web/core/lib/Drupal/Component/Utility/ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#5 [internal function]: Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#6 /home/xxxxx/www/www/web/core/includes/theme.inc(1372): strip_tags(Object(Drupal\Core\StringTranslation\TranslatableMarkup))
#7 [internal function]: template_preprocess_html(Array, 'html', Array)
#8 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): call_user_func_array('template_prepro...', Array)
#9 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render('html', Array)
#10 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#11 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render(Array)
#12 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#13 /home/xxxxx/www/www/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#14 /home/xxxxx/www/www/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#15 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#16 /home/xxxxx/www/www/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#17 /home/xxxxx/www/www/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#18 /home/xxxxx/www/www/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#19 /home/xxxxx/www/www/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /home/xxxxx/www/www/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /home/xxxxx/www/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /home/xxxxx/www/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /home/xxxxx/www/www/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /home/xxxxx/www/www/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /home/xxxxx/www/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /home/xxxxx/www/www/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /home/xxxxx/www/www/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#28 {main}

```

Everything else appears to be running fine and if I generate status messages by logging out/in or clearing the cache, I just had a couple of extensions to update, so nothing obvious. Also, there's nothing in the CiviCRM logs.

I've tried to search on here but there doesn't seem to be anything recent/similar?

# Answer
> 1 votes
Apply this patch, or downgrade drupal to 9.5.8.

https://github.com/civicrm/civicrm-drupal-8/pull/82

---
Tags: error, system-status
---


title: Updating Credit Card Payment

text:
# Question
Title: Updating Credit Card Payment
I need to update my payment credit card information to CiviCRM. The card on file is expired and I cant figure out how to update.

# Answer
> 1 votes
Welcome Lisa!

Whether you can update your credit card information is dependent on the organization whose CiviCRM you're using. Some payment processors (e.g. PayPal) allow updating expired credit cards. Others do not.

You are hopefully receiving an email each month confirming that your recurring payment went through. If you have the ability to update your credit card information directly through CiviCRM, there should be a link toward the bottom of the email that you can click to update your card information. If not, you should reach out directly to the organization.

---
Tags: profile
---


# Question
Title: CivicRM 5.60 installation on WordPress 6.2 in Local 6.7.0 fails
I am trying to install CivicRM for WordPress site in Local environment https://localwp.com/. I unzip the CivicRM (5.60), I place the folder into app/public/wp-content/plugins/ folder. I see the plugin in WP admin interface. I click activate, install starts, but it fails shortly after and the whole WP site becomes unusable.

PHP: 8.0.22 MySQL: 8.0.16 WP: 6.2 webserver: nginx \[!\[error in the wordpress backend\]\[1\]\]\[1\]

I tried to run the install a couple of times with different PHP, MySQL and webserver settings in Local, no change. \[1\]: https://i.stack.imgur.com/l92PJ.png

# Answer
Based on that screenshot - for whatever reason, the CiviCRM data wasn't loaded into the database. Is it intentional that your MySQL database name for CiviCRM is `local`?

You can probably work around this by manually loading the contents of `civicrm_generated.mysql` (found in `<webroot>/wp-content/plugins/civicrm/civicrm/sql`) into the database you specified as the CiviCRM database (which you can also double-check in `<webroot>/wp-content/uploads/civicrm.settings.php` in the `CIVICRM_DSN` constant).
> 0 votes

---
Tags: wordpress, installation
---


# Question
Title: Resend all registration confirmation emails for an event
Is it possible to resend all registration confirmation emails for an event at once?

We have an event with a large number of price set options for different workshops over a weekend. When participants registered, they received the event registration confirmation message which includes details of each event including location with link to a map using the description for the price set option. However, some people registered two months ago and we'd like to send them a reminder that includes all these details the week before the event, so they don't have to dig out that old email to have their personal schedule for the weekend. I can edit each participant individually and resend the confirmation email, but that's going to take a long time for a couple hundred participants. Is there a better way?

# Answer
It turns out that the Custom Event Communication extension makes this possible by triggering the email on a change of participant status (in our case, I'll just change all Registered to Attended and trigger on that status change). This is even better than I was hoping, because now I can specify a specific message template instead of having to edit the default one and then change it back.

Edit: If you want to try this, make sure you test this by changing participant status from the drop down menu, rather than by editing the participant, as it seems the tokens for the participant data available to the template can be different in these two situations.
> 1 votes

# Answer
You can *almost* do it from advanced search:

1. Display As: Contributions
2. In the contribution section choose financial type Event Fee (or whatever you're using).
3. In the events section choose the event.
4. Search
5. From the actions dropdown choose "receipts - print or email". It's smart enough to use the event message template.

The problem is if they have registered for another event as well, then it will show up in the results too, but you can sort by "source" and then the one event should all be grouped together. The extra results happen because it's finding contacts who have participated in the selected event and listing **all** their contributions that match the criteria in contribution section. If you know something about the contributions, like the date range is unique to this event, then you could further filter in that section and it should only show those.

By the way this also works with searchkit, but it has the same problem. But maybe someone can figure out how to get around it there.
> 0 votes

---
Tags: civievent, registration, confirmation
---


# Question
Title: CiviCRM in a separate database keeps testing the Drupal database on update
I've installed Drupal (9) and CiviCRM (5.59) in separate databases using `drush site:install` and `cv core:install` in that order. The drupal database connection is set in `settings.php`, and the civi database connection is set in `civicrm.settings.php`.

It works, until it doesn't.

Amongst others (I think), on a Drupal core update, Civi believes it lives in the Drupal database and tries to run tests there. It doesn't have the right permissions (TRIGGERS and such), and everything fails. It also creates all civi tables in the drupal db (I think already on `drush site:install`, which it never uses during operation.

What is wrong ? How can I tell CiviCRM to always work in it's own database ?

# Answer
> 2 votes
Do you have civicrm\_entity installed? See https://www.drupal.org/project/civicrm\_entity/issues/3299224#comment-15013847

---
Tags: database, drupal-9
---


# Question
Title: Error: Class "CRM_Dkbrapi_APIWrapper_Attachment" not found in dkbrapi_civicrm_apiWrappers()
This is my first module in CiviCRM and I have the example from the documentation but I can't get it to work. Every time I try to run in CiviCRM API Explorer v3 for attachments I get the following: Error: Class "CRM\_Dkbrapi\_APIWrapper\_Attachment" not found in dkbrapi\_civicrm\_apiWrappers() (line 14 of \[Drupal 9 Path\]\sites\default\files\civicrm\ext\dkbrapi\dkbrapi.php).

-\> dkbrapi.php

```
<?php

function dkbrapi_civicrm_apiWrappers(&$wrappers, $apiRequest) {
  if ($apiRequest['entity'] == 'Attachment' && $apiRequest['action'] == 'create') {
    if ($apiRequest['version'] == '3') {
      $wrappers[] = new CRM_Dkbrapi_APIWrapper_Attachment();
    }
  }
}

```

Class file Attachment.php in CRM/Dkbrapi/APIWrapper

```
<?php
class CRM_Dkbrapi_APIWrapper_Attachment implements API_Wrapper {
  public function fromApiInput($apiRequest) {
    // do some stuff

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

```

What do i wrong?

# Answer
Some things to check:

* Check that your info.xml has lines like this:
```
<classloader>
  <psr0 prefix="CRM_" path="."/>
  <psr4 prefix="Civi\" path="Civi"/>
</classloader>

```
* Clear civi cache: Administer - system settings - clear caches
> 1 votes

---
Tags: drupal, api
---


# Question
Title: Using Form Builder -- "How many additional people will you be bringing?"
Using Form Builder, I want to ask "How many additional people will you be bringing?" and provide the options for 1,2, 3, or 4 additional people. How do I set this up in CiviCRM's Form Builder?

# Answer
This can be accomplished using "Custom Fields". In the menu, click

*Administer \> Customize Data and Screens \> Custom Fields*

Create a new one with your "Field Input Type" being "Drop-Down (select list)" with your options \[1, 2, 3, 4\]. Here's a section in the User Guide that explains Custom Fields:

https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/

Once you add the custom data, you should then be able to add it to Form Builder.
> 0 votes

---
Tags: formbuilder
---


# Question
Title: Set a default Financial Type when adding New Contribution?
When I add a New Contribution, the Financial Type is required, but it is not preselected.

I would like to set a specific Financial Type as a defualt so it is already selected in the Financial Type dropdown when I click on New Contribution.

Is there a setting for this somewhere? I looked thru all the Admin menus but could not find one.

Thanks

EDIT:

I accepted the answer below about using a hook, but also posted a more detailed answer here: How to create a custom extension/module (with an example)?

# Answer
There isn't any such setting to set by default financial type on backend new contribution form.

However you can set it default programatically to a specific FT using buildform hook by calling $form-\>setDefault(\['financial\_type\_id' =\> 1\]); or JS.

It would be nice to have a config where you could set the default financial type to be so that you don't need to hard code in php/js
> 2 votes

# Answer
You can also use the Entity Templates extension to set up templates of contribution defaults. There can be a few tricks, but if you're willing to update the templates via API you can customize quite well (e.g. set receive\_date: null to still have it default to today).
> 0 votes

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


# Question
Title: How do I generate a csv report or csv export of CiviEvent participants that includes membership status information?
My organization is running CiviCRM 5.51.4. We have a conference and run registration through CiviEvent. We have separate events for regular paid participants, vendors, students, and complimentary tickets. We have a large membership who are already in CiviCRM and register through a token-containing link in an email we send them, however, non-members can and do register for our conference.

We have tried the following through CiviReport:

1. We are able to run an Event Report that will show us all event attendees but does not show us membership status.
2. We are able to run a Membership Report that will show us membership information for event attendees but doesn't show us attendees who aren't registered.
3. We are able to run a Contact Report that will show us all event attendees and their membership information but it's only available as an HTML or PDF, not CSV.

We have tried the following in an Advanced Search:

1. Displaying Results As = Contacts, selecting the event, and then exporting as CSV. This only allows us to select 'Date of Last Membership Payment' as an export field, which is not necessarily indicative of whether or not the person is a current member.
2. Displaying Results As = Memberships, selecting the event, and then exporting the results as CSV. This gives duplicate lines for people with expired/cancelled memberships etc and it doesn't list nonmember event attendees.

We ended up just using the Search Builder to make a CSV of people whose Membership Status = Empty who attended the event and compared that to the #2 result from CiviReport above.

Is there a way to produce a CSV file of every attendee of an event with a column for membership status?

# Answer
> 2 votes
If you use SearchKit, you could find:

* Contacts
* with (required) Contact Participants (using if Event ID and
Status)
* with (optional) Contact Membership (conditions as appropriate)

Then on the top right of the results table, you can add columns for the contact, membership and participant to your table and then do Action - Download Spreadsheet. Date formats can be challenging with this, but it should give you everything you want in one table. If you want to reformat anything, you can add a table and that gives you some flexibility to use Smarty on the results.

If some of your contacts have more than one event registration or membership, you might want to use Group By Contact ID and maybe list Field Transformations, so you just have one line per contact.

---
Tags: civievent, civimember, civireport, export
---


# Question
Title: Install Civicrm ESR on Buildkit wp-empty build
I am trying to set up a local development environment to test new extensions with an ESR version of CiviCRM (currently CiviCRM 5.45.6). To this end I use the civicrm-buildkit-docker projekt. So far I was successful to build recent version of CiviCRM based on wp-demo. I have access to the .zip files of the ESR Versions of Civicrm. Therefore, my plan was to set up a build based on wp-empty and then to manually install these CiviCRM versions either with the user interface or by unpacking the zip file in the wp-content/plugins folder and to activate CiviCRM in the user interface. With both approaches I was not successful:

1. Installing with the user interface I am redirected to a page stating: 'The link you followed has expired.'
2. Unziping the .zip file in the wp-content/plugins folder, I do see CiviCRM in the plugin list. If I then try to activate the plugin I get into following PHP-Errorrs:

```
Fatal error: Uncaught CRM_Core_Exception: [0: Found installation canary. This suggests that something went wrong with tracking installation process. Please post to forum or JIRA. thrown in /buildkit/build/soziokultur/web/wp-content/plugins/civicrm/civicrm/Civi/Core/InstallationCanary.php on line 37

```

```
CRM_Core_Exception: Found installation canary. This suggests that something went wrong with tracking installation process. Please post to forum or JIRA. in /buildkit/build/soziokultur/web/wp-content/plugins/civicrm/civicrm/Civi/Core/InstallationCanary.php on line 37

```

Can anyone tell me, how to go about this or which way I could go to set up a development environment based on the ESR version of CiviCRM?

# Answer
EDITED: I think with the docker image you would run the civibuild command, rather than extracting manually. So something like:

```
civibuild create my-site --type wp-empty --civi-ver 5.57

```
> 0 votes

---
Tags: developer, civicrm-buildkit, esr
---