# Question
Title: Fatal error when emailing specific participant list
I get the following fatal error when trying to send an email (under 50 addresses) to a list of participants for one specific event. I can successfully email a participant list from another event.

I'm using CiviCRM 5.36.1 with Drupal 6 (Pressflow 6.56).

I'd really appreciate any ideas how to fix this.

$Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => exceptionHandler ) [code] => -3 [message] => DB Error: constraint violation [mode] => 16 [debug_info] => INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) VALUES ( 8527 , 45914 , 'b22a018b6ac6959f' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`purcosacoza`.`civicrm_mailing_event_queue`, CONSTRAINT `FK_civicrm_mailing_event_queue_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)] [type] => DB_Error [user_info] => INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) VALUES ( 8527 , 45914 , 'b22a018b6ac6959f' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`purcosacoza`.`civicrm_mailing_event_queue`, CONSTRAINT `FK_civicrm_mailing_event_queue_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)] [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) VALUES ( 8527 , 45914 , 'b22a018b6ac6959f' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`purcosacoza`.`civicrm_mailing_event_queue`, CONSTRAINT `FK_civicrm_mailing_event_queue_contact_id```

BACKTRACE

```Message  $backTrace = #0 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/Error.php(942): CRM_Core_Error::backtrace("backTrace", TRUE) #1 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error)) #2 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/db/DB.php(998): PEAR_Error->__construct("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...") #3 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-3, 16, (Array:2), "INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...") #4 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -3, 16, (Array:2), "INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...", "DB_Error", TRUE) #5 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7)) #6 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-3, NULL, NULL, "INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...", "1452 ** Cannot add or update a child row: a foreign key constraint fails (`pu...") #7 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php(406): DB_mysqli->mysqliRaiseError() #8 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...") #9 [...]/static/import/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2696): DB_common->query("INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...") #10 [...]/static/import/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1245): DB_DataObject->_query("INSERT INTO `civicrm_mailing_event_queue` (`job_id` , `email_id` , `hash` ) V...") #11 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(639): DB_DataObject->insert() #12 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Mailing/Event/BAO/Queue.php(41): CRM_Core_DAO->save() #13 [...]/static/files/purcosa.co.za.files/civicrm/ext/com.pesc.sparkpost/sparkpost.php(280): CRM_Mailing_Event_BAO_Queue::create((Array:3)) #14 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Utils/Hook.php(275): sparkpost_civicrm_alterMailParams((Array:9), "singleEmail") #15 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(74): CRM_Utils_Hook->runHooks((Array:165), "civicrm_alterMailParams", 2, (Array:9), "singleEmail", NULL, NULL, NULL, NULL) #16 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(172): CRM_Utils_Hook_DrupalBase->invokeViaUF(2, (Array:9), "singleEmail", NULL, NULL, NULL, NULL, "civicrm_alterMailParams") #17 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent), "hook_civicrm_alterMailParams", Object(Civi\Core\CiviEventDispatcher)) #18 [...]/static/import/public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:1), "hook_civicrm_alterMailParams", Object(Civi\Core\Event\GenericHookEvent)) #19 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(129): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_alterMailParams", Object(Civi\Core\Event\GenericHookEvent)) #20 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Utils/Hook.php(167): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_alterMailParams", Object(Civi\Core\Event\GenericHookEvent)) #21 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Utils/Hook.php(1218): CRM_Utils_Hook->invoke((Array:2), (Array:9), "singleEmail", NULL, NULL, NULL, NULL, "civicrm_alterMailParams") #22 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Utils/Mail.php(179): CRM_Utils_Hook::alterMailParams((Array:9), "singleEmail") #23 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/BAO/ActionSchedule.php(639): CRM_Utils_Mail::send((Array:9)) #24 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/BAO/ActionSchedule.php(298): CRM_Core_BAO_ActionSchedule::sendReminderEmail(Object(Civi\Token\TokenRow), Object(CRM_Core_DAO_ActionSchedule), "50360") #25 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/BAO/ActionSchedule.php(372): CRM_Core_BAO_ActionSchedule::sendMailings(3, "20210505200124") #26 [...]/static/import/public_html/sites/all/modules/civicrm/api/v3/Job.php(207): CRM_Core_BAO_ActionSchedule::processQueue("20210505200124", (Array:2)) #27 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_send_reminder((Array:2)) #28 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(149): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8)) #29 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8)) #30 [...]/static/import/public_html/sites/all/modules/civicrm/api/api.php(22): Civi\API\Kernel->runSafe("Job", "send_reminder", (Array:1)) #31 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/JobManager.php(134): civicrm_api("Job", "send_reminder", (Array:1)) #32 [...]/static/import/public_html/sites/all/modules/civicrm/CRM/Core/JobManager.php(66): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob)) #33 [...]/static/import/public_html/sites/all/modules/civicrm/api/v3/Job.php(118): CRM_Core_JobManager->execute(FALSE) #34 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_execute((Array:2)) #35 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(149): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8)) #36 [...]/static/import/public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8)) #37 [...]/static/import/public_html/sites/all/modules/civicrm/api/api.php(22): Civi\API\Kernel->runSafe("Job", "execute", (Array:2)) #38 [...]/static/import/public_html/sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc(1361): civicrm_api("Job", "execute", (Array:2)) #39 [...]/tools/drush/includes/command.inc(422): drush_civicrm_api("Job.execute", "auth=0") #40 [...]/tools/drush/includes/command.inc(231): _drush_invoke_hooks((Array:37), (Array:2)) #41 [...]/tools/drush/includes/command.inc(199): drush_command("Job.execute", "auth=0") #42 [...]/tools/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch((Array:37)) #43 [...]/tools/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch() #44 [...]/tools/drush/drush.php(12): drush_main() #45 {main}

# Answer
> 2 votes
I eventually found the error for this problem, which was triggering an error for CiviEvent registrations and event reminders. Guidance from @Demerit and @petednz should have led me to it sooner.

The problem was caused by an email address with a 9-letter top level domain, and regex in sparkpost.php which assumes that top level domains are between 2 and 4 characters but see https://en.wikipedia.org/wiki/List\_of\_Internet\_top-level\_domains#Brand\_top-level\_domains .

I changed the regex from 2,4 to 2,24 and the problem is resolved.

# Answer
> 0 votes
What version of that sparkpost extension do you have? It looks pretty old. It's not inserting a contact\_id when it needs to. Maybe need to update to latest master version from github manually.

---
Tags: email, participants, drupal-6
---


# Question
Title: Is there a way to insert Case Type definitions?
I have a Drupal/CiviCRM instance (v 5.19.3) that I have inherited. It seems much of the custom work was done prior to version 4.6. And then it was upgraded to 5.19.3 without updating the customizations. One customization is the case types. They appear in two locations, a Civi extension (xml/case/\*.xml) and under custom templates (sites/all/custom\_templates/CRM/Case/xml/configuration) - yes, the directory setting for the custom templates is correctly set. Both directories contain the same files, which at this point are customized versions of the Civi core HRD xml files (sites/all/modules/civicrm/CRM/Case/xml/HRD).

When I attmept to load the Civi Case Types page (https://\[site\]/civicrm/admin/options/case\_type?reset=1), I am getting an fatal error. This happens regardless of whether I attempt to load the types from the menu or using the API.

* civicrm/ajax/rest?entity=CaseType&action=get&json=%7B%22options%22%3A%7B%22limit%22%3A0%7D%7D \- **message: $Fatal Error Details = Array ( \[message\] =\> \[code\] =\> )**

Back Trace:

> $backTrace = #0 /var/www/instance/sites/all/modules/civicrm/CRM/Core/Error.php(343): CRM\_Core\_Error::backtrace("backTrace", TRUE) #1 /var/www/instance/sites/all/modules/civicrm/CRM/Core/DAO.php(1195): CRM\_Core\_Error::fatal() #2 /var/www/instance/sites/all/modules/civicrm/CRM/Case/XMLRepository.php(96): CRM\_Core\_DAO::getFieldValue("CRM\_Case\_DAO\_CaseType", "", "definition", "name") #3 /var/www/instance/sites/all/modules/civicrm/api/v3/CaseType.php(102): CRM\_Case\_XMLRepository-\>retrieve("") #4 /var/www/instance/sites/all/modules/civicrm/api/v3/CaseType.php(81): \_civicrm\_api3\_case\_type\_get\_formatResult((Array:4), (Array:5)) #5 /var/www/instance/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(101): civicrm\_api3\_case\_type\_get((Array:3)) #6 /var/www/instance/sites/all/modules/civicrm/Civi/API/Kernel.php(168): Civi\API\Provider\MagicFunctionProvider-\>invoke((Array:9)) #7 /var/www/instance/sites/all/modules/civicrm/Civi/API/Kernel.php(99): Civi\API\Kernel-\>runRequest((Array:9)) #8 /var/www/instance/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel-\>runSafe("CaseType", "get", (Array:3), NULL) #9 /var/www/instance/sites/all/modules/civicrm/CRM/Utils/REST.php(316): civicrm\_api("CaseType", "get", (Array:3)) #10 /var/www/instance/sites/all/modules/civicrm/CRM/Utils/REST.php(566): CRM\_Utils\_REST::process((Array:3), (Array:3)) #11 /var/www/instance/sites/all/modules/civicrm/CRM/Core/Invoke.php(256): CRM\_Utils\_REST::ajax() #12 /var/www/instance/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM\_Core\_Invoke::runItem((Array:12)) #13 /var/www/instance/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM\_Core\_Invoke::\_invoke((Array:3)) #14 /var/www/instance/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM\_Core\_Invoke::invoke((Array:3)) #15 /var/www/instance/includes/menu.inc(517): civicrm\_invoke("ajax", "rest") #16 /var/www/instance/index.php(21): menu\_execute\_active\_handler() #17 {main}

The definitions for the Case Types in the database are set to NULL. Is the definition value supposed to be an array based on the XML activity types listed in the xml file? Note that it seems the old names/titles were only slightly different. At this point there are cases for each of the IDs listed below. All of the activity types listed in the xml's are the same for each case and the client would like to consoldiate all the Cases under one Case Type. The Civi extension calls a hook\_civicrm\_caseTypes when it is enabled and disabled. And though this hook is being called, it only updates is\_active field to true or false based on being enabled or disabled (currently, the ones it updates have is\_active set to 0, when enabled they are 1). It does not update the definitions.

```
+----+------------------------------+------------------------------+-------------+-----------+-------------+--------+------------+
| id | name                         | title                        | description | is_active | is_reserved | weight | definition |
+----+------------------------------+------------------------------+-------------+-----------+-------------+--------+------------+
|  1 | Civil And Political          | Civil And Political          | NULL        |         1 |           0 |      1 | NULL       |
|  2 | Economic Social And Cultural | Economic Social And Cultural | NULL        |         1 |           0 |      2 | NULL       |
|  3 | Gender Issues                | Gender Issues                | NULL        |         1 |           0 |      4 | NULL       |
|  4 | LGBT                         | LGBT                         | NULL        |         1 |           0 |      5 | NULL       |
|  5 |                              | Environmental                | NULL        |         0 |           0 |      3 | NULL       |
|  6 | CivilAndPolitical            | Civil And Political          | NULL        |         0 |           1 |      1 | NULL       |
|  7 | EconomicSocialAndCultural    | Economic Social And Cultural | NULL        |         0 |           1 |      1 | NULL       |
|  8 | Environmental                | Environmental                | NULL        |         0 |           1 |      1 | NULL       |
|  9 | GenderIssues                 | Gender Issues                | NULL        |         0 |           1 |      1 | NULL       |
+----+------------------------------+------------------------------+-------------+-----------+-------------+--------+------------+

```

Is there a way to insert the Case Type definitions from the existing xmls? Is this the approach you would use or do you have another suggestion for how I should approach this problem? How can I get the Case Types to load in the UI?

I appreciate your help.

# Answer
> 4 votes
When stored in files the definition field is null.

See also What are the pros and cons of using external xml files for CiviCase configuration?

But if you just want to consolidate all under one type, just turn off the hook extension and run a SQL statement `update civicrm_case set case_type_id=1`, and then delete all the case types except id 1 and set is\_active manually to 1 for it. Then configure the activities for the type in the UI.

Also move all the xml files out of the way.

---
Tags: civicase
---


# Question
Title: civimcrestface-wordpress get "Unable to decode supplied JSON"
I try to get civimcrestface-wordpress working. I get the error "Unable to decode supplied JSON" I used https://subdomain.domain.de/wp-content/plugins/civicrm/civicrm/extern/rest.php as URL.

Wordpress 5.7.2 CiviCRM 5.38.0

# Answer
I found the solution in https://github.com/CiviMRF/civimcrestface-wordpress/commit/f7f76ba0a8ab1fe602a17db5805af7769e95497d

It works after I used the URL https://my-civi.org/wp-json/civicrm/v3/rest
> 2 votes

---
Tags: wordpress
---


# Question
Title: Is it possible from web interface to export Notes' dates?
We are attempting to download all details on some of our donors, including the notes, but do not see among the fields to be exported the date of Notes. We can export the Note itself, but no details about it despite being able to see it on the individual contacts' profiles. We also do not have access to the backend and cannot create MySQL or other scripts to get to it. Are we SOL?

# Answer
> 2 votes
Just had a quick play on the demo site and notes and note date fields become searchable/ accessible using the Data Processor extension.

Add note as data source, and contact as additional data source if you want to export note and related contact record at same time (linking Note Entity ID and Contact ID)

And then add a csv export as a data output

---
Tags: export, dates
---


title: CiviCRM and SharePoint

text:
# Question
Title: CiviCRM and SharePoint
We run both CiviCRM and SharePoint. I've looked at the CiviCRM SharePoint extension, but:

1. It didn't work - it gave errors.
2. We are looking at exposing CiviCRM contacts in SharePoint - we don't need document sets, but just an external list with the CiviCRM data.

It looks as though SharePoint likes to get external data via the Odata format. Has anyone any experience of that?

I suppose it might be possible to devise something that populated SharePoint list from contacts, perhaps based on the SharePoint extension.

Any suggestions?

# Answer
If you want to show CiviCRM data in Office 365, I would rather considering using Microsoft Power BI.

https://civicrm.stackexchange.com/a/39681
> 1 votes

---
Tags: contacts
---


# Question
Title: Are relative dates available as data processor filters?
Is there a way to set up the date filter options in Data Processor, so that they use the relative dates available in Civi?

(e.g: this week, previous quarter etc)

Can't see a way to do this at first look. Might make the resulting reports easier to use for some of my colleagues.

# Answer
If it is for use inside CiviCRM, I have found it better to just use «Field filter» for dates, instead of «Date filter». Then you get those options out of the box.

However, for usage with API calls, it is probably better with «Date filter», since then you can control the date format output.
> 1 votes

---
Tags: data-processor
---


# Question
Title: How to set Thank-You Letter template to start the next letter on a new page
Drupal 7.69 CiviCRM 5.20

We use Thank-You letters for our Year-end receipts. We use line-items for our fund accounting. If a donor gives monthly to more than 2 funds, the search result for the letter is too long to fit on one page. So it starts the next letter on the partial page. If the results are short enough, it all works great. How do I force it to start each letter on full pages?

Here is my message template code

```
<table border="0" style="width: 900px;">
<tbody>
    <tr>
        <td width="30%"><img height="auto" src="log url here" width="275" /></td>
    </tr>
    <tr>
        <td style="text-align:left; font-weight: bold; padding-top:60px;" width="50%">{contact.addressee}</td>
        <th style="padding-top:60px; text-align:center; color:#70551F;padding-left:100px; ">2019 Contribution Statement</th>
    </tr>
    <tr>
        <td style="text-align:left; " width="40%">{contact.street_address}</td>
        <td style="text-align:center; font-style: italic; color:#281c1d;padding-left:100px;  ">January 1, 2019 - December 31, 2019</td>
    </tr>
    <tr>
        <td width="40%">{contact.city}, {contact.state_province} {contact.postal_code}</td>
        <td style="text-align:center; font-style: italic; color:#281c1d; padding-left:100px; ">Federal Id # 27-4638772</td>
    </tr>
    <tr>
        <td colspan="2" style="text-align:center; color:#70551F; padding-top:20px; padding-bottom:20px;">____________________________________________</td>
    </tr>
</tbody>

```
Thank you for your support of Radius International in 2019

No goods or services were received for these Tax Deductible contributions

Date Cont ID Contribution Designation Amount {$date} {$contribution.id} {$lineitem.label} $ {$lineitem.line\_total} 2019 Total Contributions $ {$contribution\_aggregate}

# Answer
I cannot tell you how to do a page break and it probably also depends on your pdf library (e.g. dompdf or wkhtmltopdf).

You could however consider using one of the existing extensions for donation receipts to create the Year-end receipts. There are several around, one we created quite a while ago can be found here: https://github.com/systopia/de.systopia.donrec

The documentation can be found here: https://wiki.civicrm.org/confluence/display/CRM/DonationReceipts+Extension
> 1 votes

# Answer
I would create two templates, one for single page, and one for two pages. And then search for those with too many contributions to fit one page.

And then use page-break

https://civicrm.stackexchange.com/a/6606
> 1 votes

---
Tags: message-templates
---


title: Has TurfCutter been abandoned?

text:
# Question
Title: Has TurfCutter been abandoned?
I managed to get the TurfCutter extension installed using the command line and the menu item shows up, but it's not working. It hasn't been updated in two years, so maybe it doesn't work with newer versions of CiviCRM? Is anyone using TurfCutter? Has it been abandoned? I emailed the developer, but no reply yet. Are there programmers we can hire to fix it? I'm using current versions of CiviCRM and WordPress.

https://civicrm.org/extensions/turfcutter

https://www.youtube.com/watch?v=ofrRT1Lmatg

https://gitlab.com/asludds/civicrm-turfcutter

# Answer
> 1 votes
Depending on what exactly you need to accomplish, you can get a similar function from the proximity search in civi under Search - Custom Searches - Proximity Search.

If you haven't already you'll need to set up geocoding/mapping in core: `https://{your-site}/civicrm/admin/setting/mapping?reset=1`

---
Tags: wordpress, civicrm-home
---


title: Checksum not being enforced?

text:
# Question
Title: Checksum not being enforced?
Using Drupal 7.81, CiviCRM 5.36.1 with webform intergration.

I have created a webform that pre fills the contact name. This link is sent to anonymous users from CiviMail. Using the tokens, CiviMail generates a URL containing the cid1 and the checksum. Testing this, it seems I can change the cid1 to another contact ID and see the details pre filled. I thought that the checksum prevents this?

I have also tried generating a checksum from the Contact Checksum Utilities extension, but I get the same behaviour.

The webform is set to block unknown users and anonymous users are not permissioned in drupal to see CiviCRM data. Is there another setting I am potentially missing?

# Answer
> 4 votes
I've just tested this and thankfully I wasn't able to recreate the issue.

In your settings for the 'Existing Contact' component, please could you check that the 'Enforce Permissions' checkbox is selected? It should be ticked by default. This should prevent viewing of other peoples' data.

# Answer
> 3 votes
Here's a small Drupal 7 module that checks if the combination of contact id and checksum is valid. I wrote it 3 years ago when I had the same problem as you described.

You can find it here: https://github.com/AlainBenbassat/webformchecksumchecker

---
Tags: webform-civicrm, checksum
---


title: CiviCRM database upgrade

text:
# Question
Title: CiviCRM database upgrade
I have a Joomla! CiviCRM installation (civi version 5.10.4). This has some functionality issues (reports do not work correctly). I no longer need Joomla! so is there a route to install latest CiviCRM and then put the existing (but updated) CiviCRM database into it?

I dont know if the issue with the current installation is code or data. Doing this will eliminate any code issue.

Any suggestions on how to do this or alternative approaches are very welcome.

many thanks Dave

# Answer
> 2 votes
CiviCRM sits on top of Joomla, WordPress, Drupal or Backdrop so even if you don't need the content of your current Joomla content, you still need one of those CMS's for CiviCRM. You could install a new Joomla server and then copy CiviCRM to it (https://docs.civicrm.org/sysadmin/en/latest/misc/switch-servers/) or you could just delete the unneeded content from Joomla.

However, it sounds like your main issue is with CiviCRM reports rather than Joomla. The CiviCRM database and code need to be running at the same version level otherwise you will get various errors. I'd start by upgrading to the latest CiviCRM version on your current server - see https://docs.civicrm.org/sysadmin/en/latest/upgrade/joomla/ Basically you update the CiviCRM code first then run the update scripts to make the necessary changes to the database. Make sure you take a backup before starting the upgrade.

---
Tags: upgrade, installation
---


# Question
Title: How to configure CiviEvent for high volumes of repeating events (>800 events/month)?
We are a small museum now installing CiviCRM on Wordpress. We conduct walking tours for museum visitors: 4 tours/day, 7 days/week. We would like to offer on-line registration for the tours. I'm imagining a form that would let on-line visitors select the date and the time-of-day (10am, 12, 2, 4pm) and pre-pay the tour fee. This type of repeating event doesn't seem appropriate for CiviEvent's Repeating Event mode of operation because we would have upwards of 4x7x30=840 events per month and only a small portion would have any participants. Is there a work-around for what we want to do.

# Answer
I recommend to **use CiviEvent's built-in repeat-function** in order to achieve this.

Define one template per timeslot (https://docs.civicrm.org/user/en/latest/events/event-templates) and batch-create the child-items (https://docs.civicrm.org/user/en/latest/events/repeating-events/).

We handle 5000+ events/year like this without any problems.
> 2 votes

# Answer
Sorry, I can't answer your question but 4 tours per day 7 days a week doesn't get your 800 events a month - only approx 120 per months. You don't have 30 weeks in a month but only 4 to 5 weeks.
> 1 votes

# Answer
An alternative to generating the events in CiviCRM itself would be to use the CiviCRM Event Organiser plugin. This would enable you to sync Events provided by the Event Organiser plugin with Events in CiviCRM. Using Event Organiser would give you a calendar and list of events in WordPress out of the box and, IMO, its UI for generating repeating event schedules is rather good.
> 0 votes

---
Tags: civievent, repeating-events
---


# Question
Title: civicrm mail() success message but no email sent (log de-activated)
I migrated to a new server and have the exact settings as on the old server. On the new server, I press test and save for mail() and get a message, that the test email was sent successfully, but I never receive it. Cron job is running. Logs are de-activated and when I activate it temporarily I can see the test email message in the log. I also tested smtp with a few stmp servers like google mail and domain factory but failed (no success message). I prefer to stay with mail(), but I don't know what could be wrong. Any hints how to proceed from here? civicrm 5.38 and wordpress. mysql 8 and php 7.4

# Answer
The error message is about permissions so you need to check what user you are specifying in your cron command and check the permissions for that user. The required permissions are documented here.

Does it work if you manually run the scheduled job as an admin user? Go to `Administer > System Settings > Scheduled Jobs` Find the 'Send Scheduled Mailings' job, click `more` then `Execute now`.
> 0 votes

---
Tags: civimail
---


# Question
Title: Why is a custom field not appearing in forms after changing its type from CheckBox to Select?
A custom field was originally created as HTML type CheckBox (with Options Per Line set). This was later changed to type Select, using the *Change Input Field Type* facility in the Edit Field form. After this change, the field fails to appear in edit forms: the label displays but the Select field is missing.

# Answer
I found that if a Select field has `options_per_line` set in `civicrm_custom_field`, then it fails to render, as described. A workaround is to unset Options Per Line in the UI before changing the field type, or set `options_per_line` to NULL in the database. The Select field then renders as it should.
> 2 votes

---
Tags: custom-fields, forms
---


# Question
Title: No Default With Webform CiviCRM Options Field
I have a couple CiviCRM Options fields on a Drupal 9 Webform. I want to make it so there is no default value. There is an option to choose the default but I have not selected one.

The Prefix field shows Mrs. as a default. I added a membership type for the membership field that has the same problem but this is messy. That option will not work with the prefix because we do not want to have a prefix to ignore when doing mailings.

Any ideas of how to get around this is greatly appreciated.

Thanks,

Steve

# Answer
> 1 votes
Yes there is a bug here with it not having a 'no default' option. from memory you can do something like this. switch to static, untick the option that is beahving as 'default', save, then re-edit, set back to dynamic and resave. does that work for you?

Other things that may work depending on the component type

Open 'source' and in the YAML find in the relevant component

```
    '#default_option': '0'
    '#default_value': '0'

```

and delete them.

If it is a listbox then it will just show the first in the list UNLESS you type something into the ‘Empty option label’ field in the component/element. eg type -SELECT-

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


# Question
Title: How to get Target Contacts from Api4 Activity.get call?
I have an Api4 call that gets a particular set of activities. I'd like the call to return the names of the "target"/"with" contacts.

I've tried:

## Joining the Contact directly "using" ActivityContact

```
$activities = \Civi\Api4\Activity::get(FALSE)
  ->addSelect('activity_date_time', 'subject', 'details', 'contact.display_name')
  ->setJoin([
    ['Contact AS contact', TRUE, 'ActivityContact'],
  ])
  ->addWhere('activity_type_id', '=', 56)
  ->addOrderBy('activity_date_time', 'DESC')
  ->setLimit(3)
  ->execute();

```

This works but leaves me with no way to limit the results to just the target contacts.

## Joining the ActivityContact record, then the Contact

This is how I know the SQL needs to work, but it doesn't work \[as expected\] in Api4:

```

$activities = \Civi\Api4\Activity::get(FALSE)
  ->addSelect('activity_date_time', 'subject', 'details', 'contact.display_name')
  ->setJoin([
    ['ActivityContact AS activity_contact', TRUE, NULL, ['activity_contact.record_type_id', '=', 3]],
    ['Contact AS contact', TRUE, NULL, ['id', '=', 'activity_contact.contact_id']],
  ])
  ->addWhere('activity_type_id', '=', 56)
  ->addOrderBy('activity_date_time', 'DESC')
  ->setLimit(3)
  ->execute();

```

This ends up joining the contact ID to the activity ID(!)

```
a`.`id` = `activity_contact`.`contact_id`

```

Perhaps a Join in Api4 *always* means a join onto the primary entity? Except for hard-coded "using" joins? It's not mentioned in the documentation. Perhaps it's that you cannot do it from the API explorer? Though I kinda use that to figure out what you *can* do.

I'm using CiviCRM 5.35.1

# Answer
> 2 votes
For joining explicitly by adding an ActivityContact join then a Contact join instead of just a Contact join with "Using ActivityContact" in the explorer, I think it's just the Contact join that is causing you problems. Either join on `contact.id` not `id`, or omit the explicit clause to use the implicit one.

ie use:

```
    ['Contact AS contact', TRUE, NULL, ['contact.id', '=', 'activity_contact.contact_id']],

```

or

```
    ['Contact AS contact', TRUE, NULL],

```

Both this:

```
$activities = \Civi\Api4\Activity::get()
  ->addSelect('activity_date_time', 'subject', 'details', 'contact.display_name')
  ->setJoin([
    ['ActivityContact AS activity_contact', TRUE, NULL, ['activity_contact.record_type_id', '=', 3]],
    ['Contact AS contact', TRUE, NULL, ['activity_contact.id', '=', 'contact.id']],
  ])
  ->setLimit(3)
  ->execute();

```

and this:

```
$activities = \Civi\Api4\Activity::get()
  ->addSelect('activity_date_time', 'subject', 'details', 'contact.display_name')
  ->setJoin([
    ['ActivityContact AS activity_contact', TRUE, NULL, ['activity_contact.record_type_id', '=', 3]],
    ['Contact AS contact', TRUE, NULL],
  ])
  ->setLimit(3)
  ->execute();

```

produce the same sql:

```
SELECT `a`.`id` AS `id`, `a`.`activity_date_time` AS `activity_date_time`, `a`.`subject` AS `subject`, `a`.`details` AS `details`, `contact`.`display_name` AS `contact.display_name`
FROM civicrm_activity a
INNER JOIN `civicrm_activity_contact` `activity_contact` ON `activity_contact`.`activity_id` = `a`.`id` AND `activity_contact`.`record_type_id` = \"3\"
INNER JOIN `civicrm_contact` `contact` ON `activity_contact`.`id` = `contact`.`id`
WHERE ((`a`.`activity_type_id` IS NULL OR (`a`.`activity_type_id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 17, 19, 22, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57)))) AND (`a`.`is_test` = \"0\") AND (`a`.`is_deleted` = \"0\")
LIMIT 3
OFFSET 0

```

(API Explorer 4 on 5.36.alpha1)

# Answer
> 1 votes
Following up on the EntityBridge part of the question, this is now documented in the APIv4 section of the developer guide.

The fields of the EntityBridge are effectively merged into the main entity. So joining `Contact` using the `ActivityContact` bridge makes the `ActivityContact`'s fields appear on `Contact` such that the `record_type_id` of `ActivityContact` is exposed on the `Contact` entity as `contact.record_type_id`.

Using this, the code becomes:

```
$activities = \Civi\Api4\Activity::get()
  ->addSelect('activity_date_time', 'subject', 'details', 'contact.display_name')
  ->addJoin(
     'Contact AS contact',
     'LEFT',
     'ActivityContact',
     ['id', '=', 'contact.activity_id'],
     ['contact.record_type_id:name', '=', 'Activity Targets'])
  ->setLimit(3)
  ->execute();

```

---
Tags: apiv4
---


# Question
Title: remove requirement to include address in mass mail?
Every time I try to send a mass mail the GUI tells me I need to include "{domain.address}", and I don't want to have that info in mass emails I send. How do I disable this requirement?

Alternatively, how do I remove my country from "Organization Address and Contact Info"? I removed state, zip code etc successfully but when I remove the country, save, and then go back and look at the page it just resets it to say "united states".

# Answer
In Administer/CiviMail/CiviMail Component Settings there's a checkbox for 'Disable check for mandatory tokens' - this is what you should tick to disable the check.
> 2 votes

---
Tags: wordpress
---


title: Report on Scheduled Reminders

text:
# Question
Title: Report on Scheduled Reminders
How do I get a report on the scheduled reminders the system sends on schedule please?

Under Reports there are Mailing Reports and I tried the Advance Search. However these seem to search for mailings done as news letter blasting and not reports on the automated scheduled reminders sent (for example informing the members that their membership will expire in 1 months time).

Thanks, Sri

# Answer
> 3 votes
Schedule reminders add an activity type of **Reminder Sent** so you can use any activity report and filter on that.

Use the Activity Details Report or Extended Report - Activities.

---
Tags: reports, scheduled-reminders
---


# Question
Title: Send thank you email for contact sign up
I want to send a thank you for signing up as a supporter. There is no donation so this is done through using a profile in civicrm https://emptyhometax.org/civicrm/profile/create/?gid=2&reset=1

I have set up a reminder as shown below but it isn't working. Any suggestions?

# Answer
> 1 votes
You need to have a cron job to run your Scheduled Reminders if you don't want to have to do this manually

---
Tags: scheduled-reminders
---


# Question
Title: Drupal 9 Webform - Adding Membership to Contribution
I am trying to build a CiviCRM Webform in Drupal 9. Everything appears to work well except for the fact that the membership fee for a membership does not add to the total due.

In this screenshot, a lifetime membership is set to $2500. When I click lifetime for the membership (or any of the other paid options) the total does not go up.

I tried with the *Membership Fee* option selected in the configuration but even when you type in an amount on the form the total does not change.

If anyone can help guide me to where to configure this correctly I would appreciate it.

Thanks!

# Answer
> 2 votes
This works for me once I add the initial 'wizard page' at the top of the Build elements

so on front end i see

then

but I did not enable Membership Fee. do you really need that?

---
Tags: civicontribute, civimember, webform-civicrm
---


# Question
Title: Is it possible to sort by column email and then column postcode
I am runnign civicrm 5.36.1.

When I search for a list of contacts I am taken to a page listing all the contacts and fields which reflect the search parameters. I can reorder the list by clicking a column heading eg email

Can I sort how my contacts display by 2 or more column headers eg email and then postcode?

Thanks

Adding this as an EDIT because too long for comment reply: Hi Both Thanks for answering. I use groups as calling groups and do calling of contacts by selecting the first person in the list and ringing the person, filling in the answers from my script, then pressing next and going ot the next contact. I don't actually want to sort by email and postcode - I really want to sort by took multiple delivery rounds and then has ever taken a delivery round before - hence the need for two columns. It woudl enable me to call the most likely to volunteer first, then the second most likely batch and then the least likely batch without having to create separate groups. If I create a report where I can sort when I click on the first person on the list will it take me to the contact summary for the person - will I get the next button - I will give it a go anyway but any thoughts you have are appreciated. Thanks! Caroline

# Answer
With a search (eg Find Contacts) you can only sort by a single column. But if you use a report (eg Constituent Summary) you can select the columns to display and sort by multiple columns.
> 2 votes

---
Tags: display, sort-order
---


title: Local install guidance

text:
# Question
Title: Local install guidance
I'm of the "host or you're toast" philosophy so I'm trying to get a working instance of CiviCRM on either a virtual Ubuntu 20.04 instance on a local qemu/kvm server or personal laptop. Usual LAMP with WordPress working. Web install fails on both with the same error about "grouping".

It's a nice refresher course in SQL, etc.

But what should I try to do next to get a working instance? Drop in mariaDB, dump MySQL?

Rip out apt installed CiviCRM. Download the CiviCRM tar.gz to get the latest version?

Forget the web install. Use CLI cv method?

# Answer
> 2 votes
It sounds like you have mysql 8. Civi isn't yet fully compatible with mysql 8. So yes for now try mariadb (\<= 10.3).

# Answer
> 1 votes
If you haven't done so already, I suggest you take a look at the Installation Guide and in particular the Requirements.

---
Tags: installation, local
---


# Question
Title: Waitlist not working after event limit is increased
Due to COVID we had limited our events to 20. Our September, 2021 event is oversubscribed with 8 on the waitlist.

We recently increased the limit to 28 and I expected that all the folks on the waitlist would be notified but none of them were. I guess a change in the limit after initiating the event does not get communicated to the waitlist.

Another waitlist question: our events have "Pay Now" and "Pay Later" options. It seems to me that the event limit = "Pay Now" + "Pay Later" at which point Waitlist kicks in. I would like the limit to be only the "Pay Now" folks. Is there someway I can do this?

# Answer
> 1 votes
I've had a similar issue about increasing the waitlist limit. Check that the relevant scheduled job is running: `Job.process_participant`. This handles processing the waitlist participants. Read more in the User Guide.

You'll also need to make sure that you have a cron job that triggers the scheduled jobs (or you can run it manually).

---
Tags: civievent
---


# Question
Title: Civirules send email action creates activity in UTC time
I have a rule with the trigger "Case activity is added". This activity is an "Alert" activity, and when is created, the action "Send E-mail to contacts on a case", sends it to supervisor roles in that case.

However as you can see in the attached image, while the Alert is created in the right local time, the sent email is registered with +4 hours (so I think is UTC time because we are in America/Santiago).

I'm on wordpress and sure that is correctly set in America/santiago in CMS. Also I have set that as Default timezone in php.ini.

Using Civicrm 5.36.0, Wordpress 5.7, CiviRules 2.24, and E-Mail API 2.2

Any help or guidance will be very appreciated!

# Answer
> 2 votes
This sounds like it might be a bug in CiviRules. I suggest that you raise an issue.

Looking at the issues, #127 might be related.

---
Tags: civicase, civirules, activity
---


# Question
Title: Is there a way to have an event without date?
My use case is that I have an event with limited capacity but we expect it to be oversubscribed and that we will repeat it. The waitlist feature allows me to collect extra participants very nicely. But there will also be people who are interested but can't make the specific date and I would like to capture these. I know I can have a separate form for them to register their interest and collect them in a group, but I'd prefer to collect them as participants. Ideally, I'd do that with a different participant status ("Interested") but I don't think there is a way to do that. A second event would be fine, but I can't give it a date at this stage.

I'm using WordPress so the fancy form features of Drupal are not available.

Notes on petednz's answer: I used a radio option in the price field for registration or just interest, but it counted both options towards the event participant count even though I set the interest option not to count. Also when the waitlist is activated then the price set doesn't show so I can't distinguish between wanting to be on the waitlist and interest in future events That means I can't use the waitlist for two reasons, but I can live with that and deal with the waitlist that from my interest list manually. But when I set the registration option to my maximum number of attendees, I got this error when I tried to book for another so wasn't allowed to continue registering interest. Is this a bug? Using CiviCRM version 5.35.1 on WordPress.

> Fatal error: Uncaught Error: Call to a member function freeze() on string in /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Price/BAO/PriceField.php:209 Stack trace: #0 /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Price/BAO/PriceField.php(439): CRM\_Price\_BAO\_PriceField::freezeIfEnabled('\<span class="cr...', Array) #1 /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration/Register.php(627): CRM\_Price\_BAO\_PriceField::addQuickFormElement(Object(CRM\_Event\_Form\_Registration\_Register), 'price\_48', '48', false, '0', 'Choice', Array, Array) #2 /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration/Register.php(400): CRM\_Event\_Form\_Registration\_Register::buildAmount(Object(CRM\_Event\_Form\_Registration\_Register)) #3 /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.p in /home/customer/www/staging10.crm.coma.org/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Price/BAO/PriceField.php on line 209

# Answer
> 2 votes
If you use a civi Price Set, you can indeed set an option on there to not count towards your Participant Count which i think can therefore deliver what you need

---
Tags: wordpress, civievent
---


# Question
Title: Upgrade to 5.38.1 seems to loose all my user created reports
Hi I'm testing upgrading to 5.38.1 and when I install ( even before database upgrade ) all my user created reports seem to have gone.

( user created reports - I means where they go in, copy a report, change filters and save the copy )

Obviously that isn't too useful - as there are a lot of custom reports.

Is there anything I can do - am I doing something wrong?

I'm just following the WordPress upgrade steps as documented.

# Answer
OK it seems that it is some issue with transferring to my test system ( I myslqdump and mysql ) and it seems there are constraints that are not allowed. I did manage to get the transfer right once I completely trashed the dev database. I'm assuming that the sequence of loading means it is checking against 'old' data.
> 1 votes

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


# Question
Title: Will this solution safely reduce the disk size of my database
**I need to reduce the size of my Civi database**.

I've done a bunch of reading and have found what looks like a solution. Please will someone step in to advise if this solution (below) is the way to go, and if I can just run it on each of the db tables.

**Identifying the problem tables**

Mailing records are my primary issue and this extension worked well to remove old records. https://github.com/adixon/nz.co.fuzion.deleteoldbulkmailings

But as mentioned in Recommendations or Experiences on Archiving Mailing Data this has not freed-up as much the space as I'd hoped.

Using this helped identify the culprits:

```
SELECT
table_schema AS `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES WHERE table_schema = 'dbname'
ORDER BY (data_length + index_length) DESC
LIMIT 20;

```

**SO, IS THIS THE SOLUTION?**

This link offers a solution to recover the disk space: https://dba.stackexchange.com/questions/48740/recover-the-disk-space-after-deleting-rows-from-table

The accepted solution in the post is to run this on the tables that have had rows removed:

```
USE mydb
DROP TABLE IF EXISTS mytablenew;
CREATE TABLE mytablenew LIKE mytable;
ALTER TABLE mytable RENAME mytableold;
INSERT INTO mytablenew SELECT * FROM mytableold;
ANALYZE TABLE mytablenew;
ALTER TABLE mytablenew RENAME mytable;
DROP TABLE mytableold;

```

I'm running the latest Drupal and Civi versions.

# Answer
> 3 votes
I don't think this is a solution you should employ without checking on a few things i.e. foreign keys, indexes, triggers etc. It's a risky way to do it. If you must find space and have cleared as much data as you can then the way to achieve the same results would be to backup and restore the database. This will ensure all the structures are maintained.

There are alternatives but it depends on the version of MySQL/MariaDB you're running so if you want to explore them then please do post the details.

---
Tags: database
---


# Question
Title: Scheduled reminder not sending to manual recipients
The message is sending when I test with a sign up but I have included a manual recipient of the organization email of info@emptyhometax.org so I receive notice when there is a sign up or contributions. That isn't working. Any trouble shooting tips? I do not want to manage these notifications through the contribution page I want this to go through a scheduled reminder. The cron seems to be working fine and the scheduled reminder executes I just am not receiving an email at the manual recipient address.

# Answer
> 3 votes
Its a known issue reported at https://lab.civicrm.org/dev/core/-/issues/2475

Had to use scheduledccrecipients extension as an alternate.

---
Tags: scheduled-reminders
---


title: Civicrm webform for contribution

text:
# Question
Title: Civicrm webform for contribution
In the webform \> settings \> Civicrm \> contributions, can we list the Fixed Contribution Options i.e the list Contribution Label and amount in the web form?

Thanks

# Answer
As Alan says below: No, webform civicrm doesn't make use of the price set or contribution options (which is just a hidden price set) associated with the contribution page it's connected to.

You need to use the "Contribution Amount" field, then on the webform tab change it to a select box (radio) and enter the options you wish
> 1 votes

---
Tags: webform-civicrm
---


title: Discounts - Price Sets disappeared

text:
# Question
Title: Discounts - Price Sets disappeared
We use discounts on our events so that we can do scholarships and such. We apply them to specific items in a price set, as they typically only apply to the regular price and not the early bird price. However, almost all the price sets have disappeared from the drop down inside the discount. All that is in the list are the textbook price sets. Each training should have 3 items - early bird reg, regular reg, and a textbook.

We're running: CiviDiscount 3.8.4 and CiviCRM 5.38.0

**First Update:** I've been doing a lot of testing over the last 2 weeks. I've even tried upgrading a test copy to the beta (no change) and alpha (doesn't work - website error). So then I tried creating a new price set and attaching it to an event. It's not in the price set list in discounts. I tried uninstalling and reinstalling the discount extension. No change.

I created another new price set and went super simple - just 1 item. That worked. Added the other option and the textbook - stopped working. Removed the textbook. Success!

So I've gone through and manually recreated every price set without the textbook. At least one item from each price set shows up in the discounts. Now the problem is that only 1 out of 11 is showing both options (early bird and regular). EB is up to 30 days before the event, so almost every one of these has an active early bird discount.

I tried copying the one price set that has both price options working, but the copy did the same thing - only one of the two shows in the options in discounts.

**Second Update:** So I tried the suggestion below and I made all my names unique. They still don't show up in the list. Screenshots added below. EGS is the only one showing up correctly and it's the only event of that type, so everything about it is unique.

# Answer
I have been able to replicate the problem. With 3.8.3 and 3.8.4 I believe the issue is if there are multiple price sets with fields with the same labels. I replicated the issue using the following steps:

1. Create a price set of type event, add multiple fields
2. Duplicate the price set, without changing the labels of any of the fields
3. Create an event and select the 1st price set
4. Create a second event and select the 2nd price set
5. Create a discount code and view the available price fields: for each price set you created only 1 field's options will be available ()
6. Edit the price fields for the 2nd price set and make sure all of the labels are unique from those in the 1st price set
7. Attempt to create a discount code again and this time all price fields from both price sets should be available ()

Another example; if you change the labels so that only 1 field label is not unique, then you will see:

* Price set 1 options: Only the field whose label is NOT unique
* Price set 2 options: Only the fields whose labels ARE unique ()

I have created an issue over in GitHub
> 4 votes

---
Tags: price-sets, cividiscount
---


# Question
Title: Warning in logs: Deprecated function CRM_Utils_System::getUrlPath
We have thousands of the same warning on a 5.38. What should we do about it. Just not care? It fills up the logs and looking for anything else is not easy.

`[warning] Deprecated function CRM_Utils_System::getUrlPath, use CRM_Utils_System::currentPath. Array ( [civi.tag] => deprecated )`

# Answer
Thanks to Demerit, we were able to identify the source file using this command in the console:

```
grep -r "CRM_Utils_System::getUrlPath" /home/ourserver/sitefolder/wp-content/uploads/civicrm/ext

```
> 1 votes

---
Tags: logs
---


title: Twilio Schema validation warning

text:
# Question
Title: Twilio Schema validation warning
CiviCRM 5.15.1, WordPress 5.2.2

My org has been successfully *sending* bulk SMS via Civi/Twilio for a couple weeks, however we are having problems setting up *inbound* capability.

The Long Number we lease from Twilio is configured as shown below, with a callback URL as follows: https://www.mydomain.org/?page=CiviCRM&q=civicrm%2Fsms%2Fcallback&provider=org.civicrm.sms.twilio

The problem is when an SMS recipient replies to a text sent from Civi, Twilio reports error 12200 - Schema validation warning ("provided XML does not conform to the Twilio Markup XML schema"). I understand it's not a fatal error, but I can't find the reply when I look under the senders' Activities. (Anywhere else in Civi I should look?)

Per @balleyne (WordPress Twilio Inbound SMS Callback URL failing when request method is POST), I changed POST to GET and re-tested but got a fatal error instead of balleyne's partial success.

Like balleyne and @CDS-Delano (in a comment to this post: Inbound SMS from Twilio not showing up in CiviCRM (getting 404 error on HTTP POST)), Twilio's debugger console shows that what it gets back from the inbound attempt is html instead of the expected xml (or TwiML?).

Following Chris Burgess's advice in that post, I checked the server and PHP error logs with our hosting provider but saw no red flags around the time the reply SMS was sent.

How have others fixed or at least troubleshot this issue, especially any non-coders (like me) out there?

# Answer
> 1 votes
So I also get the Schema validation warning but the inbound SMS is received. Interesting to note that it did not associate with the right contact as the phone number is on multiple contact records. Tried a second time and it *appears* it selects the highest ID in civicrm\_phone table.

Best to go to Search \> Find Activities and do the following search to see inbound SMS activity:

```
Activity Type ID In Inbound SMS ...AND...
Activity Status In Completed

```

---
Tags: sms, twilio
---


title: Event Calendar database error

text:
# Question
Title: Event Calendar database error
I installed the Event Calendar extension on a Wordpress (5.7.2) site with CIVICRM 5.37.2. I followed the installation instructions and added the `[event_calendar component="event-calendar" id="<>"]` in my page. When rendering the page, I get a database error (see below). Does anyone know what I did wrong?

```
 Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
DB Error: syntax error

Error Field Error Value
Type    DB_Error
Code    -2
Message DB Error: syntax error
Mode    16
UserInfo    SELECT * FROM civicrm_event_calendar WHERE `id` = <>; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<>' at line 1]
DebugInfo   SELECT * FROM civicrm_event_calendar WHERE `id` = <>; [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<>' at line 1]
PEAR_Exception: DB Error: syntax error in C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php on line 922
- DB_Error: DB Error: syntax error in unknown on line unknown
Exception trace
#   Function    Location
0   CRM_Core_Error::exceptionHandler(Object(DB_Error))  C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:922
1   PEAR_Error->__construct('DB Error: syntax…', -2, 16, Array, 'SELECT * FROM ci…')    C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\db\DB.php:997
2   DB_Error->__construct(-2, 16, Array, 'SELECT * FROM ci…')   C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:575
3   PEAR::_raiseError(Object(DB_mysqli), null, -2, 16, Array, 'SELECT * FROM ci…', 'DB_Error', true)    C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\pear-core-minimal\src\PEAR.php:223
4   PEAR->__call('raiseError', Array)   C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\db\DB\common.php:1928
5   DB_common->raiseError(-2, null, null, 'SELECT * FROM ci…', '1064 ** You have…') C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\db\DB\mysqli.php:936
6   DB_mysqli->mysqliRaiseError()   C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\db\DB\mysqli.php:406
7   DB_mysqli->simpleQuery('SELECT * FROM ci…') C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\vendor\pear\db\DB\common.php:1234
8   DB_common->query('SELECT * FROM ci…')   C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\packages\DB\DataObject.php:2696
9   DB_DataObject->_query('SELECT * FROM ci…')  C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\packages\DB\DataObject.php:1829
10  DB_DataObject->query('SELECT * FROM ci…')   C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\CRM\Core\DAO.php:454
11  CRM_Core_DAO->query('SELECT * FROM ci…', true)  C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\CRM\Core\DAO.php:1566
12  CRM_Core_DAO::executeQuery('SELECT * FROM ci…') C:\xampp\htdocs\en\media\civicrm\ext\com.osseed.eventcalendar\CRM\EventCalendar\Page\ShowEvents.php:184
13  CRM_EventCalendar_Page_ShowEvents->_eventCalendar_getSettings() C:\xampp\htdocs\en\media\civicrm\ext\com.osseed.eventcalendar\CRM\EventCalendar\Page\ShowEvents.php:51
14  CRM_EventCalendar_Page_ShowEvents->run(Array, null) C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\CRM\Core\Invoke.php:313
15  CRM_Core_Invoke::runItem(Array) C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\CRM\Core\Invoke.php:69
16  CRM_Core_Invoke::_invoke(Array) C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm\CRM\Core\Invoke.php:36
17  CRM_Core_Invoke::invoke(Array)  C:\xampp\htdocs\en2\wp-content\plugins\civicrm\civicrm.php:1172
18  CiviCRM_For_WordPress->invoke() C:\xampp\htdocs\en2\wp-content\plugins\wordpress-event-calendar\wordpress-event-calendar.php:131
19  event_calendar_shortcode_handler(Array, '', 'event_calendar')   C:\xampp\htdocs\en2\wp-includes\shortcodes.php:343
20  do_shortcode_tag(Array) unknown:unknown
21  preg_replace_callback('/\[(\[?)(event_c…', 'do_shortcode_tag', '[event_calendar …') C:\xampp\htdocs\en2\wp-includes\shortcodes.php:218
22  do_shortcode('[event_calendar …')   C:\xampp\htdocs\en2\wp-includes\class-wp-hook.php:292
23  WP_Hook->apply_filters('[event_calendar …', Array)  C:\xampp\htdocs\en2\wp-includes\plugin.php:212
24  apply_filters('the_content', '[event_calendar …')   C:\xampp\htdocs\en2\wp-includes\post-template.php:253
25  the_content('<span class="fa …')    C:\xampp\htdocs\en2\wp-content\themes\free-template\template-parts\post\content.php:17
26  require('C:\xampp\htdocs\…')    C:\xampp\htdocs\en2\wp-includes\template.php:732
27  load_template('C:\xampp\htdocs\…', false, Array)    C:\xampp\htdocs\en2\wp-includes\template.php:676
28  locate_template(Array, true, false, Array)  C:\xampp\htdocs\en2\wp-includes\general-template.php:204
29  get_template_part('template-parts/p…', '')  C:\xampp\htdocs\en2\wp-content\themes\free-template\index.php:31
30  include('C:\xampp\htdocs\…')    C:\xampp\htdocs\en2\wp-includes\template-loader.php:106
31  require_once('C:\xampp\htdocs\…')   C:\xampp\htdocs\en2\wp-blog-header.php:19
32  require('C:\xampp\htdocs\…')    C:\xampp\htdocs\en2\index.php:17
33  {main}

```

# Answer
> 4 votes
Welcome to SE!

In this: `[event_calendar component="event-calendar" id="<>"]` the `<>` should be replaced by a number - eg `id="1"`

---
Tags: wordpress, civievent, database, calendar
---


title: Search within a case type

text:
# Question
Title: Search within a case type
I would like to be able to search for a specific Case Type as well as a Case End Date within this case type. To give an example, say I have a record that contains both Case A (which ended January 2018) and Case B (which ended December 2018). Right now, the advanced search is returning this record if I search for "Case Type A" AND "Case End Date December 2018." However, I would like the search to NOT return this record, as the end date (December 2018) is not affiliated with Case Type A. Is there a way for me to conduct such a search? I'm using CiviCRM 5.13.4.

# Answer
Try the case summary report, which might not be visible by default. Go to Administer - CiviReport - Create New Report From Template. Then pick the Case Summary report. Then on the filters tab set your filters.
> 1 votes

# Answer
As @Demerit proposed a case report is a good way to go. If you need searches like this very often I would create a search with the data processor extension for that: Use Case for search, add the fields you'd like to see as columns and add filters for date / date range and case type. There are a lot more very useful features, too, e.g. you can add a manage case link to jump to the case view for each item directly from the results.
> 1 votes

---
Tags: civicase, search
---


# Question
Title: create a group of contacts NOT matching search criteria
I need to create a group of contacts who do NOT match a certain search criteria. Is there some way to do so using the browser interface?

Thanks. -- Hugh

# Answer
1. Create a group that DOES match the criteria.
2. Go to Search - Custom Search - Include/Exclude search.
3. Search for contacts excluding your group from (1).
> 6 votes

# Answer
you can also use the search builder
> 1 votes

# Answer
If you have an up-to-date version of CiviCRM you may want to check out Search Kit which is a new development that provides very powerful searching capabilities through the user interface.

There is some limited documentation in the User Guide but note that this is still evolving.
> 1 votes

---
Tags: civicrm-entity
---


title: Civi CRM Monthly lucky draw

text:
# Question
Title: Civi CRM Monthly lucky draw
We are trying to set up a lucky draw on our site with Civi CRM.

Essentially, this is what needs to happen:

The user should be able to select how many tickets they would like to take (this is a random number generated by the system)

The user can then pay for the tickets.

The admin people are notified about the purchase.

An email is sent to the user telling them they have been entered into the draw.

The draw then takes place and the user is notified by email they are the lucky winners.

The numbers are then added back to the system when the draw is over.

These draws need to be relevant to the current month.

How could we achieve this? Or if someone could point me in the right direction please?

# Answer
> 1 votes
As you are on WordPress, I would suggest you start by looking for WordPress plugins that might do this for you. A quick search for 'lottery' returned quite a few potential plugins that might help.

I'm not clear whether this needs to relate to your contacts in CiviCRM at all (i.e. if it is for members only). It may be that your solution has nothing to do with CiviCRM and is purely on the WordPress side. If so, you may find more help from the WordPress StackExchange.

---
Tags: wordpress
---


title: Cyber security penetration testing

text:
# Question
Title: Cyber security penetration testing
As part of our annual information governance review we have to answer a question on whether all of the suppliers of our systems have cyber certifications. CiviCRM as open source software is a bit tricky to fit into this question.

Has the core code for Civi is cyber security tested in anyway, whether this is the methodology for releasing new code changes or whether the core code has ever been pen tested?

# Answer
> 1 votes
There was a Mozilla audit last year - see https://civicrm.org/blog/josh/quarterly-report-q1-2020

For general info see https://civicrm.org/security and https://docs.civicrm.org/sysadmin/en/latest/setup/security/

---
Tags: security, testing
---


title: How to create a hook in an extension?

text:
# Question
Title: How to create a hook in an extension?
I want to give others the chance to do something when certain events happen in my extension.

So to be clear: I'm not wanting to use existing hooks in my extension, I'm wanting to create a new hook that my extension will invoke and other code may choose to react to.

I couldn't find anything in the developers' guide about this. Looking at the source makes me think that maybe I should be doing something with `CRM_Utils_Hook` or perhaps `\Civi::dispatcher()->dispatch('hook_my_new_hook', $some_event_object)`?

Is there a standardised way to do this? Are there any good examples?

# Answer
> 1 votes
I find the 'normal' way pretty ugly.

* listing the args by name in an array, then
* supplying the args, then
* needing to pass by ref a NULL/dummy variable for each of the remaining 6 or was it 7? arguments - this is ugly and error prone and passing `CRM_Core_DAO::$_nullObject` is risky as it allows the hook to overwrite that so it's no longer NULL.

I think the following can be a nicer approach, here's an example:

## Fire an event

```
// Create an event object with all the data you wan to pass in.
$event = Civi\Core\Event\GenericHookEvent::create(
  ['fname' => $fname, 'votes' => &$votes]);
Civi::dispatcher()->dispatch('civi.something.you.make.up', $event);

```

## Example listener

```
function your_listener_callable($event) {
  print "running " . __FUNCTION__ . "\n";
  // We can overwrite data
  $event->fname = 'Wilma Flintstone';
  // We can alter anything passed by reference.
  $event->votes++;
  // To return a value you need to pass it in an array like so:
  $event->addReturnValues(['Successfully recorded votes!']);
  // We can't write any properties that the event did
  // not originally have defined, so this won't work:
  $event->friend = 'Barney';
}

```

## Use data resulting from the event

This code would come directly after the 'Fire an event' code.

```
print "$fname ($event->fname) now has $votes votes.\n";
$return = $event->getReturnValues();
print "The hook returned: $return[0]\n";
// $event->friend === NULL

```

## Link your listener to the event.

You'd normally do this in a `hook_civicrm_container()` function to ensure it is only added once.

```
/**
 * Implements hook_civicrm_container().
 *
 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_container/
 */
function myext_civicrm_container($container) {
  // https://docs.civicrm.org/dev/en/latest/hooks/usage/symfony/
  $container->findDefinition('dispatcher')
  ->addMethodCall('addListener', [
    'civi.something.you.made.up',
    'your_listener_callable']);
}

```

## Full working command line example

You can run this with `cv scr hookexample.php`

```
<?php
use \Civi\Core\Event\GenericHookEvent;

if (php_sapi_name() !== 'cli') {
  http_response_code(404);
  exit;
}

function your_listener_callable($event) {
  print "running " . __FUNCTION__ . "\n";
  // We can overwrite data passed by value, but that's probably confusing.
  $event->fname = 'Wilma Flintstone';
  // We can alter anything passed by reference.
  $event->votes++;
  // To return a value you need to pass it in an array like so:
  $event->addReturnValues(['Successfully recorded votes!']);
  // We can't write any properties that the event did not originally
  // have defined, so this won't work:
  $event->friend = 'Barney';
}

// As this is a single-pass script we can just do this:
Civi::dispatcher()->addListener('civi.something.you.make.up', 'your_listener_callable');

$votes = 0;
$fname = 'Wilma';
print "$fname has $votes votes.\n";

$event = GenericHookEvent::create(['fname' => 'Wilma', 'votes' => &$votes]);
Civi::dispatcher()->dispatch('civi.something.you.make.up', $event);

$return = $event->getReturnValues();

print "$fname ($event->fname) now has $votes votes.\n";
print "The hook returned: $return[0]\n";
// $event->friend is NULL.

```

Outputs:

```
Wilma has 0 votes.
running your_listener_callable
Wilma (Wilma Flintstone) now has 1 votes.
The hook returned: Successfully recorded votes!

```

# Answer
> 7 votes
> ## EDIT
>
> This answer is now deprecated, you should use @bgm's answer instead, or for an alternative and possibly cleaner approach, try my other answer

All thanks to the code example link in Eric's answer here's a simplified example of how to offer up a hook (`my_new_hook`) which takes one argument, `$the_argument`:

```
CRM_Utils_Hook::singleton()->invoke(
  1, $the_argument,
  $dummy, $dummy, $dummy, $dummy, $dummy,
  'my_new_hook');

```

Then other extensions can include functions like

```
function myextension_my_new_hook($arg) {
  do_something_with($arg);
}

```

The `$dummy` is just because we must pass a variable (since it's passed by reference), but this hook does not need it. If you had a hook that took two arguments, you'd use `2` in place of `1` and replace the first `$dummy` with your actual second argument etc. up to 6.

Nb. this code assumes CiviCRM 4.5+, but obviously you're not using anything older than that these days, right?!

# Answer
> 5 votes
Here is an example of a hook we created for CiviRules:

https://lab.civicrm.org/extensions/civirules/blob/master/CRM/Civirules/Utils/HookInvoker.php

Hope this helps :-)

# Answer
> 5 votes
Here is an example using the named parameter syntax:

```
CRM_Utils_Hook::singleton()->invoke(
  ['pdf', 'pdf_variables', 'receipt'],
  $pdf, $pdf_variables, $receipt,
  CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject,
  'cdntaxreceipts_writeReceipt');

```

One advantage of this syntax, is that extension can then implement the hook with the Symfony syntax. When managed by Symfony, it's easier to change the priority or add/remove hooks from other extensions.

Example:

```
/**
 * Implements hook_civicrm_container().
 *
 * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_container/
 */
function myext_civicrm_container($container) {
  // https://docs.civicrm.org/dev/en/latest/hooks/usage/symfony/
  $container->findDefinition('dispatcher')
    ->addMethodCall('addListener', ['hook_cdntaxreceipts_writeReceipt', 'myext_cdntaxreceipts_symfony_writeReceipt']);
}

/**
 * Implements hook_cdntaxreceipts_writeReceipt() via Symfony.
 *
 * @see myext_civicrm_container()
 */
function myext_cdntaxreceipts_symfony_writeReceipt($event) {
  // Access the parameters with:
  // $event->pdf;
  // $event->pdf_variables;
  // $event->receipt;
}

```

Note that the implementing function `myext_cdntaxreceipts_symfony_writeReceipt` has `symfony` in the name only to avoid being called by the traditional hook system. We can name the function however we want.

---
Tags: extension, developer, hooks
---


# Question
Title: Recording event payments that come by mail (checks) after online registration
My civiCRM instance: civiCRM: 5.37.0. + iATS Extension: 1.7.4 Drupal: 7.80

My management insisted that we offer a "Pay Later" option for an event with online registration. Checks are coming in but I can't get back into the participant's record to change the payment amount.

I go to the participant's record \> Events \> on the event row I select Edit.

There is a "Change Selections" link which takes we to another screen with the link "View Payments." Clicking this link produces a box that declares "No payments found for this participant \> Record Payment \> etc.

When I click "Record Payment" I get the message "Unable to reach the server. Please refresh this page...and try again." Refreshing takes me back to the participant's record.

So, how do I update a participant's record to acknowledge payment?

# Answer
Don't click Change Selections - instead on that edit page change the participant status from Pay Later to Registered, and then lower down in the Payment Information section change the payment status to Completed.
> 2 votes

---
Tags: civievent, iats
---


title: Create customized "block" in Mosaico

text:
# Question
Title: Create customized "block" in Mosaico
My website is on Drupal.
We have preformatted Mosaico templates with header (view in your browser) and footer (social media buttons, organizational address, and unsubcribe options) in English.
HOWEVER, we do many identical mailings in 3 languages. It is simplest to copy the English mailing, then switch out the text to French and Spanish, rather than recreate the mailing from scratch using a French or Spanish.
But, this means i have to copy and paste French or Spanish text into the header and footer EVERY time.
It seems to me I should be able to save a custom block with my footer in Fr and another with footer in Sp to drop into a mailing.
But **how**?
(Or, another solution to my problem, I guess, would be a better photo gallery, so I could just use the "make a french template" option. The absolutely wretchedness of the ridiculously inadequate photo gallery is part 1 of what makes me choose copying and pasting all the fr and sp text into the original english draft so as not to have to deal with photos again, rather than recreating a draft on a Fr or Sp template. How does this program have the worst photo gallery imaginable? Part 2 is the huge amount of white space in the template that makes it impossible to see the end of a long link. \[the number of times I've sent a messed up link because I **can't see** what I've pasted there...(fist shaking)!!\])

# Answer
It is possible to define custom blocks to mosaico templates. To do this, you have to create an extension that provides a custom base template and implements the hook\_civicrm\_mosaicoBaseTemplates hook to register your template. In your custom base templates you can define custom blocks. I found these tutorials useful for understanding how the mosaico blocks work.

I think you should start creating your base templates from the one you are currently using. So copy it to your extension. Then edit the html file, duplicate the header and footer blocks, rename them to prevent issues from the duplicated block names. In the duplicates you can add text in different languages. Repeat from the duplication for the third language. Now you have the blocks, but the thumbnail images are missing for them. There is a script in the versafix template repo that could be used for generating the thumbnails for your template. This script needs to be modified a little bit, but you can execute it to generate the images for your template. The generated main image for your custom template could be too similar to the main image of template that you copied before. For making them distinguishable you can add a watermark or some text to the generated image called \_full.png
> 3 votes

---
Tags: email, mosaico, custom-templates
---


# Question
Title: How to add TikTok button to the footer of a Mosaico template?
The TikTok social button is not available in de predefined socials of the Mosaico social block. Is there a way to add other predefined buttons in the footer like TikTok?

# Answer
> 2 votes
Take a look at the answer of this question. You can do this with a custom base template.

---
Tags: mosaico, social-media, header-footer
---


title: Mosaico text alignment

text:
# Question
Title: Mosaico text alignment
I see this question was asked a few years ago and just wondering if there's any answers to it now.

When entering text into various blocks in Mosaico, if we align the text to justify it appears to work on screen and in the html test preview but when it arrives in the inbox it has all changed back to left align.

Anyone else had this problem or got any ideas/workarounds?

Thanks.

# Answer
> 4 votes
\[**UPDATE**: This problem is fixed now. Upgrade to the latest version of the Mosaico extension.\]

This issue is tracked on Github. In short:

* This is a bug in Mosaico itself, which has been fixed - but CiviCRM isn't using the latest version of Mosaico. Crowdfunding for an update is happening.
* If you know what you're doing, you can manually patch Mosaico. I've done so for versions 2.5 and 2.6, but not 2.7. I tried making a patch you could apply but unfortunately it doesn't seem to patch cleanly. I might make a zip file of the patched Mosaico 2.6 for folks to download.

# Answer
> 1 votes
This issue happened with us also. After an investigation it turned out that the alignment on the 'p' html tag is not working well. But if you update the 'p' to 'div' manually with the source code editor in mosaico, the alignment works well again. This workaround needs a lot of manual work, in addition it is easy to make mistakes.

The mosaico extension provides an option for changing the behavior of the editor. If you set the `$config['tinymceConfig']['forced_root_block'] = 'div';` setting, the editor will start creating the new paragraphs as div by default. It was nice, but we faced another issue. In the mosaico templates the paragraphs are defined with 'p' tags. If your cursor is in a 'p' paragraph, and you press enter it defines a new paragraph, but the tag is inherited from the previous paragraph, so that it is 'p'. So the final solution was a new mosaico base template where we replaced the 'p' tags to 'div'.

---
Tags: mosaico
---


# Question
Title: "Total amount" and "Balance owed" should by default be attributes to the same "contribution"
Good day,

and thanks for your support. I think I have a pretty common issue: when registering a contribution which is paid off with several payments it is not easy to find a proper solution to have the same transaction in a report indicating the "total amount" and the "balance owed". So far the best approximation that I could find is the "Bookkeeping Transactions" report in the contributions section however this solution has a limitation: the information is in two rows and it is not possible to net those so to have the outstanding debit for the member/contributor. I have to say that Civicrm is really a fantastic product: it is well structured and provides a lot of useful functionalities however when it comes to handling the debit/credit positions of members it makes me wonder why such a simple requirement was never supported. I've tried any type of solution that can be found in the web however none of them satisfies the need. I also tried with show\_balance\_due however with the latest version of Civicrm on drupal it does not work. I've also tried summaryfields and Line Item Report but none of these is satisfying the need we have. I am sure the requirement is known and I think a solution for this would makes sense.

Thanks for reading.

Kind regards Antonio

ps: we are a small ski team evaluating civicrm to handle our civic organization.

# Answer
apologise for the delay. Yes the issue was solved. It is in plan to have a new official release of the extension, in the meanwhile a patch is available.See here

Kind regards Antonio
> 2 votes

---
Tags: civicontribute, webform-civicrm
---


title: Convert Mosaico Mailing into template

text:
# Question
Title: Convert Mosaico Mailing into template
Sorry if this is a noob question, but is there a way to convert a used Mosaico Mailing into a Mosaico template?

Thanks in advance

P.S. - I know I can re-use the mailing, but I'd rather create a generic template from the already used example.

**EDIT**: to be more precise, what I did was (all from GUI, no coding):

1. Created a new template from versafix-1: let's call it Newsletter Template
2. Created a mailing based on Newsletter Template
3. Updated the mailing with the content and made some changes to the layout
4. Sent my newsletter, all is fine.

What I would like to do now is to apply the changes I made on the mailing to my original Newsletter Template.

Is this possible or do I need to recreate these changes on the template?

I hope this makes it clearer.

# Answer
> 1 votes
If i understand you well, you have a mosaico mailing originated from a given base template. And you want to use that mailing as a base template. If this is the case, you can do this with defining a custom mosaico base template. The most relevant steps for this are written in the answer of this question: Create customized "block" in Mosaico

I hope this answer helps you.

Answer for the edit:

The changes are not sync-ed back to the original template (Newsletter Template in your case). When you select the template on the Mailings \> New Mailing form, it creates a copy from the selected template and you make changes only on the copy. For making permanent changes yo have to do this in the Mailings \> Mosaico Templates menu.

On the page you can find the your Newsletter Template in the Configured templates block. Click to Edit and do the permanent changes and then save it.

If you have a draft mailing where the template is already selected, you can remove it with the Reset button and then you can select the updated version of the Newsletter Template.

So if you notice during a mailing that your template needs to be changed, you can follow this workflow:

* Save the mailing as draft, go to the Mailings \> New Mailing, edit your Newsletter Template and then save it.
* Go back to the draft mailing, reset the template and choose the updated Newsletter Template.

---
Tags: civimail, mosaico
---


title: DB set entity install priority

text:
# Question
Title: DB set entity install priority
How can I set the entity install order? now the new table refers to a nonexistent one because the new table has not yet been created

# Answer
> 1 votes
Maybe you are looking for the postInstall hook? https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_postInstall/

It is written in the example section:

`Another potential use is to act on settings or managed entities that are created during the installation (but not necessarily in order that you want them to be created)`

---
Tags: extension
---


title: upper case in name with accents

text:
# Question
Title: upper case in name with accents
`{capture assign=last_name}{contact.last_name}{/capture}{$last_name|upper}`

I'm trying to render my contact name in uppercases with Smarty and include letters with accents.

At the bottom of this page in the the Smarty doc: https://www.smarty.net/docs/en/language.modifier.upper.tpl It is advised to use `{$your_variable|@strtoupper}` but `{capture assign=last_name}{contact.last_name}{/capture}{$last_name|@strtoupper}` doesn't work

# Answer
You probably want mb\_strtoupper. Smarty's `|upper` just does strtoupper - you can see this if you look in packages/smarty/plugins/modifier.upper.php.

So one way is to hack modifier.upper.php and change it to use mb\_strtoupper. You can also try using `{$last_name|@mb_strtoupper}` but it might give you a security error.
> 2 votes

---
Tags: civimail, contacts, smarty
---


# Question
Title: Problem with register_rest_route call since 5.28.0: missing the required permission_callback argument
Ever since we upgraded to CiviCRM 5.28.0, one of our sites is getting several error messages like this:

> Notice: register\_rest\_route was called incorrectly. The REST API route definition for civicrm/v3/url is missing the required permission\_callback argument. For REST API routes that are intended to be public, use \__return\_true as the permission callback. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in \[site path\]/wp-includes/functions.php on line 5225

There are eight error messages in total, all identical other than naming other civicrm/v3/\* route names.

This is on WordPress. The core files and all plugins are at the latest versions, and the errors persist after we just updated to CiviCRM 5.28.3.

So far, Google has not revealed anything useful.

What might cause this problem?

Thanks!

# Answer
Don't panic, the issue you are seeing is only a notice, not an error and won't stop CiviCRM working.

In WordPress 5.5, a change was made to how REST routes are registered and now required a **permission\_callback**. For the moment, the plugin will continue to work and once the plugin author releases an update that adds the **permission\_callback**, the notice will disappear.

The reason you may see it the notice on one site and not all is that notices only appear when WordPress is run in **DEBUG** mode, confirm by checking the value of wp-config.php for

```
define( 'WP_DEBUG', true );

```

If the site showing the notices should not be in debug mode, simply change the value of WP\_DEBUG to false.
> 4 votes

# Answer
**search for civicrm/v3** **set** 'permission\_callback' =\> =\> function() { return true; } **after callback** \**more info : \**https://developer.wordpress.org/reference/functions/register\_rest\_route/
> 0 votes

---
Tags: wordpress, error
---


# Question
Title: Add new membership types to an existing membership profile
I have a profile containing membership fields, and when I created the profile I added a number of membership types. In the profiles administration page, the profile type says: Membership::DPN UK - Dru: DPN UK - Full: DPN UK - Student: DPN Aus - Full: DPN Aus - Student

Now, I have expanded the number of membership types this profile could be used for, so I want to add more membership types to this list. The profile is currently unavailable to people with these new membership types.

How do I do this? Apologies if I'm missing something completely obvious.

I'm in Civi 5.35.2 and Drupal 7.80

# Answer
> 1 votes
Sorry for the confusion here folks, I was mixing 'profiles' with 'custom field sets'.

My membership profile contained custom membership fields and this profile wasn't available when editing or creating some specific membership types.

However, what I didn't realise was that when setting up custom membership fields you must choose which memberships you want these fields to apply to.

I should have gone to Civimenu \> Administer \> Customise Data and Screens \> Custom fields \> \[my custom field set\] \> Used for: memberships\[choose the correct membership types\].

Once I'd chosen the correct membership types, my custom fields became available to these memberships when I edit or create them.

Whew. That's hard to describe in words, yet obvious in just a couple of screens. Hope it all makes sense and helps the next person who makes this mix up.

---
Tags: civimember, profile
---


# Question
Title: Cron not running since updating to 5.39.0
I updated to 5.39.0 on Friday, and upon logging in today I've discovered that cron doesn't seem to have run since. I've checked my host's cronlog, and it reports that the command has been sent, so I've logged in and tried it manually from the command line which initially returned this error:

```
bash-4.2$ /usr/bin/php-7.3 /var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm/bin/cli.php -s beta.example.net -u username -p password -e Job -a execute
Warning: require_once(/var/sites/e/example.net/public_html/sites/all/modules/civicrm/CRM/Core/ClassLoader.php): failed to open stream: No such file or directory in /var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm/civicrm.config.php on line 138

```

I've had problems before that I think are related to this - when I first created the site I was testing on beta.example.net and then moved it over to example.net when it was fully functioning, but the host won't let us change the primary account name. I've found that CiviCRM only loads when $civicrm\_root in civicrm.settings.php is set as `/var/sites/e/example.net/public_html/sites/all/modules/civicrm`, but command line tools like drush will only work if $civicrm\_root is `/var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm`.

So it looks like something has changed in 5.39.0 that means something in civicrm.config.php is now using the $civicrm\_root path where it wasn't before? And as the cronjob is run from the command line that's causing it to fail?

Obviously, before too long I need to find a work around for this. I can't switch the path over every fifteen minutes for the cronjob to run. In the meantime though, I've carried on trying to force it from the command line with the path set such that it should run, and even that's not working. I'm now getting this error:

```
bash-4.2$ /usr/bin/php-7.3 /var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm/bin/cli.php -s beta.example.net -u username -p password -e Job -a execute
TypeError: Argument 2 passed to CRM_Contact_BAO_GroupContactCache::getGroupsNeedingRefreshing() must be of the type int, string given, called in /var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php on line 132 in CRM_Contact_BAO_GroupContactCache::getGroupsNeedingRefreshing() (line 715 of /var/sites/b/beta.example.net/public_html/sites/all/modules/civicrm/CRM/Contact/BAO/GroupContactCache.php).

```

As far as I know, everything was running fine prior to 5.39.0. Any suggestions?

# Answer
I would upvote @Demerit if his comment was an answer, but instead I posted some additional info at the link they gave. To satisfy Stack Exchange guidelines, I'll post it below:

* In **Administer menu » System Settings » Scheduled Jobs**, edit the *Rebuild Smart Group Cache* settings to read `limit=0` instead of `limit=Number optional-Limit the number of smart groups rebuild`.
* You may want to read this documentation about optimizations, particularly the part about whether you want *Rebuild Smart Group Cache* enabled at all.
> 6 votes

---
Tags: cron
---


title: Embedding a GIF in email

text:
# Question
Title: Embedding a GIF in email
Is it possibly to embed a GIF from giphy.com in my automated email in CiviCRM?

In gmail, I can use Insert Photo / Web Address (URL) and paste in the image (gif) url.

I appreciate your time on responding to this

David

# Answer
> 1 votes
Just insert as img and fill in the giphy url like https://media2.giphy.com/media/dbVNzOSyUd1kQmOIaM/giphy.webp

---
Tags: email
---


title: Customize the display page for events

text:
# Question
Title: Customize the display page for events
Using BackdropCMS and CiviCRM.

I'm looking for tips on how to customize the event pages. The pages used to display the details of individual events.

We are including the event location and price in the 'complete description' field for the event and would prefer that CiviCRM not display this information again at the bottom of the page, right before the register button.

See image:

I was leaning towards editing the EventInfo.tpl file as the best solution, but found this in documentation:

> Changing page templates is the wrong choice when ...it is possible to make the needed changes by updating the CSS styles. For example, if a requirement is to hide or move some information or form fields on a screen, a CSS style for that HTML element can be changed to display: none, or position: absolute within the CSS file.

https://docs.civicrm.org/dev/en/latest/framework/templates/

Hiding fields with CSS does not feel like it is the best solution. But, is it the best solution available?

# Answer
> 0 votes
One of my sites also required a customised event page and ended up doing up their own designs but only grabbed the event details (e.g description, time, venue) and registration link from CIVICRM via API. This is quite doable if you have someone handy with html/js.

# Answer
> 0 votes
You can update the rendered html content with implementing the alterContent hook in an extension. You can check the tplName input to decide that the given content is connected to an event page or not. In case of event templates it is looks like `CRM/Event/...`. The html string is stored in the content variable. You can use the phpQuery tool for doing the dom manipulation. For example you can remove the section that contains the default when and fees block. It changes the html content on the server side.

Other solution could be adding custom js files and do the manipulation with javascript functions on the client side. You can implement the pageRun and buildForm hooks in your extension. If you are on the event pages or forms (you can decide it based on the page and form names that prefixed with `CRM_Event_`), you can add your custom js files with the `Civi::resources()->addScriptFile()` function.

The EventInfo.tpl will not be changed with the options above.

---
Tags: civievent, backdrop
---


# Question
Title: Send user to New Mailing page with Recepients Already Selected
We'd like to send admins to the New Mailing page (https://example.com/civicrm/mailing/send?reset=1) but have the Recipients field already populated with a specific Group. Is there a query parameter or a way to post to that URL with the recipients field set?

The idea is for us to create a Group and GroupContacts via the API (from an external web page), and then send the user directly to the Civi Mail page with that new group already selected for them.

# Answer
> 0 votes
I think you should check out the draft mailing url. If you are on the saved drafts page (`/civicrm/mailing/browse/unscheduled?reset=1&scheduled=false`). You can copy the link behind the continue button. It looks like this: `/civicrm/mailing/send?mid=1&continue=true&reset=1` So there is a mid parameter that points (i think) to a message id. If you open the link, it redirects you to the `/civicrm/a/#/mailing/1` page, where the last parameter seems a message id again. So if you know that id, you can construct a link that points to the mailing edit page. And if you are planning to setup the basics of the mailing with API, then it will returned to you in the API response.

---
Tags: civimail
---


# Question
Title: WordPress WSOD When Activating CiviCRM 5.37.2
I am attempting to activate the CiviCRM 5.37.2 plugin on WordPress 5.7.2 after editing the MySQL connection string. After saving the connection string, I briefly get the CiviCRM "Success" page before I get the infamous WordPress "Whtie screen of death" saying "Sorry, you are not allowed to access this page." (see attached)

To rule out my web host as the source of the issue, I spun up an Amazon Lightsail WP instance and got the exact same behavior. Any help is appreciated.

# Answer
I have the exact same error, I installed on hostgator, 7.3php, Activated and hit either CivicCRM Installer or "CiviCRM is almost ready. You must configure CiviCRM for it to work." After seeing CiviCRM Installed sucessfully it jumps to "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1" and i get Sorry, you are not allowed to access this page. Using civicrm-5.39.0-wordpress.zip and the instructions on the wordpress install page.

* I cleaned out my uploads directory
* I tried changing permissions
* I attempted a clean reinstall several times
> 0 votes

---
Tags: wordpress, installation
---


# Question
Title: Drupal 9 Views: rich text fields render with all HTML tags visible
HTML tags added by CiviCRM's rich text editor is generated as plain text in Views output for fields like CiviEvent description or custom rich text fields. Stripping tags in the Views output doesn't tidy it up:

# Answer
Based on feedback from Skvare's Mark Hanna on chat.civicrm.org you need to rewrite the field output, using the `_value` version and add `|raw` in the twig.

For the event description field, this looks like: `{{ description__value__value|raw }}`.
> 4 votes

---
Tags: drupal, drupal-views, civicrm-entity, textarea
---


title: CIVI Event setup is blank

text:
# Question
Title: CIVI Event setup is blank
I would like to set up an event, but every time we try (multiple different days, different browsers, different staff members on different networks) the window opens up completely blank.

Screenshot #1: Menu navigation Events\> New Event  Screenshot #2: Menu navigation Events\> Manage Events \> Add Event

Help much appreciated.

# Answer
> 1 votes
I see you're on 5.34 - your url looks wrong. See https://civicrm.org/blog/kcristiano/civicrm-526-and-wordpress-important-notice where there was a change in 5.26.

---
Tags: wordpress, civievent
---


# Question
Title: Displaying custom contribution field in the online receipt
I am having trouble with displaying a custom contribution field on the online reciept.

With the offline receipt, it works great with this:

```
{crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$formValues.contribution_id`}
{if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}

```

The same code on the online receipt returns:

Dear array,

How can I fis this?

# Answer
The smarty variables for online and offline may be different for Contribution ID.

For offline

```
{crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$contributionID`}
{if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}

```

Online

```
{crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$contributionID`}
{if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}

```
> 5 votes

---
Tags: receipts, smarty
---