title: Best way to configure IDS?

text:
# Question
Title: Best way to configure IDS?
Civicrm has a built-in layer of intrusion detection using a library called PHPIDS. Unfortunately, I often have to disable for webhooks and other things that get trapped. For example, using the mandrill extension, the system flags the webhook as an intrusion.

I'm sure there is a way to hack/patch the code, but is an IDS configuration profile supported somehow? I couldn't find any documentation.

# Answer
> 1 votes
Assuming the webhook runs as a specific user, you can disable the IDS (it's one of the permission)

So if you create (on drupal) a role "trusted user", disable the IDS check permission for that role only and grant that role to the webhook user, you should be ok

# Answer
> 0 votes
I recall this issue and seem to recall we addressed it some time ago in the Mandrill extension with assistance from Tim Otten. Maybe check the github issue queue for the extension. Are you running the latest version of Mandrill extension? I'll try put out a new version by Tuesday.

# Answer
> 0 votes
You can programmatically exclude certain URLs from IDS checks using the idsExcpetion hook. That seems like the safest approach.

The mandrill issue references the mailgun extension README file which says you can set the constant `CIVICRM_IDS_SKIP` to a serialized array of paths to skip because core has been patched - but I tried grepping the code for that constant and don't see it anywhere.

---
Tags: security
---


# Question
Title: CRM/Core/Config.php line 41 throwing 500 error with new require_once api/api.php
Just updated our WP install from 4.7.22 to 4.7.23 -- but can't run the db update script, because whenever I rename the 4.7.23 folder to *civicrm*, I subsequently get 500 internal server errors while trying to load *any* civicrm pages. Error log indicates a problem at line 41 in CRM/Core/Config.php, which is `require_once 'api/api.php';` ... so I searched the previous working iteration (it runs fine when I switch back to 4.7.22) and there is no mention of `api/api.php` anywhere. So I assume this line is new in 4.7.23, and I have to wonder why it's making civicrm completely unusable for our site.

Ideas?

More detail from the error message:

`PHP Fatal error: require_once(): Failed opening required 'api/api.php' (include_path='.:/wp-content/plugins/civicrm/civicrm:/wp-content/plugins/civicrm/civicrm/packages:/wp-content/plugins/civicrm/civicrm/vendor/tecnickcom:/wp-content/plugins/civicrm/civicrm/vendor/phpseclib/phpseclib/phpseclib:/wp-content/plugins/civicrm/civicrm/vendor/pear/pear_exception:/wp-content/plugins/civicrm/civicrm/vendor/pear/auth_sasl:/wp-content/plugins/civicrm/civicrm/vendor/pear/net_socket:/wp-content/plugins/civicrm/civicrm/vendor/pear/net_smtp:/wp-content/plugins/civicrm/civicrm/vendor/pear/validate_finance_creditcard:.:/wp-content/plugins/civicrm/civicrm/:/wp-content/plugins/civicrm/civicrm//packages:.:/usr/lib/php:/usr/local/lib/php') in /wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php on line 41`

# Answer
> 1 votes
First, let the record show that I am an idiot.

After uploading 4.7.23 (the new version) to /wp-content/plugins, I neglected to copy the pre-existing *civicrm.config.php* into /wp-content/plugins/civicrm4.7.23/civicrm ... thereby depriving the system of (at very least) a working value for `$civicrm_root`.

It was suggested to me that my civicrm.config.php was probably off, and I checked it just to make sure the `$civicrm_root` value made sense. The value was good, but the file I was checking was located outside of the plugins directory -- this was a clue, and I missed it. As I said, I'm an idiot.

Of course, once I copied the old civicrm.config.php into the new /wp-content/plugins/civicrm/civicrm, everything worked perfectly. Except for CRON jobs, of course -- but that's another matter.

# Answer
> 0 votes
Ok that's odd - `require_once 'api/api/php';` has been there since CiviCRM switched from SVN to GitHub.

https://github.com/civicrm/civicrm-core/blame/master/CRM/Core/Config.php#L41

So something else is going on; do you perhaps have two civicrm directories in your file structure? Simply renaming 4.7.22 to civicrm-old and 4.7.23 to civicrm will not work. Make sure to move the civicrm-old completely out and away.

Added: make sure you do everything in exact order:

* move 4.7.23 code out and away
* revert back to 4.7.22 db
* move 4.7.22 code -\> civicrm
* make sure it's working
* remove 4.7.22 code out and way
* put the 4.7.23 code -\> civicrm
* run the database upgrade script
* make sure it's working

---
Tags: api, configuration, upgrade, 500
---


# Question
Title: Another CRON headache: fwrite() expects parameter 1 to be resource, string given in … /WP_CLI/Loggers/Base.php
CRON was behaving as expected for a few days, but now I'm getting this: `Warning: fwrite() expects parameter 1 to be resource, string given in [REDACTED]/WP_CLI/Loggers/Base.php on line 57`

Any idea what's causing this?

# Answer
> 0 votes
This one may have been something as simple as a bad username in my CRON script. I say *may* have been because scheduled jobs are running again, but not consistently. It seems that they run automatically whenever I'm logged into SHELL, but not when I'm logged out.

More to the point of this question, I'd been successfully using an email address as the username in the CRON script. This worked for about three days. When I changed the email address to the WP username, it started working again -- but only (I think) until logged out of SHELL. Currently I'm testing to verify a causal relationship, and if one exists, I'll post a new question.

---
Tags: wordpress, cron-job, cron, wp
---


# Question
Title: How can I update a credit/debit card number, card billing address, or card expiration date to continue transaction processing - on Authorize.net
We're on CiviCRM 4.6.19, Drupal 7.50 and using Authorize.net for payment processing.

When a credit/debit card number, card billing address, or card expiration date has changed, should simply updating the subscription with the new card info in Authorize for an ongoing monthly sustainer continue the processing uninterrupted, on the same date?

UPDATE for clarification - The monthly/recurring *amount* will remain the same. The goal is to resume the same monthly/recurring contribution in the same amount by fixing an error with processing by updating the "subscription" in Authorize with the new card number, billing address and/or expiration date.

# Answer
> 1 votes
Automatic recurring billing is an extra feature in Authnet (ARB) that you usually have to request. In order for Authnet to communicate to the CiviCRM that a recurring transaction has taken place, you must install a **silent post URL** in the designated field within the Authnet portal, under **Account \> Settings \> Silent Post URL**.

The silent post URL for a Drupal site is: `https://yoursite.org/sites/all/modules/civicrm/extern/authorizeIPN.php`

Once that's established, the credit card and billing information would need to be managed through the Authnet portal since CiviCRM does not store credit card numbers. If you update the information proactively, it should update everything else in the CRM automatically.

https://wiki.civicrm.org/confluence/display/CRMDOC/Authorize.net+Configuration

# Answer
> 0 votes
Yes if you update the subscription it will update the amount that you have updated but it wont interrupt the processing or date of transaction unless you edit that date.

# Answer
> 0 votes
I believe that what you are looking for is answered here:

Editing Recurring Contributions without user login

However, to re-process the current month, I'm asking that question over here:

How to re-process failed recurring contributions after updating card info?

# Answer
> 0 votes
Added authorize.net to your Title; with the iATS Extension you manage your contacts and their recurring series from within CiviCRM so you can eg change someone's credit card number associated with a series - from within CiviCRM (and thus not interrupting and processing);

---
Tags: civicontribute, civimember, authorize.net
---


# Question
Title: Contributions: Error Cancelling Contribution The recurring contribution could not be cancelled
When our users go to the cancel contribution link in their confirmation email and select "Cancel Contribution" they get the following error: Error Cancelling Contribution The recurring contribution could not be cancelled.

Furthermore, if I am logged in and try the same link, I am able to cancel to contribution, but only if I deselect "Send cancellation request to PayPal Pro ?". Otherwise I get the same error.

Any ideas?

CiviCRM 4.7.14 / Drupal 7.53

# Answer
The problem you're describing is a known bug, which is documented at CRM-20800. A patch was submitted yesterday; by testing this patch, you can speed its inclusion into an upcoming version of CiviCRM.
> 1 votes

---
Tags: civicontribute
---


# Question
Title: Can someone help me fix a "greyed out" save button for a new contribution?
Using D7 civiCRM 4.7.22. The "save" button is greyed out in the back end new contribution form (and the "confirm contribution" button in online forms) after upgrade to 4.7.22. This happens as soon as I select a payment method other than default in the back end. e.g. the default is "check", if I select "cash" then the save button is greyed out. This also happens in the online form (no payment method is available for selection, but if the default isn't set as "credit card" then the "confirm contribution" button is greyed out).

This was all working as expected in 4.6 before upgrade.

Thanks for your thoughts!

# Answer
> 4 votes
This is likely to be a resource URL issue - the way these fields are calculated has changed in CiviCRM 4.7.

Please look at **Administer menu » System Settings » Resource URLs** and **Administer menu » System Settings » Directories**. Please ensure that both of these look correct. Note that you might see a token (e.g. `[cms.root]`) as part of your URLs and paths - you can press the little question mark in the blue circle at the top of the page to see what those tokens expand to.

\[See comments below for my final fix which was to to go to system settings -\> clean up caches and update paths - JR\]

---
Tags: civicontribute, upgrade, payment-processor, iats, payment
---


# Question
Title: Prevent Event Registration for a Specific Role (Drupal)
Is it possible to prevent a user with a specific role from being able to register for ANY EVENT?

There is a Drupal permission for event registration. It is unchecked for that role, but doesn't seem to have any affect (assuming since anonymous is allowed to register) as users with that role can still register. On the CiviCRM side there are ACLs. If I allow "everyone" to register then it includes all roles. I don't see any way to exclude them.

This is pretty important as we have a global login for several users. People don't read clearly and end up registering as the wrong person...

Thanks!

# Answer
You can do this with a custom extension - I recommend checking out the documentation for hook\_civicrm\_aclGroup and maybe for hook\_civicrm\_permission as well - the second hook will give you an easy UI to control which roles can't register. The good news is that this is a simple extension as these things go - maybe 30 lines of code should do you.

Without a custom extension, there's no way to do this that I can think of. However, consider a) having a separate login for each user, and b) installing the No Overwrite extension as alternatives to mitigate this issue.
> 1 votes

---
Tags: civievent, permissions, registration, online-registration
---


# Question
Title: CiviVolunteer permissions to allow registered (Drupal) users to view assignment details
I've just set up CiviVolunteer, and set permissions for both anonymous and authenticated users to sign up for volunteer opportunities. (That is, they have Drupal permissions for Access AJAX API and CiviVolunteer: Register to Volunteer.) I have set up the user Dashboard to show "Assigned Activities" and authenticated users can see their volunteer assignments listed. So far, so good!

The "Your Assigned Activities" section begins with the message, "Click on the activity subject for more information." However, when I click on an assignment subject while logged in as a non-administrator role, I get the "Access denied. You are not authorized to access this page." error.

Where can I set the permissions for users to view more information about the assignment, as suggested by the note and obvious links?

Also, is there any way for authenticated, non-administrator users to change their assignments? (Either through the Dashboard list of assigned activities, or through returning to the CiviVolunteer sign-up page and seeing a list of assignments that they already have?) This doesn't seem to be part of the CiviVolunteer permissions, but I'm wondering if there is something else that would do. Note that my users already have Access CiviCRM permissions.

Thanks!

# Answer
Rowan...

First, I think you want to remove "Access CiviCRM" from all users, unless you want them to be able to access CiviCRM's back end. Ordinarily, you assign that to people who have access to database functions (entering and updating contacts, recording donations, etc) and not people who just need access to the contact dashboard.

I'm pretty sure that the permissions you need to assign to the Authenticated User role (or another role if that's more appropriate) are "View My Contact" and "Edit My Contact." Volunteer assignments are stored in CiviCRM as activities and the contact permission also gives you access to the activities associated with a contact.

There currently isn't a built-in UI for volunteers to update their assignments, although there has been work done for volunteers to report their hours worked. The lead developer, Frank Gomez, is out of the office this week. I'll make sure he sees this and can give you a better idea of when this will be released. On Drupal, it might be possible to create something with the Views and Webform CiviCRM modules.

Other clients have requested some type of Volunteer Dashboard functionality. Everyone's idea of what this entails is a bit different, though. I'll reach out to you separately to get some details about what you're looking for.
> 1 votes

# Answer
If I'm not mistaken, the screen Rowan is referring to is the Contact Dashboard (civicrm/user), which is part of CiviCRM core rather than CiviVolunteer, and when an appropriately-permissioned user clicks the activity subject, the activity details appear in a modal.

I'd guess that the reason your volunteer users are getting "Access Denied" errors is that viewing the activity requires "view" permissions for one or more of the other contacts on the record. An activity typically references three contacts: the assignee (the volunteer), the assigner (varies), and the target (the beneficiary, usually the default organization in the CiviCRM instance).

A few ways to get what Rowan wants:

* **Grant the volunteers the "View All Contacts" permission.** This is almost certainly not what you want, but it's a quick way to verify that the problem is that volunteers don't have "view" on the target organization. A test like this is best performed in a sandbox.
* **Create an ACL rule so that your volunteers can view specific contacts other than themselves.** You'll need to create an actors group (i.e., which contacts are being granted additional permissions) and an asset group (i.e., to which contacts do said permissions apply). The asset group will contain the default organization and any other contacts all volunteers should be able to view. The actors group will contain the volunteers. Potential drawback: the actors group cannot be a smart group; membership in the group is handled explicitly, which might be cumbersome depending on your workflows. If necessary, membership in a static group can managed automatically via custom code.
* **Use custom code to alter how permissions are evaluated.** There a few hooks which may be leveraged to allow contacts to view activities where they are the assignee, regardless of their permissions over the other associated contacts.
* **Develop a custom volunteer dashboard.** CiviVolunteer doesn't include a dashboard for volunteers, and trying to shoehorn one into CiviCRM core interfaces that were designed for different purposes is likely to be painful and unrewarding.
> 1 votes

---
Tags: permissions, civivolunteer
---


# Question
Title: How do I put a Brown Paper Ticket ticket sale button on our CiviCRM main page
The website for our performing arts organization got handed off to me and I have very little CiviCRM experience.

Where in the user controls do I put the Brown Paper Tickets code that create a usable Button on our website? You help is appreciated.

# Answer
> 1 votes
welcome. you may need to dig out some more info to help folk here help you. I for one had to google to find that Brown Paper tickets is a third party event ticketing systems. GIven that civicrm has CiviEvent for its own event management system, your question may not be civicrm specific rather than a CMS question. Or it may be that your site has some customisation for this.

---
Tags: button
---


# Question
Title: How to add a custom field in Civicase that can be retrieved later?
My question sounds simple, but... to explain. We are using Civicase to manage mentoring. I want to add from 1 to 6 mentoring goals for each case - these would be text fields individual to each case. When the mentoring is completed (months later) the goals are then 'picked' as ones which best matched to our funder's 4 targets. My problem is that I can't see a custom field to hold these goals that would do this or just lack the imagination on how to manipulate Civi to achieve this! I'm using 4.7 with Drupal, have about 5 years Civi experience but prefer not to code. Would a webform be the answer? Maybe I just create 6 text fields, each one with an associated drop down select with the funder's targets - but that seems a bit clumsy. It seems that what I need to do is to allow the user to enter data into a select box, but that doesn't seem possible with custom fields.

# Answer
> 1 votes
One answer is to create a set of fields, set to use for 'cases', then add your six text fields to that set, then set up a webform that is set to Create or Edit a Case, and display those fields.

That said, I can't quite picture your use-case.

You say "Maybe I just create 6 text fields, each one with an associated drop down select with the funder's targets".

It may help if you can provide a specific example in your question.

---
Tags: drupal, custom-fields, webform-civicrm, civicase, 4.7
---


# Question
Title: Webform (Contact Create API) doesn't set Communication Style
I have a webform set up as a Contact page that creates a civi contact and activity and assigns it. I have a scheduled reminder send out a "Thanks for contacting us...we'll get back to you asap..." email after the activity is created. There's an issue where Webform doesn't allow the Communication Format to be set and we use that in how we format our Email Greeting. We have Formal communication preference set as default option in Civi but when Webform creates the contact for some reason that default doesn't get set and so when the contact record is viewed there's no communication format at all.

What are the options to fix this? Can Webform be updated to be able to set the communication format?

# Answer
> 1 votes
If Communication Style is set to Formal -\> is\_default on:

```
civicrm/admin/options/communication_style?reset=1

```

Then that's what shows in the Contact record (see below); Are you saying that webform\_civicrm removes this default for existing contacts; or that new contacts have their is\_default set wrong?

**Added:** I've confirmed that creating a New Contact with the API leaves the Communication Style 'blank'. However one would expect it should be setting it to the default value that is specified in the Administer settings.

So it's an API issue - we could fix this in webform\_civicrm - by explicitly passing on a value for Parameter Communication Style - but I think it should be fixed in CiviCRM Core itself.

# Answer
> 0 votes
This looks like a bug in core. Either an incorrect blank is set as a parameter from API layer before calling lower down, or the lower level BAO is not setting default correctly. Fr Tommy, could you create an issue in JIRA on this, including link to here, then assign the issue to Josh and mark as PIQ. My guess is that it would cost about $125 - $250 to fix the bug and add a test to ensure the API works properly on this.

---
Tags: drupal, contacts, webform-civicrm
---


# Question
Title: How can I generate an internal URL to a CiviCRM page based on certain parameters?
What functions exist within CiviCRM that make it easy for me to generate internal URLs?

# Answer
> 4 votes
### In PHP

```
CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$contactID")

```

See code-level docs for `CRM_Utils_System::url` for more details.

### In Smarty

```
{crmURL p='civicrm/contact/view' q="reset=1&cid=`$contactID`"}

```

See code-level docs for `CRM_Utils_System::url` for more details.

### In Javascript

```
CRM.url('civicrm/contact/view', {"reset": 1, "cid": contactID});

```

See code-level docs in `civicrm/js/crm.ajax.js` for `CRM.url` for more details.

*This content was migrated here from the Cheatsheet wiki page as part of the 2017 wiki content migration project.*

---
Tags: developer
---


# Question
Title: CiviCRM identifies itself over SMTP as 'localhost' while sending CiviMail via CLI
CiviCRM should say ...

```
EHLO example.com

```

... in the SMTP dialogue as it sends email. And it does when the email is being sent via a browser.

But when the email is being send via a CLI batch job, CiviCRM says ...

```
EHLO localhost

```

... which some email hosts interpret as a SPAM source.

Any thoughts?

# Answer
> 1 votes
I created CRM-20982 to fix this

---
Tags: civimail
---


# Question
Title: Copying the CiviCRM installation in a different machine
I am trying to make a copy of my CiviCRM installation on WordPress in a different machine. I ma mainly trying this just as a practice for future upgrading of CiviCRM versions and also as a backup.

I am caught up in a deadlock. both these options are failing. I don't which of the two options I should proceed with and how.

In machine 2,

1. I installed wordpress. created a database for Civicrm through PHPMyAdmin. copied the data from original database to new one. Activiating CiviCRM fails.
2. I installed wordpress. created a database for Civicrm through PHPMyAdmin. Activated CiviCRM. Tried copying the data alone from original database to new one. It fails with below error " Duplicate entry '1' for key 'PRIMARY'"

INSERT INTO `civicrm_acl` (`id`, `name`, `deny`, `entity_table`, `entity_id`, `operation`, `object_table`, `object_id`, `acl_table`, `acl_id`, `is_active`) VALUES (1, 'Edit All Contacts', 0, 'civicrm\_acl\_role', 1, 'Edit', 'civicrm\_saved\_search', 0, NULL, NULL, 1), (2, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'access CiviMail subscribe/unsubscribe pages', NULL, NULL, NULL, 1), (3, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'access all custom data', NULL, NULL, NULL, 1), (4, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'make online contributions', NULL, NULL, NULL, 1), (5, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'make online pledges', NULL, NULL, NULL, 1), (6, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'profile listings and forms', NULL, NULL, NULL, 1), (7, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'view event info', NULL, NULL, NULL, 1), (8, 'Core ACL', 0, 'civicrm\_acl\_role', 0, 'All', 'register for events', NULL, NULL, NULL, 1), (9, 'Core ACL', 0, 'civicrm\_acl\_\[...\] MySQL said: Documentation

# 1062 - Duplicate entry '1' for key 'PRIMARY'

# Answer
https://wiki.civicrm.org/confluence/display/CRMDOC/Moving+the+database+using+phpMyAdmin

I found this useful. Getting it done through phpMyAdmin
> 1 votes

# Answer
See documentation on moving an existing installation to a new server or location on this link: https://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location
> 3 votes

# Answer
It sounds like you didn't delete the existing CiviCRM MySQL database before importing the new one.
> 0 votes

---
Tags: wordpress, database, installation, civicrm.settings.php
---


# Question
Title: after upgrade to 4.6.26 getting PHP Fatal error when starting a new mailing
I just upgraded from 4.6.23 to 4.6.26. I'm on wordpress. Everything else seems to work fine. When I start a new mailing I get this error:

> PHP Fatal error: Call to undefined method CRM\_Mailing\_BAO\_Mailing: :getTemplateTypes() in ...wp-content/plugins/civicrm/civicrm/CRM/Mailing/Info.php on line 168, referer: ...

I see that getTemplateTypes is new for 4.6.26. I see in civicrm/CRM/Mailing/BAO/Mailing.php that the function is defined there.

I've commented out the reference to getTemplateTypes in civicrm/CRM/Mailing/Info.php and that allows me to start a new mailing, but now I'm getting this PHP warning:

> PHP Warning: call\_user\_func() expects parameter 1 to be a valid c allback, class 'CRM\_Mailing\_BAO\_Mailing' does not have a method 'getTemplateTypeNames' in .../civicrm/CRM/Core/PseudoConstant.php on line 277, ...

# Answer
> 2 votes
This means CRM\_Mailing\_BAO\_Mailing class is overriden somewhere. This could be due to a civicrm extension like mailjet that overrides Mailing.php

Please check which extension is overriding it and either disable that extension or update Mailing.php in it.

Let me know if it works!

Thanks.

---
Tags: mailing
---


# Question
Title: Redirection to Organization Dashboard in Employer of Relationship
When you create an Employer of relationship in Civicrm and the person who signs up on behalf of the Organization logs in he is usually redirected to his own dashboard. How do you redirect civicrm such that when he logs in he is redirected to the dashboard of the Organization? Any help will be appreciated. I know that a redirect wil be implemented but what is the url of the organization dashboard? Am using Civicrm 4.6.8 with wordpress 4.4.2

# Answer
No need to redirect.

1. Make sure that in the employee's Contact \> Relationships tab that by Permissions it is checked that the Employee can View and Edit the Employer Contact.
2. When the Employee logs into their dashboard, scroll all the way to the bottom and you will see a Relationship section showing "employee" as Employee of "Employer". Over to the right you will see Edit Contact Information & Dashboard. This will allow you to access the "Employer" Dashboard.
> 1 votes

---
Tags: user-dashboard
---


# Question
Title: How can Wordpress user edit Organisation details?
I'm sorry if this has been asked before but I can't find a solution...

I've created a custom Profile for an Individual's contact details and one for their Organisation's contact details. I've added shortcodes for both of these to separate pages in Wordpress. The user that I'm logged in with has an associated Individual contact record in CiviCRM and that Individial is an Employee of an Organization. I've also made sure the Individiual has access rights to edit the Organization contact details. This relationship was initially created via a Contribution page using profiles to both capture the users personal details and organization details using the 'on behalf of profile'. All good in that a logged in user can edit their Individual contact details, but when I try and access the page in Wordpress where the shortcode is for the Organization profile I get message:

```
This profile is configured for contact type 'Organization'. It cannot be used to edit contacts of other types.

```

What am I doing wrong? How can an individual edit his organisation's details?

# Answer
there is another option you might not know about. Users can be given access to their "My Contact Dashboard" eg at civicrm/user?reset=1 (in Drupal it is at that path).

And if X has permissioned relationship over Y, and if you have not unset it from /civicrm/admin/setting/preferences/display?reset=1 then X should see Y listed, and should be able to 'edit' (some of) their details. hth
> 1 votes

# Answer
No need for a different shortcode. (At least in CiviCRM 4.7.22)

1. Make sure that in the employee's Contact \> Relationships tab that by Permissions it is checked that the Employee can View and Edit the Employer Contact.
2. When the Employee logs into their dashboard, scroll all the way to the bottom and you will see a Relationship section showing "employee" as Employee of "Employer". Over to the right you will see Edit Contact Information & Dashboard. This will allow you to access the "Employer" Dashboard.
> 0 votes

---
Tags: wordpress
---


# Question
Title: Where is the "Allow Other Amounts?" option?
If you see the screen shot, from CiviCRM 4.7.22 on Wordpress, isn't there supposed to be an "Allow Other Amounts?" option to check under the "Recurring Donations" option? According to these instructions, there is supposed to be.

https://wiki.civicrm.org/confluence/display/CRMDOC/Contribution+Amounts

> Check the Allow Other Amounts? box to allow donors to enter custom amounts for their donation. This will add a field to your contribution page labeled Other Amount. Selecting this option will allow you to set a minimum and maximum amount that can be donated, if desired.

# Answer
If you look at http://dmaster.demo.civicrm.org/civicrm/admin/contribute/amount?reset=1&action=update&id=1 you will see the field as per the bottom of this screenshot
> 1 votes

# Answer
Thank you,

I resolved the problem. I was trying to use a Price Set on the Contribution Page and that is what was removing all fields below "Recurring Donations." When I deselected that Price Set and just entered the prices manually more fields appeared, including the "Allow other amounts" checkbox.

This was all done on CiviCRM 4.7.22 on Wordpress.
> 0 votes

---
Tags: contributions, contribution-page, 4.7
---


title: Extension download error

text:
# Question
Title: Extension download error
I am trying to install CiviVolunteer. When I go to extensions I get two errors:

"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."

and

"Unable to download extension from /single. Error Message: malformed"

Help!

Thanks!

# Answer
I don't know if this is related to your download problem, but CiviVolunteer is currently incompatible with CiviCRM versions 4.7.21 and greater.

There is a beta version described here which restores partial functionality.
> 1 votes

# Answer
This sounds like a permissions error; your webserver must have permissions to download files into a designated directory (which you specify in Adminster -\> System Settings -\> Directories); make sure you select a directory that is writeable; then you can install extensions for your CiviCRM.

Just re-reading your question; the above is part of the puzzle; the other part is that the CiviCRM extensions directory must be available; if that error persists please do report back. Please see here for a description on that error by one of the Core Team members: Error reaching public extensions directory
> 1 votes

---
Tags: extension, error, civivolunteer
---


# Question
Title: Subscribe to group via a webform - pass in group Id
I'm using Drupal, CiviCRM, CiviCRM Entity and Webform CiviCRM.

My hope is to link an "activity" (described on a Drupal node) to a group ("Sign up for news about this activity").

So the Group Id would be stored in a field on the Drupal node, and when I click "Sign up" I'm taken to a form where I can sign up to that group.

Is there a way of doing that with Webform CiviCRM?

I've tried setting "Enable Tags and Groups Fields" to "Yes" but I can't see how to pass in the Group Id.

Cheers!

# Answer
Here's the code I wrote to achieve my goal ...

```
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if (strpos($form['#id'], 'webform-client-form-') === 0) {
    if (in_array(
      'default-via-parameter',
      $form['submitted']['mailing_list']['civicrm_1_contact_1_other_group']['#attributes']['class'])
    ) {
      $params = drupal_get_query_parameters();
      if (filter_var($params['gid'], FILTER_VALIDATE_INT, array('options' => array('min_range' => 1)))) {
        $form['submitted']['mailing_list']['civicrm_1_contact_1_other_group']['#default_value'] = array($params['gid']);
      }
    }
  }
}

```

Details ...

* Check if it's the right form
* Check that I want to allow the default to be overwritten (via a CSS class attached to the field)
* Check if the Group Id is supplied as an argument, and is valid
* Set the default group to the one supplied

The form can be used without supplying a default to choose any group. If a default is supplied the user can use this, or even override it
> 3 votes

# Answer
Why not just use webform\_civicrm? You can inject Markup elements on a webform to dress up you page; and then with Groups -\> - User Select - you can get complete control over what Groups people can select from and you can customize their label:

First add Groups to your form in the webform tab:

Hit Edit on the Webform Element (labeled Group):

On the form it looks like this - and you can even change the Label for Group(s) to Newsletter(s)
> 2 votes

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


# Question
Title: get name and email in exchange for free PDF
We would like to get leads by offering a free PDF in exchange for name and email. Ideally, would like to eliminate bogus/spammy leads before either emailing them the PDF or allowing them into an online library where they could download it themselves. Any suggestions about the best way to go about this?

WordPress 4.8.1

CiviCRM 4.7.21

# Answer
> 1 votes
For emailing the PDF my approach would be to use a mix of Forms(WP plugin)/Profiles and Scheduled reminders or CiviRules. For granting access to an online PDF library I suggest you ask a separate question.

**Setup**

1. Create a custom activity type ie *PDF request*, and a couple of message templates, one for the welcome/thank you email on request (ie activity status Scheduled) and second one with the actual PDF or link to the PDF, when approved (ie activity status Completed). You can go cray cray and create your own, more descriptive, statuses ie *For review*.
2. Set up a Scheduled reminder or CiviRule for the *PDF request* activity with status Scheduled to send the welcome/thank you email.
3. Set up a Scheduled reminder or CiviRule for the *PDF request* activity with status Completed to send the PDF/link to PDF email.

**Workflow**

User fills in form/profile and submits it, contact and *PDF request* activity with status *Scheduled* is created on form submission, user receives welcome email, admin is notified, admin reviews contact/lead and approves the lead updating activity status to *Completed*, lead receives PDF/link to PDF email. With **CiviRules** you can create even more powerful and crazy workflows!

**Implementation**

* The Profile path would need a bit of custom development, using the appropriate form/profile hooks in an extension to create a *PDF request* activity type with status Scheduled on form submission that would trigger the described workflow.
* Using Forms you have a couple of options, the Gravity Forms CiviCRM integration (paid add-on for Gravity Forms) and the Caldera Forms CiviCRM integration (free and open source), both will allow you to create an activity on form submission without the need of custom development.

**Disclaimer**: I'm the developer of the Caldera Forms CiviCRM integration.

# Answer
> 0 votes
Search for Download Manager plugin for WordPress. There are several out there.

---
Tags: wordpress, email
---


title: Event Date Stamps Messed up?

text:
# Question
Title: Event Date Stamps Messed up?
I have been using events for a while and this just started happening - not sure if it is related to moving from one host to another since everything is functioning as expected. When I select a template or edit an event, the date/time stamps change to 2 boxes with the calendar icon in one, but not usable.
So I added some events without a template and get the single box with a selectable date, but they don't show on my calendar now and when I select Events, Show Events Calendar it returns to the Civicrm admin front page. Any suggestions on how to resolve?? I am on 4.7.18 and was going to upgrade to 4.7.23 but am hesitant with this error. I did do the upgrade on my test environment and when I saw this error in production, I went back to the upgraded test environment and the issue is there too.

# Answer
> 2 votes
So this issue was quite obscure but I went through my wordpress plugins one at a time, deactivated and tested and this one: "Social Icons Widget by WPZOOM" was at fault! Once I deactivated that plugin, events started to work correctly again. This plugin was part of a recent site update on our test, it apparently passed all the tests and was promoted to our production system. Time to check the testing checklist again.

---
Tags: civievent
---


# Question
Title: Why are all my iATS recurring payments for EFT/ACH marked as "pending incomplete transaction"?
This occured today, after upgrade from 4.6 to 4.7. The recurring credit cards appear to be updating properly in civiCRM, but not the EFT/ACH. More importantly, it also appears that the transactions in question did not transact at iatspayment.com. Is my EFT payment processor not set up properly?

I am running Civi 4.7.22 and iATS extension version 1.6.

# Answer
Pending / Incomplete is expected for ACHEFT - it can stay in that status for days depending on when iATS connects with the bank/credit union the debit account is with.

On iATSPayments.com -\> look under Journal -\> ACHEFT transactions -\> ACHEFT details

Next make sure your recurring jobs are running. Esp the ACHEFT verify one -\> that's the one that will check w/ iATS if any of the pending / incomplete ACHEFT can be updated to completed in CiviCRM.
> 0 votes

---
Tags: civicontribute, payment-processor, iats, payment
---


# Question
Title: Why do I need so extensive permissions for getting event participant via API?
I'm trying to get participant info via CiviCRM API like this:

```
civicrm_api('Participant', 'get',
   array(
      'version' => 3,
      'sequential' => 1,
      'contact_id' => $contact_id,
      'event_id' => $event_id
   )
);

```

but get the following error:

> API permission check failed for Event/get call; insufficient permission: require access CiviCRM and access CiviEvent and view event info

I need to allow **unauthorized users** to access CiviCRM ("**Master control** for access to the main CiviCRM backend and API") and CiviEvent ("**Create events**, view all events, and view participant records (for visible contacts)") to solve this. Aren't those permissions to extensive, just to get some info about a participant? Or am I doing something wrong?

I'm using CiviCRM 4.7.23. I did not get this error in 4.7.14.

EDIT: I do not have to set these permissons to create a participant via API (which is OK). So I think there is definitely something wrong here.

# Answer
> 2 votes
I'm not sure what context you are doing this in, but since you are calling the API from php, you can pass in the param `'check_permissions' => FALSE` to bypass the ACLs for the logged in user. This is useful when you know you want to get something from the api that the logged in user wouldn't normally be able to access. Just be careful!

---
Tags: civievent, api, permissions
---


# Question
Title: Why does outbound email stop working after enabling the PHP Mcrypt extension?
On a CiviCRM 4.6.30 / Drupal 7 installation using the com.cividesk.email.sparkpost extension, outbound email stopped working after enabling the PHP Mcrypt extension on the server. This affected both CiviMail and transactional emails.

Why would this occur and how can it be resolved?

# Answer
> 3 votes
CiviCRM has a utility class CRM\_Utils\_Crypt for encryption & decryption. If PHP Mcrypt is installed, it uses that plus base64 encoding. If not, it falls back to using just base64.

This class is used for encrypting some settings, including:

* `smtpPassword` in core 4.6.30
* `sparkpost_apiKey` in com.cividesk.email.sparkpost

PHP Mcrypt was not initially installed on the server, so these settings will have been encoded by CRM\_Utils\_Crypt::encrypt() just using base64\_encode.

Once PHP Mcrypt is installed, CRM\_Utils\_Crypt::decrypt() will try to decrypt these settings using mcrypt functions. This fails in this case, because they weren't encrypted with mcrypt when they were entered.

The simplest solution is to re-enter the settings. They will then be stored encrypted with mcrypt. If this wasn't feasible, it should be possible to write a script to decode specified settings using the non-mcrypt method and then encrypt and store them using mcrypt.

A few thoughts...

1. If Mcrypt is not installed, settings are not being stored encrypted. It would be good if site admins were made aware of this, perhaps via the System Status page. This could also warn of the consequences of enabling Mcrypt on a server where Civi is already configured.
2. The conditional code in CRM\_Utils\_Crypt::encrypt() & decrypt(), which falls back to just base64 encoding, appears to have been added for PHP 5.2 compatibility on Windows: see Email Configuration at https://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Configuration . As CiviCRM no longer supports PHP 5.2, the reason for this change seems no longer to apply and perhaps we should make Mcrypt a requirement. However...
3. The PHP Mcrypt extension has been deprecated as of PHP 7.1.0 and moved to PECL as of PHP 7.2.0. Comments there say:

* "This extension rely in libmcrypt which is dead, unmaintained since 2007."
    * "Avoiding mcrypt is only half of the advice. The other half: NEVER do crypto in PHP in the first place!" \[It goes on to give some good arguments and alternatives.\]

In summary, I think Civi should not leave it to chance, when it comes to deciding whether or not to encrypt something, whether a particular PHP extension is installed or not. It should at least warn site admins, if not require a suitable encryption method to be available. Which method that should be needs discussion, given the deprecation of PHP Mcrypt.

---
Tags: email, sparkpost
---


# Question
Title: Is there a way to re-send failed transactional emails using SparkPost email extension?
Have been using the com.cividesk.email.sparkpost extension (v1.1) successfully on Civi 4.6.30 . Recently had an issue due to installing PHP mcrypt on the server, which caused the extension to be unable to retrieve the SparkPost API key. \[More accurately: the call to `CRM_Sparkpost::getSetting('sparkpost_apiKey')` was returning a scrambled value.\] This was resolved, once the problem was diagnosed, by re-entering the API key. (I've written a separate Q&A about that issue, as it's not SparkPost specific.)

During the time when the API key couldn't be accessed, numerous transactional emails and CiviMails should have gone out. The CiviMails can be re-sent easily enough but what's the way to deal with the transactional emails? There's no record in the extension's log file of mails that attempted to send during this period. Is there any queueing system for failed messages? Because the API key couldn't be correctly retrieved, presumably the messages won't have been linked to the user's SparkPost account. The SparkPost stats show no messages over that period.

# Answer
> 2 votes
I have two outside ideas that 'might' be helpful:

1. Is it possible Activities have been made for the emails that should have gone out? Emails from the Contact record will almost certainly have created an activity, and it's a commonly set option for emails sent via Scheduled reminders. If an activity has been made it will probably contain the email.
2. Do you have email logging turned on? Presumably not or you wouldn't be asking the question! But perhaps worth checking...

---
Tags: sparkpost
---


# Question
Title: Scheduled Reminders - Limit or Add Recipients
I am using CiviCRM 4.7.22 on WordPress.

I am having some confusion with setting up Scheduled Reminders for Memberships. Ideally, I would like the member to receive an automatic email notice that their membership account is about to expire 30 days before the End Date.

The "Limit or Add Recipients" field is what is causing me confusion. There are three options: "Neither", "Limit to", and "Also Include". How does this need to be set to ensure that only the member whose account is about to expire is automatically sent an email notice?

I am thinking just leaving it at "neither" is all I need to do, but I am not sure and the documentation is not helping to ease my confusion. I am hoping someone can help clear this up for me.

Thank you.

# Answer
The field basically means, having selected who should get the reminder based on the Entity settings, do you then want to further restrict who gets it, and/or do you want to include folk who don't meet the Entity criteria to also get it.

If you just want the folk who should get it, to get it, then use Neither
> 1 votes

# Answer
The help screen on the "Limit to" and "also include" options is confusing. But I have it set to "Neither" and it works just fine.

Hope this helps.
> 0 votes

---
Tags: scheduled-reminders
---


# Question
Title: Automatic discount if participant on other event
I want to give automatic discounts to participants if they already are participating in another event.

I have explored the API and have some clues on how to look up participants on "the other event". But I don't understand

* How can I check if the current registering contact is in that list
* How do I turn this into something that can be applied during/after the registration process
* Where do I put that code, or whatever the "something" is

I could not find any documentation for the "automatic discount" part of CiviDiscount. Hints on where to find that are also helpful.

Edit:

I found CiviCRM Additional Events signup which sounded like a good fit but could not get that to work in a quick check, unfortunately.

# Answer
> 3 votes
If CiviDiscount can be offered to those in a Smart Group, you could make a Smart Group of folk signed up to the first event.

Also read CiviDiscount based on group membership if you haven't already in case it gives other hints

# Answer
> 1 votes
Sounds like the best fit would be to use the advanced filter under automatic discounts. More information can be found here:

https://github.com/dlobo/org.civicrm.module.cividiscount/blob/master/README.md

---
Tags: civievent, cividiscount
---


title: Scheduled Reminders - Renewal Link

text:
# Question
Title: Scheduled Reminders - Renewal Link
Civicrm 4.7.22 on Wordpress.

Hello, I copied and pasted the below link into the HTML format area of the scheduled reminders for renewing memberships. I changed the "myorganization" part to my own domain. When I click it in the email it will not load a page and even said "Too many redirects". Am I using this link wrong? What is the right way to link to the renewal page?

http://www.myorganization.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=N&{contact.checksum}&cid={contact.contact\_id}

Thank you.

\***UPDATE\**** The link issue has been resolved. It now works. However, it links to the home page where the header widget and sidebar are visible. I would rather have it linked to a different page where none of that distracting information is visible. How do I do that? I don't see an option for overriding the page with the renewal form when I create a new page in wordpress.

\****UPDATE\*** I resolved the problem. Simply change myorganization.org/?page=CiviCRM&q=civicrm/contribute/…;{contact.checksum}&cid={contact.contact\_id}

to

myorganization.org/civicrm/?page=CiviCRM&q=civicrm/…;{contact.checksum}&cid={contact.contact\_id} or whatever url you want the renewal form to appear in.

# Answer
> 2 votes
"&id=N": N must be replaced with an integer. View your contribution page and look at the value of id in the URL.

---
Tags: scheduled-reminders
---


# Question
Title: CiviCRM on Wordpress - Suppressing 'Administer' Menu items
Top Menu --\> "Administer" I'd like to suppress **ALL** the menu items like "Administration Console" through "System Settings" but **allow** all the other menu items like :

* Civi Campaign
* Civi Case
* Civi Report
* Civi Discount

Thanks.

# Answer
Some of the menus will change based on the permissions you set for each user role in WordPress Access Control under 'Administer\>User and Permissions\>Permissions (access control)'

Then under 'Administer\>Customize Data and Screens\>Navigation Menu' you can set permissions for each menu item by right clicking on the item and selecting edit.

You should be able to get the menus setup for each role as you need them. May take a bit to tweak it.

Hope this helps.
> 1 votes

---
Tags: wordpress, permissions, menu
---


title: Profiles automatically adding to Groups

text:
# Question
Title: Profiles automatically adding to Groups
I am using CiviCRM 4.7.22 on Wordpress.

In the profile creation advanced settings, we have the option of automatically adding the person to a specific group when they fill out the profile form.

I have two groups, Donors and Members. Members get access to restricted areas, while donors do not.

My dilemma is, if someone who already has a membership account decides to submit a separate donation, is he then going to be removed from the Membership group and placed in the Donors group?

Thank you.

# Answer
> 1 votes
They should be just added to the Donor group. This should not effect the existing group memberships.

---
Tags: profile, groups
---


# Question
Title: Restrict access to webinar after registration in CiviEvent
We are registering webinar participants through CiviCRM event pages, so each participant becomes a CiviCRM contact associated with one or more webinar-type events. Some of these webinars are paid events. Is there a good way to restrict access to a webinar based on the information in CiviCRM? We'd like to be able to restrict access so that only paid participants can access the paid webinars, even if someone else gets the webinar link, for instance.

We have not settled on a webinar platform yet, though we are leaning towards Zoom. Another possibility is Blackboard/Collaborate.

Any thoughts/suggestions would be welcome.

WordPress 4.8.1

CiviCRM 4.7.21

# Answer
> 1 votes
While integrations aren't hard to write for a coder, there are obviously a lot of webinar/CiviCRM integrations that haven't been written yet. So if you're not interested in coding (or hiring a coder), I believe your two options are GoToWebinar and Moodle.

---
Tags: wordpress, civievent
---


# Question
Title: How to remove certain items of custom fields when sending a offline receipt?
I have 2 set of custom fields for contributions and certain items of that are not meant for donors to see, only for admin purpose. But they are automatically included in offline receipt. How Can I remove them from the offline receipt?

# Answer
> 2 votes
If you want to stop *all* custom fields appearing in receipts, you can edit the Contribution - Receipt (off-line) template directly, in 'Message Templates'.

Remove the section starting with {if $customGroup} through to the next {/if}, and give that a try.

If it turns out it's using the on-line receipt (I'm always getting confused as to which is used when), it's the same but with {if $customPost}.

# Answer
> 2 votes
As of September 2017 (4.7.25) this is now possible without any coding changes (see CRM-20507). Simply uncheck the "Is this Custom Data Set public?" box.

# Answer
> 0 votes
Access control on custom fields is at the level of custom field sets. One way to achieve what you want might be to put the fields that should be seen by donors in one custom field set and the admin-only fields in another set. Then use ACL to restrict who can see the admin-only custom field set. Test carefully to make sure that the access control is correctly applied for receipts.

# Answer
> 0 votes
Here's a patch that screens out custom fields that belong to groups that are private. This code assumes that anonymous users are not granted the 'access all custom data' permission, and ACLs are used to make custom groups public.

```
--- a/CRM/Event/Form/Participant.php    2015-05-20 16:30:37.000000000 +1000
+++ b/CRM/Event/Form/Participant.php    2015-10-28 15:06:16.000000000 +1100
@@ -1602,9 +1602,28 @@

       $template = CRM_Core_Smarty::singleton();
       $customGroup = array();
+
+      // Assume the receipt is being sent to an anonymous user. This code emulates
+      // CRM_Core_Permission::customGroup() being called for an anonymous user, and
+      // assumes that anonymous users are not granted the 'access all custom data'
+      // permission. Anonymous users are only shown public custom data groups.
+      $publicGroups = CRM_ACL_BAO_ACL::group(
+        CRM_Core_Permission::VIEW,
+        0,
+        'civicrm_custom_group',
+        CRM_Core_PseudoConstant::get(
+            'CRM_Core_DAO_CustomField',
+            'custom_group_id',
+            array('fresh' => FALSE)
+        )
+      );
+
       //format submitted data
       foreach ($params['custom'] as $fieldID => $values) {
         foreach ($values as $fieldValue) {
+          if (in_array($fieldValue['custom_group_id'], $publicGroups) === FALSE) {
+            continue;
+          }
           $customValue = array('data' => $fieldValue['value']);
           $customFields[$fieldID]['id'] = $fieldID;
           $formattedValue = CRM_Core_BAO_CustomGroup::formatCustomValues($customValue, $customFields[$fieldID], TRUE);

```

---
Tags: civicontribute, email
---


# Question
Title: How can I hide non-mailing list groups in receipts?
At the moment, when someone signs up for a membership or makes a contribution, the receipt returns a list of their newsletter subscription groups AND non-mailing lists group assignments.

How can I hide the non-mailing lists group assignments from the receipt?

# Answer
> 1 votes
In CiviCRM 4.6+, this only happens if the user receiving the receipt has a user account, and that account has the "View All Contacts" permission. See CRM-16433 for details.

---
Tags: civimail, email, groups, receipts, templates
---


title: Restrict case clients to organizations?

text:
# Question
Title: Restrict case clients to organizations?
Is there a way i could restrict case clients to organizations only when creating a new case?

Wouldn't necessarily need to only show orgs in the autocomplete search, as long as submitting was restricted to orgs only..

I'm using Drupal 7 and latest CiviCRM

Thanks!

# Answer
> 1 votes
You should check what the webform\_civicrm module offers as it allows for Cases to be created, and in theory if you set the Contact on the webform to be restricted to Organisation, then you may get the outcome you require.

If not, please expand on your question with more specific requirements

---
Tags: civicase
---


# Question
Title: How remove fields from default price set
I have a membership signup/renewal page that also allows for additional contributions using the standard fee table (no price sets). Since upgrading to 4.7.23 the online membership page is showing previously deleted options from the additional contribution fee table. How can I remove these (my understanding is they are stored in a default price set)?

# Answer
Even when you're not using a price set, modern versions of CiviCRM store the contribution amounts on a Contribution page as a Price Set internally.

CiviCRM doesn't let Price Fields be deleted when the Set has already been used to store data as potentially data loss could occur.

Therefore I think the best option is to disable them, or switch to using a real Price Set.

Also see Unable to delete Price Field from Price Set used for Contributions
> 1 votes

---
Tags: civimember, contribution-page, price-sets
---


# Question
Title: Online Registration Confirmation throws an error after Paypal checkout is done
After upgrading from 4.7.18 to 4.7.22 (maybe it has nothing to do with that) -

I check out and pay via Paypal in an online registration page, I get redirected to the Thank You page, where I can review my info and click Confirm. After clicking confirm, I get an error saying:

```
DB Error: no such field

Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/tamera/www/www/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php on line 107

```

The new registration is not listed then in Civi, the participant is not registered, nor the payment that he did, although the payment was already done (which creates a lot of problems with refunds and explanations).

```
And in the logs I can see these 3 messages in that moment:

Notice: Undefined index: feeamt in CRM_Core_Payment_PayPalImpl->doExpressCheckout() (line 333 of /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).

$Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -19 [message] => DB Error: no such field [mode] => 16 [debug_info] => INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [type] => DB_Error [user_info] => INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list']"] )

$backTrace =
#0 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(229): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")
#4 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE)
#6 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE)
#9 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'card_type_id' in 'field list'")
#10 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")
#12 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")
#13 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1068): DB_DataObject->_query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")
#14 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(495): DB_DataObject->insert()
#15 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/BAO/FinancialTrxn.php(66): CRM_Core_DAO->save()
#16 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(3451): CRM_Core_BAO_FinancialTrxn::create((Array:15))
#17 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(234): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:28))
#18 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(1043): CRM_Contribute_BAO_Contribution::add((Array:28), (Array:0))
#19 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(611): CRM_Event_Form_Registration_Confirm::processContribution(Object(CRM_Event_Form_Registration_Confirm), (Array:57), (Array:56), "122808", FALSE, FALSE, (Array:23))
#20 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Event_Form_Registration_Confirm->postProcess()
#21 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
#22 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")
#23 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")
#24 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")
#25 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
#26 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(310): CRM_Core_Controller->run((Array:3), NULL)
#27 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
#28 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#29 /home/tamera/www/www/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#30 [internal function](): civicrm_invoke("event", "register")
#31 /home/tamera/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
#32 /home/tamera/www/www/index.php(21): menu_execute_active_handler()
#33 {main}

```

# Answer
This is the most important part of the error:

```
Unknown column 'card_type_id' in 'field list'

```

A feature added since 4.7.18 is the ability to store the type of credit card used during a credit card transaction. So a new field `card_type_id` was created to store that data.

Your copy of the database doesn't have this field.

I think the most likely explanation is that you upgraded CiviCRM's file system without visiting the page that upgrades the database. From your backtrace, I can see you're running Drupal; please try visiting `http://<your_drupal_home>/civicrm/upgrade?reset=1` (reference: Drupal upgrade instructions step 11).

The second possibility is that there's a bug in the upgrade script that prevented this field from being added - but this is the first I've heard of someone having this problem. Please try to run the upgrade script again and see if it resolves your issue.
> 1 votes

# Answer
OK, found it. For some reason the log table log\_civicrm\_financial\_trxn did not have the card\_type\_id column, therefore the trigger that tried to log any action on the table threw an exception. Once I added the column manually to the log table, the problem was solved.
> 1 votes

---
Tags: civievent, online-registration, payment
---


# Question
Title: Where can I see the database upgrade script?
I want to see which indices were supposed to be created in the last upgrade I ran because I get a status report message saying that some indices are missing, but when I click "Update Indices" I get an error saying "DB Error: already exists". So I'm pretty sure some of the indices are missing, but not all of them. So I want to manually create only the missing ones.

# Answer
> 1 votes
There are a number of other threads around this issue and you may find the specific advice you need if you read through them eg

How to find and/or fix missing indices?

or this one

Missing indices status after upgrading to CiviCRM 4.7.21 on WordPress 4.8

---
Tags: upgrade, database
---


# Question
Title: Is there a limit to the number of fields that can be included in a profile?
The organisation I work with is successfully using CiviCRM (with Joomla) for online event registration. However it seems as if there is a limit of 20 fields in the regaistration profile we use.

Twenty fields are easily used with name, address sex, dietary needs and other questions. Has anyone else hit a field limit and how did you overcome it?

thank you.

# Answer
> 1 votes
While I have not run into a limit of 20 that I can remember you can add additional profiles to a registration page. This could be a workaround for you. I generally will use additional profiles to group fields under profile titles (i.e. special requests & Special needs).

Hope this helps.

---
Tags: profile
---


# Question
Title: How can I fix [civicrm.root] variable on an addon domain?
I believe `[civicrm.root]` is being computed incorrectly. Entering the absolute URLs in `Settings > Resource URLs` has been sufficient to fix most problems, but some problems persist.

For example, when i encounter an error like crm.ckeditor.js getting an error, the console tells me it can't find it at `https://mysite.org/mysite.org/wp-content/plugins/civicrm/civicrm/js/wysiwyg/crm.ckeditor.js.`

You'll notice that `mysite.org` is repeated.

I'm running (CiviCRM 4.7.22) on an "Addon Domain" on my host. When you manage files for your addon domains, they show up as a folder on in your file manager. So my Civi files are installed at:

* `/home/username/public_html/mysite.org/wp-content/plugins/civicrm/civicrm/`

I assume that when Civi is computing the `[civicrm.root]` variable, it just assumes it can replace `/home/username/public_html` with the base url defined by `CIVICRM_UF_BASEURL`, which would explain why I'm getting this `https://mysite.org/mysite.org/wp-content...`.

So how do I fix this permanently? Clearly using absolute URLs in `Settings > Resource URLs` isn't sufficient for every case. To clarify the values frrom `settings.civicrm.php`:

* `define( 'CIVICRM_UF_BASEURL' , 'https://mysite.org/');`
* `$civicrm_root = '/home/user/public_html/mysite.org/wp-content/plugins/civicrm/civicrm/';`

# Answer
> 3 votes
**tl;dr: Uncomment and fill in the** `define('CIVICRM_CMSDIR', '/path/to/install/root/');` in `civicrm.settings.php`.

I traced through the functions that go toward building the URL for loadins `crm.ckeditor.js`. It seems there's a problem with the logic of the WordPress cmsRootPath function.

I can't tell you what the specific issue you're having that's causing that function to fail; I know it struggles with symlinks, and I'd guess there's other edge cases as well.

If I understand this line of code correctly, in addition to `$civicrm_root`, there's also a lesser-known cousin `CIVICRM_CMSDIR`, which is actually the relevant data here. In my 4.7.22 WordPress instance's `civicrm.settings.php`, that constant is present but commented out.

See also: CRM-18221 for what appears to be a similar issue on earlier versions of Civi 4.7.

---
Tags: wordpress, civimail, civicrm.settings.php, resource-urls
---


# Question
Title: Scheduled Reminders DB Error v 4.7 under Drupal
After upgrading to v 4.7.16 in May, the scheduled reminders do not run. I get "DB Error: syntax error"

Here's the query from the log. I cut & pasted so I hope I got all the information someone needs.

I saw another similar problem with v4.7.16 but it didn't quite match what I'm experiencing.

```
    [debug_info] =>
SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_membership" as entity_table, 7 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time
FROM civicrm_membership e
INNER JOIN civicrm_group_contact_cache grp ON e.contact_id = grp.contact_id
INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0
INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND
reminder.entity_id          = e.id AND
reminder.entity_table       = 'civicrm_membership' AND
reminder.action_schedule_id = 7
WHERE (e.membership_type_id IN ("1", "2", "3")) AND (( e.is_override IS NULL OR e.is_override = 0 )) AND (e.contact_id NOT IN (41, 40, 42, 77, 92, 230, 231)) AND (e.status_id IN (8, 1, 2, 3, 4)) AND ( grp.group_id IN (2)) AND ("20170814100212" <= DATE_SUB(e.end_date, INTERVAL  hour)) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table
HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20170814100212 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 YEAR)))
 [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY rem' at line 9]
    [type] => DB_Error
    [user_info] => SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_membership" as entity_table, 7 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time
FROM civicrm_membership e
INNER JOIN civicrm_group_contact_cache grp ON e.contact_id = grp.contact_id
INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0
INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND
reminder.entity_id          = e.id AND
reminder.entity_table       = 'civicrm_membership' AND
reminder.action_schedule_id = 7
WHERE (e.membership_type_id IN ("1", "2", "3")) AND (( e.is_override IS NULL OR e.is_override = 0 )) AND (e.contact_id NOT IN (41, 40, 42, 77, 92, 230, 231)) AND (e.status_id IN (8, 1, 2, 3, 4)) AND ( grp.group_id IN (2)) AND ("20170814100212" <= DATE_SUB(e.end_date, INTERVAL  hour)) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table
HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20170814100212 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 YEAR)))
 [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY rem' at line 9]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_membership" as entity_table, 7 as action_schedule_id, MAX(reminder.action_date_time) as latest_log_time
FROM civicrm_membership e
INNER JOIN civicrm_group_contact_cache grp ON e.contact_id = grp.contact_id
INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0
INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND
reminder.entity_id          = e.id AND
reminder.entity_table       = 'civicrm_membership' AND
reminder.action_schedule_id = 7
WHERE (e.membership_type_id IN ("1", "2", "3")) AND (( e.is_override IS NULL OR e.is_override = 0 )) AND (e.contact_id NOT IN (41, 40, 42, 77, 92, 230, 231)) AND (e.status_id IN (8, 1, 2, 3, 4)) AND ( grp.group_id IN (2)) AND ("20170814100212" <= DATE_SUB(e.end_date, INTERVAL  hour)) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table
HAVING (TIMESTAMPDIFF(HOUR, latest_log_time, CAST(20170814100212 AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL 1 YEAR)))
 [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND ('20170814100212' >= DATE_SUB(e.end_date, INTERVAL 0 month))
GROUP BY rem' at line 9]"

```

# Answer
> 0 votes
This is a known bug, CRM-19017.

Every parenthesis must have a corresponding closing parenthesis and vice versa - but the line starting with "HAVING" has more closing parenthesis than opening parenthesis.

You can fix this by upgrading to CiviCRM 4.7.23 or later.

---
Tags: mysql, scheduled-reminders
---


# Question
Title: civix permission denied errors in /usr/local/bin when generating a skeltal extension
I've been following the instructions to create a new extension and get the following errors when I run the civix generate:module command:

> civix generate:module org.civicrm.searchbuilderlocation

License set to AGPL-3.0 (authored by Adam Zilkie ) If this is in error, please correct info.xml and LICENSE.txt Initalize module org.civicrm.searchbuilderlocation PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34

Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34 PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34

Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34 PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34

Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34 PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34

Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34 Write org.civicrm.searchbuilderlocation/info.xml PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71

Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71 Write org.civicrm.searchbuilderlocation/searchbuilderlocation.php PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48

Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48 Write org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48

Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48 Write org.civicrm.searchbuilderlocation/LICENSE.txt PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51

Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51

mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34

It looks like it is trying to install files in /usr/local/bin/civix which is the binary location. Do I need to set a PATH variable to tell where to install files?

Thanks

# Answer
> 0 votes
My read on this error doesn't suggest it's trying to write to `/usr/local/bin/civix` \- just that the files that are calling `mkdir()` and `file_put_contents()` are located there.

If you call `civix` to generate a module, it will create it in the current working directory. Check the permissions of the current directory. If that's not conclusive, you can update the question.

---
Tags: extension, civix
---


# Question
Title: How can I automatically redirect anonymous users to a login page?
I'm using WordPress. I'm setting up various directory pages for registered users at URLs like `mysite.org/directory`. If a user is not logged in and navigates to that address they'll get:

This message is not useful to users. I would like instead for something like an automatic redirect of anonymous visitors to `wp-login.php`. Or failing that, simply change the link "Return to home page" with a link to the user login page.

**More Info**: Using a plugin to restrict access to profiles to logged-in users does not work as the Civi error overrides any page permissions. This is true regardless of the hijack content option.

Also checked out the page redirect extention but it doesn't appear to be for WP.

# Answer
> 1 votes
A solution is to restrict access to the WordPress page that you are inserting the directory short code into. A plugin such as 'Members' allows you to restrict access to pages & posts by user role, customize the message visitors see when they do not have permission and provide a login widget.

---
Tags: wordpress, error-page, system-workflow-messages
---


title: Google forms, mailchimp and civicrm

text:
# Question
Title: Google forms, mailchimp and civicrm
I want to collect some data from our contacts through Google forms, which I can do.

But is there a possibility to link to civicrm through mailchimp? I am new to civicrm and mailchimp. What can be done and how to do it? I just want to know what all options I have, before I opt for a simple Google form.

I am using wordpress. And my CiviCRM works on LAN not integrated with any website.

# Answer
> 3 votes
There is a Mailchimp CiviCRM Integration Extension which you can download. Details are here at https://civicrm.org/extensions/mailchimp-civicrm-integration

Details on how to enable extensions are at https://wiki.civicrm.org/confluence/display/CRMDOC/Extensions

---
Tags: forms, civicrm-home, mailchimp
---


title: spam problem (inbound mail)

text:
# Question
Title: spam problem (inbound mail)
I do have problems with some inbound e-mail processed by mail to activity. Some spammer got hands on the e-mail address for e-mail processing to activity. I have listed the e-mail address displayed by civi to the pop-mail-boxes spam filter (spamassassin):

```
preference  value
blacklist_from yxz@spam.com

```

however the spam still goes to civi's inbound mail...

To do further inverstigation I need the e-mail header, which is not displayed in civicrm U/I.

Is there a way to see the header, probably with a mysql statement. I think it should be somewhere in the database...

Thank you for your assistance!

# Answer
A copy of the raw email is in the CiviMail.processed folder under the "custom" folder. Depending on the CMS you are using the location is different, but e.g. for Drupal it's usually sites/default/files/civicrm
> 1 votes

---
Tags: email
---


# Question
Title: Why does the Constituent Summary & Detail reports contain deleted contacts? (or, how to remove them?)
The constituent summary & constituent detail reports both contain deleted contacts - this is 4.7.21 (and 4.7.23) under Drupal. I verified the problem on this demo site. This doesn't seem right to me - is this a bug or WAD? Either way, any advice on how to remove them from these reports? If a bug I will report it, of course, but I wonder whether I'm missing something obvious here!

# Answer
I think the answer is that the contacts probably haven't been deleted but are in Trash. You can search for deleted contacts in Advanced Search\>Search Settings where you'll see a box labeled "Search in Trash". On completion of the search, click on Actions and they can be deleted permanently there. They will probably not then appear in your reports.
> -1 votes

---
Tags: drupal, civireport, 4.7, reports
---


# Question
Title: CiviCRM Integration with SMS Gateway custom API
How to send SMS using the API when the CRM user will open a new case.

The SMS gateway has it's own API and I know how to integrate with it. I tried to edit in the code but it's very big what's usually we should do in these cases.

If I will edit in the code which editor should I use and how??

# Answer
> 1 votes
You'll need to write an extension that implements a CRM\_SMS\_Provider interface. The Twilio extension is a good example of this.

---
Tags: api, evaluating-civicrm, sms
---


# Question
Title: Debugging SQL - possible database problem
This is possibly a question with much too deep technical aspects (SQL, PHP and Civi-innards...) for this forum, but I don't know where else to start, so here goes.

I am experiencing mysterious problems with my CiviCRM installation. Various SQL errors are thrown now and then. I had to restore from a backup and I am suspecting that the schema, or some data, was not restored completely correct.

We're currently on 4.7.23 but I've experienced this, and tried to it, since a few upgrades. It is a big problem but it does not seem to affect the features we use most or the front end. But I'm afraid it will get worse if I don't get to the bottom of this. I have a development server where I can easily restore a copy of our live server so there I can try anything.

This particular example is when running the standard Activity report.

The errors are very often SQL syntax errors (1064) thrown in the midst of standard CiviCRM functions. I've turned on **define('CIVICRM\_DAO\_DEBUG', 1);** and there is a gist here with the complete output from that error, backtrace and all.

I think I've found the offending query with the syntax error:

```
SELECT SQL_CALC_FOUND_ROWS GROUP_CONCAT(civicrm_contact_contact_source SEPARATOR ';') as civicrm_contact_contact_source,
    GROUP_CONCAT(civicrm_contact_contact_assignee SEPARATOR ';') as civicrm_contact_contact_assignee,
    GROUP_CONCAT(civicrm_contact_contact_target SEPARATOR ';') as civicrm_contact_contact_target,
    GROUP_CONCAT(civicrm_contact_contact_source_id SEPARATOR ';') as civicrm_contact_contact_source_id,
    GROUP_CONCAT(civicrm_contact_contact_assignee_id SEPARATOR ';') as civicrm_contact_contact_assignee_id,
    GROUP_CONCAT(civicrm_contact_contact_target_id SEPARATOR ';') as civicrm_contact_contact_target_id, civicrm_activity_id, civicrm_activity_source_record_id, civicrm_activity_activity_type_id, civicrm_activity_activity_subject, civicrm_activity_activity_date_time, civicrm_activity_status_id
  FROM civireport_activity_temp_target tar
  INNER JOIN civicrm_activity activity_civireport ON activity_civireport.id = tar.civicrm_activity_id
  INNER JOIN civicrm_activity_contact activity_contact_civireport ON activity_contact_civireport.activity_id = activity_civireport.id
    AND activity_contact_civireport.record_type_id = 2
  LEFT JOIN civicrm_contact contact_civireport ON contact_civireport.id = activity_contact_civireport.contact_id
  WHERE (1) AND GROUP BY civicrm_activity_id, civicrm_activity_source_record_id, civicrm_activity_activity_type_id, civicrm_activity_activity_subject, civicrm_activity_activity_date_time, civicrm_activity_status_id ORDER BY civicrm_activity_activity_date_time ASC LIMIT 0, 50

```

The SQL error is pointing to the 'GROUP BY', and looking at it now I kind of think it looks incorrect; "WHERE (1) AND GROUP BY...", but I'm no SQL expert.

Looking at the backtrace, shows

```
#12 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(1315): CRM_Core_DAO->query("SELECT SQL_CALC_FOUND_ROWS GROUP_CONCAT(civicrm_contact_contact_source SEPARA...", TRUE)
#13 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Report/Form.php(2753): CRM_Core_DAO::executeQuery("SELECT SQL_CALC_FOUND_ROWS GROUP_CONCAT(civicrm_contact_contact_source SEPARA...")
#14 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Report/Form/Activity.php(877): CRM_Report_Form->buildRows("SELECT SQL_CALC_FOUND_ROWS GROUP_CONCAT(civicrm_contact_contact_source SEPARA...", (Array:0))
#15 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Report/Form.php(840): CRM_Report_Form_Activity->postProcess()
#16 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(543): CRM_Report_Form->preProcess()
#17 /var/www/events/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()

```

Line #14 points to `CRM/Report/Form/Activity.php(877)` which in is in the context of

```
$this->_aclWhere = "";
$this->buildPermissionClause();

$sql = "{$this->_select}
  FROM civireport_activity_temp_target tar
  INNER JOIN civicrm_activity {$this->_aliases['civicrm_activity']} ON {$this->_aliases['civicrm_activity']}.id = tar.civicrm_activity_id
  INNER JOIN civicrm_activity_contact {$this->_aliases['civicrm_activity_contact']} ON {$this->_aliases['civicrm_activity_contact']}.activity_id = {$this->_aliases['civicrm_activity']}.id
  AND {$this->_aliases['civicrm_activity_contact']}.record_type_id = {$sourceID}
  LEFT JOIN civicrm_contact contact_civireport ON contact_civireport.id = {$this->_aliases['civicrm_activity_contact']}.contact_id
  WHERE (1) AND {$this->_aclWhere} {$groupByFromSelect} {$this->_having} {$this->_orderBy} {$this->_limit}";

$this->buildRows($sql, $rows);

```

This looks like `this->aclWhere` is expected to contain something that should appear between the `AND` and the `GROUP BY` causing the SQL syntax error.

If I'm correct so far, then it looks like `buildPermissionClause()` fails. And it looks like this

```
public function buildPermissionClause() {
  $ret = array();
  foreach ($this->selectedTables() as $tableName) {
    $baoName = str_replace('_DAO_', '_BAO_', CRM_Core_DAO_AllCoreTables::getClassForTable($tableName));
    if ($baoName && class_exists($baoName) && !empty($this->_columns[$tableName]['alias'])) {
      $tableAlias = $this->_columns[$tableName]['alias'];
      $clauses = array_filter($baoName::getSelectWhereClause($tableAlias));
      foreach ($clauses as $field => $clause) {
        // Skip contact_id field if redundant
        if ($field != 'contact_id' || !in_array('civicrm_contact', $this->selectedTables())) {
          $ret["$tableName.$field"] = $clause;
        }
      }
    }
  }
  // Override output from buildACLClause
  $this->_aclFrom = NULL;
  $this->_aclWhere = implode(' AND ', $ret);
}

```

And here I'm at a loss... Where do I go next?

# Answer
> 2 votes
This particular error seems to be a recent regression in 4.7.23: https://issues.civicrm.org/jira/browse/CRM-21029

You can wait until the release of 4.7.24 or apply the patch from https://github.com/civicrm/civicrm-core/pull/10819 manually.

---
Tags: permissions, php, sql
---


title: using MailChimp on LAN CiviCRM

text:
# Question
Title: using MailChimp on LAN CiviCRM
Our institute uses CiviCRM only on our LAN. is it possible to use mailChimp for bulk emailing, CiviMail, in our LAN CiviCRM.?

Wordpress, Wamp 3, Windows 7

# Answer
If the machine that connects to mailchimp (the wamp machine) can reach the internet then yes.
> 1 votes

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


# Question
Title: How to embed a Soundcloud player into CiviCRM mailings
I am trying to embed a Soundcloud player into a mailing. It all seems to work fine in the composition window but then the player doesn't appear in the draft mail when I send it to myself (I tried Outlook365 and Gmail). Does someone have a sense of where it goes wrong? Many thanks.

# Answer
Almost all email clients strip out JavaScript/embeds, which is necessary to play audio. See Soundcloud's blog and Mailchimp's knowledge base for reference and workarounds.
> 2 votes

---
Tags: civimail
---


# Question
Title: Is there a way to access [civicrm.files] from smarty?
I'd like to replace the default logo in my email templates ({$resourceBase}/i/civi99.png) with a URL that points to a different location where the custom logo won't be overwritten by updates. I can do that by directly editing the template to point to https://www.mydomain.com/images/logo.png for example, but I'd like to avoid asking customers to edit the templates, which requires programming skills. Instead, I'd like to tell them to put their logo in a magic folder where it will be picked up if it exists.

Probably \[civicrm.files\] would be a suitable location but I can't work out how to expand that in a smarty template.

I tried {crmSetting name="imageUploadURL" group="URL Preferences"} but that returns "\[civicrm.files\]/persist/contribute/" which doesn't expand the variable.

I also tried {crmResURL ext=civicrm} but that just gives "/wp-content/plugins/civicrm/civicrm/" which is not a complete URL and in any case points to a directory that will get overwritten by updates (yes I'm on WordPress).

I haven't yet found where $resourceBase is set but something equivalent that returns https://www.mydomain.com/wp-content/uploads/civicrm would be good. I think I can only create that new variable by writing an extension though, which is a lot of bother if there's a better way. I would have expected the root URL of the installation to be in the settings or global variables somewhere and accessible from smarty but I can't find it.

A possibly related problem is that I'd also like to retrieve information like the date of a contribution from the database and display that in an email. Again, I can see that information is put in a smarty variable in Invoice.php for example, but the format is wrong (American, comma in wrong place) and my hunch is the information should be accessible some other way through the API. But if so I can't find it.

I've spent several hours on this (even bought the book) and I'm still struggling to find any information on how to create or use variables like \[civicrm.files\] in general, and in smarty in particular. Can any one help with either a specific or a general solution?

Update: I've found a partial solution to the logo path problem. {$smarty.server.SERVER\_NAME} will get the name of the "server", in a format like "www.mydomain.com". By sticking "https://" in front and "/wp-content/uploads/civicrm" at the end you can make a good guess at where civicrm.files is likely to be on a WordPress installation. But it's only a guess.

# Answer
You can use

```
{crmResURL ext='civicrm.files'}

```
> 2 votes

# Answer
Details on the Smarty CiviCRM interface are here: https://docs.civicrm.org/dev/en/master/api/interfaces/#smarty-api-interface

However, this seems like overkill for handling the date issue. I suspect that this can be fixed by changing the currency settings (**Administer menu » Localizations » Languages, Currency, Location**). If this does NOT fix your issue, that's a bug and should be reported.

As for the logo issue - I don't think there's a way to do what you're asking without an extension. Fortunately, it should be a very small extension, maybe 5-10 lines of code using hook\_civicrm\_alterMailParams. Best yet, you don't have to deal with Smarty :-\
> 1 votes

---
Tags: message-templates, smarty, resource-urls
---


# Question
Title: Run report of donors with email addresses
How do I run a report that lists anyone who is a donor and has an email address in my organization's database on civi?

# Answer
> 1 votes
You can search in advanced search for 'has an email' by putting a percent(%) sign in the email search field & hitting enter - and include a 'From 0' in the Contribution section of the search.

The resulting search should give results for

> Email LIKE '%' ...AND... Contribution Amount - greater than "0"

---
Tags: email
---


# Question
Title: CKEditor Multi-Site Configuration Problem
After updating to 4.7.23 from 4.7.20, I can now use the CKeditor Configuration and the changes are saved based on the changes made at https://issues.civicrm.org/jira/browse/CRM-19303, but the wysiwyg doesn't show up. The Drupal log error message reports "page not found" and that it is looking for

`http://staging.focusdc.org/sites/focus/sites/focusdc.org/modules/civicrm/js/wysiwyg/crm.ckeditor.js`

when I believe it should be looking for

`http://staging.focusdc.org/sites/focusdc.org/modules/civicrm/js/wysiwyg/crm.ckeditor.js`

I'm not sure how to go about changing this. Everything else seems to be working correctly as my Resource URL's and Upload Directories look correct.

Thanks in advance

**8/15**

After some further sleuthing I discovered my production site running 4.7.20 reports: \[civicrm.root\] https://focusdc.org/sites/focusdc.org/modules/civicrm/

whilte my staging server running 4.7.23 reports: \[civicrm.root\] http://staging.focusdc.org/sites/focus/sites/focusdc.org/modules/civicrm/

They have identical civicrm.settings.php outside of the one having SSL and one referencing "staging".

Did the $civicrm\_root settings change in civicrm.settings.php between 4.7.20 and 4.7.23? Any other thoughts?

# Answer
> 1 votes
Thanks Jon G, for steering me in the right direction and hopefully this might help someone down the line.

I probably wasn't particularly clear in my description in that I run a Drupal multisite but CiviCRM is still running under it's original single site (although this is bringing me a step closer to having all the sites run CiviCRM especially for webform integration).

Accordingly, I was still hosting CiviCRM in the 'subsite'/modules directory. When I moved the module into the /all/modules and changed the $civicrm\_root any inconsistencies in the Directories and URL Resources corrected themselves.

Now the CKEditor Configuration works!

# Answer
> 1 votes
You should be able to fix this by defining the CIVICRM\_CMSDIR constant. Since you're using multi-site, you'll need to define that on a per-site basis.

---
Tags: multisite, wysiwyg, drupal-multi-site
---


title: back office renewals with price sets

text:
# Question
Title: back office renewals with price sets
Our organization recently went from straight choice of membership type on signups and renewals to a Price Set in order to include an option to pay for a newsletter. The web page using the price set works just fine. And if we use the back-office interface to add a new member, that works fine too - on the Membership Organization and Type line, I get a choice of Org and Type, or a Price Set. However, when I select an existing Membership record in the back-office and choose "renew", I get to change the membership type but get no option to select Price Set. I need the latter to work so I can get the newsletter option to be included in the total charge.

New Member looks like this:

Renewing Member looks like this:

# Answer
> 2 votes
It's not currently supported... However, I'm running the patch from https://issues.civicrm.org/jira/browse/CRM-15861 successfully on a client site. That should do what you want!

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


# Question
Title: Updating a custom field set for case entity Civi API
I have defined a custom field for a particular case type ("adhesion") it's a yes or no field that I need to update when I finish the processing. So I use the Case API to update it passing the id and the new value for the custom field. But this doesn't update the value I get this as a return in the API explorer. I was able to update custom fields in others entities and update case predifined fields using the API.

Is there any explantion for this problem? Any hint on how i can achieve this update action.

Down below is a screenshot from the API explorer

# Answer
This looks like a bug to me. Looking at the code you can see in `civicrm_api3_case_create` that if the ID is already set it calls `civicrm_api3_case_update`.

`civicrm_api3_case_update` has no call to the `CRM_Case_BAO_Case::create` method, which is the only mention I see of custom parameter creation in the BAO.

In fact api/v3/Case.php contains only one mention of the word "custom". It's surprising that something like this could have been left out and maybe I'm missing something, but when I tried creating a custom field for a Case locally and setting some custom values nothing was created.

I'd suggest mentioning this in Mattermost or just going ahead and creating a bug report for it on Jira

Edit:

This issue is about custom data being ignored by the case API but is still open.
> 1 votes

# Answer
Not a direct answer to your question, but you might contemplate using CiviRules to update the case custom field?
> 1 votes

# Answer
Unfortunately the Case API doesn't support custom fields... However, good news! From 4.7.25 the Case API DOES supports custom fields! https://issues.civicrm.org/jira/browse/CRM-18082
> 0 votes

---
Tags: api, civicase
---


# Question
Title: How do I regenerate the text version of an email after editing the HTML draft?
As asked in title. Thanks for your time!

# Answer
> 3 votes
Welcome to Stack Exchange, CiviMail will create a plain text version of your email for those using a plain text client. So there is no need to enter content in the plain test area unless you wish folks using plain text to have a specially formatted message or you just want to send your email in plain text that is when you would use the plain text field.

If you have already entered text, delete it and it will be re-generated.

Here is a link to more info: https://docs.civicrm.org/user/en/latest/email/mass-mailings-using-civimail/#mailing-tab

Hope this helps

---
Tags: email
---