# Question
Title: Donor with only email address shows no display name
If a NEW donor makes a donation and only supplies their email address\*, the displayed name is blank in WordPress civi 4.6.4 and above. (\*This can happen when someone donates directly through PayPal, civi only retains the email, or sometimes in a "pay later" situation when only an email is required.)

In my old civi (4.2.7, yes I know very old) it always defaulted to the email address if no name was supplied. Now that I'm upgraded to 4.6.4 the email address does not show in the contribution dashboard, contribution searches or the soft credit section on the donation tab for a contact.

I tested in the Demo site. If a donor already exists with just a email, then it's peachy it shows the email name. But if you make a new donation with a new email address there's no displayed name. (See below). You can go into the contact, press 'add or edit email' and then immediately press save and civi will then start displaying the email properly.

Any idea why it won't do this to begin with?

EDIT: Reported as CRM-16936

# Answer
This sounds like a bug in recent CiviCRM, especially given that you've confirmed the behavior change on demo site.

Why this happened isn't so important I expect as what to do to get it fixed, and whether this change in behavior is intended - I'd guess not.

To get it fixed, the next step would be to open an issue in the bug tracker at http://issues.CiviCRM.org \- your details here are perfect for that.

You or your organization could contribute further towards the fix, but a thorough bug report like you've provided is a great contribution already.
> 3 votes

---
Tags: civicontribute, search-results
---


# Question
Title: What might cause an Contact Import to only import core data and not import custom data
Asking this mostly so I can answer it in case it helps others. I had been provided a csv that was doing as described in title ie it had both custom and core fields in it, and the core date eg First, Last, Email etc were importing but the Custom fields were not being imported.

# Answer
I took a stab in the dark on this and re-ordered the columns in the csv to ensure that the custom fields did not come before the core fields. This resulted in both core and custom data to be imported. This may be documented somewhere but was a new one for me.
> 1 votes

---
Tags: import
---


# Question
Title: Why can't anonymous users make contributions?
I want anonymous users to be able to make online contributions (both through standard contribution pages and through PCP pages). I have the "make online contributions" selected in anonymous user role, but my site still requires a user to create an account (both on standard and PCPs).

Using latest CiviCRM and latest D7.

# Answer
> 4 votes
Do you mean an account is required to even fill in your page, or that filling in the page creates an account?

If the former then it sounds like a permission issue such as Anon not having access to the following

* CiviCRM: profile listings and forms
* CiviCRM: access all custom data.

These Permissions are usually part of default permissions afaik

Within the Profile settings you want to make sure that you have not set **Account creation required** which can be found in the advanced settings: **Administer \> Customize Data & Screens \> Profile**.

---
Tags: contribution-page, permissions, pcp
---


title: Problem with Date Range in searches

text:
# Question
Title: Problem with Date Range in searches
There seems to be a bug in doing searches on date ranges - specifically in Advanced Search and in Find Contributions. We're using Drupal and Civi 4.6.2.

When I type into Adv Search's Member Since date range fields OR Find Contribution's contribution date range fields only 2 digits for the year (1/1/14) I get a nonsensical number of records back. No error msg, just an obviously wrong set of data. I confirm by looking at several records but they do not match the date range in either Member Since or Contrib Date.

However, when I type in all four year digits, then I get the expected results.

I have tested this in the demo Civi and received the same results for both - only 2 digits gets bad results, 4 digits gets correct one.

I used to be able to type in only 2 digits (since we started using Civi in 11/12).

Please add in an error message or change the field instructions.

Thank you.

# Answer
> 1 votes
Thanks for taking the time describing the problem.

As it seems to be a bug rather than a question, i think you should create a new issue in the issue tracker rather than using Stack Exchange.

---
Tags: search, search-results
---


title: Admin language does not change

text:
# Question
Title: Admin language does not change
I try to change the language localisation of our site to dutch following the documentation at: http://wiki.civicrm.org/confluence/display/CRMDOC/i18n+Administrator%27s+Guide%3A+Using+CiviCRM+in+your+own+language

I uploaded our language files at sites/all/modules/civicrm/l10n/nl\_NL Now some of the backend interface (settings) shows in dutch. But the admin menu and for instance event emails are still send in english.

When I change the language on the 4.6 sandbox the whole menu changes. I already dropped civicrm\_domain. What else can I do to get this working using civicrm 4.6.4 / drupal 7.38 ?

# Answer
Unfortunately, if you change the language after the installation, the data that has been loaded during installation in the database will not be translated.

I am not aware of an easy way of fixing that but you could use as a start the sql files in civicrm-xxx-l10n.tar.gz and do updates instead of insert.

The issue is known and hopefully will be fixed in CiviCRM 4.7
> 3 votes

---
Tags: localisation, settings
---


# Question
Title: smart groups based on membership broken after upgrade from 4.6.4 to 4.6.5
Smart groups that are based upon advanced search membership are broken after upgrade from 4.6.4 to 4.6.5. After the upgrade, the groups have everyone in the database. When you select contacts in group and then click on the edit smart group search criteria you get the advanced search form. The section for membership is expanded but the group is not selected nor is membership status filled in.

I can fix the groups but it's a bit of a pain.

I looked at the criteria in the civicrm\_groups after the upgrade. It looks the same as before the upgrade and doesn't work. Once you manually fix them then the criteria is different. I'm not sure if the civicrm\_membership\_cache is messed up or if the criteria isn't getting update.

# Answer
> 1 votes
It seems like a bug to me. Please raise a issue on Civicrm Issue tracker

---
Tags: smartgroups
---


# Question
Title: First CiviCRM API call is slower, are unnecessary resources loaded?
We're looking at importing a lot of data via the API call. But we've noticed that on a page load the first API call is significantly slower than following ones. Eg:

```
$result = civicrm_api3('Contact', 'get', array()); // Slow
$result = civicrm_api3('Contact', 'get', array()); // 10x faster
$result = civicrm_api3('Contact', 'get', array()); // 10x faster

```

I thought this might be because CiviCRM has to autoload a number of classes the first time it is called. However, the same classes (inspected using get\_declared\_classes()) seem to be called when using lower-level and faster functions, which don't have a slow first query like:

```
$dao = CRM_Core_DAO::executeQuery($query); // Fast
$dao = CRM_Core_DAO::executeQuery($query); // Fast

```

Obviously the raw SQL will always be faster, but does anyone know what could be causing this initial slowness on first API calls, or have any tips on how to debug it?

It would be great if we could optimise this since REST calls are all single page requests it can be quite slow.

# Answer
They are several distinct issues:

1. Calling civicrm\_api3, this isn't REST, and (unless requested) the code runs as admin, so probably not linked with authentication

Here, a common issue is the database access, the first time you access the underlying tables (civicrm\_contact and co), mysql might not have kept them in the cache, but the second time they are and it will be several order of magnitude faster.

My guess would be that most of the difference in time is due to the database layer (that might has well be kept some cached in the DAO layer) but mostly the difference between an empty mysql cache.

When you compare with running directly the executeQuery, which one do you run? They are likely quite a few sql queries inside the api call. Do you run them after having called the api?

if you want to dig into the detail of where the time is spent, I'd recommend you to use a profiler, because it's hard enough th it, and black magic and speculation without

2. The REST interface. It's always going to be slower, both because of the overhead of the network and the extra authentication step (based on the keys you provide)
3. It will be faster if you provide a return param to the api call, to specify which fields you want. by default, it will returns tons of fields that you probably won't use, some that are from related joined tables (eg. email, phone, address, name for options or pseudo constants...).

adding a return="first\_name,last\_name,email" would avoid fetching stuff you don't need.
> 4 votes

---
Tags: api, performance
---


# Question
Title: Reserved payment-instruments: can they be removed?
I found that there a few payment-instruments being reserved and therefor can't be removed in the UI, while setting up CiviContribute. These are 'Credit Card', 'Debet Card' and 'Check'. I'm 100% sure that in this case these will never used, so I'd like to remove them. I've already removed all cards in *Accepted Credit Cards*. I know how to delete the instruments in mysql, but I wonder if it would cripple something else?

# Answer
Don't delete them, but there is a trick to disable the ones you don't want without resorting to direct SQL queries. Check out this solution on households to see how to do it via API explorer. In your case we would use:

* Entity = OptionValue
* Action = Create
* Option Group ID = payment\_instrument
* Option Value ID = 88 (e.g. for Debit Card)
* Option Is Active = False.
> 2 votes

# Answer
If you are sure you are not going to use payment instrument then you have an option of disabling it

But you should at least have one payment instrument in order to create contribution record etc

so you don't have to delete it just disable but setting the flag of is\_active column to zero and if something goes wrong always you can enable it
> 0 votes

# Answer
`Credit card` and `Debit card` could be used by the system if you do online payment with some payment processor.

`Check` is used by the system on online payment page when you let the user choose the `Pay later` option.

So, it's ok to disable them if you don't plan to do online payment forms (event, contribution or membership).
> 0 votes

# Answer
If you won't have any payment instruments (and what is left besides cash and sheep if you disable those?) you might consider disabling CiviContribute and any other components that aren't getting used. You can do it in Administer - System Settings - Enable CiviCRM Components.
> 0 votes

---
Tags: civicontribute
---


# Question
Title: Entity Relationship Between Grant and Case
I'm exploring Civicrm for a client that processes emergency grants for individuals with medical, and other issues. There is a process to fill out forms which often requires follow-up in the workflow.

For the architecture, I plan to use grants (and the grant application extension) to collect and approve grant applications (since this is designed with financial accounting in mind) but also create a case and activities to manage the application process (followup, approval, etc.).

There is a close entity relationship between the grant application and the Case. Since civicrm does not (yet) have entity relationship or lookup custom fields, does anyone have a suggestion of how to approach this relatively simple requirement? Basically, Grants and Cases would each have a reciprocal field to connect each other.

I'm sure the "answer" will require creating an extension (would prefer to avoid maintaining it). I could also do this in Drupal with entities / views / rules but wondering if there are any other clever approaches.

# Answer
> 2 votes
If you are using Drupal as your CMS then one option would be to set-up a webform that simultaneously opens a case and a grant (yes, webforms can do both at once). In that case the webform submission itself could serve as the link between the two, or you could make a more explicit link via custom fields.

# Answer
> 1 votes
One option would be to create your own custom Activities to manage the Grant side of things and then include them in your Case directly rather than having to link Cases with CiviGrant.

---
Tags: civicase, evaluating-civicrm, civigrant
---


title: How do I recover CiviGrant Component?

text:
# Question
Title: How do I recover CiviGrant Component?
I disabled, and re-enabled CiviGrant and now I can no longer access it. I **tried to rebuild the menus** and actually **reproduced this on the demo** site: Its not just the Grant and Grant Admin menus. if i try to use a link I get access denied. **The grant component is working at the API level.** Any suggestions on how to recover the component?

# Answer
Go into your CMS permissions and check that your role has all the CiviGrant permissions. They are not automatically granted when you enable the component (though it is a little surprising that they would be revoked upon disabling it).

You also might try logging out and then in again.
> 5 votes

# Answer
This is a known issue but so far hasn't risen to the top of anyone's to-do list. Patches from the community would be more than welcome.

See https://issues.civicrm.org/jira/browse/CRM-9659
> 1 votes

---
Tags: issues, civigrant
---


title: The overlay window became all greyed

text:
# Question
Title: The overlay window became all greyed
After upgrading to CiviCRM 4.6.5, I cannot access any more to any popup window. This overlay window is somehow slightly greyed. It doesn't react anymore (not event the cancel button) and the only way to remove the window is pressing the escape button.

In drupal administration I have this warning :

Warning : array\_shift() expects parameter 1 to be array, string given dans civicrm\_permission() (ligne 67 dans /home/website/public\_html/sites/all/modules/civicrm/drupal/civicrm.module).

Is it a Drupal issue or a Civi one ?

Thanks for advice and help.

====

# Answer
From what I can tell, css from your drupal site is majorly interfering with CiviCRM. Specifically, the interference is targeting jQuery UI, probably because you have a copy of jQuery UI loading via Drupal. Try:

* Disabling the jQuery UI module (or find a way to disable it just for CiviCRM pages)
* Choosing a simpler theme for CiviCRM pages, particularly one that does not bundle a copy of jQuery UI.
> 2 votes

# Answer
Instead of clicking the link that triggers the pop up, can you right-click and 'open in new tab' so that you have the form as a page rather than a pop up? Does that work fine? If so, when you are getting the pop-up do you have any errors if you right-click on the pop up and Inspect Element?

(Edited to included Heather O. comment) If that is the case, then you can disable the pop-ups in the Administration console under Display Preferences civicrm/admin/setting/preferences/display&reset=1 Means that members of staff can access as normal in the meantime.
> 1 votes

# Answer
We just got a bug report in our issue tracker about this: https://issues.civicrm.org/jira/browse/CRM-16935

Looks like a recent change to the Drupal Media module is to blame.
> 0 votes

---
Tags: drupal
---


# Question
Title: When I go to run the API, I get errors looking for examples
Civi version 4.6.3.
When I access the API, it loads but with errors related to the examples.

This is an IIS server.

> Warning: scandir(C:\inetpub\wwwroot\sites\all\modules\civicrmapi/v3/examples,C:\inetpub\wwwroot\sites\all\modules\civicrmapi/v3/examples): The system cannot find the path specified. (code: 3) in CRM\_Admin\_Page\_APIExplorer-\>run() (line 55 of C:\inetpub\wwwroot\sites\all\modules\civicrm\CRM\Admin\Page\APIExplorer.php).
> Warning: scandir(C:\inetpub\wwwroot\sites\all\modules\civicrmapi/v3/examples): failed to open dir: No such file or directory in CRM\_Admin\_Page\_APIExplorer-\>run() (line 55 of C:\inetpub\wwwroot\sites\all\modules\civicrm\CRM\Admin\Page\APIExplorer.php).
> Warning: scandir(): (errno 2): No such file or directory in CRM\_Admin\_Page\_APIExplorer-\>run() (line 55 of C:\inetpub\wwwroot\sites\all\modules\civicrm\CRM\Admin\Page\APIExplorer.php).
> Warning: Invalid argument supplied for foreach() in CRM\_Admin\_Page\_APIExplorer-\>run() (line 55 of C:\inetpub\wwwroot\sites\all\modules\civicrm\CRM\Admin\Page\APIExplorer.php).

There appears to be a missing slash in the warnings between the civicrm and api folders.

If I edit APIExplorer.php and add either `\` or `\/` the error goes away.

# Answer
Git history shows this bug to have been already fixed on 6th June 2015. Please upgrade to the latest version of CiviCRM and try again.
> 1 votes

---
Tags: api
---


title: VERP info not added to mail headers?

text:
# Question
Title: VERP info not added to mail headers?
I'm trying to set up the CiviMail return channel, and expect that, if I do it properly, headers like Reply-To and/or Return-Path will have values like bounces+`verp-stuff`@mydomain.com, but so far, that's not happening.

What I've done so far:

1. Created an email account bounces@mydomain.com through Google Apps, and verified it receives an email sent to bounces+123@mydomain.com
2. Edited the default mail account at /civicrm/admin/mailSettings?reset=1, with values (server, username, password, protocol, use ssl) that allow it to check email over IMAP on the bounces@mydomain.com and verified that some messages in that account get labeled with the inbox-civimail-ignored.
3. Also at /civicrm/admin/mailSettings?reset=1, set "Email Domain" = "mydomain.com" and "Used For?" = "Bounce processing". Other fields in this form are blank.
4. Outbound Email (/civicrm/admin/setting/smtp?reset=1) is set to "mail()"

I then create a new scheduled mailing and send it out using the "Send Scheduled Mailings" job, and the mail arrives with these headers:

```
Delivered-To: me@example.com
Received: by a.a.a.a with SMTP id x3csp113516itf;
        Wed, 29 Jul 2015 10:06:44 -0700 (PDT)
X-Received: by b.b.b.b with SMTP id o40mr63319942qga.0.1438189604113;
        Wed, 29 Jul 2015 10:06:44 -0700 (PDT)
Return-Path: <b.94.15.1ff1d88a496eafde@mydomain.com>
Received: from mydomain.com (mydomain.com. [c.c.c.c])
        by mx.google.com with ESMTP id g9si32260106qgf.41.2015.07.29.10.06.43
        for <me@example.com>;
        Wed, 29 Jul 2015 10:06:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of b.94.15.1ff1d88a496eafde@mydomain.com designates c.c.c.c as permitted sender) client-ip=c.c.c.c;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of b.94.15.1ff1d88a496eafde@mydomain.com designates c.c.c.c as permitted sender) smtp.mail=b.94.15.1ff1d88a496eafde@mydomain.com
Received: by mydomain.com (Postfix, from userid 33)
    id D96011442D; Wed, 29 Jul 2015 17:06:43 +0000 (UTC)
To: Two Mice <me@example.com>
Subject: test 6fd
X-PHP-Originating-Script: 1001:mail.php
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="=_10b250b1b5a6af786cd9e0315548c9d9"
Reply-To: "My Site"
 <info@mydomain.com>
From: "My Site" <info@mydomain.com>
List-Unsubscribe: <mailto:u.94.15.1ff1d88a496eafde@mydomain.com>
job_id: 94
Precedence: bulk
X-CiviMail-Bounce: b.94.15.1ff1d88a496eafde@mydomain.com
Date: Wed, 29 Jul 2015 12:06:43 -0500
Message-Id: <20150729170643.D96011442D@mydomain.com>

--=_10b250b1b5a6af786cd9e0315548c9d9
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8

```

Suspecting that our postfix setup might be messing with the headers, I set Outbound Email (/civicrm/admin/setting/smtp?reset=1) to "Redirect to Database", then created a new scheduled mailing and sent it out. The mail was stored in the civicrm\_mailing\_spool table with these headers:

```
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="=_6f3fb5f7026a6aecc8d6a73af912a390"
Reply-To: "My Site"
 <info@mydomain.com>
Return-Path: b.100.16.af889b4c23dd0331@mydomain.com
From: "My Site" <info@mydomain.com>
Subject: test 7
List-Unsubscribe: <mailto:u.100.16.af889b4c23dd0331@mydomain.com>
job_id: 100
To: Two Mice <me@example.com>
Precedence: bulk
X-CiviMail-Bounce: b.100.16.af889b4c23dd0331@mydomain.com | --=_6f3fb5f7026a6aecc8d6a73af912a390
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8

```

**Question:** What else should I do to get bounces to be directed to my bounces@mydomain.com address?

# Answer
> 1 votes
In the Mail Accounts entry you set up, you need to set `bounces+` as the localpart. Everything else looks good.

In your examples, you have b.94.15.1ff1d88a496eafde@mydomain.com as the return-path in the the first one and b.100.16.af889b4c23dd0331@mydomain.com in the second. CiviMail just needs to know to tack "bounces+" on the front of those addresses, and that's where the localpart comes in.

---
Tags: civimail
---


# Question
Title: Can I remove specific emails/contacts from Scheduled Reminders?
We have scheduled reminders set to send emails to contacts whose membership is set to lapse. There are a few contacts I would prefer to not receive the reminder, however, the only way I see to do this is to stop them from receiving all communications. This would mean adding "Do No Send" to their account preferences, then creating a smart group which does not includes contacts with "Do Not Send" preferences, and sending scheduled reminders to this smart group. The problem is that the contacts in question do need to receive other communications, just not membership reminders. Any ideas?

# Answer
> 6 votes
You can use the "Limit to Recipients" along with a smart group to handle this.

* Create a smart group of all members called "Receives Reminders".
* Manually remove those folks who you don't want to receive reminders from the smart group.
* Use the "Limit to Recipients" to only send to members of your smart group

---
Tags: scheduled-reminders
---


# Question
Title: 4.6.6 Wordpress still does not allow me to credit to a PCP
I posted about this earlier here: "Loading Failed" when soft crediting to a Personal Campaign Page

And Coleman kindly submitted a fix for it: https://github.com/civicrm/civicrm-core/pull/6156

Trouble is, I was never able to get the fix to work on my end and when I check the Demo site, which is now 4.6.6, it also still fails when you try to add a PCP page.

If I edit an existing donation from either a contact's card or by searching for a contribution and use the PCP drop down and try to search for a PCP -the screen below appears. I also tried opening the contribution in a new tab (rather than the overlay edit) and got the same error. I get the same error if I try to enter a check donation from scratch and add a PCP credit.

Did I miss something in the fix or is it not really working!?

# Answer
I finally figured it out: when you checked it on the WP demo site vs Drupal it turns out there was a conflict between a wp url param and one used by the widget.

This fixes it: https://github.com/civicrm/civicrm-core/pull/6351
> 3 votes

---
Tags: civicontribute, contributions, pcp, personal-campaign-pages
---


title: Change Email Address on Renewal

text:
# Question
Title: Change Email Address on Renewal
Can a user log in to Drupal, fill out a contribution form to renew their membership, and change their Email address when contributing? Looking for an optimal workflow here. If the email address on the contribution page auto fills with their CiviCRM primary email, and they change it on the form, will that change the address in CiviCRM and/or their linked Drupal account? If not, how could I make this easiest. What happens in my org is that members sometimes have old AOL emails and want to change it with something new when renewing.

# Answer
> 2 votes
Petednz is correct. If a user is logged in, then they can change their CiviCRM e-mail address on a contribution form. This won't change the Drupal address AFAIK; I'd be very surprised if it did.

If you also want to change the Drupal e-mail address, you'll need to write an extension (or hire someone to do it). My Domain Access CiviCRM module is conceptually similar and will get you about 80% of the way there. You can also check out CiviCRM Wordpress Profile Sync for inspiration, since that's the functionality you're looking for, but for Wordpress.

---
Tags: civicontribute
---


# Question
Title: ERROR: No CMS user associated with given api-key
I have just installed a fresh CiViCRM 4.6.5 with new Drupal setup. I'm trying to fetch all events from CiViCRM.

```
$api = new civicrm_api3 (array ('server' => 'http://localhost/civicrm', 'api_key'=>'123456789', 'key'=>'82666e3fdc5cc88c6c31ddbef2a74cxx'));

// Get all events from CiViCRM
if ($api->Event->get()) {
    print_r($api);
} else {
    echo $api->errorMsg();
}
exit;

```

Any idea how to solve above issue?

Any help would be appreciated. Thanks.

# Answer
Actual problem was that there were two CiVi contacts having the same API key set, and one of them was connected with Drupal user but another wasn't, so that was the main issue here.
> 4 votes

# Answer
API keys are set manually per contact in the civicrm\_contact table, so it's possible that you haven't set the key for your contact in your new installation.

If that's set, you also need to make sure the contact with the key corresponds to a user with permission to view events:

1. Find the contact in CiviCRM and see if it has a User ID listed next to its contact ID on the contact summary.
2. If not, check to see if there's a Drupal user with that contact's email address. If you find one, you'll need to resync contacts to users (found in the CiviCRM Administer menu).
3. If you don't find a user with that address, create one. Confirm that the user is connected to the contact by viewing the contact summary again. If it hasn't connected, you may need to merge.
4. Once you have a user connected to the contact with the API key set, make sure they have the right permissions--a role with at least "Access CiviCRM", "Access CiviEvent", and "View all events" granted.
> 3 votes

---
Tags: drupal, api, permissions
---


title: Unable to parse returned JSON - CiViCRM

text:
# Question
Title: Unable to parse returned JSON - CiViCRM
I have setup CiViCRM in one Drupal site, and then from another Drupal site I'm fetching events from that first site. This entire thing is working fine in my local.

Now I have uploaded both sites on staging server. On one site, I have install CiViCRM from scratch (no relation with local CiViCRM) and new CiVi installation is completed successfully without any errors. But when I'm trying to fetch events using API, I'm getting this error:

**Unable to parse returned JSON**

All configuration is perfect e.i API key, site key and CiVi server.

Below is my code to fetch events using API.

```
$api = new civicrm_api3 (array ('server' => 'http://xxxxxxx.com', 'api_key'=> 'abc123456', 'key'=> 'd0d792e6cd3c824bb3e0b671992fdc2d'));

if ($api->Event->Get()) {
    print_r($api);
} else {
    echo $api->errorMsg();
}

```

PS: I don't think there can be any issue in code, as same code is working fine on local.

Any help would be appreciated.

# Answer
I got the issue. It was due to .htaccess authentication on entire site.

In such **access denied** cases, CiViCRM API should give some proper response message like "Access denied" or "Authentication failure" instead of just **Unable to parse returned JSON**
> 2 votes

---
Tags: civievent, drupal, api
---


# Question
Title: Error Viewing Participants from Event Screen
I have a drupal 7 site running Civi 4.6.5 and using it for event registrations.

When attempting to view Participants from the Event page, I receive a `DB Error: syntax error`. See backtrace below. I am able to view a report of registered participants without an issue - just problems using the icon on the event page. Any ideas?

```
#0 /sites/all/modules/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#4 /sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#5 /sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...", "DB_Error", TRUE)
#6 /sites/all/modules/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#9 /sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#10 /sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#11 /sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#12 /sites/all/modules/civicrm/CRM/Core/DAO.php(1221): CRM_Core_DAO->query("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...", TRUE)
#13 /sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4609): CRM_Core_DAO::singleValueQuery("SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contac...")
#14 /sites/all/modules/civicrm/CRM/Event/Selector/Search.php(288): CRM_Contact_BAO_Query->searchQuery(0, 0, NULL, TRUE, FALSE, FALSE, FALSE, FALSE, NULL)
#15 /sites/all/modules/civicrm/CRM/Core/Selector/Controller.php(233): CRM_Event_Selector_Search->getTotalCount(4, NULL)
#16 /sites/all/modules/civicrm/CRM/Event/Form/Search.php(336): CRM_Core_Selector_Controller->__construct(Object(CRM_Event_Selector_Search), NULL, NULL, 4, Object(CRM_Event_Form_Search), 1, NULL)
#17 /sites/all/modules/civicrm/CRM/Event/Form/Search.php(124): CRM_Event_Form_Search->postProcess()
#18 /sites/all/modules/civicrm/CRM/Core/Form.php(455): CRM_Event_Form_Search->preProcess()
#19 /sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm()
#20 /sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Event_Form_Search), "display")
#21 /sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Search), "display")
#22 /sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display")
#23 /sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)
#24 /sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:14))
#25 /sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#26 /sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))
#27 [internal function](): civicrm_invoke("event", "search")
#28 /includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))
#29 /index.php(21): menu_execute_active_handler()
#30 {main}

```

# Answer
> 3 votes
This issue is been resolved in https://issues.civicrm.org/jira/browse/CRM-16858 against coming 4.6.6. You can find the fix here https://github.com/civicrm/civicrm-core/pull/6238.

---
Tags: civievent
---


# Question
Title: programatically delete an event that has participants
I am trying to delete an event that has participants registered using:

```
civicrm_api( 'event','delete', array('version' => 3, 'id' => $v) );

```

Which gives an error saying that I can't delete it because it has participants.

Is there any way to force the deletion of the event? Or how do I remove all participants of the event?

# Answer
> 4 votes
You can delete participants from an event using:

```
civicrm_api3('Participant', 'delete', array(
  'event_id' => $v,
  'options' => array('match' => 'event_id')
));

```

Once that's done you can proceed to delete the event.

# Answer
> 1 votes
I think you have to delete the event participants from the event before deleting the event, note that this only deletes the participants from the event and not from the db. Go to Events, find participants, select the event -\> search, select all and use the action menu to delete participants. After that you can go to Events-\>Manage events, search and from the more link you can delete the event

---
Tags: civievent, api
---


# Question
Title: How to change Paypal IPN URL when migrating Civicrm onto a new domain?
I would like to move my civi install to a new domain. I am able to change paypal IPN to new domain. But for all previous recurring contribution via paypal, i can't change the urls. what can be done?

# Answer
> 7 votes
I ran into this problem today, and found my solution.

Folks who are saying that you can change the IPN URL on an existing Paypal recurring payment are incorrect; you can't, you can only change the IPN URL for future notifications.

I was able to use a rewrite to redirect from Drupal to Wordpress, as follows:

```
RewriteRule ^sites/all/modules/civicrm/extern/ipn.php$ https://mysite.org/wp-content/plugins/civicrm/civicrm/extern/ipn.php [R=307,L]

```

The magic is the `R=307`. A 307 redirect indicates that a POST request must be resent as a POST. Otherwise you lose the IPN data.

# Answer
> 4 votes
PayPal stores these URLs so there is no way to change this in CiviCRM, nor any other application in fact.

There is a way to change the URL via PayPal's site, however. For details how to do that, refer to Change the IPN url on existing subscription

# Answer
> 2 votes
You can actually change the IPN URL in PayPal settings. For previously failed IPN calls to a historic URL you can resend the messages from PayPal's control panel to the new URL.

In PayPal. Profile and Settings -\> Selling Preferences -\> Instant Payment Notification (IPN)

Change the notification URL here. Then click on the link to IPN history and run a search (this only shows the last 28 days worth though for me).

With the results showing Check a box at the top of the list which says apply profile and there will be a drop down box to resend the IPNs to the new URL.

Simples

# Answer
> 1 votes
Civi does not have the facility to do this. Your best bet is to check and see if you can do this in paypal directly or via the API. You might also experiment with setting up a redirect from the old to the new (not sure if this will work, since it is a POST request from paypal servers)

Please report back your findings. I suspect more and more folks will start running into this issue

---
Tags: drupal, payment-processor
---


# Question
Title: Error on activity import: "'1' is not a valid option for field custom_42". Can I find which field this is referring to through the admin interface?
I am importing custom activities (with some custom fields in them) and getting "'1' is not a valid option for field custom\_42."

The problem is that I can't figure out which field it's referring to. "1" is not a value I am trying to import so that's no help. Do I have to go into my back end to find the the interface label for "custom\_42" or is that exposed in the admin interface anywhere?

Running 4.6.4 on Drupal.

# Answer
> 3 votes
You may find that you can go to this url and find the field you are looking for /civicrm/admin/custom/group/field/update?action=update&reset=1&id=

Or, to reverse engineer this, go to any existing custom field and mouse over the view/edit links and you should see the field ID along with the field group ID - i just dropped out the field group id to make the url look a little less intimidating.

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


# Question
Title: How can I modify the Activity Report to display phone number?
I have built a report off of the Activity Report template and have been able to add all the columns I need EXCEPT target contact phone number. Email and many address fields are available in the "columns" tab but I do not see phone number there.

Is there anything I can do to expose this information?

(I thought about using a Constituent Report (Detail) instead, because phone is available there--but I want to filter by activity type and include custom fields on my activities.)

# Answer
> 0 votes
Check out Lola Slade's excellent CiviCon presentations on this topic: 2015 session (download the PDF on this page); 2015 video, and the CiviCon 2012 slideshow.

---
Tags: civireport, activities
---


# Question
Title: How do I get more than 25 records from the API?
I'm making a normal api call such as:

```
$params = array(
  'version' => 3,
  'sequential' => 1,
  'membership_type' => 1
);
$result = civicrm_api('Membership', 'get', $params);

```

But I only get 25 results back.

How do I get more than that, and how do I ensure I can retrieve all results, if say there was 5,000?

# Answer
To return more than 25 results you need to **add options.limit to your api call**:

```
$params = array(
  'version' => 3,
  'sequential' => 1,
  'membership_type' => 1,
    'options' => array(
    'limit' => 100,
   ),
);
$result = civicrm_api('Membership', 'get', $params);

```

---

For the second part, we want to be able to retrieve say 5,000 records. We can't really set rowCount to 5,000 because depending on the size of data, we run the risk of timing out.

The solution here is to page the results using a parameter 'options.offset':

```
$params = array(
  'version' => 3,
  'sequential' => 1,
  'membership_type' => 1,
  'options' => array(
    'limit' => 100,
    'offset' => 100 // offset value is equal to the number of results to skip
  ),
);

```

For this to work, we decide on what our ideal page size is let's say 100. We set options.limit to 100, and then we increment offset by our page size (100) on each call, until we no longer get results.

How do we know when we're done? Check the value of count in the returned result. When the returned count is less than the page size, stop.

```
  $memberships = array();
  // Initialise our pagesize and offset
  $page_size = 100;
  $offset = 0;
  // Start out loop
  do {
    // Call the api
    $results = civicrm_api(
      'Membership',
      'get',
      array(
        'version'         => 3,
        'sequential'      => 1,
        'membership_type' => $membership_type,
        'options'         => array(
          'limit'  => $page_size,
          'offset' => $offset
        )
      )
    );

    // do something with the results if we didn't error
    if ($results['is_error'] == 0) {
      foreach ($results['values'] as $value) {
        $memberships[] = $value;
      }
    }

    // Increment the offset by the page size
    $offset = $offset + $page_size;

  } while ($results['count'] >= $page_size); // Check if we still need to fetch results

```
> 16 votes

# Answer
Well here's an alternate way to try which returns the total result if you have no idea how much entries does the returned result will contain :

```
$count = civicrm_api('Membership', 'getcount', $params);

$params = array(
  'version' => 3,
  'sequential' => 1,
  'membership_type' => 1,
  'options' => array(
    'limit' => $count,
  ),
);

$result = civicrm_api('Membership', 'get', $params);

```
> 8 votes

# Answer
Adding options.limit to 0 returns the total result for the api which I feel is the best way to get more than 25 contacts :)

```
$params = array(
  'version' => 3,
  'sequential' => 1,
  'membership_type' => 1,
  'options' => array(
    'limit' => 0,
  ),
);

```

$result = civicrm\_api('Membership', 'get', $params);
> 6 votes

---
Tags: api, developer
---


# Question
Title: Call to undefined function getRequiredMarker() - CiViCRM
I have setup CiViCRM with Drupal. Setup was completed successfully without any errors.

After Login into Drupal as Admin, while I'm visiting new event create page using menu -\> Events -\> New Event, I got blank page nothing else.

When I checked the error log it says:

**PHP Fatal error: Call to undefined function getRequiredMarker() in /var/www/html/xx-civicrm/sites/default/files/civicrm/templates\_c/en\_US/%%89/896/89673E6E%%ProfileTemplates.tpl.php on line 64, referer: http://xxxxxxx.com/civicrm?reset=1**

But I found that function "getRequiredMarker()" in a js file:

/sites/all/modules/civicrm/js/view/crm.designer.js

So what is the issue here? What is the solution here?

Any help would be appreciated. Thanks.

# Answer
> 2 votes
I found the issue:

It is because of **asp\_tags** extension. Need to turn off it.

Either turn off it from php.ini file(globally disable)

OR

by putting this line in .htaccess file(locally disable)

php\_flag asp\_tags off

---
Tags: civievent, drupal
---


title: Multilingual support

text:
# Question
Title: Multilingual support
We need CiviCRM Member Form in six or more different languages. The site will be in three languages, but we want the Member Form to be in as many languages as possible. I can't find any information about CiviCRM multilingual support, except for a few random sentences in the documentation that indicate multilingual is supported. Where can I find more information about the set-up, user interface and languages that are supported. Does multilingual implementation require an extension?

# Answer
i think you are right that there is not a lot of information about this currently. Multiple language can be enabled on the Localisation screen ie at http://d46.demo.civicrm.org/civicrm/admin/setting/localization?reset=1

Some documentation about it is here http://gitbook.civicrm.org/the-civicrm-community/localising-civicrm.html http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=88408149

Once multiple languages have been enabled, when you are creating eg a Contribution Form you should see new green buttons next to fields that will allow you to provide a translation of the text.

NOTE: we have had issues when trying to run CiviCRM with more than 2 or 3 languages so you need to test this on a dev site of course.

RANDOM IDEA: I haven't thought about this previously but if you are using Drupal then there may be options to provide alternative language versions of a webform\_civicrm form that is connected to your Member Form
> 4 votes

# Answer
As Peter has said, CiviCRM's current support for multiple languages is restricted by the underlying architecture. Basically an extra column is added to the tables for each field that needs to be represented in the additional language. For example if 5 languages are enabled then the table could have 5 times more columns. The issue with this is that mysql has a restriction on rowsize and therefore once you enable these extra languages and start populating the text for them you may find issue with DB failures when attempting to use the administrative interface to populate that information. At the moment there isn't a workaround to this problem within CiviCRM but as Peter's highlighted you could look at having WebForm do something based on language.
> 4 votes

---
Tags: localisation, multisite, i18n
---


# Question
Title: How can I modify what is displayed on the civicase dashboard?
currently it shows Contact / Subject / Status / Type / Mt Role / Manager / Most Recent /

I want it to show Contact / Subject / Activity Status / Custom field 1 / custom field 2

# Answer
One way would be to use the technique described here: http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens

The files you want to override are:

```
    templates/CRM/Case/Page/DashboardSelector.tpl
    and
    CRM/Case/Page/Dashboard.php

```

Getting custom fields can be done using the api, although you need to know the database id for the field definition. See http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API, and down where it says Custom fields.
> 1 votes

---
Tags: civicase
---


# Question
Title: CiviMail shows unexpected groups when selecting recipients
I create a new email and go to choose "Recipients". I see a full list of all groups. This includes groups I shouldn't be allowed to see (per ACL rules), and groups that do not have the "mailing list" attribute. Does a little trick exist that can restrict the groups available to choose from?

Edit: CiviCRM version: 4.6.3

# Answer
Similar issue is filed here for which I've submitted a PR at https://github.com/civicrm/civicrm-core/pull/6366

Hope you can see Groups permitted by ACL now:)

Update : If you can also see the groups not configured for mailing list, please upgrade to the latest CiviCRM version.
> 3 votes

# Answer
Sounds like a bug to me, at least for the ACLs. I am quite surprised that you can see groups that have not been flagged as "mailing list". Can you please provide specifics on the version you are using, as well as the way you have setup these ACLs? Also, on the Manage Groups screen, do you see the same groups or a different list? Finally, do users that have different ACLs than yours have the same issue?
> 1 votes

---
Tags: civimail, email, acl
---


title: Checksum to edit profile not working?

text:
# Question
Title: Checksum to edit profile not working?
I've been trying to test using checksums to access pre-filled Profiles, eg:

```
/civicrm/profile/edit?gid=1&cid=12&cs=12f12df65c25b4b31afb11726af4d5ca_1438265969_168

```

However it does not seem to be working in the current version of CiviCRM (4.6.x). The profile appears without any information filled, and there are no error messages displayed.

Using the same approach (same contact ID and checksum) to pre-fill an event form is working fine, eg:

```
/civicrm/event/register?id=442&reset=1&cid=12&cs=12f12df65c25b4b31afb11726af4d5ca_1438265969_168

```

Is anyone else experiencing the same problem? If so I'll submit a bug report.

Documentation for checksums at the bottom of this page: http://wiki.civicrm.org/confluence/display/CRMDOC/Tokens

# Answer
> 3 votes
I believe that for profile edit, you need to use `id` rather than `cid` for the contact id, as per the docs you linked to:

http://www.myorganization.org/civicrm/profile/edit?reset=1&gid=N&{contact.checksum}&id={contact.contact\_id}

---
Tags: profile, tokens, checksum
---


# Question
Title: How to set a contact's gender using API?
If I do a `civicrm_api3('contact', 'getsingle', ['id'=>123])` I get lots of data, including `gender`.

However when I try to set the gender like:

```
civicrm_api3('contact', 'create', ['id'=>123, 'gender'=>'Male'])

```

It reports no error, but neither does it do anything(!).

(Nb. I'm using v4.4.16 LTS)

# Answer
> 4 votes
Experimenting with the API explorer, I found that `'gender_id' => 'Male'` worked.

# Answer
> 3 votes
The field name is `gender_id` not `gender`.

For a bit of history and explanation:

The contact api automatically takes a few fields (notably gender\_id, prefix\_id, suffix\_id, state\_province\_id and a few others) and gives you the label as well as the id for convenience. However this is not consistent across all apis and is not something I would generally rely on.

In v4.4 a lot of work was done to standardize option lists and the upshot is that 'create' type actions will now accept either the id or the name of any option (not the translated label).

So `civicrm_api3('contact', 'create', ['id'=>123, 'gender'=>'Male'])` and `civicrm_api3('contact', 'create', ['id'=>123, 'gender'=>2])` will do the same thing.

Come to think of it, it would be nice to accept either 'gender' or 'gender\_id' since that's more consistent with the output. Here's a PR for that.

# Answer
> 2 votes
Try using `gender_id` when creating the contact, rather than `gender`.

# Answer
> 1 votes
I solved it by creating a lookup function (which can be used for any field that takes an id that you wouldn't know):

```
function getIdforLabel($entity, $field, $label) {

    $result = civicrm_api3($entity, 'getoptions', ['sequential' => 1, 'field' => $field]);
    if ($result['is_error']) {
      throw new \Exception("Failed to getoptions for $entity.$field");
    }
    foreach ($result['values'] as $result) {
      if ($result['value'] == $label) {
        return $result['key'];
      }
    }
    throw new \Exception("Supplied value, '$label' is not a valid option.");
}

```

So then you can go:

```
$gender_id = getIdForLabel('contact', 'gender_id', 'Male');
civicrm_api3('contact', 'create', ['id'=>$contact_id, 'gender_id'=>$gender_id]);

```

Clearly davejenx's answer is simpler :-)

---
Tags: api
---


# Question
Title: How to set a custom country field using the API
Some fields that are stored as id references to other tables can be set by simply passing the value as an id, e.g. setting gender\_id=Male works.

I have a custom fieldset attached to contacts that includes a country (of origin - it's different to of residence!) field, known affectionately as `custom_77`.

But I've noticed that the API doesn't like me to pass `custom_77=Uganda` \- it complains that Uganda is not an integer. Can't fault it there :-)

My answer to the setting gender question provides a working solution: you can get it from `getIdForLabel('contact', 'custom_77', 'Uganda')`, or from any other country field, e.g. `getIdForLabel('address', 'country_id', 'Uganda')`, but as that turned out to be a very long winded solution when it was actually very simple, I thought I might, once again, be wrong! Hence this question.

# Answer
Any field (including custom fields) that accepts an option value will take either its machine name or it's id. The machine names for countries are their ISO codes, e.g. the code for 'United States' is 'US'. So you could do:

```
civicrm_api3('Contact', 'create', array(
  'custom_77' => 'US',
));

```

which is equivalent to

```
civicrm_api3('Contact', 'create', array(
  'custom_77' => 1228,
));

```

The label "Uganda" will not work, as it's not considered reliable given translations and word-replacements.

To find the ISO code for a country, use the api explorer. Api `Country` `get` with `name = Uganda` reveals `"iso_code": "UG"`
> 4 votes

# Answer
Chain API call would be an answer for this. Let's for example :

```
$result = civicrm_api3('Country', 'get', array(
  'sequential' => 1,
   'name' => "India",
   'api.Contact.create' => array(
   'contact_id' => 202,
   'custom_7' => "\$value.id"),
));

```

So here we first fetching country on basis of its `'name' => "India"` and providing your desired custom field(related to entity Contact) with its country.id (here `"\$value.id"`)
> 1 votes

---
Tags: api, custom-fields, lts
---


# Question
Title: On upgrade from 4.5.8 to 4.6.2 CiviCRM menu disappears until scroll, then scrambled
The issue: after upgrade the CiviCRM menu will not appear at the top over the Drupal menu. It does not appear at all unless I scroll down the page a short ways and then it appears on the upper left apparently without theming (see image).

I have now tried to upgrade several times and each time the same issue happens again. I have tried changing permissions, re-uploading a new set of 4.6.2 and following upgrade instructions carefully.

This site is basic and has no particular customizations... it is a shared hostgator account. I am running the latest Drupal 7 version and have upgraded CiviCRM at least a dozen times in the past with no issues. Perhaps I have some particular issue only on my setup, but wondering if anyone else is having a similar issue. Perhaps I'll need to wait until the next release and try again. Thanks.

# Answer
I was able to finally figure this out (not why, but how to fix). It somehow had to do with the Zen sub-theme I was had created was not playing nice with version of CiviCRM past, I think, 4.5.8.

I downloaded another version of the Zen 7.x5.5 version sub-theme and re-built my theme and was able to upgrade successfully. Thank you, Michael, for leading me down the right path.
> 3 votes

# Answer
I know that CiviCRM 4.6.x and the Drupal core Garland theme are incompatible presently. The AJAX flipping between tabs on a given page, and bringing email address fields into edit mode are all busted in Garland theme. Perhaps something is wrong compatibility wise with your site's theme. Try switching the theme for a test user account to a different theme and see if that clears up the troubles.

Also did you remember to flush your CiviCRM template cache files after each time you upgrade? ALWAYS wise to flush the cache directory after each CiviCRM upgrade. Locate your civicrm caching directory and issue:

```
.../civicrm/templates_c/en_US$ sudo rm -rf %%*

```

I am thankful,

Michael
> 2 votes

# Answer
This is not a known bug in CiviCRM 4.6 and you can see it working correctly on the demo site.

I suggest you try these troubleshooting steps to figure out what's going wrong with your site.
> 1 votes

# Answer
I had the same issue and (mostly) resolved it by copying the CSS from my prior CiviCRM installation's navigation.css and adding it to my theme's custom.css file. It (mostly) works correctly now (I'm dealing with a Smarty error. I think that error is not related.).

I pre-tested whether this would work by viewing the wrong-displaying page/CiviCRM menu in Chrome, inspecting the various elements, and hand-copying correct css into it.

Following is the css I copied into my custom.css file:

```
html>body div.outerbox
{
  padding: 0 5px 5px 0;
  z-index:999999;
  font-size: 13px;
  margin-top:2px;
}
html>body div.outerbox div.shadowbox1
{
  position: absolute;
  right: 0;
  bottom: 5px;
  width: 5px;
  height: 100%;
  background: url(../i/myshadow.png) no-repeat right top;
}
html>body div.outerbox div.shadowbox2
{
  position: absolute;
  bottom: 0;
  right: 5px;
  height: 5px;
  width: 100%;
  background: url(../i/myshadow.png) left bottom;
}
html>body div.outerbox div.shadowbox3
{
  position: absolute;
  bottom: 0;
  right: 0;
  height: 5px;
  width: 5px;
  background: url(../i/myshadow.png) no-repeat right bottom;
}
html>body .innerbox
{
  margin: 0;
  z-index:999999;
  margin-left:10px;
}

#root-menu-div ul {
  border: 1px solid #000;
}
#root-menu-div li{
  white-space:nowrap;
  background-image: none;
  text-align: left;
}
* html #root-menu-div li{
  height: 1.5em; /* fixing ie6 problem */
}
#civicrm-menu,
#root-menu-div ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background:#5D5D5D;
  color: white;
  cursor: default;
  font-size: 12px;
  font-family: Tahoma, Verdana, Arial, Sans;
}

#civicrm-menu {
  position:absolute;
  top:0;
  left:0;
  background:#1B1B1B repeat-x;
  width:100%;
  height:27px;
  z-index:99999;
  overflow: hidden;
}

li.menu-separator.active{
  background-color: transparent;
}

.menu-ul li.active {
  background-color: #aaa;
}

#civicrm-menu .activetarget{
  background-color: #aaa;
}

#civicrm-menu li a, #root-menu-div li a {
  color:white;
  cursor:pointer;
  display:block;
  font-weight:normal;
  text-decoration:none;
}

* html div.menu-item {
  display: inline; /* fixes problem in ie6 */
}

li.menumain {
  float: left;
  padding: 3px 10px;
  background-image: none;
  border-right: 1px solid #5D5D5D;
  margin:0;
}

#root-menu-div .menu-ul li {
  margin: 0;
  padding: 0 20px 0 2px;
}

div.menu-item {
  padding: 1px 10px 1px 4px;
  height: auto;
}
img.menu-item-arrow{
  position: absolute;
  right: 4px;
  top: 8px;
}
li.menu-separator{
  border-bottom: 1px solid #000;
  font-size: 0; /* for ie */
  height: 0;
  line-height: 0; /* for ie */
  margin: 2px 0;
}
#civicrm-menu .crm-logo-sm {
  background: url('../i/item_sprites.png') no-repeat scroll -80px -16px;
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align:middle;
}

```
> 1 votes

---
Tags: upgrade, 4.6.2, menu
---


# Question
Title: How do I use the API to check MembershipType and "active" status?
I've been tinkering with API explorer and examples https://github.com/civicrm/civicrm-core/blob/4.5/api/v3/examples/ but can't find a solution.

Via **Smarty** I'm looking to print some text "blah blah blah" via the .tpl of a Donation (Contribution) Page if the current viewer of that page has:

1. a membership of a certain type (example: "1")
2. that is "active" (current or new status)

Note that this contribution page is not membership related, it is for donations.

Can someone please point me in the right direction?

# Answer
I assuming you're doing this with a .tpl.extra file. I tried mocking this up in the API Explorer and found a couple shortcomings, namely the lack of support for arrays in smarty, and the inability to set a contact ID field to the magic "user\_contact\_id" value. Here's a fix for both those issues.

The upshot is you can now do this:

Instead of the boilerplate `{foreach}` loop you can do a simpler conditional. Here's the full code you would use:

```
{php}
  $this->assign("param_status_id", array('IN' => array("New", "Current", "Grace")));
{/php}
{crmAPI var='result' entity='Membership' action='get' contact_id="user_contact_id" membership_type_id=1 status_id=$param_status_id return="id"}
{if !empty($result.values)}
  Blah blah blah...
{/foreach}

```
> 2 votes

---
Tags: api
---


# Question
Title: What is the best way to avoid cartesian product on specific SELECT attributes?
I faced similar issue in some CiviReports where some of the Select attributes applied with Group function like SUM(), got affected due to LEFT JOINs. Let me provide further clarification on basis of two resolved/current CiviCRM issues -

* https://issues.civicrm.org/jira/browse/CRM-16338 where contribution sum(total\_amount) got tripled if the contribution is linked with three soft-credits. Although resolved it via splitting the query onto contribution and soft-credit queries respectively, which might not be the right way to do it :/ \[civicrm\_contribution one-to-many civicrm\_contribution\_soft\]
* https://issues.civicrm.org/jira/browse/CRM-16719 where SUM(duration) got doubled if the activity got two target contacts. \[civicrm\_activity one-to-many civicrm\_activity\_contact\]

# Answer
> 1 votes
CiviReport has a tradeoff between having a lot of functionality and nice widgets already done for you, but you have less control over the final SQL. When I run into this problem I usually do it as a custom search instead. See http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Custom-Search+Extension . Then you have more control over the SQL and can join with a subquery on the "many" table that reduces it to "one".

You might still be able to do it in a civireport, I just find it harder.

If you're asking instead for general SQL help, then if I bing for "select join mysql sum duplicate" I get answers like this one: https://stackoverflow.com/questions/3345657/mysql-how-do-i-sum-non-duplicates-values-when-doing-multiples-joins

---
Tags: civireport, mysql
---


# Question
Title: Patch or workaround for search with checkbox or multiselect field
I believe we have a bug when search criteria includes a checkbox or multi-select fields (it may include other fields). I created a ticket: https://issues.civicrm.org/jira/browse/CRM-16947

1. Create a multiselect custom field (or checkbox text)
2. Search in advanced search and fails to pickup record
3. Search in "find grant" and fails pickup record That's all I've tested but it fail be elsewhere too.
Works in API and search builder.

I reproduced on the wordpress demo site (Contact-"Omar Barkley" custom field-"test contact") I Couldn't find a specific issue on Jira.

If it were only for contacts, I could use the search builder (which works) but This is for a grant. Need a select/checkbox for completing parts of a grant (status won't work.)

Has anyone else encountered this and/or resolved it?

# Answer
I have fixed that under https://issues.civicrm.org/jira/browse/CRM-16927 and here's the PR https://github.com/civicrm/civicrm-core/pull/6342 (not merger yet). Can you please verify the patch if it works for ya ?
> 3 votes

# Answer
I had two recent similar issues. One here (Advanced Search error after upgrade to 4.6.5) was resolved with a rc codebase that Eileen M kindly provided. The other (Different search results in Adv Search vs Search Builder), which is perhaps closer to yours, I temporarily resolved by going back down to 4.6.4. It sounds like a few search issues will be resolved when 4.6.6 comes out in a week or two.

You could try the new codebase that Eileen provided to see if that helps. If not, 4.6.6 is perhaps your best bet.
> 0 votes

---
Tags: search, civigrant
---


title: Add group to activity assignees

text:
# Question
Title: Add group to activity assignees
I want to assign everyone in a particular group to an activity when I create the activity.

Currently I only see how to add each one individually. This happens frequently enough that I would like to just assign to the group and have the contacts show up in the list of assignees, or use some other method to attain the same result.

When adding a new activity I can narrow the search to my group, but then I still have to add each one separately.

I tried searching for contacts in a group, then look for an action of "create activity" but that didn't show in my list of actions.

Thanks in advance for any help you can offer.

CiviCRM 4.6.3 on Drupal 7.37 in a Linux Mint 17.1 VirtualBox

# Answer
you should be able to do this via Find Members or Advanced Search. Use either and select your Group. Search. Select all records. Under Actions find "Record Activities for Contacts". On the next screen you should see all members of your group. And there should be an option to "Create a separate activity for each contact."
> 2 votes

---
Tags: activities, groups
---


# Question
Title: Upgrade Wordpress CiviCRM Version from 4.5.2 to 4.6.5
I have a good installation of CiviCRM on Wordpress, but now i want to upgrade to version 4.6.5 and when ik upgrade, the upgrade stops at 4.6.alpha7

I am trying for 4 hours to get an solution So i have tried to export the structure and data end make a new database with the original structure imports. But nothing will work..

**EDIT:** I have checked all the tables with a compare program, Left= Current version 4.5.2 / working civicrm (Backup / before Upgrade) Right= Original civicrm.mysql version 4.5.2

**RESULT:** Only tables civicrm\_value\_\**** are not in the right (original) version.

**EDIT 2:** I can upgrade to version 4.5.8 without problems. If i want to upgrade then to 4.6.6 It will also stop at 4.6.alpha7 (error below)

I have also checked if there is a table civicrm\_mailing\_abtest but this table does not exist.

I hope someone can help me to solve this problem.

Thanks a lot. It is a fantastic plugin!! ( CiviCRM )

With kind regards,

Mark

This is the error:

```
[Error: Upgrade DB to 4.6.alpha7]
Fout Veld   fout waarde
Type    DB_Error
Code    -1
Message DB Error: unknown error
Mode    16
UserInfo    ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1215 ** Cannot add foreign key constraint]
DebugInfo   ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1215 ** Cannot add foreign key constraint]
PEAR_Exception: DB Error: unknown error in unknown on line unknown
- DB_Error: DB Error: unknown error in unknown on line unknown
Exception trace

```

# Answer
I had a similar issue upgrading from 4.5.8 to 4.6.4, what worked for me was to manually remove the civicrm\_mailing\_abtest table from the database. Restore your database backup before the upgrade and login to mysql

**Update:** To restore your backup database:

```
mysql -u root -p // login to mysql

drop database civicrm; // delete the current database, the one is failing to upgrade

create database civicrm; // create a new empty database

quit // logout from mysql

```

**Restoring the database backup**

```
mysql -u root -p -h localhost civicrm < /path/to/your/database/backup/civicrm-database-backup.sql // write the backup to the new empty database

```

Replace "/path/to/your/database/backup" with your backup directory and "civicrm-database-backup.sql" with the name of your Civicrm backup SQL file.

**Check for the existing civicrm\_mailing\_abtest table**

```
mysql -u root -p

use civicrm; // replace civicrm with the name of your database

show tables; // it will give you a list with the civicrm database tables

```

If the civicrm\_mailing\_abtest is listed in the output, remove it, as it shouldn't be there, the A/B Test mailing was introduced in CiviCRM 4.6

```
drop table civicrm_mailing_abtest; // this will remove the table

```

After that proceed with the upgrade again.

Hope this helps

**Update 2:** If you have permission errors after the restore, you will need to grant permission to the civicrm mysql user

```
mysql -u root -p

grant all on civicrm.* to 'username' identified by 'password';

flush privileges;

```
> 2 votes

---
Tags: wordpress, upgrade
---


# Question
Title: What table and column contain the date a contact was added?
I'm trying to determine the correct table and column to check the data a contact was added to the civicrm-contact table. What is the best method for doing this?

# Answer
You can use `date_created` on the `civicrm_contact` table.
> 2 votes

# Answer
Check the table civicrm\_log. The column entity\_table will contain civicrm\_contact and the column entity\_id the id of the contact you are looking for. Does that help? If you want more specific information you need to explain what you are trying to do :-)
> 1 votes

---
Tags: contacts, database, data-model
---


# Question
Title: "Failed to locate template" error when building development environment
I am new trying to setup my development environment with the build kit tool. I am using XAMPP on Ubuntu 14.04 . I have problems with the `civibuild` command accessing my XAMPP MySQL via the command line to create the database so I have used the `gitify` command to set up, but when try to run `GenCode.php`, I get this error:

> civicrm\_domain.version := 4.7.alpha1
>
> Parsing schema description schema/Schema.xml
> Extracting database information
> Extracting table information
> PHP Fatal error: Uncaught exception 'Exception' with message 'Failed to locate template for civicrm.config.php' in /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/CRM/Core/CodeGen/Config.php:34
> Stack trace:
> #0 /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/CRM/Core/CodeGen/Config.php(10): CRM\_Core\_CodeGen\_Config-\>setupCms()
> #1 /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/CRM/Core/CodeGen/Main.php(115): CRM\_Core\_CodeGen\_Config-\>run()
> #2 /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/CRM/Core/CodeGen/Main.php(100): CRM\_Core\_CodeGen\_Main-\>runAllTasks()
> #3 /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/xml/GenCode.php(38): CRM\_Core\_CodeGen\_Main-\>main()
> #4 {main} thrown in /opt/lampp/htdocs/civisocialdev/wp-content/plugins/civicrm/civicrm/civicrm/CRM/Core/CodeGen/Config.php on line 34

What could be the problem?

# Answer
I'm seeing your path has three `civicrm`s in it - that seems like it's not correct, normally there are two with Wordpress.

Second - if you're using Ubuntu, there's really no need for XAMPP. You can just install your LAMP stack using `apt-get` or `synaptic`. This is much closer to the standard setup, and you're likely to find better assistance that way!
> 1 votes

---
Tags: wordpress, developer
---


# Question
Title: Groups correctly set but showing wrong - caching problem?
I'm using CiviCRM 4.6.5, Joomla 2.5.28 (yes, I know...), with 70k contacts and 25 groups (one of which is a smart group).

Since the upgrade to 4.5.6, contacts started to display the wrong groups (actually several times the same group, instead of several different groups). If you check the groups the contact should be in, the contact is there. But the group doesn't show on the contact record. Cleaning the Caches (through the backend) seems to fix the problem, and everything is fine and dandy for a while, with the groups displaying correctly in the contact records again. But the fix is only temporary - the next day, the problem is back again.

Can anyone please suggest where to start looking for the cause?

Thanks.

# Answer
> 3 votes
This sounds very much like https://issues.civicrm.org/jira/browse/CRM-16945

This has only just popped up in testing of 4.6 for my organisation as well.

# Answer
> 2 votes
Submitted the fix https://github.com/civicrm/civicrm-core/pull/6388 under CRM-16945

---
Tags: contacts, groups, cache
---


# Question
Title: How do I create a custom field that selects a CiviCRM group
I want to create a custom field that selects a CiviCRM group.

eg, the business logic is "when a person registers for an event and they select 'subscribe me to news of events like this' then add them to group X" where X is a custom field attached to the event.

I could create a custom field that is an integer, look up the Id of the group, and set the custom field to that number. It would be nicer to have a UI for that.

Any pointers? Cheers!

# Answer
As you may already know, there is a field that will expose all groups that are mailing lists to the user and let them select, which one they want to subscribe to. You could add this field to the profile that you use for events. It is descirben on this page (see "Using a profile"). However, users would be presented with all public mailing groups available.

As an alternative, you could also create a custom field (I would recommend a contact field but you could also use an event field) and give the users the opportunity to tick that field/option. You could then create a smart (mailing) group (which is also described on the page linked above) that includes all people who selected the option.

Both options do not require any coding at all and can be done via the UI.
> 3 votes

---
Tags: custom-fields
---


# Question
Title: Failed Upgrade 4.6.4 to 4.6.5 Joomla 2.5 & 3.4
My attempts to upgrade 4.6.4-\>4.6.5 fails in Joomla 2.5 with an 'already exists' error on CREATE TABLE \`civicrm\_cxn

Any clues? The full error message is:

> \[Error: Upgrade DB to 4.6.5\] Error Field Error Value Type DB\_Error Code -5 Message DB Error: already exists Mode 16 UserInfo CREATE TABLE `civicrm_cxn` ( `id` int unsigned NOT NULL AUTO\_INCREMENT COMMENT 'Connection ID', `app_guid` varchar(128) COMMENT 'Application GUID', `app_meta` text COMMENT 'Application Metadata (JSON)', `cxn_guid` varchar(128) COMMENT 'Connection GUID', `secret` text COMMENT 'Shared secret', `perm` text COMMENT 'Permissions approved for the service (JSON)', `options` text COMMENT 'Options for the service (JSON)', `is_active` tinyint DEFAULT 1 COMMENT 'Is connection currently enabled?', `created_date` timestamp NULL DEFAULT NULL COMMENT 'When was the connection was created.', `modified_date` timestamp NULL DEFAULT CURRENT\_TIMESTAMP ON UPDATE CURRENT\_TIMESTAMP COMMENT 'When the connection was created or modified.', `fetched_date` timestamp NULL DEFAULT NULL COMMENT 'The last time the application metadata was fetched.' , PRIMARY KEY ( `id` ) , UNIQUE INDEX `UI_appid`( app\_guid ) , UNIQUE INDEX `UI_keypair_cxnid`( cxn\_guid ) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8\_unicode\_ci \[nativecode=1050 \** Table 'civicrm\_cxn' already exists\] DebugInfo CREATE TABLE `civicrm_cxn` ( `id` int unsigned NOT NULL AUTO\_INCREMENT COMMENT 'Connection ID', `app_guid` varchar(128) COMMENT 'Application GUID', `app_meta` text COMMENT 'Application Metadata (JSON)', `cxn_guid` varchar(128) COMMENT 'Connection GUID', `secret` text COMMENT 'Shared secret', `perm` text COMMENT 'Permissions approved for the service (JSON)', `options` text COMMENT 'Options for the service (JSON)', `is_active` tinyint DEFAULT 1 COMMENT 'Is connection currently enabled?', `created_date` timestamp NULL DEFAULT NULL COMMENT 'When was the connection was created.', `modified_date` timestamp NULL DEFAULT CURRENT\_TIMESTAMP ON UPDATE CURRENT\_TIMESTAMP COMMENT 'When the connection was created or modified.', `fetched_date` timestamp NULL DEFAULT NULL COMMENT 'The last time the application metadata was fetched.' , PRIMARY KEY ( `id` ) , UNIQUE INDEX `UI_appid`( app\_guid ) , UNIQUE INDEX `UI_keypair_cxnid`( cxn\_guid ) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8\_unicode\_ci \[nativecode=1050 \** Table 'civicrm\_cxn' already exists\] PEAR\_Exception: DB Error: already exists in unknown on line unknown \- DB\_Error: DB Error: already exists in unknown on line unknown Exception trace

# Answer
> 1 votes
Civi 4.6.5 adds a new table "civicrm\_cxn". Your upgrade is failing because it's trying to add this table, but it already exists.

Usually this happens when you attempt an upgrade which didn't complete for whatever reason, then attempt a second upgrade without doing a DROP DATABASE and CREATE DATABASE command. Even though you may have restored a backup, newly-created tables will still be present.

The most "correct" way to handle this is to do a DROP DATABASE command for your Civi database, then CREATE DATABASE and load in your backup. That said, I suspect you can get away with blowing away the new table and running the upgrade again; try `DROP TABLE civicrm_cxn;` in MySQL and see if the upgrade works. Make a backup first, of course!

# Answer
> 0 votes
This table is newly-introduced in 4.6.5. It has been under discussion for a little while, however--have you installed a patch, pulled a non-release branch from GitHub, or anything like that?

I assume that before retrying the failed upgrade, you're restoring your database to the backup that you took prior to the upgrade.

Assuming you don't know/care how the table got in your database, you can go ahead and drop the table. In MySQL, just enter

```
DROP TABLE civicrm_cxn;

```

You can then retry the upgrade, which will re-create the table.

If you failed to backup before upgrading, at least only a couple of queries would be attempted going from 4.6.4 to 4.6.5. The file is at https://github.com/civicrm/civicrm-core/blob/4.6.5/CRM/Upgrade/Incremental/sql/4.6.5.mysql.tpl. You'll see that it creates the table, and then it adds a new activity type of "Failed Payment" to the civicrm\_option\_value table. If you need to start over, you can just drop the table and delete that row.

---
Tags: upgrade, 4.6.4
---


# Question
Title: Can I influence the activity source contact with the membership API Create action?
In my project I am using a scheduled job to get street recruitment data from a csv file and create a new membership with the API if required. When the membership is created, an activitiy is also automatically created using the logged in user as the activity source contact. Does anyone know if I can influence this activity source contact with the API? My workaround is changing the activity once it is generated with the post hook. Works, but is a bit hackish :-)

# Answer
At this point, no, at least as long as you aren't using the API as the member him/herself. The relevant line is https://github.com/civicrm/civicrm-core/blob/4.6/CRM/Activity/BAO/Activity.php#L1886:

```
// create activity with target contacts
$session = CRM_Core_Session::singleton();
$id = $session->get('userID');
if ($id) {
  $activityParams['source_contact_id'] = $id;
  $activityParams['target_contact_id'][] = $activity->contact_id;
}

```

Basically, CRM\_Member\_BAO\_Membership::create calls CRM\_Activity\_BAO\_Activity::addActivity, and the code above just forces the source contact to be whoever's logged-in.

Ironically, just a few lines above, the activity source contact is set to be the ID set in the `contact_id` property of the activity object passed to the function from the membership, but this overrides it.
> 3 votes

---
Tags: civimember, api, extension, activities
---


# Question
Title: How can I set "Assigned To" for an Activity to default to the logged-in user name?
Our users are creating many new Activities which are Assigned To the user creating the Activity. I want to save them time and keystrokes by having Assigned To: default to that logged-in user's name. How can I do this? Thanks.

# Answer
> 5 votes
Create a simple extension implementing hook\_civicrm\_buildForm like so:

```
function myextension_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Activity_Form_Activity' && $form->getAction() == CRM_Core_Action::ADD) {
    $form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
  }
}

```

# Answer
> 3 votes
You can (must) use an extension.

You can either use `hook_buildForm` to include a jQuery snippet that looks up the current user and populates the field, or you can use `hook_post` to do the same if there's no "Assigned to" set. The first approach lets the user see the "Assigned To" with their name, but the second approach covers activities created via other means than the "New Activity" form (import, API, profiles, etc.). If you go the second route, you need to make sure it's not assigning activities automatically for people contributing online etc.!

---
Tags: contacts, activities
---


# Question
Title: How To Record & Display External ID In Contact Summary?
We are (newly) using civi to track membership in our international martial arts organization.

We have an external ID for each member to date, which I need to preserve and display in the contact summary, so we don't need to re-issue new member IDs.

Once I have the civi DB current with all existing members, moving forward we will simply assign NEW members the civiCRM ID as their member ID.

We had considered a one time re-issue of existing members a new ID based on their civiCRM ID, but this is not feasible.

# Answer
You could do this with a database trigger. If you are using external id for the existing members you could put a trigger on civicrm\_contacts after insert that would populate external\_id with the internal\_id. (assuming after you import the internal\_id will be higher than any existing members. If not, than just add some number to get it higher).

External ID does show up on the main contact screen on the right side above phone number. If this isn't prominent enough you could use the civicrm\_contact\_get\_displayname hook to append the id to the end of their display name.

Here is some info on that.
http://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_contact\_get\_displayname

Also, you'll find a question or two on this in the old forum and in this stackexchange.

Note: if you add a db trigger you'll need to add it through the trigger\_info hook. http://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_trigger\_info
> 1 votes

# Answer
Not sure I quite understand your question? You could use the external\_id column on the civicrm contact record if the external ID is unique to the contact. If a contact could have more membership ID's you could add a custom field to the membership? I assume you know how to add custom fields, if not please check the user guide on http://book.civicrm.org/user/
> 0 votes

# Answer
External Identifier is visible in the same place as the CiviCRM ID at the bottom of the contact summary screen - IF one is defined. I don't believe you can record an external ID from within the UI, but only from an import (or manipulating the API).

Using the database's internal ID for membership IDs can backfire; someone incorrectly merging records can change the ID, as well as a number of other issues. It may be better to use a custom field.
> 0 votes

---
Tags: contacts
---


# Question
Title: Clearing/disabling out-of-date event locations
Is it possible to hide/disable event location addresses? Or manage them at all without digging around in the database?

I'm using Drupal Views to search by event location, but that doesn't help when adding locations - we have a long list of event locations, and because they're not sorted, and can't be searched, people keep adding superfluous duplicate locations, which makes the situation worse...

# Answer
Unfortunately, no, there is no UI for managing event location addresses and it's not possible to disable them even in the database without dropping the link between an event and the address (table `civicrm_loc_block`).

It could be a good feature to add to CiviCRM though.
> 1 votes

# Answer
Okay, I'm someone who should not be muddling too much in the databases... hopefully I didn't mess up anything when I went in to get rid of some incorrect addresses for our own location.

In Events\>Location, we had a few incorrect addresses in our drop-down list (4549 instead of 4945). We did not want someone to accidentally select one of these.

To remove them this is what I did: I looked at the location in all events (in Manage Events), including past events, to make sure none of the incorrect addresses were being used. Depending on the number of events you have, this can be a bit time-consuming, but why have wrong info in your database, right?

Through Control Panel, I went to phpMyAdmin and selected database from the lefthand side. I then did a search on the street address (with "match exact phrase" box checked, and all tables selected) to find the table this was in - civicrm\_address.

In the search results, you can scroll down to see the results in the table. I checked to make sure there was no contact\_id associated with the address that I wanted to delete... identified with NULL. (It is our own address, albeit incorrect, and no one lives at the incorrect address... it's a corn field!), so no contact would have it listed. I deleted it. I then went into our CiviCRM and checked the location drop-down list in a current event (Manage Event), and incorrect address is no longer in the list.

Not sure if this is a recommended way to do this, but the incorrect addresses are no longer in Event Location drop-down list.

I am not sure if I did find an incorrect address in use in a past event if I would be able to change it, or if that would cause other problems.
> 0 votes

---
Tags: civievent, addresses, location
---


# Question
Title: Create new report from template is not working (CiviCRM 4.6.5)
When you go to /civicrm/report/template/list?reset=1 and for example choose this contact report template /civicrm/report/contact/summary?reset=1 ..and click on the button 'Create report' Then a popup window appears with Report Title
Report Description ..and when you click the button 'Continue', the popup window disappears and nothing happens. No report is created.

I tried different browsers, but the problem stays the same.

# Answer
It appeared that this was caused by a theme that I applied to civicrm. I reverted to the original bartik theme and the report creation worked.
> 2 votes

---
Tags: civireport
---


# Question
Title: Data (phone numbers) deleted in batch using profile not deleted from contacted records
Wanted to reclassify 'Other Mobile' type phone numbers as 'Home Mobile' type phone numbers. Exported, copied data from 'other mobile'column to "Home Mobile column' in CSV file, leaving "other mobile column empty', and then reimported. Numbers were now in 'home mobile' field but also remained in "other mobile' (ie now appeared twice in each contact record. Created profile including phone number fields. Did batch edit using that profile. Deleted numbers in the innappropriate fields. Updated contact (saved). All appeared to work BUT the numbers are still showing in the "other mobile field. What have I done wrong?

# Answer
> 0 votes
not sure you have done anything 'wrong'. I think the phone and some other fields are designed so an empty field does not overwrite existing data - i remember this being an issue people have hit when trying to do what you tried via the Import route. Sounds like the same is happening via the Profile.

Probably doesn't seem like a 'great' solution, but if you have mysql access, could you use your Batch update Profile to change all the numbers you want to eg 'xyz', and then use mysql to find and delete that data?

---
Tags: contacts
---


title: CiviGroup Roles Sync errors

text:
# Question
Title: CiviGroup Roles Sync errors
After upgrading Drupal to 7.3.8 (don't know if this is related), I'm getting an error when a user logs on and belongs to groups/holds a role that is set up with CiviGroup Roles Sync.

> Role *groupname* (*group id*) should be held by user *username* (*drupal user id*) because they are part of *group id* (contactID: *civi id*)

When I check the user's groups and roles, they appear to be correct. The error is listed in dblog for each group that they are a member of.

Groups are regular groups, not smart groups.

Appears to be happening for all users.

# Answer
> 2 votes
I don't think this is actually an 'error', the status is just misleading.

The Group \<\> Role sync runs on a user when they log in, syncing up the roles. All this message is saying is: "When the user logged in, I added role x, because they are a member of group y."

The severity of these database log messages is misleading and will be fixed up in 4.7 by this commit: https://github.com/civicrm/civicrm-drupal/pull/272

---
Tags: drupal, groups
---


# Question
Title: Is CiviEngage a core part of CiviCRM now?
I'm a new Civi user with the intent of using CiviCRM for political campaigns. I keep coming across dated articles talking about CiviCampaign and how it's functionality is extended by CiviEngage, which is only available on Drupal. However, I did not find CiviEngage in the available public modules list.

I am testing CiviCRM on both WordPress and Drupal, and I noticed that Drupal lists CiviEngage as an activated module by default, however I find no equivalent in WordPress. Is the functionality provided in CiviEngage now a core part of CiviCRM on all available platforms, or is this still specific to CiviCRM on Drupal?

# Answer
CiviEngage, *at the moment*, is a Drupal module that currently ships with the official CiviCRM Drupal release (see https://github.com/civicrm/civicrm-drupal/tree/7.x-master/modules/civicrm\_engage, which ends up installed in sites/all/modules/civicrm/drupal/modules/civicrm\_engage). That means you won't find it on drupal.org or any other drupal module site and you will only see it in your CiviCRM installation as an available module if you are running CiviCRM on Drupal.

Having said that... plans are underway to first split the module out of CiviCRM and onto drupal.org so it can be downloaded and installed like any other third party drupal module and eventually be converted into an extensions so it can be used by anyone.

More information is available in this issue:

https://issues.civicrm.org/jira/browse/CRM-16671
> 8 votes

---
Tags: drupal, wordpress, civicampaign
---


# Question
Title: Can the Xero accounting package be integrated with CiviCRM?
What degree of integration is there between Xero and CiviCRM?

# Answer
> 4 votes
There has been some integration work undertaken by Fuzion and is available in this extension. General functionality:

* create contacts in Xero based on them being created (or having had a contribution or recurring contribution) created in CiviCRM. You can configure which of those 3 will cause them to be created in Xero
* update contacts in Xero based on the contact or contact details having been updated in CiviCRM
* adds a link to the contact summary to the Xero record
* adds a link from the contact summary to the contact's transaction history in Xero
* creates invoices in Xero based on contributions in CiviCRM (and adds a link in CiviCRM)
* where a pending contribution has a payment matched in Xero the CiviCRM contribution is updated (which participant records, memberships etc also being updated & emails sent as configured)
* where a contribution is voided or cancelled in Xero it can also be cancelled in CiviCRM

The extension cannot be downloaded through the UI (intentionally) as it defintely requires someone technically savy to be involved in setting it up & maintaining it. You can see much of what is possible at this blog post

---
Tags: accounting
---


# Question
Title: How can I preserve smarty date formating in message templates?
I have a message template that we use to print letters for those joining our association. We want to include the end date for their memberships in the letter (This used to be printed on membership cards, but we have ditched them.)

If I search for the new members and display the results as memberships, I can include the token {membership.end\_date} in the letter but it displays as, say, 2016-12-27 which is not commonly seen in Australia.

Our site settings include **define( 'CIVICRM\_MAIL\_SMARTY', 1 );** so the following code gives the formating I actually want:

```
<p>Your membership expires on:{capture assign=mem_end_date}{membership.end_date}{/capture} {$mem_end_date|date_format:"%d %B %Y"}</p>

```

Unfortunately this is somewhat temperamental. If I save the template when it is displaying the code and the next time I open it I select 'Source' **before** opening the template, then the formatting is correct.

However, if I save the template when it is displaying the code and then open the template before I select 'Source' the next time I use it, the **"** is changed to **"** (see below) and I don't get any end date printed at all.

```
   <p>Your membership expires on:{capture assign=mem_end_date}{membership.end_date}{/capture} {$mem_end_date|date_format:"%d %B %Y"}</p>

```

Is there some other way I can write things so that it will retain the formatting I want without the person who will be running the letters having to remember to select **source** before opening the template?

This is a Drupal7/CiviCRMv4.4.16 site.

# Answer
You can stop ckeditor encoding quotes by editing ckeditor.js in /packages/ckeditor. There's a push command that begins 'quot,iexcl,cent,pound,curren,yen' - remove quot from this list. This isn't terribly elegant, and would obviously need doing on every upgrade, but I couldn't find anything equivalent in the ckeditor config files without disabling all html entities entirely.

Alternatively, if you don't need to use visual editor at all, you could separate the two entirely. Copy the content from the template into a .tpl file and put it in the templates directory somewhere (or in the templates folder in an extension). Then include in the visual editor with:

{include file=CRM/membership.tpl} (or as appropriate)

Then edit this file directly in whatever way suits.

(We had odd problems with the presence/non-presence of the $ sign in smarty tags when we included files like this, but that was a few versions ago so that bug may have been fixed by now.)
> 1 votes

---
Tags: message-templates, smarty
---


# Question
Title: CiviMail stuck on "Starting execution of Send Scheduled Mailings"
WordPress installation. Upgraded web hosting to a VPS (Site5) and they said the cron job would work fine. I sent a test of this mailing to a group of 10. It worked fine. I So I sent the mailing to a group of ~4236 recipients and executed the "Send Scheduled Mailings." That was over an hour ago. The job log says:

Entity: Job Action: process\_mailing Summary Starting execution of Send Scheduled Mailings Details

Parameters parsed (and passed to API method): a:1:{s:7:"version";i:3;}

Full message: Starting execution of Send Scheduled Mailings

Should I be worried or does this just take a long time?

# Answer
so you should have the report accessible for this mailing, what do you see? you have the number of emails delivered, that should increase, more or less slowly depending on how you configured your cron
> 1 votes

---
Tags: civimail
---


title: Is the postSave hook a supported hook?

text:
# Question
Title: Is the postSave hook a supported hook?
This is different than the post hook, which is officially documented. The only real reference to the postSave hook I can find is CRM-7850, so I'm just wondering if it's supported or if it might disappear in future?

# Answer
Reading the code and that issue, the hook exists and someone just forgot to add it to the wiki. Here, I've just added it:

http://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_postSave\_table\_name
> 3 votes

# Answer
If it is not officially documented I would guess the hook is there until it disappears :-)
> 1 votes

---
Tags: hooks
---


# Question
Title: Is the "Show Contact Deceased" extension compatible with 4.6?
Extension here shows as compatible through 4.5. Is this compatible with 4.6?

What is the best way to determine whether something is likely not compatible with a contemporary Civi version rather than just not updated to reflect as much?

# Answer
The core team liked the extension so much that it was incorporated into core for 4.6. So we won't be releasing a 4.6 version. Thanks for your question - we will update the documentation on civicrm.org to reflect that it has gone into core for 4.6.
> 4 votes

---
Tags: extension, 4.6.0
---


title: Membership Status Report

text:
# Question
Title: Membership Status Report
I have done a CiviCRM installation for a local networking club. They are adopting CiviCRM slowly, and at the moment we only have the member's contact records and membership records imported.

We need a report that shows the number of memberships that are of different statuses; they want to know at any given time how many current members, grace members, expired members, etc.

How to do this?

# Answer
If you are wanting a 'count' for each status, ie a small table showing eg Member Type X, Status A 12 Member Type Y, Status A 5 Member Type X, Status B 15 etc

and if you are using Drupal, then I built a View to demo how you can do this which you can download from here

NOTE: you may need log in as user/1 (or Masquerade as admin) in order to access the Import View window.

NOTE: this was done in response to the stackexchange question
> 1 votes

# Answer
By "any given time", do you mean you want to be able to pick any historical date and see how many members you had in each given status? If so, that's not doable out of the box. You can get basic total member numbers by searching on start/end dates, but this won't catch people in 'New' or 'Grace' periods etc.

Afaik most CRMs struggle with this idea of looking at data from a particular point in time. It's a regular question I get, and tbh I never have a good answer. For what it's worth we just use an script which dumps member numbers to a csv once a day.
> 1 votes

# Answer
Steps are:

1. Go to Reports \>\> Membership Reports \>\> Membership Details
2. Then on Filter tab choose "Member Since" of desired date range and "Membership Status" of your choice.
3. Preview Report and in order to save a copy of the Report click "Save a copy" and change the title of your new report copy

That's it
> 0 votes

---
Tags: civimember
---


title: What organizations use CiviCRM?

text:
# Question
Title: What organizations use CiviCRM?
Okay...call me blind, but I can't find a list anywhere of who is using CiviCRM. I know it exists somewhere (or at least an outdated form of it). Can anyone help me...?

# Answer
I've seen the page you're talking about, but I don't think it survived the website redesign. Here is a list of CiviCRM Members though, which has the more high-profile names you're probably searching for: https://civicrm.org/members
> 3 votes

---
Tags: civicontribute
---


# Question
Title: How can I make External ID a searchable field?
Or create a directory that displays all recorded external IDs?

# Answer
when you click in the QuickSearch (white search box very top left) you should see a drop down of 'what do i want to search for' and External ID is in there. So you can select that and then just enter the Ext ID that you are looking for. You can also add the Ext ID field to a Profile which you have set up for Search or Listing if you want this more public eg I set this up on demo.

This link for a user to 'edit' their own (which you wouldn't want I guess ;-) but you may need to check if that url is available and set the field to View Only http://d46.demo.civicrm.org/civicrm/profile/edit?gid=16&reset=1

This to 'view' it http://d46.demo.civicrm.org/civicrm/profile/edit?gid=16&reset=1

This to 'search' for it http://d46.demo.civicrm.org/civicrm/profile?gid=16&reset=1

And this (or may be another url for this) to View the listing http://d46.demo.civicrm.org/civicrm/profile?\_qf\_Search\_display=true

External ID is also available from Advanced Search and Search Builder like most other fields.
> 6 votes

---
Tags: contacts, search, external-id
---