# Question
Title: Upgrading old version - Integrity constraint violation: 1062 Duplicate entry 'civicrm_handler_field_custom_file-class' for key 'PRIMARY'"
I have been spinning my wheels all day trying to upgrade an old CiviCRM installation. It was running 4.3.4, and I need to get it up to at least the latest 4.6.x. This error has been dogging me the whole way:

> \[Error: Finish Upgrade DB to 4.4.alpha1\] PDOException: "SQLSTATE\[23000\]: Integrity constraint violation: 1062 Duplicate entry 'civicrm\_handler\_field\_custom\_file-class' for key 'PRIMARY'"

I've gone so far as to approach the upgrade in steps; upgrade to the latest 4.3, then 4.4, etc. after starting out trying to do the whole thing (to 4.6.15) in one fell swoop. I did manage to get it upgraded in that way to 4.3.11, but trying to upgrade to 4.4.21 causes the error.

Googling the error turned up this thread from the forum: https://forum.civicrm.org/index.php?topic=35976.0 so I tried the last suggestion of disabling/enabling CiviCRM beforehand but there was no improvement. I also tried deleting rows in the registry and registry\_files tables that reference civicrm\_handler\_field\_custom\_file but that didn't help either.

Suggestions from anyone?

Here's my whole stack trace:

```
[Error: Finish Upgrade DB to 4.4.alpha1] PDOException: "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'civicrm_handler_field_custom_file-class' for key 'PRIMARY'"
#0 /home/mydomain/domains/mydomain.net/public_html/includes/database/database.inc(2139): PDOStatement->execute((Array:5))
#1 /home/mydomain/domains/mydomain.net/public_html/includes/database/database.inc(664): DatabaseStatementBase->execute((Array:5), (Array:4))
#2 /home/mydomain/domains/mydomain.net/public_html/includes/database/mysql/query.inc(36): DatabaseConnection->query("INSERT INTO {registry} (name, type, filename, module, weight) VALUES (:db_ins...", (Array:5), (Array:2))
#3 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(179): InsertQuery_mysql->execute()
#4 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(144): _registry_parse_file("sites/all/modules/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_...", "<?php\n/*\n +----------------------------------------------------------------...", "civicrm", "100")
#5 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(82): _registry_parse_files((Array:180))
#6 /home/mydomain/domains/mydomain.net/public_html/includes/bootstrap.inc(3076): _registry_update()
#7 /home/mydomain/domains/mydomain.net/public_html/includes/bootstrap.inc(3062): registry_update()
#8 /home/mydomain/domains/mydomain.net/public_html/includes/common.inc(7238): registry_rebuild()
#9 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Utils/System/Drupal.php(991): drupal_flush_all_caches()
#10 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Upgrade/Form.php(607): CRM_Utils_System_Drupal->flush()
#11 [internal function](): CRM_Upgrade_Form::doIncrementalUpgradeFinish(Object(CRM_Queue_TaskContext), "4.4.alpha1", "4.3.11", "4.4.21", "/tmp/civicrm-post-upgrade7AnGtE")
#12 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Task.php(79): call_user_func_array((Array:2), (Array:5))
#13 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Runner.php(186): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
#14 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(44): CRM_Queue_Runner->runNext(TRUE)
#15 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php(80): {closure}()
#16 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(47): CRM_Queue_ErrorPolicy->call(Object(Closure))
#17 [internal function](): CRM_Queue_Page_AJAX::runNext((Array:5))
#18 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(293): call_user_func((Array:2), (Array:5))
#19 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(76): CRM_Core_Invoke::runItem((Array:13))
#20 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:5))
#21 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/drupal/civicrm.module(484): CRM_Core_Invoke::invoke((Array:5))
#22 [internal function](): civicrm_invoke("upgrade", "queue", "ajax", "runNext")
#23 /home/mydomain/domains/mydomain.net/public_html/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:4))
#24 /home/mydomain/domains/mydomain.net/public_html/index.php(21): menu_execute_active_handler()
#25 {main}

```

# Answer
It seems to be failing when Drupal is flushing its cache, and the error is related the Views integration of CiviCRM (in the Drupal registry).

There can be various causes, but before digging deeper, I would try:

* moving the "views" code base from sites/all/modules/civicrm/drupal/module/views to somewhere outside your Drupal hierarchy,
* clear the Drupal cache
* upgrade the CiviCRM code, remove the Views directory again
* run the CiviCRM upgrade

If all goes well, then move back the Views code and flush cache again, to see if it now works. If not, it will require debugging a bit more in details, perhaps old views data in the DB.
> 1 votes

---
Tags: upgrade, 4.6
---


# Question
Title: Extra p tags in profile form inserted via WP shortcode
Even though I have disabled autop for shortcodes, I end up with a lot of extra `<p>` tags in the generated form. Here's a snippet:

```
<div id="editrow-email-Primary" class="crm-section editrow_email-Primary-section form-item">
  <div class="label">
    <label for="email-Primary"> Email
      <span lass="crm-marker" title="This field is required.">*</span>
</p><p>
    </label>
  </div>
  <div class="edit-value content">
    <input maxlength="254" size="30" name="email-Primary" type="text" id="email-Primary" class="big crm-form-text required" />
  </div>
<div class="clear"></div>

```

Note the stray `</p><p>` in the middle. But while a bit wrong, this is ok. What's really a problem is that the generated JS code for the datepicker *also* gets a bunch of random `<p>` tags:

`<script type="text/javascript">/*<![CDATA[*/</p><p>CRM.$(function($){</p><p>var $dateElement=$('input[name=birth_date_display_57599e0ccbe99].dateplugin:not(.hasDatepicker)');</p><p>`

This completely breaks the JS.

Any hints on how to figure out where these tags are coming from would be helpful. This sure looks like autop acting up, but I don't see how it could affect the shortcode's generated *content*, even when it might wrap the shortcode itself.

# Answer
> 1 votes
Ok, I figured it out. Here's the auto-relevant bits from `functions.php`:

```
function better_wpautop($pee){
    return wpautop( $pee, $br=0 );
}

/* This is a hack to make sure that wordpress's autop filter doesn't apply to shortcodes */
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'better_wpautop', 11 );
add_filter( 'the_content', 'shortcode_unautop', 12 );

```

I thought `shortcode_unautop` was supposed to fix this, but I took a look at it and it's a huge hack that tries to strip p tags back out of shortcode content in a truly terrifying way with a regex (ob Zalgo reference). So I made a copy of my standard page template and added the following to the top:

```
remove_filter( 'the_content', 'better_wpautop', 11 );
remove_filter( 'the_content', 'shortcode_unautop', 12 );

```

Now there is nothing autop related happening, which is fine, since the entire content of the page comes from the CiviCRM profile.

---
Tags: wordpress
---


# Question
Title: How to configure Views VBO action to disable relationships?
I'm trying to create a View of people with relationships to an organisation with options to disable those relationships. I have created the view and added a VBO field on the relationship.

In the Selected Bulk Operations section, I have selected Modify Entity Value and then in the display section selected Relationship is Active.

The view then shows a 'Modify entity values' and after clicking that button I get a text box to enter the value of Relationship is Active. Entering '0' and submitting then has the intended effect of disabling the relationship in Civi.

But ... what I really want is the button to say "Disable relationship(s)" and when clicked to set the Relationship is Active to 0 without asking the user for a value.

How can I achieve that? (Drupal 7, CiviCRM 4.6.18, civicrm\_entity 7.x-2.0-beta1)

# Answer
First part is easy. When you check the box 'modify entity values' in the VBO field, you should see an option to tick another box that says 'override label'. That lets you then set the button that users will see to be 'Disable relationships'.

The second bit - i think it would require more code for CiviCRM Entities module or civicrm\_entity\_actions. I say this because on a VBO i set up recently I had the option to tick both 'Add to Group' and 'Remove from Group' (and there was also 'modify entity values') - so it sounds like you need the options for 'Enable Relationship' and 'Disable Relationship' to be explicit options at that step.
> 2 votes

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


# Question
Title: Certain data is not displaying on records
I just created a custom field for a multi-select list using tab with table. When I add data, the tab correctly shows that there are four items saved to this field, but the actual items are not displaying. See image attached.

Having another similar problem, not sure if they are related. We have employer-employee relationships. The employer properly displays on the employee summary. Both employer and employee show a relationship, but when you go to the Relationship tab, nothing is displayed.

I did work in a staging environment, and this worked. What could be causing this problem on this instance?

# Answer
> 1 votes
FYI, I found a work-around by changing from "tab with table" to "tab". Also when I checked the staging environment that I used for testing, there were two fields in the custom field group, the multi-select field and a text field, that I no longer needed. Although it worked fine with "tab with table", once I deleted the text field that I no longer needed, it no longer worked. Seems like a bug to me.

---
Tags: wordpress, custom-fields, relationships
---


title: Views integration and CiviVolunteer

text:
# Question
Title: Views integration and CiviVolunteer
I think I've discovered something broken with CiviVolunteer's views integration, which was only laid bare in the past two civi 4.6 releases (.17 and .18, related to the custom group work).

The symptom is that the views interface now returns "The website encountered an unexpected error. Please try again later." and in the watchdog, I can see this: "CRM\_Core\_Exception: Invalid Entity Filter for Activity in CRM\_Core\_BAO\_CustomGroup::validateSubTypeByEntity() (line 645 of \[...\]CRM/Core/BAO/CustomGroup.php)."

Actually, I updated the exception code to include 'Activity'. That part of the code shouldn't be executing except for contact entity types.

Tracing back to how this might have happened - it appears that civivolunteer creates the custom field group that this is breaking on, and it includes a number in the "extends\_entity\_column\_value" of civicrm\_custom\_group, which I suspect is why this code is executing.

I haven't tried removing this column data, in case it's used in a way I don't understand, but I'm guessing this is the easy solution.

Anyone else have this experience and/or can give me an opinion on my diagnosis?

# Answer
Whether or not civivolunteer is misbehaving, I've got a pending patch to the views integration that fixes the issue, here: https://issues.civicrm.org/jira/browse/CRM-18776
> 3 votes

# Answer
Adding this an answer rather than a comment so I take advantage of formatting, like, ya know, paragraphs:

I'm not clear what your question is, so I'll try to answer a few questions you might be asking :-)

# If your question is "Is CiviVolunteer misbehaving with regard to its declaration of custom fields?" the answer is no.

To the best of my knowledge, the extension manages custom fields the same way as if you were to create them via point-and-click. I'm not sure exactly where you're encountering the error, as the extension defines several custom field groups:

One is for the contact subtype Volunteer. The corresponding entry in civicrm\_custom\_group (name=Volunteer\_Information) has a string in the extends\_entity\_column\_value. If you manually create a custom field group for the student subtype that ships with some builds, you'll see it follows the same pattern.

For what I assume are legacy reasons, if the custom field group extends an Activity, the column in question takes an integer instead of a string. The integer represents the value of the activity subtype in the option group named activity\_type.

# If the question is "How can I get more CiviVolunteer data into Views?" see below.

CiviVolunteer doesn't have any Views integration beyond what it inherits from Core. Since Core already exposes the Activity entity which CiviVolunteer makes use of, some CiviVolunteer data is exposed. However, entities originated by CiviVolunteer (e.g., civicrm\_volunteer\_project) are not exposed. I haven't had any serious requests for this functionality, so I haven't pursued it.

I haven't worked with the Views integration code since versioning was managed in SVN (!), so it's unclear to me what it would take to expose Volunteer-specific entities. I suspect the integration code would need to be updated to invoke hook\_civicrm\_entityTypes(), but I haven't dug around to see how much other information Views needs.

To be more helpful I think I need more information. What are you trying to do? What steps can I take to reproduce the error? Does the View have to be of a certain type? Maybe it would be easier to export your View so I can test it on a copy on my end.
> 0 votes

---
Tags: drupal-views, civivolunteer
---


# Question
Title: How can I set a Membership to Next Year?
The business rule is that if people join after September this year, their membership becomes effective for the next calendar year.

Can this be done within CiviCRM?

At the moment we are adjusting the dates with a hook.

```
civicrmprofile_civicrm_postProcess {
  if ($join_date_month > 9) {
        $end_date = date("Y-m-d", strtotime($join_date_year + 1 . "-12-31"));
        $start_date = date("Y-m-d", strtotime($join_date_year . "-01-01"));

```

# Answer
> 1 votes
Yes - in Membership Types you can set membership type plan to be fixed, and then set the Start Day and also set the Rollover day

> Membership signups on or after this date cover the following calendar year as well. Example: If the rollover day is November 30, membership period for signups during December will cover the following year.

---
Tags: civimember
---


# Question
Title: Error Event registration - When registering for an event
This is all that is on the page after you click "Continue"

**Sorry but we are not able to provide this at the moment. Could not find valid value for id Return to home page.**

Using civicrm 4.7.8 with Wordpress

# Answer
> 1 votes
It might be because you start on a different domain name or protocol than the one configured in civi.

a common issue is to go to http://example.org but http://www.example.org is configured, or https://example.org

Can you copy/paste the url of the registration form and the one after? are they the same?

---
Tags: wordpress
---


# Question
Title: Sync CiviCRM Events with WordPress custom post type
I want to Sync CiviCRM Events with WordPress custom post type. I.e. everytime I create/edit/delete CiviCRM Event the same happens with corresponding custom post type. This will bring new abilities (i.e. you'd have Featured image). Is there a CiviCRM extension or WordPress plugin that provides this?

CiviCRM 4.7.7, WP 4.5.2

# Answer
I haven't put it on the WordPress repo yet, but there's CiviCRM Event Organiser. Repeat events only sync properly when the event is created in Event Organiser, but most of the other elements sync as you would expect. Event registration sync, however, is not yet completed.
> 4 votes

---
Tags: civievent, wordpress
---


title: CiviCRM and Webform Confirmation Page

text:
# Question
Title: CiviCRM and Webform Confirmation Page
Drupal 7 and CiviCRM 4.6

Using the Webform extension, which is amazing of course. Is there a way to get the confirmation page to look like the page would be if somebody was using a native CiviCRM form. For example for a new membership, it would show name, membership expiration date etc? This does get emailed but sometimes our members don't get our emails, so it is nice to have a confirmation page they can print with these fields like you can in a CiviCRM form?

Might be obvious thing I am missing.

# Answer
> 3 votes
I think the answer will be primarily a drupal answer ie you need to get the tokens for the submission values on the confirmation page. The best recipe (untested by me) that I can see that doesn't involve a custom module is here

Please report back how it goes.

---
Tags: webform-civicrm
---


title: Authorize.net seal and JS in footer

text:
# Question
Title: Authorize.net seal and JS in footer
So, utilizing Authorize.net, the verification seal code has a JS call in it. However, when trying to save the online event registration page, CiviCRM complains that there may be a JS attack in progress. Pulling the script bits out removes the error and the link still says it's verified. The code is typical JS light, but seems very benign in the same way. Anyone else experiencing such an issue?

Here's the JS call, with the potentially confidential bits mixed up: `<script type="text/javascript" language="javascript">var ANS_customer_id="redacted";</script><script type="text/javascript" language="javascript" src="//verify.authorize.net/anetseal/seal.js" ></script>`

Wordpress: 4.5.2 CiviCRM: 4.7.8

# Answer
> 1 votes
Where are you trying to add the script -- in the "Footer" editor window on the Event details page?

If so, you probably need to add it in the Wordpress side (e.g. as an HTML/Text widget) rather than the CiviCRM editor to avoid these security notices. If you only want to have the widget show on CiviCRM pages, or SSL pages, etc. you may find this Q&A on the Wordpress StackExchange site helpful (more than one of the answers may be useful).

---
Tags: wordpress, javascript, authorize.net
---


# Question
Title: KCFinder browser shows empty pop-up window. How to debug?
I've just upgrade a site, which as far as I'm aware was working fine, from CiviCRM 4.6.x to 4.7.8. Only now the file/image browser and file upload facility within the CKEditor (which I understand is provided by KCFinder, is displaying nothing in the file/image browser and won't let me upload anything. Don't know if this is a bug in the 4.7.8 release for Wordpress. I've never come across this issue before in CiviCRM, on dozens of different sites. I've read that KCFinder is fussy about paths and permissions. Any pointers about how to fix this very welcome.

Update: from the error log I see that each time I open up the KCFinder browse window I get a pattern of notices and warnings, ending with a fatal error:

> PHP Notice: Undefined variable: output in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 403, referer: http://account.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fadd&reset=1&action=add
>
> PHP Warning: exec() has been disabled for security reasons in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 403, referer: http://account.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fadd&reset=1&action=add
>
> PHP Notice: Undefined variable: output in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 404, referer: http://account.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fadd&reset=1&action=add
>
> PHP Warning: implode(): Invalid arguments passed in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 404, referer: http://account.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fadd&reset=1&action=add
>
> PHP Fatal error: Uncaught exception 'Exception' with message 'Failed to locate civicrm.settings.php. Please boot with settingsFile, search, or CIVICRM\_SETTINGS; or normalize your directory structure.' in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php:125\nStack trace:\n#0 /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php(413): Civi\Cv\Bootstrap-\>boot()\n#1 /home/account/sites/default/wp-content/plugins/civicrm/civicrm/packages/kcfinder/integration/civicrm.php(45): require\_once('/home/account/si...')\n#2 /home/account/sites/default/wp-content/plugins/civicrm/civicrm/packages/kcfinder/integration/civicrm.php(140): checkAuthentication()\n#3 /home/account/sites/default/wp-content/plugins/civicrm/civicrm/packages/kcfinder/core/bootstrap.php(39): require('/home/account/si...')\n#4 /home/account/sites/default/wp-content/plugins/civicrm/civicrm/packages/kcfinder/browse.php(15): require('/home/account/si...')\n#5 {main}\n thrown in /home/account/sites/default/wp-content/plugins/civicrm/civicrm/civicrm.config.php on line 125, referer: http://account.co.uk/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fevent%2Fadd&reset=1&action=add

I've got 4.6.x sites running on the exact same server set-up with no issues. This is the first site with 4.7.x on this server.

# Answer
There used to be a requirement that the URLs that Andrei referred to above could not contain symbolic links. I don't know if that is still the case, but make sure that all directories in that path are true directories and not symbolic links.
> 1 votes

# Answer
I don't think there's an intentional change in system requirements. However, looking at civicrm.config.php, I can see it's undergone recent changes. It looks like you're having trouble because your PHP configuration doesn't allow running the "exec" command. That's often done for security - but if you can change your configuration to allow it, I think you'll be better off.

If not, maybe change line 401 in civicrm.config.php to read:

```
if (true) {

```

to force it to use the alternate method of finding your search directory?

Please try either changing that line or your PHP configuration to allow "exec" and let us know if it solved the problem for you!
> 1 votes

---
Tags: kcfinder
---


# Question
Title: Organization/Individual Contact relationship
* I'm using CiviCRM as Joomla component
* Joomla users are not connected to CiviCRM contacts
* There are Organizations and Individual contacts
* Each Individual contact belong to Organization (employer) and has a specific group eg "Representative", "Librarian" etc.

# Updating profile info:

Organizations get an email (through mailing functionality) with personalized URL to update their profile fields.

# PROBLEM:

What is the best way to enable Organizations admin to update/add/delete Individual contacts which belong to that specific organization?

# Answer
afaik there is nothing in civicrm that delivers quite what you ask.

The closest 'in the box' is probably the 'contact dashboard' which does let Primary Contact edit the Organisation record, and if you "allow second degree relationship permissions" here the if Primary Contact has permission over the ORganisation and the Organisation has permissioned relationship over the other employees, then Primary contact can edit those people.

Of course the Primary Contact needs a joomla record to login to do this
> 2 votes

---
Tags: contacts, profile, upgrade
---


# Question
Title: Is there a setting to automatically Refresh Dashboard Data on a user login, or when returning to CiviCRM Home?
We're on Civi 4.6.17 and Drupal 7.

I'm looking for a way for users to be able to select an option to be able to automatically Refresh Dashboard Data on login, or when returning to their CiviCRM Home page, without having to click on Refresh Dashboard Data.

Better, is there a way to have this be the default action with an admin setting.

Is/are there such a setting(s)?

# Answer
> 2 votes
I don't think such setting exists, although, you can set the timeout for the Dashboard cache navigating to **Administer - System settings - Misc** and set the the **Dashboard cache timeout** to the value desired in minutes, setting it to 1 minute for example it will refresh the Dashboard data every minute.

I guess the other option would be to create an extension and use the resetDashletCache method on login

---
Tags: dashboard, user, user-dashboard, user-interface, user-experience
---


# Question
Title: Keep getting HTTP ERROR 500 since upgraded to 4.6.16
Since I have upgraded to 4.6.14 \> 4.6.16 everything is so messed up on my website. Events that are not yet finished they are not appearing on the dashboard, Cant change the event end date, clicking save button returns only endless CiviCRM logo loop. Cant renew membership. Keep getting the message "The Contact Sub Type does not match the Contact type for this record".

# Answer
> 1 votes
@Tapash - I tried to reproduce one of the specific issues that you reported post upgrade to 4.6.16 : Fatal Error when renewing membership after Upgrading to 4.6.16

But I can not - it's all working fine on our 4.6.16s - I also don't have any reports of any of our projects experiencing issues on 4.6.16 I'm wondering if perhaps something went wrong during your recent upgrade?

General recipe for this is to restore both code base (files) & databases back to 4.6.14 and then to run the upgrade script \[to 4.6.16\] again. If you can: run it via drush - it may give you some warnings/errors that give you some insight as to what's going on.

> sudo -u apache drush civicrm-upgrade-db

# Answer
> 0 votes
6.18 which is out now. There were regressions in 4.6.16 which had fixes in 4.6.17 & 4.6.18 due to fixing a difficult security issue

---
Tags: civievent, civimember
---


title: Civisualize not reporting Gender

text:
# Question
Title: Civisualize not reporting Gender
Civisualize seems to be reporting on most things, however the Gender report shows a green circle with 99% but no breakdown of gender even though we have male and female members. Any ideas?

# Answer
> 2 votes
Fixed by reinstalling the module

---
Tags: civisualize
---


# Question
Title: Can I send membership reminders "retroactively"
I created a new installation, and I want to send membership reminder to everybody who is, say, 2 months *or less* before expiration (including those whose membership already expired). Essentially, the opposite problem from the one described here. Is it possible?

# Answer
> 1 votes
This answer assumes that this is a one-off requirement to deal with the "backlog" of reminders that has arisen because you haven't had the ability to send scheduled reminders before and that once the site is established you will be sending reminders at 2 months before the membership end date.

You wouldn't do this with a scheduled reminder. You would use **Advanced Search** or **Find Membership** to identify all those who "missed" the two-month-before reminder and send an email to them using CiviMail.

---
Tags: civimember, scheduled-reminders
---


# Question
Title: Contact summary email link open mailto: instead?
Noticing a change after update to 4.6. Within the contact summary, clicking an email link opens up a CiviCRM popup email dialogue. Is there an easy way to override this behavior and provide a simple mailto: link instead like it used to be in 4.4?

A setting? if not, an extension?

# Answer
> 1 votes
For many people, this new behavior is an improvement, but there are definitely others who preferred the old approach.

The operative line in the template is here, and the only way you don't see that is if outbound mail is turned off on the site. (In a perfect world, there would be a site-wide setting for this.)

If you want a customization to handle this, the easiest might be to add a bit of jQuery via a .extra.tpl, extension, or theme:

```
CRM.$(function($) {
  $('.crm-contact_email a.crm-popup').each(function() {
    var email = $.trim($(this).html());
    var emailLink = $('<a/>', {
      class: 'mailto-link',
      href: 'mailto:' + email,
      title: ts('Send an email outside of CiviCRM'),
      html: '<i class="crm-i fa-envelope"></i>'
    });
    $(this).after(emailLink);
  });
});

```

---
Tags: civimail
---


# Question
Title: How to delete an address, phone, email, or website in a profile?
I've created a CiviCRM profile with address fields, and with email, phone, and website fields, and configured this profile for use in the Drupal Account Edit screen. Some users may want to delete these fields from their profile, but this doesn't seem to be possible. When the user deletes the values of all the address fields, and/or deletes the phone, email, or website form values, and saves the form, the existing field values remain untouched.

As a very poor workaround, the user can enter a bogus value like '-' for the phone number, or for address fields, but email and website require valid formats, so even this poor workaround fails for those fields.

Is there a way to allow deleting on these entities in a profile?

# Answer
> 1 votes
I recall this coming up a number of times on the old Forum and the answer was 'can't be done'. And I thought this was going to be an unhelpful answer but Post 1 took me to Post 2 which took me to this Include ID when editing 'block' fields (+ allow deletion of block values via Profiles) which is flagged as Fixed for 4.7.

What version are you on? Want to go test on master

---
Tags: profile, addresses
---


# Question
Title: Adding new default components to the database
I have been working on to add a default header and footer to the system workflow emails. Most of the part is done but I am stuck at setting those components in the database by default so that whenever a new user installs civicrm, get the new transactional\_header and footer along with other components as well.
I have for now trying updated the .tpl files for the mysql in civicrm/templates/civicrm\_msg\_templates.tpl
I tried resetting the database to see the changes but its not there. Do we have any documentation or we need to make changes somewhere else also?

# Answer
A bit of terminology: Components in CiviCRM usually means CiviContribute, CiviEvent, CiviMembership, etc. I think you are referring to parts of an email template when you write about components. In general, when you are wanting to add something to the database in CiviCRM as part of the core code, you need to make sure it is added to the install tarball and is added or changed in databases as they are upgraded.

To insert data in the tarball, look under https://github.com/civicrm/civicrm-core/tree/master/xml/templates \- in your case you likely want to add or update templates in https://github.com/civicrm/civicrm-core/tree/master/xml/templates/message\_templates

To insert or modify data on upgrade, look at https://github.com/civicrm/civicrm-core/tree/master/CRM/Upgrade. Note that the message templates are in subdirectories by release, and that non-message template insertions are generally in the per release upgrade scripts in https://github.com/civicrm/civicrm-core/tree/master/CRM/Upgrade/Incremental/sql
> 1 votes

---
Tags: civimail, database, gsoc
---


# Question
Title: What is the correct return from payment provider URL?
I'm developing a payment plugin for SwipeHQ (a New Zealand based online credit card processor) for my clients Drupal website running CiviCRM.

Currently a user will make a purchase and be redirected to the correct payment provider page, but is currently (incorrectly) being redirected to the IPN notification page on completion. The IPN end point should be used by the payment provider to notify the server of success or otherwise, but when the client is redirected here none of this information yet exists so it throws an exception. How do I instead redirect to the completion page ("hi your purchase is successful pending payment") - I have tried passing the URL in the format

```
civicrm/event/register?_qf_Confirm_display=true&e436769547477d10db6253a97538b92a_7705
But it complains about not being able to find the id..

```

I guess what I'm asking is, is there an easy way, given a transaction id or something similar (which I can hake the payment provider pass back to me) I can close the users current transaction?

# Answer
welcome to CiviCRM - we had some communications with a potential client who had an in-house developer that did some work on SwipeHQ. Suggest you try getting in touch with him via this question or give me a buzz and I will put you in touch if that is helpful. Adding a SwipeHQ tag
> 2 votes

---
Tags: drupal, payment-processor, omnipay, swipehq
---


# Question
Title: Cannot properly configure PayPal Sandbox
I'm attempting to enable PayPal as a payment provider on our website and test some transactions, however I cannot get the PayPal sandbox to work. I configure the sandbox with the correct URL:

https://sandbox.paypal.com/

However, when I go back in to the payment process to verify the settings, it has always reverted back to the same as production:

https://www.paypal.com/

Why can't I get CiviCRM to keep the sandbox settings?

# Answer
I think you've found a bug. I just confirmed that if on 4.7.8 - you have - under Processor Details for Test Payments:

And then hit Save = you end up with \[for the very same Processor Details for Test Payments\]:

Go ahead and file this on JIRA: http://issues.civicrm.org \- not sure why those settings are not retained. They certainly used to be completely functional.

In the mean time I'd recommend run some Live Tests - with real easy to spot $ ($1.11, $2.22 etc).
> 2 votes

---
Tags: civicontribute, paypal
---


# Question
Title: Webform - autofilled fields using "Existing User"
I often use the "existing user" field in a Webform so that authenticated users don't have to re-enter info that we already have in CiviCRM.

This works well but I realized that collection fields that exist after a page break, meaning not in the same page as the "existing user" field, aren't populated and remain blank.

Am I missing something? Is there a way around this?

# Answer
I've run into something very similar previously - and here's how I solved it:

How can I (on page 2) show First Name of an Existing Contact - static (on page 1) without dragging it to page 2?
> 2 votes

---
Tags: webform-civicrm
---


title: time taken for smart group updating

text:
# Question
Title: time taken for smart group updating
How quickly should I expect my smart group to update?

I use smart groups to do calling from and data usually gets altered as a result of the call. However in order to get the the smart group contacts to update I have to clean the cache (or wait for the job to run).

Is this correct?

# Answer
there is also a link at civicrm/group?reset=1 where you can 'update smart group counts' which uses this path /civicrm/group?reset=1&update\_smart\_groups=1 so you could probably put a Menu item in with that destination if it is something that you need to do frequently.

There is also a setting at civicrm/admin/setting/search?reset=1 where you can reduce the "Smart group cache timeout" (The number of minutes to cache smart group contacts. We strongly recommend that this value be greater than zero, since a value of zero means no caching at all. If your contact data changes frequently, you should set this value to at least 5 minutes.)
> 1 votes

---
Tags: smartgroups
---


# Question
Title: How to detect/handle card failure from Payment Provider's callback URL
I have implemented a payment gateway for SwipeHQ's 1-off payment mechanism. It's similar to PayPal's mechanism in that there's an LPN that notifies CiviCRM of the success/failure of the transaction, and also a callback URL.

SwipeHQ adds a couple of URL parameters to the callback URL to notify of success/failure. These are in addition to the mechanisms in the LPN.

e.g. &user\_data=619%2C7%2C5a00dbadde859a90b262eb532f863d98%2C%2C%2C2%2C%2C&response\_message=INVALID%20CARD%20NUMBER&response\_code=14&result=declined

My issue is that the standard Thankyou page in Civi has no way of picking up this important info and using it to instruct the user to try again. The message there is "Thank you for your payment" or whatever is set up as the thank you message.

So what's the best/right way to handle this?

* is there a hook that could be used on the Thank you page to change the message?
* or might it be easiest to just override the Thank you php and tpl files in order to display appropriate messages? I'd rather that this could be integrated into the payment plugin rather than having to mess with overrides though.
* perhaps just some jQuery added to the page to do some dynamic HTML rewriting based on URL params?
* or as suggested in another question/answer, use the LPN trigger URL to give to the payment provider as the callback, and integrate the checking into that file. It would end with a redirect back to the thank you page on success.

The latter seems like a possibility, but may have some issues:

How would you handle HTML display in the case that it's not "success"? Just spit stuff out directly from the LPN? But this wouldn't have any other templating etc from the CMS. What other pages could be used to redirect to?

Thanks in advance for any advice.

# Answer
> 2 votes
I would -

* make the return page a CiviCRM IPN callback - `civicrm/payment/ipn/XX` (where XX is the database ID of the payment processor in use).
* from this IPN callback, which is a method in your processor, return a 302 to the Thanks page if the transaction "checks out", and the Unsuccessful page if not

Probably the best "reference" payment processors are NOT those in core, but those based on Omnipay.

* Hitting `civicrm/payment/ipn/XX` will land you in `CRM_Core_Payment::handleIPN()` which should in turn call your processor's `$processorInstance->$method();` determined via `CRM_Core_Payment::handlePaymentMethod()`.
* Eileen's Github probably has a few Omnipay based processors worth checking out.

---
Tags: joomla, payment-processor, developer, swipehq
---


# Question
Title: Why is the list of relationships presented when adding an additional role to a case different from those presented when configuring a case?
The list of relationships presented for selection when configuring a case type are B to A Relationships. The list available from which to add roles to cases contains A to B relationships. Is this correct? Why don't these lists present the same perspective of the relationship?

# Answer
> 1 votes
There is a JIRA issue CRM-16980 which is listed as fixed in 4.7.

---
Tags: civicase
---


# Question
Title: Civimail and Sendgrid limitations and scalability?
Is anyone using Civimail with Sendgrid on a large scale? We have successfully used Civimail for newsletters and it seems to work well. However, on the Sendgrid website they say the SMTP is limited to 100 messages per connection and 1000 recipients. Does his mean Civimail needs to be setup to run a maximum of 1000 emails per cron run? More information here sendgrid docs

Thanks!

# Answer
1,000 recipients max? I could see how just about any org will quickly run into that limit!

We end up using CiviSMTP: http://www.civismtp.com/drupal/

Or SparkPost: https://www.sparkpost.com

And that's just two examples - there are many other SMTP options.
> 1 votes

---
Tags: civimail, email, mailserver
---


title: Price Sets for different groups

text:
# Question
Title: Price Sets for different groups
I've installed the group based pricing extension and enabled it, however I can't seem to get it to kick in. The two extra fields that are supposed to show don't appear. I'm using 4.7.7 and Drupal. Has anyone managed to get this extension to work?

# Answer
Do you mean this extension: https://github.com/zengenuity/civicrm\_groupprice/blob/master/info.xml

It's info.xml says it's compatible w/ 4.4 - I think that explains why you're having difficulty to get it to work on a 4.7.x

If this functionality is very important to you - the general guideline is:

1. contact the author of the extension
2. check with them on possible plans for an upgrade of the extension to a newer civicrm version
3. and what kind of funding it may take to get it there
> 1 votes

---
Tags: extension, price-sets
---


title: Message templates "access denied"

text:
# Question
Title: Message templates "access denied"
I was trying to change the message template for the membership invoice, so I went to Administer - Communication - Message templates, but got the message "Access denied - you are not authorised to access this page". Anyone who knows what I can do and why access is denied?

Thank you.

# Answer
your username has not got permission to Edit message template

so please try to view - Drupal Access Control

```
Administer -> Users and permissions -> Permissions(access control)

```

where you will see the following role and try to enable for your user group

> CiviCRM: edit message templates

If you don't have permission then please ask your admin or login to admin user and enable for specific user group

refer to link https://book.civicrm.org/user/current/initial-set-up/permissions-and-access-control/

I guess this helps !!!
> 2 votes

---
Tags: civimember, message-templates, user
---


title: How many users in a network

text:
# Question
Title: How many users in a network
We are a non-profit transition movement in Norway. If we as ha "head office" sign up for a user license, will all our grasrootgroups (=neigbourhood) around in Norway be able to use the same license?

# Answer
First of all welcome to CiviCRM :)

As CiviCRM is published under the free GNU AGPL license there are no licensing costs and you do not even have to sign up. All your grasrootgroups can use your database or get their own copy /environment of CiviCRM (depending on your use case / requirements).
> 3 votes

---
Tags: civimember, evaluating-civicrm, install
---


# Question
Title: How to link to the CiviEvent registration page from a node field using entity reference
Scenario is the Content Type has an Entity Reference field set to use Target Type = CiviCRM Event. This currently gives me a radio set for the civievents to choose from.

My concern at this point is about how the field can be displayed. i would like it to provide a link to the registration page of civicrm - i set the Field Display to 'link label to entity reference' but am just getting the event id with no link

# Answer
> 2 votes
A more elegant approach would be to use field formatters, in a module, e.g. as below. The advantage with this would be that it works with multiple values and automatically disappears once the registration is closed. You could make it do other things when the registration closes also.

```
/**
 * Implements hook_field_formatter_info().
 */
function mymodule_field_formatter_info() {
  return array(
    'mymodule_civievent_id_register' => array(
      'label' => t('CiviEvent Registration Button'),
      'field types' => array('entityreference'),
    ),
  );
}

function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  switch ($display['type']) {
    case 'mymodule_civievent_id_register':
      civicrm_initialize( );
      foreach ($items as $delta => $item) {
        try{
          $event = civicrm_api3('Event', 'getsingle', array('id' => $item['target_id']));
        }
        catch (CiviCRM_API3_Exception $e) {
          // break;
        }
        if ( time() <= strtotime($event['registration_end_date']) ) {
          $element[$delta] = array(
            '#markup' => l('Register','civicrm/event/register',array(
              'attributes' => array('class' => array('button-like')),
              'query' => array('id' => $item['target_id'],'reset' => 1)
            )),
          );
        }
      }
      break;
  }

  return $element;
}

```

# Answer
> 1 votes
You mentioned that you are using a .tpl file for the event content type -- we've had to do the same on a site and had to massage this field to get what we wanted. The following code is (slightly modified but the basic idea) from the .tpl file specific to the event content type, for example:

```
if (isset($node->field_civicrm_event['und'][0]['target_id'])) {
   print "<div class='registration_button'><a href='/civicrm/event/register?id=".$node->field_civicrm_event['und'][0]['target_id']."&reset=1'>Register Now</a></div>";
   hide($content['field_civicrm_event']);
}

```

(Obviously you would need to adjust `$node->field_civicrm_event` to the actual name of the field in your instance.)

But I agree, the "link label to entity reference" field display could be fixed!

---
Tags: civievent, drupal, civicrm-entity
---


title: Troubleshoot webform contributions

text:
# Question
Title: Troubleshoot webform contributions
I have a webform, which was working, which collected contributions from users using authorize.net. At the end of the form, users would check the contribution amount, the total would show, and the pieces of the form collecting credit card information would appear. But now, the fields for the credit card info are not appearing and users cannot submit the form. They get the error "credit card information needed."

One possible solution is to upgrade to 4.7, which I can do tomorrow morning, but this was working before with our current configuration. Do you have any troubleshooting tips?

# Answer
> 3 votes
Don't update to 4.7! webform\_civicrm module is not compatible with 4.7 (yet).

CORRECTION: Looks like the main issue holding that up functionality w/ 4.7 got fixed last month: https://www.drupal.org/node/2661232

Give us some more details - perhaps a URL to the form - so that we can have a look.

Couple of things to check:

1. is the CiviCRM contribution page still working? Does it have the correct Payment Processor still attached? That's where webform\_civicrm gets the Payment fields from.
2. By default webform\_civicrm will put the $amount total and payment fields on the next page - I'm not 100% sure but I think that may be required for it to load the payment fields.
3. Having different pages (page breaks) in your webform makes for a nice form. I often go: Parents, Children, Waivers, Payment

Example:

---
Tags: civicontribute, webform-civicrm, contributions, authorize.net
---


# Question
Title: Possible to import Contacts and Activities at the same time?
Currently we are pulling multiple new contact lists from different sources daily. They have to be imported and assigned activities in order for staff to process them as necessary.

Our process now is to import the contacts without activities then exporting them to get the Contact ID then importing activities with the Contact ID that was assigned in the initial contact import. Is it possible to import new contacts with activities so that we can avoid the export and second import step?

I'm trying to save time and possibly automate this process. We have to do the whole import, export, import thing a few times as different groups and activities are specific to each source we pull from.

Any tips or tricks are greatly appreciated.

Thanks

# Answer
If you're doing this daily, it's better to automate and not rely on the GUI.

If you're automating, you can either a) write a PHP script to handle what you're doing, optionally using API chaining to handle the activities and contacts together; or b) use a dedicated ETL tool like Kettle. I have a client that daily imports contacts, activities, memberships and payments this way.
> 2 votes

# Answer
You can cut down one step by assigning the to be imported contacts an external ID; then also use that external ID to import the Activities.

Other than that - we end up writing mysql queries to import on an going basis from other data systems - once these queries work well they can then be bundled into an extension - so admin staff can initiate/run the import at will.
> 3 votes

# Answer
Third solution would be to use an ETL-tool like Pentaho Data Integration (aka Kettle) to transform the import data and load it into the CiviCRM database. But like with the PHP script, you need to know the CiviCRM database well enough to know where to stick the data
> 1 votes

---
Tags: contacts, import, activities, export, civicrm-entity
---


# Question
Title: How to display Contact Summary address in an Activity Form?
I would like to display the address fields found in the contact summary tab (I'm thinking this is the inline location) in the new activities screen. Would also like for the fields to be editable as well. The reason for wanting it to display in both locations is because users are reading off a script in the new activity. Address is the one of the pieces of information gathered/confirmed. Is this possible? All help appreciated. We prefer to have one location for the demographic information so it will be easier to use. We are using Drupal-7.41 and CiviCRM-4.6.6 Thanks for the help.

# Answer
> 1 votes
Like Jon G suggested a little more information would help a lot, I am now assuming I understand what you mean but I do not really :-)

Obviously it is possible to place the address on the activity form (I am assuming you mean the form of the activity when you click 'edit'/'view'? But you can not do this from the UI, you will need to do some customization.

My way would be to write a little extension and use the CiviCRM buildForm hook to add the address on the list of form variables, and add a little jQuery to the template (using `CRM_Core_Region::instance('page-body')->add(array('template' => 'yourtemplatewithjQuery.tpl')`. This answer assumes you are familiar with PHP and jQuery and with concepts like CiviCRM extensions and hooks. If you are not, the place to start would be the CiviCRM Documentation at http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Documentation.

ALternative would be to add jQuery to your own .tpl, retrieve the Contact Address with the CRM.api3 function and then display the address. Example of the CRM.api3:

```
CRM.api3('Contact', 'get', params).done(function(result) {
         <your function>
        })

```

---
Tags: activities, summaryfields, display
---


# Question
Title: CiviCRM Installer doesn't find language files
I am trying to install CiviCRM 4.7.8 on WordPress 4.5.2.

I uploaded the l10n and sql folder to the civicrm folder, but the installer only offers "English (United States)" as an option for "Language of basic data:" :-(

I spent many hours to get this working, without any success :-( Is it a bug of CiviCRM???

# Answer
> 1 votes
I got it! I forgot to upload "civicrm\_data.de\_DE.mysql". I only uploaded the "civicrm\_acl.de\_DE.mysql" to the sql folder.

---
Tags: wordpress, localisation
---


# Question
Title: How can I setup only contribution page in dual language
I want to setup only a contribution page in two languages: English and Spanish. However, civicrm default language should be English. User should be able to select their preferred language to see the contribution page.

Is this achievable, any help greatly appreciated.

# Answer
> 1 votes
This is doable. First. Is your website multilingual, have you got it for two languages? What CMS platform are you on?

---
Tags: contribution-page
---


# Question
Title: Why is a contribution given a financial type different from that allocated to the contribution page used?
I have a contribution page, utilising Paypal standard, set up to handle a membership renewal. The page has a 'renewal' financial type set for it. However, if I initiate a contribution using this page, the resulting contribution record shows as having a different financial type ('registration').

I've come across this because I'm trying to debug a situation where users are reporting that they have made a payment via Paypal (and have sent me the Paypal receipt to prove it), but no contribution record exists for this transaction. The Paypal receipt includes information that strongly suggests that CiviCRM is sending data to Paypal, but as no contribution record exists in the Civi database to link to the receipt, I can't be certain.

Clearly something is not as it should be. I'm using Civi 4.6.10 currently and about to update to latest 4.6.x

Is this a known issue? How can I begin to debug this?

# Answer
> 2 votes
I am answering the question posed in the title, not dealing with the problem of debugging the Paypal problem.

When you define a membership type you specify a financial type. That become the defualt financial type for that membership type. Unless you use price sets, the "default financial type for that membership type" will be recorded against the membership contribution no matter what you have chosen as the financial type for your contribution page. This is explained at the bottom of the help message that appears if you click on the ? associated with the Financial Type when you are setting up your contribution page.

> NOTE: If you are using this contribution page for membership signup and renewals, the financial type configured in the membership type settings will be used when recording the membership payment. The financial type selected here will only be used if you are also collecting additional contributions (as configured on the Membership Settings page).

If you need renewals to have a different financial type from new memberships (as we do) then you will need to use a price set for you renewal page specifying the renewal financial type at the line item level. You will also need to extract financial data at the line item level, not just at the contribution level.

---
Tags: civicontribute, contribution-page, financial-types
---


# Question
Title: Credit Card swiping from mobile devices for event registrations and contributions
Is there a solution to allow credit card swiping from mobile devices for event and contribution pages?

# Answer
> 3 votes
Yes there is! iATS Payments has an encrypted USB card reader that works with its CiviCRM iATS extension as well as a mobile phone card reader that works with their App.

For the mobile option: we're actively working on code required to be pushing them into your CiviCRM as well.

Organizations use it during checkout at fundraising events and in the office to swipe card / walk-ins.

---
Tags: civievent, civicontribute, payment-processor
---


title: Event Info Page error with Joomla

text:
# Question
Title: Event Info Page error with Joomla
we've just started using CiviCRM events. I've followed the process to get the event set up. I can test-drive the link and it works fine but if I go to the live online registration I get an error page that says I don't have permission to access the page. I've tried setting the public permission to allowed for "CiviEvent: register for events" to Allowed but it doesn't save when I change the permission. Any ideas where i need to look for the error. I'm using CiviCRM 4.7.7 and Joomla! 3.5.1 Thanks Emma

# Answer
> 0 votes
This is an ACL issue. If users can login, then register it is simpler. If you are allowing anonymous users then you have a tiny bit of configuration to do to enable anonymous users. Have to race out to a client for the day, i can send you info tonight with some screen captures, but also maybe you can look up the instructions in the manuals, it works quite nicely when configured. CiviCRM » Administer CiviCRM » Access Control

For more reference please give a read https://book.civicrm.org/user/current/initial-set-up/permissions-and-access-control/

Also can you just double check that you have the event checked off as a "public event".

---
Tags: civievent, joomla, permissions
---


title: How do I hire a good CiviCRM user?

text:
# Question
Title: How do I hire a good CiviCRM user?
Looking for someone who will use CiviCRM day-to-day (as opposed to a CiviCRM *developer* or *consultant*), how do I maximize the chance that they'll succeed in their job and in using CiviCRM?

# Answer
Even as CiviCRM is a key tool for many roles at an organization, it's often an afterthought in choosing the best person for the job. Selecting someone who knows CiviCRM will certainly help, but it's also good to hire someone with the capacity to learn the way *your organization* applies CiviCRM to its work.

Stuart Gaston did a fabulous session at the 2014 CiviCRM User Summit called Hiring and Training for Success. He highlighted ways to think about individuals' patterns when they encounter technical problems and interview questions (like *"What is your favorite Excel trick?"*) that help in highlighting those. Even just reading the slides is a good place to start thinking.

It's good to list CiviCRM as an element of the job and a bit of experience that would be valued, but you probably don't need to make CiviCRM experience an absolute requirement.

However, you can maximize your chances at finding experienced CiviCRM users by posting on CiviCareers, the CiviCRM job board. Posting is free, and you'll maximize the chances of finding someone who can quickly understand your CRM and maybe even share tips from past work.

*(Full disclosure: my coworkers and I started CiviCareers after a series of conversations at DC CiviCRM meetups where people laid off from a local organization were looking for jobs where they could apply their CiviCRM experience. It isn't a commercial venture--it's free and always will be--but it does mention that it's hosted by AGH Strategies.)*
> 6 votes

---
Tags: user, training
---


title: Remote Database Connection

text:
# Question
Title: Remote Database Connection
I apologize if I am asking this in the wrong place, but I've hit something I cannot figure out..

I have remote drupal and civicrm databases that I want to use for multiple developers. My question concerns the civicrm.settings.php file. I can successfully connect to the remote drupal (CMS) database using the settings.php config, but my civicrm settings do not seem to be pinging the server db at all. This code (no matter which credentials/IP/DB I try) is not doing what I think it should be doing...

`define( 'CIVICRM_DSN' , 'mysql://civicrm:YOUR_PASSWORD@localhost/civicrm?new_link=true');`

The error:

Initialization Error

Array ( \[callback\] =\> Array ( \[0\] =\> CRM\_Core\_Error \[1\] =\> simpleHandler )

```
[code] => -26
[message] => DB Error: insufficient permissions
[mode] => 16
[debug_info] =>  [nativecode=1044 ** Access denied for user 'db_user'@'12.12.12.12' to database 'db']
[type] => DB_Error
[user_info] =>  [nativecode=1044 ** Access denied for user 'db_user'@'12.12.12.12' to database 'db']
[to_string] => [db_error: message="DB Error: insufficient permissions" code=-26 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info=" [nativecode=1044 ** Access denied for user 'db_user'@'12.12.12.12' to database 'db']"]

```

)

The error duplicates, which I find puzzling. Mainly, I am wondering if there is an example of somebody doing such a thing as remote setup with CiviCRM db.

# Answer
"Access denied" is indicating an authentication problem somewhere, either because of a bad user name or password, or a MySQL host restriction.

Try testing the MySQL connection from the command line:

```
mysql -h hostname -u username -p database

```

You'll be prompted for the password.
> 1 votes

---
Tags: drupal, database, mysql, civicrm.settings.php
---


# Question
Title: How can I export/import contribution pages and event pages from one site to another
I want to export contribution and event pages from one Drupal7 site to another Drupal7 site.

Is this doable, any help greatly appreciated.

# Answer
> 1 votes
It should be possible (but I've not tried it ...) using the API for Event and ContributionPage: `civicrm_api3('Event', 'get', ...)` to get them from one system and `civicrm_api3('Event', 'create', ...)` on the other.

Take a look at the API explorer on your system (Support \>\> Developer \>\> API explorer).

Unless you have loads of them, it might be just as quick doing it manually!

# Answer
> 1 votes
It sort of depends on what you mean by eg 'event page'; do you mean also taking over all the information to create the location, the price set, the Profiles etc, or actually just the info in a row of civicrm\_event.

If the latter then you can check what you can grab and insert via sql (eg if you have something like Sequel Pro, you can click on a row in the table, the right click and "Copy as SQL insert" and then at the other end, just paste as a query.

---
Tags: civievent, drupal, import, contribution-page, export
---


title: How to do a Mail Merge

text:
# Question
Title: How to do a Mail Merge
How do I start a mail merge? I would like to mail a letter to multiple contacts. Not an email, but an actual letter to receive in the mail. Can you please provide step by step instructions.

Thank you, Becky

# Answer
You can add tokens and produce a PDF from that as a printable item. You will find some instructions about this in the manual's postal communication page (thanks to Allen for improving answer)
> 2 votes

---
Tags: civimail
---


# Question
Title: Payment Processor Error 9003, and logging
I have the same issue that this person did, though I'm updated to 4.6.10 The issue is that when submitting payments, I get the 9003 error code, which says "MD5 Verification failed." I've reset the MD5 code from both sides, and am confident that they match. It's possible that my issue could be solved with the answer that I linked, but I don't know enough to apply it. It's also possible that Authorize.net tech support could help me, but they won't do anything without the log and I'm unsure where it lives. So...

1) Do you know how to fix this error?

Or failing that,

2) Where are CiviCRM's payment processor logs?

# Answer
> 2 votes
Answering (2) only here.

CiviCRM's payment processor logs vary in their location based on the CMS in use. These logfiles include a unique string per site, as the logfiles are located within the webroot and a hard to guess filename offers some defense against attackers viewing debug output.

This is documented @ -

## WordPress

4.6 and below: `wp-content/plugins/files/civicrm/ConfigAndLog/CiviCRM.HARDTOGUESS.log` 4.7 and above: `wp-content/uploads/civicrm/ConfigAndLog/CiviCRM.HARDTOGUESS.log`

## Joomla

`media/com_civicrm/ConfigAndLog/CiviCRM.HARDTOGUESS.log` () or `media/civicrm/ConfigAndLog/CiviCRM.HARDTOGUESS.log` ()

## Drupal

`sites/<sitedir>/files/civicrm/ConfigAndLog/CiviCRM.HARDTOGUESS.log`

---
Tags: payment-processor, error, authorize.net, logging
---


# Question
Title: How to successfully install CiviCRM w/Wordpress on WPEngine hosting
I've seen other questions indicating CiviCRM will not install properly on WPEngine, at least not without some extra work, such as: Install problem civicrm with wordpress

The installer says it was successful, but no menu appears and no links work.

I haven't been able to find out what exactly needs to be done to make it work, in case anyone knows. It appears perhaps WPEngine changes where files are placed or permissions or something like that. They are very restrictive and will often delete plugins without asking us. (I do actually have a lot of years experience with web applications including Wordpress & Drupal, but in this case my hands are tied due to IT)

I just would like to know so that I can relay this info to my IT department which controls all access and communication with WPEngine (and picked them for all Wordpress hosting). Thanks for any help with this.

# Answer
> 2 votes
The shortest answer I have is :

The issue is the way WP Engine builds the user directory structure. We have a proposed patch in : https://github.com/civicrm/civicrm-core/pull/8494

Until that is merged, you can use the answer listed here: Word Press Install Missing civicrm.settings.php; dashboard unavailable; no menus

Make sure the `global $civicrm_setting;` precedes `$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = 'http://example.com/example-resource-url/';`

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


title: What do these iATS - SOAP errors mean?

text:
# Question
Title: What do these iATS - SOAP errors mean?
We are a new iATS client and have hit a bit of a roadblock.

I followed the iATS extension instructions here for setting up the payment processor. On my local dev environment, things went great and I was able to process a contribution using the TEST88 information without a problem.

When I tried to set up the iATS payment processor on our live production server and tried a contribution in the same manner, I received a white screen with the following error:

> Fatal error: Call to a member function \__getLastResponseHeaders() on a non-object in /~oursite.org~/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php on line 202

Following the debug advice from the iATS instructions (I turned on Drupal/CiviCRM logging) and tried again. I received the same white screen and error. I checked the Drupal logs and received the following error, notice and warnings:

> **Type: civicrm\_iatspayment\_com** SoapFault: SoapFault Object ( \[message:protected\] =\> SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://www.iatspayments.com/NetGate/ProcessLinkv2.asmx?WSDL' : failed to load external entity "https://www.iatspayments.com/NetGate/ProcessLinkv2.asmx?WSDL" \[the error in the logs is rather long and shows sensitive information, so I've truncated it\]
>
> **Type: php** -- Notice: Undefined variable: soapClient in iATS\_Service\_Request-\>request() (line 202 of /~oursite.org~/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php).
>
> **Type: php** -- Warning: SoapClient::SoapClient(https://www.iatspayments.com/NetGate/ProcessLinkv2.asmx?WSDL): failed to open stream: operation failed in iATS\_Service\_Request-\>request() (line 161 of /~oursite.org~/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php).
>
> **Type: php** -- Warning: SoapClient::SoapClient(): Failed to enable crypto in iATS\_Service\_Request-\>request() (line 161 of /~oursite.org~/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php).
>
> **Type: php** -- Warning: SoapClient::SoapClient(): SSL operation failed with code 1. OpenSSL Error messages: error:14077410:SSL routines:SSL23\_GET\_SERVER\_HELLO:sslv3 alert handshake failure in iATS\_Service\_Request-\>request() (line 161 of /~oursite.org~/sites/default/files/civicrm/extensions/com.iatspayments.civicrm/CRM/iATS/iATSService.php).

Searching Google for "SOAP-ERROR: Parsing WSDL" related to iATS and CiviCRM, I found this comment and this GitHub issue by Joe Murray indicating that the issue could be related to inadequate SSL Protocols. This announcement from iATS also seemed to indicate that.

I've taken the last two days to upgrade our OpenSSL to 1.0.2g and adjusted our SSL Protocols to only accept TLSv1.2. The SSL Labs SSL Server Test had initially rated us at a C, but after upgrading OpenSSL and the SSL Protocols, we now rate at an A-.

Having updated our security settings, I cleared caches in both CiviCRM and Drupal and attempted our test contribution again, using the TEST88 information. We still receive the same white screen error in the browser and the above error, notice and warnings in the Drupal logs. I also tried using our actual account information with iATS. Same result.

**Any ideas on what to try next?**

iATS extension 1.5, CiviCRM 4.6.14, Drupal 7, Apache 2.2.24, OpenSSL 1.0.2g

# Answer
> 1 votes
Turns out the issue was our server's operating system. **We were on CentOS 5.5, and it doesn't support OpenSSL higher than 0.9.8. We had to upgrade to a new server.** We decided on a CentOS 7 server and are in the process of migrating. The CentOS 7 server came with OpenSSL 1.0.2 installed. I setup and tested our connection with iATS today and had it working in no time at all. Hooray!

While I had manually updated OpenSSL, I neglected to update it with our server's package manager (and our website would only recognize what the package manager was using). But it turns out with CentOS 5.5, the `yum` package manager only goes up to 0.9.8e. There was no way around it.

There are so many benefits to CentOS 7 over 5.5, even with all the migration work, I'm glad we made the change.

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


# Question
Title: Has version 4.7 introduced an Activity Date filter problem with activity reports?
Since upgrading to 4.7 we have had the following problem:

Created a new Activity (contacts) report with \- the Activity Date filter set to This week \- the Navigation Menu Link To set to View Results

When running the report from the navigation menu the report is displayed without any filtering on Activity Date - the Activity Date filter has been reset to empty.

If I:

1. Set the (emptied) Activity Date filter to This week
2. Change the Navigation Menu Link To to Show Criteria
3. Click the Update Report button to save the changes
4. Re-run the report from the navigation menu

The report is not run, as expected, but the Activity Filter now remains set to This week. Clicking on the Preview Report button now produces the report I was expecting.

To see the problem on the demo site (while the Joomla demo site is still on 4.6):

4.6

4.7

# Answer
This seems to be a bug with the update report, preview report works as expected. See guideline on bug reporting https://civicrm.org/bug-reporting
> 1 votes

---
Tags: civireport
---


# Question
Title: Registering for Event without Email Validation
How do I allow people to register without verifying their email address. CiviCRM seems to give 'permission denied' and even 'you don't have permission to view this event' until the email address is validated.

The setup is:

* LoginToboggan is used to enable the user to set a password.
* Immediate login is used.
* The user is given a 'registered' role.
* User signs up and receives 'you do not have permission to view this event'.
* Follows the email validation process and then can view the event.

An anonymous user can 'view the event'.

I want people to register for the event immediately as many people don't see their email and going offline means a lot forget where they are at.

# Answer
I set the LoginToboggan non-verified role to 'authenticated user'.

It is possible to set a permission for an 'authenticated user' but not a user with a specific role.
> 1 votes

---
Tags: permissions
---


# Question
Title: Is this the desired/typical setup for directories after 4.7?
After an upgrade from 4.6 to 4.7, I see this. While it advertises 'variables' in the top right, they aren't used in the boxes below, and any other hardcoded path has been stripped out. The files seem to be working, is this correct?

# Answer
Yes it appears to simply be using $civicrm\_root (from the civicrm.settings.php) to look for these dirs! So as long as you have them in the usual places - this will work.

If you have a dir in a slightly different place or if you give it a different name - then you have to continue to be more specific \[either specify exact path or construct it with the path variables\]. I must do that for our projects for which we typically name and put the /extensions dir in a different place.
> 1 votes

---
Tags: upgrade, 4.7, directory
---


# Question
Title: Initialization Error after restoring a Wordpress site from backup
This morning, a plugin update broke the website, so we did a restore from a backup from the previous day. CiviCRM was working properly at the time, but now when we try to access it, we get the following error:

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

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] => SELECT *,  config_backend, locales, locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]
    [type] => DB_Error
    [user_info] => SELECT *,  config_backend, locales, locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info="SELECT *,  config_backend, locales, locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1146 ** Table 'frenchf_crm.civicrm_domain' doesn't exist]"]
)

```

Any idea on what this means and how we can go about fixing it? Thanks.

# Answer
> 1 votes
As you can probably tell, CiviCRM is looking for a table that doesn't exist (at least where it's looking). Given your context, there are a few possibilities for why.

CiviCRM creates a bunch of tables that are independent of WordPress and about which WordPress has no knowledge. They may be in the same database as WordPress, or they may be in a separate database. The connection to the database is stored in wp-content/plugins/civicrm/civicrm.settings.php. There, you'll see two lines of database information: "CIVICRM\_UF\_DSN" for the WordPress database connection, and "CIVICRM\_DSN" for the CiviCRM database connection.

So, the possible situations:

1. You have separate databases, and you have been only backing up the WordPress database. You'll see this if your database connections in civicrm.settings.php differ from each other. The good news is that if this is the case, you might be able to find the old CiviCRM database sitting around somewhere, and it would probably be unaffected from a bad plugin.
2. You were only backing up the WordPress tables. Even if CiviCRM is in the same database as WordPress, if you're using a WordPress tool for backup, it might decide to only handle certain tables. If this is the case, you may be out of luck unless you still have the pre-restore database around.
3. You failed to update civicrm.settings.php after restoring the site. If you had Database A running the site, and you restored the backup to Database B, you'd need to update wp-config.php *and* wp-content/plugins/civicrm/civicrm.settings.php. If you neglected to do the latter, and you got rid of your old database, you'd see this. Likewise, if you simply changed the password on the database user and forgot to update civicrm.settings.php, you'd have this sort of problem.

# Answer
> 0 votes
One of the reason for the following Error:

you get this error if you have restored your latest civicrm database (eg.4.7.8) and you are still having your old civicrm Core (eg: 4.6)

so just replace your Civicrm Core files to the latest one should fix the issue

---
Tags: wordpress, database, backups
---


title: Import to Custom Field with Tab setting

text:
# Question
Title: Import to Custom Field with Tab setting
I created a custom field with a Tab setting, but when I go to Import the custom field is not visible as an option for importing. Custom fields that are inline are visible. Is this a limitation or a bug or something unique to my set-up?

# Answer
> 1 votes
Please check you have set your Fields to be Searchable. I think that if they are not Searchable, then they also do not show on Import. There is no difference, in terms of importing, between a Group of Fields that is set to Inline v one that is set to Tab.

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


# Question
Title: Storing Personally Identifiable Information
Is anyone storing Personally Identifiable Information (PII), such as Social Security Numbers (SSN), in their database? How would I encrypt such a field in the database? I'm expecting that it would be a custom field that is part of a Custom Data Set attached to a contact. However, I've not seen a way to simply encrypt the stored data in the database.

Encrypting the whole database wouldn't be a bad idea, and any ideas about that would be great too, but it seems like these types of fields need their own key sets in addition to anything else.

Yes, I'm aware of CiviHR, but having a completely separate install and database means a lot more complexity than seems feasible.

# Answer
We're in Canada - but no we don't store SINs for any of our projects. We don't store Credit Card numbers (PCI compliance dictates that) - and one could argue that having your SIN/SSN stolen is far more serious than having your Credit Card stolen. Storing SSNs would substantially increase the risk that a breach would be considered a major privacy breach.
> 2 votes

# Answer
Hitting the right keywords is always fun. Here's a partial answer, from the how-to side of the question. Is there a way to encrypt a single field in Civi database?
> 2 votes

# Answer
Encryption is fascinating, but when you think it through, it's often not as attractive as you might want. Basically - you've got two kinds of encryption:

1. symmetric encryption - a robust and fast encryption, but to be done programmatically requires the use of some key that must be stored on the machine in the first place - meaning if you have full access to the machine then you've really only got security by obscurity. But that might be all you want anyway.
2. assymetric encryption - this is was ssl is all about, i.e the ability to have a secure conversation with someone with whom you don't have apriori a shared secret key with. But this isn't going to help either unless you're encrypting things programatically that don't need to be unencrypted programatically. If you want to basically receive secrets that can only be unencrypted off line, or with a manually entered secret key, then this would be cool.

I think your conclusion (roll your own using the Civi-supplied Crypt object) is probably the right answer.
> 2 votes

---
Tags: wordpress, custom-fields, database, mysql, security
---


# Question
Title: How can I create a smart group with no matching contacts?
Is there a way via the UI to create a smart group with no matching contacts in the database? For example, our database does not currently have any contacts where the city is "Cottonwood," but I'd like to create a smart group for Cottonwood residents now so when someone with a Cottonwood address is added, they're automatically added to that group.

Thanks in advance.

# Answer
> 8 votes
The easiest way would be to create a test contact with city Cottonwood, search on it. Create a smart search out of it and then delete the test contact.

---
Tags: contacts, groups, smartgroups
---


# Question
Title: Contact individual Summary Print page Image not showing
When in the contact individual summary page i have an image that i upload and it shows. When i go to the action button and use print summary. On the print page the image does not show up.

I tried adding this to /sites/all/modules/civicrm/templates/CRM/Contact/Form/Taskprint.tpl

```
{if !empty($imageURL)}
            <div id="crm-contact-thumbnail">
{/if}

```

it does not load the image. does anyone know how to make the image load in the print summary page ?

I am using drupal and civicrm 4.6.16

**EDIT**

I still have not gotten this to work. I have try to add this to the Taskprint.tpl

```
<div class="crm-contact_image crm-contact_image-block">
  <a href="{$imageURL}" class='crm-image-popup'>
    <img src="{$imageURL}" height={$imageThumbHeight} width={$imageThumbWidth}>
  </a>
</div>

```

**Edit 2**

Thank you so much. `Print.tpl` was the correct file and i was able to figure out my problem with the image now i was looking in the right place. I had to add this code to the `summary.tpl` for it to load.

```
<div class="contactCardRight">
              {crmRegion name="contact-basic-info-right"}
              {if !empty($imageURL)}
                <div id="crm-contact-thumbnail">
                  {include file="CRM/Contact/Page/ContactImage.tpl"}
                </div>
              {/if}
                </div>
              {/crmRegion}
            </div>
            <!-- end of right side -->

```

Thanks

# Answer
I don't think you're looking at the right template. When I press Print Summary, that's not the template that loads.

You can check which template is in use by pressing "Ctrl-U" to View HTML Source, then searching for ".tpl". When I do that, I see `templates/CRM/Contact/Page/View/Print.tpl` instead.

Above the `{literal}` tag, I added the `{debug}` tag and reloaded the page in my browser. This brought up a Smarty debug window; I confirmed that `$imageURL` is indeed available to this template (otherwise we'd need to add it in the corresponding PHP file).

So hopefully this is enough info to get you where you need! Update your question if not.
> 1 votes

---
Tags: templates
---


# Question
Title: REST API and ACLs - should the API return contacts made accessible via an ACL?
My REST API call returns data fine as long as the user has 'view all contacts' permission. But if I turn that off and instead grant the user access to a particular group via an ACL, I get nothing. I've confirmed that the user can see the relevant data through the UI.

*Should* that work? Or are ACLs not taken into account by the REST API?

Using WordPress and Civi 4.5.8.

Update 1: this issue on the forum suggests it might not be WordPress specific.

Update 2: Just to clarify exactly what I'm doing, here's the relevant part of the URL:

/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&action=get&api\_key=xxx&key=xxx

I can get the data I want by using the API key of an admin, or if a non-admin has 'View all contacts' permission. But I get no results if the non-admin lacks this permission and only has access via an ACL. (If I change the API key I get an authentication error, so I'm confident that's correct.)

# Answer
> 2 votes
When the Contact Get REST api is triggered, I can see that the permission clause for the ACL is being generated from the `whereClause()` funcion of `CRM_ACL_API`. Here a `contactId`(previously passed as NULL) is fetched from the session (logged in user id) and the contact from `api_key` is **actually** not taken into account. Hence a 0 is set for `ContactId` and ACL permissions are not respected.

# Answer
> 0 votes
I tested this locally & it worked fine - but looking at the wordpress code the signature of the loadBootStrap function does not match the signature of drupal (which works).

I expect it's not responding correctly to

```
  CRM_Utils_System::loadBootStrap(array('uid' => $uid), TRUE, FALSE);

```

Since

return $config-\>userSystem-\>loadBootStrap($params, $loadUser, $throwError, $realPath);

passes in an array but WP seems to be unable to cope with that

---
Tags: api, rest
---


# Question
Title: When upgrading from 4.7.7 to 4.7.8 I get error "Specified key was too long"
I tried to upgrade my Joomla CiviCRM 4.7.7 to 4.7.8 and got the following error in the database upgrade:

```
ALTER TABLE `civicrm_contact` CHANGE `image_URL` `image_URL` VARCHAR(512)
CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL
COMMENT 'optional URL for preferred image (photo, logo, etc.) to display for this contact.'
[nativecode=1071 ** Specified key was too long; max key length is 767 bytes]

```

This old MySQL bug tells part of the story, I think. I run MySQL 5.6.24 so the limit should be higher, but when I try to do the ALTER TABLE directly I get the same error.

The statement seems to lengthen the `image_URL` column from 255 to 512 VARCHAR in UTF8. Turns out I can not even lengthen it to 256...

Is there some setting on the database that limits the key length 'globally' that I could have inherited from earlier (site has been up and upgraded for 5 years) versions?

Fortunately I did this on a restored backup, as I do with all upgrades before applying them on the live site. But this is a MacOSX and the live site an Ubuntu 15.10 so there might be some differences there too...

UPDATE: Here's a blog post indicating that `innodb_large_prefix` can be used to fix this. And it might be default from MySQL 5.7.

Question is just how to do that. Can I change my existing MySQL to run with `innodb_large_prefix` and then do the upgrade? Will a change in the MySQL setting interfere with my existing data or other tables/databases on the same MySQL server?

# Answer
> 1 votes
This issue is CRM-18983: DB error on upgrade to 4.7.8. I ran into it on OSX also while testing an upgrade.

There is a PR at https://github.com/civicrm/civicrm-core/pull/8605 currently which addresses this by reducing the size of the key before increasing the column size. Not all sites will have the option of reconfiguring MySQL server settings to accommodate the DB change in 4.7.8, so it makes sense to me that we do this in the schema.

Applying the patch before running the upgrade works for me - please post feedback on the JIRA issue or PR if you find it helps.

# Answer
> 0 votes
You can modify the innodb\_large\_prefix value several ways (http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar\_innodb\_large\_prefix). I'd recommend changing your my.cnf file that contains the startup configuration and parameters, then restarting mysql on your system. Exactly how to do that varies by your OS version, one typical approach is to do it through a control panel, one we use on Debian is

```
$ sudo /etc/init.d/mysql restart

```

Once you have the MySQL daemon running with this setting, it will be able to run the ALTER TABLE query successfully. Your CiviCRM system will run fine with your existing data.

---
Tags: upgrade, database
---


# Question
Title: What would cause civicrm_invoke to submit a large number of server requests?
Earlier today, the civicrm\_invoke process submitted a large number of requests to our server – so many requests that it took our site down. An agent at our host (Pantheon) had to restart our application instance to get our site back on-line.

My goal is to prevent this from happening again. To do that, I need to better understand why this happened, so I'm turning to y'all for some guidance:

* What is civicrm\_invoke?
* What causes it to instantiate?
* If there are obvious possible causes for a (seemingly) spontaneous "burst" of civicrm\_invoke requests, what are they?

We're on a virtual server on Pantheon, running CiviCRM 4.7.8, Drupal 7.44, PHP 5.5.24. Our database is: 5.5.5-10.0.23-MariaDB-log. No extensions are installed. Cron has not run since April 18th (Yes, that's a problem. No, I don't know how I managed to get it to run in April. If anyone can point me at a way to manually force Civi's Cron to run, that'd be keen.).

Thanks!

# Answer
It isn't a process it's a function in the drupal module. It mostly gets called when a web request comes in. Check your apache logs for a large number of requests, maybe your site was hit by a botnet. At least the logs would tell you IPs.
> 1 votes

---
Tags: error
---


# Question
Title: Show validation errors on custom elements added using hooks
I added a text element to a `New Event` page using *buildForm* hook.

```
function mymodule_civicrm_buildForm($formName, &$form) {
 if ('CRM_Event_Form_ManageEvent_EventInfo' == $formName) {
    $form->add('text', 'custom_element', ts('Custom Element Label));
    CRM_Core_Region::instance('page-body')->add(array(
     'template' => 'CustomElement.tpl',
    ));
  }
}

```

And I added a validation code using *validateForm* hook which looks like this:

```
function mymodule_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) {
  if ('CRM_Event_Form_ManageEvent_EventInfo' == $formName) {
    if ( validation condition fails )
      $form->_errors['custom_element'] = 'Validation message';
    }
  }
}

```

But when validation fails, let alone error, the text element is not shown at all. How do I get it to show both the element and the error on the element?

# Answer
It should be something like below

```
function mymodule_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) {
  if ('CRM_Event_Form_ManageEvent_EventInfo' == $formName) {
    if ( validation condition fails )
      $errors['custom_element'] = ts('Validation message');
    }
  }
}

```

HTH
> 2 votes

# Answer
Did you know that in your buildform hook - you can add a $form-\>addRule:

two real-life examples:

```
$form->addRule('bank_account_number', ts('%1 must contain only digits.', array(1 => ts('Bank Account Number'))), 'numeric');
$form->addRule('encrypted_credit_card_number', ts('%1 is a required field.', array(1 => ts('Encrypted'))), 'required');

```
> 1 votes

---
Tags: hooks, validation
---


# Question
Title: Two domains, one site how to manage civicontribute?
Civicontribute post-transaction response page always reverts to primary domain. How can I force it to stick with the original domain?

# Answer
This page: https://wiki.civicrm.org/confluence/display/CRMDOC/Multi+Site+Installation

Plus Domain Access Module (Drupal) got me 90% of the way there - however no matter what I try, contribution pages and event pages auto-generate their page links with the primary domain.
> 0 votes

---
Tags: civicontribute, multisite
---


# Question
Title: How to add the Recent Items stack (block)
I just watched a youtube tutorial on how the basics of CiviCRM. The video showed a recent items list on the left of the page. My CiviCRM does not have that. Is there any way I can add it? It would be extremely helpful.

Thanks, Becky

# Answer
> 3 votes
You didn't mention which CMS you are using, and this is CMS-dependent feature. In Drupal, for example, you would select from the menu Structure | Blocks and then find the item labeled "CiviCRM Recent Items" and select "Sidebar First" for its region for the theme that you are using for CiviCRM (which can be different for admins, and there is a setting at bottom of /admin/appearance to set that).

# Answer
> 0 votes
Probably a theme issue. Not all themes display that block. I'd recommend Garland.

---
Tags: dashboard
---


title: Mailings - Disabled Next/Test Buttons

text:
# Question
Title: Mailings - Disabled Next/Test Buttons
New mailings with all required fields and the default responsive template do not enable the Next or Test mailing buttons. As a workaround I can reuse an old mailing and update the fields. The last successful mailing was sent using 4.6.2, the current installed version of CiviCRM is 4.6.3.

Drupal 7.38

# Answer
I found the solution in another question. Go to Administer \> CiviMail \> Headers & Footers. Edit the auto-responder, set default to yes. The Next and Test buttons in new mailings should now be enabled.
> 2 votes

# Answer
Unfortunately, my last post affirming that the problem is real and still present in the current version was deleted because the moderator thought it would be better as a 'comment' without realizing that commenting is disabled for most users. I'm not yet certain of the cause but there are a few fields in the civicrm\_mailing table. In particular, the reply\_id field (and a few other suspects) look like they may not be getting updated properly. Nicholai, I'd have been happy to post this as a comment if you would be kind enough to enable commenting for individual's with a reputation of less than 50.
> 2 votes

# Answer
Since one of the above comments confirms that it works fine on demo instance, I think a possible solution will be to upgrade to latest **4.6.x** version. ( *if upgrade is possible* )
> 1 votes

# Answer
Just found another possible reason whereby no warnings are given. A user has created a template, and created a txt only template too. The footer had unsub in, neither of the above had opt out. I added opt-out to HTML but of course Plain Text was not expanded so i didn't know it was even in use!! And so setting the token in there fixed it. but at no point of the OptOut button being missing from either did i get a warning, until i saved, closed, continued and bingo Plain Text was expanded and showed the warning

I found a couple more situations that the greyed out button can appear which may be less than obvious

* if there is no Resubscribe Msg set on the Response tab (no alert is currently provided
* if you put in a Subject, but then decide to switch to using a Template the Subject gets changed to the Subject of the Template, so if the Template does not have one you may get surprised
> 0 votes

---
Tags: civimail, upgrade
---


# Question
Title: How can I find the CiviCRM Admin API key from Wordpress CiviCRM plugin
We have got a wordpress website using CiviCRM plugin. The only thing which we have is the CiviCRM site key, but in order to implement the functionality on the website we need CiviCRM API Key.

Can you or anyone please advise from where can we get those details?

Urgent help would be much appreciated.

Thanks

# Answer
you can find API key against each contact record in the Database

select api\_key from civicrm\_contact where id = \<\>

Also please read the below link for more reference https://civicrm.org/extensions/api-key

I guess this helps !!!
> 3 votes

---
Tags: api
---


# Question
Title: How to set API ContactType parent_id NULL or how to rename label?
Attempting to write prototype initialisation code I want to rename a ContactType using the API action "create". I tried to set:

* array ('parent\_id' =\> 0)
* array ('parent\_id' =\> '')

But both error out with "Mandatory key(s) missing from params array: parent\_id". I cannot set array('parent\_id' =\> NULL), because it would be like unsetting 'parent\_id' which according to the error message cannot be missing. So the question is how do you set it NULL or how do you rename the label of a ContactType using the API?

Edited: Then I discovered that apparently you need the ID of the ContactType when you want to update with 'create', following the instruction that the API explorer gives me when I choose 'update':

> The "update" action is deprecated. Use "create" with an id instead.

So I added id as parameter and kept trying ways to set 'parent\_id' correctly to NULL. I discovered that array('parent\_id' =\> '0') is the likely way to do that, because it returned a different error message: "already exists". Well yes, I knew that. My intention was to update the label with 'create" according apparently a wrong instruction. Or is this a bug?

# Answer
Rename ContactType label

```
$result = civicrm_api3('ContactType', 'create', array(
  'sequential' => 1,
  'id' => 1,
  'label' => "test",
));

```

This example will rename ContactType Label

I guess this helps !!!!
> 1 votes

---
Tags: api, contact-types
---


# Question
Title: specific confirmation email for an event?
I would like to send an particular email confirmation for certain events. Is it possible to select a particular model for these events, or must absolutely change the existing model?

# Answer
Two options!

Use the text in the Event Config -\> Online Registration -\> Confirmation Email -\> this is Event specific and this text/note will be pasted ahead of the receipt Email - so ahead of what is generated by the message template.

Or - if you want to go into more detail:

You can get into the message-template and add some if logic - that would essentially change the message based on {$event.event\_xxx}
> 4 votes

# Answer
Another option would be to use the fantastic CiviRules and E-mail API extensions (developed by CiviCoop), see links for more info.

After installing and enabling both extensions, create a new rule like this:

**Trigger**: Event Participant is added or Event Participant is changed, this will vary depending on your registration workflow, ie if you use the Participant Approval feature

**Condition**: Field value comparison

Comparison criteria:

* Entity: Participant
* Field: Event
* Operator: is equal to (for a specific event)
* Compare value: 123 (Event Id)

**Action**: Send e-mail, select your Message template and you're done

If you use the Participant Approval feature you could add a second Field value comparison condition to check for Participant status.
> 2 votes

# Answer
Well there is only one message template for event confirmation following a online registration. So if you change it, it will apply on every event unless you add some smarty code in it.

Another method is to disable the confirmation email for this event and use schedule reminders instead.

* administer -\> communication -\> schedule reminder
* entity =\> Activity - Event registration - Completed
* create a schedule reminder that start 0 hour after Activity Date Time
* don't forget to enable cron job : Administer -\> System settings -\> Schedule Jobs and set `Send Scheduled Reminders` to `every time cron job run`

As it is an automatic process, i recommend to do some tests before activate it widely.

**EDIT** This will not work because you can't specify which event will trigger the reminder.
> 1 votes

---
Tags: civievent, message-templates
---