title: CSS shows at top of mosaico emails

text:
# Question
Title: CSS shows at top of mosaico emails
Any ideas why I'm seeing a big block of CSS at top of the HTML preview, and email test of mailing from Mosaico? Everything is updated to latest versions (Civi, Flexmailer and Mosico) I've tried completely removing and reinstalling and the issue is still there. Also verified happens from multiple browsers and computers.

This does only happen with the template versafix-1.

# Answer
That's your mosaico css being displayed as content instead of interpreted as css, - i.e. it's probably not inside a `<style>` tag.

The word "test" at the top suggests you might have some kind of test code mangling your output, or else that someone was hacking around with your template.
> 1 votes

---
Tags: mosaico
---


# Question
Title: testing recurring contributions -- gone wrong!
Please help!

I've made a new recurring contribution page for membership renewals. I tested to contribution page to make sure recurring contributions would go through -- they went through so I *thought* it was all good to go.

I tested the page the following week just to make sure it was still running smoothly and... nothing. Now, anytime I submit one-time member dues (i.e. a one-time contribution of $30) it works fine, but once I add that I want to contribute that amount of money every month, on the user side it says the payment went though Authorize for processing, but it doesn't show up in Authorize and it doesn't record anything in Civi.

Curiously, after I complete a transaction, I "told a friend" and then that action showed up in my activities in Civi. That is to say, something is connecting, but recurring transactions are just not.

I've submitted them under my name and another's. Both unsuccessful.

Payment processor: Authorize.net Civi version: 5.17.5 Drupal core version: 8.7.8

# Answer
The recurring contribution workflow is more complicated than the one-time workflow. For authorize.net, it means that a request for a recurring contribution is sent, but relies on the payment processor to come back with any information about whether the recurring contribution has completed or not (as well as communicating about any future transactions), and typically that will not happen immediately, but at some later time.

I'd guess that you will see pending payments in CiviCRM for these recurring requests, and that for some reason your payment processor account is not configured to properly handle recurring requests (i.e. the callback or IPN isn't firing properly). Perhaps your payment processor account is used for other purposes than online payments?
> 2 votes

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


# Question
Title: Sync smart group to WordPress role, group, or capability
I have a WordPress site which is already using the *CiviCRM WordPress Member Sync* plugin to sync memberships to roles.

On this same site, I also want to **show/hide certain content based on the user's having a membership of any type, age, or status** -- basically, if they've *ever* had a membership, WP should use that fact to show/hide some content.

This show/hide should be possible with roles, capabilities, or groups, but I can't yet find a way to sync this "ever been a member" status to one of those. It seems like it requires a smart group in CiviCRM, and then I don't see any existing plugins that support syncing smart groups to roles, capabilities or groups.

Also, we need to continue using *CiviCRM WordPress Member Sync* for its current usage, and it doesn't seem to support additional sync rules beyond "one rule per membership type" and "only sync to roles, groups OR capabilities, but not to any combination of those."

Is there a plugin or combination of plugins that will allow this to be done? Or does this need a custom-built plugin?

# Answer
> 5 votes
I would move to using groups and not roles for permissioning because it gives you more flexibility. People can be in multiple groups then.

There is the CiviCRM Groups Sync which syncs a regular CiviCRM group to a WP group. So that may be an option by auto-adding members to the CiviCRM group and creating their WP user at the form-level.

The other option is to improve the plugin by having it sync smart groups.

---
Tags: wordpress, civimember, smartgroups
---


# Question
Title: Create Drupal users with custom usernames from Company Data?
In my company members have a unique membership ID. Is it possible, that the Drupal users which are created by CiviCRM, can have this membership ID as the username and not the real name/email address as is used currently?

We would also like to use the members' date of birth as their password and set this automatically.

Thank you.

# Answer
> 1 votes
I am not sure if CiviRules allows the creation of a CMS user when a membership is created. But you could write a small extension that implements a hook to override the username (to use the member ID) and password (to use the Date of Birth) or implement a hook (post on membership) to create a CMS user when a membership is purchased (created),

# Answer
> 0 votes
Other option would be to look at what Drupal Rules can do

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


# Question
Title: Bulk email sent to group of contacts after new contact added to CiviCRM
We have a couple of sites that offer volunteering directories. External organisations post opportunities and members of the public can view and apply for those opportunities (a massive tangle of webforms and drupal views essentially).

We've been asked for a functionality that if an organisation offers a new opportunity with a given field of activity (eg. buddying/ befriending), and a volunteer has registered with the site expressing an interest in opportunities of that same field of activity then the volunteer(s) get an email notifying them of the new opportunity details.

I was essentially thinking create "field of activity" as a tag list for the opportunity, and a custom data checkbox field for the volunteers. Then create smart groups for volunteers based on the custom data All contacts, of type volunteer with type of interest "Befriending/Buddying" are added to a Befriending Buddying smart group. When a new opportunity is tagged as Befriending/ Buddying an email goes to the BB smart group.

Had a quick look at configuring a CiviRule, but CiviRules basic settings don't seem to result in Bulk Email Actions

Has anyone configured anything like this in CiviCRM before, or got suggestions of where to start?

Drup 7.69 Civi 5.19.4

# Answer
> 1 votes
Adding here as well

Maybe a scheduled reminder with the activity as the 'trigger' entity and then limit the recipients to your BB smart group would work.

---
Tags: civimail, contacts, email, civirules
---


title: Manage the image gallery in mosaico

text:
# Question
Title: Manage the image gallery in mosaico
As you upload images into Mosaico mailings they get stored in a Mosaico "Gallery".

We're now beginning to find duplicate images in the gallery as different users have uploaded the same image at different times (or people using Mosaico hadn't spotted the gallery function and have re-used the same image several times).

Does anyone know which directory the gallery is saved in? Is there a way to give access to local users to allow them to manage the images there and remove the duplicates?

Cheers!

# Answer
**The answer is to the first of your two questions** is: the images are stored in a subdirectory of the CiviCRM "Image Directory", which by default looks like `[civicrm.files]/persist/contribute/`.

The specific subdirectory it stores it in is: `images/upload`

You can see the code on line 153-ish of this file: https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/2.x/CRM/Mosaico/Utils.php

**The answer to the second of your two questions is**: yes. If you create a new traditional mailing, you'll see a button in the wysiwyg window that lets you add/remove images. That tool will manage the same directory that Mosaico uses.

**The answer to a question you didn't ask** "how can a new mosaico mailing make use of existing images" is: along the top bar in the mosaico interface there's the same button (i.e. a picture of a mountain) which let's you reuse existing images in your "gallery". So you could also manually put a bunch of images into the images/upload directory for your civimailers to re-use.
> 4 votes

---
Tags: civimail, mosaico
---


# Question
Title: How do I send a scheduled mailing via CiviMail?
I've created and scheduled for immediate delivery an email via CiviCRM. It's in the queue but nothing is happening. Who can I contact or what do I need to do?

# Answer
> 4 votes
Mailings run from a cron job on the server, so submitting immediately does not immediately start the mail sending, it sends the next time the bulk mail processor task runs.

If the mailing is still not sending in an hour or so...

Go to Scheduled jobs (Administer\>System Settings\> Schduled Jobs) And check that the Mailings scheduler job is enabled.

If it is enabled, and your mailing still hasn't gone talk to your admin person to check that cron jobs are enabled on the server.

Details fpor configuring scheduled jobs here: https://docs.civicrm.org/user/en/latest/initial-set-up/scheduled-jobs/

Cheers

Craig

---
Tags: civimail
---


# Question
Title: Contact Summary Editor Extension Question
I am using CiviCRM 5.19.4 and Drupal 8. I need to customize the Contact Summary page - installed the extension Contact Summary Editor successfully. All is good, added all the contact information that I want displayed. However, I need to add events and contributions for the contact to the summary page, but this information isn't displaying on the fields that are available to select from when creating a new block.

Thanks for your help!

# Answer
You can use one of the Extended Reports for Events and Contributions respectively to display on the contact summary screen. Go to the Display Options tab and select '*Make available for contact summary page (requires contact layout editor extension)*'.
> 3 votes

---
Tags: extension, contact-summary-editor
---


# Question
Title: "Implode" / "Database Deadlock" errors on Civi Webform
Using Drupal 7.69 and CiviCRM 5.20.2, with Webform 7.x-4.21 and Webform CiviCRM Integration 7.x-4.28.

I have a Drupal webform node that uses custom fields from CiviCRM. This webform has been working well but recently a member of the public called and said it didn't let them submit their form. I looked into the Drupal error log and found 7 error messages. Did some searching but couldn't find any solutions.

All error messages located here: https://pastebin.com/A5vn0VWN

I made my own submission on the webform and it went through but I still saw the following message in the error log. Key difference between the error log for the public (failed) submission and my submission is that for both submissions the following error was logged -- for my successful submission, it was logged once, but for the failed submission, it was logged twice. So I feel like this might be important.

> Warning: implode(): Invalid arguments passed in CRM\_Core\_BAO\_CustomGroup::postProcess() (line 1494 of /MYHOME/FOLDER/public\_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomGroup.php).

Anyone know how to fix this (or what the problem is in the first place)? Wasn't able to decode anything from the error log...

# Answer
The error you're looking at is not the real issue.

The real issue (as showing in your pastebin log) is the deadlocks re: group contact cache.

You may need to rebuild some of your smart groups, or disable them.
> 1 votes

---
Tags: drupal, webform-civicrm, error
---


# Question
Title: How can I create a public list of event attendees?
I would like to create a page on my Wordpress site that lists everyone who is registered for a specific event (EID 3 in this case). I only need a list of attendees names, sort by last name. No other columns needed.

# Answer
You can do this using profiles

1. Create a smart group of all attendees of the event
2. Create manage acl to grant view permission for authenticated and anonymous user to view contacts from smart group.
3. Create a profile for search and include fields that you want to show.
4. Create manage acl to use the above created profile for search for anonymous user
5. Create a post/page on wordpress and include profile search short code.

Also you can use content views wordpress instead profile to show contact belonging to smart group
> 3 votes

---
Tags: wordpress, civievent
---


# Question
Title: ValueComparison null error when adding 'Last contribution is more than n days ago or is n days ago' as condition
I'm trying to set up a rule in CiviRules that will **send an e-mail n days after a contribution was made.**

When I try to save the condition parameters I get an error message.

**Can anyone confirm that this is a bug, or am I messing up something?**

Error log:

```
2020/02/06 13:20:26 [error] 8317#8317: *280630 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to civicrm_api3() must be of the type string, null given, called in .../shared/uploads/sites/5/civicrm/ext/org.civicoop.civirules/CRM/CivirulesConditions/Generic/ValueComparison.php on line 125 and defined in .../releases/20200204155448/web/app/plugins/civicrm/civicrm/api/api.php:84

```

Stack trace:

```
#0 .../shared/uploads/sites/5/civicrm/ext/org.civicoop.civirules/CRM/CivirulesConditions/Generic/ValueComparison.php(125): civicrm_api3(NULL, 'getfields', Array)
#1 .../shared/uploads/sites/5/civicrm/ext/org.civicoop.civirules/CRM/CivirulesConditions/Generic/ValueComparison.php(73): CRM_CivirulesConditions_Generic_ValueComparison->isDateField(NULL, NULL)
#2 .../shared/uploads/sites/5/civicrm/ext/org.civicoop.civirules/CRM/CivirulesConditions/Contribution/LastContribution.php(64): CRM_CivirulesConditions_Generic_ValueComparison->ge" while reading response header from upstream, client: [...], server: [...], request: "GET /wp/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcivirule%2Fform%2Frule&reset=1&action=update&id=2 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm-wordpress.sock:", host: [...], referrer: [...]/wp/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcivirules%2Fform%2Frulesview&reset=1"

```

I reproduced the bug on the demo site:

# Answer
> 0 votes
It might well be, but this is not the way I would specify the rule. This condition was for something pretty different, I do not recollect what exactly.

I would specify that the action is send email but the delay is xxxx number of days?

Like so:

---
Tags: wordpress, contributions, civirules, condition
---


# Question
Title: Added scheduled reminder not showing in admin
I have been battling for 48 hours trying to figure out why schedule reminders I added are not showing up in admin.

Here's the screenshot: https://www.screencast.com/t/AZ1CoyMqDbH

Also, there are couple of errors in console, perhaps you guys have an idea when you spotted them.

The same error on "Setting - Schedule Jobs" admin https://www.screencast.com/t/JxHWb8MSlE57

Any thoughts would be greatly appreciated. Thanks

# Answer
> 1 votes
It's not just a double HTTPS - one of those is missing the colon between the https and backslashes.

Check **Administer menu \> System Settings \> Resource URLs**, and also `civicrm.settings.php` for `https//`.

---
Tags: scheduled-reminders, scheduled-job
---


# Question
Title: Emails from CiviCRM completely rejected by GMX (Germany)
everyone,

I have sent a newsletter to the admin team for testing purposes. All admins with GMX email accounts did not receive this email. The email was also not found in the spam folder or trash. With a newsletter to all contacts this would probably never have been noticed.

The same email sent directly from the sender address arrived. I suspect that the header entries from CiviCRM (bounce, precedence: bulk) are causing this. Does anyone have similar experiences and maybe even a solution? GMX is an often used email provider in Germany.

Best regards

Marion

# Answer
> 2 votes
> The same email sent directly from the sender address arrived.

Based on the above piece of information, there are two lines of investigation that are worth pursing.

One key difference between sending a message via CiviMail vs sending directly (i.e. from your mail program) is the "sender envelope from address", which is not the same thing as the "From:" address in the message itself. A CiviMail message uses a sender envelope from address using the domain in the mail account used for bounce processing.

i.e. look at \[yourdomain\]/civicrm/admin/mailSettings?reset=1 and look at the row that says "Used for bounce processing". All emails sent using CiviMail will use that domain in the sender envelope from address.

So, your first line of inquiry is to look at the SPF record of that domain and make sure that the machine that sends out the email has an entry in some form, i.e. that your smtp server ip is blessed to send out mail from that domain.

If that has already been done properly, then the second line of inquiry is to look at the IP of your outgoing mail machine and look at it's reputation. It's possible that GMX is using a blacklist to block email from your mail machine's ip.

If both of those seem like issues that are too technical, then you really will need someone who understands them to sort it out, otherwise you won't be getting much value from CiviMail.

# Answer
> 0 votes
I recommend using "mail-tester" to establish whether or not you are on a mailing black list.

Another thing is that if you are sending to a lot of incorrect email addresses then many service providers will just stop all your requests entirely. Why not try the Email Amender CiviCRM extension to clean your email addresses both in bulk, and as they are added to your CRM?

# Answer
> 0 votes
We have the same problem with GMX. We had already contact with them and they say, that they have some policy that blocks our CiviCRM mails. But they have also a policy not say, what kind of policy it is, that blocks our mails. :( For years now it is like this, that they set our server on a internal whitelist. And then our emails are accepted. After some time we are blocked again. Then we contact them and they set us on their whitelist. Then our emails are accepted. After some time we are blocked again. Then we contact them and they set us on their whitelist. And so on...

---
Tags: email, spam
---


# Question
Title: How to Remove Old Events from the Managing Events Tab
I have eight events under my "Manage Events" Tab on Civi. Three of them are upcoming, but five of them are left over from 2012. When I try to put an end date to the event, so they will be cleared from my this page, but not deleted, I am given this error blocking message:

"Sorry an error occurred We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.

Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.

Error type: Could not find a valid session key."

# Answer
> 1 votes
The error is likely misleading. You'll find more details in your CiviCRM error log (and/or perhaps your CMS error log). The CiviCRM Log Viewer extension is the simplest way to see those.

It's likely that these old events have some configuration that is blowing up when you resave them with the end date.

Since you just want to hide them, your simplest course of action is to set an end date directly using sql, e.g. with something like:

```
UPDATE civicrm_event SET end_date = start_date where isnull(end_date) and start_date < '2013-01-01'

```

---
Tags: civievent
---


title: Error Deleting memberships

text:
# Question
Title: Error Deleting memberships
I am running CiviCRM 5.20.1 with WordPress 5.3.2. We have decided to redefine a membership type (actually an annual recertification) and I needed to delete the current members before I upload a sanitized version of the data (error free and more complete data).

I originally posted this question believing the memberships had not be deleted. They were. It would still be nice to fix this appearance of a problem.

Anyway, I am getting the following error when I delete the current members:

```
 Notice: Undefined offset: 1260 in
 **/home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php** on line **632**

 **Fatal error:** Uncaught Error: Call to a member function delete() on
 null in /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php:664

Stack trace:
#0 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php(613): CRM_Member_BAO_Membership::deleteMembership('1260', false)
#1 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Task/Delete.php(83): CRM_Member_BAO_Membership::del('1260')
#2 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(495): CRM_Member_Form_Task_Delete->postProcess()
#3 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Done.php(75): CRM_Core_Form->mainProcess()
#4 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Done->perform(Object(CRM_Member_Form_Task_Delete), 'done')
#5 /home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Pa

in **/home/websiteweb/public_html/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php** on line **664** There has been a critical error on your website. Please check your site admin email inbox for instructions.

 Learn more about debugging in WordPress.

```

I've looked at the lines in question, but I don't see (or understand) the problem. Any suggestions to move this project forward?

# Answer
The error is happening in the deleteMembership function, and the error says: you're trying to execute the method "delete" on an empty (i.e. null) object. The object that is "null" is expected to be a membership object.

That suggests that the code might have been running two copies in parallel - e.g. perhaps you clicked twice on the delete button (would not be difficult, since you're trying to do a mass delete on a lot of memberships).
> 1 votes

---
Tags: wordpress, civimember
---


# Question
Title: Expose CiviDiscount Fields to Drupal Views
I'm creating a Drupal view and would like to reference the discount end date field created by the CiviDiscount extension, but the only thing associated with that extension that's available as a field is the "Default Discount Fee ID". Is there a way to access the other CiviDiscount fields from Drupal Views?

# Answer
If you're on D7, you can use the Views CiviCRM Expose Tables module.
> 2 votes

---
Tags: drupal-views, cividiscount
---


# Question
Title: All contributions on this webform are created as recurring
CiviCRM 5.20.0 Drupal 7.69 iATSPayments 1.7.1 Webform/Civi Integration 7.x-4.28

This webform is used for non-taxdeductible giving. I have two categories set at the top of the form, giving for food and lodging while visiting campus and assisting our short-term volunteers with the cost of their food and lodging. Often donors will want to set up a monthly recurring if they are assisting with our our volunteers food and lodging. But visitors do not want/need to have monthly recurring just for a visit to campus. So, I used conditionals to only show the parts needed for the option they start with. If they choose to give to food and lodging, then I do not show "I want this to recur monthly" and I have Recurring monthly default set to no. But all giving to this is created as a recurring contribution. You can select "Payment for short-term staff room and board" and it shows the "I want this to Recur" with the default of NO and if you leave it on No, it does not create it as recurring.

I changed my conditional for the first option so that "I want this to Recur" is set to No. But I get the same results. It creates all contributions for this option as recurring.

Additional info: The attached screenshot shows how I have Options set for civicrm\_1\_contribution\_1\_contribution\_installments so it sends it as a number. The Value is what the consumer sees visually, the Key is the number that gets sent to civicrm\_contributions\_installments. It is obviously sending it as a number because it does work for the second option when people give to cover room and board for volunteers, with that they can choose to have it recur or not recur. There is only one civicrm\_1\_contribution\_1\_contribution\_installments on my form so both options are using the same installments question.

The problem is, it is overriding my default = 1 AND my conditional to set civicrm\_1\_contribution\_1\_contribution\_installments to 1. It is putting it in the installments column with a 0. But only for the first option of the form, the second option is working as designed.

# Answer
Webform does not include conditionally hidden components in the submission. Civi Core treats a Null for installments as "Open Ended Recurring". So with submitting nothing, it will always be a recurring contribution.

The only option I can come up with is to not hide the installments option.
> 0 votes

# Answer
You need to set a conditional to ensure instalments = 1 for the one time scenario. Instalments = 0 is open ended recurring and any other number is recurring with that number of instalments.

There was a change/PR to the repo that enabled open ended recurring contributions: https://github.com/colemanw/webform\_civicrm/pull/141 so now it's even more important than before to ensure `civicrm_1_contribution_1_contribution_installments` is a number and set properly. It's a Number --\> No is not a valid value.

Best to keep the Widget: Number -\> this is how the component config looks when it's first enabled:

If you want to hide the Element -\> change the widget to Hidden and use conditionals to set its value to either 0 or 1 (based on another field).
> 1 votes

---
Tags: webform-civicrm, iatspayments
---


# Question
Title: I need some help resolving db error:unknown error CSV Import helper when selecting a CSV from my desktop
I prepared a CSV for upload. I'll have to make multiple passes on the upload because I have single entry items and multiple entry data in the spreadsheet. I have created all of my custom fields. I can do a standard contact import with the unsupervised rule.

I see that I need an ID number for the multi-record import. I installed the CSV Import Helper to prepare for the multi-record import. When I select the CSV (I'm using the ; for my field delimiter) I get the DB error: unknown error from CiviCRM.

I'm on WordPress with CiviCRM 5.20.1

The only error I see in the Civi error log is :

> \[26-Feb-2020 16:20:05 UTC\] PHP Notice: Undefined index: SERVER\_NAME in /home/websiteweb/public\_html/wp-content/plugins/LayerSlider/classes/class.km.autoupdate.v3.php on line 75
>
> \[26-Feb-2020 16:20:06 UTC\] PHP Warning: session\_start(): Cannot start session when headers already sent in /home/websiteweb/public\_html/wp-content/plugins/civicrm/civicrm.php on line 364

My end goal is to merge the contact IDs into the data set so I can proceed. Any advice is welcome.

# Answer
> 2 votes
The issue was unrelated to the log error, which we will debug at a future time.

The problem was caused by my preferred use of a semicolon ";" as a delimiter instead of a comma ",". I frequently use the semicolon because clients frequently include commmas in names and addresses. Apparently this disambiguation was a problem for the CSV Import Helper.

---
Tags: contacts, import, data-import, csv
---


# Question
Title: Needing to change the email address emails are coming from
I am looking for some help on two issues:

When Mailing contacts who have booked for an event, the email is coming from an email address I don't want to use. How do I remove the preferred email address and add a new one?

Likewise, when manually registering an event participant, the default email address that the booking confirmation would come from is also wrong, and I wish to remove this completely and add a new one/

Thanks in advance

# Answer
I'd look first at the event settings themselves.

(From the manage events page, choose configure and then click to the online registration tab)

At the foot of the page is the email confirmation settings

This is what governs the "from email address" in any confirmation message.

Cheers

Craig
> 1 votes

# Answer
The default email for messages is set in Administer \>\> CiviMail \>\> From Mail Addresses and setting that to what you want should help (but I'm not quite clear on your examples. In your first case, if its an online booking then Craig's suggestion should work. Perhaps you can be more specific.
> 1 votes

---
Tags: civimail, email
---


# Question
Title: civix civicrm:ping error [Exception] Failed to locate civicrm.settings.php
I just installed CiviCRM BuildKit using the instructions here

After accessing the bash shell of the container with:

```
docker-compose exec -u buildkit civicrm bash

```

I try running the command

```
civix civicrm:ping

```

in the /src folder, I get the error

> \[Exception\]
> Failed to locate civicrm.settings.php. By default, this tool searches the parent directories for a standard CMS (Drupal, WordPress, etal) and standard civicrm.settings.php. Symlinks and multisite configurations may interfere. To customize, set variable CIVICRM\_SETTINGS to point to the preferred civicrm.settings.php.

How can I get the command(s) to work correctly?

# Answer
> 2 votes
Cool - in the drupal site root of the site you should see a folder "sites" and be able to see a file at sites/default/civicrm.settings.php can you try running the command from the same directory as the civicrm.settings.php file.

# Answer
> 2 votes
The `/build/dmaster/web/sites/default` folder has the civicrm.settings.php file, you can execute the commands from anywhere in/or below the `web` directory. This will allow civix to correctly locate the settings file.

---
Tags: extension, civicrm-buildkit, civix
---


title: Address Labels Printing

text:
# Question
Title: Address Labels Printing
I have no problem printing my contact group mailing labels, however is it possible

to only print a full sheet of mailing labels for a single contact?

Any assistance appreciated.

# Answer
> 1 votes
Welcome to SE! There isn't a built in way to print multiple labels for a single contact within the label printing functionality. Demerit's suggestion above is probably what I'd do, but if you have a regular need and want to do it entirely within CiviCRM you could produce a message template with multiple copies of the same address on it and then use the print/Merge Document on the single contact. You would have to be careful how empty address fields were handled to make sure it looked right and the spacing didn't change, but some smarty should be able to do this.

---
Tags: address-labels
---


# Question
Title: Is it possible to install CiviCase without all the sample data?
When I enable CiviCase I get a whole load of sample configuration added in that I didn't want. Is there a way to (a) get rid of it easily and (b) install CiviCase without that happening in the first place?

e.g.

* two case types are created. I can disable these but I don't seem to be able to delete them.
* several relationship types are created, I can delete them one by one...
* several case statuses are created (minor, only "urgent" needs to go)
* various other bits, I think.

# Answer
> 2 votes
I've written an extension that will disable the bits that CiviCase creates.

Install it, run it, uninstall it.

# Answer
> 5 votes
The short answer is no. But it's a good point. I think this is mostly just left over from the original implementation when setting up civicase was difficult, and it was hard to know what it would look like without an example. There didn't used to be a UI - just hand-coded xml files.

You might have to delete some of a case type's definition parts first before deleting the actual type, since it might consider it "in use". But you are going to need at least one case type, so as a workaround for now instead of deleting you can edit the case type.

The relationship that is defined within the case type as the case manager has to exist.

The Open Case activity type does need to exist since it has some semantics associated with it, along with some other activity types, e.g. "Link Cases".

The Urgent status is used for hiliting on the Case Dashboard, but it will function fine if you delete it.

---
Tags: civicase
---


title: CiviCRM Report - Sorting DB error

text:
# Question
Title: CiviCRM Report - Sorting DB error
when I'm preparing a report (Event Participants) through CiviCRM Report module and I want to sort the results by anything (age, name, etc) I am getting a fatal error: `DB ERROR: No such field`

I'm currently on **Drupal 7.69** and **CiviCRM 5.20.**

Here is the full log of this issue:

```
     [debug] $backTrace = #0 /var/www/html/sites/all/modules/civicrm/CRM/Core/Error.php(208): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/html/sites/all/modules/civicrm/packages/DB.php(987): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#3 /var/www/html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#4 /var/www/html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", "DB_Error", TRUE)
#5 /var/www/html/sites/all/modules/civicrm/packages/DB/common.php(1920): PEAR->__call("raiseError", (Array:7))
#6 /var/www/html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", "1055 ** Expression #21 of SELECT list is not in GROUP BY clause and contains ...")
#7 /var/www/html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 /var/www/html/sites/all/modules/civicrm/packages/DB/common.php(1229): DB_mysqli->simpleQuery("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#9 /var/www/html/sites/all/modules/civicrm/packages/DB/DataObject.php(2416): DB_common->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#10 /var/www/html/sites/all/modules/civicrm/packages/DB/DataObject.php(1607): DB_DataObject->_query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#11 /var/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php(435): DB_DataObject->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#12 /var/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php(1428): CRM_Core_DAO->query("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", TRUE)
#13 /var/www/html/sites/all/modules/civicrm/CRM/Report/Form.php(3076): CRM_Core_DAO::executeQuery("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...")
#14 /var/www/html/sites/all/modules/civicrm/CRM/Report/Form.php(3561): CRM_Report_Form->buildRows("SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_so...", (Array:0))
#15 /var/www/html/sites/all/modules/civicrm/CRM/Report/Form/Event/ParticipantListing.php(616): CRM_Report_Form->postProcess()
#16 /var/www/html/sites/all/modules/civicrm/CRM/Core/Form.php(495): CRM_Report_Form_Event_ParticipantListing->postProcess()
#17 /var/www/html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Submit.php(74): CRM_Core_Form->mainProcess()
#18 /var/www/html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Submit->perform(Object(CRM_Report_Form_Event_ParticipantListing), "submit")
#19 /var/www/html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Report_Form_Event_ParticipantListing), "submit")
#20 /var/www/html/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("submit")
#21 /var/www/html/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(114): CRM_Core_Controller->run()
#22 /var/www/html/sites/all/modules/civicrm/CRM/Report/Page/Instance.php(90): CRM_Utils_Wrapper->run("CRM_Report_Form_Event_ParticipantListing", NULL, (Array:0))
#23 /var/www/html/sites/all/modules/civicrm/CRM/Core/Invoke.php(284): CRM_Report_Page_Instance->run((Array:4), NULL)
#24 /var/www/html/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:14))
#25 /var/www/html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#26 /var/www/html/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:4))
#27 /var/www/html/includes/menu.inc(527): civicrm_invoke("report", "instance", "26")
#28 /var/www/html/index.php(21): menu_execute_active_handler()
#29 {main}

```

Has anyone come across such an issue? Is my database missing a table header?

# Answer
It's a bug in the report but you can work around it by turning off ONLY\_FULL\_GROUP\_BY on the server. See https://docs.civicrm.org/sysadmin/en/latest/requirements/#mysql-configuration
> 1 votes

---
Tags: civireport, error, database
---


# Question
Title: I need a developer for a custom extension where is the best place to ask?
All is in the title. We have a client with specific need. We would like to hire a developer to build the extension the right way and share it with the community. Where's the place to do it ? Here ?

# Answer
> 4 votes
The obvious place to start is the list of experts at https://civicrm.org/partners-contributors and select **custom code and extensions**

# Answer
> 2 votes
I am currently talking to a few developers for custom extensions. I suggest checking out CiviCRM extensions authors and contacting them personally (for e.g CiviCOOP, AgiliWay)

# Answer
> 1 votes
You can either find under https://civicrm.org/partners-contributors or post a enquiry on https://chat.civicrm.org/civicrm/channels/extensions

---
Tags: extension
---


# Question
Title: How can I assign one contact to one of the team workers?
Right now everybody have access to the info of all the contacts. And we need that only specific people of our team get access to the info of a specific group of people.

How do we do that?

# Answer
> 1 votes
ACL or Access Controls should be able to do that. https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control/

BUT... I've never worked with Joomla so can't offer any further advice

# Answer
> 1 votes
You can create ACL through UI if you have very limited group if you have 50+ groups and will increase going forward than would recommend to write a small extension that implements ACL civi hook to control the action on contact.

Some useful docs to configure ACL via UI:

http://www.gingerfeet.net/civicrm\_access\_control\_lists

http://www.gingerfeet.net/civicrm\_access\_control\_lists

For some use case you may like to use below extension

https://civicrm.org/extensions/autogroup-helper-for-group-based-acl-environments

---
Tags: contacts, joomla
---


title: CIVICRM export des formulaires

text:
# Question
Title: CIVICRM export des formulaires
Bonjour, je souhaites utiliser civicrm mais j'aimerais savoir si des extensions / plugins existent qui me permettent d'utiliser les formulaires (paiement, evenement, don, adhesion...) sur des sites sous wordpress, drupal, ou autre cms type spip par exemple. Merci pour votre aide !

---

Hello, I want to use civicrm but I would like to know if extensions / plugins exist which allow me to use the forms (payment, event, donation, membership ...) on sites under wordpress, drupal, or other cms type spip for example. Thanks for your help !

# Answer
> 1 votes
Bienvenue sur Stack Exchange. Il existe de nombreuses extensions qui peuvent être ajoutées à CiviCRM qui étendent / ajoutent à la fonctionnalité. Vous pouvez voir une liste des extensions publiées / révisées sur CiviCRM.org et de nombreuses extensions non publiées sur GitLab

Si vous utilisez WordPress, il existe également des plugins spécifiquement liés à CiviCRM qui permettent l'intégration, comme avec les formulaires Caldera.

---

Welcome to Stack Exchange. There are many extensions that can be added to CiviCRM which extend/add to the functionality. You can see a list of published / reviewed extensions on CiviCRM.org and many unpublished extensions on GitLab

If you use WordPress, there are also plugins specifically related to CiviCRM which allow integration such as with Caldera forms.

# Answer
> 0 votes
CiviCRM does not work with SPIP. If you 'must' retain a SPIP CMS then you would need to use one of the 3 CMS it does work with as a front end for CiviCRM and perhaps theme it to look like the SPIP site, then bounce them to CiviCRM forms, or use a method for embedding forms on the external SPIP site

---
Tags: wordpress, drupal, cms-integration
---


title: Looking for hosting company

text:
# Question
Title: Looking for hosting company
I am looking for hosting providers and would like recommendations as well as any horror stories about you to avoid.

# Answer
> 3 votes
The top two complaints we hear the most from organizations about their previous providers are:

1. lack of responsiveness/customer service to inquiries.
2. consistency in maintenance and updates.

When we take over hosting and maintenance services, we try to identify any technical debt that exists so it can be addressed as early as possible in the engagement.

I recommend paying attention to what sort of site/code audits the provider does upfront. It will likely save you in the long-term and start everyone off in the relationship with better and more information.

# Answer
> 2 votes
There is a list of CiviCRM Partners who provide hosting among other services here

https://civicrm.org/partners-contributors?country\_1=All&services=Hosting&language=All&cms=All

# Answer
> 2 votes
CiviCRM tends to place higher demands on hosting than most extensions/plugins/modules, so a common recommendation is to avoid generic shared web-hosting packages and instead look for something that specifically claims to support CiviCRM.

You can find a list of those offering hosting for CiviCRM here. Do note those are not recommendations (actually, there are some there I would avoid), but they do at least claim to offer support for CiviCRM.

Note that some only offer hosting as part of a bundle of other services whereas others provide hosting for anyone without further obligation.

There are horror stories, but you may not get people giving specifics here. You are more likely to get those if you ask in person at a CiviCamp or similar!

As already said in the comments to this question, if you provide more details about what you are looking for then we may be able to guide you more specifically. However, one long-time specialist hoster of CiviCRM offering a range of provision who I have had good experience with is CiviHosting.com (They seem to have fallen off the list above, but there is a note saying the listing is undergoing 'revision and repair'.)

---
Tags: hosting-providers
---


# Question
Title: How do I access the JavaScript API via a WordPress theme template?
I've taken a look at the docs here under "Use on Non-CiviCRM Pages" but I'm coming up empty when trying to access the CRM object via JavaScript.

http://wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference#JavascriptReference-UseonNon-CiviCRMPages

In functions.php I've tried this:

civicrm\_initialize(); $manager = CRM\_Core\_Resources::singleton(); $manager-\>addCoreResources(); $manager-\>addScriptUrl(path-to-ajax.js); // looking around through the available scripts this seemed the obvious candiate

I can get it to load scripts via wp\_enqueue\_script, but I have no idea which scripts it needs. The docs appear to suggest that it should just magically load everything into the header but that isn't the case for me. The CRM object is never defined.

What I want to do is grab the event list in JSON format.

Any clues? What am I missing?

# Answer
One way would be to write your own AJAX handler in the usual WordPress way and then grab the event list via the CiviCRM API. Untested pseudocode:

```
// add AJAX functionality
add_action( 'wp_ajax_my_civi_get_event_data', 'my_civi_get_event_data' );
add_action( 'wp_ajax_nopriv_my_civi_get_event_data', 'my_civi_get_event_data' );

/**
 * Get data from CiviCRM
 */
function my_civi_get_event_data() {
    civicrm_initialize();
    $civi_data = civicrm_api( 'event', etc etc );
    $data = my_process_civi_data( $civi_data );
    echo json_encode( $data );
    exit();
}

```
> 5 votes

# Answer
Not perfect (see below), but I've made this work in a pinch:

As of civicrm version 5.17 at least, `addCoreResources($region)` works if you specify `'page-footer'` for `$region`.

```
CRM_Core_Resources::singleton()->addCoreResources('page-footer');

```

The function signature for `addCoreResources()` says `addCoreResources('html-header')`, and some quick testing shows that CiviCRM is for some reason not able to add resource files to that region. For example, try it with `CRM_Core_Resources::singleton()->addScriptFile('com.example.extensionname', 'js/example.js', $weight=1, 'html-header')` and you'll see your file is not included; other other hand, if that 4th argument is left blank (it defaults to 'page-footer') your file will be included.

So by specifying the 'page-footer' region for the core resources, they are included.

Other thoughts:

* I'm unsure what other regions may be provide the same effect;
* I'm unsure what negative side-effects may come from putting the core resource files in a region other than 'html-header'; at the very least, it does dump some JS errors into your console, which is obviously less than ideal.
> 1 votes

---
Tags: wordpress, api
---


title: How to clone a contact?

text:
# Question
Title: How to clone a contact?
Just hit a few cases where it would be great to have a contact with exact same status eg event, member, relationship, contribution, and of course custom fields on contact and those other entities etc so we can 'test' a fix on.

Might not need to clone 'everything' eg Activities, since I can see complexity bursting forth.

Anyone else looked at doing this? Any thoughts about (im)possibility of doing this?

# Answer
> 3 votes
You can do a shallow clone with `cv` (and a little stripping of the original ID).

```
cv api Contact.getsingle id=203 | sed -e 's#"id"#"foo"#g' | sed -e 's#"contact_id"#"bar"#g' | cv api Contact.create --in=json

```

For the rest, you'd really need to specify the outcomes. Should the spouse be a clone too, or the original? The event registrations are for a cloned event or the original? The employer and other relationships?

1980s movie hijinks will abound as you explore the philosophical implications of cloning, in a time before it was a hellish near-reality.

---

OK, it's sprint, here's some JS to clone a contact:

```
// Go find a contact
CRM.api3('Contact', 'get', {
  "sequential": 1,
  "id": 361
}).done(function(res_old) {
  // Grab contact out and remove their ID.
  var contact_params = res_old.values[0];
  // Remove existing ID so we create a new contact.
  delete contact_params.id;
  delete contact_params.contact_id;
  // Create our new contact.
  CRM.api3('Contact', 'create', contact_params);
});

```

And, to clone a contact and related contributions:

```
// Cloning a full contact + related contributions (+ ...)
CRM.api3('Contact', 'get', {
  "sequential": 1,
  "id": 361
}).done(function(res_old) {
  // Grab contact out and remove their ID.
  var contact_params = res_old.values[0];
  // Remove existing ID so we create a new contact.
  delete contact_params.id;
  delete contact_params.contact_id;
  // Create our new contact.
  CRM.api3('Contact', 'create', contact_params)
    .done(function (res_new) {
      // Now handle related entities, one by one.
      // Contributions only as an example below.
      CRM.api3('Contribution', 'get', {contact_id: res_old.id})
        .done(function(res_contrib) {
          for (var key in res_contrib.values) {
            var new_contrib = res_contrib.values[key];
            // Returned values need to be adjusted so we create a new contribution.
            // Remove link(s) with previous contribution.
            delete new_contrib.id;
            delete new_contrib.contribution_id;
            // Associate with the new contact.
            new_contrib.contact_id = res_new.id;
            // Contribution.create requires financial_type_id, not provided by
            // Contribution.get. That's a whole other topic. Random ID here.
            // You'd actually need to use api "return" to get all fields.
            new_contrib.financial_type_id = 1;
            CRM.api3('Contribution', 'create', new_contrib)
              .done(function (res_newcontrib) {
                // console.log(res_newcontrib, 'rnc');
              }); //
          }
        });
        // Repeat as above for other related entities you wish to clone.
    });
});

```

And so on to clone Contact with related Participant, Contribution & Relationship records ... Some thoughts on this:

* Cloning a contact or other simple entity is straightforward here.
* Cloning related entities got verbose fast!
* It's kinda weird that you have to remove both contribution.contribution\_id and contribution.id, both contact.id and contact.contact\_id ...
* It's also kinda weird that you can't pipe a `contribution.get` back into a `contribution.create` because `contribution.get` does not return the (required) `financial_type_id` field.
* Sounds like to handle this last point, the current approach would require using `return` with the API to specify all the fields on an entity, including the required ones not returned by default.

# Answer
> 2 votes
You can clone by creating a new contact and merging with the old one.

Once merged you can pull the old one back by searching in deleted contacts and restoring the deleted one.

# Answer
> 1 votes
Interesting idea Pete! Not looking at doing this. I would certainly limit to basic contact data and custom fields on contact level as a start. Perhaps relationships would make sense but hard to determine if they all need cloning (for example case relationships probably not)....

---
Tags: contacts
---


title: Export contacts as displayed?

text:
# Question
Title: Export contacts as displayed?
Is there a way to export contacts (to a csv) as they are displayed without having to create a field mapping?

# Answer
From Search its not possible i guess unless you save the mapping and reuse it, but from report you can generate csv from the fields you have selected as to display
> 1 votes

---
Tags: export
---


title: Unable to manage case tags

text:
# Question
Title: Unable to manage case tags
Im getting this error when attempting to add tags to a case.

If I create a case and add tags at the same time, they get added.

If I subsequestly try to remove a tag, no problem.

If I subsequently try to add a tag, I get this error

```
Something wrong with getting info for tag: Expected one Tag but found 25

```

Also a huge array in the backtrace but the relevant bit I think is

```
Something wrong with getting info for tag: Expected one Tag but found 25" } ["message":protected]=> string(72) "Something wrong with getting info for tag: Expected one Tag but found 25" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(64)

```

If I then try to view the case again, it's unviewable and has to be deleted.

Drupal up-to-date using 5.21.0

backtrace

```
CiviCRM_API3_Exception: "Something wrong with getting info for tag: Expected one Tag but found 25"

#0 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Case/Form/CaseView.php(359): civicrm_api3("entityTag", "get", (Array:6))
#1 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/Form.php(595): CRM_Case_Form_CaseView->buildQuickForm()
#2 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(76): CRM_Core_Form->buildForm()
#3 /home/vwdnetor/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Case_Form_CaseView), "display")
#4 /home/vwdnetor/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Case_Form_CaseView), "display")
#5 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(335): HTML_QuickForm_Page->handle("display")
#6 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Case/Page/Tab.php(93): CRM_Core_Controller->run()
#7 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Case/Page/Tab.php(180): CRM_Case_Page_Tab->view()
#8 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(268): CRM_Case_Page_Tab->run((Array:4), NULL)
#9 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:13))
#10 /home/vwdnetor/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:4))
#11 /home/vwdnetor/public_html/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:4))
#12 /home/vwdnetor/public_html/includes/menu.inc(527): civicrm_invoke("contact", "view", "case")
#13 /home/vwdnetor/public_html/index.php(21): menu_execute_active_handler()
#14 {main}

```

Also I'm getting console error 500 on

```
/civicrm/contact/view/case?reset=1&id=859&cid=1777&action=view&context=case&selectedChild=case&key=d880725325c5ab758814d913d9a0790e_7084

```

# Answer
I'm going to bet this is something to do with the civimobile api extension, even though you mentioned you tried disabling. That's the only place I can see the phrase "Something wrong with getting"

https://lab.civicrm.org/extensions/civimobileapi/blob/4.2.1/CRM/CiviMobileAPI/ApiWrapper/EntityTag/Get.php
> 2 votes

# Answer
We have fixed the bug in last CiviMobileAPI extension (5.0.1). Thanks for a feedback!
> 2 votes

---
Tags: civicase, tags
---


title: Adding a menu entry from an extension

text:
# Question
Title: Adding a menu entry from an extension
I'm writing an extension to provide a dashboard of membership numbers specific to our organisation. I have created the extension using civix and edited the navigationMenu function to create a menu entry. I have also created the xxxx.xml file in xml/menu to map the url to the page\_callback. Is there another step I need to do?

The menu entry appears ok with the correct url but, when clicked, only displays the civicrm "home page" rather than my function. Is there a way to check if the xml file is being parsed correctly and the mapping stored? I checked civicrm\_api3('Navigation', 'get'.. but I can't find entries for other extension menus so maybe this is the wrong place to look.

Any help appreciated.

# Answer
You need to either clear caches or menu rebuild: https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#rebuild-civicrm-menus
> 2 votes

# Answer
There's 2 things that often get thought of as one and the same here.

1. The "menu" route is specified in your XML file and makes it so if you type the URL correctly you'll get to your code.
2. The "navigation menu" is usually populated via a hook made easier by civix. Here's an example that adds an item called "Group Growth" under the Contacts menu.

Changes to either of these usually need a cache clear as @Demerit says - I usually prefer `cv flush` if I'm on the command line, or **Administer » System Settings » Cleanup Caches...\***

If that's not working...

* checked your extension is enabled (!)
* check file permissions on your cache directories (e.g. `templates_c`) - sometimes if you've been working on the commandline and your webserver runs as a different user then you can end up locking CiviCRM out of being able to write files it needs to.
> 3 votes

---
Tags: extension
---


title: Integration with Facebook Lead Ads

text:
# Question
Title: Integration with Facebook Lead Ads
Someone knows or has made some integration between Facebook Lead Ads and CiviCRM?

I'm looking for a custom integration as described on https://developers.facebook.com/docs/marketing-api/guides/lead-ads/

# Answer
> 1 votes
Is my Facebook Conversion Tracking Pixel extension what you're looking for?

---
Tags: facebook
---


# Question
Title: How do I edit the contribution confirmation page
How do I edit the contribution confirmation page? I need to change the text so that the instructions are consistent with the buttons

# Answer
I think you could probably manage it with Adminster \>\> Customise Data and Screens \>\> Word Replacements if you chose a sufficiently long phrase to ensure it doesn't affect anything elsewhere.
> 2 votes

---
Tags: contributions
---


# Question
Title: Send an email to activity targets when activity is created via the API
This feels like a simple one but I am not sure if there is a way to do this.

Does anyone know if you can automate an email to a activity assignee when the activity is created and include activity tokens like {activity.subject}, {activity.activity\_date\_time} etc.

I want to send emails along the lines of:

> Your meeting is scheduled with Michael McAndrew at 'Wednesday 4th March, 2pm'. The subject is 'How can I get more involved with your organisation'.

I haven't tried the CiviRules route yet (not sure if it supports tokens for activity emails) I'm going to try it now.

# Answer
> 3 votes
This will work in 5.24! As the new "tokenprocessor" functionality in core now has support for activity tokens. You'll also need a modified version of the emailapi extension https://lab.civicrm.org/extensions/emailapi/-/merge\_requests/3 and you can then use civirules to trigger.

# Answer
> 3 votes
You can solve this in two ways:

1. Use schedule reminders. You can then use all the activity tokens. Draw back is that this one sends e-mail based on the (scheduled) date of the activity.
2. Use CiviRules and the email api extension. Create a civirule based on the trigger activity is added. Add a condition to limit the civirules to only the activity assignnee and add an action to send an e-mail. I am not sure if all activity tokens work with this solution.

# Answer
> 1 votes
I'm pretty sure it only happens automatically in the UI form in core (related but separate ticket: https://lab.civicrm.org/dev/core/issues/1582).

But for the api it shouldn't be too hard have hook\_post or something call CRM\_Core\_BAO\_MessageTemplate::sendTemplate(), which will automatically parse CONTACT tokens. If you want activity tokens you could get the same effect by putting smarty variables of your choosing in the template, and then passing in the appropriate activity's values in the $tplParams parameter to the sendTemplate() function. I'm pretty sure I've done something like that in a different context elsewhere, e.g.

`$tplParams = array('the_subject' => $activity->subject);`

and then in the message template:

`Here is the activity subject: {$the_subject}`

---
Tags: activities, mailing, civirules, automation
---


# Question
Title: error when opening Word attachment to email from view activity
I've sent an email with an MS Word document as an attachment. When I look at the email on the activity log and open the attachment with Word then I get a warning message saying there is unreadable content in the document. It allows me to open the document anyway and doing a comparison with the original it says its the same. If I open the document from the email that is sent then its fine.

Not a big deal for me, but could be worrying for another user. I'm using CiviCRM 5.15.1 (and WordPress, but doubt that is relevant).

# Answer
I've tried again just now and all seems OK, so I think the answer is the same as JPG files uploaded as notes can't be viewed and that it was caused by a blank line in the functions.php in the theme
> 1 votes

---
Tags: wordpress, email
---


title: CiviCRM Stripe PCI Compliance

text:
# Question
Title: CiviCRM Stripe PCI Compliance
I am using the latest version of the Stripe extension (5.2) and have CiviCRM up-to-date and Drupal. I'm getting this error in my Stripe portal, I only use Stripe with CiviCRM. Can anyone provide some insight? Was not sure if i should post this here or at https://lab.civicrm.org/extensions/stripe/issues

# Answer
> 1 votes
The Stripe development team has upgraded the code of the extension to support the new API that is PCI compliant.

---
Tags: drupal, civicontribute, payment-processor, stripe
---


# Question
Title: Expected import behavior when setting custom field to view only
Checking this option in a custom field **View Only? Is this field set by PHP code (via a custom hook). This field will not be updated by CiviCRM.**

I had read that it would not update upon import. However I just ran an import and a field did import that was marked as view only. For a previous import I recall that it did not update.

What is the expected behavior here? I thought it was not to update.

# Answer
It seems a probable bug.
I ran an import of a file containing same field as my custom field and the field was updated by the information mentioned in csv and did not retain its default value. So, Yes, the issue was replicated.
The value of custom field is only retained when we create a contact through CiviCRM and not importing, so it looks to be an inconsistency in the behaviour while importing. An issue will be opened for the same in issue tracker of CiviCRM.
Thanks for reporting!
> 2 votes

---
Tags: custom-fields, import
---


# Question
Title: Must my command-line tool be an extension?
I have made a standalone tool which i start with the command-line to see possible updates in the database to use the actual translations, and a program to compare an existing database with a new installation. Now you can use the sql-files in the localization-files only with a new installation and i use the new po-files to find possible updates after the normal upgrading in CiviCRM. The translated strings in the database are now never upgraded with new Transifex translations. After making the programs i looked how extensions work, but this is not really an extension for users but may be something for the system administrator. Are there other kinds of extensions?

# Answer
> 1 votes
If the tool is command-line only, it probably shouldn't be an extension.

If you need to bootstrap CiviCRM from the command line, and you can presume that the cv tool is in the path, and your tool is PHP-based, you can add the line:

```
eval(`cv php:boot`);

```

or just:

```
cv php:boot --level=classloader

```

This should give you the ability to call CiviCRM classes without creating an extension.

---
Tags: extension
---


# Question
Title: SOLVED CiviMobile: DB Error in adding a Participant to an Event
I have an issue with the database for which I find no solution, even after intensive search on Internet. It now unables me to add a Participant to an Event. And even has consequences on adding Relationship or Memberships. Could you kindly help to solve this? Thanks for your help. Drupal 7.69 CiviCRM 5.21.1

Below are the logs

```
Feb 28 11:13:28  [error] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , message , entity_table , entity_id ) VALUES ( 509 , 'Array' , '%display_name has created participant.' , 'Participant' ,  1677 )  [nativecode=1054 ** Unknown column 'data' in 'field list']
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , message , entity_table , entity_id ) VALUES ( 509 , 'Array' , '%display_name has created participant.' , 'Participant' ,  1677 )  [nativecode=1054 ** Unknown column 'data' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , message , entity_table , entity_id ) VALUES ( 509 , 'Array' , '%display_name has created participant.' , 'Participant' ,  1677 )  [nativecode=1054 ** Unknown column 'data' in 'field list']"]
)

Feb 28 11:13:28  [debug] $backTrace = #0 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Error.php(192): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /home/leboucli/activites/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB.php(987): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...")
#3 /home/leboucli/activites/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...")
#4 /home/leboucli/activites/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), "INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...", "DB_Error", TRUE)
#5 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/common.php(1920): PEAR->__call("raiseError", (Array:7))
#6 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, "INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...", "1054 ** Unknown column 'data' in 'field list'")
#7 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/common.php(1229): DB_mysqli->simpleQuery("INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...")
#9 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/DataObject.php(2416): DB_common->query("INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...")
#10 /home/leboucli/activites/sites/all/modules/civicrm/packages/DB/DataObject.php(1040): DB_DataObject->_query("INSERT INTO civicrm_contact_push_notification_messages (contact_id , data , m...")
#11 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/DAO.php(554): DB_DataObject->insert()
#12 /home/leboucli/activites/sites/default/files/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/BAO/PushNotificationMessages.php(20): CRM_Core_DAO->save()
#13 /home/leboucli/activites/sites/default/files/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/BAO/PushNotificationMessages.php(40): CRM_CiviMobileAPI_BAO_PushNotificationMessages::add((Array:7))
#14 /home/leboucli/activites/sites/default/files/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/PushNotification/SaveMessageHelper.php(29): CRM_CiviMobileAPI_BAO_PushNotificationMessages::create((Array:7))
#15 /home/leboucli/activites/sites/default/files/civicrm/ext/com.agiliway.civimobileapi/CRM/CiviMobileAPI/PushNotification/Utils/BasePushNotificationManager.php(59): CRM_CiviMobileAPI_PushNotification_SaveMessageHelper::saveMessages((Array:1), 1677, "Participant", "Soirée Dansante Mars 2020", "%display_name has created participant.", (Array:3))
#16 /home/leboucli/activites/sites/default/files/civicrm/ext/com.agiliway.civimobileapi/civimobileapi.php(332): CRM_CiviMobileAPI_PushNotification_Utils_BasePushNotificationManager->sendNotification()
#17 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Utils/Hook.php(298): civimobileapi_civicrm_post("create", "Participant", 1677, Object(CRM_Event_BAO_Participant))
#18 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(74): CRM_Utils_Hook->runHooks((Array:72), "civicrm_post", 4, "create", "Participant", 1677, Object(CRM_Event_BAO_Participant), NULL, NULL)
#19 /home/leboucli/activites/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(98): CRM_Utils_Hook_DrupalBase->invokeViaUF(4, "create", "Participant", 1677, Object(CRM_Event_BAO_Participant), NULL, NULL, "civicrm_post")
#20 /home/leboucli/activites/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(184): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\PostEvent), "hook_civicrm_post", Object(Civi\Core\CiviEventDispatcher))
#21 /home/leboucli/activites/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:2), "hook_civicrm_post", Object(Civi\Core\Event\PostEvent))
#22 /home/leboucli/activites/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_post", Object(Civi\Core\Event\PostEvent))
#23 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Utils/Hook.php(392): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_post", Object(Civi\Core\Event\PostEvent))
#24 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Event/BAO/Participant.php(129): CRM_Utils_Hook::post("create", "Participant", 1677, Object(CRM_Event_BAO_Participant))
#25 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Event/BAO/Participant.php(181): CRM_Event_BAO_Participant::add((Array:15))
#26 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Event/Form/Registration.php(853): CRM_Event_BAO_Participant::create((Array:15))
#27 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Event/Form/Registration.php(695): CRM_Event_Form_Registration::addParticipant(Object(CRM_Event_Form_Registration_Confirm), "509")
#28 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(637): CRM_Event_Form_Registration->confirmPostProcess("509", NULL)
#29 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Form.php(479): CRM_Event_Form_Registration_Confirm->postProcess()

#30 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/StateMachine.php(144): CRM_Core_Form->mainProcess()
#31 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(45): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")
#32 /home/leboucli/activites/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")
#33 /home/leboucli/activites/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")
#34 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Controller.php(335): HTML_QuickForm_Page->handle("next")
#35 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Invoke.php(268): CRM_Core_Controller->run((Array:3), NULL)
#36 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:15))
#37 /home/leboucli/activites/sites/all/modules/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
#38 /home/leboucli/activites/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3))
#39 /home/leboucli/activites/includes/menu.inc(527): civicrm_invoke("event", "register")
#40 /home/leboucli/activites/index.php(21): menu_execute_active_handler()
#41 {main}

```

\[SOLVED\] This issue was solved by installing a new extension, as Jon G - Megaphone Tech suggests below. Thanks @Jon G - Megaphone Tech for the very useful help.

# Answer
> 4 votes
This error is related to the CiviMobile extension - you can see it mentioned in the backtrace, and the table with the error, `civicrm_contact_push_notification_messages`, is created by the CiviMobile extension.

The error is that there's a field in that database table which is missing called `data`. I can see from the CiviMobile source code that this field was added with Version 5.0. Is it possible that you installed the upgrade but didn't run the database upgrade? Go to **Administer menu » Administration Console » System Status** and see if there's a message telling you to run the database upgrades.

If the database upgrade ran but failed, you might be in your current situation. In that case, you'll need to run the following query on your MySQL database. I copied the query from the link above, which is the upgrade code.

```
ALTER TABLE civicrm_contact_push_notification_messages ADD data varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL

```

UPDATE: Based on the comments below, it seems clear that the issue is with `log_civicrm_contact_push_notification_messages`, not `civicrm_contact_push_notification_messages`. This is a bug in the CiviMobile upgrade routine (though a common one). The trick is to run `CRM_Logging_Schema->fixSchemaDifferences`. The easiest way to do this is to install or enable an extension that's not currently installed; you can uninstall it immediately afterward.

---
Tags: error, database, civimobile
---


# Question
Title: CiviMobileAPI - "The extension is too old" Error
I'm running CiviCRM (v5.21.2) and the CiviMobileAPI (v5.0.1) extension in WordPress (v5.3.2).

The CiviMobileAPI extension path is `/wp-content/uploads/civicrm/ext/com.agiliway.civimobileapi/`

The CiviCRM WP REST API (v0.1) WordPress extension is also installed and active.

Still, I'm getting a "The extension is too old" Error when connecting via the iOS CiviMobile app (v5.0).

What could be the reason for that?

# Answer
> 0 votes
The CiviMobileAPI page is mentioning that you need a Patch for Wordpress - maybe that's the reason?

---
Tags: wordpress, extension, mobile
---


# Question
Title: Xero integration with OAuth 2.0 credentials
Seeing some changes in the Xero process of creating a "new App" to use for synching with CiviCRM.

Specifically it now requires an

* OAuth 2.0 redirect URI

but also, unless my eyesight is failing, i no longer see where we are meant to upload the .cer we create on our hosting server.

Thoughts?

# Answer
we’re almost done moving over xero to oauth 2.0 and can share the code/instructions in the next few days if that works for you?
> 2 votes

---
Tags: civixero
---


title: CurrentUser function in Reports?

text:
# Question
Title: CurrentUser function in Reports?
I'm wondering if it is possible for the "Assignee Name" field in a report to have a Current User function. My goal is to create 1 report for the CiviCRM Dashboard where users can see all the activities assigned to them without creating a filter for each person.

# Answer
> 1 votes
It's not quite what you're looking for but if you install the Extended Reports extension then you can do:

1. Go to Administer - CiviReport - Create Report from Template.
2. Pick extended report - activities.
3. Pick some columns for the activity.
4. On the Display Options tab, check the box to display as a tab on the contact record, and for the box below that choose assignee.
5. Click refresh results.
6. From the actions dropdown choose Create Report.

Then on any given contact they'll have a tab that shows their assigned activities.

---
Tags: civireport, activities, dashboard
---


title: Migrate Import/Export Mappings

text:
# Question
Title: Migrate Import/Export Mappings
Is there a way to migrate the saved Import/Export Mappings to a different CiviCRM installation? It seems there is no way to export them. I already tried copying the .php files located at /bin/migrate, but the settings did not show up when I tried to import something in the new installation.

# Answer
Assuming your location types and phone types etc have the same ids, you should just be able to copy over the two tables, `mysqldump <dbname> civicrm_mapping civicrm_mapping_field > somefile` and then import the file into the other site's mysql database. But note that will \**** **OVERWRITE** \**** any mappings that you had already set up in the new site.

As noted in the comments there's some constraints so there's some extra steps:

1. If using mysqldump, use `--skip-add-drop-table` and `--no-create-info`. In phpmyadmin uncheck the option to drop/create tables.
2. In the new system do `TRUNCATE TABLE civicrm_mapping_field` then `TRUNCATE TABLE civicrm_mapping`.
3. Import civicrm\_mapping first, then civicrm\_mapping\_field.
> 1 votes

---
Tags: import, field-mapping
---


title: How to import members spreadsheet

text:
# Question
Title: How to import members spreadsheet
I'm new to CiviCRM and have a somewhat noob question about importing membership data from a spreadsheet. We have this data in a way that each row is a company with organizational data (membership type and date and tax number..etc) and some of the columns in this row have also individuals (employees of the company) in them with their contact details in other columns. How should we start the importing is my question. Should I first import our members as organizations and then do another import for the individuals...all into contacts? How to connect these to the companies? Does it work with say based on ID-s that I give to the companies beforehand? Also how to import these same companies to the membership module?

I'm using latest Joomla and CiviCRM.

# Answer
> 2 votes
This has been answered before indeed: noob query : Importing contacts and membership and here: https://docs.civicrm.org/user/en/latest/membership/manual-entry-of-memberships/ Thanks for the exchange:-)

---
Tags: civimember, import
---


title: Mail account authentication with Oauth2

text:
# Question
Title: Mail account authentication with Oauth2
Exchange Online is retiring basic authentication which means, I think, that CiviMail will no longer be able to process bounced messages in Exchange Online mailboxes. Are there any plans for CiviMail Mail Accounts to use Oauth2 for authenticating with the mail server?

# Answer
UPDATE: It's available now for **INBOUND** emails (bounce processing/email processor) in 5.32 as a hidden extension. See https://docs.civicrm.org/sysadmin/en/latest/setup/oauth/#enable-the-module

---

It's in progress for google and would likely be the same for outlook/exchange.

See https://lab.civicrm.org/dev/mail/issues/59

It supports using a bearer token already but we could use some coding help though for someone to write the code to get/store/use the refresh tokens in order to get the bearer token.
> 0 votes

---
Tags: civimail
---


title: batch edit organizations

text:
# Question
Title: batch edit organizations
I would like to bulk add countries to my organizations via profiles but when adding an organizational field type I can't see the country field, only the official name, SIC code and some custom fields I created. I can only see country at "contact" type not at "oragnization" tpye. But bulk editing organizations with this "contact type profile field" doesn't do anything.

# Answer
You need to add the country field to your profile. Since the country field applies to all Contacts it shows under Contacts.

Make sure you do not have any other conflicting entities in the same profile you are using to batch update orgs.

You should create a profile called 'Batch Update Organization' to be used just to batch update the organization contacts.
> 4 votes

---
Tags: batches
---


# Question
Title: How do I show members their current status on CiviCRM/WordPress
I'm unable to show our members their specific membership status info as I keep getting the "Profile search, view and edit are not supported"

Why is it so hard for CiviCRM to have a simple feature that allows members see their current status and decide to renew or not on their own?

# Answer
Its not so hard - there are a few ways to do this.

Easiest - create a user dashboard page where a user can see all of their account history.

`[civicrm component="user-dashboard" hijack="0"]`

On the dashboard - there is also an option to renew.
> 4 votes

---
Tags: wordpress, civimember
---


title: How do I delete a CiviCRM instance?

text:
# Question
Title: How do I delete a CiviCRM instance?
Trying to find details on how to remove a CiviCRM test data setup I've created. I'm using Wordpress 5.3.2 multisite and CiviCRM 5.22.1. I've installed CiviCRM into the plugin directory which appears to work...

.. as I installed a CiviCRM instance in one of the domains. The installation used my default Wordpress database, and I'd prefer to do it again, but using a new database (and also in a different domain).

I'd like to have two instances, using the same code, but ideally accessing different databases for the CiviCRM data.

Anyway can't see any documentation on how to to remove the CiviCRM database and get to the position where I can reinstall in the two domains. Any suggestions on how to remove the CiviCRM database - and if this is documented anywhere?

Thanks for any assistance

# Answer
> 0 votes
The files are easy enough to get rid of - just delete .../wp-content/plugins/civicrm and best to clear ../wp-content/uploads/civicrm as well.

For the database, you could just leave the old version there or you can use phpMyAdmin to delete all the tables starting civicrm\_ leaving all the ones starting wp\_ there.

Mick

---
Tags: wordpress, installation, multisite
---


# Question
Title: Is there a way to make all Mosaico blocks the same width?
When adding Mosaico blocks each has its own width. That creates problems if you want a different color for the external background but not have it change its width depending on the width of each Mosaico block.

# Answer
Mosaico template 1.19 solves the problem with transparent background for the Logo block at the top. Thanks
> 4 votes

---
Tags: mosaico
---


title: How do I record partial payments?

text:
# Question
Title: How do I record partial payments?
My client frequently needs to record partial payments for events and memberships. When I open the transaction history, I don't see a way to record the partial payment. In fact, all registrations seem to get recorded as completed by default. Any suggestions for a workflow which better records the transactions and the status of payments?

# Answer
* First, record the payment with a status of *Pending*.
* Click the triangle next to the contribution to open up the payment listing (see screenshot below).
* Click **Record Payment** (or **Submit Credit Card Payment**). You can log a partial payment from here.

In my screenshot below, you can see the $55 donation has a status of "Partially Paid".
> 4 votes

---
Tags: civicontribute, contributions
---


title: Create a extension for civicrm

text:
# Question
Title: Create a extension for civicrm
Please give some reference site for creating a simple extension for civicrm with sample example. Any simple extension on GitHub.

# Answer
You need to install civix to create civicrm extension and then follow documentation for creating module extension. There are many examples of extension under civicrm.org. The easiest one to start would be

Ref: https://www.youtube.com/watch?v=lrk8X\_jt0wU

HTH

Pradeep
> 3 votes

# Answer
As a first step I would go check the Developer Guide here: https://docs.civicrm.org/dev/en/latest/extensions/
> 1 votes

# Answer
1. First install civix and create a extension in `[civicrm.files]/ext/` folder. The extensions folder will have all the extension you create in future.
2. Move to that extension folder and generate a new extension by executing `civix generate:module <your_extension_name> --license=AGPL-3.0` command.
> 0 votes

---
Tags: civix
---


title: Finding people with multiple activities

text:
# Question
Title: Finding people with multiple activities
We have a client who will be recording people who attend theatre productions. These attendances will be recorded as CRM activities (imported in bulk). The client would then like to search for people who have attended x activities (maybe over a set time period). Then group them and contact them.

CiviCRM would be very good at telling us who attended one or more theatre attendance activities. But not mutiple. Considered smart groups, custom searches, search builder, extended reports etc.

We think a custom extension may be needed for this. Any ideas would be appreciated.

Olly

# Answer
> 2 votes
Maybe the extension summary fields could be used as a base. Even though it probably does not do exactly what you want, it may be easier to build up on it insted of developing something completely new.

Or you could use the SQL-Task Extension.

# Answer
> 2 votes
Alternative with very little coding:

1. create a custom field on individual Number of Productions
2. create a CiviRule (trigger activity is added, condition activity type = xxxx)
3. develop a specific action to add 1 to the number of productions (max 2 hrs of work)
4. search on the custom field

# Answer
> 1 votes
To me this sounds like a job for pivot tables:

1. Search - Find Activities.
2. Choose Export from the options dropdown.
3. Open the file in excel and make a pivot table, with the contact on the row, and count of activity id as the data value. Sort the pivot by count.

---
Tags: activities
---


# Question
Title: How can I search contacts and run a report of contacts with no activity
I'm struggling to find a list of conatcts with no activity records, could someone help me on how to achieve this?

# Answer
> 4 votes
Use search builder to search for all contacts with the activity field: activity date of "not null" and add them to new group "has activities". Use the include/exclude custom search to find any contact not in the "has activities group and add them to a new group "no activities".

# Answer
> 0 votes
You could export a list of contacts, export a list of activities, and then using vlookup() in excel find the rows in the contact list that do not appear in the list of activities.

See e.g. https://www.extendoffice.com/documents/excel/3124-excel-compare-two-columns-for-missing-values.html#formula where it says "Compare two columns for (highlighting) missing values with formulas"

---
Tags: activity
---


# Question
Title: Can I create report with filtered custom field values?
When I create reports, they list either Contacts, Contributions, Activities or similar. Is it possible to list Custom Field entries?

For example, I have a TAB with custom fields. I'd like to get a list of entries that have PARAMETER X with corresponding DATA value from multiple contacts, while not listing Y.

Alternatively, I'd like to get ALL of these **Custom Field entries** from multiple contacts (including contact name), not just the names of contacts that contain these Custom Fields entries.

Is that possible? If not via reports, maybe somehow else?

# Answer
> 2 votes
It turns out, I can do it easily with CiviCRM Constituent Summary report. (**Class used: CRM\_Report\_Form\_Contact\_Summary**)

I just need to enable to show all necessary custom fields and it returns exactly the table needed.

# Answer
> 1 votes
If you are using Drupal CMS than you can use Views to create report.

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


title: How to CSS style price set checkbox?

text:
# Question
Title: How to CSS style price set checkbox?
I need help styling my priceset checkboxes on a contribution pages. I was able to style it, but when any of them are selected, the checked item doesn't show activated as per my css color. It maybe a simpletest thing for some, but I would very much appreciate if anyone can help please. Here's my CSS so far

```
#crm-container.crm-public .price-set-row .crm-price-amount-label {display: inline;}
#crm-container.crm-public .price-set-row {display:inline-block;border:1px solid #e0e0e0;width:48%;}
#crm-container.crm-public .price-set-row label {display: inline-block;}

#crm-container.crm-public .price-set-row:hover,
#crm-container.crm-public .price-set-row.selected,
#crm-container.crm-public .price-set-row:checked {background-color: #FFC107; color: #FFF;font-weight:700;}

```

# Answer
Adding as an answer for future references

```
 #crm-container.crm-public .price-set-row input {position: absolute;opacity: 0;cursor: pointer;height: 0;width: 0;}
#crm-container.crm-public .price-set-row input.crm-form-checkbox + label{display: inline-block;text-align:left; padding: 8px 8px;
  cursor: pointer;border: 1px solid #e0e0e0;width: -webkit-fill-available; margin-left: 0;}

#crm-container.crm-public .price-set-row input.crm-form-checkbox + label:hover,
#crm-container.crm-public .price-set-row input.crm-form-checkbox + label.selected,
#crm-container.crm-public .price-set-row input.crm-form-checkbox:checked + label {background-color: #FFC107; color: #FFF;}
#crm-container.crm-public .price-set-row input.crm-form-checkbox:after {content: "";display: table;clear: both;}

#crm-container.crm-public .price-set-row .crm-price-amount-label {display: inline;}
#crm-container.crm-public .price-set-row {display: inline-block;width:49%;}

```

UPDATE: More comprehensive styling

Styling Contribution pages with buttons
> 2 votes

---
Tags: css
---


# Question
Title: What entity to use for committees (both a group and a collection of projects)?
Having some trouble mapping CiviCRM database entities to conceptual entities in my organization. We have long lists of committees; each committee can have any number of projects; projects can have any number of volunteer opportunities. Working backwards from CiviVolunteer, that seems like I should have Projects and Campaigns to group them. But Committees more naturally map to Groups. So is it a question of using both and keeping them synced and somehow associated?

# Answer
> 3 votes
I would create a sub-contact type of an Organization called 'Committee'. The committee can be set to the 'Owner' of each volunteer project. It might be useful to useful to have a campaign for each committee as well.

Also, by adding it as a sub-contact type you can add the individual relationships against the committee and track their start and end dates.

---
Tags: groups, civivolunteer
---


# Question
Title: How to assign Drupal's system roles to Case Role in CiviCase
I would like to Use CiviCase to manage my cases.

I find that the Case Roles can be assigned to update the case. However, the Case Roles are not the Drupal's system user roles. (e.g. Administrator)

Does it has a solution to assign the system roles to Case Roles?

Thanks!

# Answer
Welcome to SE! You're right that Case roles are not the same as Drupal Roles.

Case Roles are relationships. There is a module called "CiviCRM Relationship to Role Sync" that might help which is part of the civicrm\_entity module, but not enabled by default. Someone was asking about this just yesterday on mattermost and it seems we don't have much current documentation for it.

Another approach would be to use Drupal Roles and a post by @petednz might help: https://fuzion.co.nz/blogs/complex-civicrm-relationship-role-synchronisation-recipe
> 1 votes

---
Tags: drupal, civicase
---


# Question
Title: How to get my Green Party email address added to the CiviMail from dropdown list
I am the Membership Secretary for the Croydon and Sutton Local Party. In the past I have been able to send out mailings to our members. However, since the update on civi my Green party email address cannot be manually entered so that I am unable to send out mailings.

How can I rectify this please so that my email can be added to the from section of a mailing?

# Answer
> 3 votes
This is a setting in CiviCRM setting under Administer --\> System settings --\> Outbound E-mail.

There is a checkbox to allow different from e-mail addresses. If this is checkbox is set to no you can only send from a predefined list of senders.

The from e-mail addresses could be found under Administer --\> CiviMail --\> From Email Addresses

---
Tags: civimail
---


title: CiviCRM API Implementation

text:
# Question
Title: CiviCRM API Implementation
How are API's implemented in the CiviCRM Codebase? I have a idea of basic structue user \<-\> api \<-\> BAO \<-\> DAO \<-\> mysql but I guess there is more to this than just this structure. Thanks in Advance!

# Answer
Welcome to CiviCRM SE! The first place to look for this information is in the relevant section of the developers guide at https://docs.civicrm.org/dev/en/latest/api/
> 5 votes

# Answer
I just finished writing a man page for this: *APIv4 Architecture*

Note that there are currently 2 versions of the CiviCRM API. APIv3 has been around for years, and APIv4 is fairly new. But they both rely on core BAO classes for writing data, and a query builder for fetching data.
> 3 votes

---
Tags: api
---


# Question
Title: Autoassign relationship when creating contact
I'm looking for a way to auto-assign relationships between the current drupal user and created contact. I know there is extension CiviRelate, but it only works when using "profiles". I'm looking for a way to auto-assign selected relationships when the user creates contact from the CiviCRM backend (from the dashboard).

# Answer
> 1 votes
You could achieve this with the CiviRules extension. The extension can be found here: https://civicrm.org/extensions/civirules and the documentation here: https://docs.civicrm.org/civirules/en/latest/

You should add a rule with trigger "Contact of any type is added" and then some conditions (perhaps on contact type or contact is in group if required). You can then use the action "add relationship".

# Answer
> 1 votes
Depending on your CMS you could consider the following

* WP: create a Caldera Form for people to add New Contacts via, and add the relationship automatically
* Drupal: as above but use Webform

---
Tags: relationships
---


# Question
Title: How do you properly setup scheduled job for report mailings?
Our cron is setup correctly - however I am not sure our parameters for the job `mail_report` are.

`instanceId=[82] format=[print]`

Also, do I have to create a separate job for each report or can I create one job for all reports? Lets say I just want an HTML print out embedded in the body of the email for all reports in which there is an email setup.

# Answer
> 3 votes
The format is

```
instanceId=1
format=csv

```

No brackets. The `format` parameter value can also be `print` for printer-friendly HTML. If no format is specified it will send as PDF.

If you are doing this in the UI, you have to setup a separate job for each report. That is useful, because you may want some reports mailing at a different frequency.

# Answer
> 1 votes
The last time I did this, which was a while ago, I didn't do anything with the job in the admin screens in civi, I just set up a cron job and gave it the parameters there, e.g.

`php bin/cli.php -u cms_user_name -e Job -a mail_report --instanceId=82 --format=csv`

So for multiple reports just add more similar lines in your cron script.

---
Tags: reports, scheduled-job
---


title: Custom API Action: Access Request Body

text:
# Question
Title: Custom API Action: Access Request Body
I'm developing a custom API v3 action which is intended to handle a webhook request from Zoom (https://marketplace.zoom.us/docs/api-reference/webhook-reference). Zoom follows REST standards by putting the data inside the request's body (not like the CiviCRM api where you put the data inside a json parameter). So, is there a way to access the request's body from my custom action or custom extension?

# Answer
> 2 votes
This is typically handled by adding a webhook endpoint to your extension. The Mailchimp extension does this - see Webhook.php.

If you've already written your API action, it shouldn't be too tough to use a webhook to grab the data and push to API.

It sounds like maybe you're past this point, but https://lab.civicrm.org/dev/financial/issues/55 is an issue I raised to deal with handling POST data stored as JSON.

# Answer
> 1 votes
**UPDATE**: This answer won't work. See comments.

---

You can always access $\_POST.

There is CRM\_Utils\_Request::retrieve() - it serves a different purpose but you could also use it, specifying method 'POST'. It's not technically a supported API call though. See https://github.com/civicrm/civicrm-core/blob/5.22.1/CRM/Utils/Request.php#L51

---
Tags: api, extension, developer
---


# Question
Title: 'DB Error: no such field' for all (free) event registrations
Using CiviCRM 5.20.2 on Drupal 7.69.

Having a new error whenever someone tries to register for an event through CiviEvent on our website. This happens for all events: private or public; those with custom fields and those with no custom fields; with confirmation screens turned on or off; with thank you emails turned on or off. The event is free/no payment processing.

The user sees this screen:

The registration does not pull through on the back-end either.

This is the error message in the error log:

```
$Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -19 [message] => DB Error: no
such field [mode] => 16 [debug_info] => INSERT INTO
civicrm_contact_push_notification_messages (contact_id , data ,
message , entity_table , entity_id ) VALUES ( 6820 , 'Array' ,
'%display_name has created participant.' , 'Participant' , 2699 )
[nativecode=1054 ** Unknown column 'data' in 'field list'] [type] =>
DB_Error [user_info] => INSERT INTO
civicrm_contact_push_notification_messages (contact_id , data ,
message , entity_table , entity_id ) VALUES ( 6820 , 'Array' ,
'%display_name has created participant.' , 'Participant' , 2699 )
[nativecode=1054 ** Unknown column 'data' in 'field list'] [to_string]
=> [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO
civicrm_contact_push_notification_messages (contact_id , data ,
message , entity_table , entity_id ) VALUES ( 6820 , 'Array' ,
'%display_name has created participant.' , 'Participant' , 2699 )
[nativecode=1054 ** Unknown column 'data' in 'field list']"] )

```

Any clue how to fix this?

# Answer
Fixed by upgrading to Civi 5.23

However this may also be relevant: SOLVED CiviMobile: DB Error in adding a Participant to an Event
> 2 votes

---
Tags: civievent, error
---