# Question
Title: Using Civi to manage members' lists of items available for donation to other members
I'm helping an organization that connects with wealthy schools to share surplus items (from scissors to books to furniture) with under-funded schools.

I'm looking to set something up so the wealthy schools can create a membership account online, create a list of items they have available, and then those items can be assigned to various under-funded schools, which have also created their own account along with a list of what they need.

These lists are currently being done through spreadsheets, but I'd like a way to integrate the list functionality with the member management functionality. At the very least my hope is that doing that will give more power to the schools to facilitate the donations on their own, and I hope it will make it easier for past donations to be displayed online. Ideally, I'd like the software to automatically assign the items to the schools in need, but that's probably asking too much.

Anyway, my main question is: will Civi be helpful with the management of these donation item lists, or are good old Google spreadsheets the way to go?

# Answer
interesting use case.

Firstly I would question if 'membership' is actually necessary for this, or do they just need to have a 'user account'?

In terms of the 'items', the only way I think you could do this so they can be 'assigned' to another school is if each 'item' is a discreet entity - and the mostly likely approach for doing this would be to have each as an Activity. You can then 'assign' the item to the recipient school.

You would then be able to report against these (via Views and Webforms if done in Drupal - which is the only way i would attempt this) in such a way that in theory the under-funded schools would be able to self-allocate the items, thus removing them from the 'available resources' list, and potentially trigger an email to the donating school to arrange the delivery of the resources etc.

So, in short, yes I think with the right conceptual application of what civi offers, and with the great tools that Drupal provides, I do think Civi could be helpful.

We have just done a challenging project which matches 'gift providers' with the children of prisoners, with the goal of delivering Xmas presents. It doesn't particularly mirror your requirements, but does have similarities in terms of linking an entity with the donor and the recipient etc. I need to get a blog written on it as it could flesh out quite nicely the way Views and Webforms can help deliver complex requirements like these.
> 0 votes

# Answer
I also received a helpful answer from Rose in the Civi chat (thank you Rose!). Thought I'd post it here just to have it all in one place:

Interesting problem, and there's probably a way somehow. I've also looked at the response in Stack Exchange, which definitely recommends Drupal because then you can use Views and Webforms. A few questions first... 1) Why does it have to be Wordpress? 2) Do the schools need to log in/record their own needs and surplus or will it all be managed by staff in the organisation? 3) Are the items specifically limited (e.g. 3 tables, 100 books)?

A really simple method would be to just use custom fields to record what items are in surplus and then use Reports to pull off which items are needed, and use customised Activities to record any transactions between schools. Drupal is probably key if you do want the schools to log in and record their surplus or needs. You could use Memberships and Donations (of a sort) to record items donated but it's not as simple to record how the items are transferred to the under-funded schools. Possibly Grants but it's not a very sophisticated tool.

And Drupal is probably key if you want to display the info online (using Views) although you may be able to use the API to display some information but you can't interact with the information using the API. For example, people with some log in access can view information and then submit a request for it if you're using Drupal.

Sorry - discount my second question because you have already answered that! I asked the third question because if 'yes' then the answer in Stack Exchange is probably a better answer than mine, but if they're happy with using custom fields to just record categories of items (plus a free text field to provide a bit of detail, including condition), this would be sufficient for schools to see what's available.
> 1 votes

---
Tags: donations
---


# Question
Title: "alter routine command denied to user" error when installing extensions?
I have installed civicrm 4.7 on drupal 7. Installing of extension failed with error:

```
DROP FUNCTION IF EXISTS civicrm_strip_non_numeric [nativecode=1370 ** alter routine command denied to user 'civicrm'@'localhost' for routine 'civicrm.civicrm_strip_non_numeric']

```

I have grant all to the database, named civicrm.

# Answer
Some permissions won't be granted when you use 'GRANT ALL' before the database has been created. Rerunning your GRANT ALL should fix the problem.
> 2 votes

# Answer
The user does not have the permissions to alter and create routines (functions). This should fix it:

```
GRANT CREATE ROUTINE, ALTER ROUTINE ON civicrm.* TO civicrm;

```
> 3 votes

---
Tags: extension, installation, mysql
---


# Question
Title: iAmAnIntentionalENoticeThatWarnsOfAProblemYouShouldReport and other event registration warnings in 4.7.1
On the Find Participants page for an event:

```
Warning: array_keys() expects parameter 1 to be array, null given in CRM_Utils_Array::formatArrayKeys()

```

In the Drupal log, lots of these:

```
Notice: Undefined variable: iAmAnIntentionalENoticeThatWarnsOfAProblemYouShouldReport in CRM_Contact_BAO_Query::buildClause() (line 5382 of /home/[site]/public_html/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php).

```

And these:

```
Cache rebuild lock hit: event_init

```

And when viewing a contact, these:

```
Warning: array_keys() expects parameter 1 to be array, null given in CRM_Utils_Array::formatArrayKeys() (line 1037 of /home/[site]/public_html/sites/all/modules/civicrm/CRM/Utils/Array.php).

```

And these:

```
Notice: Undefined variable: onlySubType in CRM_Custom_Form_CustomData::setGroupTree() (line 163 of /home/[site]/public_html/sites/all/modules/civicrm/CRM/Custom/Form/CustomData.php).

```

And these:

```
Warning: Missing argument 4 for CRM_Custom_Form_CustomData::setGroupTree(), called in /home/[site]/public_html/sites/all/modules/civicrm/CRM/Custom/Form/CustomDataByType.php on line 56 and defined in CRM_Custom_Form_CustomData::setGroupTree() (line 153 of /home/[site]/public_html/sites/all/modules/civicrm/CRM/Custom/Form/CustomData.php).

```

It looks like these are related to paid event registration - the client is complaining that the transactions (using Authorize.net) are taking a long time to process and are even timing out.

It looks like going to 4.7 was a big mistake, but now I'm stuck - any ideas? And help greatly appreciated...

# Answer
That is a lot of errors, so here are a few answers.

1. Not helpful for you, but in response to your last few comments, I'd say you should also be testing upgrades before doing them on a production site, and making sure you've backed up your site so you can roll it back in case of disaster. That is particularly true of a complex existing site, which appears might be true in your case.
2. You posted this some time ago when 4.7 was relatively new, so I'd guess that the latest 4.7 will have resolved many of these problems. I agree that early 4.7 releases perhaps should have come with more warnings. Releases do go through a lot of testing, but CiviCRM is a complex code base and especially when you are using it in non-standard ways, there can be some subtle issues that arise.
3. Your collection of warnings and notices need to be addressed one at a time, it's not necessarily one problem and solution. Some of them may be connected, but the limited error log you've posted above doesn't give us enough to go on. You'll need to dig into the CiviCRM error log in the files/civicrm/ConfigAndLog directory where a more complete backtrace should be. Looking at the datestamps and order of the errors will give you a good idea of which of the errors/notices are the key ones to look at, and which ones are just symptoms of the earlier problem.
4. iAmAnIntentionalENoticeThatWarnsOfAProblemYouShouldReport is a clever mechanism that I believe Eileen introduced to help diagnose issues. I'd start with that one as being the most helpful symptom of what might be the key issue, which is likely related to custom values.
5. The cache rebuild lock hit might also be a key symptom - i.e. if there are resource issues, that might cascade down into some of the other issues.
> 1 votes

---
Tags: civievent, drupal, upgrade, 4.7
---


# Question
Title: Why is filtering by custom country multi-select in a Drupal View not working?
I have a searchable directory listing a group of users, made with a Drupal View. The user profile includes a list of countries where they have relevant work experience, and this data is stored in a custom country multi-select field in Civi.

I want users searching the directory to be able to search based on this country information, and so I have exposed the Views filter to users so that they can select one or more countries and view a list of contacts who have experience in those countries.

Only it doesn't work.

The query that the view generates is:

```
SELECT civicrm_contact.id AS id, civicrm_contact.first_name AS civicrm_contact_first_name, civicrm_contact.last_name AS civicrm_contact_last_name
FROM
{civicrm_contact} civicrm_contact
LEFT JOIN {civicrm_value_public_profile_12} civicrm_value_public_profile_12 ON civicrm_contact.id = civicrm_value_public_profile_12.entity_id
WHERE (( (civicrm_value_public_profile_12.countris_88  = 1013) ))

```

(this example is searching on the country Australia, which has the code 1013). In this instance the query returns no results.

Looking at the database, the column civicrm\_value\_public\_profile\_12.countris\_88 does include two records that include the country code 1013.

Whatever I put into this search field I get zero results.

The settings.php file has been updated to include reference to the table for Views.

The country codes that are stored in the custom database field are not comma separated in cases where the user has selected more than one country when they created their profile. For example, where a user has selected both Thailand and Australia the field contains: 11211031 rather than, for example 1121,1031. Civi seems happy enough with this, so I'm assuming that the Views handler for this field type is broken?

# Answer
> 2 votes
Views is going to have a tough time handling this field, it generally likes a better table structure. I wouldn't call this a views handler problem, but an implementation problem - using the CiviCRM multi-valued custom field is just going to be problematic for views.

You could try getting views to create a different sql query with a LIKE instead of equal to the country id, but that'll be flaky.

I'd consider instead using a Drupal user field to store that value.

---
Tags: custom-fields, drupal-views
---


# Question
Title: Personal Campaign Pages only visible on front end when logged into back end
Using WP 4.6.1 and Civi 4.7.13. I am trying to create a set of PCP's for staff members for our year end fundraising campaign. I can successfully create a PCP from the link provided by the Contribution Page using a browser in which I am not logged into WP/Civi. In another browser, I am logged into WP/Civi and approve the PCP and am able to see that PCP by clicking the link in the Civi PCP list. However, if I log out or try to use that link in another browser in which I am not logged into WP/Civi I get an error stating that the PCP is not available but I can donate using the donation page form. What am I missing?

Thanks, e.

# Answer
> 1 votes
Have you checked the permissions and roles? If not you may find useful the following documentation Default Permissions and Roles

---
Tags: wordpress, civicontribute, personal-campaign-pages
---


# Question
Title: save contact with non numeric phone number gives access denied civicm_strip_non_numeric
I recently update civicrm till 4.6.2 till 4.6.4 on drupal 7.38, mariadb 5.5.41. When saving a contact with a non numeric phone number (+32 123456798) I got the error:

Database foutcode: execute command denied to user 'civicrm-db-user'@'localhost' for routine 'civicrm-db.civicrm\_strip\_non\_numeric', 1370

```
Array
(
[callback] => Array
    (
        [0] => CRM_Core_Error
        [1] => handle
    )

[code] => -1
[message] => DB Error: unknown error
[mode] => 16
[debug_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id ) VALUES ( 26 ,  1 ,  1 ,  0 , '+32' ,  NULL ,  1 )  [nativecode=1370 ** execute command denied to user 'civicrm-db-user'@'localhost' for routine 'civicrm-db.civicrm_strip_non_numeric']
[type] => DB_Error
[user_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id ) VALUES ( 26 ,  1 ,  1 ,  0 , '+32' ,  NULL ,  1 )  [nativecode=1370 ** execute command denied to user 'civicrm-db-user'@'localhost' for routine 'civicrm-db.civicrm_strip_non_numeric']
[to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id ) VALUES ( 26 ,  1 ,  1 ,  0 , '+32' ,  NULL ,  1 )  [nativecode=1370 ** execute command denied to user 'civicrm-db-user'@'localhost' for routine 'civicrm-db.civicrm_strip_non_numeric']"]

```

)

I found the solution in adding the "execute" privilege to my civicrm-db user in mariadb using phpmyadmin.

I have a second civicrm db (non related to my first) still on the old version 4.6.2 which has no issues at all. I has no "execute" privilege and does not need it.

Civicrm doc (http://forum.civicrm.org/index.php?topic=23489.0) does not mention execute privilege.

list of grants to my civicrm user: Grants for civicrm-db-user@localhost

```
GRANT USAGE ON *.* TO 'civicrm-db-user'@'localhost' IDENTIFIED BY PASSWORD 'pwdhere'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON `civicrm`.* TO 'civicrm-db-user'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON `civi`.* TO 'civicrm-db-user'@'localhost'
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE ROUTINE, ALTER ROUTINE, TRIGGER ON `civicrm-db`.* TO 'civicrm-db-user'@'localhost'

```

trigger rebuild did not fix the issue. (/civicrm/menu/rebuild?reset=1&triggerRebuild=1)

automatic\_sp\_priveleges variable = on in mariadb

Question: did I miss something in the update, does the latest version need different rights? I think I found a workaround, but not the actual error. Has someone the same issue?

Kind regards

Johan.

# Answer
> 2 votes
I checked a site that is currently being test-upgraded from 4.4.14 to 4.6.4, so we have both the 4.4.14 and 4.6.4 versions.

In 4.4.14: GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `mycividb`.`civicrm_strip_non_numeric` TO 'myuser'@'localhost'

In 4.6.4: GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `mycividb`.`civicrm_strip_non_numeric` TO 'myuser'@'localhost'

I.e. the same. This permission normally gets automatically granted for this function, when the function is created, which happens when triggers are set up. This is done automatically by MySQL:

> The EXECUTE privilege is required to execute stored routines. However, this privilege is granted automatically to the creator of a routine if necessary

https://dev.mysql.com/doc/refman/5.5/en/stored-routines-privileges.html

From the MariaDB docs:

> To run a stored routine, the EXECUTE privilege is needed. This is also temporarily granted to the creator if they attempt to run their routine unless the automatic\_sp\_privileges variable is set to 0.

https://mariadb.com/kb/en/mariadb/stored-routine-privileges/

Worth checking the automatic\_sp\_privileges variable.

Does a trigger rebuild (/civicrm/menu/rebuild?reset=1&triggerRebuild=1) fix the problem?

You say you solved the problem by adding the "execute" privilege to your drupal-db user. Did you mean your civicrm-db user? If you post the results of SHOW GRANTS for the relevant users, that might help to diagnose what's happening.

# Answer
> 0 votes
As far as I know you also needed the execute privilige in earlier versions for the phone strip function?

# Answer
> 0 votes
CiviCRM requires additional DB permissions beyond what you'd normally require for a CMS like WordPress, Joomla or Drupal.

When cloning a site for testing, the same permissions setup will need to be replicated for the cloned site. Just "stock" permissions won't do the trick :(

These permissions are documented in the CiviCRM Wiki: CiviCRM MySQL Permission Requirements

---

Select your MySQL version below, then execute the appropriate permissions SQL after replacing `DBNAME`, `DBUSERNAME`, `DBHOSTNAME` and `DBPASSWORD` to suit your access.

## MySQL \>= 5.1.6

```
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, TRIGGER, CREATE ROUTINE, ALTER ROUTINE
   ON DBNAME.* TO 'DBUSERNAME'@'DBHOSTNAME' IDENTIFIED BY 'DBPASSWORD';

```

## MySQL \<= 5.1.5

```
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE ROUTINE, ALTER ROUTINE
   ON DBNAME.* TO 'DBUSERNAME'@'DBHOSTNAME' IDENTIFIED BY 'DBPASSWORD';
GRANT SUPER ON *.* TO 'DBUSERNAME'@'DBHOSTNAME';

```

---
Tags: contacts, mysql
---


# Question
Title: Get civi mailing with status = 'Complete' using API explorer
What should be the way to get/find mailing with the status ='complete' using API explorer?

or is it the value which stores in civicrm\_mailing.is\_completed for each mailing?

or there is any other way to get such mailings?

# Answer
Yes, this is doable via API Explorer.

* Entity is `Mailing`,
* The Action is `Get`, and
* The Parameter is `Mailing Completed = Yes`
> 1 votes

---
Tags: civimail, scheduled-job
---


# Question
Title: How to export 'employee of' relationship that has multiple staff members?
As a disclaimer, I've read up on this thread: How to export all children of a family?. However, that doesn't seem to solve my problem. Here's my dilemma.

I'm looking to export contacts from our installation that shows both the organization's employees as well as the staff member assigned to that organization (known as a field support coordinator). We have the relationships 'employee of' and 'field support coordinator is' to handle this.

If I pull up the organizational group 'current affiliates' and export those contacts, we are able to choose the aforementioned relationships. However, with the 'employee of' relationship, it only exports one staff member.

I've tried to alleviate this by using the advanced search to create a group called 'employees of current affiliates' which pulls everyone. I'm able to export this list with the 'employee of' relationship, but then I'm stuck with the inability to export the relationship 'field support coordinator is' since that's only attributed to organizational records.

I've gone to the reporting section and even tried pulling up this information there using the relationships template, but I run into the same issue where I'm not able to show the 'field support coordinator' is relationship, only the 'employee of' relationship.

Finally, I've tried creating a Drupal view which works fine, however the same issue occurs where it only shows one 'employee of' and not the multiple contact records attributed to it.

Is all of this a limitation of the system? Am I missing something or not understanding what needs to be done? Do we need to go to our developer to get this laid out in a different fashion?

Thank you in advance for your suggestions.

# Answer
I put a quick example of a View together which you can download from our Treasure Trove.

It is based on 'contact' and assumes that the Org is at the B end of the relationship, and uses a single 'views' relationship starting from B to then connect to Contact A, and the 'which Civi relationship to use' has been set to include several - but these will need reselecting based on which civi Relationships you are trying to pull in.

Hope it makes sense. It may not be quite where you were headed but may gave you some ideas in how to put your View together.

I think an alternative could be to build the View based on CiviCRM Relationship, rather than CiviCRM Contact.
> 0 votes

---
Tags: relationships, export, reports
---


# Question
Title: API - Create a contact from an external site
I have the need to create/update a contact from an external site. If I understand correctly, the only way to do this is to use Rest API. In my test I had no problem to read the database, but when using the "create" action, as in the following PHP code:

> $url='http://.../sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=create&api\_key=...&key=...&json={"sequential":1,"first\_name":"Gianni","last\_name":"Predan"}';
>
> $responsestr = file\_get\_contents($url);

I obtain the error "*All requests that modify the database must be http POST, not GET.*"

What should I do? Thanks

# Answer
What you are asking is "How do I send a POST request with PHP?". See the following stackoverflow question: https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php .
> 2 votes

---
Tags: api, rest
---


title: Transferring CSV contacts Civi

text:
# Question
Title: Transferring CSV contacts Civi
On a PC, I've downloaded a list into excel and saved it as a MS-DOS CSV file. When I go to Civi to import it, Civi says it's not saved as a CSV file.

I've followed the same steps I have for a dozen other contact lists.

What am I missing?

# Answer
I would suggest that you take a look at the documentation: Importing Data into CiviCRM

Read through this and follow the steps carefully. Try to export a small number of contacts - i.e. the first ten or so. If you are able to import these then the problem may be with some of the data in the later records.

You may need to change the export settings so that fields are separated by a semicolon (;) rather than a comma (,).

You may find the answers to this related post helpful: CSV file import problem with file from Mac MS Office

If you are still having trouble it would be helpful if you could paste an example of the CSV file to your post **with dummy data replacing any real data**. Again, just the first few lines would be sufficient.
> 1 votes

# Answer
In some cases I have found that saving a csv that has been edited and resaved results in this type of behaviour. Solution in those cases was just

* open the csv
* copy all content
* paste in new csv, save, close, do not reopen or edit etc
> 1 votes

---
Tags: contacts, import
---


# Question
Title: Transfer Database to new location raised MySQL Error function already exists
I follow the instructions here https://wiki.civicrm.org/confluence/display/CRMDOC/Moving+the+database+using+phpMyAdmin

I want to import the so called Old\_without\_five\_tables.sql with phpmyadmin in the civicrm database but I get the following error:

SQL query:

```
- Datenbank: `civicrm`
--

DELIMITER $$
--
-- Funktionen
--
CREATE DEFINER=`civicrm`@`localhost`
FUNCTION `civicrm_strip_non_numeric`(input VARCHAR(255) CHARACTER SET utf8) RETURNS varchar(255) CHARSET utf8
   NO SQL
   DETERMINISTIC
BEGIN
  DECLARE output   VARCHAR(255) CHARACTER SET utf8 DEFAULT '';
  DECLARE iterator INT          DEFAULT 1;
  WHILE iterator < (LENGTH(input) + 1) DO
    IF SUBSTRING(input, iterator, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') THEN
      SET output = CONCAT(output, SUBSTRING(input, iterator, 1));
    END IF;
    SET iterator = iterator + 1;
  END WHILE;
  RETURN output;
END$$

```

MySQL said:

> #1304 - FUNCTION civicrm\_strip\_non\_numeric already exists

I am using: civicrm 4.7.3 drupal 7.26

thanks so far

# Answer
> 2 votes
The error suggests that you did run the import for the second time. The function cannot be created because it is already there. You can remove it with

```
DROP FUNCTION `civicrm_strip_non_numeric`

```

An alternative is to use the checkbox in *phpmyadmin* that is labeled *add DROP TABLE / VIEW / PROCEDURE / FUNCTION*

(To be honest: I am not a phpmyadmin user, I got this suggestion from What does the “Add DROP TABLE / VIEW / PROCEDURE / FUNCTION” checkbox do in phpmyadmin ).

---
Tags: drupal, database, error, mysql
---


title: What type of database does CiviCRM use?

text:
# Question
Title: What type of database does CiviCRM use?
I'm sure this is a very obvious question but what type of database does CiviCRM use? SQL Server, MYSQL, etc.

# Answer
> 2 votes
From CiviCRM Requirements

An installation of Drupal, Joomla or Wordpress, and the following additional requirements:

PHP 5.5+ is recommended. See the CiviCRM PHP Requirements page for details. PHP memory\_limit set to between 256 and 512 megabytes.

MySQL 5.1.x or higher with INNODB support : CiviCRM is compatible with the current generally available MySQL release. Trigger support is required for logging and multi-lingual features. SUPER privileges are required in MySQL 5.1 if binary logging is enabled.

Surprised if this (or other places which reference mysql) was hard for you to find, so please suggest where you think the documentation could be improved.

# Answer
> 0 votes
CiviCRM utilizes PHP/MySQL. Info on installation and requirements can be found here: https://wiki.civicrm.org/confluence/display/CRMDOC/Installation+and+Upgrades

---
Tags: database
---


# Question
Title: How hard is it to obtain PCI compliance?
I want to preface this by saying that I am aware that no one here can tell me authoritatively whether I am PCI compliant, since only licensed people can do that.

Instead, I'm asking what your experience was in seeking out compliance. My site is run on Drupal 7, CiviCRM 4.6, and we use Authorize.net for our payment processor. We have SSL. Do you have any helpful intel on how hard or easy this will be for us?

edited to add: We are hosted by CiviHosting

# Answer
A great explanation of PCI compliance and things an organization should consider relating to PCI compliance is available from this CiviCon Denver 2015 talk: CiviCon Denver Data Security and Payment. See my answer here for other relevant info: https://civicrm.stackexchange.com/a/10453/105

We also use Drupal 7 and Civi 4.6, but are hosted on MediaTemple and use iATS for our payment processor. The biggest issue will be whether you take payment directly onsite or offsite (I'm not familiar with Authorize.net). In and of itself, a MediaTemple VPS is not PCI compliant. We had to take steps ourselves to make sure our server met the PCI criteria. iATS has their clients enroll in PCI Smart which is a PCI compliance testing and reporting program through TrustWave. We used those scans as guidance for what we needed to adjust technically on the server to meet PCI guidelines and the self-report to determine in-house processes to meet the PCI criteria.
> 3 votes

# Answer
I have had experience with AuthorizeNet and PCI compliance both with CiviCRM installs and other sites with custom configurations. the process is the same, generally the merchant account provider will require scans through a service provider. You will most likely need to make adjustments to server settings, primarily port/firewall adjustments. Depending on your hosting provider the ease of this may vary. Shared hosting may cause some issues as they may not make the changes.

Keep in mind that PCI compliance goes beyond your website transactions. If you process any Credit Card information from your office network via the AuthorizeNet Portal or a swipe machine your office network will be scanned and some adjustments may need to be made there also.

The process involves filing out a questionnaire and scans. Also most providers require regular scans to maintain compliance. It's important to maintain compliance as most merchants account providers will charge higher fees if you are not compliant.
> 3 votes

---
Tags: drupal, 4.6, authorize.net, pci-compliance
---


title: HTML Email won't save; related to size

text:
# Question
Title: HTML Email won't save; related to size
We have an html email message that won't save and it seems related to size. if we remove a table or a few characters, we can save. But once we hit this unknown limit, we can't save a blank space. We can't make any more changes.

Anyone else run into this and know where the settings are to change this?

# Answer
> 2 votes
body\_text and body\_html are the fields in the database that store these values, and the are of type 'longtext', which are of size 4Gb. So you're probably not hitting this limitation.

More likely, it's your php.ini configuration that is limiting the size of your "posting" (i.e. post\_max\_size), or a mysql limitation (e.g. max\_allowed\_packet).

It's also easy to put way too much bad html into these fields, particularly if you're copy/pasting from say, Word. If you take a look at your source, you might find a bunch of html you can and should remove.

---
Tags: civimail
---


# Question
Title: Error during Drupal installation: MySQL support not included in PHP
I am getting an error as show by the image above when attempting to install CiviCRM on drupal.

What does this error message mean and how could I go about fixing it?

The entire configuration report is as follows:

# Answer
Recommend **setting MAMP to use PHP5.6** if you have that option.

The screenshots show MAMP is set to use PHP7, but CiviCRM isn't ready for PHP7 yet.

(PHP7 removes `ext/mysql` in favour of `ext/mysqli` and `ext/pdo_mysql`. CiviCRM looks for `ext/mysql`, and the installer test is bailing out when it detects that this isn't supported.)

CiviCRM's PHP requirements are documented in the CiviCRM wiki.
> 8 votes

# Answer
its worth noting that now with the release of 4.7.12 and the work completed on CRM-17789 That you now have 2 options,

1. Download the later code base that does support php7
2. Downgrade PHP to 5.6 as suggested by Chris
> 1 votes

# Answer
Try changing the DSN in civicrm.settings.php from mysql to mysqli in the following line: define( 'CIVICRM\_UF\_DSN', 'mysql**i**://cms\_db\_username:cms\_db\_password@db\_server/cms\_database?new\_link=true');
> 0 votes

# Answer
For anyone else having this problem, XAMPP 5.5.33 is shipping with the mysql\_connect extension disabled by default. You need to go to php.ini file and uncomment the line

;;extension=php\_mysql.dll
> 0 votes

---
Tags: installation, mysql
---


# Question
Title: Has anyone used Emojis in CiviMail subject/body?
I am curious if anyone has used Emojis in CiviMail content. I just tried a test mailing with an Emoji in the subject and message body, which show up fine in the editor but do not appear in the test message in my inbox.

# Answer
> 7 votes
@laryn the short answer is that for this to work your database needs to be changed. CiviCRM by standard sets things to be utf8\_unicode\_ci. You will need to convert database to utf8mb4\_unicode\_ci to allow for Emojis and you would need to change the setNames call in CiviCRM to be utf8mb4 as per https://stackoverflow.com/questions/7814293/how-to-insert-utf-8-mb4-characteremoji-in-ios5-in-mysql

---
Tags: civimail
---


# Question
Title: Wordpress CiviCRM 4.7.10 - Sorry an error occurred and your information was not saved
Just upgraded 4.6.9 to 4.7.10 and get the following message: "Sorry an error occurred and your information was not saved" when creating a new mail message.

Click Mailings, New Mail and then enter a mail name. Click the recipients, select my test group and wham the message above is displayed. This message can occur at random in this form and is not specifically related to the recipients selection. No matter what you do it does not send the email or save the record.

Other web hits indicate that you can bypass this security check by enabling the 'CiviCRM: skip IDS check' permission'". Tried this on and off and no joy. This is using the Admin role which should have full access.

Anybody got any clues?

# Answer
> 2 votes
Have just turned off a security plug and the mail function is now working so for anyone with this issue in Wordpress you might want to check your plugins and switch some off.

# Answer
> 0 votes
Matt, Try Civi on a diffferent device if possible like a tablet or different PC if you have one around as I have found it works on my tablet but not on my laptop so starting to think it is cache based possibly.

# Answer
> 0 votes
I am finding that this problem exists in Firefox, but is not a problem in Chrome, Opera or IE. Is that consistent with what you found?

# Answer
> 0 votes
And I am now finding that we have the same issue when I use Chrome. Anyone else got any idea how to fix this one?

---
Tags: wordpress, civimail
---


# Question
Title: CiviMail problem; possible Cron Error: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids()
After making core updates in Drupal commons, from 7.37 to 7.50, scheduled Civi mails are not being sent. Cron jobs are still set up. Before this update, we've been using it for years with no known issues. Using CiviCRM 4.8.7. Currently trying to upgrade now but there are other roadblocks also.

Watchdog shows the following error for the time of the scheduled mailing:

```
error    cron     EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7953 of /var/www/html/example/docroot/includes/common.inc).

```

# Answer
Turns out that this cron error is unrelated to CiviMail going out. I resolved the problem by changing the group owner and permissions of the `/sites/default/files/civicrm/templates_c` folder, which was effecting `/mail.log`. The group permissions was changed to root, which won't work for the mail.

I am still getting this cron error, but know now that it probably has to do with Drupal alone.
> 1 votes

---
Tags: civimail, drupal, cron
---


title: event report - export events added only

text:
# Question
Title: event report - export events added only
I want to run a report of events only. I want to be able to export the list of events to excel and share with my team. I don't care about fees or participants.

# Answer
If you install the Extended Reports extension there is a report called 'Event Overview' with which you can create a list of events. Just select the Event ID & Event Title columns to display and you should get a list. You can then export the list to CSV.
> 1 votes

---
Tags: civievent, civireport
---


# Question
Title: Is there a bug when placing a token inside quotation marks in CiviMail 4.6.2+?
I have a mailing template with this snippet:

```
Trouble seeing this email? <a href="{mailing.viewUrl}">Read in your browser</a>.

```

In previous versions of CiviCRM, the token would render correctly.

In 4.6.2 and 4.6.3, the token renders, but elements of it are HTML-escaped. More importantly, the quotation marks surrounding the token are HTML-escaped:

```
Trouble seeing this email? <a href="http://mysite.org/civicrm/mailing/view?reset=1&id=6">Read in your browser</a>.

```

My workaround has been to add a space between the quotation mark and token, which renders correctly:

```
Trouble seeing this email? <a href=" http://mysite.org/civicrm/mailing/view?reset=1&id=7 ">Read in your browser</a>.

```

Has anyone else seen this behavior? I can't send mailings from the demo server, and setting up my dev environment to send e-mails would be a serious pain, so I wanted to check in with the community before reporting it on issues.civicrm.org. My guess is that some of you have already got e-mails sitting in your inbox that you can test by clicking a link.

# Answer
in CiviCRM 4.6.2 you can patch this issue with the following edit:

```
--- a/a/civicrm-core/CRM/Mailing/BAO/Mailing.php
+++ b/b/civicrm-core/CRM/Mailing/BAO/Mailing.php
@@ -1472,7 +1472,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       if ($this->url_tracking) {
         $data = CRM_Mailing_BAO_TrackableURL::getTrackerURL($token, $this->id, $event_queue_id);
         if (!empty($html)) {
-          $data = htmlentities($data);
+          $data = htmlentities($data, ENT_NOQUOTES);
         }
       }
       else {

```
> 3 votes

# Answer
I actually found another 4.6.3 site that exhibited identical behavior, so I filed an issue: https://issues.civicrm.org/jira/browse/CRM-16634
> 2 votes

---
Tags: civimail, tokens, issues
---


# Question
Title: Date added to CiviCRM DB error when using with a smart group that has a custom field type
Using the CiviCRM custom search by Date added to CiviCRM, I can add any group or smart group and get results, but when I search within a specific smart group I created, which involves using criteria from a custom field, I get the following errors:

```
 17829237  16/Nov 16:53  warning  php     Warning: fopen(/var/www/html/example/docroot/sites/default/files/civicrm/ConfigAndLog/CiviCRM.c496aa562571a7869b7d0ea6d810ea10.log): failed to open stream: Permission denied in Log_file
 17829238  16/Nov 16:53  debug    civicrm  $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such
 17829239  16/Nov 16:53  warning  php     Warning: fopen(/var/www/html/example/docroot/sites/default/files/civicrm/ConfigAndLog/CiviCRM.c496aa562571a7869b7d0ea6d810ea10.log): failed to open stream: Permission denied in Log_file
 17829240  16/Nov 16:53  debug    civicrm  $backTrace = #0 /var/www/html/civicrm/v4.3.8-d7/CRM/Core/Error.php(196): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2

```

Please note that we are already working on trying to upgrade our version of CiviCRM from 4.3.8, but in the meantime, I'd like to know if anyone has any ideas about what is going on here, thanks! We are on Drupal 7.50 Commons.

Edit: changed permissions on log file but still get the DB Error:

```
 17835968  17/Nov 12:32  debug    civicrm  $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such
 17835969  17/Nov 12:32  debug    civicrm  $backTrace = #0 /var/www/html/civicrm/v4.3.8-d7/CRM/Core/Error.php(196): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2

```

# Answer
> 1 votes
It appears that your Drupal siteroot is at `/var/www/html/example/docroot`, but this search is looking for CiviCRM at `/var/www/html/civicrm/v4.3.8-d7`. CiviCRM should be installed in the Drupal modules directory. I'm guessing that it IS installed in the Drupal modules directory - I don't think it works if it's not - but that there's a setting pointing to `/var/www/html/civicrm/v4.3.8-d7` that shouldn't be. Please check your `civicrm.settings.php` file and perhaps the **Administer menu \> System Settings \> Directories** settings as well. This problem is likely to clear up when you point CiviCRM to the correct install.

# Answer
> 2 votes
This line:

> Warning: fopen(/var/www/html/example/docroot/sites/default/files/civicrm/ConfigAndLog/CiviCRM.c496aa562571a7869b7d0ea6d810ea10.log): failed to open stream: Permission denied in Log\_file

indicates a permissions error. Check that your webserver user can write to the directory:

```
/var/www/html/example/docroot/sites/default/files/civicrm/ConfigAndLog

```

and to this file if it exists:

```
/var/www/html/example/docroot/sites/default/files/civicrm/ConfigAndLog/CiviCRM.c496aa562571a7869b7d0ea6d810ea10.log

```

That may not fix the search problem you describe, but you should then get more information in the log file.

---
Tags: drupal
---


# Question
Title: How can I use Xdebug with CiviCRM unit tests?
Ideally in conjunction with an IDE (I use Netbeans, but will fire up pretty much anything that gets this to work).

# Answer
> 9 votes
Xdebug configuration is a somewhat temperamental issue -- the details depend on the IDE, the PHP build, host OS, target application, test suite, etc. Providing a good answer to this is tricky -- e.g. I could describe my configuration (Mac OS X, PHPStorm 2016.2, MAMP 3.4, PHP 5.4, buildkit/dmaster), but the odds are that most people reading it will need something *slightly* different -- and in six months one of those pieces will have changed in a way which breaks it.

Rather than a comprehensive step-by-step guide, we might look at a few distinct problems. After you've looked at these separately, it's easier to tackle them together.

# Problem 1: Running PHPUnit generally (most PHP projects)

The idealized workflow for PHPUnit can be imagined as something like this:

```
1: wget https://phar.phpunit.de/phpunit-old.phar -O /usr/local/bin/phpunit4
2: chmod +x /usr/local/bin/phpunit4
3: git clone https://example.com/my-php-project.git
4: cd my-php-project
5: phpunit4

```

Step #1-2 can be accomplished in a few ways -- e.g. download from `phpunit.de` or download civicrm-buildkit or run `apt-get install phpunit` or somesuch. Whatever the approach, take care to note the precise name of the executable (e.g. `phpunit` or `phpunit4` or `phpunit.phar`).

In step #5, you call this executable, and it reads a configuration file from your project (`phpunit.xml.dist`). By default, it runs all tests in your project. However, you can run a specific test-file or test-folder, e.g.

```
5b: phpunit4 tests/foo/MyFullTest.php
5c: phpunit4 tests/foo/

```

# Problem 2: Running PHPUnit with the CiviCRM test cases

To run the CiviCRM tests (v4.7+), there are a few additional requirements. These requirements are generally met automatically if you use `buildkit` and `civibuild`, but it may help to describe them anyway:

* You must have the command `cv` installed.
* You must have a working CiviCRM installation.
* You must have an extra, headless database defined in `TEST_DB_DSN`. (To view/edit this option, use `cv vars:show` and `cv vars:fill`.)
* You cannot run all tests by default. Always specify a particular test-file or test-folder (e.g. `phpunit4 tests/phpunit/api`).
* You may need to set the environment variable `CIVICRM_UF`. For some tests (eg `E2E` and `WebTest`), this can be blank. For other tests (e.g. `api` or `CRM` or `Civi`), set `CIVICRM_UF=UnitTests`.

Assuming these requirements are met, you can invoke the "E2E" tests using a conventional PHPUnit command:

```
phpunit4 tests/phpunit/E2E/AllTests.php

```

To run all the "CRM" tests, you would execute:

```
export CIVICRM_UF=UnitTests
phpunit4 tests/phpunit/CRM/AllTests.php

```

I suggest that you get this working before trying anything inside an IDE.

This page may also be useful: https://github.com/civicrm/civicrm-core/blob/master/tests/README.md

# Problem 3: Running PHPUnit with an IDE+XDebug

This part varies widely, and I can't do it justice. I'd usually do a Google search like "phpstorm mamp xdebug phpunit" or "netbeans ubuntu xdebug phpunit" or "eclipse vagrant xdebug phpunit". For most permutations of IDE and PHP runtime, you should be able to find some guidance like this for Netbeans, or this and this for PHPStorm.

# Bring it together

Whatever instructions are provided for the IDE, keep an eye out for how to set these additional configuration options for Civi:

* Specify where `phpunit` lives (e.g. `/usr/local/bin/phpunit.phar` or `/home/myuser/buildkit/bin/phpunit4`)
* Specify the working-directory as the CiviCRM folder (e.g. `/var/www/drupal/sites/all/modules/civicrm`).
* Specify the PHPUnit configuration file as CiviCRM's `phpunit.xml.dist` (e.g. `/var/www/drupal/sites/all/modules/civicrm/phpunit.xml.dist`)
* Specify the environment variable `CIVICRM_UF=UnitTests`.

As a demonstration, the following includes screenshots about setting those options within a specific version of PHPStorm. However, the precise windows+fields may be different in your IDE.

# Variation: Extension Test Suites

Beginning in 2016, the recommended practice for testing extensions is to create your own test-suite inside each extension -- e.g. each extension should have its own `phpunit.xml.dist` and its own `bootstrap.php` file. Configure your IDE to use those resources, e.g.

* Specify where `phpunit` lives (e.g. `/usr/local/bin/phpunit.phar` or `/home/myuser/buildkit/bin/phpunit4`)
* Specify the working-directory as the extension's folder (e.g. `/var/www/drupal/sites/default/civicrm/ext/org.example.mymod`).
* Specify the PHPUnit configuration file as the extension's `phpunit.xml.dist` (e.g. `/var/www/drupal/sites/default/civicrm/ext/org.example.mymod/phpunit.xml.dist`)
* Specify the environment variable `CIVICRM_UF=UnitTests`.

# Legacy: `tools/scripts/phpunit`

CiviCRM v4.7 works with a standard executable of phpunit 4.x. However, in older versions, you had to use an alternative executable, `tools/scripts/phpunit`. Unfortunately, this executable required a different syntax which made it incompatible with IDE's and other tools. You can still use the `tools/scripts/phpunit` syntax in v4.7, but I consider it a distraction.

---
Tags: developer, debugging, unit-testing, xdebug
---


# Question
Title: After upgrade to 4.7.13, I get 500 Internal Server Error when creating new mailing
After upgrading from 4.7.11 to 4.7.13 (with Drupal 7.51), I get à 500 error (Internal Server Error) on an ajax call when attempting to create a new mailing. The screen stucks at "Initializing..."

* The message in the console is : GET XHR http://dev.lists.sciences-po.fr/fr/civicrm/ajax/rest \[HTTP/1.1 500 Internal Server Error 381 ms\]
* Parameters are : action=get&entity=MailingGroup&json={"mailing\_id":"6"}
* There are some similar ajax call before and after the faulty one, without any problem.
* There are no javascript error except this one.
* There are no group in the civicrm\_mailing\_group table

Have you got an idea of debug tests I could run to understand more about this error ? I know, I definitely need to read the server logs, but I don't have access.

Thanks for your help.

Philippe

# Answer
> 2 votes
After investigations :

* The issue is due to i18n : if multilingual is on, then the bug raises. When it's off, there are no bug.
* CRM\_Core\_DAO\_AllCoreTables::registerEntityType returns only table names without language code. In my case, the function returns civicrm\_group instead of civicrm\_group\_fr\_FR. Then, the function CRM\_Core\_DAO\_AllCoreTables::getClassForTable($table) returns nothing, which ends with the following error : PHP Fatal error: Class name must be a valid object or a string in /store/www/dev.lists.sciences-po.fr/html/sites/all/modules/civicrm/CRM/Utils/SQL.php on line 53

Guess some hook in the i18n module is missing or not working properly.

---
Tags: drupal, error, 4.7, ajax
---


# Question
Title: Lots of failed Static function errors after upgrade to 4.7.13 (Joomla)
Just upgraded from a very old (4.4 something) release to 4.7.13. Lots of things are working, but getting lots of these:

Call to undefined method CRM\_Contact\_BAO\_Query::processSpecialFormValue()

Seems to be just static functions.

Anyone else seeing this?

# Answer
Solved. There were some old customised files hanging around that are no longer needed.
> 1 votes

---
Tags: joomla, upgrade, 4.7
---


# Question
Title: manual contribution entry not showing up on contacts contribution summary
I am brand new to CiviCRM :) 4.7.4 We are using WordPress for our website 4.6.1

I am trying to manually enter a contribution and/or a pledge as I am testing out the new database with just a few contacts. I am trying to add a contribution manually one by one to a donor that already
exists in the database. Also did this with a pledge

Contact selected: Daffy Duck Selected Contributions tab, then new contribution

Financial type - Campaign Contribution Total Amount = 875.00 (US$) Source = Board Contribution status = Pending (since this is one of 4 payments to be made)

Soft Credit - N/A

Under Payment Details: Received: March 24, 2016 Time: 10:00 a.m. payment method = Check Check no. = 9083 transaction id = blank Receipt date = July 27, 2016 Time: 12:22 pm

Under Additional Details: Non-deductible amount = $22.00 Fee amount = blank n/a Net amount = 875.00 all other fields left blank

Hit the SAVE button and said contribution was saved to contact

But when I go to the Contributions or Pledge summary page for that contact it does not show any dollar amount for the contribution of $875 that I
put in.

the first column which should show the $875 only shows a blue Dollar sign ($)
with **no amount**. Type "campaign contribution" and Source "Board" appear as they should

why is the amount not showing up? Thank you for your assistance. BB

# Answer
> 1 votes
If you have two transactions entered that are exactly the same and both pending, but one is cancelled, it may have created a conflict in the system. Try deleting the cancelled transaction and see if that helps.

---
Tags: civicontribute, pledges, civipledge, summaryfields
---


title: Redirecting Wordpress users on login

text:
# Question
Title: Redirecting Wordpress users on login
I'm just starting to work on CiviCRM for Wordpress, after having worked on CiviCRM for Drupal for such a long time. The one thing I dislike about wordpress is that when a user goes to log in, they are directed to the admin portal.

So I was wondering what others did to just direct members only to their profile page on the website, rather than to the admin portal after loggin in.

Thanks!

Matt

# Answer
> 3 votes
I've used Peter's Login Redirect successfully for a similar purpose.

# Answer
> 4 votes
Have a look at the `login_redirect` filter. You can return whatever URL you like for whoever's logging in:

https://codex.wordpress.org/Plugin\_API/Filter\_Reference/login\_redirect

# Answer
> 3 votes
I use a WP Redirect After Login Plugin. It is in the WP Plugin Library. https://wordpress.org/plugins/redirect-after-login/ I just change the Subscriber Role (or whatever Role your Members are defaulted to) to go to the dashboard url.

I have not had any conflicts with my theme or Civi with this Plugin. As of 10/19/2016

---
Tags: wordpress, user-account, user, user-dashboard, user-interface
---


# Question
Title: Can I turn off Drupal cron while the CiviCRM upgrade script is running?
I want to know if it is a bad idea to turn off cron while in the middle of upgrading the CiviCRM?

Below is my original post, but now I see that this information is irrelevant/unrelated.

I am upgrading our CiviCRM from 4.3.8 to 4.7.13. On my local dev environment, the update went basically fine, but I didn't have cron turned on. On my remote test site, which does have cron runs, the update seems to be stalled. Watchdog is showing cron errors for the last 3 hours with seemingly no progress. I suspect that Drupal's cron is trying to run and everything is being stalled because of this error, that could be caused from jumping so many versions. What I want to know is if I can open another terminal window and turn off cron until I'm done running the update script or is this a bad idea, especially since it's already running?

In case it's important, here is the cron error:

```
error  cron  EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7953 of /var/www/html/mydomain/docroot/includes/common.inc).

```

# Answer
> 2 votes
My standard for Drupal cron is to only run it every 8 hours. Unless you use modules that expect a more frequent update (e.g. to pull in RSS feeds in a timely manner) you should be fine turning it off for a day.

---
Tags: drupal, upgrade, error, cron
---


title: CiviMail template errors

text:
# Question
Title: CiviMail template errors
I have been having issues using templates in CiviMail. If you use the sample responsive newsletter template the draft cannot be saved. We get an "error: Sorry your information could not be saved"

With out the template no issues. I have tried with different sample templates and the issues are the same. I have also tried different sites. Not sure when this started. I know on one site it was all fine earlier this year.

Anyone experience anything similar?

CMS: WordPress & CiviCRM 4.6.21 (also tried in 4.7.10)

# Answer
> 2 votes
I had the same problem. It happened after upgrading CiviCRM. The cause was the html. There were problems/errors with the html template along with too many tables. We used the W3 validator (https://validator.w3.org/). That helped a lot but did not find all the problems. So we just kept testing portions of the html until we found the section that was preventing CiviCRM from saving. Eventually we were able to clean up the html and CiviCRM was able to save it.

# Answer
> 1 votes
I'm on Drupal and have had the same problem. It was caused by my hosting provider implementing mod security rules on the server. Once the offending rules were whitelisted the problem went away.

For the record every time I have any 403 error in CiviCRM I now first check with my hosting provider - it has inevitably been a mod security rule that was causing the problem.

# Answer
> 1 votes
Here is what my web host said - I was hitting a ModSecurity rule for SQL injection protection. They fixed it and it saved. :)

---
Tags: wordpress, civimail
---


title: 403 error accessing PDF view of report

text:
# Question
Title: 403 error accessing PDF view of report
We're running CiviCRM 4.7.13 on Drupal 7.51 on a shared server.

I am the administrator for our site and AFAICT, I have admin privileges for everything. However, whenever anyone, myself included, opens a report (eg Membership Detail report), we can view the results on screen, page through them etc., but we can't print the report, print to PDF or export as CSV, all we get in each case is the 403 "Forbidden" error.

My main problem trying to work out the cause of this problem is finding some sort of error message. Thanks to how do I find error log to see what is causing the error and pages linked from that question I've been able to locate our PHP log file and our CiviCRM log file but neither shows any entries that are obviously related to this problem.

I believe this is a symptom of some broader issues we have with the Organic Groups module on our site so I am mainly looking for tips on increasing the usefulness of existing logs (or any other logs I should be looking for). Other questions on those topics haven't helped me so far.

TIA,

# Answer
I would suggest that you talk to your hosting provider. It is possible that they may be incorrectly marking this as suspicious activity and hence giving you a 403 error. Hosting companies are continuously updating their server monitoring rules that seek to prevent malicious activity. Occasionally this creates false positives. If this is the case they should be able to whitelist your site.
> 1 votes

---
Tags: permissions, pdf, logs
---


# Question
Title: How to set up the filtering in Drupal Views to target the correct CiviCRM Activity
I've got a Drupal View that identifies a specific activity within a case and provides a link to the activity using its ID number. It appears to be working correctly in the majority of use cases, where I can simply filter out deleted cases, and filter on the activity type, status and current revision to find the right activity.

However, in some cases the view is showing me a link to an activity which I can't see when I view the 'Manage Case' screen. Indeed the activity ID that the view is presenting doesn't even show up when I search within CiviCRM for activities that match the other filters I'm using in the view.

It looks like CiviCRM - at least in the version I'm using in this case - is changing the ID number of activities when the activity gets edited?

# Answer
> 2 votes
When you edit a case activity, it creates a new version of it, and that does indeed have a different ID.

---
Tags: activities
---


# Question
Title: Example: Recommended way to hide entry fields in new contact view
I just got CiviCRM installed and I also did some customizing, but now I am not sure how to proceed. AFAICS using extensions and hooks is the recommended way of customizing civicrm, but there no examples for hiding/removing fields, although many people seem to need that. Could someone post an example of hiding unwanted fields like nickname/pseudonym or something from the new contact entry page? Let me explain: I want to set up Civicrm for a non profit club and they are quite conservative. Nicknames and messenger entries are not wanted, so I want to hide them in a way that survives Security Updates.

Thanks

# Answer
One way to simplify data entry is to consider using a Profile as the way for your users to add new contacts. This means you add fields that you want, rather then removing fields you don't want. Once you have created a Profile you can then use the 'create' version link such as

http://d46.demo.civicrm.org/civicrm/profile/create?gid=1&reset=1

but you don't get the same warnings in terms of potential matches, and there are no doubt other downsides (such as the unwanted fields still showing on the Summary screen), but it may be worth a thought as a temporary fix if you hadn't already considered it.
> 2 votes

---
Tags: contacts
---


# Question
Title: Best way to manage common contacts between 2 CiviCRM databases?
The situation is that we have 2 separate non-profit sport organizations. Org A has 1000 paid members and 10000 contacts. They are just now starting the process to switch to CiviCRM as their membership is in a large spreadsheet. CiviMember will likely be a key tool of Org A. I am on the technical committee of Org A.

Org B is a completely separate non-profit created specifically for an annual event that Org A is sponsoring financially next year, and with volunteers from Org A's list of contacts. CiviEvent will be a key tool of Org B. I am the president of Org B.

Currently, Org B has no list of contacts list at all as it is new. We want to keep some organizational separation between A and B, since they are both separate legal entities, and also because in the future there may be little or no need to link them. They both currently have separate web sites, FB pages, etc and both Orgs will be using WordPress.

There are some commercial membership software that allow "sub-accounts", that is, a parent organization with sub-organizations. I do not believe this to be the case with CiviCRM, but correct me if I'm wrong. Also, I don't see any built-in way to "link" 2 CiviCRM instances unless one does custom development, again correct me if I'm wrong.

**My question is**, if Org A has their own CiviCRM and Org B has our own CiviCRM installation, would it be best to manage volunteers for Org B's event in Org A's CiviCRM, or just maintain separate CiviCRMs and export those volunteers over to Org B's?

(or is there another solution I'm missing?)

EDIT: after doing a bit more research, I did find some info on WordPress Multi-site, but since both Orgs are hosted with different web hosts I don't think that will work for us, again correct me if I'm wrong.

thanks

# Answer
I am by no means an expert or experienced with multi-site or multi-org implementations but this is my take on it.

If the two Orgs were going to be perpetually involved with each other then it would make sense to setup one Civicrm instance and share the database. Utilizing the Multi-site and Multi-org settings found here.

However, since the two Orgs will not be perpetually involved that doesn't really make sense (at least to me). I would, if I were implementing this instance, setup Civi for each Org separately. I would obtain an export (hoping Org A allows it) of their contacts and import those contacts into the Org B's Civi install for an initial load. That way you would start out with identical contact databases. You could occasionally obtain an export from Civi OrgA's contacts and import into Org B's civi install utilizing a de-dupe rule.

You could also, if you have a developer or want to pay for it, create an extension or script that would sync the contact databases at regular intervals.
> 4 votes

# Answer
To me it does not make sense to have 2 separate CiviCRM's? I assume you actually want to make sure you know if one individual is involved with both organizations, so it would make sense to have one overall CiviCRM behind the screens if you like.

If you take that approach you might think about these alternatives for your websites:

1. For security reasons some organizations want to separate their public facing website from their back office database. These organizations have their public facing website(s) on other servers than their CiviCRM, and develop (or have someone develop) a service that allows their relevant pages or forms to communicate with CiviCRM using the API
2. You might want to have one CiviCRM (probably the org A one) with a CiviCRM on the same server, and develop (or have developed) some event forms that communicate with CiviCRM for org B.
3. You might include the event forms created on the CiviCRM/Website of Org A as a iframe on Org B's server. This you could do without any actual coding but does required some knowledge on how to set this up.

I do recommend you involve a CiviCRM partner in the decision on where to go, you can find one near you on https://civicrm.org/partners-contributors
> 3 votes

---
Tags: civimember
---


# Question
Title: Event invitations and RSVP functionality
Part question - part feature/support request.

However, I often get asked by clients how they can invite people to meetings, and enable a richer RSVP functionality, whereby invitees can respond with an 'accept', 'decline', or 'maybe'.

I tell them that Civi doesn't explicitly understand the notion of declining an invitation, it's more that no response to an invitation is assumed to be a declination, and there's no support for the concept of 'maybe'.

At least that's my understanding of the current state of play. I may well be wrong (it wouldn't be the first time :-)).

I guess it would entail a somewhat different approach to events, but wondering if anyone has any thoughts on this issue?

I was looking at the .ics files that Civi makes available from event information pages, and wondering what might be entailed in perhaps attaching that file to an event invitation email via a token and when the recipient double clicks the .ics (or its automagically picked up by their calendar app, they could RSVP simply clicking one of the options, as is now the case with a Google calendar invite, for example.

# Answer
> 3 votes
I found this on https://wiki.civicrm.org/confluence/display/CRM/RSVP-style+Event+Registration.

It's an old post but I had a quick look and it still should work. It doesn't allow the 'maybe' option tho....

===

1) Enable "On waitlist" event participant status (Administer -\> CiviEvent -\> Participant Statuses)

2) Create an event. We don't need the "Offer the waitlist" option, the below will work without it. Enable Online Registration.

3) Find contacts in CiviCRM, and on the results page, from the drop down "Actions" select "Add Contacts to Event". On the next page, change the "Participant Status ID" to "On waitlist". Uncheck "Send confirmation" if you don't want those contacts to receive an email about a fact that they were added to the waitlist. They will still separately receive a follow up email with a tokenized link to register/cancel the registration.

4) When the Scheduled Job "Update Participant Statuses" runs (or execute it manually for testing) (Administer \> System Settings \> Scheduled Jobs), an email with a customized link to the registration page will be send to everyone on the waitlist.

5) When a invited participant follows the link, they will be presented with an event registration page with two options: "Confirm Registration" and "Cancel Registration". If the confirm, a regular event registration page will be presented with their information pre-filled. If they select "cancel", their status will be changed to "cancelled".

To modify the text of the email that is send to participants on the wailist, update message template "Events - Registration Confirmation Invite" (Mailings \> Message Templates \> System Workflow Messages)

---
Tags: civievent, calendar
---


# Question
Title: Event registration allows free registrations (but shouldn't)
We have 2 price levels for our events: adult and child but cannot make either of them required as it is possible in our case to register either a child, or an adult. We use the numeric/quantity fields. Some people hit "register" without filling in anything and get through to the confirmation screen. In the back-end the registration shows up with a "registered" status and "attendee" role and payment amount "$0". How can this be prevented?

Joomla 3.4.8 CiviCRM 4.6.10

http://www.nywolf.org/?option=com\_civicrm&task=civicrm/event/info&reset=1&id=350

I'm not allowed to post more than 1 image so here's the back-end:

# Answer
> 5 votes
A way to do this would be the following:

* Enable in the Event Configuration the option "Register multiple participants?"
* Use in the priceset a radio button for child/adult. You can make it required and add a different price for each.

You will have the option to set a different "Profile for Additional Participants", so you can collect different data for the person entering the form compared to the other participants.

That way you know who will attend the course and know per registrant whether it is a child or parent.

# Answer
> 1 votes
This should be fixed in 4.7.14: https://issues.civicrm.org/jira/browse/CRM-19626.

---
Tags: civievent
---


# Question
Title: how do I find error log to see what is causing the error
I am not the technical person - merely a user so I am very unfamiliar with this tool. I am trying to find the reason for the error I receive when trying to search the contacts for all individual contacts. The error I receive is: Sorry. A non-recoverable error has occurred. DB Error: unknown error.

# Answer
The links in the comments are helpful, but don't actually give the correct answer for the log in question.

There's two ways to see the logs for your error:

* Check the ConfigAndLog directory. You can find it here: Where are the "ConfigAndLog" and "templates\_c" directories?
* You can also see the error on-screen: Go to **Administer menu » System Settings » Debugging and Error Handling**, and select both "Enable Debugging" and "Display Backtrace". Then repeat whatever issue led to the error! Make sure to turn this off when you're done - leaving it turned on can leak information to a potential hacker, which is why they're not on by default.
* Install the Log Viewer extension from your **Administer menu » System Settings » Extensions**. This will add a new entry under **Administer menu » Administration Console**.
> 4 votes

---
Tags: contacts, search
---


# Question
Title: Administrator does not have sufficient permissions when running upgrade script
I've run into an issue with Civi CRM and I'm hoping after an upgrade it may resolve itself. It's been a couple years since we starte using it on the site. I'm following the steps that are located here and have no problem up until I get to step 4, when I need to "Run the Upgrade Script". I've replaced *your\_wordpress\_home* with my home link but all I get is a "You do not have sufficient permissions to access this page" error. My folder permissions are correct, I downloaded and unzipped the correct wordpress zip file and I'm logged in as the Administrator so I can't see why I'm running into this error.

I've searched around and there may be something to do with a database permission for the administror account? Or is there something else I should be doing in this case?

I had run into this question/answer however I've checked my download at it is indeed correct *civicrm-4.7.13-wordpress.zip*.

Any help or guidance with this is greatly appreciated as I've been trying to re-upgrade and delete and go through the whole process again and agian but I run int othe same issues.

# Answer
> 1 votes
From the steps you've taken, it seems you are trying to do an install on Wordpress.

Have a look at the "Upgrade Troubleshooting" paragraph near the foot of the page at https://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Wordpress The "You do not have sufficient permissions to access this page." error when trying to run the upgrade script(step 4), probably means that you most likely deactivated CiviCRM plugin during the upgrade process. You just have to visit /wp-admin/plugins.php and activate the plugin, and then proceed with step 4 .

Hope this helps.

---
Tags: wordpress, upgrade
---


title: Discount Codes Stop Working After a Day

text:
# Question
Title: Discount Codes Stop Working After a Day
We currently have CiviCRM 4.4.6 installed with Drupal 7.36. Our version of CiviDiscount is 2.5.

Our issue is as stated in the title. Our discount codes stop working after about a day. It will start giving us fatal errors, the most recent being "/civi\_extensions/org.civicrm.module.cividiscount/cividiscount.php on line 848".

If we delete the offending discount code and replace it either with the same code or a new one, it will work for a brief period before doing the same thing. This is becoming problematic as we have quite a few upcoming events that need discounts applied to them.

I'm not sure if this is a bug or related to the amount of discount codes we have in the system (~65).

It should be noted that we are in the process of upgrading to CiviCRM 4.7 and have a dev site up, however I haven't had a chance to see if 2.5 is a problem on that installation as well. We'll ideally be upgrading CiviDiscount to the latest version for CiviCRM 4.7, but until then, I need a solution to our current installation.

# Answer
> 1 votes
Upgrading to the latest version seems to have fixed the problem.

---
Tags: cividiscount
---


# Question
Title: Exclude contacts from report based on membership they have
I want to make a report that only shows contacts that **don't have** any of the listed membership id.

The following SQL code filters the memberships, but still lists contacts that have other memberships, including the ones I want to avoid (e.g.: it shows *Joe* with a membership type 8, but *Joe* also have another membership of type 7, so I want to exclude *Joe* from the report).

When trying to make this with Search Builder I got the same situation.

I'm using Joomla! on that, so Drupal Views are **not** an option. I have the last CiviCrm version.

> SELECT SQL\_CALC\_FOUND\_ROWS contact\_civireport.sort\_name as civicrm\_contact\_sort\_name, contact\_civireport.id as civicrm\_contact\_id, membership\_civireport.membership\_type\_id as civicrm\_membership\_membership\_type\_id, membership\_civireport.join\_date as civicrm\_membership\_join\_date, mem\_status\_civireport.name as civicrm\_membership\_status\_name
>
> FROM civicrm\_contact contact\_civireport INNER JOIN civicrm\_membership membership\_civireport ON contact\_civireport.id = membership\_civireport.contact\_id AND membership\_civireport.is\_test = 0
>
> LEFT JOIN civicrm\_membership\_status mem\_status\_civireport ON mem\_status\_civireport.id = membership\_civireport.status\_id
>
> WHERE ( mem\_status\_civireport.id NOT IN (1,2,3,4,5,6,7) )
>
> ORDER BY contact\_civireport.sort\_name, contact\_civireport.id, membership\_civireport.membership\_type\_id
>
> LIMIT 0, 50

# Answer
> 2 votes
One solution could be to make a Smart Group (A) of those with Membership X or Y or Z, then have another Smart Group with the larger target group eg All Individuals (B), then use the Custom 'Include / Exclude' Search to do B not A.

This may not help you if your need an sql query but could be useful to others (if it works as I expect it would)

# Answer
> 2 votes
From the description it seems you need to filter the report using type id whereas the query applies the condition on `membership_status_id`. You may also need a subquery to address this -

Instead of

```
WHERE ( mem_status_civireport.id NOT IN (1,2,3,4,5,6,7) )

```

try removing the contacts from the query itself which has those `membership_type_id`. Something like -

```
WHERE (contact_civireport.id NOT IN (
  SELECT contact.id
  FROM civicrm_contact as contact
    INNER JOIN civicrm_membership membership
      ON contact.id = membership.contact_id
      AND membership.is_test = 0
  WHERE membership.membership_type_id IN (1,2,3,4,5,6,7)))

```

This will remove any contact having `membership_type_id` in the ids provided.

---
Tags: civimember, joomla, custom-reports
---


# Question
Title: Using the 12 hour time display option, how can I schedule a mailing to go out at 1 minute past midnight?
I like to use the 12 hour time display option to set and present times. In most cases it is simply more easily understood.

On a number of occasions it's been important to carefully schedule the timing of a mailing, for example to coincide with the lifting on an embargo on a press release issued by a third party. These can commonly be embargoed until 00:01 on a given date. Id like to set the timing for a mailing to go out at 00:01, but as far as I can tell the field won't accept '00' as the hour value. What time should I set in this field to represent 1 minute past midnight?

# Answer
> 3 votes
When you schedule the time you should set to 12:01AM. Initially the time display doesn't display AM/PM but once you begin to enter a time it should show and be editable.

---
Tags: civimail, scheduling
---


# Question
Title: Make the Contact create API behave like UI in the way in checks for duplicates
I am creating a contact using CiviCRM API, what I have noticed that the duplicate checking looks inaccurate compared to the check done when entering new contacts via the User Interface.

Under the CiviCRM API, it's only a match if the given parameters are exactly the same like "John Smith of john@here.com" does not match "Johnathan Smith of john@here.com", for example, but in the UI, simply entering a matching e-mail address throws a warning.

Is there a way to make the CiviCRM API dupe check behave more like the UI ?

I am passing the parameter `dupe_check = true`. The complete call is:

```
$result = civicrm_api3('Contact', 'create',
          array( 'sequential' => 1,
                 'contact_type' => "Individual",
                 'first_name' => "raj",
                 'last_name' => "l",
                 'dupe_check' => 1,
                 'api.Email.create' => array('email' => "raj@abc.com"), )
           );

```

# Answer
I did some research in the code. When you use the contact API, the default *Unsupervised* rule for the Contact Type. This rule is configurable in the *Contacts -\> Find and Merge Duplicate Contacts* screen.

Update: The contact has another option. You can use the `duplicatecheck` method. But it cannot be tested in the API explorer. The following code returns the contact\_ids found deduplication rule 4 (Checking on email for Individuals).

```
$result = civicrm_api3('Contact', 'duplicatecheck', array(
     'return' => array("display_name"),
     'dedupe_rule_id' => 4,
     'check_permission' => FALSE,
     'match' => array(
        'contact_type' => 'Individual',
        'email'        => 'blue@example.com'
  )
));

```
> 1 votes

# Answer
There are different sets of deduplication rules, and you can create your own. They may be:

* Unsupervised- are used automatically when contacts are created in certain ways, such as through imports, event registrations and profiles
* Supervised- are used to check/warn of possible duplicates when creating new contacts in the UI
* General- you can use these at your leisure from the "Find and Merge Duplicate Contacts" page

What you're seeing in the API is probably only the Unsupervised rule, which should be deliberately strict. What you're warned about in the UI will be the Supervised rule.

The docs: https://docs.civicrm.org/user/en/4.6/common-workflows/deduping-and-merging/
> 1 votes

---
Tags: contacts, api, duplicate-contacts
---


# Question
Title: How to evaluate hosted CiviCrm enviroments
What are the features I should be looking at when considering a hosted CiviCrm environment? Are there red flags I should look for from a vendor? There are a number of vendors out there all claiming to the best/fastest/most supported. Prices range from $3-$20/mo so how to choose?

# Answer
> 6 votes
Much could be said on this (and probably will be!) but here's a few starters you might want to consider. What is "best" for you depends on which factors are important for you.

If you use a hosting environment that specifically supports CiviCRM then things like MySQL version, MySQL permissions, php version, php memory will be ok. Otherwise, you need to check they meet CiviCRM's requirements which are fairly demanding.

Some hosters will upgrade Drupal & Civi for you. On others, you manage your own upgrades.

Some provide Let's Encrypt automated free SSL certificates.

Some provide ssh access. If so, do they provide drush, wget, git etc? (Does drush, wget or git matter to you?)

Personally I'd opt for a specialist CiviCRM hoster. Avoid a hoster that doesn't explicitly mention CiviCRM.

# Answer
> 3 votes
I can't resist adding that with a cheap host, you'll probably get what you pay for, but only if you're lucky. And as the old Bell bicycle helmet commercial used to say, if you have a cheap head, buy a cheap helmet.

So: what is your data worth to you? And how much is it going to cost you if something goes wrong? Not just issues of performance and availability, but also security and privacy.

---
Tags: hosting
---


title: How to Add Image Field in CIVICRM

text:
# Question
Title: How to Add Image Field in CIVICRM
I am trying to add an Image as Custom field in Civicrm Contact, but the Image Field type is not in the Custom Field section. It has only Field type as File.

How to apply Drupal Image styles for Images uploaded on Civicrm Contact.

I have integrated Civicrm in Drupal 7.

# Answer
Yes, there's no custom field type specifically for images. You can of course put an image in a file field type. Interestingly, the image field that is available for organizations is technically there for all contact types, just not enabled for individuals, so I'd guess it wouldn't be hard to turn it on.

To display images from CiviCRM in Drupal, I use views and the external image cache module here: https://www.drupal.org/project/imagecache\_external

It's a useful technique from Chris Burgess, who describes how to use it here: https://forum.civicrm.org/index.php?topic=34929.0
> 3 votes

---
Tags: drupal, custom-fields, webform-civicrm, images
---


# Question
Title: How to send subscriptions to a non-primary address
We would like to manage the sending of our magazine via CiviMember as « The Monthly » made it.

We have an additional problem: certain contacts wish to receive their subscription to an address different from the primary address, the primary address remaining the address for the others sendings.

Is there a (simple ?) way to associate a particular address with a membership ?

# Answer
> 1 votes
You can create a new Location Type at Administer \> Customize Data and Screens \> Dropdown Options \> Location Types. I take it that most contacts will use the Primary Snailmail address, but that a small proportion won't. So I would manually create and manage the use of the override location type for the smaller group.

There are various ways to handle the creation of the mailing labels. You could either export both primary and override addresses to Excel and then do a bit of coding in Excel to choose the override if it exists else the primary. Or you could do a bit of custom coding to provide tokens in CiviCRM that do the same thing. You could probably also do it in Smarty fairly easily if you have full mailing address for both locations in two variables exposed to Smarty.

Unfortunately I can't think of an easy way to print the labels in core CiviCRM. Maybe others will. Good luck.

---
Tags: civimember, addresses
---


# Question
Title: CiviReport - Add days to Transaction Date for Estimated Deposit Date
Our Treasurer has asked for a report that will help him reconcile the monthly bank statement more efficiently. As with most financial services vendors, our vendor (iATS) has a delay between the transaction date (or receive date in Civi) and the day the money is actually deposited into our organization's bank account. This creates an extra step for our treasurer as he has to line up the transaction dates in Civi to the deposit dates on the bank statement.

iATS has the added wrinkle that credit/debit card transactions are deposited on a different schedule than ACH/EFT transactions. **How can I create a column in the CiviContribute Bookkeeping Transactions report that will give an estimated deposit date for each donation based on what type of payment instrument was used and what day of the week the transaction took place?**

For reference, iATS deposits transactions on this schedule:

* Credit/Debit cards - 1-2 business days, rolling; to be safe, the default on the report will be 2 business days unless the transaction happens on a Friday-Sunday; then it will be the following Monday.
* ACH/EFT - each Sunday through Saturday is deposited on the following Wednesday.

Civi 4.6.20, Drupal 7

# Answer
> 2 votes
This is not an elegant solution by any means. But it does work. So there's that.

To start, I copied the Bookkeeping transactions report from here (sites\all\modules\contrib\civicrm\CRM\Report\Form\Contribute) and renamed it Reconcile.php and placed the new file in my custom PHP folder so I wouldn't be adjusting the original report.

I renamed the class on line 35 to `CRM_Report_Form_Contribute_Reconcile` so the class name and file name match.

My report does not require both the Receive Date and Transaction Date columns, so I re-purposed the Transaction Date column. (Truthfully, I would rather have been able to add a column for this, instead of re-purposing an existing one... but alas, I didn't know how). In the `function __construct()`, under `'civicrm_financial_trxn'` `'fields'`, I changed the `'title'` of `'trxn_date'` to 'Est Deposit Date'. Approx line 299:

```
'trxn_date' => array(
  'title' => ts('Est Deposit Date'),
  'default' => TRUE,
  'type' => CRM_Utils_Type::T_DATE,
),

```

I also changed the title in the `'filters'` section so that the UI would match.

Then in `'function select()'`, I added another `case` to the `switch ($fieldName)` (which begins approx line 371). Our payment instrument 1 is credit/debit cards. Our payment instrument 2 is ACH/EFT.

```
//adjust Transaction Date column to yield adjusted dates for Estimated Deposit Date
case 'trxn_date':
  $select[] = " CASE
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 1 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 1
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 1 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 1 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 6
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 3 DAY)

     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 1
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 10 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 2
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 9 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 3
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 8 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 4
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 7 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 5
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 6 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 6
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 5 DAY)
     WHEN {$this->_aliases['civicrm_financial_trxn']}.payment_instrument_id = 2 AND DAYOFWEEK({$this->_aliases['civicrm_financial_trxn']}.trxn_date) = 7
     THEN DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 4 DAY)

     ELSE DATE_ADD({$this->_aliases['civicrm_financial_trxn']}.trxn_date, INTERVAL 2 DAY)
     END AS civicrm_financial_trxn_trxn_date ";
break;

```

I'd be curious to hear and learn how others might have tackled this. I know I could have done this as an extension, but that would have been more work for me at this point. Maybe if I learned the extension system better it wouldn't be more work in the future. :-) I also initially tried finding a solution in Drupal Views, but I couldn't sort out how to add days to a date within the Views ecosystem.

---
Tags: civicontribute, civireport, developer, mysql
---


# Question
Title: Custom Field doesn't appear in Drupal views using civicrm entity module
I'm trying to use the Drupal module civicrm entity in views to render a custom field (Image) I created in contacts in civicrm 4.7.13, I did the views integration through settings.php and in views when I add the field provided by CIVICRM Entity I get the error:

> Column not found: 1054 Unknown column 'civicrm\_contact.custom\_4' in 'field list'

The field provided as "Custom Data Field" in views works but it only displays a link to the uploaded image and I need it as an entity to apply image styles on it, etc..

# Answer
> 1 votes
If you have the link to the image file in the view then I would try rewriting the results of that field. Set it up as an `<img src=[token that has path to image] />`.

Then you can add a class to it and style it as you wish.

---
Tags: custom-fields, drupal-views, civicrm-entity
---


title: Multiple Tax Rates

text:
# Question
Title: Multiple Tax Rates
I have a client that needs multiple tax rates added together for the same product. Specifically, state and county tax but, ideally the plugin would allow for more (city tax, special district tax, etc.)

For example if State Tax is 5% and City Tax is 2% and the item cost is $1.00, then I need to see $1.07 as the total, but $1.00 as Product, $0.02 as City Tax and $0.05 as State Tax in the financials.

I see that there is an open issue for that request here:

https://issues.civicrm.org/jira/browse/CRM-18580

Has anyone successfully implemented multiple tax rates? Did you use an openly available plugin? If not, is anyone willing to quote the work for such a plugin?

Thanks!

# Answer
> 2 votes
We have implemented this in a non-generalized way for a couple of clients (eg https://github.com/JMAConsulting/biz.jmaconsulting.cdntaxcalculator), and have developed a spec for the work involved in making it work easily for everyone. There are various places where this would be useful: Canadian federal and provincial taxes (sometimes harmonized into a single tax), VAT sales for certain online services across Europe, state and city taxes in US, etc.

We think the functionality can be broken into two: a general extension to support two taxes, and jurisdiction-specific extensions to provide rates for a (set of) jurisdictions.

General extension functionality to support up to two taxes:

* during configuration for each financial type
* on display per line item on contribution, membership, and event registration purchase forms, confirmation forms, thank you pages
* on display on shopping cart event registration purchases
* on invoice and credit note downloadable documents
* for pay later, pay immediate, partial payment, cancellation, pending refund, partial refund and refund transactions
* in financial batch export functionality
* on all contribution, membership and event registration system template messages
* on all relevant reports that display financial information (about 15+)
* on API calls for order, payment, contribution, etc.
* on hook calls for determining tax amounts
* automated tests to ensure compliance
* system administrator/bookkeeper documentation

A second extension would provide the data and code to calculate taxes for a specific (set of) jurisdiction(s), like Canadian provinces. The types of rules for determining which taxes are applicable vary between jurisdictions. Generally there is a set of rules to determine place of supply (ie which place the sale occurs in for sales purposes) which can vary between different kinds of sales - physical goods, online services, offline services. The type of sale and place of supply will determine how many and which taxes to apply. Different items may have different tax rates in the same jurisdiction. Updates to the billing address may result in changes to the applicable taxes.

The work can probably be done in separate phases for contributions (when used for taxable products or services), event registrations and memberships (dependent on contributions).

There is likely some opportunity to share costs between various organizations needing this functionality. However, such Make It Happen fundraising efforts usually only succeeded when there was a launch sponsor willing to fund at least half the cost. Please contact me at joe (dot) murray (at) jmaconsulting (dot) biz if you would like to continue this discussion.

# Answer
> 0 votes
Haven't looked at this for a while but I think using price sets with financial types you could probably setup differing tax rates using whats there.

---
Tags: civicontribute, taxes
---


title: Limitations for sending emails

text:
# Question
Title: Limitations for sending emails
We are running a mass mailing from CiviCRM using the Sparkpost Extension. The cron job will only send 400 emails per execution. Is this a limitation of CiviCRM? How do we increase it?

Environment: WordPress 4.6.1 running Canvas-child theme. CiviCRM 4.7.13

# Answer
> 1 votes
At **Administer** \> **CiviMail** \> **Mailer Settings** (`civicrm/admin/mail`) you will find settings for CiviMail delivery.

Do your settings have a **Mailer Batch Limit** of 400? If so, this was probably set on your site at some point.

The default is 0 (unlimited) I think; if it was set to 400 on your site this may indicate the task was timing out before completion. If you're having that issue, running the mail task more frequently may be a good alternative to adjusting the batch limit.

---
Tags: civimail, sparkpost
---


# Question
Title: When Paypal Standard pay as Guest (no paypal account) Session Expired message on Thank You
I'm using CiviCRM 4.7 with paypal standard. When someone proceeds to paypal and chooses the guest option (no account) to pay with credit card, it processes normally. Yet, when returning to the CiviCRM they get the contribution page form again (not the 'thank you page') and a message that 'session expired'. This behavior is consistent across these browsers: Chrome, Edge.

Anyone seen this? Is there a setting or change within CiviCRM to prevent this? People are confused and making a second donation.

# Answer
> 1 votes
It turns out the existing Paypal account had its Primary Email set to one that was different from the Merchant Email used for Paypal login. Making these both the same fixed the pending contribution issue.

# Answer
> 0 votes
We have a new site which went live yesterday and we are also getting the same behaviour. Also in CiviCRM all the Contributions are still pending.

Olly

---
Tags: paypal
---


# Question
Title: Real-time dashlet of contacts without certain activity
I would like to create a dashlet listing contacts who do not have a certain type of activity scheduled.

I've tried a comnbination of smart groups and include/exclude search, which works but does not update in real time.

Volunteers need to see the immediate result if they make an appoitment for a client, the client needs to disappear from the list. Otherwise they will be worried that they haven't done it correctly, and it won't inspire confidence in the system.

I've looked at Views but if I create a view with Contact as the main entity, I try to add a relationship to Activities but Activities does not come up as an option.

I'm about to write a hook that tags and untags contacts when the appointments are made, completed or cancelled. Do I really have to do this? It seems there must be another way!

# Answer
> 2 votes
If the smart group approach is working other than the update latency, you could reduce the Smart Group Cache Timeout at Administer \> Customize Data and Screens \> Search Preferences. Beware that it is likely to increase load on the system, but that may be worthwhile in your case.

See https://docs.civicrm.org/user/en/stable/organising-your-data/smart-groups/#smart-group-caching

---
Tags: activities, drupal-views, dashboard, reports
---


# Question
Title: Unable to create label format for membership card
I'm trying to configure printing of a membership card directly from Civi using a custom mailing label format. Here's what I've done so far:

1. Created a custom label format with the parameters for Avery Label 5371 (business card)
2. Tried to get the data to print as a mailing label on the card stock (which is pre-printed with the org logo) by creating a message template using tokens for member name, membership expiration date, and membership type (Membership Card Data).
3. From member search results, performed the action "Create Mailing Label" and selected the custom label format I created in step 1.
4. Result is a nicely printed list with the name and address of each person, not the information specified in Membership Card Data.

I am guessing that the custom label format controls the size and number of each entry on a page, and the Membership Card Data message template is ignored and replaced by the specs in Localization\>Address Settings/Mailing Label. I can't find anywhere to add a new ***mailing label*** format that contains the tokens I need for membership cards.

I've combed the boards and have seen discussions, but none seem to address my particular problem. Any thoughts?

# Answer
> 3 votes
I ended up creating an extension for a professional organization to handle this - ingredients:

1. `function membershipcards_civicrm_tokenValues` \[you must create the tokens e.g. `$value['membership.type']` and `$value['membership.status']` \- I have 'see Example from Lobo' in my NOTES: https://civicrm.org/node/480
2. Then I have a Task: `class CRM_membershipcards_Task_IssueMembershipCards extends CRM_Contact_Form_Task {` So that you can Find -\> Advanced Search Contacts -\> select them and then in the -actions- you can pick: Print Membership Cards
3. Then in the postProcess for that -action- I swap out the tokens and I re-use much of core mailing label bits - this is everything I want on the card:

> $formatted = $row\['addressee\_display'\] . "\n" . $row\['contact.homestreetaddress'\] . "\n" . $row\['contact.homecity'\] . ' ' . $row\['contact.homepostalcode'\] . "\n" . "\n" . 'License #: ' . $row\['external\_identifier'\] . "\n" . $row\['membership.type'\] . "\n" . $row\['contact.activityskills'\] . "\n" . 'Start Date: ' . $row\['membership.startdate'\];

Eventually that gets passed onto `self::createLabel($rows, $fv['label_name']);`

Then my own `function createlabel` has all my custom layout for this organization: XY positioning of the details, font, logo (watermark) placement, authorized signature.

Hope this helps! You could just create the Tokens and then you might be able to get at them into a template - however if you really want control over layout/looks - you'll need your own createlabel.

# Answer
> 2 votes
I have recently created an extension for printing membership card. It is not as generic as I would like it to be but a good start IMO :)

https://github.com/kurund/com.webaccessglobal.membershipcard

# Answer
> 0 votes
I don't think that there is a function specific for membership cards, but I do believe that event badges is closer than adress labels.

If you enable CiviEvent, you will get another possibility. For participants of an event, you have the ability to print badges. The settings of badge printing will give you some more formatting options than an adress label.

I have not tried this according to your specification, but I do think it could be worth a try.

---
Tags: civimember, joomla
---


# Question
Title: I have put an wp specific extension in my extension directory but it does not appear in the manager
I have uploaded and extracted the CIVIEVENT WIDGET to www/www/wp-content/uploads/civicrm/ext hit refresh on the CiviCRM Extensions administer page but the extension does not appear. Is there something else I need to do?

# Answer
Turns out this a WordPress extension (even though I found it on the CiviCRM extension page) and on about page 3 of the readme.txt it tells you to install it into the WordPress extensions directory.
> 2 votes

---
Tags: extension
---