# Question
Title: How to make links in email direct and non-trackable
We are sending emails containing links which are redirecting through civi. We need them to go direct to the website. (Our civi is not public facing). All articles / questions i have seen are about making urls trackable, we need the opposite.

Any link added to a message template is creating a url that runs through our server. This happens regardless of how email is sent, single email, bulk email etc.

What am I doing wrong?

# Answer
The adding of trackable urls is down to an extension called Transactional Email. This was installed so we could records bounces on single emails going out (which is only set up in default for bulk mail). The extension adds tracking links across the whole install. Disabling this extension stopped it redirecting urls through our servers. Thanks to Bails at Circle Interactive for helping find the answer.
> 2 votes

# Answer
Parvez is rigth!

I want to add: In your case, when you will never ever want to use trackable links, you can switch them off in the CiviMail component settings: Uncheck the options "Enable click-through tracking by default" and "Enable open tracking by default"
> 4 votes

# Answer
You can turn off tracking in the "Advanced Mailing Options" on the final step, assuming your using to send. I've attached a screen shot for reference.

On the Tracking tab, you can untick "Track Click Throughs" to stop URLs going via CiviCRM. To clarify you will then lose the ability to see tracking information on the mailing reports.
> 3 votes

---
Tags: mailing, hyperlinks
---


# Question
Title: Unable to map fields when exporting to CSV
We are unable to map fields when exporting to CSV. Using Primary Field export gets us the standard csv, but when option to select fields for mapping is checked, seems to go into a loop (see attached screenshot). Cannot use a previously saved field mapping either. We are running Civicrm 5.32.2 with Joomla 3.9.23 on PhP 7.4 server. Wasn't a problem before last Joomla/Civi updates. thanks, Kate

\`

# Answer
> 0 votes
This is working on https://dmaster.demo.civicrm.org/civicrm

It will help if you can add your CMS version, CiviCRM version etc to your question. This could be something interfering with the display of the 'add field' feature

If you know how to use your browser 'inspect' you may be able to identify an error in your Console

---
Tags: reports, export, field-mapping
---


# Question
Title: Delete multiple contacts from a list input
Civi is a great platform and I started to use with the first action to organize some old contacts. I could import them fine and I see them in the system. The problem is that we are doing some cross-checking for the accounts' current validity and at some point we need to delete some of them but based on a list of items, let's say emails that should be inputted somehow. So the question is: is there an option like that? An input area like the "import contacts" where we can upload a file (maybe csv or text) with the emails to delete, then the script would just remove the contacts found.

Thank you very much!

Andy

# Answer
You could easily import a list of emails, add the contacts to a group when you import, and the delete all the members of the group.

The only potential hurdle is if you have more than one contact with the same email address, in which case the contacts will be imported as new contacts. In that case, I would suggest finding duplicate contacts of any members of your newly created group with a email matching rule and you can merge as appropriate to delete those contacts or simply deal with the matching contacts manually. If you want to delete all contacts with email addresses on your list, you could simply merge all the duplicate contacts found and then delete.
> 2 votes

---
Tags: contacts, delete, multiple-choice
---


# Question
Title: What is the Drupal 8 Webform url for autofill CiviMail linkage
In D7 Webform Civicrm integration, under Additional Options for Civi configuration there is this link

To have this form auto-filled for anonymous users, enable the "Existing Contact" field for Contact 1 and send the following link from CiviMail: https://site.nubay.net/sample-webform?cid1={contact.contact\_id}&{contact.checksum}

I do not see the equivalent link for D8 Webforms. Would it be the same link? Should it be in the additional options section?

# Answer
> 2 votes
It works just the same!

Example:

/form/special-resolution?cid1=123&cs=6b8783497eb95b80a04d943f04fa8c5b\_1585859799\_168

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


# Question
Title: Changing display on CiviCase search results
Currently, when I search using Find Cases on CiviCase, the results are displayed in 9 columns: Client, Subject, Status, Case Type, My Role, Case Manager, Most Recent, Next Sched., Actions.

We don't involve assigning Civi activities much in our workflow so these fields are pretty much useless to us: **Most Recent, Next Sched.**

I would also like to add a results column that includes the Case Start Date.

How can I make this change?

# Answer
You've picked a hard one to customize since there's multiple technologies involved on that screen and the results load after the rest of the page but without an easy way to hook into it to change it. You might want to instead go to Reports - Case Reports and use the Case Details report to select your fields and then on the Filters tab choose the criteria.
> 1 votes

---
Tags: civicase, search, display
---


# Question
Title: Confusion about theming and version - Shoreditch?
I need some advice on the theming of my instance of CiviCRM. I have done some research and have seen this theme and I'm not sure of the following

1. Is it version based?
2. Is it CMS based - depending on the CMS you are using?
3. Or is it a setting inside CiviCRM - I am currently using 5.25.0

I'm looking to move from the before to after.

Thanks in advance for the advice,

E :

# Answer
> 1 votes
The system requirements are listed at https://github.com/civicrm/org.civicrm.shoreditch#requirements. It's an extension you would need to install.

---
Tags: theme, shoreditch
---


# Question
Title: Change count in Custom Tab with table according to filtered data
I have filtered the data being shown in a custom group tab on contact page but I'm struggling on how to change the count being shown next to the tab name. Could anyone help me how? thanks

# Answer
I assume you used a tabset hook to adapt the tab on the contact page. That is where you can influence the count as you can see here:

```
  $tabs[] = [
    'id' => "mediweattestbeheer",
    'url' => CRM_Utils_System::url("civicrm/mediweattestbeheer/page/mediweattest", "reset=1&mid=" . $contactId, TRUE),
    'title' => "Attesten",
    'weight' => 16,
    'count' => CRM_Mediweattestbeheer_BAO_MediweAttest::telAttestenMedewerker($contactId),
    'class' => "livePage",
  ];

```

For the *count* parameter I have used a function that counts the number of records in the table for the specific contact.
> 3 votes

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


# Question
Title: Is there an extension to manage Keycloak users?
Is there an extension to manage Keycloak users? https://www.keycloak.org/

We are using CiviCRM together with drupal 7.

# Answer
> 3 votes
daveawe12323, identity and access are managed at the Drupal level and there is connection between the Drupal "user" and the CiviCRM "contact". It looks like the only Keycloak Drupal module is for Drupal 8 but there is documentation on using Keycloak as OAUTH or OpenID.

I hope this helps.

# Answer
> 0 votes
I think the idea is, to do the Keycloak-Usermanagement via a CiviCRM extension. In this case i would be also interested in a hint or an idea how to manage this.

The kc-usermanagement out of the box is not really satisfying - however kc has a good api

greets

---
Tags: extension
---


# Question
Title: Installer fails with Cannot execute CREATE TABLE civicrm_acl_cache
First, thanks to anyone who takes a look at an issue I can't get to the bottom of regarding a Civi 5.33.2 install.

The issue: When running the installer I get the following error:

> Civi\Setup\Exception\SqlException: Cannot execute CREATE TABLE `civicrm_acl_cache` ( `id` int unsigned NOT NULL

There is more to the error but I believe I am stuck on permission issue. I seem to be missing a GRANT privilege but I can't find which one I'd need.

Installing CiviCRM 5.33.2 under Drupal 7.78. I have a separate Civi MySQL 5.7 database (running under Centos 8) from my Drupal database but I use the same user to access both databases. I've created the civicrm database as follows:

`CREATE DATABASE civicrm CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`

`GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, TRIGGER, CREATE ROUTINE, ALTER ROUTINE ON civicrm.* TO 'accessuser'@'localhost' IDENTIFIED BY 'somepassword';`

I have the CREATE privilege so it's odd to be told I can't CREATE a table. Any ideas?

Thanks

# Answer
(Might not be an answer but posting as answer since this won't fit in a comment.)

See https://docs.civicrm.org/installation/en/latest/general/requirements/#mysql-permissions. You don't have REFERENCES permission.

What's the full error if you run the create table manually? It looks like this:

```
CREATE TABLE `civicrm_acl_cache` (

     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique table ID',
     `contact_id` int unsigned    COMMENT 'Foreign Key to Contact',
     `acl_id` int unsigned NOT NULL   COMMENT 'Foreign Key to ACL',
     `modified_date` timestamp NULL   COMMENT 'When was this cache entry last modified'
,
        PRIMARY KEY (`id`)

    ,     INDEX `index_contact_id`(
        contact_id
  )
  ,     INDEX `index_acl_id`(
        acl_id
  )
  ,     INDEX `index_modified_date`(
        modified_date
  )

,          CONSTRAINT FK_civicrm_acl_cache_acl_id FOREIGN KEY (`acl_id`) REFERENCES `civicrm_acl`(`id`) ON DELETE CASCADE
)  ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC  ;

```
> 1 votes

---
Tags: error, mysql, setup
---


# Question
Title: Custom field set - how to move Delete button (or prevent deletes)?
Users are 'accidentally' deleting custom field sets because (so they claim) the 'Edit' button and the 'Delete' button are too close together after clicking the custom field set tab. So is it possible to move the delete button to the right? One solution is to disable the ability to delete custom field sets but that doesn't see possible - we are using ACLs that only allow 'Edit'. Any other ideas?

# Answer
You can use a bit of CSS (either in your CMS theme or in a custom CSS file you define in **Administer menu » System Settings » Resource URLs** to move the buttons further apart.
> 3 votes

# Answer
You can remove the delete option in an extension, using the buildForm hook: https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_buildForm/ or hiding it in a jQuery script.
> 0 votes

---
Tags: custom-fields, delete
---


# Question
Title: Newbie question: Will "Pending" change to "Current" when Status Override reaches the selected date?
I have a member who has paid for a new membership and asked it to start when his current membership expires. At the moment, both read as "Current." If I use "Status Override" until a select date and change his status to pending, will that "pending" automatically change to "current" on that selected date?

Tony

# Answer
> 2 votes
Ideally you should set up your membership status rules and live by them, and not use "status override" :-) Documentation on the membership status rules can be found here: https://docs.civicrm.org/user/en/latest/membership/defining-memberships/#membership-status-rules

# Answer
> 1 votes
This is very likely to happen, but it depends on your membership status rules, as Erik notes. It sounds like you'd like to change the start date, not the status.

Remember that membership status works by finding the first status (reading from top to bottom) where the current date is between the two dates defined as the Start and End Events. You can find the rules at **Administer menu » CiviMember » Membership Status Rules**.

---
Tags: civimember, status, pending
---


# Question
Title: CiviMember permission issue on net new Wordpress install
I am working with a test installation of CiviCRM 5.33.0 on Wordpress 5.6 on a local Debian 10 install, MariaDB database. Vanilla Wordpress, no additional plugins other than CiviCRM. Configuration checklist is clear, showing no errors. I have successfully imported 4200 sanitized Contacts with no issues. Now looking at Memberships. Membership Dashboard shows a blank page with only the title, nothing else. New Member gives the "You do not have all the permissions needed for this page" error. There is exactly one user in Wordpress, my admin user login, and I have explicitly enabled the Member permissions. I have looked through similar cases listed on StackExchange and while I see things that are similar I do not see any particular "fix". Can anyone point me in the proper direction? I see there are two minor updates available for CiviCRM but I don't want to complicate things further by applying them unless so instructed.

All other enabled modules appear to be functional, it is only Memberships that is causing me grief. Any guidance would be appreciated.

# Answer
> 3 votes
It seems I had to add a Price set in Memberships before I could go further. Doh! Please excuse my ignorance and ignore the question.

---
Tags: wordpress, civimember, permissions
---


title: adding colour/color button to Ckeditor

text:
# Question
Title: adding colour/color button to Ckeditor
I'm trying to add colour/color buttons to Ckeditor on a new site. I've done it on a previous site using configuration option for the editor in Administer \>\> Display preferences, but either I have forgotten something or something has changed with an upgrade.

As described in How to restore the colour button in Ckeditor I add the Colorbutton plugin, but no buttons appear. The color group was already there but it remains empty. I can't see any options for adding or moving individual buttons (just hiding buttons or adding separators).

I've tried clearing caches, but as it doesn't show in the config screen I don't think that is relevant.

CiviCRM 5.15.1 and WordPress 5.3.1

# Answer
> 1 votes
Luke Stewart's suggestion in the comments above proved correct and its all fine in CiviCRM 5.26.2. I haven't marked his answer as correct though as the answer wasn't a solution.

# Answer
> 1 votes
If clearing your browser cache and templates\_c doesn't work. Try adding in both the Civimail and CiviEvents tabs - not just the default tab.

---
Tags: ckeditor
---


# Question
Title: Display nth payment of a recurring series?
Is there any way to display "nth Payment" of a recurring series? I am looking for a way to display with a contribution and/or line item result that this is the 3rd, 4th, 5th payment in the recurring series. I can work with either a civi report or a Drupal View.

# Answer
> 3 votes
I was able to do this with a Drupal View and adding the Views Aggregator Plus module.

I created a view using Contributions. The format was Table with Aggregation Options. I added the Filter Criteria and Fields that I wanted to display.

In the Format:Settings--

1. I "grouped and compressed" the Recurring Id field
2. "Count" the Contribution ID field (this column is labeled # of Payments)

So my view displays the Recurring Id with the # of Payments

---
Tags: civireport, drupal-views, recurring-contributions
---


title: Where is the "Do Not Email" setting?

text:
# Question
Title: Where is the "Do Not Email" setting?
We want to find the best way to not send bulk emails to a contact when they've asked to be removed from our mailing lists. I've seen many references to the "Do Not Email" box, but have not been able to find it. We are able to use the "On Hold" setting for a specific email address of the contact, but the documentation implies that that is for a different purpose (that the email address does not work). Is there a "Do Not Email" setting that we can manually select in order to have a contact excluded from any future CiviMail mailings?

# Answer
It's a bit hidden inside Communication Preferences on the contact record:
> 1 votes

---
Tags: civimail
---


# Question
Title: Clean URLs don't work after install in Backdrop
I'm intalling civicrm on backdrop cms. Setup returns that installation was succesful. I see the link in the admin bar, but when clicked, the link gives me 404 error.

If I add "?q=", links works, the page display, but any other link doesn't work.

Clean urls works fine on the site.

I'm performing a migration from Drupal 7, were civicrm was updated and functioning.

System: Backdrop 1.18.0 MySQL Database MySQL, MariaDB, or equivalent version 5.5.5-10.3.27-MariaDB-0+deb10u1 php Version: 7.3.19-1~deb10u1 (PHP information) Servidor web Apache/2.4.38 (Debian) Civicrm 5.33.1

I would appreciate any advice.

Andrés

# Answer
> 1 votes
searching in the apache2 error.log I saw:

\[Tue Jan 26 14:15:46.726049 2021\] \[negotiation:error\] \[pid 16679\] \[client 127.0.0.1:44192\] AH00687: Negotiation: discovered file(s) matching request: /home/(...)backdrop/civicrm (None could be negotiated)., referer: http://(...)backdrop/?q=civicrm&reset=1

Then I searched the web and found this post that explains that in the line

```
Options Indexes FollowSymLinks MultiViews

```

of my virtual host configuration (file /etc/apache2/sites-enabled/backdrop.conf) I should delete the word "MultiViews".

I restarted apache and civicrm links started working when I enabled Clean URLs.

Thanks,

Andrés

# Answer
> 2 votes
If Clean URLs are working in Backdrop, but not in Civi under Backdrop, then the problem is almost certainly in `civicrm.settings.php`. My Backdrop/Civi sites (and also Drupal 7/Civi sites) have this snippet of code in `civicrm.settings.php`:

```
if (!defined('CIVICRM_CLEANURL')) {
  if ( function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
    define('CIVICRM_CLEANURL', 1 );
  }
  else {
    define('CIVICRM_CLEANURL', 0);
  }
}

```

I suspect you're either missing this code, or perhaps there's something wrong with your "clean\_url" variable in Backdrop.

Try replacing that with just this and let us know if it solves the problem?

```
define('CIVICRM_CLEANURL', 1 );

```

---
Tags: backdrop
---


# Question
Title: In Drupal 8 Webform_Civicrm how do I clone a Contact?
Running Drupal and Webform\_civicrm 8.x-5.0-beta4. How do I clone a Contact?

If I create one Contact, then change the number of Contacts from 1 to 2 (or more) I get the message:

```
Tip: Consider using the clone feature to add multiple similar contacts. (more info)

```

The (more info) looks like a link, but does nothing when I click it. On D7 there is a 'Clone Contact' link on the Webform tab, but I can't find the equivalent on the D8 Build tab, or elsewhere.

# Answer
Unfortunately there is no such clone feature yet. We've had to park it for now as other outstanding bugs: re: existing contact element, and re: static/live options take precedence.

So I've just removed the Tip (for now) and have added a ToDo statement: https://github.com/colemanw/webform\_civicrm/pull/449
> 1 votes

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


# Question
Title: Importing Contribution should update Membership period
I'm trying to do an "Import Contribution", Member Dues, but the membership period in not extended by the expected year. How can I manage that automatically? Should be possible! I have probably not found the correct method. This is our first steps to do Imports. Claes

# Answer
> 2 votes
There are two issues that you have to deal with when importing membership payments in order to extend your memberships:

1. You should connect the contribution (mebership payment) with the correct membership after the import. Technically you don't have to but it makes a lot of sense in order to keep a good overview.
2. You need to extend the membership (set a new membership end date)

The bad news is that afaik there is no user interface in CiviCRM-Core that allows you to connect existing payments with memberships. CiviCRM only offers to extend a membership and create a corresponding payment at the same time, but that does not work if you already have imported the payments.

There are also scheduled jobs that can change your membership status but that will probably not solve your problem either (a lot of information on renewal concepts can be found in CiviCRM's documentation).

The good news is that there are some extensions that can facilitate both connecting payments and memberships as well as extending your membership (e.g. by extending it's end date), for example this one: https://github.com/Project60/org.project60.membership

It can do much more than only connecting memberships and contributions via the UI so make sure that it's not an overkill for your purposes ;)

Unfortunately, there is no coherent documentation so for some features you may want to contact the maintainer (Björn from SYSTOPIA) for info and/or add to the documentation once you know your way around the extension.

If you only want to connect payments & meberships, https://github.com/CiviCooP/org.civicoop.membershippayment may do the trick.

# Answer
> 1 votes
I need to do the same thing and could not find a built in solution. There is a batch membership entry, but that is for manual entry from the interface. The code might be useful to write a process to import an externally created batch, but that is beyond me.

What I do is import the contributions from a file (derived from a bank transaction listing with a lookup from the memo field to find the contact to match it to). I give the contributions a clearly identifiable source (bank-year-month). I then do an advanced search for memberships with a contribution with this source and do a bulk update with a profile set up to edit the end date. I need to do this in two stages as some are annual and some are monthly memberships.

Hope that helps

---
Tags: contributions, import, upgrade
---


title: Time estimate for setting up CiviCRM?

text:
# Question
Title: Time estimate for setting up CiviCRM?
I volunteer with a small non-profit and we recently decided to create a new CRM using CiviCRM. I am a complete novice with this and am learning it all from scratch - really appreciating the community and all the help on offer.

As we are planning out the work I am struggling to come up with a rough estimate for how long it will take and was hoping someone could advise. I realise this is a bit 'how long is a piece of string' but it would be good to hear from peoples' experiences how long similar-ish projects can take, either in hours or days for different stages.

We currently have around 300 members and we are planning to start off with a fairly simple CRM focussing on membership management. The key features/aims are:

* Integrated with our Wordpress website (currently using shared hosting but may move to cloud).
* Securely hold very basic member data; provisionally names, email, region, membership subscription amount, and have some basic tags.
* Contact groups, with some groups having access to specific pages on our website (e.g. 'members' have more access than 'supporters').
* Automated updating of the database when members join, leave etc.
* Connected with a payment processor.
* Automated emails following certain triggers e.g. lapsed payments.
* Ability to set up events, invite different contact groups, and record attendees.
* Email and event templates.

If I have said anything that doesn't make sense please let me know! Here to learn.

Many thanks, Nick Sharma

# Answer
Nicky welcome to CiviCRM SE. Your requirement seems to be very simple and straight forward and can achieved using CiviCRM without any writing any custom code(Can say less than a day for someone who is well versed with CiviCRM or a week or more for a newbie).

You can contact experts based on your country you living or the organization is setup for cost. Or if you want to do it by your self there are ample of tutorials available online which I believe is sufficient for your requirement.

https://docs.civicrm.org/

https://civicrm.org/videos

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

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

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

Good resource for learning civicrm and drupal

CiviCRM training courses for beginners
> 3 votes

---
Tags: installation
---


# Question
Title: My mail_report: Finished execution of Mail Reports with result: Failure, Error message: is not of type String
I'm running civiCRM 5.30.0 on Drupal 7.

I've designed a report to be sent weekly. To test it, I manually ran mail\_report and got the detail below. Where is type STRING required?

---

Parameters raw (from db settings): instanceId=\[ID of report instance\] required format=\[csv or print\] optional-output CSV or print-friendly HTML, else PDF

Parameters parsed (and passed to API method): a:3:{s:7:"version";i:3;s:10:"instanceId";s:32:"\[ID of report instance\] required";s:6:"format";s:67:"\[csv or print\] optional-output CSV or print-friendly HTML, else PDF";}

Full message: Finished execution of Mail Reports with result: Failure, Error message: is not of type String

---

# Answer
> 1 votes
If you run it manually from the scheduled jobs screen you need to edit the mail report entry there and set those parameters. Normally you would set them in the specific command you use for cron for a specific report.

See https://docs.civicrm.org/user/en/latest/initial-set-up/scheduled-jobs/#job\_mail\_report. For getting the instance id that's a good point. There's a couple ways but one is to go to Reports -\> All Reports and then hover over the View Results link and in the url that appears in the browser status bar it's the number after the word "instance", e.g. if it says `civicrm/report/instance/5?force=1&reset=1` then the id is 5.

---
Tags: civireport, error, scheduling
---


title: Descrepancies in search result counts

text:
# Question
Title: Descrepancies in search result counts
I'm migrating to a new Drupal 9 install, and after a decade of using CiviCRM, I want to pare down the number of records. If I do a simple find contacts search with no criteria, I get 74144 results. I've also searched for everyone who has given us contributions as well as everyone who opted in to our email list and put them in a separate group. This group, "2021\_keep" has 6046 contacts. Next I go to Search Builder and put in the query `Group(s) Not In 2021_keep ...AND... Group Status 'Added'` Actually, just the first part is my query, the second part gets added after I click to search. Result is 71858 contacts. I would expect the result to be 74144 - 6046 = 68098 contacts. This is kind of important, as I want to delete all of these contacts, who are people that at some point signed a petition we hosted but didn't sign up for the email list, or later opted out of it, etc.

# Answer
When you search for `Group(s) Not In 2021_keep`, Search Builder may be interpreting it as "contacts who are in some group that's not 2021\_keep". That's not what you want.

Here are ~~two~~ three options for finding all the contacts who are not in the group "2021\_keep".

### Include/Exclude Search

Go to Search \> Custom Searches and click on Include/Exclude Search. Set "2021\_keep" as the value for "Exclude Group(s)". Click on either one of the radio buttons next to "AND/OR" (it doesn't matter which you choose, since you're not using tags in your search.)

You should be able to delete contacts directly from the search results, or perform various other actions on them.

### API v4

If for some reason the Include/Exclude search doesn't satisfy, and you are on a recent version of Civi, you can do your search using API4. You should have access to the API explorer at the url `civicrm/api4`.

Configure your search as follows:

Entity: Contact
Action: get
Select: id
Join: GroupContact
On: group\_contact.contact\_id = id
On: group\_contact.group\_id =
On: group\_contact.status = "Added" (note the quotes)
Where: group\_contact.id IS NULL

You can pre-fill these values by deleting everything in your URL bar to the right of the word "explorer", and replacing it with:
`/Contact/get?join=[["GroupContact AS group_contact",false,null,["group_contact.contact_id","%3D","id"],["group_contact.group_id","%3D","1"],["group_contact.status","%3D","\"Added\""]]]&where=[["group_contact.id","IS NULL"]]&select=["id"]&debug=0&checkPermissions=0`

Remember to change the Group ID to the id of your "2021\_keep" group. When you're finished you can use the "Save" button at the top to save the results as a Smart Group.

### Group subtraction (remove from group)

1. Use the basic "Find Contacts" search with empty search criteria to find all your contacts.
2. Above the result table, click "All 74144 records", then select the "Group - add contacts" action. On the following screen, create a new group called "NOT in 2021\_keep" and click "Add to Group".
3. Do another "Find Contacts" search. This time, set the groups field to "2021\_keep".
4. Above the result table, click "All 6046 records", then select the "Group - remove contacts" action. On the following screen, select the "NOT in 2021\_keep" group you just created. Click "Remove From Group".

Now your "NOT in 2021\_keep" group should have 74144 - 6046 = 68098 contacts in it.
> 4 votes

---
Tags: contacts, search-builder, advanced-search
---


# Question
Title: Getting a two-column dashboard in CiviCRM 5.33+
After the recent rewrite of the CiviCRM dashboard, many of the sites I work with have only a single column where previously they had two columns. How does one restore the two-column behavior?

# Answer
> 3 votes
It autoadjusts to screensize. I suppose you could overwrite the specified widths for css:

https://github.com/civicrm/civicrm-core/pull/19235/files

---
Tags: dashboard, dashlet
---


# Question
Title: Membership duration depending on conditions?
Is it possible to configure memberships in CiviCRM as follows?

The basic subscription duration is 6 months **AND** it gives members the possibility to attend 10 lessons/events. After having "used" the included lessons **OR** after 6 months the subscription expires and has to be renewed.

I could easily configure the membership expiration after 6 months.

As I'm completely new to CiviCRM: Where can I define the/a second condition (expiration after 10 lessons/events)?

Thanks in advance for your help!

Regards

# Answer
Set up the membership normally with a duration of i.e. 6 month/1 year.
Use the extension Summary Fields to report back the number of events visited per user.
Implement the Rule (on participant status change \>\>\> attended) in CiviRules and change membership/subscription status to "expired".
> 1 votes

---
Tags: civimember
---


# Question
Title: How do I get PCPs to look 'right' when shared on Facebook?
We are using Wordpress 4.2.2 & CiviCRM 4.6.1. We have a couple of fundraising events in which participants have the option of creating a Personal Fundraising Page.

When participants share their PCP URL on Facebook the link preview doesn't share any info from their PCP—Page Title, Description or Photo—and doesn't link to their page, it links to the Base page that has been set for CiviCRM in Wordpress.

Is there a way to add Open Graph tags to each PCP? I did see that Mathieu created a Drupal module that adds Open Graph tags on PCP pages for Facebook a few years back: https://github.com/mlutfy/civicrmogp. Does anyone had any ideas for Wordpress?

I do know that there are plugins for Wordpress that allow you to add Open Graph Meta tag info to your website. These allow you to set that info for individual Pages or Posts, however the PCPs are generated dynamically through CiviCRM using the base Wordpress page that I configured, so setting Open Graph info on that page would cause all the PCPs to share the same info on FB—unless I don't know what I talking about (which is totally possible).

Here are some screenshots to help show what I am talking about:

# Answer
As you've discovered, this is not something that the WordPress plugin does by default. You can, however, hook into the 'civicrm\_basepage\_parsed' action that is fired when (ahem) the basepage has been parsed and roll your own Open Graph tags to be included in the markup via 'wp\_head'. The content of the basepage is available via the 'basepage\_render()' method of class 'CiviCRM\_For\_WordPress\_Basepage', which can be externally accessed with the following code:

`$content = civi_wp()->basepage->basepage_render();`

Admittedly, this won't tell you what kind of Civi content is being included in the basepage, but the technique above will allow you to produce something more sensible than what you currently have.
> 3 votes

# Answer
There is a CiviCRM native extension available also: https://civicrm.org/extensions/ogp

I have not tested PCP pages recently, but I've been working on improving various aspects of the extension and will be happy to fix if there are PCP-specific issues.
> 1 votes

# Answer
PCP shortcodes are now available for both the info and transaction pages.

https://lab.civicrm.org/dev/wordpress/-/issues/63
> 1 votes

---
Tags: civicontribute, pcp, personal-campaign-pages, facebook, social-media
---


# Question
Title: Royal Television Society payment problem
I am trying to register for the RTS Virtual Careers Fair 2021, but no matter what card I try, I keep getting a denial message. Can you please help? I am accessing the payment from this page, empowered by you https://rts.org.uk/civicrm/event/register?id=446&reset=1

Thanks.

Kind regards, Gergana Georgieva

# Answer
We are the support providers for the Royal Television Society, we'll take a look and come back to you.
> 1 votes

---
Tags: payment-processor
---


# Question
Title: Add custom field with multiple values to Contact Form 7 and Form Processor
I can't seem to make a custom field that allows multiple values work if more than one value is selected in Contact Form 7 via Form Processor. If one value is selected, everything works fine. If more than one value is selected, Form Processor fails and no contact is created.

This error is logged: Notice: Undefined index: title in Civi\FormProcessor\Type\OptionGroupType-\>getConfigurationSpecification() (line 40 of /var/www/html/sites/default/civicrm/extensions/form-processor/Civi/FormProcessor/Type/OptionGroupType.php).

Here is my contact form (it uses checkboxes). In Form Processor, I have a Custom Options input, with multiple selected and I have the same options set up there.

If I use Try out in Form Processor, it works fine, so I wonder if Form Processor is expecting the data in a different form than Contact Form 7 is sending it in.

# Answer
Potentially you could also develop a new type of input in the Form Processor that deals with the comma separated list.
> 0 votes

---
Tags: custom-fields, form-processor
---


# Question
Title: Drupal 8 version of CiviVRM Membership Roles Sync?
Is there a Drupal 8 version of the CiviCRM Membership Roles Sync module, or is one planned? I can't see it, or any opportunity to configure an equivalent facility.

# Answer
> 1 votes
There is a alpha version for d8(https://www.drupal.org/project/civicrm\_member\_roles) which seems to be working for me.

---
Tags: drupal-8, roles, sync
---


title: Is A/B testing possible using Mosaico?

text:
# Question
Title: Is A/B testing possible using Mosaico?
When I go through the Create new A/B test workflow, it presents me with a traditional mailing interface, even though I have Mosaico installed.

I'm pretty sure that means A/B testing is not possible with Mosaico but wanted to check for confirmation.

# Answer
A/B testing for subjects is now possible (though not content or from details), as of Mosaico CiviCRM 2.6.
> 5 votes

# Answer
According to a 2017 blog post: no, it's not implemented yet.

I think it should probably be opened as an issue on github.
> 1 votes

---
Tags: civimail, mosaico, abtesting
---


title: Request login on edit mode profile form

text:
# Question
Title: Request login on edit mode profile form
I'm using CiviCRM 4.7.31 on WordPress with the Members plugin. I created a new profile, then embedded that form in edit mode within a WordPress page:

```
[civicrm component="profile" gid="35" mode="edit" hijack="0"]

```

As expected, the WordPress page generates an error if a user is not logged in:

> "No user/contact ID was specified, so the Profile cannot be used in edit mode."

This error persists even when I set the page's Content Permissions to limit access to users in selected roles.

The error disappears when I wrap the civicrm shortcode within the members\_logged\_in shortcode:

```
[members_logged_in]
[civicrm component="profile" gid="35" mode="edit" hijack="0"]
[/members_logged_in]

```

But then the profile form loses its formatting; it seems like some Javascript/CSS is not loaded on the page when the shortcode is nested.

Is there a way to make this work correctly? Do I need to switch to Caldera Forms with the Caldera Forms CiviCRM plugin?

Thanks for your help.

# Answer
> 2 votes
The solution was to make sure the Civi scripts loaded on the page. This answer provides guidance on how to do that.

# Answer
> 0 votes
Did you find a solution? This is still happening with: Wordpress version: 5.6 CiviCRM version: 5.32.2

I'm having a consulting team investigate, I'll report back if they find a solution.

UPDATE: I found a VERY hacky workaround. I added this block to civicrm.shortcodes.php inside "prerender" function:

```
          // default regex FAILED. Support nested shortcodes with custom regex.
      if (empty($shortcodes_array)) {
        preg_match_all('/\[civicrm component="(contribution|event|profile|user-dashboard|petition)"( action="[a-z]+"| mode="[a-z]+")?( id="[0-9]")?( gid="[0-9]")?\]/', $post->post_content, $located);
        if (!empty($located) && !empty($located[0])) {
          $shortcodes_array = $located[0];
        }
      }

```

Here is the entire function with my custom block included:

```
  public function prerender( $wp ) {

/*
 * At this point, all conditional tags are available
 * @see http://codex.wordpress.org/Conditional_Tags
 */

// Bail if this is a 404
if ( is_404() ) return;

// A counter's useful
$shortcodes_present = 0;

/*
 * Let's loop through the results
 * This also has the effect of bypassing the logic in
 * https://github.com/civicrm/civicrm-wordpress/pull/36
 */
if ( have_posts() ) {
  while ( have_posts() ) : the_post();

    global $post;

    // Check for existence of shortcode in content
    if ( has_shortcode( $post->post_content, 'civicrm' ) ) {

      // Get CiviCRM shortcodes in this post
      $shortcodes_array = $this->get_for_post( $post->post_content );

      // default regex FAILED. Support nested shortcodes with custom regex.
      if (empty($shortcodes_array)) {
        preg_match_all('/\[civicrm component="(contribution|event|profile|user-dashboard|petition)"( action="[a-z]+"| mode="[a-z]+")?( id="[0-9]")?( gid="[0-9]")?\]/', $post->post_content, $located);
        if (!empty($located) && !empty($located[0])) {
          $shortcodes_array = $located[0];
        }
      }

      // Sanity check
      if ( !empty( $shortcodes_array ) ) {

        // Add it to our property
        $this->shortcodes[$post->ID] = $shortcodes_array;

        // Bump shortcode counter
        $shortcodes_present += count( $this->shortcodes[$post->ID] );

      }

    }

  endwhile;
}

// Reset loop
rewind_posts();

// Did we get any?
if ( $shortcodes_present ) {

  // We need CiviCRM initialised prior to parsing shortcodes
  if (!$this->civi->initialize()) {
    return;
  }

  // How should we handle multiple shortcodes?
  if ( $shortcodes_present > 1 ) {

    // Add CSS resources for front end
    add_action( 'wp_enqueue_scripts', array( $this->civi, 'front_end_css_load' ), 100 );

    // Let's add dummy markup
    foreach( $this->shortcodes AS $post_id => $shortcode_array ) {

      // Set flag if there are multple shortcodes in this post
      $multiple = ( count( $shortcode_array ) > 1 ) ? 1 : 0;

      foreach( $shortcode_array AS $shortcode ) {

        // Mimic invoke in multiple shortcode context
        $this->shortcode_markup[$post_id][] = $this->render_multiple( $post_id, $shortcode, $multiple );

      }

    }

  } else {

    // Add core resources for front end
    add_action( 'wp', array( $this->civi, 'front_end_page_load' ), 100 );

    /*
     * Since we have only one shortcode, run the_loop again
     * the DB query has already been done, so this has no significant impact
     */
    if ( have_posts() ) {
      while ( have_posts() ) : the_post();

        global $post;

        // Is this the post?
        if ( ! array_key_exists( $post->ID, $this->shortcodes ) ) {
          continue;
        }

        // The shortcode must be the first item in the shortcodes array
        $shortcode = $this->shortcodes[$post->ID][0];

        // Check to see if a shortcode component has been repeated?
        $atts = $this->get_atts( $shortcode );

        // Test for hijacking
        if ( isset( $atts['hijack'] ) AND $atts['hijack'] == '1' ) {
          add_filter( 'civicrm_context', array( $this, 'get_context' ) );
        }

        // Store corresponding markup
        $this->shortcode_markup[$post->ID][] = do_shortcode( $shortcode );

        // Test for hijacking
        if ( isset( $atts['hijack'] ) AND $atts['hijack'] == '1' ) {

          // Ditch the filter
          remove_filter( 'civicrm_context', array( $this, 'get_context' ) );

          // Set title
          global $civicrm_wp_title;
          $post->post_title = $civicrm_wp_title;

          // Override page title
          add_filter( 'single_post_title', array( $this->civi, 'single_page_title' ), 50, 2 );

          // Overwrite content
          add_filter( 'the_content', array( $this, 'get_content' ) );

        }

      endwhile;
    }

    // Reset loop
    rewind_posts();

  }

}

// Flag that we have parsed shortcodes
$this->shortcodes_parsed = TRUE;

/**
 * Broadcast that shortcodes have been parsed.
 *
 * @since 4.6
 */
do_action( 'civicrm_shortcodes_parsed' );

```

}

Please reply if there's a better way to do this!

---
Tags: wordpress, profile
---


title: Delete Change Log for 1 contact

text:
# Question
Title: Delete Change Log for 1 contact
We are trying to delete the change log for 1 user. We want to complete remove their address and information on our system. There a way to delete the change log for 1 contact in CiviCRM?

# Answer
> 3 votes
It depends on what you are trying to do. If you want the complete removal of the contact, together with related entities (like address, activities, event participations etc.), then permanently deleting the contact will delete all the associated entities.

If you just want to remove the change log for that 1 contact without deleting the contact, you can run a simple SQL query to delete it. For a contact with the contact id 57 you would run this:

```
DELETE FROM `civicrm_log` WHERE entity_table LIKE 'civicrm_contact' and entity_id = 57

```

Beware, if you used something like Drupal webforms, then the data can still be there in the webform submissions, even though you deleted it form CiviCRM.

---
Tags: contacts, logging, civicontact
---


title: Importing Contacts from Access

text:
# Question
Title: Importing Contacts from Access
I understand I need to convert a table into a csv file, but the contact table in question has both an individual and their spouse in the same record. Now I can build a query that would only show me the individual's information, but once I import that information into civicrm how would I then import a list of spouses and get them to setup relationships, or will I just have to manually enter those in after importing the primary contact information?

# Answer
It is a bit complicated. You will need to do at least 2 different imports, with external IDs. The CSVs for imports would look at this

1st import

```
first_name, last_name, extID
Jane, Doe, 1

```

2nd import

```
first_name, last_name, extID, Spouse-extID
John, Doe, 2, 1

```

Take a look at CiviCRM 5.29.0 - import relationships
> 2 votes

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


# Question
Title: Two civicrm contacts have become "mixed" somehow
I have a very odd situation.

I am user 1 in drupal and contact 25,000 in my civicrm. My contact record has a little /1 which links to my drupal record. My name is correct.

I am currently logged in.

However whenever I make changes to another contact record, if records the change as having been made by another contact in the civicrm database, let's say 25,001. This contact does not have a /x and there is no drupal record for this person. However when I try to delete this record it says I am logged in as that person so I can't delete them.

I am wondering if there is a table in the mysql of civicrm which matches the civi and drupal contacts up. Or indeed if there is some other thing I could look at to start trouble shooting.

Thought very welcome!

# Answer
There is a table civicrm\_uf\_match but also during certain situations it will match on email. So check both those things.
> 2 votes

---
Tags: contacts, user-account, user
---


# Question
Title: Invalid Currency error when using custom template
I'm creating a custom thank you following the instructions here

https://docs.civicrm.org/user/en/latest/contributions/manual-receipts-and-thank-yous/

However the {contribution.total\_amount} token is causing an error saying

> Invalid currency "USD\****~~~~USD\****~~~~USD\****~~~~USD\****~~~~USD"

All of my contributions are in dollars and that's what I've also set in localization.

What could be causing this?

This only happens when using the grouping option. I'm wondering if it relates to https://github.com/civicrm/civicrm-core/blob/3bfdcfb534a0b27a4f7f4c65bb07f2670ac31d14/CRM/Contribute/Form/Task/PDFLetterCommon.php#L74

CiviCRM 5.32.2
Joomla 3.9.23

# Answer
This was a regression and was fixed. https://lab.civicrm.org/dev/core/-/issues/2344
> 2 votes

---
Tags: message-templates, currency
---


# Question
Title: When are scheduled reminders for late registrants to events sent or not sent?
After a small mess over the weekend with an online event login information not being sent, I'm trying to figure out when scheduled reminders are or are not sent for people who register for an event after the reminder was scheduled to send. If I can get some kind of idea what the behaviour is supposed to be, I will test and add this to the documentation.

So, case A: A contact registers after an event scheduled reminder was sent, but before the event starts. Do they receive the reminder? Does it matter how the reminder was set (at a specific date time versus X hours or days before the event starts)?

Case B: A contact registers after an event scheduled reminder was sent, but while the event is happening. Do they receive the reminder? Does it matter how the event was set up, as above?

Case C: A contact is registered for the event after the event ends. Do they receive the past scheduled reminder? Does it matter how the event was set up, as above?

Opinions on what should or does happen seem to be mixed. See other questions here, here, and here. Is there actually a 24 hour test that will send scheduled reminders from 24 hours before the registration but not before? Are there additional rules?

# Answer
> 1 votes
Good question with several permutations! Here's a partial answer from experience.

> Case A: A contact registers after an event scheduled reminder was sent, but before the event starts.

It is sent. The timing will be whenever your Send Scheduled Reminders scheduled job runs. It occurs when you set x time before and based on this answer specific time it will not.

> Case B: A contact registers after an event scheduled reminder was sent, but while the event is happening.

It is sent.

> Case C: A contact is registered for the event after the event ends.

Not sent.

I've not seen a 24 hour test.

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


# Question
Title: Warning: Disabled/Deleted fields on Smart Groups
After upgrading to CiviCRM 5.27 (and now, to 5.28) on Drupal 7, I see this warning message.

As you can see, GROUP is listed as "-" (minus).

When I try to click on settings (Gear icon), it shows me Group Settings empty fields:

When I click on *Contacts in this Group* (in Group Settings), it shows me all contacts in my CiviCRM database along with some notice warning (a lot of lines exactly like these - Undefined property and Undefined Index):

#

#

# UPDATE

(January, 2021) The problem is still there after update to 5.33.2. What can I do about that?

# Answer
> 1 votes
To clear them click the left of the 2 small icons, then click the smart group criteria to go into search, hit the search button and create the smart group & then delete the smart group. Then it should disappear the warning message

# Answer
> 0 votes
I believe this query will help identify those orphaned saved searches that no longer have a group

```
select * from civicrm_saved_search where id not in (select saved_search_id from civicrm_group where saved_search_id is not null)

```

---
Tags: error, groups, errorhandling
---


# Question
Title: Custom fields sometimes missing from profile, until flushing caches
On civicrm 5.20.1 under WordPress, we have added two custom fields to the Registration Info profile (gid=12). We've added that profile to the Online Registration config for one event.

Now and then, for reasons unknown, those fields will stop displaying: on the online registration form, and in the profile preview. Flushing caches (with `cv flush` or with the "Cleanup Caches" button at `q=civicrm%2Fadmin%2Fsetting%2FupdateConfigBackend&reset=1`) causes them to reappear.

Then sometime later, they disappear again, until caches are again flushed.

I've verified that neither the profile fields nor the custom fields are being disabled, nor are there any changes in user permissions, ACLs, profile config, custom field config, etc. The only corrective measure is to clear caches.

Is this a known issue in any 5.x version of civicrm? Naturally we're working toward an upgrade to the latest security release, but it would be nice to have some reason to believe that such upgrade might also address this mysterious issue; or to have any other way to address it besides periodically flushing caches.

# Answer
The only way we could solve this was turning off php opcache in fpm/apache/nginx and cli

For other sites with opcache turned off we had to enable schedule job 'Clean-up Temporary Data and Files' with parameters

dbCache=1

tplCache=1

Incase you have memcache enabled then memCache=1
> 2 votes

# Answer
I had this experience with a Drupal 8 site and fixed it by enabling the permission "access custom fields" for anonymous visitors.

In our case, the issue was that anonymous visitors couldn't access the custom fields, so if the cache was cleared, it would get populated via the anonymous access rules and that same cache was used for everyone.

Clearly there was also an underlying caching problem going on.
> 2 votes

# Answer
I've also encountered this issue. In a profile, some of the custom fields are displayed, but some are not, all within the same single profile.

civi 5.33.2 Joomla: 3.9.24

Clearing civi cache files resolves the issue for a little while, and then issue returns. Digging into user permissions, we found that some Joomla user groups had permission to "CiviCRM: profile create" and others did not. We changed this so all relevant user groups (including public & registered) had this permission, and when we refreshed the page with the profile and missing fields, the fields then reappeared.

I'm still monitoring this to see if in fact our permissions change has any permanent affect.
> 1 votes

---
Tags: custom-fields, profile, cache
---


title: Images in templates on civicrm spark

text:
# Question
Title: Images in templates on civicrm spark
I am on civicrm spark running 5.32.beta1 and I cannot get images to work on templates with PDF document merge.

Since it's spark I have little control over the backend installation. As far as I can tell I can't use local image hosting located at "https://mysite.civicrm.org/sites/mysite.civicrm.org/files/civicrm/persist/contribute" so I have tried hosting the images on our main organization webhost and using the url in an image tag. This appears to work fine for emails but will not generate in the pdf output.

I found this help relevant: https://forum.civicrm.org/index.php%3Ftopic=22663.0.html but since I'm on spark I don't believe I have any control over the civicrm version or the "allow\_url\_fopen" field. Can I only use any images already hosted on civicrm.org then? Is there something I'm missing?

# Answer
> 1 votes
I was able to add a custom field to contacts and upload a signature file to relevant users and then use that generated url. This work around isn't ideal as it means tying the image to a custom field that may not be relevant and a relative location hex link that looks roughly like this:

mysite.civicrm.org/civicrm/file?reset=1&id=2&eid=28&fcs=54ef7e8c1d8fc5b70133338bb1872353e

but we do what works. I would appreciate a better solution if anyone has one.

---
Tags: pdf, civicrm-spark
---


# Question
Title: Error "CiviCRM must be installed via composer" in Drupal8
Drupal 8.6.3, CiviCRM 5.7.0, PHP 7.2.10. Followed the instructions in https://github.com/civicrm/civicrm-drupal-8/blob/master/README.md (skipped "load dummy data" and -b'd "master" instead of the missing 8.x-master). The error comes up after the final instruction, "install CiviCRM Core." I now have composer.phar and seems to be ready to go, but what are the appropriate command line args & working directory given where I'm at? I'd prefer not to have to scratch everything to follow the directions here or here!

# Answer
This error comes when the civicrm folder is not present in the vendor directory.

Make sure you install civicrm with composer

```
• composer config extra.enable-patching true
• composer require civicrm/civicrm-asset-plugin:'~1.1'
• composer require civicrm/civicrm-{core,packages,drupal-8}:'5.31.0'

```

And add l10n if needed.
> 0 votes

# Answer
I asked on Friday in chat.civicrm.org and it sounded like the current state is still like those other instructions you've linked. I wasn't able to get it working with the automated vagrant setup and haven't got around yet to trying those manual instructions with the latest code, but maybe someone else can confirm sooner.
> 1 votes

# Answer
In the end I found that:

```
 composer require civicrm/civicrm-core

```

seemed to work for me :)

I found it via:

```
:~/buildkit/build/ptest/sites/default$ composer require civicrm

No composer.json in current directory, do you want to use the one at /home/xxx/buildkit/build/test? [Y,n]? y

  [InvalidArgumentException]
  Could not find package civicrm.

  Did you mean one of these?
      civicrm/cv
      civicrm/civix
      drupal/civimail
      drupal/civicrm_cron
      civicrm/civicrm-core

```

and saw the civicrm/civicrm-core in the suggestions...

the site broke after it had installed - but this does seem like the right command.
> 1 votes

---
Tags: drupal-8
---


title: search database to identify addresess

text:
# Question
Title: search database to identify addresess
we have about 1400 people in our database. All have email addresses and some have physical addresses. How can I sort/search so I can produce a list of those who have physical addresses? Once we have this list, is there a way to export that list to create mailing labels? Thanks in advance!

# Answer
> 3 votes
Welcome to this stack community. There are multiple ways you could get what you want. I would use the Search Builder functionality. You can find it in the main menu Search-\> Search Builder.

You can search the contacts where the address fields (such as city, street adress, or other address fields) are not empty.

You can then select actions (what to do with the list). You can export it and deal with it externally or you can select Mailing Labels - print to directly create mailing labels. You would probably want to configure Label format before doing so. You can do that by going to the Administer-\>Communication-\>Label Formats in the main menu.

---
Tags: custom-search
---


# Question
Title: Activity Duration in Hours extension NOT working for CiviCase
Currently using CiviCRM Version 5.31 (Wordpress Version 5.5.3)

Installed the extension to change Activities Duration from Minutes to Hours

https://lab.civicrm.org/extensions/activityhours

The extension works for Contact Activities but not Case Activities.

Does anyone know what needs to be done to make the changes in Case Activities ?

===========================================================================

Hi Demerit, thank you for the prompt response.

I changed the lines in both activityhours.php and activityhours.js but the duration for case activities are still in 'minutes'.

Please advise

# Answer
You could try changing this line in activityhours.php from:

`if ($formName == 'CRM_Activity_Form_Activity' && !CRM_Utils_Request::retrieveValue('snippet', 'String')) {`

to

`if (($formName == 'CRM_Activity_Form_Activity' || $formName == 'CRM_Case_Form_Activity') && !CRM_Utils_Request::retrieveValue('snippet', 'String')) {`

You'd probably also have to add some selectors in the .js file, e.g. whereever it says `.crm-activity-form-block-duration` also add `.crm-case-activity-form-block-duration`

You could post a feature request at https://lab.civicrm.org/extensions/activityhours/-/issues, but if you're able to also post a merge request with some tested code changes that would be best.
> 1 votes

---
Tags: extension, civicase, activities
---


# Question
Title: What replaced the "access CiviCRM" permissions?
There used to be a CiviCRM permission in the CMS for "access CiviCRM" - and most of the resources mention this. But its gone now (CiviCRM v 5.33, Drupal 7.78) and I need to give some users contact, event, activity, contribution creation & edit permissions but not "administer CiviCRM" permission.

The result is that the CMS role "CiviCRM user" (different from "CiviCRM Administrator") cannot access CiviCRM unless I give full CiviCRM administration privileges.

What is the current best practice for giving this set of permissions?

# Answer
Internally it's still "access CiviCRM". The label changed to "access CiviCRM backend and API".

https://github.com/civicrm/civicrm-core/commit/d9a37cbcc18a593635360ce05f236dcd9ec7d93e#diff-410497db8c86f6ba1a897c533db8f391a25d2cee7b12852bb743b2dbed82d86aR764
> 3 votes

---
Tags: permissions, administer
---


# Question
Title: Call to undefined function user_load() using Drupal 9 and api3?
Full error message:

```
Error: Call to undefined function user_load() in CRM_Utils_System_DrupalBase->getUserObject() (line 558 of /var/www/drupal/vendor/civicrm/civicrm-core/CRM/Utils/System/DrupalBase.php)

```

I get this when using an api3 call like this:

```
$result = civicrm_api3('User', 'get', [
  'sequential' => 1,
  'id' => 1,
]);

```

# Answer
> 3 votes
The function user\_load is deprecated in D9.

https://api.drupal.org/api/drupal/core%21modules%21user%21user.module/function/user\_load/8.7.x

Looks like we need a replacement stub function in the drupal module. For a quick hack, you could append this to /var/www/drupal/web/modules/contrib/civicrm/civicrm.module (or wherever it lives on your server).

A better method might be to create a new D9 file of functions that gets loaded selectively only for D9.

```
/* for when user_load gets deprecated */

if (!function_exists('user_load')) {

function user_load($uid, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()
      ->getStorage('user')
      ->resetCache([
      $uid,
    ]);
  }
  return \Drupal\user\Entity\User::load($uid);
}

}

```

---
Tags: api, drupal-8
---


# Question
Title: setting membership status override in bulk update
I've made some changes to our membership structure and will be creating new memberships for a significant number of contacts. I'd like to keep the old memberships for completeness and have created a new status of "Transferred" to distinguish them from normally Expired or Cancelled. I can set the status with a bulk update on the records, but I can't see a way to set the Status override field in the bulk update (it doesn't appear as an option in profiles) and I am worried that the automatic membership status check will change them to Expired.

Using CiviCRM 5.26.2

# Answer
> 1 votes
You could do that with the API:

```
$result = civicrm_api3('Membership', 'get', [
  'sequential' => 1,
  'status_id' => "Transferred",
  'options' => ['limit' => 0],
  'api.Membership.create' => ['id' => "\$id", 'is_override' => 1],
]);

```

(Find all memberships with status 'Transferred' and set override)

Or in Explorer:

If you can adjust your membership status rules to avoid using status override, that would be preferable but in this case your Transferred status only applies to some membership types.

---
Tags: civimember, profile
---


# Question
Title: API csv Import GUI with Formprocessor fails with smarty errors
I created a rather complicated form processor which works (through api), but when I tried to clone it (rename it to create so csv api picks it up) and tried to do the csv import.

I get the following error for each row (in the download errors)

```
Error with entity "create"! (Action Donor info failed. Caused by PHP Error 256 at /var/www/mysite/sites/all/modules/civicrm/packages/Smarty/Smarty.class.php:1100: Smarty error: [in evaluated template line 1]: syntax error: unrecognized tag 'n' (Smarty_Compiler.class.php, line 585))

```

When I tried it with the same data using just formprocessor API it works, but through CSV API Import GUI it doesn't.

How would I go around debugging this. Or should I even bother? I mean it might be easier script API calls. I always thought CSV API and Form processor would be a powerful combo.

# Answer
CSV Import and Form Processor IS a powerful combo! Check out the advimportformprocessor extension.

Note that this combines the "advimport" extension rather than the CSV API GUI extension with Form Processor. It's overall better, but some work on advimport's rough edges would improve the UX.

Also note that Form Processor is pretty slow, so imports using this technique should account for that.
> 1 votes

---
Tags: api, import, csv, form-processor
---


# Question
Title: Trying to get New Member, Member Renewal Contribution working
CiviCRM 5.33.2, Drupal 7.78. Using example tokens found in the CiviCRM docs at "Tokens and mail merge/Checksum for Contribution Pages for Membership Renewals" to create an email to go out, I am struggling to claim a victory. The example I am using looks something like this in my email template...

https://oursite.org/civicrm/contribute/transact?reset=1&id=5&{contact.checksum}&cid={contact.contact\_id}&mid={membership.id}

...but the membership.id does not get picked up when the mail goes out. The contact.contact\_id seems to grab the correct information, but the url ends with "&mid=" with no value filled in.

Help please!

# Answer
My guess is that you're sending emails out using CiviMail or the "send mail to contacts" search action. This won't pick up the membership ID, because a contact can have multiple memberships and there's no way to know which to use.

I believe at present the only way (in CiviCRM core) to use the membership ID token is when using Scheduled Reminders (\**Administer menu \>\> Communications \>\> Scheduled Reminders). There's ongoing work to use the new token processor in other areas of CiviCRM, which would allow using this token elsewhere.

If you only have one active membership per contact, you can install Fuzion Tokens, which has a "latest membership ID" token. This works for contacts because it eliminates the ambiguity of which membership is meant.
> 1 votes

---
Tags: civicontribute, civimail
---


# Question
Title: Trying to migrate data from Drupal 7 to new install on Drupal 9
Isn't it possible to just copy tables of contacts, groups, mailings and their related data into the new install? I'm trying to figure out which tables contain essential data on contacts, activities, donations, etc. vs the ones that contain information on the site setup (like the civicrm\_menu table, which I definitely want to leave behind, as somewhere over the years it got corrupted during an upgrade and has double entries and lacks a few entries as well).

Would this at all be a valid approach?

# Answer
This sounds a bit dicey, but fortunately I think there's a simpler solution.

My answer on migrating CiviCRM to WordPress is generic for moving CiviCRM to ANY new CMS - even the same CMS on a different site.

I would fix the `civicrm_menu` issue separately. You should be able to restore a copy from a fresh install, then disable/re-enable any extension, which will re-add any "managed entity" entries - in practical terms, those added by extensions.
> 3 votes

---
Tags: drupal-8, migration, drupal-9
---


# Question
Title: How can I search for upcoming birthdays?
Is there a way to find upcoming birthdays in version 4.7?

When I try to find people by birthday in the advanced search, it still searches for people whose birthday is in the current year (birth-date). So I can't find people who has birthdays in January neverminding the year.

Thanks.

# Answer
> 3 votes
There is an extension called "Birthdays By Month" which may prove helpful:

> BIRTHDAYS BY MONTH
>
> This extension lets you look up contacts that have a birthday on a given month. Once installed access it at ~/civicrm/birthdays-by-month. Author: S. Lee Gooding

# Answer
> 1 votes
I needed to send birthday messages to contacts, but Civi's Birthdate field, as you say OP, looks only at the current year, despite the fancy relational date ranges (i.e. Today, Tomorrow, Last Year, etc.). Useless.

Rather than adding an extension, I used custom fields to create a work around in Civi.

I added two custom fields: Birthday Day Number; & Birthday Month Number. I have these set as number fields, but really any qualitative field that can express values in the ranges 1-31 and 1-12 works (e.g. you could use a number field and a text field using the names of months, but this has a higher chance to introduce user error in inputting data when compared to numbers imo: e.g. one user writes Feb, another writes Fev, another writes February, etc.).

If you then export the birthdate fields and process so that you get the day and month as isolated columns in a csv, you can import and add those fields to your contacts.

I can now used Advanced Search to find contacts that have e.g. Birthday Day Number 5 & Birthday Month Number 2 (the fifth of February-- any year!). This would work equally well for your purposes, as you'll be able to search by entire months by searching on only the month field. You could also set the fields up to be searchable by range, but I found that this slowed down searching criteria input for me.

# Answer
> 0 votes
There's a custom search for that: "Find Upcoming Birthdays" yourserverhere.org/civicrm/contact/search/custom?csid=16&reset=1

Or did it disappear in 4.7?

---
Tags: contacts, custom-search
---


# Question
Title: Is Membership payment on Drupal 8 Webform supported yet?
I am trying to configure a Drupal 8 Webform to support payment for Memberships, but there seems no connection between the Membership field and the Payment fields. On D7, when configuring a Contribution on a Webform it asks for a Contribution Page to use, but not on D8.

Is this a bug, or just not yet implemented?

# Answer
> 3 votes
It’s a new feature! It is no longer necessary to create a Contribution Page

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


# Question
Title: mysql_dsn error on amp config - why am I getting "access denied"?
I'm trying to install buildkit on my Ubuntu 19.04 laptop, per the instructions at https://docs.civicrm.org/dev/en/latest/tools/buildkit/#config

I've used curl to run the script, successfully - `civicbuild -h` works - and am now on the `amp config` step.

When trying to create a mysql\_dsn using either

`mysql://joe:randompass@127.0.0.1:3306` or `mysql://joe:pass@localhost:3306`

I get this error:

`SQLSTATE[HY000] [1045] Access denied for user 'joe'@'localhost' (using password: YES)`

Running `amp config:get` does not show an existing `mysql_type` , which I think means there is not an existing mysql database that I can't log in to.

Running `amp cleanup` shows `Destroyed 0 instance(s)`

Running `amp show` returns an empty list

Running `amp test` shows this error:

```
PHP Fatal error:  Uncaught Error: Call to a member function getDriver() on null in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php:59
Stack trace:
#0 phar:///home/joe/buildkit/bin/amp/src/Amp/InstanceRepository.php(56): Amp\Database\MySQL->createDatasource('canary')
#1 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/CreateCommand.php(107): Amp\InstanceRepository->create(Object(Amp\Instance), true, true, 'admin')
#2 phar:///home/joe/buildkit/bin/amp/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Amp\Command\CreateCommand->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/ContainerAwareCommand.php(26): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/TestCommand.php(65): Amp\Command\ContainerAwareCommand->doComman in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php on line 59

```

I'm trying to figure out the error message, Googling that.

# Answer
Just in case anybody else has this issue when they try to use amp config with CiviBuild. It is probably not entirely clear that you **first need to create the user** that you are inputting into the Enter dsn\>

You first need to create a user in mysql with sufficent privileges. Remember, one does not log in as root anymore! Use 'sudo su' and then run your MySQL commands. There are plenty of resources to show you how to do this, but on MySQL ver 5.7.heres's what to do:

user@ubuntu: sudo su

user@ubuntu: mysql

mysql\> CREATE USER 'newusername'@'localhost' IDENTIFIED BY 'yourpassword';

This creates your new user - just replace 'newusername' with whatever you wish e.g. 'itadmin'. The same goes for the password (the security is up to you but be secure if you ever build production servers)

Now grant the permssions that amp requires:

mysql\> GRANT ALL PRIVILEGES ON * . * TO 'newusername'@'localhost' WITH GRANT OPTION;

Flush all privileges with:

mysql\>FLUSH PRIVILEGES;

The WITH GRANT OPTION is important as this will allow the user to be able to grant options on other users by a script.

exit from Mysql and then from su with two lots of exit command. You now have a user that you can put into amp config for the dsn section.

Remember! You have just created what is effectively a root user on your MySQL database
> 2 votes

# Answer
So, duh. I haven't totally figured out the problem - now I'm getting this -

`SQLSTATE[HY000] [2002] Connection refused`

but the `Access denied` issue was a simple fix, i.e., use `chmod`.

See "How to Run MySQL as a Normal User" at https://dev.mysql.com/doc/refman/5.7/en/changing-mysql-user.html .
> 1 votes

---
Tags: mysql, civicrm-buildkit
---


# Question
Title: Is there a bulk method to put emails on hold?
Bounce processing has not been working - but I do have a list of addresses that have been bounced. What I want to do is bulk update all those matching contacts and put their emails on hold.

I cant see a way of doing that. Is there?

# Answer
> 2 votes
You can add an extra column to your spreadsheet called "On Hold" and assign it 1, another one called "hold date" and then (3 options below, choose 1):

1. import your sheet (using eileen's csv import extension) as "emails", with appropriate matching rules.

https://civicrm.org/extensions/api-csv-import-gui

2. If you're brave, you could upload your sheet as it's own table and do an sql "Update" on the civicrm\_email table joining your new table via the email addresses.
3. You might be able to just import your sheet as a regular contact import with your strict matching rule, if your email addresses are unique (I'm not sure whether this would work, but it might be the easiest if it does - the part I'm not sure about is whether the mapping you get would expose the is-on-hold field and on-hold-date field).

---
Tags: civimail, import
---


# Question
Title: How do I add a column to a Contribution Summary report which will show the date and amount of the most recent payment/donation?
When running a payment report using the Contribution summary, along with the columns showing number of payments, payment aggregate and payment average, I would like to be able to see the date and amount of the last/most recent payment. This information can be separately gathered by running a Contribution detail report, but it is a lengthy process going through two separate spreadsheets when, ideally, I would want this information regularly, so having the data within the Contribution summary report who be ideal.

# Answer
> 2 votes
I recommend the summary fields extension: https://civicrm.org/extensions/summary-fields

It'll keep a calculated copy of the last contribution amount (and many other useful fields) as custom fields of the contact, making reporting like this much easier.

Because contributions are stored in a separate table, generating fields like 'last contribution' tends to be complicated and mixing it with other values isn't going to be well supported in most reports, but pulling in custom contact field values is almost always supported.

---
Tags: civireport
---


# Question
Title: How can I allow multiple memberships for a single contact under one organisation?
There are two scenarios
**First**
a. I create contribution page with membership types A, B, C, D and then user goes to the contribution page and purchases membership type A
b. I again go to the contribution page and this time purchase membership type B
**Result** --\> Membership Type - B
i.e. At first my membership type was A but after purchased membership type B, I have Membership Type B
**Second**
a. I go to contact dashboard , open membership tab and click on + Add Membership --\> select membership type A
b. I again to contact dashboard open membership tab and click on + Add membership --\> select membership type B

**Result** --\> \** Membership Type A and Membership Type B both
i.e. I have two memberships A and B
I know since all membership type belongs to one organisation , we maybe getting the above issue, is there any chance we can implement scenario second with contribution pages ?

is there any better solution than as provided in the old post here :
https://forum.civicrm.org/index.php%3Ftopic=31251.0.html

# Answer
The logic behind the behaviour you're observing is that most of the time when a contact is paying for a different membership type than their existing one, they are upgrading or changing that membership. Whereas an administrator is doing it, they can be trusted to differentiate between an update/change vs. a new one.

The link you provided suggests that if you create membership type A and B associated with different organizations, then the system knows not to change a membership, but to create a new one. That seems like a good idea, but it depends on your own details - the membership model in civicrm has trouble capturing all the possible nuances of memberships in real life.

Here's a link to one of my recent projects that provides support for multiple memberships:

https://socius.cpha.ca/civicrm/contribute/transact?reset=1&id=2
> 1 votes

---
Tags: civimember
---


title: Integrating with Elavon

text:
# Question
Title: Integrating with Elavon
How does one setup the integration with Elavon Payment Processor? Is there anything to do on the Elavon side? Have you had good experience integrating CiviCRM with Elavon?

# Answer
The Elavon payment processor integration ships with CiviCRM https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Payment/Elavon.php

From Administer \> System Settings \> Payment Processors, click Add Payment Processor. On New Payment Processor page, for Payment Processor Type, select Elavon Payment Processor and complete the rest of the form before submitting.

This is one of the oldest integrations with CiviCRM, and we have clients who have been happy with it for many years.
> 1 votes

# Answer
In Canada, Elavon has monthly PCI fees of less than 10$/month requiring a yearly questionnaire be filled (else they add 20$ /month extra) and 5$/month admin fees but no setup fee, for a MID only account meaning no terminal.

Almost always, you can get a better rates when you have a trustworthy payment consultant offering different payment processors, like the one I have :-)

I'm about to put aside Stripe, I can let you know later how the switch went.
> 1 votes

---
Tags: payment-processor
---


title: Why is my phone only dedup not working?

text:
# Question
Title: Why is my phone only dedup not working?
I created a dedup rule "Phone only", and set the only criteria to Phone, weight 30, and threshold 10. (I also tried 1 and 1). It fails to find duplicate contacts that clearly have matching phone numbers. Kind of at a loss here... the admins are complaining.

CiviCRM 5.29.1 Wordpress Version 5.6

# Answer
> 2 votes
My bad newbie error. The phone numbers matched but one was a household contact and the other an individual and deduping doesn't cross types. Same goes for all our rules.

---
Tags: duplicate-contacts
---


# Question
Title: Can I use CiviRules to send a notification to the administrator when an email gets bounced?
Often when sending bulk mailings, a few addresses will bounce, for various reasons. these bounces are not very noticeable. In many cases the on hold flag doesn't get turned on, but in many cases it is important that some admins are alerted.

I'mnot too familiar with Civirules, but was wondering whether it could be used to send an email notification to admins whenever an email gets bounced from a bulk mailing, pointing them to the contact/s in question.

# Answer
> 1 votes
I don't think you can do this (at least without development). Most significantly, there isn't any trigger from within the bulk mail system in Civirules so you would not be able to catch the bounces that don't put the email on hold. I suspect that adding that functionality would be very difficult as I doubt that these email bounces go near the sort of things that Civirules for a trigger. There isn't even an option to catch the change to email on hold. The trigger "contact changed" with the condition "field value comparison" doesn't off the email on hold status as option, though I think adding this would be relatively straight forward if you want to write some code.

---
Tags: civirules, bounce
---


# Question
Title: CiviRules Action to add tags not working
Wordpress 5.6.1, CiviCRM 5.33.1, CiviRules 2.21 I would like to add a tag to a contact when a membership is added/renewed. I can select the action "Add Tag to entity", but I can't see any of the available tags. I can create a rule with a trigger "Contact is tagged" where I can select from the available tags. In Drupal, I can choose the action "Add Tag to contact" and it works, but I need to do it in wordpress and can't figure out the issue. Any ideas?

# Answer
> 4 votes
Welcome to SE. I think this may be a bug with Civirules 2.21, where something has obviously changed as I now see the action "Add Tag to entity" rather than "Add Tag to contact which was in 2.20. I also don't get offered any tags to select. I'm guessing you may have an older version on your Drupal site. Nothing in the release notes (https://lab.civicrm.org/extensions/civirules/-/releases) suggests this change so I suggest that you contact the email addresses in the documentation (https://docs.civicrm.org/civirules/en/latest/)

I'm on an older version of WordPress 2.26.2 but I don't think that will make any difference.

---
Tags: civirules, tags
---


# Question
Title: Correct database collation recommendation
I now get the following warning under CiviCRM Status:

> Future versions of CiviCRM may require MySQL utf8mb4 support. It is recommended, though not yet required, to configure your MySQL server for utf8mb4 support...

Currently our database uses the collation utf8\_unicode\_ci for all CiviCRM tables. I can change the collation easily in phpMyAdmin. There are a number of utf8mb4... collations available. I was thinking of just switching to utf8mb4\_unicode\_ci. Is that the correct thing to do? Will it make the system status warning go away? Should I put our website in maintenance mode for the switch? Thanks for any advice. I don't do much with MySQL details like this and any hand-holding is appreciated ;)

# Answer
> 2 votes
Good question. There's some discussion here about utf8mb4\_unicode\_520\_ci or utf8mb4\_0900\_ai\_ci, but there's maybe some issues with that since at the moment in the associated changes it seems to be staying at utf8\_unicode\_ci. But it might change.

But the warning might be due to your global settings. In order to support this you need barracuda format available and some innodb settings. Most likely this one is not the default in your install: `innodb_large_prefix=true`.

Also need:

`innodb_file_format=barracuda`

`innodb_file_per_table=true`

# Answer
> 1 votes
Circling back almost 2 years later. Our MySQL server now is running 5.7.1 with settings innodb\_large\_prefix | ON; innodb\_file\_format | Barracuda; innodb\_file\_per\_table | ON. I actually used the System API from the shell to convert from utf8 to utf8mb4:

```
cv api System.utf8conversion

```

That converted all but one extension table, which I easily converted using phpMyAdmin. This time there are no error messages in CiviCRM status and nothing in our error logs.

---
Tags: database
---


# Question
Title: CiviRules Multiple rules per trigger - What happens?
When using CiviRules, what happens if two rules match a single trigger? Rule one says "if group X is added, filter matches X location, then send e-mail X." Rule two says "if group X is added, filter matches Y location, then send e-mail Y." Do both rules trigger? Does it dump after triggering the first applicable reached rule, even if the filter doesn't match?

# Answer
It should do both. I have two rules with the same trigger - membership changed with different conditions- (a) membership status is one of the ones I consider active and (b) membership status is one that I do not consider active. Both are working. But I'd still do some tests on your precise requirement to see that it does what you want.
> 0 votes

---
Tags: civirules
---


title: Unable to change membership

text:
# Question
Title: Unable to change membership
I am not able to change a membership. Version 5.34.0 Steps to reproduce:

1. Edit a membership
2. Change e.g. the end date
3. Save the membership.

A popup message appears saying the membership change has been carried out with the date given. However, the change is not recorded. This happens with every change.

# Answer
Note this is also tracked in gitlab https://lab.civicrm.org/dev/membership/-/issues/34
> 2 votes

---
Tags: civimember
---


# Question
Title: How can I use CiviCRM for registration, login, forgot password pages on Wordpress?
Effectively, I’m looking to completely replace the default Wordpress forms for these functions using CiviCRM, in order to get a nice integrated feel. Additionally, this will allow me to ask additional questions from a profile on user registration.

This is for a sub site of a multi site installation, which does make things a little more complicated.

# Answer
> 1 votes
The registration part is quite straight forward and described in the manual at https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/#wordpress-user-account-registration-option. The profile allows you to collect additional information and populate existing or custom fields.

The login and forgotten password screens are WordPress pages so you can't replace them with something from CiviCRM, but they can be customised sufficiently to make them look consistent and a bit of googling is probably the best way to find out how to do what you want.

---
Tags: wordpress
---


# Question
Title: Auto save mailing editing template in Mosaico
I have a question about creating a mailing with mosaico (civicrm/a/#/mailing/\[number\]), Why does auto-save not always apply when is changed?

When you click close or test buttons its saved, but it doesn't do it automatically, although it does do it when accessing the template during the first two changes...

Has it always worked like this?

Thanks!

# Answer
Changes to the mailing are saved automatically (groups, subject, etc), but changes to the content (i.e. changes that you make in Mosaico) aren't saved automatically. So anything you change while in the Mosaico editor (with the Mosaico logo in the top left) isn't saved. It has always been this way.

It would be great if there was an autosave feature.
> 2 votes

# Answer
We have created an extension which bundles quite a few tools for handling mailings - it is called "Mailingtools". The good news is that it has a feature which will warn you when you accidentally navigate away from the mosaico editing screen. You could use only that feature if you like.

1. Install the latest version of the extension
2. Navigate to /civicrm/admin/setting/mailingtools?reset=1
3. Check the box at the bottom "JS Warning to save Mosaico templates"
> 2 votes

# Answer
We potentially have a client interested in cosponsoring that feature - when you have info about possible cost - please post it here.
> 0 votes

---
Tags: civimail, mosaico
---


# Question
Title: Any recommended alumni tracking system that integrates with Civi?
We are a small non-profit school (around 70 students) and we would like to keep some stats on our alumni so we can measure how well are doing at training.

1. Is this something you would use CiviCase for?
2. Do you recommend any other systems out there for this?

Edit: We specifically want to track several things.

1. Class dropouts
2. Location of where they land a job within area of training
3. How long from graduation to working within field of training
4. They will be working in teams (not necessarily just teams of our alumni) so we want to be able to see team connections across our crm.
5. Stages of advancement within field of training and team successes/accomplishments
6. How long working in said field

Since we are a small tight-knit school, we have continuing relationships with our alumni. So we will likely get a high response rate to annual surveys that can keep the data base updated.

# Answer
CiviCase might be overkill. Maybe if you had several steps involved with each alumni outreach and wanted to track those steps separately but count the number of outreaches as a whole, but otherwise just one or two regular activities should do it? Or CiviCampaign with a survey.
> 1 votes

---
Tags: civicase
---


# Question
Title: How to get Views to work in CiviCRM on Drupal9 with separate CiviCRM database
On based the answers on this question How to get CiviCRM Views to work in Drupal 8 with separate CiviCRM database I'm trying to get work Views on Drupal9. Drupal9 and CiviCRM has different databases, but the database user who is trying to work with the databases has access for both databases, and I installed CiviCRM Entity module (the latest Drupal8 version).

I put a second `$databases['civicrm']['default'] = array {......};` to the end of my `settings.php` file with the correct informations, but on the Views preview page I get always the `SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxxxDEVxxxxx.civicrm_contact' doesn't exist: SELECT "civicrm_contact"."modified_date" AS "civicrm_contact_modified_date", "civicrm_contact"."id" AS "id" FROM {civicrm_contact} "civicrm_contact" ORDER BY "civicrm_contact_modified_date" DESC LIMIT 11 OFFSET 0; Array ( )`  error -- xxxxxDEVxxxxx is my Drupal9's database.

Is it possible somehow the get Views work? Thank You!

# Answer
> 1 votes
Do it exactly like was done in Drupal 7.. You should be able to goto path: civicrm/admin/setting/uf?reset=1

And then copy the integration code for the settings.php or settings.local.php from the "Views Integration settings"

---
Tags: drupal-views, civicrm-entity, settings, drupal-9
---


title: Activating Smarty

text:
# Question
Title: Activating Smarty
I'm trying to send end of year tax letters to donors. I want to customize the letters/emails with their total donation amount for the whole year. I understand I need to activate "smarty" to be able to do this, however, I can't find where this needs to be configured or enabled.

any guidelines would be really appreciated!

# Answer
Welcome to StackExchnage Aida. Activating smarty is usually done in the file civicrm.settings.php.

However for what you have in mind you may want to take a look at the extension "Summary Fields". It prvides certain information / data such as the total contribution amount in custom contact fields which allows you to easily use them in emails or letters.
> 3 votes

---
Tags: civimail, smarty
---


# Question
Title: Mandatory Key(s) missing params array:one of (first_name, last_name, email, display_name)
Hi I spent a long time testing my code and checking it worked on our test CIVI. On the test version of the CIVI CRM the requests work no problems. As soon as I switch to live and connect to the real CIVI I'm troubled with this error. Since this works perfectly on the test CIVI CRM I'm assuming there must be some setting different within CIVI? How can I debug this? When it works on my testing environment? Does anyone know what I need to change within CIVI.

I have a feeling it is related to this bit where it tries to save the users email as Main. On live CIVI it creates two users with one as email in main one in home. On testing however (the tet CIVI) it works as expected.

```
    $data['contact_type'] = 'Individual';
    $data['first_name'] = $account->field_first_name['und'][0]['value'];
    $data['last_name'] = $account->field_last_name['und'][0]['value'];
    $data['email'] = $account->mail;
    $data['location_type_id'] = 'Main';

    if (isset($account->field_company_name['und'][0]['value'])) {
      $data['current_employer'] = $account->field_company_name['und'][0]['value'];
    }

    $response = civicrm_contact_create($data);

    if (!$response->is_error) {
      $contact = reset($response->values);
      $contact_id = $contact->id;

     // search for the email to get the id.
      $email_search_params = array(
        'contact_id' => $contact_id,
        'location_type_id' => 'Home',
      );
      $email_search_response = civicrm_email_search($email_search_params);
      $email_search_params['email'] = $account->mail;
      if (!$email_search_response->is_error && count($email_search_response->values)) {
        $email = reset($email_search_response->values);
        // Add email to Main.
        $params = array(
          'id' => $email->id,
          'location_type_id' => 'Main'
        );
        $response2 = civicrm_email_create($params);

       }
      }

      // Add phone using Phone create CiviCRM API
      if ($account->field_telephone_number['und'][0]['value']) {

        $params = array(
          'phone' => $account->field_telephone_number['und'][0]['value'],
          'contact_id' => $contact_id,
          'location_type_id' => 'Main', // Other until main form completed
        );
        $response3 = civicrm_phone_create($params);

        if (variable_get('civicrm_api_connect_debug', false)) {
          watchdog('civicrm', '<pre>' . print_r($response3, 1) . '</pre>');
        }
      }

      $edit['field_civi_id']['und'][0]['value'] = $contact_id;
      // Default primary contact to the web administrator
      $edit['field_primary_contact_first_name']['und'][0]['value'] = $account->field_first_name['und'][0]['value'];
      $edit['field_primary_contact_last_name']['und'][0]['value'] = $account->field_last_name['und'][0]['value'];

```

This is an update:

I have added the code for civi\_create\_contact as requested

```
function civicrm_contact_create($params) {
  return civicrm_api_query('Contact', 'create', $params);
}

```

And this is the code for civicrm\_api\_query:

```
function civicrm_api_query($entity, $action, $data = array()) {
      $url = civicrm_api_connect_get_base_url() . "/sites/all/modules/civicrm/extern/rest.php";

  $keys = civicrm_api_connect_auth();

  $params = array(
    'entity' => $entity,
    'action' => $action,
    'api_key' => $keys['apikey'],
    'key' => $keys['sitekey'],
    'json' => 1,
  );

  $headers = array(
    'Content-Type' => 'application/x-www-form-urlencoded'
  );

  // Send the HTTP basic authentication headers if we are in test mode.
  if (variable_get('civicrm_api_connect_test', false)) {
      $headers['Authorization'] = 'Basic ' .
        base64_encode(
          variable_get('civicrm_api_connect_access_username') . ':' .
          /*decrypt*/(variable_get('civicrm_api_connect_access_password')));
  }

  $params = array_merge($params, $data);

  $query = drupal_http_build_query($params, '', '&');

  if ($action == 'get') {
    $url .= '?' . $query;
    $method = 'GET';
  }

  if ($action == 'create') {
    $method = 'POST';
  }

  $data = array(
    'method' => $method,
    'headers' => $headers,
    'data' => $query,
  );

  // Trace the submitted data if we're in debug mode
  if (variable_get('civicrm_api_connect_debug', false)) {
    watchdog('civicrm', '<pre>' . print_r($data, 1) . '</pre>');
  }

  $response = drupal_http_request($url, $data);

  // Trace the received data if we're in debug mode
  if (variable_get('civicrm_api_connect_debug', false)) {
    watchdog('civicrm', '<pre>' . print_r($response, 1) . '</pre>');
  }

  if ($response->code == 200) {
    $data = json_decode($response->data);

    // Trace the response if it's an error and we haven't already traced
    // it through being in debug mode.
    if ($data->is_error) {
      drupal_set_message(t('CiviCRM error @error', array('@error' => $data->error_message)), 'error');

      if (variable_get('civicrm_api_connect_debug', false)) {
        watchdog('civicrm_error', $data->error_message);
        //watchdog('civicrm_error', '<pre>' . print_r($params,1) . '</pre>');
      }
      return false;
    }
    else {
      return $data;
    }
  }
  else {
    watchdog('civicrm_error', 'CiviCRM fatal error');
    return false;
  }
}

```

# Answer
> 1 votes
Welcome to SE! It looks like you are trying to create an Individual and that your API call doesn't have all the necessary data.

One option is to print out the API parameters just before you make the API call and check it has what you expect. See https://docs.civicrm.org/dev/en/latest/tools/debugging/#printing-php-variables

If you edit the question and include your code, or a link to it, then we can offer more specific suggestions.

---
Tags: civicrm.settings.php
---


# Question
Title: Message is localized but message template is not
I received an summary of an activity that looked like this (in Swedish):

| Åtgärdssammanställning - Telefonsamtal |  |
| --- | --- |
| Med kontakt(er) | name\_10564 |
| Typ av åtgärd | Telefonsamtal |
| Ämne | Introduktion |

Obviously this is translated, which is kind of good, but the `name_10564` should definitely be a real name.

Problem is that I can't find this template in the System Workflow template list. The only one I find is "Cases - Send Copy of an Activity" and that is using the default template.

How can this be and where should I look for the template for "Activity Summary"?

We're running on Joomla if that (file locations?) are relevant.

(It seems that some of these strings exist in the translation on Transifex, to which I'm partly responsible ;-)

# Answer
For the `name_xxx` check your settings at Administer - CiviCase - CiviCase settings. There's a setting called "Redact Activity Email" that changes real names for privacy.

And yes the email template used to send to activity assignees is called "Cases - Send Copy of an Activity" even for regular emails.
> 2 votes

---
Tags: message-templates
---


# Question
Title: How to use webform to register a new user on Drupal 8/9 and link to contact in CiviCRM
I have a need to use Webform (using the Webform CiviCRM module) in Drupal 8 to register a new user and their organisation in Civi and at the same time create the user account in Drupal and link it to the Civi contact. I can't use the standard Drupal register form as I want to include their organisation and other custom fields. How can I do this?

# Answer
Using Webform and Webform CiviCRM modules create a webform with the fields required for the user and their organisation to create the contact and organisation in CiviCRM.

Then create a WebformHandler to programmatically create the user using the postSave() function. The WebformHandler is a single php file that needs to be saved in a custom module folder as: `my_module/src/Plugin/WebformHandler/CreateUserHandler.php` I have created a basic guideline WebformHandler that creates the user and connects to the CiviContact at https://gist.github.com/bmango/0347f6c22b3fb38e34be57bb50f8e99e

Note that the namespace declaration at the top of the script is not the same as the path to the file but will be:

`namespace Drupal\my_module\Plugin\WebformHandler;`

omitting the 'src'.

Once you have created the WebformHandler it should appear on the Webform "Email/Handlers" tab where you can then add it to the form.

This answer extends the answer given by mAtZ to Create a new user on Webform submission, by adding the code to connect the Drupal user account to the Civi contact.
> 4 votes

# Answer
Ben's answer sounds like a really good extra tool for this. Just for the record other solutions include
> 4 votes

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