title: Sliding Scale Pricing

text:
# Question
Title: Sliding Scale Pricing
I am trying to set up a membership option where people can pay what they can with a minimum amount set. For example $60 rather than the standard $180 for a membership. I would have thought this was possible/easy because you can do that with contributions but I do not see a way to assign a membership to the contribution.

All I need is a text field for people to type in the number just like on contribution price sets.

Is there an extension that does this? Is there an easy way with code? CiviRules (I looked but I do not see a good way to tell what PriceSet field it came from)?

Thanks!

# Answer
> 2 votes
You can't have a text box to choose membership amount but there are two ways as a workaround

1. Create a price set with required pricefields

a) Select or Radio button with Membership as 0 fees

b) Add text price field with $1 amount.
2. Make membership type fee as 0 and include contribution amount section on contribution page

---
Tags: civimember, price-sets
---


title: Angularjs called from an extension?

text:
# Question
Title: Angularjs called from an extension?
Good morning from Canada. I am trying to create an extension with angularjs forms. I have followed the development guide and have created the angularjs page but I cannot get it to display in CiviCRM. I have a Tabset function used with Events, it calls the php page, which in turn I have the AngularLoader configuration. When it gets to the useApp() command I get an Unknown Path error. The examples in the doc don't go as far as to show how to do this within an extension or as a new tab under event. Even if you can point me to an example extension, I can analyse it to try and figure it out. The default\_route value in the useApp() command I'm assuming is the ang entry in angular? When I do a cv ang:html:list the page I want is listed (as well as ang:module:list has the module). Thanks for any advance or help you can give. I ran all of the suggested civix commands from the documentation. From the php called from the extension: ...

```
$loader = new \Civi\Angular\AngularLoader();
$loader->setModules(array('trialadmin'));
$loader->setPageName('TrialDetails');
//$loader->useApp(['defaultRoute' => '/trialadmin']);
$loader->load();
parent::run();

```

And in my module I have

```
if ($eventID) {
$url = CRM_Utils_System::url( 'civicrm/event/manage/TrialAdmin', "reset=1&force=1&eventid=$eventID&snippet=5&angularDebug=1" );
error_log($url);
$tab['Administration'] = array(
  'title' => "Administration",
  'link' => $url,
  'valid' => 1,
  'active' => 1,
  'current' => false,
);

```

output from cv ang:module:list trialadmin | civicrm/a | crmUi, crmUtil, ngRoute

output from cv ang:html:list trialadmin/TrialDetails.html

I've tried different arrangements of the defaultroute but I'm not clear on why I'm getting the unknown path error. If I comment out the useApp line it continues on to use the \*.tpl that I originally had in place. I wanted to do this with the newer forms format rather than the quickforms as suggested in the docs.

# Answer
Ok, sorted it out with some suggestions and examples.

> $loader = new \Civi\Angular\AngularLoader(); $loader-\>setModules(array('trialadmin')); $loader-\>setPageName('Administration'); $loader-\>useApp(\['activeRoute' =\> '/trialadmin/trialdetails'\]); $loader-\>load();

Worked with this, but I also used the trace and debug in the browser to determine there likely was another issue with the form actually loading. Regardless, I've been able to sort it out.
> 2 votes

# Answer
You are trying to inject an angular snippet into an otherwise non-angular page, and you're wanting to place it into a new tab in the Manage Events page. This is doable but there are a few things to understand:

1. Yours might not be the only Angular snippet on the page. Other extensions may want to add them in the future.
2. Angular routing requires control of the URL, which your snippet shouldn't assume it has, so I don't recommend using `crmApp` or `ng-route`.
3. Tab content loads via ajax by default, but it's also possible to pre-load it by supplying a "template" property. This makes Angular stuff simpler.

I recently faced these same challenges while adding this feature to the new Form Builder (Afform) extension, and ended up improving the way AngularJS loads in Civi. It's available in version 5.37+ and I highly recommend you start using this new service:

In your hook you'd do this:

```
function my_hook_civicrm_tabset($tabsetName, &$tabs, $context) {
  //check if the tab set is Event manage
  if ($tabsetName == 'civicrm/event/manage') {
    if (!empty($context['event_id'])) {
      // Add our Angular module to the page
      Civi::service('angularjs.loader')->addModules(['trialadmin']);
      // Add the tab
      $tab['Administration'] = [
        'title' => "Administration",
        'template' => 'path/to/your/template.tpl',
        'valid' => 1,
        'active' => 1,
        'current' => false,
      ];
    }
  }
}

```

Note that I didn't supply a URL but instead gave a `'template'` which will cause the tab content to load immediately. So now you've got your module loaded and don't have to worry about ajax for the tab content.

In your tpl file you need to initialize your Angular module. This will look a little different than the docs which use `crmApp` and `ng-route`. It's actually going to be a lot simpler. All you do is add a tag which tells Civi to boostrap Angular and load your module, then just have your module do it's thing.

So skip all the stuff about routes and controllers. Best practice is to just define a module and a component.

E.g.

```
(function(angular, $, _) {
  angular.module('mymodule', CRM.angRequires('mymodule'));

  angular.module('mymodule').component('myComponent' {
    // do your thing
  });
})(angular, CRM.$, CRM._);

```

Then your .tpl file would look like this:

```
<crm-angular-js modules="mymodule">
  <my-component></my-component>
</crm-angular-js>

```
> 1 votes

---
Tags: civievent, extension, angular
---


# Question
Title: Minor flaw in CiviCRM registration page for EFF
Excuse me for being OCD = perfectionist, but when RSVPing for an EFF event, there was no \[register\], \[Submit\], \[Complete your registration\] etc, but only a \[Review your registration\].

As a professional CRM company, I'd expect CiviCRM to have something this simple be correct:

Change the "review your registration" (which DOESN'T - you're LOOKING at your information right there!!) to "register". Maybe you're thinking that it goes through an audit process making sure data is entered in the \*'d (mandatory) fields. But still... you are submitting the registration!

Thanks

# Answer
The answer is that the meaning of that button changes depending on how the registration is set up and the text of the button doesn't change in line with that, unfortunately. I have a pull request in to fix this in future versions.
> 2 votes

---
Tags: issues
---


# Question
Title: Some problems to add email account in CiviMail CiviCRM
I am trying to configure the email address to send messages. I am trying to use a Google Workspace user with custom domain.

Some values that I have are the following:

```
Server: smtp.gmail.com
Username: myemail@apapacheautismo.org
Local part: (empty)
Email domain: apapacheautismo.org
Email return path: (empty)
Protocol: IMAP
Origin: (empty)
Use SSL ?: Yes
Used for: "Bounce Processing"

```

**An error occured while sending or receiving mail. The IMAP server did not accept the username and/or password: A0001 NO \[AUTHENTICATIONFAILED\] Invalid credentials (Failure). (See log for more details.)**

I have already verified username and password and they are correct.

# Answer
First step would be to use Server: imap.gmail.com. smtp.gmail.com is for outgoing mail and Bounce Processing is for checking incoming mail.

Second step would be to verify that Less secure app access is enabled in Gmail.

If that doesn't solve the problem, here are the settings that work for me with Google Apps for bounce processing, same as what you have but using POP instead of IMAP:

`Server: pop.gmail.com Protocol: POP3`

Optionally, add Local part: myemail+ if you want VERP processing.
> 3 votes

---
Tags: civimail, email, evaluating-civicrm, smtp, mailserver
---


# Question
Title: Secondary recipient email body is blank when sent using "Find Contribution"
**Reproduction steps:**

* Click on \**Find Contribution -\> enter a contact name -\> click search \**.
* Select 1 contact (contribution) from the list -\> select "Email send now to 50 or less" from action menu
* Email popup window opens. -\> in the TO field add a second recipient -\> Select a template or add text in body
* Click Send

**Current behaviour:**

* First recipient that was selected from find contribution list receives the email with body, subject & attachment (if any)
* Second recipient who was added later receives a blank email with no body or subject. If any attachment were added, that gets added though.

**Expected behaviour**

* Second recipient who was added later should also receive the same email as the first recipient.

Does anyone have a fix for this please? Thanks

# Answer
> 3 votes
To add additional 'To' in email on Find Contribution action is not supported because the html is build using contribution id, Hence manually added email will not have contribution id selected from Find contribution result. It may be little tricky to change the code to support this. Below patch should work if your email body doesn't have contribution tokens.

```
diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php
index 4fe6e48..ef36a12 100644
--- a/CRM/Activity/BAO/Activity.php
+++ b/CRM/Activity/BAO/Activity.php
@@ -1124,12 +1124,16 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       $contactId = $values['contact_id'];
       $emailAddress = $values['email'];

-      if (!empty($contributionDetails)) {
+      if (!empty($contributionDetails[$contactId])) {
         $subject = $contributionDetails[$contactId]['subject'];
         $text = $contributionDetails[$contactId]['text'];
         $html = $contributionDetails[$contactId]['html'];
       }
-
+      else {
+        $subject = $subject;
+        $text = $text;
+        $html = $html;
+      }
       if (!empty($details) && is_array($details["{$contactId}"])) {
         // unset email from details since it always returns primary email address
         unset($details["{$contactId}"]['email']);

```

Other alternate method is to use Advance Search, Display result as Contact, add contribution filter. Select Contact and choose email action.

HTH

Pradeep

---
Tags: contacts, email, contributions
---


title: CiviMcRestFace installation problem

text:
# Question
Title: CiviMcRestFace installation problem
I've an issue with the plugin CiviMcRestFace. I can't install it in my WP site v. 5.7.2 running on Linux server with php 7.4.6

I download plugin from github (https://github.com/CiviMRF/civimcrestface-wordpress) and then I upload it with WP plugin page. When I try to activate plugin nothing happens, but I can see this error log:

PHP Fatal error: require\_once(): Failed opening required '/Volumes/web/default/crm.depadova.com/wp-content/plugins/civimcrestface-wordpress-master//vendor/autoload.php' (include\_path='/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/form-processor-master/:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/action-provider-master/:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/recaptcha/:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/financialacls/:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/eventcart/:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/ext/greenwich/:.:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/packages:/Volumes/web/default/crm.depadova.com/wp-content/plugins/civicrm/civicrm/vendor/tecnickcom:/Volumes/web/default/crm.depadova.com/wp-content/plu in /Volumes/web/default/crm.depadova.com/wp-content/plugins/civimcrestface-wordpress-master/wpcmrf.php on line 32, referer: http://asterix.y-tech.it/crm.depadova.com/wp-admin/plugins.php?plugin=civimcrestface-wordpress-master%2Fwpcmrf.php

Any ideas? many thanks

# Answer
If you install it from github you need to run the following command in the directory of the plugin `composer install`

This is explained in the readme on Github.

The easiest way to install this plugin is on the Manage plugin page in your wordpress installation and then press add plugin and search for this plugin in the plugin directory.
> 1 votes

# Answer
We've just used and installed this plugin on 5.37.2 as a regular WP extension and it worked fine. No need for a Github version.
> 0 votes

# Answer
I was able to install the plugin on my WP site. The problem is that the zip downloaded from GitHub does not contain the "vendor" directory ... I don't know why.

I then found the complete plugin at this address: https://it.wordpress.org/plugins/connector-civicrm-mcrestface/ I installed it and set up the remote connection.

In the caldera I created a form and added the processor created in the remote CiviCRM.

However, I encountered **first problem**: CviCRm responds with "Unable to decode supplied JSON".

Looking at the code I saw that the json parameter is passed as an attribute container ("$ post\_data. =" & Json = ". Urlencode (json\_encode ($ request));") But the doc civi specifies that "json" should be used to tell the system the type of response: xml or json. In fact, going to modify the portion of code in this way: "& json = 1", CiviCRM is able to manage the call.

But here's a **second problem**. It seems that the Caldera form parameters are not passed to Civi and the form processor responds with the message: "error\_message": "Mandatory key (s) missing from params array ......" FAIL { "entity": "FormProcessor", "action": "nwl\_form\_ita", "options": \[\] }

Thanks a lot for the support
> 0 votes

---
Tags: rest, caldera-forms
---


# Question
Title: Bring up contact by Amatuer Radio callsign rather than name
We have a database of Amateur Radio operators. One field is their callsign. What I would like to do to make editing events faster, is instead of polling by their name, to add callsign to advanced search. Is this possible? Thanks, Steve

# Answer
> 1 votes
As Laryn notes, it should show up in the Custom Fields section of Advanced Search anyway providing the field is marked as searchable.

You can search by callsign in the Quicksearch box by going to `Administer > Customize Data and Screens > Search Preferences` and ticking the callsign field in the Quicksearch options box.

---
Tags: search, advanced
---


# Question
Title: IATS ACH Civi is not recording when a donation has been refunded or returned
Civi is not recording when a donation has been refunded or returned. Is there a way for Civi to record returns or would these have to be recorded manually? IATS EXTENSION: 1.7.4

# Answer
That’s correct and by design. Refunding for example a donation may have other business consequences like revoking a charitable tax receipt already issued for the original donation so best to have a finance/admin have eyes and hands on refunds and ensure the entire refund procedure for their specific org is followed.
> 1 votes

---
Tags: civicontribute, iats, refund
---


# Question
Title: How to set password on backend user-creation?
Is it possible to set the password on backend CMS user-creation in CiviCRM?
I think I saw this in an older CiviCRM-version...
Form ID = Useradd

# Answer
In 5.37 there was a bug that hid the password field. This is fixed in the 5.37 branch but 5.37.3 hasn't been released yet, otherwise it will be in 5.38. If you're on 5.37 you can just replace the CRM/Contact/Form/Task/Useradd.php file with this one: https://raw.githubusercontent.com/civicrm/civicrm-core/5.37/CRM/Contact/Form/Task/Useradd.php

Note that in wordpress if the wordpress configuration says to allow anyone to register, then the password field is intentionally hidden because it was decided that the user should set their own password using the link in the email.
> 2 votes

---
Tags: user-account
---


# Question
Title: Why does CiviDiscount remove the url parameters after a discount code is applied?
A typical event URL looks like this:

But when you apply a discount code, the page is refreshed and the url parameters are removed:

This can lead to unexpected behavior when your url contains e.g. lcMessages, to force civi in a specific language.

Does anyone know why CiviDiscount removes these query parameters?

# Answer
> 2 votes
Form submissions will always remove the parameters because they are now in $\_POST and for example keeping "reset=1" would mean the form would reset and wouldn't get processed fully. So not just cividiscount. Some forms redirect to a different url and might add some parameters but that's specific to the form.

lcMessages is a bit special and yes maybe it needs some extra handling.

---
Tags: cividiscount
---


# Question
Title: CKeditor security issue--does it impact CiviCRM and what to do?
Drupal security reported Project: Drupal core Date: 2021-May-26 Security risk: Moderately critical 14∕25 AC:Basic/A:User/CI:Some/II:Some/E:Proof/TD:Default Vulnerability: Cross Site Scripting Description: Drupal core uses the third-party CKEditor library. This library has an error in parsing HTML that could lead to an XSS attack. CKEditor 4.16.1 and later include the fix.

What should CiviCRM uses do regarding CKeditor within CiviCRM? Is the library installed or is it served via CDN and updated to the latest version?

# Answer
See https://github.com/civicrm/civicrm-core/pull/20428 which will be in 5.38. But my quick read of it is that the addons affected are not installed by default.
> 2 votes

---
Tags: ckeditor, security
---


title: Afform status (Form Builder)

text:
# Question
Title: Afform status (Form Builder)
I did create my first customized Contact form with Form Builder. However, I am unable to create a Membership form: currently le proposed field sets are limited to «Individual» «Activities» «Organization» and «household». Am I missing something or is it merely the current state of the project ?

# Answer
> 2 votes
Welcome to SE! Currently Membership is not supported in Form Builder. A prerequisite for Form Builder is that the entity is supported in APIv4 - and it isn't yet. See https://lab.civicrm.org/dev/core/-/issues/2023

---
Tags: civimember, formbuilder
---


# Question
Title: Stop scheduled reminders for an event after the event is finished
We occasionally have participants get registered for an event by our back-office staff while the event is in progress or even after it is finished. Our events have scheduled reminders set for 1 day and 1 hour before the event. These people who are registered during or after the event do get these scheduled reminders sent to them and it is both confusing to them and spammy of us to send them.

Six years ago someone asked if there was a way to turn this off. I'm hoping that in six years maybe there has been some progress or changes.

Is it possible to get scheduled reminders that are set to "XX time before the event starts" to not fire once the event start time has passed?

Thank you

# Answer
> 1 votes
There is a outstanding PR's for the fix which needs some feedback on test,

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


title: Forms Question -- href issue

text:
# Question
Title: Forms Question -- href issue
I have an extension that adds a tab to Events. The form is called up, and works using the automatic layout for the top piece.

```
 {foreach from=$elementNames item=elementName}
     <div class="crm-section">
     <div class="label">{$form.$elementName.label}</div>
     <div class="content">{$form.$elementName.html}</div>
     <div class="clear"></div>   </div> {/foreach}

```

Further down I add more to this form:

```
/script>
{/literal}
<table border='1' cellpadding='5' cellspacing='5'><tr class="crm-entity" id="TrialComponents" style='border-bottom: 1px solid black'><th>id</th><th>Event ID</th><th>Trial Number</th><th>Trial Date</th><th>Judge</th><th>Started</th><th>Advanced</th><th>Excellent</th><th>Elite Offered</th><th>Games</th></tr>

{crmAPI var='result' entity='TrialComponents' action='get' event_id = $event_id}
{foreach from=$result.values item=component}
<td>{$component.id}</td>
<td>{$component.event_id}</td>
<td>{$component.trial_number}</td>
<td>{$component.trial_date}</td>
<td>{$component.judge}</td>
<td>{$component.started_components}</td>
<td>{$component.advanced_components}</td>
<td>{$component.excellent_components}</td>
<td>{$component.elite_offered}</td>
<td>{$component.games_components}</td>
<td><a href="{$url}&reset=1&action=update&id={$component.id}" class="crm-popup"> Edit </a><a href="javascript:deleteComponent({$component.id})"> Delete </a></td></tr>
{/foreach}
<a title="Add a Component" class="button_name button crm-popup" href="{$url}?reset=1&action=add&id={$event_id}">
  <span>Add Component</span>
</a>

```

The idea here is I have a one to multi so this second bit lists out the component section, and I have an Edit and a Delete function associated with each line. The Delete works fine but its the href that does not. I have a second form in this extension called EditComponent, which I want to call and put in the popup window that gets produced when you hit the edit or Add Component. The issue is I'm getting a 404 error and it can't find that form? What URL should I be using in there to get that other form in the popup? My extension is called TrialAdmin and the two forms are called TrialDetails and EditComponent, both in the same directory of the extension. I think I'm just too tired to think this one through -- help?

# Answer
> 2 votes
Resolved this issue by using:

```
<td><a href="{crmURL p='civicrm/EditComponent' q='reset=1&action=update&id=2'}" class="crm-popup"> Edit </a><a href="javascript:deleteComponent({$component.id})"> Delete </a></td></tr>

```

---
Tags: extension, quickform
---


title: Select2 in php forms?

text:
# Question
Title: Select2 in php forms?
I have a simple quickform --

```
    $this->add('text','trial_number','Trial Number',TRUE);
    $this->add('date','Trial_Date',ts('Trial Date'),CRM_Core_SelectValues::date(NULL, 'Y M d',15,1) );
    $this->addEntityRef('judge',ts('Assigned Judge'));
    $this->add('advmultiselect','started_components','Started Components',$this->getOptions("regComponents"),FALSE);
    $this->add('advmultiselect','advanced_components','Advanced Components',$this->getOptions("regComponents"),FALSE);
    $this->add('advmultiselect','excellent_components','Excellent Components',$this->getOptions("regComponents"),FALSE);
    $this->add('checkbox','elite_offered','Elite Offered',FALSE);
    $this->add('advmultiselect','games_components','Games Components',$this->getOptions("gameComponents"),FALSE);

```

However, the advmultiselect fields I would like to use select2 for multiple selections of the options. I have searched, and searched, yet cannot find any examples as to the format of the select2 add. The options are straight forward - all in a function called getOptions(). The advmultiselect works, but well, that's just ugly.

What is the format of the add('select2'.... and what attributes can I set?

Thanks Norm

# Answer
> 1 votes
It should work using the following format

```
$this->add('select', [YOUR CODE HERE] array('multiple' => TRUE, 'class' => 'crm-select2'));

```

https://docs.civicrm.org/dev/en/latest/framework/quickform/entityref/
https://select2.org/

---
Tags: php, forms, select2
---


title: Connecting Power BI to Civi

text:
# Question
Title: Connecting Power BI to Civi
Has anyone tried to connect Civi to Power BI? I'm considering using this platform for some more in depth analytics.

# Answer
> 0 votes
I don't believe anyone has, but Power BI has a MySQL connector component, so it appears that would be all you need:

https://powerbi.microsoft.com/en-us/integrations/mysql/

# Answer
> 5 votes
Connecting with API could be a better solution. This is how I did it:

**Step 1: Prepare data in CiviCRM**

* Get the site key
* Create a CiviCRM and Drupal user with correct access rights
* Get(Create) the API-key of that user
* Create a data processor with relevant data, accessed with API
* First column to be an index key, used to connect with other CiviCRM data sources
* Amounts to be Aggregate functions, 2 decimals, comma as decimal separator,
and space as thousand separator
* Avoid including any personal information in the data processor API-call, than there will be no privacy risk involved with PowerBI.
* With data processor API calls, only get-function is available. That means no risk of anyone updating/creating values in database
* Test by input URL to a browser

https://\[site-URL\]/\[CiviCRM folder\]?entity=\[name of API-call or data processor\]&action=get&api\_key=\[api-key of a CiviCRM&Drupal user with proper access rights\]&key=\[Site key\]&version=\[API version\]&json{"sequential":1,"options":{"limit":0}}

**Step 2: Proxy (if relevant)**

* Add API-call to CiviProxy
* Get different site URL, CiviCRM folder, Api-key and site keys
* Build up a new URL
* Test by input URL to a browser

**Step 3: Connect Power BI**

* Get data with Web connection
* Input URL that is tested after proxy

**Step 4: Create graphs and statistics in PowerBI**

* Transform columns to correct data type!
* Schedule automatical refresh(es). Daily at 03.00 am is a good suggestion, as that will likely not cause any performance issues in CiviCRM
* Connect different data sources in Power BI, like website traffic

---
Tags: civireport
---


# Question
Title: Add a custom field as a column in relationship tab
I added a column in relationship tab, to do that I edited the civicrm/CRM/Contact/BAO/Relationship.php

I already added columns with fields existing in the base of civicrm but now I'm trying to add a custom field of a custom group as a column.

In the function makeURLClause() I don't know what to add in the select so it can select my custom field.

the name of the custom group is civicrm\_value\_r\_le\_11 the name of the custom value is fonction\_dans\_l\_entreprise\_83 I tried `civicrm_civicrm_value_r_le_11.custom_83 as custom_83,` but it didn't work

# Answer
> 2 votes
You really don't want to be modifying core files to do that. See here for a different approach.

---
Tags: custom-fields, database, relationships, column
---


# Question
Title: How do I enable recuring donations when I have two payment processors enabled, one which supports recuring donations and one that does not?
I am using WP Version 5.7.2 and CiviCRM V 5.37.0. The two payment processors are Stripe and BTCPay.

BTCPay obviously does not support recurring payments (not really a thing with cryptocurrency atm) but Stripe does. So when someone pays with Stripe, there should be an option for them to make recurring payments.

But every time I try to enable BTCPay as a payment processor, the recurring payment option checkbox disappears.

Video shows the problem: https://watch.rt4mn.org/videos/watch/f255ffe2-71b8-48d9-acf4-1bac95aeb90e

# Answer
> 4 votes
You can't do this on the same contribution page (at least not without custom code). If one of the enabled processors does not support recurring contributions the option will not be available on the entire contribution page.

The solution normally used is to have two separate contribution pages.

---
Tags: wordpress, contributions, stripe
---


title: sql queries using too many resources

text:
# Question
Title: sql queries using too many resources
My host has said one of my sites is using too many sql minutes. I have a list of sql queries (20 in total) which are using the most system resources.

The information starts

```
'civicrm_tmp_e_gccache_50974519e3a17388f13e9f857d1c2320'
#    SHOW CREATE TABLE `database_civicrm`.`civicrm_tmp_e_gccache_50974519e3a17388f13e9f857d1c2320`
#    SHOW TABLE STATUS FROM `database_civicrm` LIKE 'civicrm_contact'
#    SHOW CREATE TABLE `database_civicrm`.`civicrm_contact`
#    SHOW TABLE STATUS FROM `database_civicrm` LIKE 'civicrm_activity_contact'
#    SHOW CREATE TABLE `database_civicrm`.`civicrm_activity_contact`
#    SHOW TABLE STATUS FROM `database_civicrm` LIKE 'civicrm_activity'
#    SHOW CREATE TABLE `database_civicrm`.`civicrm_activity`
#    SHOW TABLE STATUS FROM `database_civicrm` LIKE 'civicrm_group_contact'
#    SHOW CREATE TABLE `database_civicrm`.`civicrm_group_contact`

```

How can I match this information up with something my civicrm is doing? This query has run for 172seconds and run 1239 times - although I'm not sure over what time period.

Thanks Caroline

# Answer
The gccache one is group contact cache. You probably have a cron job that rebuilds the group contact cache periodically, or it can also happen when the cache expires.

The other ones come from either

* converting to utf8mb4, which you probably only ran once but it would have run on every table
* turning on advanced logging (administer - system settings - misc) which also you probably would have only turned on once, but it will also partially run when you do something like add a custom field
> 1 votes

---
Tags: mysql
---


title: Drupal 9 Compilation Install Error

text:
# Question
Title: Drupal 9 Compilation Install Error
I’m trying get CiviCRM working on a Drupal 9.1.9 test site. I know CiviCRM but not Drupal… I followed this: https://docs.civicrm.org/installation/en/latest/drupal8/

These are the commands I ran to install it:

php composer.phar create-project drupal/recommended-project

php composer.phar require pear/validate\_finance\_creditcard:dev-master

php composer.phar config extra.enable-patching true

php composer.phar require civicrm/civicrm-asset-plugin:'~1.1'

php composer.phar require civicrm/civicrm-{core,packages,drupal-8}:'~5.37.2'

The last command does a lot of installing and then gives me:

\[Exception\]
Cannot prompt for compilation preferences. Please update COMPOSER\_COMPILE, extra.compile-mode, or extra.compile-whitelist.

compile \[--all\] \[-N|--dry-run\] \[--soft-options \[SOFT-OPTIONS\]\] \[--\] \[\]...

Subcommand @composer compile returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

\[RuntimeException\]
Subcommand @composer compile returned with error code 1

Composer version 2.0.14 PHP 7.4.14

Can someone please assist…thanks!

# Answer
> 1 votes
Add this line to the top level composer.json and then run `composer compile`:

`"compile-whitelist": ["civicrm/civicrm-core", "civicrm/composer-compile-lib"]`

Then it won't try to prompt you next time for upgrades either.

---
Tags: drupal-9
---


# Question
Title: How to change participant role in CiviRules with trigger "event participant is added"?
Is it possible in CiviRules to **change the participant role** (action)
when a **participant is added** (trigger)
for **specific status** (condition)?
The opposite – to update the participant status for certain role(s) using the same trigger – is possible out of the box.

**Can this be achieved without having to write a new/custom action as described here?**

# Answer
**By default, CiviCRM uses the default participant role specified in the event settings.**
As there is only one participant role defined per event in CiviEvent, the desired behaviour can't be achieved through CiviRules.
When doing a **batch import of participants**, the role(s) can be set in the .csv-file.
When **manually registering participants**, one or multiple roles can be chosen.
When **participants register**, an extension like **THIS** would be necessary in order to have their roles separated.
> 2 votes

---
Tags: civirules
---


# Question
Title: Does CiviCRM work with Sharepoint/Googledocs?
I found this question from last year titled document management system. I would like to investigate ways to link CiviCRM to something like Sharepoint/Googledocs. Is there an update to this/some sort of extension?

Former question posted on StackExchange: Document Managment System

We're looking for a way to use One Drive or Google Docs in a document management system that allows users to log into Civi, open up the documents folder and edit the document from within Civi, without ever leaving Civi.

Does something like this exist perhaps?

Many thanks

# Answer
See if the Sharepoint extension does what you want.
> 1 votes

---
Tags: documentation, attachments, hyperlinks, document-management
---


# Question
Title: Profile in wordpress need phone validation
I have this profile form made https://emptyhometax.org/civicrm/profile/create/?gid=2&reset=1 and want to make it so phone can only be enter in one way through validation 123-456-7890. I don't want people to be able to leave our a number or put in an extra one.

# Answer
> 1 votes
Can you do this using caldera form with Civi integration? Or afform extension in Civi?

---
Tags: wordpress, phone, validation
---


title: Transferring from one event to another

text:
# Question
Title: Transferring from one event to another
civiCRM: 5.37.0, using civiEvent Drupal: 7.80

This is our first year using civiCRM, so rather than allowing participants to self-transfer from one event to another, I decided to do this myself. When I go to the transferring participant at "Manage Events" and click on "Transfer or Cancel" button (on the right, under "More"), I have the option of "Transfer or Cancel." Cancel works as it ought but Transfer gets "Select Contact" (and does nothing) rather than "Select Event" or some such tag.

My only option seems to be to cancel and manually register.

Is this a bug? Or am I doing something wrong?

Tom

# Answer
> 1 votes
The function of Transfer is to move the registration from one participant to another. Its not to transfer the booking to another event. For that you'd need to cancel the participation record for this event and register the contact onto the new event. Hope that makes sense.

---
Tags: civievent
---


title: CiviCRM old version

text:
# Question
Title: CiviCRM old version
If an old version of CiviCRM is installed on my wordpress site, are there dangers to the website? eg security dangers, site malfunctioning etc.

thank you

# Answer
Unless you are on at least the most recent security release then your site contains known security vulnerabilities (currently 5.35.2 / 5.36.1 - see release notes). However, whether those vulnerabilities are actually exploitable on your system depends on many factors, but it's a bad place to be.

You may also encounter other problems - for example if your hosting upgrades the version of php to something more recent than your version of CiviCRM can cope with.

What is stopping you upgrading to the current version?
> 1 votes

---
Tags: version
---


# Question
Title: Anonymous user permissions column missing
Our users trigger a “you don’t have permission to access this page” error when trying to make a contribution or opt out of an email. I’ve read some responses on SE about setting permissions for an anonymous user which seem related. But when I visit the “WordPress access control page” there is no column for Anonymous user permissions. What would cause that and how do I fix it?

# Answer
I may have found the answer here. I created an anonymous\_user role as described, and the column appears in the permissions page now. I am testing to see if the errors go away.

Edit: it does work. BTW this is not a multi site install as was described on the linked issue, but it worked here on our single site.
> 2 votes

---
Tags: wordpress, permissions, anonymous-user
---


# Question
Title: How does one override print.css (Drupal 7 / CiviCRM 5.36.x)
This is referencing a Drupal 7 website with CiviCRM 5.36.x

When CiviCRM prints from a modal it invokes print.css which lives in /sites/all/modules/civicrm/css/. It does not invoke any other theme level css or the custom css that can be set in Administer/System Settings/Resource URLs.

In the case I'm working on, I have attached custom fieldsets to my membership types and applicants can apply via a webform to include a great deal of data.

If I view a membership from a contact record and print, the OEM print.css is invoked and the printed result or PDF is useless. To overcome this shortcoming, I've modified print.css but I'm looking for a long-term sustainable solution.

How does one override print.css with custom css?

Thanks.

# Answer
> 2 votes
I think you can use addStyle or addStyleUrl or addStyleFile methods

eg:

```
function extensionname_civicrm_config(&$config) {
  if (!empty($_REQUEST['snippet']) && $_REQUEST['snippet'] == 2) {
    Civi::resources()->addStyle('.label {
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }');
  }
}

```

---
Tags: css, drupal-7
---


# Question
Title: Using a dropdown box for selecting stateprovice?
I'm trying to change some forms from quickforms to angularjs.
In quickforms you do this: $this-\>addEntityRef('Location\_province', ts('Select Province'), \['entity' =\> 'state\_province',\]);

How do I replicate this in Angularjs? This is what I thought I should do but probably a class or something in CRM to already do this: In js file:

```
provinces = crmApi('state_province', 'get', {
      country_id: 1039,
    })
// do I process provinces to get to the values I want?
this.province = provinces
var ctrl = this

```

In the html template file I have:

```
<div crm-ui-field="{name: 'myForm.location_province', title: ts('Province'),}">
            <select
              crm-ui-select="{allowClear: true}"
              ng-model="$ctrl.myContact.location_province"
              multiple="single"
              class="big"
            >
              <option ng-repeat="option in $ctrl.province.values" value="{{option.name}}">
              {{option.name}}
            </option>
            </select>
            {{myform.location_province}}
          </div>

```

So its not working because the crmApi returns it in an array of multiple levels so is there a class to do this for me?

Thanks in advance!

# Answer
Try below code

```
<div crm-ui-field="{name: 'myForm.location_province', title: ts('Province')}">
  <input
    name="myForm.location_province" crm-ui-id="myForm.location_province"
     crm-entityref="{entity: 'state_province', api: {params: {country_id: 1039, is_active: 1, options:{sort:\'name\'}}}, select: {allowClear: true, minimumInputLength: 0, placeholder: ts(\'Select State\')}}"
    ng-model="myForm.location_province"
  />
</div>

```
> 2 votes

---
Tags: civicrm-entity, angular
---


# Question
Title: Update error - Error: core-issue#2487 Add / alter defaults for civicrm_contribution_recur
I get an update error when updating - see attached screen capture.

The error happens when upgrading from 5.36 to 5.37 and 5.38 (which is currently the latest). The error occurs when using the browser and drush to update.

Running Drupal version: 7.81 (currently the latest)

There are Civi extension updates, I normally update Civi before extensions. Not sure if this is causing an issue.

I can also upload the drush error log as well if that will help.

Any help is appreciated.

# Answer
> 0 votes
The problem is contribution\_status\_id - it can't set the default value because it isn't able to find the status corresponding to Pending. Did you maybe delete that status in your system?

---
Tags: drupal, upgrade, drupal-7
---


# Question
Title: "HTTP Error 404.0 - Not Found" error on Contribution page
I'm relatively new to CiviCRM and am excited to learn more about the application in the future. I have a Wordpress site created using Elementor. I have plenty of contacts and donations in the CiviCRM database. I'd like to implement a proper CiviContribute contribution page. I set up a payment processor and the contribution page, but no matter what I do, I get this "404 - Not Found" error. Other than that, everything works fine.

I've tried disabling all the other plugins, and don't see anything in the log file in the ConfigAndLog directory. I'm at a loss - any ideas on how I can troubleshoot this?

Here's the link to the contribution page: https://maranathacm.org/civicrm/contribute/transact/?reset=1&id=3

Thanks in advance for your help.

# Answer
> 1 votes
Make sure that the base page is set - go to https://maranathacm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fsetting%2Fuf&reset=1

Review the Base Page setting and value, it cannot be blank

Make sure there is a published page that matches the one in that page

If there is no value there, add one, civicrm is the default and then create a WP page with that slug

Make sure the page is public and visible to all

Once you've done that (or confirmed the base page exists) Visit this page https://maranathacm.org/wp-admin/options-permalink.php

Confirm that your permalinks are set to anything EXCEPT Plain

If it is set to Plain change to one of the other options and save

If it is not set to plain, you can exit the page

Flush CiviCRM Caches go to https://maranathacm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fsetting%2FupdateConfigBackend&reset=1 and click cleanup caches

---
Tags: civicontribute
---


# Question
Title: User cannot sort the cases using 'most recent'
On Find case result screen, when sorted using 'Most recent' column get DB error. Is this know error?

```
Type    DB_Error
Code    -19
Message DB Error: no such field
Mode    16
UserInfo    SELECT civicrm_case.id , contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_case.id as case_id, civicrm_case_type.title as case_type, case_status.label as case_status, civicrm_case.is_deleted as case_deleted, IF(case_relationship.contact_id_b = contact_a.id, case_relation_type.label_b_a, case_relation_type.label_a_b) as case_role, case_activity.activity_date_time as case_activity_date_time, case_activity.subject as case_activity_subject, civicrm_case.subject as case_subject, rec_activity_type.label as case_activity_type FROM civicrm_contact contact_a LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 202 AND case_relationship.case_id = civicrm_case.id OR case_relationship.contact_id_b = civicrm_case_contact.contact_id AND case_relationship.contact_id_a = 202 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type') LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id WHERE ( civicrm_case.is_deleted = 0 ) AND ( 1 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_case.id ORDER BY `case_recent_activity_date` asc, `contact_a`.`id` LIMIT 0, 50 [nativecode=1054 ** Unknown column 'case_recent_activity_date' in 'order clause']
DebugInfo   SELECT civicrm_case.id , contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_case.id as case_id, civicrm_case_type.title as case_type, case_status.label as case_status, civicrm_case.is_deleted as case_deleted, IF(case_relationship.contact_id_b = contact_a.id, case_relation_type.label_b_a, case_relation_type.label_a_b) as case_role, case_activity.activity_date_time as case_activity_date_time, case_activity.subject as case_activity_subject, civicrm_case.subject as case_subject, rec_activity_type.label as case_activity_type FROM civicrm_contact contact_a LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id INNER JOIN civicrm_case ON civicrm_case_contact.case_id = civicrm_case.id LEFT JOIN civicrm_relationship case_relationship ON ( case_relationship.contact_id_a = civicrm_case_contact.contact_id AND case_relationship.contact_id_b = 202 AND case_relationship.case_id = civicrm_case.id OR case_relationship.contact_id_b = civicrm_case_contact.contact_id AND case_relationship.contact_id_a = 202 AND case_relationship.case_id = civicrm_case.id ) LEFT JOIN civicrm_relationship_type case_relation_type ON ( case_relation_type.id = case_relationship.relationship_type_id AND case_relation_type.id = case_relationship.relationship_type_id ) INNER JOIN civicrm_case_activity ON civicrm_case_activity.case_id = civicrm_case.id INNER JOIN civicrm_activity case_activity ON ( civicrm_case_activity.activity_id = case_activity.id AND case_activity.is_current_revision = 1 ) LEFT JOIN civicrm_option_group option_group_activity_type ON (option_group_activity_type.name = 'activity_type') LEFT JOIN civicrm_option_value rec_activity_type ON (case_activity.activity_type_id = rec_activity_type.value AND option_group_activity_type.id = rec_activity_type.option_group_id ) LEFT JOIN civicrm_option_group option_group_case_status ON (option_group_case_status.name = 'case_status') LEFT JOIN civicrm_option_value case_status ON (civicrm_case.status_id = case_status.value AND option_group_case_status.id = case_status.option_group_id ) LEFT JOIN civicrm_case_type ON civicrm_case.case_type_id = civicrm_case_type.id WHERE ( civicrm_case.is_deleted = 0 ) AND ( 1 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_case.id ORDER BY `case_recent_activity_date` asc, `contact_a`.`id` LIMIT 0, 50 [nativecode=1054 ** Unknown column 'case_recent_activity_date' in 'order clause']

```

# Answer
> 2 votes
Yes, its a known issue and is reported on CiviCRM gitlab. Difficult one to support or fix as the data is filled when the rows for results are altered after fetched from database. May be turn off the sorting for the column using JS?

---
Tags: civicase
---


# Question
Title: how can i delete reserved dedupe rules in civicrm
i'am using civicrm and i want to delete some dedupe rules but the problem i dont see the buttom delete. Can you help me please ?

# Answer
you can't from the backoffice, you need to edit the rule in the table `civicrm_dedupe_rule_group` and set `is_reserved` to `0`
> 3 votes

---
Tags: dedupe-rules
---


title: Upgrade Drupal 7 to Drupal 9

text:
# Question
Title: Upgrade Drupal 7 to Drupal 9
I am upgrading Drupal 7 to Drupal 9 and trying to copy over my CiviCRM database.

My Drupal 9 install is fresh. I used the instructions at https://docs.civicrm.org/installation/en/latest/drupal8/ to download CiviCRM with Composer.

I have upgraded the existing CiviCRM settings file to work with Drupal 9.

The problem is that I am getting the following error when trying to load Drupal."Warning: require\_once(CRM/Core/ClassLoader.php): failed to open stream: No such file or directory in require\_once() (line 516 of /home/user/public\_html/web/sites/default/civicrm."

As expected Drupal will not load at all.

I have checked all my paths and that CiviCRM is in my vendor folder. /home/user/public\_html/vendor/civicrm

Any help is greatly appreciated.

Thanks, Josh

# Answer
Have you updated the civicrm.settings.php to include new location for $civicrm\_root?

Add below entries in your civicrm.settings.php

```
$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/';
$civicrm_paths['civicrm.root']['url'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/';
$civicrm_setting['domain']['userFrameworkResourceURL'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/';
$civicrm_paths['cms.root']['path'] = '/home/path-to-drupal9/web';

```
> 3 votes

---
Tags: upgrade, drupal-8, drupal-9
---


# Question
Title: How to create a non report based dashlet
Expanding on this question here: dashlet creation

If I wanted to create my own dashlet with somewhat static content I'm wondering how that is accomplished, I have a loose idea below but not sure if it is correct.

How do I register the dashlet itself, since I won't be starting from a report - can I add a row to the database itself?

That row in the database would then point to a URL similar to the others (i.e. civicrm/dashlet/blog?reset=1). If I point to my own /dashlet/goodinfo... do I need to create *both* a supporting tpl and php file (kept neatly in a custom/override folder) or will a tpl file suffice?

I may be headed down an entirely incorrect path - open to suggestions!

# Answer
If you're on Drupal, you can use the civicrm\_views\_dashlets module for a no-coding solution. Not only can use create a view that shows a single page (which is editable like any other page), but you can use Views to show more complex content.

For instance, when I worked on a CiviCRM-based SaaS a few years back, we created our own "news" dashlet by publishing an RSS feed from a central site, which was picked up by the Drupal Feeds module to populate the View.
> 2 votes

# Answer
When that other question mentions news dashlet I think it means the one called Blog, but yours sounds more similar to the Getting Started one - CRM/Dashlet/Page/GettingStarted.php.

Civix doesn't have a specific feature for dashlets, but you start with civix generate:page and copy/paste from the GettingStarted dashlet, although all you really need to do is optionally assign some smarty variables in run() in the autogenerated php class and edit the autogenerated .tpl with your html.

In the xml menu file that gets autogenerated it will have the url path you made up during the generate:page command. You need to insert an entry in civicrm\_dashboard that links that url up to make it dashboard-worthy. See the function addGettingStartedDashlet() in CRM/Upgrade/Incremental/php/FourSeven.php, just note the columns have changed slightly if you're on a later version.
> 1 votes

# Answer
I created an extension for a custom dashlet with static text.

It's called **Dashlet Note**, and can be downloaded here: https://github.com/AlainBenbassat/eu.businessandcode.dashletnote

You can use it to display announcements to users, shortcuts to certain pages, usefull phone numbers...

There's an editor to create/edit the note.
> 1 votes

---
Tags: dashboard, dashlet
---


title: Dashlet memo pad

text:
# Question
Title: Dashlet memo pad
I'm sharing the administration of CiviCRM with 2 other people. I would like the capability to leave notes and reminders for the other admins on their dashboard. Does anyone know of an extension that provides memo pad/notes as a dashlet?

The CMS is Joomla so can't use an Drupal functions.

Thanks for any help

# Answer
> 2 votes
You can try Dashlet Note: https://github.com/AlainBenbassat/eu.businessandcode.dashletnote

There's an editor to create/edit a note. That note is saved as a dashlet and can be added on the dashboard.

# Answer
> 1 votes
You can use CiviAlert extension, you can configure it per user as well.

HTH

Pradeep

---
Tags: dashboard, dashlet
---


title: CiviMobile local timezone

text:
# Question
Title: CiviMobile local timezone
When I create activities etc. on CiviMobile in my Time Zone I am in it displays as 9 hours later. Currently I am -7 GMT and when setting an activity on the app it automatically changes it to +2 GMT (9 hours ahead of my time zone). When I look on CiviCRM, the activities I created in CiviMobile are 9 hours ahead there too. I’m using the latest CiviMobile on and iPhone. How do I get CiviMobile to use the time/time zone on my phone?

# Answer
Jerry, Welcome to CiviCRM stackexchange, your civicrm database stores certain fields with data-type "DATETIME". To improve timezone support, you may want to change these from "DATETIME" to "TIMESTAMP".

For further discussion, please visit https://github.com/civicrm/org.civicrm.doctorwhen
> 2 votes

# Answer
This is a workaround, not a solution:
Comment out the `time_zone_utc_offset` in **PublicSettings.php**, in **Cms.php** and in **CiviMobileSystem.php**

CiviMobile takes the server timezone-settings. Depending on what has been configured there, the result can be misleading...
> 1 votes

---
Tags: timezone, civimobile
---


title: group visibility missing options

text:
# Question
Title: group visibility missing options
I Would like to create groups "exposed publicy and for listings". Buit while the option is available in search-form under "Manage Groups", ist not available within the group settings. There I only have "user and usaer-admin only" and "expose publicy"

# Answer
those are the only two options available on manage group settings
> 1 votes

---
Tags: profile, groups, search-results
---


title: Remove Default Dashlets

text:
# Question
Title: Remove Default Dashlets
Generally, I tend not to use the CiviCRM Home page since it's not a global dashboard. However, recently, I thought some of the dashlets could be beneficial for my users.

My question is: is it possible to remove or hide some of the default dashlets (specifically, CiviCRM Resources, CiviCRM news)?

The last time I visited this feature, I recall that there is no way to reset everyone's dashboard to have the same dashlets correct? DefaultDashlets only sets dashboards for new users but not existing users.

# Answer
> 3 votes
You could update mysql directly:

`UPDATE civicrm_dashboard_contact SET is_active = 0 WHERE dashboard_id IN (1,2);`

1 and 2 are the ones you mentioned. You can double-check with `select id,label from civicrm_dashboard;`

```
+----+------------------------+
| id | label                  |
+----+------------------------+
|  1 | CiviCRM News           |
|  2 | CiviCRM Resources      |
|  3 | Activities             |
|  4 | My Cases               |
|  5 | All Cases              |
|  6 | Case Dashboard Dashlet |
+----+------------------------+

```

---
Tags: dashlet
---


# Question
Title: How to bulk modify email addresses as a result of re-brand?
I've got about 80 records in my database for contacts who all work for an important organisation that we liaise with. They've just changed their email domain, but all of the front part of their email addresses don't change, e.g. bob@old-domain.org is now bob@new-domain.org.

What's the simplest way to update all 80 addresses in CiviCRM?

# Answer
> 7 votes
Run a sql query on mysql table

```
UPDATE civicrm_email
SET email = REPLACE(email, '@old-domain.org', '@new-domain.org')
WHERE email LIKE '%@old-domain.org';

```

# Answer
> 5 votes
You can do a contact search for contacts with that email adress ending, and then bulk update with profile. And then manually copy/paste the correct ending on all 80 emails, before saving.

It takes more time than the SQL, but on the other hand you do it in the UI and have full control of the result without having to do extensive testing (which you should do when using SQL-commands pasted from online)

# Answer
> 3 votes
You could export the above 80 with their Contact ID, then do a find/replace in a s/sheet, then reimport them using 'update' and match on Contact ID

(hmm having written this i now wonder if it would overwrite the existing email address or just add another one. will leave this here for now but delete if someone points out i am wrong)

As Alan says below "Using civicrm.org/extensions/api-csv-import-gui \[you can work\] directly with the email entities"

---
Tags: contacts
---


title: Searching for Test Contributions

text:
# Question
Title: Searching for Test Contributions
I have just started making contributions in Test mode. I understand that "Test contributions are not visible on the Contributions tab, but can be viewed by searching for 'Test Contributions' in the CiviContribute search form", but I don't know how to filter that Find Contribution form to generate the test results. Eg. When I search for contributions made this year the test contributions I made today aren't returned. Am I using the wrong search form?

# Answer
Thanks to Demerit. I used the box that says "Contribution is a Test? Yes No ". It's about half-way down on the left on the find contributions form (Contributions -\> Find Contributions).
> 2 votes

---
Tags: search, testing
---


title: merge fields list in search kit

text:
# Question
Title: merge fields list in search kit
how to get ID of a relationship in Search Kit ?

# Answer
> 3 votes
The field was just not exposed and @coleman did a commit that will be active starting from version 5.39:

https://github.com/civicrm/civicrm-core/pull/20558

---
Tags: tokens
---


title: How to set Up a Cron Job

text:
# Question
Title: How to set Up a Cron Job
I am trying to set up the cron job, can't seem to get it to work. I keep getting invalid user/password. I am trying the HTTP method. I am using WordPress I am on a shared server.

# Answer
Welcome to SE! Can you install cv? If so, I find that the most straightforward for cron. See https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/#cv

For the HTTP method, does the user/password work when logging in via GUI? Does it work with curl or wget? (See same doc) Check that works before adding the complications of cron itself.
> 0 votes

---
Tags: wordpress, cron
---


# Question
Title: Find contribution excluding certain financial types and sending email
I have around 30 financial types listed in CiviCRM. I would like to find a list of contribution excluding 5 of those financial types and send an email. This is something needs doing often.

If I would not need to send email excluding certain financial types, it’s easy to use just by navigating Find Contribution and send email. But excluding certain financial types is the only issue.

What other option do I have where I can set excluding financial types and send email? Is search-kit able to do something? Thanks

# Answer
> 2 votes
Have you considered using the search builder to create a smart group of contributors who have given to financial types *not in* those five types? Then you could send an email to that group when needed.

---
Tags: civicontribute, email, search, receipts
---


# Question
Title: Is there a way to include group and tags on a contact report
I built a report off of the Constituent Summary report and I am wondering is there a way to include groups and tags in that report that will export as a csv? Also why are some reports only exportable as a pdf and others give the option as a csv?

# Answer
Those fields aren't available from reports as far as I can see, but you can get your csv from a search. You can get all records from a contact search and then export including the group and tag fields. Or if you only want to select the records with groups or tags set you can use Search Builder to select these using include **contacts where group is not empty and also include records where tag is not empty**.
> 1 votes

---
Tags: groups, tags, csv
---


# Question
Title: Uncaught Symfony "cannot rename" causing Critical Error on Wordpress
I got a Critical Error today which has caused the backend of the website to be inaccessible. Is there a way to fix this? and is there a way to stop this from happening?

An error of type E\_ERROR was caused in line 289 of the file /nas/content/live/icadev21/wp-content/plugins/civicrm/civicrm/vendor/symfony/filesystem/Filesystem.php. Error message: Uncaught Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/nas/content/live/icadev21/wp-content/uploads/civicrm/templates\_c/CachedCiviContainer.38f8e379763eb3410e8abbe75dff0d3c.phpk3pMie" to "/nas/content/live/icadev21/wp-content/uploads/civicrm/templates\_c/CachedCiviContainer.38f8e379763eb3410e8abbe75dff0d3c.php". in /nas/content/live/icadev21/wp-content/plugins/civicrm/civicrm/vendor/symfony/filesystem/Filesystem.php:289

Stack trace:

```
#0 /nas/content/live/icadev21/wp-content/plugins/civicrm/civicrm/vendor/symfony/filesystem/Filesystem.php(694): Symfony\Component\Filesystem\Filesystem->rename('/nas/content/li...', '/nas/content/li...', true)
#1 /nas/content/live/icadev21/wp-content/plugins/civicrm/civicrm/vendor/symfony/config/ResourceCheckerConfigCache.php(124): Symfony\Component\Filesystem\Filesystem->dumpFile('/nas/content/li...', '

```

Site Specs: WordPress version 5.7.2 Current theme: Avada (version 6.2.3) Current plugin: CiviCRM (version 5.38.0) PHP version 7.4.18

I'm not an expert coder but have access to FTP files to make changes. I could use all the help I can get. Thanks.

# Answer
> 1 votes
Welcome to SE! The error is about renaming files which suggests a permissions problem. Check the permissions on the templates\_c folder and remove all the existing files in there (they will be recreated automatically).

Is this a new site? If so, how did you do the installation? Permissions should normally be taken care of by the installation process.

---
Tags: wordpress, error, issues, filesystem
---


title: Full text search through API

text:
# Question
Title: Full text search through API
A client of my asked me to implement a Search functionality on their website, which interfaces with CiviCRM through the API. The 'Full text search' functionality of CiviCRM does exactly what is required, so I was wondering, is it possible to call it through the API?

Thanks!

# Answer
> 2 votes
Welcome to SE! I don't think you can call full-text search through the API currently. But you could write an extension to provide that as an API call based on CRM/Contact/Form/Search/Custom/FullText.php

However, that is a heavy search and can cause problems on a large site. You might be better to refine what you really need to search for and then use APIv4 to do the searches.

---
Tags: search
---


# Question
Title: Do the profiles for search results apply only to advanced search?
I discover the profiles, especially for the search results. Do these search profiles only work in advanced search? How do I change the look of a search on memberships, or contributions?

I have tried to create a search profile with a custom Contacts field and the Member Type field, but it does not appear in the Advanced Search Profiles drop-down list and the Membership search always displays the same result columns.

I looked at the pages of the manual but found nothing about it (https://docs.civicrm.org/user/fr/latest/organising-your-data/profiles/ and https://docs.civicrm.org/user/fr/latest/initial-set-up/customizing-the-user-interface/#personnalisation-des-ecrans-de-recherche)

Thank you in advance for your help.

# Answer
> 2 votes
The profiles are only used for contact searches. Advanced Search lets you select a profile but you can also change the default profile (`Administer > Customize Data and Screens > Search Preferences > Default Contact Search Profile`) and that will change the results displayed from a simple search.

There are other questions on here about customising the results of contribution and membership searches which may be helpful - but it's not as simple as creating a profile.

One of the exciting new developments is SearchKit which Coleman is leading. You can build your own search for Contacts and Contributions and configure what fields to show. See this video. Memberships are not supported yet but SearchKit is progressing rapidly.

---
Tags: profile, search-results
---


# Question
Title: Smarty for greeting not functioning anymore on civicrm > 5.35
Is there any reason why a custom greeting using smarty wouldn't work anymore on recent versions of CiviCRM:

`{if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif "{contact.gender}"=="Homme"}Cher{ }{contact.first_name}{/if}`

was working smoothly until recently on both WP and Drupal?

I don't understand what happened :-/

Of course Smarty is enabled :

```
if (!defined('CIVICRM_MAIL_SMARTY')) {   define( 'CIVICRM_MAIL_SMARTY', 1 ); }

```

# Answer
> 0 votes
Gender wasn't properly define and @Fabian inspired me this little improvement:

`{if "{contact.gender}"=="Femme"}Chère{ }{contact.first_name}{elseif "{contact.gender}"=="Homme"}Cher{ }{contact.first_name}{else}{contact.first_name}{/if}`

---
Tags: smarty
---


# Question
Title: Variable membership start date with fixed end date
Our client has a membership plan that offers a 3 Month membership but it has to stop for accounting reason by the 31st of August. So if it starts on the 10th of February, end date will be after 3 months on the 9th of May but if it starts on 10th of July it will be ending on the 31st of August. It seems unfair but their work this way.

Is this possible? I only know fixed or variable but not a mix of it.

# Answer
> 3 votes
Unfortunately that's not possible via UI config, we also had similar request and end up writing extension to support it. So its possible by writing custom code.

Or other option is to make 4 different fixed membership type i.e for each quarter and have 4 different price field in a price set with single option respectively and have Active on and expiry on field set.

---
Tags: civimember
---


title: Using CRM_Utils_Mail and logs

text:
# Question
Title: Using CRM_Utils_Mail and logs
I have a custom extension which I have working great- sends out email using the CRM\_Utils\_mail function. The emails go out fine, look fine, but are not registered to the contact's profile (not under the Mailings tab, or any of the others).

```
$emailbody = (CRM_Core_Smarty::singleton()->fetch($turl));
        $params = array();
        $params['from'] = 'Sporting Detection Dogs Association <no@x-x-x.ca>';
        $params['toName'] = $values['Requester_Name'].' '.$values['Requester_lastname'];
        $params['toEmail'] = $contact['email'];
        $params['subject'] = 'Trial Approval';
        $params['text'] = '';
        $params['html'] = $emailbody;
        CRM_Utils_Mail::send($params);

```

Is there a parameter I can add to make it add to the history for the record? Also, as a sidenote, how do I add more than one toEmail address?

thanks in advance.

# Answer
Take a look at CRM\_Activity\_BAO\_Activity::sendEmail(). An example of its use at https://github.com/civicrm/civicrm-core/blob/236007df15c5e3c65866b9cdd53fcd7593bb82c8/CRM/Contact/Form/Task/EmailTrait.php#L416

Note that it's not an "official" api and may change in the future, but that's also true of CRM\_Utils\_Mail.
> 1 votes

---
Tags: extension, email, developer
---


# Question
Title: Menue "create new mailing" leading to "old server" after creating test-server via backup of VM?
) after setting up a staging-server-VM via snapshot of our "production server", i've got two very strange/mysterious effect:

* when choosing the menue-item "create new mailing" the form with the URL/domain of the original server is displayed !-( ( https://machmittestsrv....../crm/index.php?q=civicrm/mailing/send&reset=1 =\> https://machmit..../crm/index.php?q=civicrm/a/#/mailing/35 instead of https://machmittestsrv..../crm/index.php?q=civicrm/a/#/mailing/35) BUT: all the other menue-entries are leading to the domain/URL of the new staging-server..
* the top-menue is not there but on the left side only... At the top there is still the drupal7-menue-bar

Please try to explain how civicrm / drupal7 does the "translation" of the menue-URL .

Thanks a lot in advance ;-)

best regards Dieter

# Answer
> 1 votes
You may find the solution for this is to visit civicrm/menu/rebuild

---
Tags: civimail
---


# Question
Title: Get an API key for civi update and mailings
My developer has asked me to provide an api key so that they can upgrade our version of civiCRM and set up cron and mailing system. I have no idea how to do this....

# Answer
the API key sits in the database as a field for the CiviCRM contact. You can find it in the table civicrm\_contact.

If you are not too technical and do not access your database directly on a regular basis the is an extension you can use called API Key (https://civicrm.org/extensions/api-key) which will show an additional tab for contacts if you are a sysadmin where you can see and add the API key for that user.

Does that answer your question?
> 2 votes

---
Tags: api
---


# Question
Title: Why are export field mappings not available for custom search results?
When using custom searches such as the Include/Exclude search, the resulting contacts can be exported, but there's no option given to select the fields. Fields to be included in the export file are apparently predefined in the search. That might make sense in some cases, but we have a scenario where the export file is pretty useless. Working around this with a temporary group or tag is a hassle.

Why is it that field mappings are not provided here? And can anybody assess what it might take to alter that behaviour in core, or which follow-up problems that would possibly implicate?

# Answer
A work-around for this is:

1. From the search results, create a new group.
2. Go to **Contacts » Manage Groups** find your new group and click **Contacts**
3. Choose **Export Fields**

It *is* an annoying bug, but obviously it's a bit akward for some reason.
> 2 votes

# Answer
Martin - one of our team had a quick dig. He says there is code that is intentionally preventing this, presumably as there is no presumption on what entity (member/contact/activity) is involved in the search.

Code involved can be seen at https://github.com/civicrm/civicrm-core/pull/11458/files

If that is enough for you to make a custom change (hack) to your system to get you over the hurdle, then good luck (normal warnings apply ie backup, etc)

If you would like us to work with you to sort this out either just for your situation, or a more generic fix that could end up as a community contribution (change to core, extension etc) then pls get in touch.
> 1 votes

---
Tags: export, custom-search
---


# Question
Title: How to change what fields show as columns in the Search display screen
How can I change the fields in the list of all contacts to custom ones, and delete unnecessary ones?

# Answer
> 3 votes
If you mean to display the search result columns to display custom fields, than you can create a profile to include all the fields to include as column(check the result column checkbox while adding the field in profile). Set the 'Default Contact Search Profile' in search preference setting.(Administer \>\> Search Preferences \>\> Search Preference).

---
Tags: contacts, search-results, fields, custom
---


title: Write a file, after them redirect

text:
# Question
Title: Write a file, after them redirect
Sorry for the newbie question...

I modified `CRM_Contact_Form_Task_Label` class, to create my own Task. It creates necessary data for printing membership cards. If a contact has all necessary data, then these are printed to a file, if not, the contact should be shown as result of a Custom Search.

I can't figure out why, but this code doesn't shows up the file, only redirects the page. File is shown up when I add `exit;` after the `$fileReady = self::createMembershipCard($rows);` row.

Please advise me, how can I show up the file and then redirect the page.

Thank you!

```
    function postProcess($params = NULL) {

        [...]

        $fileReady = FALSE;
        $fileReady = self::createMembershipCard($rows);
        if($fileReady) {
            $csvListOfIds = implode(",", $failed);
            CRM_Utils_System::redirect( CRM_Utils_System::url('civicrm/contact/search/custom', "reset=1&force=1&csid=19&cid={$csvListOfIds}"));
        }
     }

  /**
   * Create export file for Membership Cards.
   *
   * @param array $contactRows
   *   Associated array of contact data.
   */
    public function createMembershipCard(&$contactRows) {
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=data.txt');

        $output = fopen('php://output', 'w');

        if(sizeof($contactRows) != 0) {
            foreach($contactRows as $item) {
                $toOutput = $item['display_name'].';'.date('Y.m.d.').';2099.21.31.'.PHP_EOL;
                fwrite($output, $toOutput);
            }
        }
        fclose($output);

        return TRUE;
    }

```

# Answer
It's not possible in a web browser application / HTTP to do a download and then redirect.

Since you're passing the list of cids in the redirect url, what you can do is in buildform add a link on the page to a download that uses the list of cids if present. Then add a "page" (`civix generate:page`) in your extension that responds to that link and does the same thing your createMembershipCard() function does.

e.g. `civix generate:page CRM_Myextension_MembershipCard civicrm/myextension/membershipcard`

and then in buildForm you'd do something like

```
$cids = CRM_Utils_Request::retrieve('cids', 'String', $this);
$url = CRM_Utils_System::url('civicrm/myextension/membershipcard', "reset=1&cids={$cids}");
$form->assign('url', $url);
CRM_Core_Region::instance('page-body')->add(array(
    'template' => 'CRM/Myextension/MembershipCard.tpl',
  ));

```

and in MembershipCard.tpl you'd have a link like `<a href="{$url}">{ts}Download membership card{/ts}</a>`

and in CRM\_Myextension\_MembershipCard::run you do the same thing as createMembershipCard().
> 1 votes

---
Tags: files, redirect
---


title: warning message from cron

text:
# Question
Title: warning message from cron
This morning I started receiving a warning message from my regular cron job.

```
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/customer/www/crm.coma.org/public_html/wp-content/uploads/civicrm/ext/org.cpehn.subscriptionhistory-master/subscriptionhistory.civix.php on line 149+

```

I haven't knowlingly changed anything or even used CiviCRM this morning. I don't suppose it matters much, but I'm curious. CiviCRM 5.35.1 WordPress 5.7.2.

# Answer
That's a php 7.4 warning. The extension org.cpehn.subscriptionhistory needs to make the change in the extension and then they should release a new version. I would post an issue there: https://github.com/MegaphoneJon/org.cpehn.subscriptionhistory/issues
> 2 votes

---
Tags: cron
---


title: Custom templates folder

text:
# Question
Title: Custom templates folder
Set the Custom Template Directory and created 3 templates, but CiviCRM loads standard templates. What did I do wrong?

**Settings in WordPress:**

**Folder:**

# Answer
Rename **Custom Templates** folder to **CRM**.

After renaming clear civicrm cache
> 2 votes

---
Tags: templates
---


# Question
Title: custom fields in hook_civicrm_pre' $params have an extra "_-1" suffix
On my latest Civi 5.37.2 the params array passed to `hook_civicrm_pre` looks like:

```
Array
(
    [hidden_custom] => 1
    [hidden_custom_group_count] => Array
        (
            [] => 1
        )
    [custom_395_-1] =>          <-------- Spooky appdx
    [custom_463_-1] => 1000     <-------- Spooky appdx
 [...]

```

This happens when adding a new activity to a case. `hook_civicrm_customPre` works in other cases but it is *not* fired here. So it seems, there is no hook to get a sane `custom_<fieldid>` param prior saving to db.

# Answer
> 1 votes
Converted comment to answer:

I think it's always been like this? And for editing an existing one it's not -1 it's the autoincrement id in the customvalue table.

---
Tags: custom-fields, hooks, core
---


# Question
Title: Webform integration - how to I get a webform to create multiple records in a custom field set?
Using Drupal 7.81 and Webform 4.x with CiviCRM Webform integration.

I have an application form that uses a custom field and this field is set to allow multiple records. The form is set to expose 6 records of data from the drop down (9 is the max from what I can see) and I use a fieldset for each one. 'Create/Edit' mode is set on each set. I use a condidtional with 'more' to expose the next set if the applicant needs to add more data.

Contact1 is the applicant and a CiviCase is created for each application.

The webform submits fine, the contact and case are created. I can see each of the up to 6 rows of data for this field when I view the webform submission. However, in CiviCRM only the first set of data is recorded in this custom field on the contact record, despite the webform appearing to have the correct fields displayed and exposed e.g. civicrm\_1\_contact\_1\_cg12\_custom\_123, civicrm\_1\_contact\_2\_cg12\_custom\_123, civicrm\_1\_contact\_3\_cg12\_custom\_123 etc.

What am i doing wrong in my form?!

# Answer
We recently did a fair bit of work on multiple multi-value fields and that issue is fixed in the latest and tested by a UK partner and his client:

https://github.com/colemanw/webform\_civicrm

Fixed in 8.x-5.x - secured with a test and backported to 7.x-5.x - so it will be fixed when we push next releases to drupal.org

If you think that’s awesome - you can always show your appreciation by sponsoring ongoing development of webform civicrm module -\> https://webform-civicrm.io/form/sponsor-webform-civicrm-module
> 3 votes

# Answer
I think its a bug, please see the link below:

https://www.drupal.org/project/webform\_civicrm/issues/3199090
> 0 votes

---
Tags: custom-fields, webform-civicrm, multi-record
---


title: Create Contact from PHP

text:
# Question
Title: Create Contact from PHP
Whats wrong with this code? After submitting my form, I want to create a new contact in CRM via PHP, but it returned 500

```
$result = civicrm_api4('Contact', 'Create', [
    'where' => [
        ['first_name', '=', $_POST['first-name']],
        ['last_name', '=', $_POST['last-name']],
        ['email', '=', $_POST['email']],
      ]
    ]);

```

# Answer
Did you use api4 explorer (http://{site}/civicrm/api4) to generate that? You probably mean `values` instead of `where`.

And to do Email you'll need to chain: https://docs.civicrm.org/dev/en/latest/api/v4/chaining/
> 0 votes

---
Tags: api
---


# Question
Title: Including contacts that have done multiple activities in one search
I'm trying to build a list of people who did one specific activity (which was send an email) that have done other activities as well (trying to find activists). How do I build this list?

Trying to work off of this search: https://crm.aclusocal.org/civicrm/contact/search/custom?\_qf\_Custom\_display=true&qfKey=CRMContactControllerSearch4wcjzxp91r0g04sscgwg4g40080w00wgks88wksg0ogcoc0cw8\_3758

Thanks!

# Answer
> 2 votes
You could try creating a Group for one of the criteria and then do a search via Search Builder for that Group and for the other Activity.

---
Tags: database, activities
---


title: Unable to Add User

text:
# Question
Title: Unable to Add User
I am trying to add another user to my site. I am on Spark and with civihosting. When I click "create new account," I am redirected to a page that says "The website encountered an unexpected error. Please try again later." I've been having this issue for three days and can't figure out what the problem is. Everything else seems to be working perfectly fine.

# Answer
It seems like you were missing the "Unsupervised" rule in CiviCRM (from Contacts \> Find and Merge Duplicate Contacts).

The default rule, by email, was set as "General".

I changed it back to "Unsupervised".

It's rather odd that CiviCRM allows this, I will see if we can add a check against it.
> 2 votes

---
Tags: user-account, user, sparkpost, civicrm-spark
---


# Question
Title: SQL too many joins limitations- what will break and how
From experience I know that once a database reaches a certain size the sql limitation of 61 joins can cause problems

I've seen it raised in stack exchang here:Too many tables - MySQL limitation - CiviCRM API errors

And as a git lab issue: https://lab.civicrm.org/dev/core/-/issues/1191

I'm working on a site with currently 70 active custom data tables (50 for activities, 9 for individuals, 2-4 each for other entities) And am concerned that soon we're going to hit this limit.

Adding activities isn't a problem because no activity uses all 70 available data sets.

But will reporting on activities be a problem, because the activity data sets and contact data sets can all be included by default in the report templates. Or are activity reports handled differently now?

# Answer
> 1 votes
So, after talking to colleagues my understanding is...

61 joins will cause problems on big queries (reports) where we try and pull in all activity types and all associated activity data and additional contact data

If reports are more focussed then most reports will be within the 61 join limit even with more than 60 associated tables to choose from, adding more tables won't necessarily cause things to break, but caution is needed as the db expands.

Drupal views and the Data Processor extension can help in that process not just relying on reports.

What can break is if a custom data table gets too big 38-40 fields plus. And that can stop the entity associated from the data saving.

Here to learn, so feel free to tell me where I'm wrong with this.

---
Tags: custom-fields, mysql
---


# Question
Title: Custom Field: Multiple Contact References
Is it possible to configure custom field of type contact reference to store multiple contacts?

# Answer
This is possible in CiviCRM 5.34+: https://lab.civicrm.org/dev/core/-/issues/2123
> 2 votes

---
Tags: custom-fields
---


# Question
Title: Sending email from CiviCRM via Gmail SMTP - two-factor authentication
Problem: how to use Gmail SMTP service from CiviCRM ("System Settings -\> Outbound Email") when the Gmail account is set up for two-factor authentication.

# Answer
> 2 votes
The solution is here.
Generate a sixteen-digit token and use the token instead of your Gmail password. So the SMTP settings will be:
SMTP server - smtp.gmail.com
SMTP port - 587
Authentication - Yes
SMTP username - Gmail account username
SMTP password - 16-digit token (not your Gmail password)

---
Tags: email, smtp
---


title: What character is VALUE_SEPARATOR?

text:
# Question
Title: What character is VALUE_SEPARATOR?
I need to run a MySQL query to split the values in the fee\_level field of the civicrm\_participant table. I just can't determine what character to use as the delimiter. When I look at VALUE\_SEPARATOR in eclipse, I see a character that resembles a 'binary domino.' When I look at VALUE\_SEPARATOR in vi, I see ^A. I'm not sure how to query on either?

# Answer
> 4 votes
In fact, if you use HEX() function, you can guess it's the ASCII code 01 which is not really readable :

```
MySQL> SELECT substring(besoins_sp__114, 1,1)
       FROM civicrm_value_besoins_sp_cifiques_v_nements_26 LIMIT 1;
+---------------------------------+
| substring(besoins_sp__114, 1,1) |
+---------------------------------+
|                                |
+---------------------------------+
1 row in set (0.00 sec)

MySQL> SELECT HEX(substring(besoins_sp__114, 1,1))
       FROM civicrm_value_besoins_sp_cifiques_v_nements_26 LIMIT 1;
+--------------------------------------+
| HEX(substring(besoins_sp__114, 1,1)) |
+--------------------------------------+
| 01                                   |
+--------------------------------------+
1 row in set (0.00 sec)

```

From there, you can do reverse operation using UNHEX. So, if you need to replace this char by another more readable one, you can do the following :

```
MySQL> SELECT replace(besoins_sp__114, UNHEX(01), '|') AS special_needs
       FROM civicrm_value_besoins_sp_cifiques_v_nements_26;
+---------------+
| special_needs |
+---------------+
| |AL|          |
| |AL|          |
| |VG|          |
| |VG|          |
| |VG|          |
| |VG|          |
| |VG|          |
| |VG|          |
| |VG|          |
| |VG|AL|       |
+---------------+

```

# Answer
> 0 votes
There is another solution here which I have tried and it has updated the data in the db, but currently i can't assess if the outcome was good as the site is borked at the front end for other reasons

https://stackoverflow.com/questions/47266517/civicrm-crm-core-daovalue-separator-how-to-use-it-in-pure-sql

so something like

```
UPDATE TABLE SET <column>=concat_ws (X'01','value1','value2','etc') WHERE id=x

```

---
Tags: developer, mysql
---


# Question
Title: Activity - custom date format display incorrect
I've added a date and time field to an activity ('departure date'). The problem is that it steadfastly refuses to display as anything other than YYYY-MM-DD HH-MM-SS even though the custom field is specified as d MM yy with a 12 hour time format. This is when I hit 'View' against an activity in a list of case activities and get a pop up. Which does look odd when the activity date is displayed correctly as (e.g.) 14 June, 2021 1:03pm. My 'date preferences' were all set to default (I'm in the UK) but to try and fix this this I've set the 2 activity dates formats to d MM yy, and the custome the same. But to no avail. Civi is at 5.37.2 - I guess a bug? Problem raised as this issue

# Answer
> 1 votes
This is specific to civicase activities and it's because the view form uses its own way of displaying custom fields that's different from regular activities. I posted this quickie patch in the lab ticket but it's not the best long-term solution:

```
diff --git a/templates/CRM/Case/Form/ActivityView.tpl b/templates/CRM/Case/Form/ActivityView.tpl
index 9bc3c3d781..868c69c512 100644
--- a/templates/CRM/Case/Form/ActivityView.tpl
+++ b/templates/CRM/Case/Form/ActivityView.tpl
@@ -54,7 +54,11 @@
             {foreach from=$customGroup item=customField name=fields}
               <tr{if ! $smarty.foreach.fields.last} style="border-bottom: 1px solid #F6F6F6;"{/if}>
                 <td class="label">{$customField.label}</td>
+                {if $customField.type == 'Date'}
+                <td>{$customField.value|crmDate}</td>
+                {else}
                 <td>{$customField.value}</td>
+                {/if}
               </tr>
             {/foreach}
           {/foreach}

```

---
Tags: civicase, activity, date-preferences
---


# Question
Title: API V4 - Uncaught Exception: Authorization failed
With this code I created contact, but only when I'm authorized.

```
        civicrm_api4('Contact', 'create', [
            'values' => [
                'contact_type' => 'Individual',
                'checkPermissions' => false,
                'first_name' => $_POST['first_name'],
                'last_name' => $_POST['last_name'],
                'display_name' => $_POST['username'],
            ],
        ]);

```

**But when I'm logout:**

# Answer
> 1 votes
The checkPermissions line should be outside the values array. You can use http://{your-site}/civicrm/api4 to use the explorer to construct the correct code.

```
        civicrm_api4('Contact', 'create', [
            'values' => [
                'contact_type' => 'Individual',
                'first_name' => $_POST['first_name'],
                'last_name' => $_POST['last_name'],
                'display_name' => $_POST['username'],
            ],
            'checkPermissions' => false,
        ]);

```

---
Tags: apiv4
---


# Question
Title: Administer CiviCRM vs. administer CiviCRM System
What's the difference between the 'administer CiviCRM' and 'administer CiviCRM System' permissions? What are some examples of system administration tasks that are permitted under 'administer CiviCRM System' but not 'administer CiviCRM'?

# Answer
> 4 votes
There are some implied permissions which you can see here: https://github.com/civicrm/civicrm-core/blob/3bb9adfc8b7b19d8ef5cb5e27b981bd9b61b8769/CRM/Core/Permission.php#L898

```
public static function getImpliedAdminPermissions(): array {
    return [
      'administer CiviCRM' => ['implied_permissions' => ['administer CiviCRM system', 'administer CiviCRM data']],
      'administer CiviCRM data' => ['implied_permissions' => ['edit message templates', 'administer dedupe rules']],
      'administer CiviCRM system' => ['implied_permissions' => ['edit system workflow message templates']],
    ];
  }

```

So administer CiviCRM gives you access to both system and data admin.

---
Tags: permissions
---


# Question
Title: Drupal permission required for CiviCRM home page?
What is the minimum required Drupal permission to access drupalroot/civicrm?reset=1?

I'm trying to set up a role for users who need access to the contacts database but shouldn't have any admin rights. I've ticked all the permissions for things like add/view/edit contacts, and unticked anything that sounds like access to the backend. Whenever I go to the CiviCRM homepage as a user with that role I just see a message that says 'Access denied You are not authorised to access this page.' If I go directly to the URL of a specific contact I can view and edit it, but I can't see an interface to browse or search them by.

# Answer
> 3 votes
The user should have **CiviCRM: access CiviCRM backend and API** permission

---
Tags: drupal, permissions
---


# Question
Title: How can I allow members to view and edit their own records?
1. Front-End Interface for End-Users

* Develop a login based front-end portal for members where they can login using individual credentials, and see their own records.
* Front-end GUI will show members static information for their accounts including o Name, address, email, phone, birthday, professional skills, etc. o Add/update family members, relationship, personal info for each family member (name, address, email, phone, birthday, professional skills, etc.) o Membership status (lifetime, annual, date of expiry if annual) o Data of financial pledges, payments made, balances due, donation summary o File attachment section where admins can upload pdf files (for e.g. tax statements, receipts, etc.)
* Email notification when a member makes a change to their account
* Forgot and reset password functions

# Answer
Depends how complicated you want to make it, though we simply use:

https://docs.civicrm.org/sysadmin/en/latest/integration/wordpress/ explains things pretty well, including frontend dashboard `[civicrm component="user-dashboard"]` and profiles.

* emails on submission is I think a setting in a profile (though you could also use Caldera Forms (or its impending replacement to capture information and I recall that has many more settings for notifications etc - a good place to start would be https://wordpress.org/plugins/cf-civicrm-formprocessor/
* Forgot and reset password functions - using the above approach with Members and Members Sync etc allow you to just use the WordPress default system for login, forget and reset functions etc (and there a many a WordPress plugin to style and tweak the WordPress login page.

Good luck.
> 6 votes

---
Tags: wordpress, civimember
---


# Question
Title: Does Stripe and CiviCRM work on Drupal 8 and Webform?
I have installed: Stripe 6.5.5; CiviCRM 5.32.2; Drupal 8.9.11; Webform 6.0.0; Webform\_civicrm 8.x-5.0-beta4.

When I try to make a (test) Donation payment I get the error:

```
Error
Unable to complete payment! Missing paymentIntentID.

```

Is this a configuration problem or does D8 not work yet?

# Answer
> 1 votes
Stripe 6.5.6 has a Fix for this. (I haven't tested it personally, but it looks good.)

# Answer
> 1 votes
Stripe is working with webform civicrm D8/D9 complete with test coverage.

---
Tags: webform-civicrm, drupal-8, stripe
---


# Question
Title: Drupal 9 View Shows Permission Denied For CiviCRM Tables
I have my Drupal 9 database and my CiviCRM database in two separate databases on the same Amazon MySQL Aurora instance. The setup in our dev environment is identical and is working perfectly. However, after performing the upgrade to Drupal 9 and CiviCRM 5.37.2 from Drupal 8 I am now getting a MySQL access denied error in production, only when accessing CiviCRM with Views.

I have looked at this issue as an Amazon issue, a Drupal issue, and a CiviCRM issue. I am not positive it is a CiviCRM issue but the tables are specifically CiviCRM so I am hoping I can get some help, please.

This is the full error:

```
SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'user'@'10.0.2.97' for table 'civicrm_contact': SELECT "civicrm_contact"."id" AS "id", "users_field_data_civicrm_uf_match"."uid" AS "users_field_data_civicrm_uf_match_uid", "contact_id_civicrm_contact"."id" AS "contact_id_civicrm_contact_id", "member_of_contact_id_civicrm_contact"."id" AS "member_of_contact_id_civicrm_contact_id" FROM {civicrm_contact} "civicrm_contact" INNER JOIN {civicrm_uf_match} "civicrm_uf_match" ON civicrm_contact.id = civicrm_uf_match.contact_id INNER JOIN {users_field_data} "users_field_data_civicrm_uf_match" ON civicrm_uf_match.uf_id = users_field_data_civicrm_uf_match.uid LEFT JOIN {civicrm_membership} "contact_id_civicrm_contact" ON civicrm_contact.id = contact_id_civicrm_contact.contact_id LEFT JOIN {civicrm_membership_type} "member_of_contact_id_civicrm_contact" ON civicrm_contact.id = member_of_contact_id_civicrm_contact.member_of_contact_id WHERE (users_field_data_civicrm_uf_match.uid = :users_field_data_uid) LIMIT 1 OFFSET 0; Array ( [:users_field_data_uid] => 3016 )

```

I have checked that when logging in directly to the database from the EC2 instance that I have access to the database and the specific table. My EC2 security group has the appropriate grants for Amazon Aurora.

I my settings.php has

```
$databases['default']['default']['prefix']= array(
  'default' => '',
  'civicrm_acl'                              => '`civicrm_prod`.', ...

```

I updated the array tonight after the upgrade.

Any help is greatly appreciated.
Thanks,

Josh

# Answer
> 4 votes
Remove \` symbol added to the database name in settings.php

eg

```
$databases['default']['default']['prefix']= array(
  'default' => '',
  'civicrm_acl'                              => '`civicrm_prod`.', ...

```

change to

```
$databases['default']['default']['prefix']= array(
  'default' => '',
  'civicrm_acl'                              => 'civicrm_prod.', ...

```

---
Tags: drupal, upgrade, database, drupal-views
---


title: How do I install cv?

text:
# Question
Title: How do I install cv?
I'm trying to install the TurfCutter extension: https://gitlab.com/asludds/civicrm-turfcutter Since I can't install it via the Web UI, I'm struggling. I managed to get the npm utility installed and `npm install` seemed to work but TurfCutter doesn't show up as an extension. The TurfCutter install instructions use a `cv` command and I can't get that installed because the instructions for installing cv use `sudo` commands, which DreamHost doesn't allow in my VPS. I tried unzipping cv into .../wp-content/plugins/civicrm/civicrm/bin It's there but I guess it needs to be installed. How do I do that? Thanks...

# Answer
I downloaded cv.phar from https://docs.civicrm.org/installation/en/latest/general/cli-cv/ Then I uploaded cv.phar to .../wp-content/plugins/civicrm/civicrm/bin/ Then I was able to do the shell command: php cv.phar en TurfCutter That made TurfCutter show up as one of my Extensions. Sadly, I've got it installed and the menu item shows up but I don't think it's working yet...ugh...anyone know TurfCutter?
> 1 votes

---
Tags: wordpress, cli
---