# Question
Title: Permissions and admin approval of additions and edits
I'm setting up an instance on Drupal for an organisation to use with delegated data entry roles. The main admin person would like a workflow step that requires her to approve any additions or edits to contact fields (entries in general would be fine). Is there a way to do this, perhaps with an extension? I don't see anything native in the CMS permissions or Civi ACLs aside from having the admin role periodically do a search for recent modifications and revert them if necessary.

# Answer
> 2 votes
Another possibility could be using a webform\_civicrm form that is (somehow??) set up so that folk who enter the data can only 'save as draft' - hence the data is only stored in Drupal at that point - and (assuming I am not overlooking a big gotcha) this could then allow an admin to review/edit the draft and submit it which should then result in the data being pushed to civicrm.

A view could be built to show the data that is currently awaiting approval.

This may not be doable, but it could be worth exploring.

# Answer
> 1 votes
Maybe not what you're looking for but if the data entry people make csv files with rows for what their adds/edits would be, then the admin can review the csv file and run an import to make the changes live. When you run an import as an update it has an option to leave any field as-is if it's left blank on the row, so they wouldn't have to fill out the whole row, just any edits.

---
Tags: permissions, roles, workflow
---


title: Special characters in template

text:
# Question
Title: Special characters in template
We are using a docx file for a template and are calling the API for variables like first/last name etc. As we are working with a client who has a lot of contacts with special characters in their names (ñ, é etc.) we noticed that those aren't displayed correctly if called directly with `first_name` or `last_name`, however they ARE correctly displayed if we create a custom field in which we write the first and last name values and then instead call the custom fields. Any idea why this could be happening? And is there a way to call the values directly with the characters displaying correctly? Our solution is quite cumbersome. Thank you for help in advance!

# Answer
> 0 votes
It may be because of the civicrm\_contact table and it's fields are not in utf8mb4\_unicode\_ci collation!

The Uh-oh extension can help highlight weird db issues for you, and cv api3 System.utf8conversion can convert all your tables to utf8mb4

---
Tags: templates, custom-templates
---


# Question
Title: CiviCRM does not have permission to write temp files on new server
I just built a RedHat server on AWS to act as a Test server and cloned a Git repository that has my Drupal installation in it. After importing the Prod MySQL database for both Drupal and CiviCRM and adjusting the civicrm.setting.php file I tried accessing the website. I get the error message:

> CiviCRM does not have permission to write temp files in /var/www/html/natureserve/sites/default/files/civicrm/templates\_c/en\_US/, Exiting

The root directory of the website is owned by the 'apache' user and I set the permissions to '777' (both recursively). I know this is not recommended but I wanted to see if it was indeed a file permissions issue.

Any thoughts as to what else I can try?

# Answer
> 2 votes
I found out the culprit was SELinux. Once I disabled it everything worked fine.

# Answer
> 1 votes
The fact that each time you fix the permissions you can write down another level suggests that the umask might not be what you expect.

I can think of a couple of scenarios that would lead to this problem:

* Your umask doesn't include a write permission for the file owner.
* The `site/default/files/civicrm` folder isn't owned by the Apache user.
* The Apache user isn't the owner, but is in the owning group - but the `+s` bit isn't set.

In short - this sounds like a file permissions issue, not a CiviCRM issue. If you want help though - please give more information, such as a copy/paste of the file/owner permissions of the folder giving you grief (using ls -a, so we see the current folder permissions).

# Answer
> 0 votes
This is file permission issue you don't have write permission for the folder

So, Please change the permission for default/files/ folder this will fix the issue

# Answer
> 0 votes
You will want to look for .htaccess files buried in sites/default/files/civicrm/templates\_c/en\_US/ . I was just working the same problem myself, and found that the folder contained a .htaccess file with a "Deny from All" statement.

Modify this to allow CiviCRM to make modifications, the simplest (though least secure) way to to comment out "Deny from All" and add "Allow from All."

You may still need to use chown and chmod to set the right permissions.

# Answer
> 0 votes
For those landing here from a web search, I ran into this exact problem when setting up a test server (in my case a RedHat clone, with `backdrop cms` as the civicrm base).

What it required on my end was to edit `/etc/php-fpm.d/www.conf` to change the entries for:

```
 user = your-webserver-user
 group = your-webserver-group

```

add then add the user to the list

```
listen.acl_users = apache,nginx,your-webserver-user

```

then running

```
systemctl restart php-fpm

```

You can get your webserver user by checking `/etc/httpd/conf/httpd.conf`

```
User your-webserver-user
Group your-webserver-group

```

Hope that is useful to someone else out there. No amount of chmod/chown fixed it for me, this is what did.

---
Tags: drupal, permissions
---


# Question
Title: Mosaico Extension Disabled in CiviSpark Pro
I just set up CiviCRM Spark Pro, which says that it comes with Mosaico. However, when I go to create a new mailing, the option is not there. When I go to Administer \> Settings \> Extensions, Mosaico is listed as disabled. How do I enable it? If I click update, I'm only given the option to cancel, not to update.

# Answer
> 0 votes
Welcome to SE! For Spark issues, you may find the spark channel on https://chat.civicrm.org is more responsive.

---
Tags: mosaico
---


# Question
Title: How to remove a participant from multiple events
We are using the Advanced Events extension which allows us to copy participants from one event in a series to multiple other events via the event template. The downside of this is that, if a participant decides to no longer attend the events, we have to change the participant status to cancelled for each event individually. Is there a way to do this in bulk? I cannot find one. Thank you.

# Answer
You should be able to change it for the named individual via 'Find participants', select all results and then use 'Cancel registrations' from the action drop down menu (or the 'Participant status - change' option depending on your own configuration and status options)
> 1 votes

---
Tags: civievent
---


# Question
Title: Access Civi functions from outside wordpress plugin
I am able to access WordPress functions from outside of a wordpress plugin by doing a require wp-load.php and then I can access (for example) the db functions directly by setting global $wpdb:

```
require_once( '/mydomain/public_html/wp-load.php' );
global $wpdb;

```

For CiviCRM I will specifically I need to access the following:

* Find Contact
* Add Contact
* Find Financial Type
* Add Financical Type
* Add New Contribution

If I want to access any of these CiviCRM functions (without a plugin), what would I need to add to make them available?

Thanks

EDIT: I can directly retrieve from database is needed, and I could potentially even add new contact or financial type or contribution direct to database, but if there are functions that do this already then they would the better choice as all the 'checks and balances' will already be there and nothing will get missed.

EDIT: So I see I can use API4 ... the explorer tool is excellent by the way! So how can I access these API4 functions from the same server as CiviCRM, but from seperate php code (not a civicrm function).

# Answer
Start reading here: https://docs.civicrm.org/dev/en/latest/framework/bootstrap/#how-to-bootstrap-civicrm

If running your code with `cv` is an option for what you're trying to do, like a shell script, then that's the easiest. You just write your script as normal and then `cv scr --user=admin myscript.php`
> 1 votes

# Answer
You could also access CiviCRM API3 via the WordPress REST API or WP-CLI depending on your use case:

Note that the WP-CLI example should read:

```
wp civicrm api contact.get first_name=Alice last_name=Roberts

```
> 2 votes

---
Tags: wordpress, civicontribute
---


# Question
Title: WordPress 5.9 and CiviCRM 5.46 Donation Forms JQuery Errors
After updating my CiviCRM install I have noticed I am getting the following errors in my console on pages that have my donation forms.

```
jquery-ui.min.js:6 Uncaught TypeError: V.each is not a function
jquery.mousewheel.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'fixHooks')
select2.min.js:1 Uncaught TypeError: e.extend is not a function
jquery.form.min.js:11 Uncaught TypeError: e(...).get is not a function

```

These errors continue on and it looks like just about every .js file is throwing an error. I am going back through the release notes but of course I can not confirm which version I upgraded from to 5.46. Is there anything obvious I can check for why this is not working?

# Answer
> 0 votes
I had the same issue on a system with WordPress 5.8.4 and CiviCRM 5.47.4. and what solved it for us was one of the theme's compatibility function called Defer jQuery And jQuery Migrate which (un)changes the order in which jQuery / jQuery Migrate is registered.

---
Tags: wordpress, civicontribute, jquery
---


# Question
Title: I want to add a user in CIVI using drupal
I would like to create a user profile without administration privileges but can add people to our account. For example we have 3 employees, I want them to have access to the clients we serve but not be able to make administrative changes. I am able to add a user profile for drupal but not add it for civi.

# Answer
> 1 votes
That is possible. The way I would recommend going about this is making a new role in Drupal for your staff. People -\> Roles -\> Add role

After adding the role, you can then navigate to People -\> Permissions and change settings as you wish! You can set specific access to CiviCRM with certain permissions granted, while others (more admin-level permissions) remain hidden from them. Then, simply set their drupal role to be the newly created role.

---
Tags: user
---


# Question
Title: Is there a setting to turn off "You have been un-subscribed" emails?
When you unsubscribe in Civi you are generated an email that contains "You have been un-subscribed from the following groups" with a link to re-subscribe. To be clear this is not the 'double opt in' email. And we do not wish to turn off the unsubscribe feature. We simply want to stop sending these confirmation emails. Is there a way to do this as a configurable setting in CiviMail?

# Answer
> 1 votes
You can go to Administer -\> CiviMail -\> Headers, Footers, and Automated Messages. There, you will find the automated email you are looking for.

---
Tags: civimail
---


title: MailStore Error Messages In Log

text:
# Question
Title: MailStore Error Messages In Log
Getting the following error: Finished execution of Process Inbound Emails with result: Failure, Error message: Could not connect to MailStore for xxxx@xxxx.org@Error message: An error occured while sending or receiving mail. Failed to connect to the server: :995.

This is what the log reads: Parameters parsed (and passed to API method): a:1:{s:7:"version";i:3;}

Full message: Finished execution of Process Inbound Emails with result: Failure, Error message: Could not connect to MailStore for xxxxx@xxxxx.org@ Error message:

An error occured while sending or receiving mail. Failed to connect to the server: :995.

I tested the Send Mail and got: Mail Sent Sending test email: From: xxxx@xxxx.org To: xxx@xxxxx.org Your SMTP settings are correct. A test email has been sent to your email address.

# Answer
> 2 votes
It sounds as though outbound email (SMTP) is configured correctly but inbound email may not be. This could be due to incorrect inbound email settings in CiviCRM or a complication such as two-factor authentication on your email account. These resources may help to pin it down:

# Answer
> 1 votes
Based upon davejenx statements I examined the mail settings and changed from POP3 to maildir and it solved the issues. Thanks you for the help!

---
Tags: email
---


# Question
Title: If you set a report access permission to everyone, includes anonymous, can it be viewed publicly?
Wordpress - Civi 5.48

I created an event report and I want it so anyone can view who is attending by using the link.

I figured out the link part - https://example.org/civicrm/report/instance/44/

I gave "CiviReport: access CiviReport" permission to anonymous user and changed permission on the report itself, but the results don't actually appear.

Is there a better way of doing this?

# Answer
> 1 votes
I believe I've been down this road and reports do not show on the front-end. Another reason for Search Kit and making a display.

# Answer
> 1 votes
There is a setting on Events for "Participant Listing"

> To allow users to see a listing of participants, set this field to 'Name' (list names only), 'Name and Email', or 'Name, Status and Register Date'. You will need to set Access Control permissions to include 'view event participants' for any Roles you want to access this listing. After adding your event, create links to the listing page by copying the URL provided in the 'Participant Listing' section of the Configure Event page.

Does that not suffice?

---
Tags: civievent, permissions, reports
---


title: Send Test email not working properly

text:
# Question
Title: Send Test email not working properly
For the 18 months I've been using civiCRM. the "Send Test" on traditional email worked fine.

Now I am getting the message "Could not identify any recipients. Perhaps your test group is empty, or you tried sending to contacts that do not exist and you have no permission to add contacts." My test group is fine. When I click "Send Test" my test email address is put "On Hold." If I send to the test group, everyone in the group is put "On Hold."

Any idea why this is happening?

My civiCRM instance civiCRM: 5.40.3 Drupal: 7.80

# Answer
> 1 votes
Try checking your SMTP settings. (I received that message when I changed the password for that account, but didn't update CiviCRM's Outgoing Mail settings.)

# Answer
> 0 votes
Theres a patch to the sparkpost extension. Prior to that it was reporting a similar issue so maybe check the version of sparkpost (if you are using it) and try upgrading the extension.

---
Tags: civimail
---


# Question
Title: duplicate memberships for the same member
What is the recommendation to deleting duplicate memberships. some members have at least 3 - 10 entries and we want to clean it up. please advise

# Answer
The first step is to stop the duplicates from happening. Are the memberships all tied to the same organization? Then it should not be doing that. The cases where I've seen it create duplicates is when memberships were in a pending state (contribution failed) https://lab.civicrm.org/dev/membership/-/issues/11.

You can create a new member status of e.g. "Duplicate" to isolate your dupes so they can be excluded in a search by users. You want to do this because setting to cancelled per delete membership action help pop-up doesn't seem advisable as in some cases I've seen, prevent the supporter from adding a membership via a front-end again. (may need to submit PR to change that reccomendation pop-up).

> WARNING: Deleting this membership will also delete any related payment (contribution) records. This action cannot be undone.
>
> Consider modifying the membership status instead if you want to maintain an audit trail and avoid losing payment data. You can set the status to Cancelled by editing the membership and clicking the Status Override checkbox.
>
> Click 'Delete' if you want to continue.

To cleanup, you should identify your duplicate memberships, either manually, sorting by name / CID in a membership search or via an export to a CSV. Via CSV you should export Contact ID, Membership ID, Member Since, Membership Type, Membership Start Date. You can run a dedupe scan in the CSV to figure out the dupes and fix the data accordingly for re-import or manual intervention.

Then you need to enure you move all the related contributions from the Duplicate status memberships to the surviving membership. You can use this extension to do so if you do not want to edit `civicrm_membership_payment` table directly: https://github.com/CiviCooP/org.civicoop.membershippayment. This moves the contribution ID(s) to the correct membership ID.

After moving all related contributions from the duplicate membership it is safe to delete it.
> 1 votes

---
Tags: civimember, duplicate-contacts
---


title: Best 'hidden' CiviCRM features?

text:
# Question
Title: Best 'hidden' CiviCRM features?
Does anyone have any really good 'hidden' CiviCRM features / easter eggs that you don't see enough of the community taking advantage of?

We just wrote an article about a few we know about and were wondering if anyone else had some even better ones?

# Answer
> 5 votes
Custom search proximity search, then use the actions dropdown to map contacts on a map. (Requires setting up mapping at google or openstreetmaps, but worth it.)

I think searchkit is close to having proximity search too, but right now I think it's only in the custom search.

You can also map contacts from any regular search result too, but proximity radius seems the most useful for mapping.

# Answer
> 4 votes
This is tricky because some of the "best" hidden features are of niche interest, or require extensions.

For strictly core "hidden" features, I'd suggest the batch accounting integration, event badges, and of course Search Kit and Form Builder are still hidden to most users.

Also: Override any settings in `civicrm.settings.php`, sending CiviReports out via email on a scheduled basis, multi-site, invoicing, the user dashboard (`/civicrm/user`, not the "home" Civi screen), contribution premiums and PCPs, Quick Search based on custom fields, and Search Views to customize your search results (in non-Search Kit searches).

---
Tags: best-practice
---


# Question
Title: How to manage a membership price increase for rolling memberships
Other than MembershipExtras, does anyone have other solutions for when a Memb price increase needs to be applied such that the system checks if the End Date is before or after a specific date, and hence applies correct amount for a renewal

EG both Peter and John have a membership.

Peter expires on June 28

John's expires on July 2

The fee increase is to only apply to memberships ending after June 30.

On june 25th they both go to the renewal page, at that point you are asking that the system apply different prices for them despite them having the same Membership type.

# Answer
> 0 votes
I have an extension built that changes the price for membership 10 days before the expiry or when at the time of saving the membership type. This works for payment processors that have an update subscription amount function implemented. I am in a process of supporting it for Stripe.

---
Tags: civimember, renewals
---


# Question
Title: Using API4 to get contact based on email match
The API Explorer is excellent for testing proper queries, but I can not figure out how to get a contact based on matching email address.

For example, I can get a contact based on a partial match of last name like this:

```
// get any contacts that contain 'smith' in the last_name field
$contacts = civicrm_api4('Contact', 'get', [
  'where' => [
    ['last_name', 'LIKE', 'smith'],
  ],
]);

```

But since email is in a different table than the contact information, I think I need to use some kind of JOIN command, but I am having trouble figuring out how to accomplish this.

So I need to any contacts where `last_name LIKE 'smith' AND email='aaa@bbb.com'`

# Answer
> 1 votes
Unless you have a complex join, it's simply a matter of referencing contact\_id (the literal string prefix `contact_id.`, not a numeric contact id) in the select() or where() to create the join, e.g.

```
$x = \Civi\Api4\Email::get()
->addWhere('email', '=', 'me@example.com')
->addWhere('contact_id.last_name', '=', 'Smith')
->addSelect('contact_id.display_name')
->execute()->first();
print_r($x);

```

If it's more complex see https://docs.civicrm.org/dev/en/latest/api/v4/explicit-joins/

# Answer
> 2 votes
So @Demerit's answer above was exactly what I needed to understand how to connect the two tables together (email table and contact info table). I am posting my answer for other noobs that are trying to understand how this works.

In my question I was trying to GET CONTACT info first with the matching email address, however this appears to be far more complex than Demerit's solution which was to GET EMAIL info first with matching contact info... I am sure there is a way to do the complex call, but the exact query that I was looking for in my question above is this (get the email and then its matching contact info):

```
$emails = civicrm_api4('Email', 'get', [
  'select' => [
    '*',
    'contact_id.*',
  ],
  'where' => [
    ['email', '=', 'aaa@bbb.com'],
    ['contact_id.last_name', 'LIKE', '%smith%'],
    ['contact_id.is_deleted', '=', FALSE],
  ],
]);

```

The SELECT statement `*` pulls all the fields from the email table, and then the SELECT statement `contact_id.*` pulls all the fields from the related contact table.

The WHERE clause is looking for an email exact match in the email table, with a last\_name that contains 'smith' from the related contact table.

Note for 'contains' to work properly, you need to use the LIKE operator, and then wrap your search term in between percent signs '%smith%'. Percent sign is like a wildcard in MySQL. So BEGINS WITH would be LIKE 'smith%' and ENDS WITH would be LIKE '%smith'.

Also note that when you delete a contact, it is not actually deleted from the database (a flag is set that says is\_deleted=true), so if you want to ignore deleted contacts you can include a check for is\_deleted being false.

---
Tags: wordpress, contacts, api, apiv4
---


# Question
Title: WP Fatal Error UserDashBoard.php:80 for anonymous users
My Wordpress \ConfigAndLog\Civicrm.xx...xx.log is full of this error. 100s of MB of them. I understand that this is due to anonymous users not passing a valid contactID to the UserDashBoard.

This looks the same as the issue posted here Anonymous user can't view CiviCRM user dashboard in WordPress

```
Apr 28 13:27:57  [error]
$Fatal Error Details = array:3 [
  "message" => "You must be logged in to view this page."
  "code" => null
  "exception" => CRM_Core_Exception {#17563
    -errorData: array:1 [
      "error_code" => 0
    ]
    #cause: null
    -_trace: null
    #message: "You must be logged in to view this page."
    #code: 0
    #file: "/home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php"
    #line: 80
    trace: {
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php:80 {
        › if (!$this->_contactId) {
        ›   throw new CRM_Core_Exception(ts('You must be logged in to view this page.'));
        › }
      }
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php:193 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm.php:1199 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.shortcodes.php:380 { …}
      /home/xxxxx/public_html/wp-includes/shortcodes.php:356 { …}
      do_shortcode_tag() {}
      /home/xxxxx/public_html/wp-includes/shortcodes.php:228 { …}
      /home/xxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.shortcodes.php:227 { …}
      /home/xxxxx/public_html/wp-includes/class-wp-hook.php:307 { …}
      /home/xxxxx/public_html/wp-includes/class-wp-hook.php:331 { …}
      /home/xxxxx/public_html/wp-includes/plugin.php:522 { …}
      /home/xxxxx/public_html/wp-includes/class-wp.php:771 { …}
      /home/xxxxx/public_html/wp-includes/functions.php:1310 { …}
      /home/xxxxx/public_html/wp-blog-header.php:16 { …}
      /home/xxxxx/public_html/index.php:17 { …}
    }
  }
]

Apr 28 13:26:48  [debug] $backTrace = #0 /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(433): CRM_Core_Error::backtrace("backTrace", TRUE)
    #1 /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
    #2 /home/xxxxx/public_html/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke((Array:2))
    #3 /home/xxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.shortcodes.php(380): CiviCRM_For_WordPress->invoke()
    #4 /home/xxxxx/public_html/wp-includes/shortcodes.php(356): CiviCRM_For_WordPress_Shortcodes->render_single((Array:5), "", "civicrm")
    #5 [internal function](): do_shortcode_tag((Array:7))
    #6 /home/xxxxx/public_html/wp-includes/shortcodes.php(228): preg_replace_callback("/\[(\[?)(civicrm)(?![\w-])([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\...", "do_shortcode_tag", "[civicrm component=\"user-dashboard\" gid=\"20\" action=\"info\" mode=\"view\...")
    #7 /home/xxxxx/public_html/wp-content/plugins/civicrm/includes/civicrm.shortcodes.php(227): do_shortcode("[civicrm component=\"user-dashboard\" gid=\"20\" action=\"info\" mode=\"view\...")
    #8 /home/xxxxx/public_html/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress_Shortcodes->prerender(Object(WP))
    #9 /home/xxxxx/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, (Array:1))
    #10 /home/xxxxx/public_html/wp-includes/plugin.php(522): WP_Hook->do_action((Array:1))
    #11 /home/xxxxx/public_html/wp-includes/class-wp.php(771): do_action_ref_array("wp", (Array:1))
    #12 /home/xxxxx/public_html/wp-includes/functions.php(1310): WP->main("")
    #13 /home/xxxxx/public_html/wp-blog-header.php(16): wp()
    #14 /home/xxxxx/public_html/index.php(17): require("/home/xxxxx/public_html/wp-blog-header.php")
    #15 {main}

```

I can confirm that the Wordpress ACL is set to grant access for anon users to the Contact Dashboard however it still throws the error. My belief is that all the hits are from bots probing the site and are not real users. Even if they are the neatest solution would surely be to chuck them back at the home page rather than just filling the logs with errors.

To achieve this I changed /wp-content/plugins/civicrm/civicrm/CRM/Contact/Page/View/UserDashBoard.php

From

To

```
  /**
   * Heart of the viewing process.
   *
   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
   */
  public function preProcess() {
      if (!$this->_contactId) {
         header("Location: https://my-domain.com/login/");
         exit();
         //throw new CRM_Core_Exception(ts('You must be logged in to view this page. - '));
    }

```

Shouldn't this be the default behaviour? I've purged almost a GB in logs from the last couple of months for this alone.

Or I have I committed a sin and there is a better way to get around this?

# Answer
> 0 votes
The "correct" behavior probably depends on your personal preference. In my case, I would want the default behavior - this can indicate a misconfiguration I caused - but I see why you would want this.

The only "sin" is that you've modified a core file - so every time you upgrade you'll need to put your modification back in. Or you could use PHP overrides, but that's not long-term maintainable.

Here are some ways I would consider handling this:

* I would check my web server logs to verify that this is bot behavior. If it is, I would block those bots (with robots.txt, mod\_security, fail2ban, and/or Apache configuration).
* You could use the mod\_rewrite Apache module to block anyone attempting to access this page without a contact ID in the URL and with no cookie indicating they're logged in.
* There are more advanced approaches, like sending your logs to a tool like Logstash where you can filter out garbage, but that's a lot of work just for this. CiviCRM implements the PSR-3 logging interface, so there's a lot of software you could use as an alternative to writing to the Civi log.

Personally I like the fail2ban option, but that presumes you have access to fail2ban.

---
Tags: wordpress, logs, user-dashboard, errorhandling, anonymous-user
---


title: How do time zones work with CiviCRM?

text:
# Question
Title: How do time zones work with CiviCRM?
I am using EventICS and some event registrants are reporting that the calendar item they get is for the wrong time, but when they forward to us, its correct, so we think its an issue with time zones. In the docs, I can't seem to find any reference to time zones, so I am posting here to get more clarity. How do time zones work with CiviCRM?

# Answer
> 4 votes
This might be https://lab.civicrm.org/dev/core/-/issues/2887. Are they Outlook users?

# Answer
> 2 votes
I see we made an extension described as

**Event ICal Timezone**

> Sets time on the ical file as per the timezone set on the user's device

I can't comment on how well it might meet your need but happy to provide it if you want to give it a try if it sounds useful

---
Tags: civievent, timezone
---


title: Participants phone number

text:
# Question
Title: Participants phone number
Some events require the participants' phone numbers. Is there a way to add a field specific to an event?

# Answer
> 1 votes
Include the phone number field in the profile and make it mandatory. Use the profile for doing registration

---
Tags: civievent, custom-fields, participants, phone
---


# Question
Title: Does Authorize.net/CiviCRM integration require the use of "Webhooks" instead of "Silent Post"?
I'm nervous that Civi's documentation for Authorize.net is outdated. There appear to be cases where recurring ARB payments are processed by Authorize but the related Civi contributions & memberships are not updated. This doc seems to require the use of a "Silent Post", but tech support at Authorize said Silent Post is deprecated. Other systems that integrate with Authorize use webhooks instead of the Silent Post. Should I be using webhooks instead of the Silent Post? If so, should I use the same format, like this for Wordpress:

```
https://example.com/BASEPAGE/?civiwp=CiviCRM&q=civicrm/payment/ipn/NN

```

If so continued... which events should be listened to?

* All Events
* Customer Events
* Subscription Events
* Payment Events

# Answer
> 3 votes
You want to use the authnet extension instead which uses webhooks and not a silent post URL.

Here is the setup guide and if you are migrating from legacy core authnet. The webhooks are created automatically if you check the system status page in Civi to generate them. FYI, the webhooks used are:

---
Tags: wordpress, payment-processor, authorize.net, integration
---


# Question
Title: Contribution Pages are not working in Test-Drive Mode
I revisited some Contribution Pages which are working fine in "live" mode. (The credit card transactions are processed and CiviCRM records are updated.) I just discovered that those pages don't work in Test-Drive mode. (Testers receive a 404 error after clicking "Submit", no contribution record is creates, and the Contribution\>Payment Processor Administration log shows REJECT1 for the failed transaction.) The text of the 404 error that appears after "Submit" is "Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." What's wrong with my test-driving? (CiviCRM 5.48.0 on Wordpress Version 5.9.3)

**Additional information.** The payment processor is iATS. The credentials for both live payments and test payments are active and unchanged since we launched. I called iATS customer service and they confirm the test credentials are correct. The URL that generates the 404 error is `https://[xxxx]museum.com/&civiwp=CiviCRM&q=civicrm%2Fcontribute%2Ftransact&_qf_Main_display=true&qfKey=CRMContributeControllerContribution2fhpo9ptg1usw0o00cs4co040ssg4c4wsk0o040ko04g40s8ck_6256` I've asked our webmaster to look into other applications that may be interfering with the tests. **More Additional Information:** I notice that occasionally the Contribution Page(s) that I'm trying to test open(s) with this 2-line error message preceding the "Test-drive Your Contribution Page"  (screenshot) It doesn't happen every time. Customer Service at iATS explained that that means something is wrong with my set-up and reiterates that the test credentials are valid. **More Additional Information**. I found that I can get the Test-Drive functionality to work properly if the transaction amount is $1.00 (no less and no more). I've tried several different Contribution Pages with varying amounts of Fixed and "Other" optional amount. Only $1.00 Test-Drives complete successfully. And to reiterate, all the pages I tested work perfectly in "live" mode, regardless of the amount.

# Answer
It's hard to know without more information, but here are some possible causes:

* You don't have test payment credentials set up at **Administer » System Settings » Payment Processors**.
* You've reused your live payment processor credentials as test credentials. This seems likely given the rejection. Most processors require you sign up for a test account separately (Stripe, notably, does not - but still requires different credentials).
* You have some sort of web application firewall or web server configuration that's causing the 404 error, which is an unusual error here.

If this doesn't provide an answer, I would edit your question with:

* The name of the payment processor you're using.
* Confirmation that you're using test credentials for the test processor.
* The URL that generates the 404 error, preferably with the actual log entry from your web server software.
> 1 votes

---
Tags: civicontribute, iats, testing
---


# Question
Title: API4 PHP Fatal error Uncaught API_Exception Authorization failed
So I was happily programming and testing away, and everything was working and then suddenly I started getting this error:

```
PHP Fatal error:  Uncaught API_Exception: [0]: Authorization failed
  thrown in /home/my_public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php on line 223

```

I am writing code in an external php file and using this method to gain access:

```
require_once '/home/my_public_html/wp-content/plugins/civicrm/civicrm/civicrm.config.php';
require_once '/home/my_public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php';
$civi_config = CRM_Core_Config::singleton();

```

I was able to get and create Financial Types as well as get and create Contacts without any issues. But then suddenly started getting the error.

This is one of the calls I am making (which is giving me error):

```
$financial_type_name = "Donations";
$financialTypes = civicrm_api4('FinancialType', 'get', [
      'select' => [
        'name',
        'id',
        'is_deductible',
      ],
      'where' => [
        ['name', '=', $financial_type_name],
      ],
    ]);
print_r($financialTypes);

```

EDIT: Using @Demerit answer, this is what the proper working call looks like with checkPermissions=FALSE

```
$financial_type_name = "Donations";
$financialTypes = civicrm_api4('FinancialType', 'get', [
      'checkPermissions'=>FALSE,
      'select' => [
        'name',
        'id',
        'is_deductible',
      ],
      'where' => [
        ['name', '=', $financial_type_name],
      ],
    ]);
print_r($financialTypes);

```

# Answer
Because you're using a manual way to bootstrap civi (as opposed to e.g. running your script with `cv scr --user=admin`), you need to either add code in there to also "log in" as a user, or you need to pass checkPermissions =\> false as a parameter to api4.
> 2 votes

---
Tags: wordpress, civicontribute, contacts, api, apiv4
---


# Question
Title: Anon user profile edit error - No user/contact ID was specified, so the Profile cannot be used in edit mode
I am using wordpress with civicrm 5.39.0 and previously this url worked for anon users to edit profile which I would include in e-blasts https://emptyhometax.org/civicrm/profile/edit?reset=1&gid=2&{contact.checksum}&id={contact.contact\_id}

When I tested with some user today on their mobile device they get this error. It first routes to the main website page then when you click link to profile webform it gives "Error No user/contact ID was specified, so the Profile cannot be used in edit mode."

Any advice on how to get this to work so an anon user can be directed to their profile to edit from a link in an email?

# Answer
> 0 votes
contact.contact\_id is a deprecated token but you say it's on 5.39 which was before that I think. But try {contact.id}

---
Tags: checksum, anonymous-user
---


title: Is the use of API4 already recommended?

text:
# Question
Title: Is the use of API4 already recommended?
I am currently working on a custom module for CiviCRM (5.48) and Drupal 9 (9.3.9)

I opted to use API4 but I notice that some things are missing compared to API3:

* Contribution -\> completetransaction
* MembershipPayment
* ParticipantPayment

Are these done in a different way or has this not been developed yet?

# Answer
See https://lab.civicrm.org/dev/core/-/issues/2486 but I believe all of those things are deprecated anyway (or on the way to being deprecated) and the idea is to use Order and Payment: https://docs.civicrm.org/dev/en/latest/financial/orderAPI/
> 3 votes

---
Tags: api, drupal-9, apiv4
---


# Question
Title: Best Way to Check In Three Events at Once?
So here is the scenario

* Three events happening at same time
* Had to setup 3 different registration pages because only certain people were invited to certain things.
* When we check people in, we want to make sure we have them checked in for all events they are registered for.
* we are using QR code check in but are open to other options.
* We also want to be able to identify VIPs when checking them in

Here are a couple ideas I had

* Create a price set with all the RSVP options and move all the RSVP's to a new event and make sure all the right price set options are chosen. This way when we use QR code check in, it will show all the correct options to the person checking them in. We would be managing RSVP's in two places, but it would streamline check in.
* Create a new event for another scenario. Everyone is attending event B, but some people are attending event A,B,&C
* Create VIP as a participant role.

Wordpress and Civi 5.48

# Answer
These are all good thoughts.

The easiest approach, if starting from scratch, would be to have one "umbrella" event and the price sets dictate access to the other events.

Given your current situation - since everyone is attending event B, I would probably just use QR check-in on that event, and after everything was over, create a group of all attendees in event B. Then search for event A (and C) attendees in the group and update their participant status in bulk.

If you need this done in near real-time, you could use SQL Tasks to automate this, but that's more technical.

I think "VIP" as a participant role makes a lot of sense.
> 1 votes

# Answer
If this is useful, i can dig it out for you. We did an extension that adds a custom field to an Event. If you then put another Event ID (for the 'parent' event) in to this field on the 'child event' then anyone registering for the 'parent' event gets registered for any/all 'child' events.
> 1 votes

# Answer
To register participants for a series of events, we use the Event Additional Signup Extension, which can be found in the extensions manager of CiviCRM.

I think it covers your basic requirements: Just set up price sets and link the appropriate option to the additional event(s) signup.
> 1 votes

---
Tags: civievent
---


# Question
Title: How to add advanced options for CKEditor
When I go to /civicrm/admin/ckeditor at the end of the page I see "Adavanced options" which simply links me to the Api documenation of CKEditor - but how can I define these advanced option in CiviCRM?

# Answer
> 1 votes
Right below that link is a set of dropdowns to select the advanced options.

# Answer
> 1 votes
Thanks to Demerit.

The solution for now is to add the file to the composer.json:

```
"civicrm-asset": {
    "path": "httpdocs/libraries/civicrm",
    "url": "/libraries/civicrm",
    "assets:core": {
        "include": ["js/**", "css/**", "ang/**", "templates/**.png", "templates/**.jpg", "ext/ckeditor4/js/ck-options.json"],
        "exclude-dir": [".git", "/CRM"]
    }

```

After that run `composer civicrm:publish` and the options appear under /civicrm/admin/ckeditor.

I created an issue for the plugin: https://lab.civicrm.org/dev/civicrm-asset-plugin/-/issues/20

---
Tags: ckeditor, wysiwyg, editor
---


# Question
Title: How to compose HTML Body from a Mosaico Template content?
I amb creating a Mailing via API calls. I dynamically create the Moisaico code. But when the Email gets created, it doesn't have any HTML code, so I can not send it. How can I get the HTML code from the Mosaico code?

If I go through the CiviCRM web GUI, I just need to click on "Edit" on the Mosaico Design created for that Email, and then jsut click "Save" or "Close", and the HTML gets created by Mosaico and then I can send the email.

How can I make this process via API?

Thanks.

# Answer
> 0 votes
If I understand correctly - this should serve your needs

Mosaico Message Templates For each "Mosaico Template", automatically create "Message Templates" for use in scheduled reminders, personal emails, etc.

https://github.com/civicrm/org.civicrm.mosaicomsgtpl

---
Tags: civimail, api, email, mosaico
---


# Question
Title: Why do I get "loading failed" when trying to add Membership Organization to a new membership type?
I am setting up a new install of CiviCRM on the latest Wordpress (self hosted). I am trying to set up membership types, but when I go to enter the Membership Organization, I get a "Loading failed" message (see screenshot). I have already created two contact records of type Organization, including the default org which this setup is for. I am logged in as the super admin, so it should not be a permissions error. Also, there are no existing membership types. Any ideas appreciated. Thanks.

# Answer
> 2 votes
Well, I finally tracked this down. But before I go into that, I should say that I initially worked around the issue by creating the Membership Types right in the Civi table using phpMyAdmin.

Later, though, I noticed I was getting the same "Loading failed" when trying to add a tag to a contact using the tag tree popup. I also could not create a new mail message. It always got stuck on "initializing." So I went searching for more help and found an old post on the CiviCRM community forum by @Coleman that seemed to be related to the issues I was experiencing.

Based on that post, I started to disable WordPress plugins. I narrowed it down to the **All In One WP Security** plugin. Then I narrowed it down to the plugin's firewall measures. Finally, I found the culprit, the "Enable legacy 5G Firewall Protection" setting. By unchecking that, I was able to restore proper functionality in CiviCRM.

I hope this helps someone else out there who might be getting "loading failed" issues. It will most likely be related to the firewall and what is in the .htaccess file.

Thanks again to those of you who offered help.

---
Tags: wordpress, civimember, organization
---


title: DB Error: no such field "created_date"

text:
# Question
Title: DB Error: no such field "created_date"
When I try to add or edit an "Employee of" Relationship, I get a "no such field" error, although this field exists in the database. Any ideas how to proceed?

CiviCRM 5.48.2; MySQL:5; PHP 7.4

From error log

    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => INSERT INTO `civicrm_relationship` (`contact_id_a` , `contact_id_b` , `relationship_type_id` , `start_date` , `end_date` , `is_active` , `description` , `is_permission_a_b` , `is_permission_b_a` ) VALUES ( 55680 ,  1377 ,  4 ,  NULL ,  NULL ,  1 , '' ,  0 ,  0 )  [nativecode=1054 ** Unknown column 'created_date' in 'field list']
    [type] => DB_Error
    [user_info] => INSERT INTO `civicrm_relationship` (`contact_id_a` , `contact_id_b` , `relationship_type_id` , `start_date` , `end_date` , `is_active` , `description` , `is_permission_a_b` , `is_permission_b_a` ) VALUES ( 55680 ,  1377 ,  4 ,  NULL ,  NULL ,  1 , '' ,  0 ,  0 )  [nativecode=1054 ** Unknown column 'created_date' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="INSERT INTO `civicrm_relationship` (`contact_id_a` , `contact_id_b` , `relationship_type_id` , `start_date` , `end_date` , `is_active` , `description` , `is_permission_a_b` , `is_permission_b_a` ) VALUES ( 55680 ,  1377 ,  4 ,  NULL ,  NULL ,  1 , '' ,  0 ,  0 )  [nativecode=1054 ** Unknown column 'created_date' in 'field list']"]
)```

# Answer
> 2 votes
Do you have logging turned on (admin - system settings - misc)? If so then the log table is probably out of sync. Check log\_civicrm\_relationship to see if it has the field. If it doesn't have the field, try admin - system settings - clear cache and also rebuilding triggers: https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild

`https://example.org/civicrm/menu/rebuild?reset=1&triggerRebuild=1`

---
Tags: contacts, relationships
---


# Question
Title: Best way to cleanup CiviMail database tables?
On CiviCRM installations that use CiviMail extensively, the mailing tables can become pretty big. For example, I'm looking at a database with a `civicrm_mailing_recipients` table that has 4 million entries since 2011.

Assuming that the stats from old mailings are not relevant anymore, what would be the best way to archive the data?

Ex: we are in 2019, stats from before 2016 could be archived elsewhere.

I did a bit of digging and found this old forum post which sounds like a good start. There was also this PR back in 2016 that helped avoid breakage of click-through links when mailing data was deleted.

Related SE question: Does archiving mailings do anything in particular.

# Answer
If I'm understanding correctly, I'd say there are two possible solutions here. The first is the easier one where you don't care about keeping the stats or history of the mailings in Civi. If that's case, then you can probably use the API explorer to delete old mailings, which would be equivalent to clicking to delete them from the Scheduled and Sent Mailings management list. This doesn't really archive them per se. You're just deleting them, but doing so through the explorer seems cleaner than deleting through the MySQL cli.

The second option is what my clients want which is to keep the stats and remove the bloat, but this currently doesn't exist as far as I know. The largest tables they have are `civicrm_mailing_recipients`, `civicrm_mailing_event_queue` and `civicrm_mailing_event_delivered`. (The activity tables also get pretty big, but that's another issue.) I've schemed a solution that would require transferring the stats data to another table(s) to be able to reference them at a later date (not all that difficult), but hooking those new table(s) into the search functions, reports and other areas where it's needed is a taller order. I haven't really thought through this in any detail, so I'm sure there's lots I haven't considered. Maybe there's an interim solution between these two. Clicking Archive removes data from the some of the processing tables but keeps the stats tables in place?
> 3 votes

# Answer
I created an extension archive mailing where a Scheduled Job can be enabled to automatically archive mailings (and compile statistics, cleanup the mailing tables) after a specified period.
> 4 votes

---
Tags: civimail
---


# Question
Title: Error message in CiviMail: "Mailing has not been saved, Content maybe out of date, please refresh the page and try again"
After upgrading to CiviCRM 4.7.28 in WordPress, when users are trying to draft mailings in CiviMail using a template (which contains unsubscribe/opt out/resubscribe/subscribe tokens, the {domain.address} token, and URLs to our website and Facebook), when CiviMail tries to autosave the draft, the user gets this error message:

"Mailing has not been saved, Content maybe out of date, please refresh the page and try again"

This error does NOT occur when not using a template, but if you use a template when you start a message, and then delete it, the error does continue to occur. It seems like it's related to the template but I can't really understand why.

Anyone have any ideas on why this would be occurring and how to fix it?

# Answer
> 3 votes
I puzzled over this problem after a 4.7.28 upgrade for hours before reading this post. Turning off and on Ckeditor worked for me, which gave me another idea.

Since this happened to me with two sites, I tried clearing all caches on the second site and that did the trick. I suspect changing the ckeditor setting flushes a cache, and flushing the cache is the real fix.

I flushed all the caches I have so I'm not sure which is the one that really does the trick:

# Answer
> 1 votes
If I remember correctly, I had this happen one time and it was faulty html in what I was pasting in. I figured it out by pasting only a little piece of the code in at a time to find the part where I got the error.

# Answer
> 1 votes
I had the same error appear after upgrading from 4.7.24 to 4.7.29 (wordpress). I was able to regain mail functionality by following the instructions above to disable the CKEditor - however, as stated above you lose the WYSIWYG functionality...

# Answer
> 1 votes
I managed to trigger this error after upgrading to 5.0 (probably a directory permissions error). Deleting the cache files as Jamie describes above AND doing the menu rebuild seems to have repaired the problem.

# Answer
> 1 votes
I ran into this because the database had not yet been converted to utf8mb4 (it was an old installation of CiviCRM).

Example: go to the Support \> Developer \> Api3 Explorer, then run entity = "System", and action = "utf8conversion".

---
Tags: civimail, message-templates
---


# Question
Title: WooCommerce prevents user from accessing CiviCRM menus
I have CiviCRM installed on WordPress.

I have duplicated the wordpress Subscriber role (using Members plugin), and then I go to Administer \> User and Permissions \> Permissions (Access Control) \> Wordpress Access Control and I assign ALL permissions to this new role.

I then assign this role to a user, and login with the user.

If I have the WooCommerce plugin activated, the user can not access the CiviCRM menus at https://mysite.com/wp-admin/admin.php?page=CiviCRM ... it gets redirected to the WooCommerce my-account page.

As soon as I disable the WooCommerce plugin, the user now has full access to the CiviCRM menus.

Any thoughts or ideas on how to get around this situation?

Thanks

# Answer
We found this to be problematic as well.

You can restore the default Woo admin bar and admin access with code:

```
add_filter('woocommerce_disable_admin_bar', 'cv_wc_disable_admin_bar', 10, 1);

function cv_wc_disable_admin_bar($prevent_admin_access) {

    return false;
}

add_filter('woocommerce_prevent_admin_access', 'cv_wc_prevent_admin_access', 10, 1);

function cv_wc_prevent_admin_access($prevent_admin_access) {

    return false;
}

```
> 1 votes

---
Tags: wordpress, civicrm-home, evaluating-civicrm, woocommerce
---


title: Newsletter checkbox at WP shop checkout

text:
# Question
Title: Newsletter checkbox at WP shop checkout
How can a newsletter checkbox be handled at checkout and the relevant contents be transmitted to CiviCRM? My customer is a Drupal 7 based CiviCRM at 5.47.4 with a separate WP website. Newsletter signup used to go to a WP based system but is now working OK through a webform into Civi. Also, however, users can purchase items from the WP website through (I think) Woohoo, and previously just ticked a box at shop checkout. How can this be transmitted to Civi? They've already entered their name and email address during the shop checkout process, so it's "just" a question of transmitting that information to Civi as a newsletter signup. Is there a way of doing this?

# Answer
\[EDIT - this answers the question as I understood it when first posted - it does not answer the request for passing info from a remote Woohoo form.\]

Checkout isn't a civicrm term. if you mean eg a Donation/Membership page (Contribution page in civi parlance) then there are a few ways you can do this

1/ add a custom field, then add it to your profile on the form, then make a Smart Group based on that field

2/ set up a Group to be 'public' then add the Group field to your profile. This will cause all 'public' groups to be listed, so would only suit your use case if you only have the one public group.
> 0 votes

---
Tags: wordpress, newsletter
---


# Question
Title: How to search active relationships (e.g) during past year?
We record volunteer relationships for our Volunteer contacts.

A contact is an active Volunteer of our organization if exists a relationship "volunteer for" and this relationship has no an "end date".

In the same way, a contact is an inactive Volunteer of our organization if exists a relationship "volunteer for" and this relationship has a past "start date" and a past "end date".

**The difficulty is when you want to get a list of all the volunteers that were active during for example the past year.**

How can I obtain a list of these contacts? There is no current built in search to achieve it? We must develop a customized search?

# Answer
> 0 votes
It will be possible from version 4.7.21 through the following improvements CRM-18081 - Allow search of active relationships during a custom range of dates

# Answer
> 4 votes
I would do the following, although it's a bit complicated so maybe you will want to develop a custom search after reading :).

Create a smart group to keep track of your active volunteers by searching for relationship type 'volunteer for' and status = active only (no start or end dates so you grab those empty end date people).

When you have your date criteria, for example the past year, create a group of folks who stopped volunteering in the past year by searching relationship type 'volunteer for', status = inactive only, and end date choose range choose your range, such as Jan 1, 2014 - Current date.

Now to get folks who are still active, or ended in the past year, do an OR search (checkbox in advanced search) using your 'active' smart group and your 'inactive in the past year' group.

# Answer
> 2 votes
Just stumbled across this old question, but Search Kit is now another option: see here

# Answer
> 1 votes
Do you have info about Memberships, Event participants and Activities completed by Contacts? All of those can be searched by date and Groups/Smart Groups created based on the action taken and the date completed. If a contact was a contributing Member, or made a Contribution otherwise, and/or attended an Event, and/or completed an Activity, like making phone calls or signing up other Members, that to me is an indication that someone is active, whether or not the person has a Relationship of type Volunteer or not.

# Answer
> 1 votes
It seems there is no an easy way to get this information.

Given a **date range** in which you want to find out the relationships that were active, the search should take into account up to four circumstances. Match all relationships where:

---

**(A)** Relationships with defined start and end dates

> *Relationship start date* **is before** *date range end date*
>
> **AND**
>
> *Relationship end date* **is after** *date range start date*

**(B)** Relationships with undefined end date

> *Relationship start date* **is before** *date range end date*
>
> **AND**
>
> *Relationship end date* **is empty**

**(C)** Relationships with undefined start date

> *Relationship start date* **is empty**
>
> **AND**
>
> *Relationship end date* **is after** *date range end date*

**(D)** Relationships with undefined start and end dates

> *Relationship start date* **is empty**
>
> **AND**
>
> *Relationship end date* **is empty**

---

Unfortunately, there is no "is empty" date range operator in the Advanced Search relationship form to cover this solution. If any, would create four smart groups nested to another group to satisfy the search in question.

Instead, Relationship Contact Report does incorporate the empty operator in the filter report for start and end dates.

---
Tags: civireport, search, relationships, custom-search, searchkit
---


# Question
Title: How can I write custom entites/ actions for api v3 - usage of api v4 for scheduled jobs
I want to define some scheduled jobs so that old data is deleted from time to time. For example contacts in trash, mailings older than X year, drafted mailings never sent... For scheduled jobs I need to use api v3 - is this right? I read it somewhere...

I found a module with some basic functionality like we need (https://github.com/fuzionnz/nz.co.fuzion.deleteoldbulkmailings) and tried to adjust to our needs. I would like to understand how CiviCRM finds new API 3 actions and entities so I got rid of all the civix code. I reduced the code so that there is only folowing left:

In folder api/v3/Bulkmailing there is is a file Deleteoldrecords.php:

```
/**
 * Bulkmailing.Deleteoldrecords API
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_bulkmailing_Deleteoldrecords($params) {
  $isEnabled = Civi::settings()->get('logging');
  $logging = new CRM_Logging_Schema();
  if ($isEnabled) {
    $logging->disableLogging();
  }
  CRM_BulkMailing_BAO_Delete::delete($params);
  if ($isEnabled) {
    $logging->enableLogging();
  }

  return civicrm_api3_create_success(array(), $params, 'BulkMailing', 'DeleteOldRecords');
}

```

In folder CRM/BulkMailing/BAO there is a file named Delete.php with the class CRM\_BulkMailing\_BAO\_Delete:

```
class CRM_BulkMailing_BAO_Delete extends CRM_Contact_BAO_DeleteBase {

  /**
   * Delete older bulk mailing records
   *
   * @param array $parameters
   *  The parameters as defined in scheduled job.
   *  See self::getMailingIdsFromParams() for details
   *  Additionally skip_activity_delete can be set to TRUE so that Activities
   *  related to the deleted mailing should not be deleted.
   *
   * @throws \API_Exception
   * @throws \CiviCRM_API3_Exception
   *
   */
  public static function delete(array $parameters): void {
    $parameters['delete_drafts'] = FALSE;
    $mailingIds = self::getMailingIdsFromParams($parameters);
    if (!empty($mailingIds)) {
      self::deleteMailings($mailingIds);
    }
  }
}

```

For what ever reason before my changes I was able to create a scheduled job for entity BulkMailing and with action Deleteoldrecords. Now I can not.

I find no documentation about how to create custom entities and actions for api v3 - at least none which exactly explains how CiviCRM finds my new entities / actions. All I find is how to use civix to create mass of code which is not actually needed (I am not a fan of these tools creating code for me...). I am sure there are naming conventions which are not documented?! Maybe I have somewhere a typo or a uppercase/lowercase problem which simply leads to this issue?!

Could somebody explain to me a) if there is a way to use api V4 for scheduled jobs (which I would prefer) and b) if not how CiviCRM actually finds out which apiv3 entities and actions are defined by my extension?

# Answer
> 1 votes
Not exactly a scheduled job or an answer to the questions in regard to civix and the api but you may want to have a look at the SQL-Task Extension.

It allows you to configure any number of scheduled tasks via the UI. It is essentially a SQL driven, configurable execution of any of the following generic CiviCRM actions:

* Create activities
* Call any CiviCRM API3 action
* Export to CSV,including zipping, uploading, emailing the results
* Synchronize a SQL result such as a contact ID list with a given tag or group

---
Tags: api, developer, civicrm-entity, scheduled-job
---


# Question
Title: Error: Certificate Authority file is too old. ..\modules\civicrm\vendor\totten\ca-config\src\CA\Config/cacert.pem
Today we wanted to access our civicrm site which is hosted within a bitnami stack but we receive the following error:

Certificate Authority file is too old. Please contact the system administrator. See also: C:\Bitnami\civicrm-5.37.2-0\apps\civicrm\htdocs\sites\all\modules\civicrm\vendor\totten\ca-config\src\CA\Config/cacert.pem

We can't open the civicrm site.

I looked up the expiring date from that cacert.pem file / Global Sign Root CA but the date is far in the future (28.01.2028).

Does anyone know what is causing that problem and probably how to fix it?

I tried google but with no success.

We run civicrm version 5.45.1 on Drupal 7.

# Answer
See https://github.com/totten/ca\_config/issues/2. Core hasn't been updated yet but you can composer require totten/ca-config:~22.05
> 0 votes

# Answer
So that's something I didn't expect....

After digging a bit within our Root Certificates I found out that the name of the current GlobalSign Root CA is actually "GlobalSign Root CA - R1" (in our certificate vault at least).

Inside the cacert.pem file however the name is listed as "GlobalSign Root CA" followed by the Certificate Hash.

After editing the file cacert.pem and adding the "- R1"-part and refreshing the site it immediately worked.

I really don't know why on earth and especially how this got messed up.

Anyway it's working now.
> 0 votes

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


# Question
Title: CIVICRM_TEMPLATE_COMPILEDIR / template_c folder becomes too large. How to empty it periodically?
We realized that the folder which is set in CIVICRM\_TEMPLATE\_COMPILEDIR (in our case as per default: template\_c) became way too large. From time to time it grew so much that we needed to empty it manually. How can this directory be emptied on a periodic basis?

# Answer
> 3 votes
The action Job.cleanup has a parameter tplCache which is set to 0 by default. When the action is called with the parameter set to 1 the folder gets emptied.

1. Create a new scheduled job
2. Choose "Job" as API call and cleanup as action
3. In the parameter textfield add tplCache=1

We chose monthly as the run frequency but this depends on your project.

---
Tags: smarty, scheduled-job, templates, cache
---


# Question
Title: CiviCRM 5.9.1 Cannot Read Database Information
CiviCRM 5.9.1 WordPress 5.0.3 PHP 7.2

Upgraded after migration between servers from 4.7.29 w/o issue. When I went inside the CiviCRM it asked me to redo everything like a new install. I went to the MySQL tables and all of my data is there; however, it is not "read" by the CiviCRM. I even added the :3306 to localhost in the civicrm.settings.php and am simply stumped. I have verified that the database info in the DSN section is identical to the database itself. I am running on Business Cloud so I have access to cPanel, phpMyadmin, and terminal. There are NO entries in the error log file. Server runs LightSpeed; however, I have added comments addressing it for WordFence.

The two images show that there are Contacts in the DB (along with everything else) and that the CiviCRM instance does not find anything other than what I filled out. I have also taken a screenshot of the civicrm.settings.php to show that it is set to access my database and one of the database settings itself.

**ANY** help is **GREATLY** appreciated as I have tried for over a week to set up an account with Mattermost and it still *will not* send me an email link.

# Answer
Sorry for leaving this open for so long. I just simply did a rollback from a previous date and went on from there. Never did figure out what the issue was other than at the time I was at GoDaddy and they were a nightmare. I now run my own cloud based servers and have not had issues since then.
> 0 votes

# Answer
Your DB connection specifies `mysql://`, and you are using PHP7.2. The MySQL extension was deprecated in PHP 5.5 and removed in PHP 7.0.

Try switching the two DB connect strings in `civicrm.settings.php` to use `mysqli://` instead of `mysql://` and see if that resolves the issue.

I would also remove any other changes (eg the addition of port :3306), to eliminate issues caused by other attempts to fix things.

If this resolves it, the cause was the migration from a PHP5 server to a PHP7 server, not an upgrade to CiviCRM 5.9.1.
> 6 votes

# Answer
Since you have access to a terminal, Do you have the wp-cli tool? If so, can you login, go to the civicrm directory (really anywhere under the webroot) and run `wp cv sql-conf` see if the output matches what you are looking at. Then run `wp cv sql-cli` and see if it logs you in to the correct database?

I would also search to see if there are any other civicrm.settings.php files. It could be you have more than one and that is the issue
> 1 votes

---
Tags: wordpress, upgrade, database
---


# Question
Title: How to get Unique Opens with CiviCRM API?
I am getting summary report of email by using CiviCRM API but not able to get the field `Unique Opens` I can see on the report page. Currently I am using this query:

```
$result = civicrm_api3('Mailing', 'stats', [
  'mailing_id' => 10,
]);

```

And this gives me these columns:

```
{'Delivered': '1', 'Bounces': '0', 'Unsubscribers': 0, 'Unique Clicks': '0', 'Opened': '1', 'clickthrough_rate': '0%', 'opened_rate': '100%', 'delivered_rate': '100%'}

```

But not the `Unique Opens` which I need too.

Example email report page:

Any help will be appreciated.

# Answer
> 0 votes
Have you tried passing is\_distinct=1 as a parameter in api? It would show unique clicks and opens

```
$result = civicrm_api3('Mailing', 'stats', [
  'mailing_id' => 12,
  'is_distinct' => 1,
]);

```

---
Tags: api, email
---


# Question
Title: How to redirect all outgoing emails / change recipients before email sending
I want to create a module which alters the recipients of all outgoing emails so that in dev environment email are only sent to developers or testers and not to real users. So the recipients should be altered before sending the email in defined circumstances.

I tried `hook_civicrm_alterMailingRecipients()` but this hooks gets called when I create a mailing and add recipients to the corresponding field. This is not what I need - I don't want to alter the recipients on creation of a mass/bulk mailing.

Is there any way to alter recipients for all outgoing email (indiviual emails, mailings, system mails - if there are any) in any way? In Drupal we have `hook_mail_alter()` which allows to alter just everything in an email and which I used for this functionality already.

# Answer
I would use the alterMailParams hook and replace the to, cc, bcc in $params
> 2 votes

# Answer
You probably want to connect your dev environment to something like mailtrap. That way you'll be able to see the emails in an inbox. The alternative is to set all emails to write to the database instead, theres a setting to do that.
> 0 votes

---
Tags: civimail, email, mailing
---


# Question
Title: How to change the order to last name and first name in the email from header?
I have been trying to send email to my contacts with their name last name and first name order. I mean "To: last\_name first\_name example@example.com"

I have already changed the Display Preference to {contact.last\_name}{ }{contact.first\_name} from the Administrator menu. It works fine for the display and also for CKEditor's to field. It is properly shown as last\_name first\_name order as I wanted.

But when I send an email, email comes with the name by the different order, I mean "To: first\_name last\_name example@example.com", which is not suitable in East Asia. The email header is quite essential to keep our relationships with our contacts.

I tried to find a way to change it but in vain.

Could someone help me how to solve this? Thank you in advance.

# Answer
> 0 votes
It seems to be hardcoded at https://github.com/civicrm/civicrm-core/blob/cb21080b397be5f8b84bca2c6d3483ad64d7071f/CRM/Contact/BAO/Contact.php#L1934

`$name = "{$dao->first_name} {$dao->last_name}";`

I don't see an obvious reason why it's hardcoded, but the function is used in a couple places - maybe there are some places where it was needed to have a "short version" of the display name.

---
Tags: email
---


# Question
Title: Can I add participants to an existing event registration?
I've searched for answers on this but what I have found was either not quite on point or several years old, so I thought I'd check again.

I have an event set up where participants could register themselves plus additional participants. One registrant missed the option to add additional people and only registered herself, and wants my help registering her husband. But I can't see how to add participants manually on my end. "Change selections" doesn't allow me to change the quantity of registrations. (This was a credit card registration).

Is this a thing that can be done or not? Or am I looking in the wrong place?

# Answer
> 0 votes
If you don't need to track that the husband was registered by the wife, you can just add the husband as a new participant through the interface at Events\>Register Event Participant (though if it needs to be paid you will need to have one of them give you a credit card number over the phone). Or have one of them register the husband separately via the method that the wife used originally.

# Answer
> 1 votes
I would add the Husband as a New Participant for the Event. Via API explorer or mysql set civicrm\_participant.registered\_by\_id to wife participant ID.

---
Tags: civievent
---


# Question
Title: Are contacts cached when scheduling a mailing?
This might be a stupid question, but I know some poorly designed systems out there, so I just want to make sure.

Scenario

* Monday - Create an Email - Choose a Group/Smart Group - Schedule it to go out Friday
* Though-out the week, you remove members of the group or if a smart group, it updates and removes members of the group. Let's say 10 people are removed.
* Friday email goes out to the group

Do those 10 people that were removed get the email or does it deliver the email to who is in the group when the email is sent?

# Answer
> 1 votes
Thanks to Demerit and Petednz for answering this in the comments.

The answer is that the email is sent to contacts that were in the group(s) when the email was scheduled, not when it actually sends.

This extension, though with flaws addresses the issue. It recalculates the contact groups before sending the email. However it does not work if you do A/B testing or if you use ACL's to restrict who can send emails to what groups. https://github.com/3sd/civicrm-recalculate-recipients

These gitlab issues discuss this in more detail. https://lab.civicrm.org/dev/core/-/issues/2351 and https://lab.civicrm.org/dev/mail/-/issues/45

---
Tags: civimail, smartgroups
---


# Question
Title: upgrade to 5.49 on Wordpress unzip and file permissions
In following the instructions for upgrading on a wordpress cms (https://docs.civicrm.org/sysadmin/en/latest/upgrade/wordpress/), I backed up all the existing files and renamed the existing civicrm directory incase I have to restore a working copy. I have not deleted the old folder YET.

I loaded the new 5.49.1 zip file and unpacked it into the wp-content/plugins directory which creates a new civicrm folder and underlying folders & files. When I compare the file permissions for each of the newly unpacked folders and files, the new folder and file permissions don't match the file permissions in my currently working set of files & directories.

Can I just go ahead and follow the upgrade instructions from this point, or do I have to be concerned that things will become corrupted and I will have created the biggest headache ever? Or do I have to go through each folder and set the permissions?

# Answer
Did you just rename it or move it completely out of the tree? I'd move it completely out otherwise it might think there are two conflicting copies even with different names.

For permissions, you'd probably want to make it match the previous if it was working before. But in general the below will usually make it "sane" unless the server setup is unusual:

```
cd civicrm
find . -type f -exec chmod 644 \{\} \;
find . -type d -exec chmod 755 \{\} \;

```
> 1 votes

---
Tags: upgrade, permissions
---


title: Download button doesn't drop down

text:
# Question
Title: Download button doesn't drop down
The DOWNLOAD CIVICRM 5.49.1 button on the https://civicrm.org/download doesn't have any drop down options.

# Answer
> 2 votes
You can also find CiviCRM versions on the SourceForge. I'm sure this is a bug tho. Hopefully it will be fixed soon.

https://sourceforge.net/projects/civicrm/files/civicrm-stable/

# Answer
> 0 votes
The download button now has options. Someone has fixed it.

---
Tags: installation
---


# Question
Title: Has anyone found a solution to add an appointment booking element in CiviCRM
We would like our users to be able to book a time slot with our Support team - I was thinking of using Microsoft Booking but am not sure if I can redirect to Civi to confirm. Is anyone using anything different? I there a way to do this in CiviCrm? I am working for a Charity and am not very techinical so would really apprecaite some advice. Thanks

# Answer
> 2 votes
A solution I've seen used in the past uses CiviCRM activities for support slots/ appointments , these are then exposed/ updated via views and webforms. So this is a Drupal specific solution. And, warning, it's admin heavy.

Create Activity type "Appointment" And either extend the activity status list to include a "booked" option, or add a custom field of availability options "available", "booked".

Using CiviCRM's import options you can upload a list of available appointments a week, month in advance

Added by contact= staff member/ team the appointment is with Activity status= scheduled/ available date/ time/ duration etc

You can then build a (calendar?) view of upcoming, scheduled "appointment" activities. And a webform for members of the public to use to update the underlying activity change status to "booked", add contact details of person making the booking as the "with contact" on the activity.

# Answer
> 1 votes
Would you use an activity assigned to the support team? There are ways to create forms that generate activities

---
Tags: repeating-events
---


# Question
Title: How to import relationships with metadata
I can see that I can import relationships as part of the **Contacts » Import** form, but it only seems to let me say that Contact A *is \<predicate\> of* Contact B.

Relationships have: start, end dates, current status ("is active"), note, title + possibly custom fields (I think). Is it possible to populate any of those via an import? Are there extensions that provide this functionality?

# Answer
> 2 votes
I can heartily recommend Eileen's (obviously) Excellent "CSV API Importer" extension

https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport/blob/master/README

Don't have relationship custom data on our set up so can't answer that aspect- but most other relationship fields are there

---
Tags: import, relationships
---


# Question
Title: "The CiviCRM public extensions directory at could not be contacted" -- why is my repo URL empty in the browser but not in `cv`?
**Question:** What could be causing the `ext_repo_url` setting value to be empty when running in the browser, though it appears to be correct when running in `cv`?

Under civicrm 5.35.2, if I visit the Extensions page, I see this message:

> Extension download error
> The CiviCRM public extensions directory at could not be contacted - please check your webserver can make external HTTP requests or contact CiviCRM team on CiviCRM forum.

Notice that it says "extensions directory *at could* not", implying an empty value for the repo URL.

Things seem to work normally using `cv`:

* At the command line I run `cv api Extension.getremote`, I get a full json array of remote extensions.
* From the command line, the setting has what appears to be a correct value.

```
cv api setting.get | grep -i ext_repo_url
"ext_repo_url": "https://civicrm.org/extdir/ver={ver}|cms={uf}",

```
* I also tried a script with `cv scr`, and get what looks like correct output, like so:

```
$ cat /tmp/a.php
<?php
$a = CRM_Extension_System::singleton()->getBrowser()->getRepositoryUrl();
var_dump($a);
$ cv scr /tmp/a.php
string(51) "https://civicrm.org/extdir/ver=5.35.2|cms=WordPress"

```

But for content called from the browser, the repo setting appears to be empty. To test, I added this code to an existing extension:

```
function activityical_civicrm_pageRun(&$page) {
  $page_name = $page->getVar('_name');
$repo = CRM_Extension_System::singleton()->getBrowser()->getRepositoryUrl();
echo "<!-- page_name: $page_name -->\n";
echo "<!-- repo_url: $repo  -->\n";

```

And then I view the page source at https://REDACTED.example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fextensions&reset=1 , which says:

```
<!-- page_name: CRM_Admin_Page_Extensions -->
<!-- repo_url:  -->
<!DOCTYPE html>

```

Also tried:

* `cv flush` and `wp cache flush` do not make any change in the above findings.

# Answer
Turns out this site was long ago upgraded from an older version that lacked `global $civicrm_settings` variable definition as called for in this (5-year-old) commit in civicrm.settings.php.tpl.

Simply adding that variable definition cleared up the problem immediately. (Naturally there were other important things to change in civicrm.settings.php, so of course if you have this problem, you've probably got others.)
> 2 votes

---
Tags: extension, settings
---


# Question
Title: List members of organisation belonging to sub-types
I have my organisation split between local sport clubs. I'm looking for a best way to list all members of particular clubs - should I use Drupal Views or Civi search'es or reports? Thnx R.

# Answer
> 2 votes
Searchkit looks like it can pull in related contact data

Search view that shows the mutual relationships between two contacts

There's a bit of a learning curve, but I found this overview from a recent CiviCRM meetup really helpful

https://youtu.be/-YJyRt02vvw

# Answer
> 1 votes
Partly depends who needs to see the report but we tend to build all such results in Drupal Views.

---
Tags: drupal-views
---


# Question
Title: How can I change the date format in a Search Kit result?
I have a Search Kit search that shows the date like this: `November 1st, 2012 12:00 AM`. I want to reformat this as `11/01/22`. How can I do this?

# Answer
> 10 votes
* You must be on CiviCRM 5.47+ to have the "Use Smarty in Search Kit rewrites" feature.
* Create a Search Display based on your search - e.g. **Add » Table** using the **Add** button in the left pane.
* Find your date field and check the **Rewrite** box. You'll see a token that represents your date, e.g. `[receive_date]`.
* Change the rewrite value to the following. Substitute your token for `[receive_date]` below.

```
{"[receive_date]"|date_format:"%D"}

```

A full list of date formatting options is available in the Smarty date\_format documentation.

(Ignore the older rewrite text in the screenshot, the value above is the improved version!)

---
Tags: smarty, dates, searchkit, formatting
---


# Question
Title: Changing membership prices and deciding to whom they should apply
Prices need to increase at end of Financial Year.

So if someone's end date is eg EOFY -1, then they should pay existing price, even if they renew after their End Date (ie any time till end of Grace period)

if someone's end date is eg EOFY +1, then they should pay new price, even if they renew before the EOFY date.

Thoughts?

# Answer
Approach we are considering is CiviDiscount which lets us set a discount to apply to specified contacts (eg those in a Group whose End Date is before EOFY) and to apply automatically to a Membership

Hence

* we increase the price of memberships on day X (well before the EOFY)
* we set up the 'group' that the Discount applies to as a group for everyone whose End Date is before EOFY so the outcome should be
* folk in that Group see the discounted rate
* those with renewal dates after EOFY see the new rate regardless of when they renew
> 1 votes

---
Tags: civimember, renewals
---


title: New Member entry in Civi

text:
# Question
Title: New Member entry in Civi
What is the proper way to enter a new member (that is also a new company in the database). I tried to do this via "memberships" "new member" and it did not seem correct and gave me an error message about missing a membership ID. Is it necessary to add a new organization via "contact" first?

# Answer
> 1 votes
Welcome!

It's a little hard to answer your question with just the info you gave and no screenshots, but I'll try my best.

When I go to **Memberships » New Membership**, this is the screen I see:

Note that the **Member** field allows me to either type in the name of an existing contact, or I can press **New Organization** (or Individual or Household) to create the contact on the fly.

To help us help you, it would be good to share the exact text of the error message and not a paraphrase. Also, it's helpful to edit your original question so other folks see the whole issue at once.

---
Tags: civimember, contacts, organization
---


# Question
Title: How do I find the headers of bounced emails using traditional mailing in civiCRM
All my bulk emails from civiCRM bounce and the recipient is put on hold. The bounce report lists SYNTAX.

I brought this to the attention of my hosting company and they replied "please provide us with the full email headers of one of the bounce-back messages."

Trouble is I cannot locate a bounced email to provide the headers. Where are these located in civiCRM?

My civiCRM instance: civiCRM: 5.40.3; Drupal: 7.80

# Answer
> 1 votes
I don't think there is a way to see the email headers of sent emails via Civi unless you have received the email yourself. If you can get an email to be sent to yourself, you can view the headers from there.

Here are the tables that you can investigate, but I haven't been able to find anywhere that headers would be available.

In the `civicrm_mailing_bounce_type` db table, you can see the bounce reasons.

```
SELECT * FROM civicrm_mailing_bounce_type;

```

SYNTAX means you should probably check your SMTP settings and send a test email to yourself.

If you aren't receieving a test email, check your FROM address (Administer \> CiviMail \> From Email Addresses) and ensure that it matches your domain or is recognized as an email account by your ISP.

# Answer
> 1 votes
The Bounce Report has a "Bounce Reason" that's separate from the "Bounce Type" and contains more information - but it's still just the body, not the mail headers.

Getting the mail headers depends on how your Mail Account (**Administer menu » CiviMail » Mail Accounts**) is set up.

Assuming you're not doing bounce handling through an extension, there should be an email account listed as the *Bounce Processing* mail account. Log into that account manually - e.g. if it's "civibounces@gmail.com", log into GMail with the appropriate email and password.

From there, you should see a folder called `CiviMail.processed`. In there you'll find the bounce messages.

---
Tags: civimail, mailserver
---


# Question
Title: Find Contacts Custom Searches Zip Code Range Search lists duplicates
I entered a range of zip codes and the selected records were duplicated. How do I go about reporting the issue to have my request analyzed for an error on my part or get bug fixed?

# Answer
Your question suggests you're using the Zip Code Range custom search - but this is a *very* old way to handle zip code range searches, from before Advanced Search could do them (10-12 years ago). In my opinion, this search should have been removed a long time ago, but that's an issue if someone has a smart group built on it.

The more-modern (though not most modern!) way to do a zip code range search is **Search menu » Advanced Search**. Check the **Range** box (see screenshot) in the *Address Fields* above *Postal Code*.

The *most* modern approach is to use Search Kit, but despite being more powerful than Advanced Search, it's also got a steeper learning curve, so I recommend Advanced Search for now.
> 2 votes

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


# Question
Title: How to change english coupon text field into polish text
I have a problem with some fields in english. I have a polish version of CiviCRM, but the field "If you have a discount code, enter it here" is in english.

Here is our website: https://crm.mieszkanicznik.org.pl/oplacenie-czlonkostwa/

Where can I find this field and where can I change this text into polish?

Could you send me some tips how can I do it?

I'll be waiting for your reply.

Best regards, Mietek

# Answer
> 0 votes
It's coming from the cividiscount extension. Maybe you didn't download the translations for the extension? The easiest way is with https://github.com/cividesk/com.cividesk.l10n.update. See also https://lab.civicrm.org/dev/translation/-/wikis/extension-translation#installing-translation-mo-files-for-an-extension

If there is no Polish translation for that extension, then you can do a quick manual replacement at Administer - Customize Data and Screens - Word Replacements.

---
Tags: wordpress
---


title: Redundant Indexes

text:
# Question
Title: Redundant Indexes
It looks like there are several redundant or partly redundant indexes that civicrm creates on the database. Some of this may be storage engine specific (e.g. InnoDB), but some isn't.

civicrm\_contact:

```
PRIMARY KEY (`id`)
KEY `index_is_deleted_sort_name` (`is_deleted`,`sort_name`,`id`)

```

In this case, the id suffix on the index\_is\_deleted\_sort\_name index is redundant for InnoDB which contains the PK as the payload in each index entry.

civicrm\_discount:

```
KEY `index_entity` (`entity_table`,`entity_id`)
KEY `index_entity_option_id` (`entity_table`,`entity_id`,`price_set_id`)

```

index\_entity is a prefix subset of index\_entity\_option\_id which makes it completely redundant.

civicrm\_entity\_file:

```
KEY `index_entity` (`entity_table`,`entity_id`)
UNIQUE KEY `UI_entity_table_entity_id_file_id` (`entity_table`,`entity_id`,`file_id`)

```

index\_entity is a prefix subset of UI\_entity\_table\_entity\_id\_file\_id which makes it completely redundant.

civicrm\_financial\_type

```
UNIQUE KEY `UI_id` (`id`)
PRIMARY KEY (`id`)

```

PKs are implicitly unique, so the unique key on id is completely redundant.

civicrm\_iats\_journal:

```
KEY `tnid_2` (`tnid`)
UNIQUE KEY `tnid` (`tnid`)

```

tnid\_2 is redundant.

civicrm\_line\_item:

```
KEY `index_entity` (`entity_table`,`entity_id`)
UNIQUE KEY `UI_line_item_value` (`entity_table`,`entity_id`,`contribution_id`,`price_field_value_id`,`price_field_id`)

```

index\_entity is redundant.

civicrm\_queue\_item:

```
KEY `index_queueids` (`queue_name`,`weight`,`id`)
PRIMARY KEY (`id`)

```

PK suffix is redundant in index\_queueids.

civirule\_action:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_condition:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_rule:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_rule\_action:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_rule\_condition:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_rule\_log:

```
KEY `rule_idx` (`rule_id`)
KEY `rule_contact_idx` (`rule_id`,`contact_id`)

```

rule\_idx is redundant.

civirule\_rule\_tag:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

civirule\_trigger:

```
UNIQUE KEY `id_UNIQUE` (`id`)
PRIMARY KEY (`id`)

```

id\_UNIQUE is redundant.

I think these qualify as performance bugs as each redundancy will add overhead on writes and memory usage.

# Answer
> 2 votes
To reduce apparently "unanswered" questions...

The answer here is:

1. yes, you're right, good catch! The suggestions that relate to CiviCRM core have been acted upon, thanks for contributing! See the issue and the merge request.
2. the way to report problems is to submit an issue checking that there's not one there already. This is the right thing to do if you can't fix the issue yourself.
3. the way to suggest improvements is through submitting a "pull" or "merge" request (PR/MR)

There's more about (2) and (3) in the developer docs

And finally of relevance: issues and pull/merge requests for *extensions* will be found in the repository for that extension; typically on https://lab.civicrm.org or somewhere on github (look at the extension's info.xml file for the repo address).

---
Tags: database, issues, performance, datatables
---


# Question
Title: How to get the Financial Type name/label in Smarty template?
I am using Thank You letter template to generate donation receipt. After using Find Contributions, I then choose All Records and from Actions I choose Thank You Letters.

I can then add smarty logic and am able to show the contacts name and address as well as some things like date of contribution ($contribution.receive\_date) and the total amount of contribution ($contribution.total\_amount) and also the ID of the Financial Type ($contribution.financial\_type\_id)

But I am not able to figure out how to get the following:

* Financial Type Name ($contribution.financial\_type\_id.name does not work.. always returns 1)
* Contribution Source ($contribution.source does not work.. always returns blank)
* Financial Type Is Deductible ($contribution.financial\_type\_id.is\_deductible does not work.. always returns 1)

I am basing what I am doing from this answer by Iowa Boy How to print USA tax receipt to individuals?

# Answer
> 3 votes
Well after MUCH testing and playing around, I figured out what I needed, and I post it here in hopes it will help other noobs...

* Financial Type Name was retreived using `$contribution.financial_type`
* Contribution Source was retrieved using `$contribution.contribution_source`
* Financial Type Is Deductible was not available in the data that was already retreived, so had to make another call to find that out. Using the Financial Type ID from `$contribution.financial_type_id`, I did the following:

```
{crmAPI var='resultFinancialType' entity='FinancialType' action='get' id=$financial_type_id}
{assign var="financial_type_is_deductible" value=$resultFinancialType.values[0].is_deductible}
{if $financial_type_is_deductible eq '1'}
   {assign var="financial_type_is_deductible" value="Tax-Deductible"}
{else}
   {assign var="financial_type_is_deductible" value="Non tax deductible"}
{/if}

```

---
Tags: wordpress, civicontribute, receipts, smarty
---


title: Basic Wordpress user cannot see CiviCRM

text:
# Question
Title: Basic Wordpress user cannot see CiviCRM
I have installed CiviCRM on Wordpress and done the setup. I have created a basic (subscriber role) in WP, have filled the Permissions (Access Control) table for this role, synchronized the WP contacts with CiviCRM. When this user logs into WP, he do not see the CiviCRM menus nor dashboard... What is the CiviCRM URL for this user ? I have read the documentation, but nothing about it... Which configuration is missing ? Thanks for your help

---

*** Next to my question ***

First of all, I have not designed other roles than the two that are predefined : Administrator and Authenticated. As I understand, I do not need other roles for the moment. My test user has the Subscriber role in Wordpress. I also have read carefully the documentation.

Next, I have logged in as Administrator in Wordpress&CiviCRM. In the CiviCRM top menu, I go to Administer -\>Users and Permissions -\> Permissions (Access Control). And there, I enter in WordPress Access Control. I see then an ACL table and I have checked quite all boxes under the Subscriber column.

But nothing changed : a subscriber user does not see the CiviCRM plugin. And the CiviCRM dashboard for this user does not show even if I type "https://mysite.org/wp-content/plugins/CiviCRM (is this the correct url for CiviCRM under Wordpress ?)

Thanks a lot for your help.

---

I'm still stuck with my access privileges problem. Users connected with the "subscriber" role in WordPress do not see the CiviCRM menu in the left WordPress menu. However, it seems that I have configured correctly the permissions in Administer -\> Users & Permissions -\> WordPress Access Control. Any ideas? Many thanks

# Answer
After having tested all the possibilities by checking and unchecking all the options marked in the WordPress Access Control pane, I found that the box "CiviCRM: access CiviCRM backend and API" must be be ticked. Otherwise you dont have access to CiviCRM. Strange because it is told to give this to trusted roles only. The well done documentation is unfortunately lacking on this subject.
> 1 votes

# Answer
When you edit a role its the first item under "Other Capabilities"
> 0 votes

# Answer
The URL i have for getting to civicrm under WP is:

https://mysite.com/wp-admin/admin.php?page=CiviCRM

do you have any plugin that controls visibility of menus by roles?
> 0 votes

# Answer
Thanks a lot for your details. It definitely helped me solve my very similar issue. Just as an update, if it can help anyone, I actually enabled the **"CiviCRM: access AJAX API"** permission for the "Subscriber" and "Anonymous User" roles, as I got the error on a public donation payment page where even the non-registered users should have access to.
> 0 votes

---
Tags: wordpress, installation, user-account, urls
---


# Question
Title: What are all the reasons a CiviCRM URL would return a 404?
So, I already solved this before (RESOLVED: "Review your contribution" returns a 404 after it worked before on CiviContribute Member Contribution page), but it seems to have come back with a minor vengeance. WordPress 5.9.3, CiviCRM now 5.48.0. I did an extension update of Stripe this weekend which had issues. The resolution there was to change the old base page of 'crm' (last time this happened, I did that because someone probably me accidentally deleted the blank civicrm WordPress page) was changed to a new base page of 'civicrm' so it was back to the default name. Oddly, while that fixed the Stripe payment processing contribution page (and may have broken events, not sure) that caused URLs to use civicrm-2, which turned out to be because the original base page was chosen as Welcome at install time way back when because that's the only page that was there, which I guess updated the post\_name to civicrm, so the new civicrm got -2 added to it? Would be nice to be able to edit that within WordPress, but I guess that's what phpMyAdmin is for. In any event, I cleared out all old civicrm pages, flipped the base page to a temporary one, then flipped it back to civicrm (flushing cache every time I changed that, in the unconfirmed thought that this is necessary), hoping that would do what needed to be done.

But now, every single CiviCRM URL gives a 404. Shortcodes in WordPress pages seem to work. But of course that's not going to work out too well as the original problem from before -- review your contribution returns a 404 -- is back.

But, the fix that worked before isn't working. So, what ELSE could be going on here? Does the post\_name not matter so much as ... something else?

The website is https://members.marylandtesla.com. Try to become a member and you get a 404 on the review contribution step. The upcoming events (which the Civi event widget isn't actually showing a new test event while it does show up with a shortcode in a page, not sure if that's a clue) all give 404s too unless I use specific shortcodes.

So far just typing this up hasn't given me any more ideas to see what's going on. Help?

Here's the base page config to prove it's there:

Thanks.

Michael

# Answer
So, I missed the part in the documentation that says you should really have AllowOverride not set to None in the Apache http configuration file for .htaccess. I went and did a fresh install (preserving everything via backup of course) and ran into some similar errors there just when trying to set my permalink structure to just %post\_name%. Still running into a weird issue with CiviCRM system status page not displaying, and the Stripe payment text field is like a pixel high now (no idea how that one happened yet), but my 404 error has been resolved.
> 1 votes

---
Tags: civievent, civicontribute, base-page
---


title: Check Group Permission in Drupal Views

text:
# Question
Title: Check Group Permission in Drupal Views
I have a Drupal 7 Views that produces a case activities report. It has columns like scheduled activity date, contact id, notes, etc. The user can search by contact id and all activities related to that contact id appears. From this post, this is because CiviCRM Entity does not respect CiviCRM's ACL permission.

I want to see if it's possible to restrict the case activities that only show up if the user has an existing group relationship to the case records. I think I'm close. I have the Group ID as a relationship (access control: clients). I just can't get Views to check the login user's CiviCRM group and validate it against the civicrm ACL.

For example: User A belongs to Group A (staff group). In the ACL, Group A can view contacts from Group B (the clients). When the user uses the case activities report, they should only be able to search contacts to which they have the ACL access from in Group B (not Group C, D, etc.).

The challenge is filtering on the activities on the user login's group ID.

# Answer
> 0 votes
To have it so the View only shows 'My Cases' you can build the View based on CiviCRM Relationships then use Contextual Filters to filter to get only those relationships that associate to the current user, and then join on the Case.

---
Tags: groups, drupal-views
---