# Question
Title: Manually adjusting a contribution in the database
I need to manually change a one-time Failed contribution in the database to a Completed contribution. (See How do I change an incorrect contribution status to Completed? for context). What tables and fields in the database do I need to adjust in order to make the change successfully?

Drupal 7, Civi 4.6

# Answer
> 2 votes
In Civi 4.6, when a contribution is made, an entry is recorded in the following three database tables: **civicrm\_contribution**, **civicrm\_financial\_item**, and **civicrm\_line\_item**. If a contribution is marked as Failed, other entries in other tables do not get made (these other entries are needed for CiviAccounting features like Exporting Accounting Batches). To change the Failed contribution to Completed after the fact, follow the below steps:

1. In the **civicrm\_contribution** table, the *contribution\_status\_id* for the contribution in question needs to be changed from `4` to `1`.
2. In the **civicrm\_financial\_item** table, the *status\_id* for the contribution needs to be changed from `3` to `1`. (You can identify the exact contribution in this table using the *entity\_id* field. The *entity\_id* here comes from the *id* field in the **civicrm\_line\_item** table.)
3. In the **civicrm\_financial\_trxn** table, create an entry. (This entry must be created before Step 4, so the entries in Step 4 have a financial\_trxn record to reference).
4. In the **civicrm\_entity\_financial\_trxn** table, create two entries.

4a) The first entry will have 'civicrm\_contribution' in the *entity\_table* field and the contribution ID of the contribution itself in the *entity\_id* field. The *financial\_trxn\_id* field will use the the *id* from the entry you created in Step 3.

4b) The second entry will have 'civicrm\_financial\_item' in the *entity\_table* field and the id from the **civicrm\_financial\_item** table in the *entity\_id* field. Again, the *financial\_trxn\_id* field will use the *id* from the entry you created in Step 3.

---
Tags: civicontribute, contributions, database
---


title: How do I add Financial Type

text:
# Question
Title: How do I add Financial Type
I am setting up a new Price Field for a Webform I am creating and none of the Finincial Types in the drop down menu suit the Contribution so I need to create a new Financial Type. I cannot work out how to do it.

# Answer
To create a new financial type navigate to Administer \> CiviContribute \> Financial Types, and click on Add Financial Type.

See the manual for more details: Key concepts and configuration
> 3 votes

---
Tags: financial-types
---


# Question
Title: Should I disable extensions prior to upgrading CiviCRM?
I couldn't spot anything on this in the upgrade instructions, and as it's something that could affect lots of people, I thought I'd ask the question here.

When upgrading CiviCRM, what is considered best practice regarding extensions? Should they be disabled prior to the upgrade?

If, as a result of upgrading Civi, one or more of my installed extensions is no longer compatible, what's the best procedure to follow? Should I attempt to update/upgrade extensions to a compatible version before or after upgrading CiviCRM?

# Answer
> 6 votes
In general, I'd recommend no.

Some extensions - literally - may not be reinstallable if they aren't qualified for that version of Civi.

My recommendation: **TAKE BACKUPS!!!** Then don't disable extensions and just go ahead with the upgrade.

---
Tags: extension, upgrade
---


title: Open Ended Pledges

text:
# Question
Title: Open Ended Pledges
The New Pledge form asks for a total amount of the pledge. I'm working from a spreadsheet where the installment is specified but not a total amount. What is the best way to enter this?

# Answer
The "recurring payments" approach will only work if you have a CiviCRM payment processor extension that supports it. Other than iATS and CiviSEPA I'm not sure other extensions support ACH/EFT - though I'm not familiar with the non-US processor extensions.

It could be that CiviBanking could provide a solution for you. Another possibility is the Offline Recurring Payment extension.

You can also check out the Direct Credit and Direct Debit wiki page.
> 2 votes

---
Tags: pledges
---


# Question
Title: 404 on link to edit contact with contact hash
I'm testing the ability to send emails out with a link for each contact to edit their own information anonymously, using the contact hash token as described in Linking Profiles.

I am able to access the profile anonymously, but when I click on the link provided in the email: as with tokens: http://\[site\]/civicrm/profile/edit?reset=1&gid=36&id={contact.contact\_id}&{contact.checksum} in sent email: http://\[site\]/civicrm/profile/edit?reset=1&gid=36&id=\[CID#\]&cs=\[checksum#\] I get a 404 error.

I've confirmed the URL based on the wiki documentation. I've tried updating Joomla permissions (Public users are allowed access to profile listing and forms, profile create, profile edit, and profile view). I've confirmed that my profile does not use any non-contact fields.

What should I check next?

Joomla 3.6, Civi 4.7.12

# Answer
I tend to use this for my instructions on adding tokens - which in the case of joomla says the url construction should be like

Joomla!: http://www.myorganization.org/index.php?option=com\_civicrm&task=civicrm/profile/edit&reset=1&gid=N&{contact.checksum}&id={contact.contact\_id}
> 1 votes

# Answer
This is a token substitution error - the information is getting replaced but with the wrong thing.

Next steps are to check out error logs, in a file called ConfigAndLog.

Good luck, report back with what you find.
> 1 votes

---
Tags: contacts, profile
---


title: Send test mail works, CiviMail doesn't

text:
# Question
Title: Send test mail works, CiviMail doesn't
On a 4.7.11 site, I'm trying to send mails using the smtp relay server of google.

I followed the instructions on the google website for setting up mail relay in G suite (https://support.google.com/a/answer/176600?hl=en and https://support.google.com/a/answer/2956491)

Then in CiviCRM I configured outbound mail settings like this:

* Select mailer: SMTP
* SMTP Server: smtp-relay.gmail.com
* SMTP port: 25
* Authentication? No

When I click the "Save & Send Test Email" button, it works. So the setup of google relay for my account is correct.

Also, when I use activities to send an email, it works.

But when I try to send a test email using CiviMail, I get the error:

Error in call to Mailing\_send\_test : Failed to set sender: b.25.13.aa68527faac1fed1@EXAMPLE.ORG \[SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM \>\> Global Settings \>\> Outbound Email (SMTP). (code: 550, response: 5.7.0 Mail relay denied \[62.19.72.76\]. Invalid credentials for relay for one 5.7.0 of the domains in: example.org (as obtained from helo and mail-from). 5.7.0 Email is being sent from a domain or IP address which isn't registered 5.7.0 in Google Apps account. Please login to your Google Apps account and 5.7.0 verify that your sending device IP address has been registered within 5.7.0 Google Apps SMTP Relay Settings. For more information, please visit 5.7.0 support.google.com/a/answer/6140680#maildenied e9sm8480344wjh.2 - gsmtp)\]

Which is weird, because the IP address *is* correct and SMTP authentication is not required in my google settings.

Is CiviMail using other settings than the one defined in the outbound mail settings screen? Or does it use another method to send mails?

Thanks.

Alain

# Answer
Apparently, CiviCRM adds a lot of things before the @yourdomain.com in the From-address. Things like a job id, event queue id, and a hash. Google didn't like that because that email address didn't match an existing mailbox. Luckily, in the Google SMTP relay settings, you can specify to accept any address from your domain. That did it!
> 3 votes

# Answer
This may be because CiviMail is using a VERP format email as the from address, and it may be that G Suite does not permit this with your configuration.

Conversely, when sending a single test email, CiviCRM will be using the default site email address OR the email of your CMS user's CiviCRM contact. This works because G Suite sees a known, working email from your domain, and permits delivery.

To disable VERP, navigate to Administer \> CiviMail \> Component Settings and disable 'Track replies using VERP in Reply-To header'.

VERP is a good thing for accurate bounce / unsubscribe handling, so I don't recommend disabling it. Instead I'd recommend looking to get G Suite configured to support it better, or using an outbound mail provider which supports either VERP or other reliable means of handling bounces / unsubscribes / etc. (There are various extensions for providers which do something similar, but that's a whole other topic.)

See also How does Civimail reply tracking and forwarding work?
> 2 votes

---
Tags: civimail
---


# Question
Title: Upgrade from 4.6 to 4.72 DB error - no such field
As I was following the process to upgrade to 4.72, I received the following error when updating the DB:

```
[Error: Upgrade DB to 4.7.beta8]
Error Field Error Value
Type    DB_Error
Code    -19
Message DB Error: no such field
Mode    16
UserInfo    UPDATE civicrm_payment_processor_type SET is_active = 0 WHERE name = 'Google_Checkout' [nativecode=1054 ** Unknown column 'payment_instrument_id' in 'field list']
DebugInfo   UPDATE civicrm_payment_processor_type SET is_active = 0 WHERE name = 'Google_Checkout' [nativecode=1054 ** Unknown column 'payment_instrument_id' in 'field list']

```

I still very new to Civi and I'm not sure where to begin with this other than rollback to my backup. I've attached a full screenshot as well. Thanks for any help in advance.

Jason

# Answer
I just did an Upgrade from Civicrm 4.6.11 to 4.7.2 - (plan copy) which went without any error - so please try the below and update the result

Just TEST This First I guess you had Payment processor enabled in your previous version and which has extra column for the payment processor type

So please try to Roll back to your previous version of CiviCRM 4.6 first

Then try to delete the payment processor or Disable the payment processor and try to Upgrade to Civicrm 4.7.2

Also if possible try to disable all the extension too.
> 1 votes

# Answer
This appears to be caused by triggers which CiviCRM is adding to the database during the upgrade.

I had a problem that fits this description exactly, except on Joomla! (your screenshots appear to be from WordPress), when upgrading from 4.6.21 to 4.7.12. After exploring lots of different possibilities related to MySQL triggers, I was able to complete the upgrade by simply disabling the "Logging" option under Administer \> System Settings \> Misc. This setting makes use of triggers to perform the logging, and those triggers were interfering with the upgrade. After the upgrade is complete, I can re-enable logging again with no problem.

Interestingly, some older upgrade instructions like this one for Drupal https://wiki.civicrm.org/confluence/display/CRMDOC42/Upgrade+Drupal+Sites+to+4.2+-+Drupal+7#UpgradeDrupalSitesto4.2-Drupal7-5.DisableLogging specifically say "disable logging", but there doesn't seem to be any mention of this requirement after 4.2, nor anywhere that I could find for Joomla! or WordPress.
> 1 votes

---
Tags: upgrade
---


# Question
Title: Modify the Tags (Categories) Administration page
I'm using CiviCRM 4.7.9 in a Drupal 7 environment. CiviCRM does an amazing amount of stuff remarkably well. Unfortunately, its Tags (Categories) Administration page (http:///civicrm/admin/tag) page is not one of them. I have a rather extensive set of tags organized into tag sets.

When I attempt to manage my tags, the Description column is so wide that it forces everything else off the page. You have to scroll way over to get to the incredibly important Parent ID, Tag set? and actions columns. When you scroll over, you loose all ability to see which tag you're actually dealing with. The whole thing is a terribly clumsy, difficult mess.

If I could just get rid of the totally unnecessary Description column in the display, it would not only make managing the tags (and tag sets) much easier, it would also make it possible. Is there any way of getting the offending Description column disappear?

# Answer
> 1 votes
When we have come to a necessity of Tags Administration page changes, only way we've been able to find, was custom CRM/Admin/Page/Tag.tpl template creation. With more than 2000 tags, it was almost impossible to load the page, so we got rid of some CiviCRM stuff and replace it by "native" Datatable script (CiviCRM uses it anyway, but wraps it into set of features we didn't need at the moment). This is how it looks now, loads pretty fast and has only information we use (guess Tag Set and Reserved also can be stripped though):

It's CiviCRM 4.6, but guess this part has no significant differences to 4.7 So, you might want to give "custom CiviCRM template creation" a try, most likely you will get there sooner or later, if you continue to use CiviCRM for a long enough :-)

---
Tags: contacts, tags, administer
---


# Question
Title: What is the best way to override changes to CRM_Core_Config?
What is the best way to override changes to CRM\_Core\_Config without modifying the original. Have tried through inheritance, but generates the following code:

> Fatal error: Cannot redeclare class CRM\_Core\_Config ....../code/sites/all/civiphp/CRM/Core/Config.php on line 854

It isn't possible to dynamically load and unload the class, so I was thinking of writing a module which modifies the object after it has loaded via a hook. At least this would survive upgrades.

http://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_config

# Answer
Module available: https://github.com/adam-devapp/drupal-pantheon-civicrm-cache-clear/tree/master/civicrm\_cache\_clear

Needed to be in Drupal, as CiviCRM extensions won't work if the path changes underneath them.
> 0 votes

# Answer
I've come up with this function to clear cache, when file paths change.

```
function cacheoff_civicrm_config(&$config) {

  // 1. Get document root from the server
  // 2. Compare to a set path in the cache
  // If 2. doesn't start with 1., then regenerate cache
  // This means the file path has changed

  $templateDir = $config->customTemplateDir;
  $document_root = $_SERVER['DOCUMENT_ROOT'];

  if (!substr($templateDir, 0, strlen($document_root)) === $document_root) {

    CRM_Core_Error::debug( "Path changed: " . $document_root . " doesn't match " . $templateDir );
    CRM_Core_Config::clearDBCache();

  }
  _cacheoff_civix_civicrm_config($config);
}

```
> 1 votes

# Answer
As you have found out, the hook civicrm\_config is just the way to do that :-)
> 1 votes

---
Tags: configuration
---


# Question
Title: Totals without showing each contact in Contact related reports
Is it possible to have contact reports with listings that do not initially show each contact as a row but displays only the totals for the sorting groups? I have thousands of contacts and want to have a report that shows how many contacts are within each postal code or totals for each gender, etc. I know we can get the totals to be displayed using the Sort area and clicking the check box for "Section Header / Group By". However, my results have hundreds of pages and I just want to see the totals for each category.

We are currently on CiviCRM 4.6.20.0 on Drupal.

# Answer
> 1 votes
one way to do this would be to use the Aggregation feature in Drupal Views. This can be set to give you a 'count' for any of the fields in the row, so you could have your postcode in one column and a 'count' of the 'contact IDs' in the next. You would then be able to make the 'postcode' function as a link so that you could then click through to see all the contacts in that postcode.

Of course it really depends what you want to 'do' with that data after you see it. But if reporting the numbers is the primary goal, this may work for you.

Expect others to provide a 'how to' using Reports directly.

---
Tags: civireport, reports
---


# Question
Title: Relationships Search other than via Advanced Search?
Is there an option to find the related contacts (e.g. employee of) of an organization other than with the advanced search?

We seem to have an error/bug in our advanced search. It shows the correct results on the initial search, but when creating and saving the smart group, the settings for the advanced search seem to reset.

The search builder doesn’t allow to search for relationships. The relationship report doesn’t allow to save the results in a smart group.

Is there any other option I can’t think of right now?

What are trying to do is to get all related contacts (employee of) of our organization members in one smart group.

# Answer
I just had a go on Demo

"This smart group will stay up-to-date with all contacts who meet the search criteria.

Employee of

Relationship - Active and Current"

I don't know if it will still be there by the time you get to look at it. http://d46.demo.civicrm.org/civicrm/contact/search/advanced?reset=1&force=1&ssID=1
> 1 votes

---
Tags: search, search-results, custom-search, search-builder
---


# Question
Title: Save/submit button when profile is set to "view"
One gets "Save" and "Cancel" buttons when adding a profile in "edit" mode. I'd like to see the same when presenting a profile in "view". Why? The client checks the entry and can then submit it - if changes have to be made, they go back to an editable profile page, just looks nicer in "view". I've played around a bit with scripting - but no luck given little programming intelligence. Any idea - this is all on a Wordpress platform. Cheers

# Answer
This is a very non-coder way - I've got no real programming skills, so hacked around a bit - and maybe there are other ways of doing it better...

```
[civicrm component="profile" gid="yourvalue" mode="view" hijack="0"]

<form id="Edit" class="CRM_Profile_Form_Edit" action="http://yoururl/?page=CiviCRM&q=civicrm/profile/edit" method="post" name="Edit" data-warn-changes="true">
<div>
<input name="entryURL" type="hidden" value="http://yoururl/?page=CiviCRM&amp;q=civicrm/profile/edit&amp;" />
<input name="gid" type="hidden" value="yourvalue" />
<input name="_qf_default" type="hidden" value="Edit:next" />
</div>
<div class="crm-container crm-submit-buttons">
<span class="crm-button crm-button-type-next crm-button_qf_Edit_next crm-icon-button">
<span class="crm-button-icon ui-icon-check">
</span>
<input id="_qf_Edit_next" accesskey="S" class="crm-form-submit default validate" name="_qf_Edit_next" type="submit" value="Save and complete registration" />
</span>
</div>

```

Gives you-\>
> 1 votes

---
Tags: wordpress, profile
---


# Question
Title: What is the best way to use CiviCRM for on-site registration at an event?
We have an event coming up and this is the first time we've used Civi to handle our registrations both pre-event and on-site. It is possible that we will have people attend who are not yet in our database. As I understand it the existing workflow for registering a new contact would be to add a new individual, enter their info, save the contact, click events, add event registration, pick the event, pick their options. \[...\]. That's a lot of different screens to jump through.

My solution for this piece was to keep the online registration open and add a menu item to a blank form. Then our folks doing registration can just bring up the form and key in the participant's info and event options (we have a couple lunch and banquet choices they get). However, we also want to record payments. This means having a second tab open, refreshing the participant list, editing the registration, and recording the payment. Which works if your "cashier" is a different person than your data entry person.

Has anyone used Civi for on-site registrations like this? Is there something I'm missing? Absent custom coding is there a way I can build a profile or use Drupal Webform to allow a registration team member to enter a new person, select their registration options, and record a payment all on one screen? I imagine if not, I can do it with the API and build a page, but I'm not sure I can get it done in the time I have.

Thanks for any suggestions.

Rachel

# Answer
Yes, a Drupal-Civi webform will allow you to do just what you've described.

Note that if your event uses a price set, you will have to get creative (see below).

From Webform CiviCRM Integration:

> Event registration via webform is extremely flexible; any number of contacts can be registered for any number of events on a single form. If your form has multiple contacts on it, you may choose to register them each separately for different events, or all together for the same event(s). If you choose to register them together, CiviCRM will show contact 1 as having registered the others...
>
> With payment integration, events can be paid for online or offline via webforms (see notes below on supported payment processors). Note that CiviCRM pricesets are not supported and fees should instead be allocated using the "event fee" field provided by this module.

If you have your staff/volunteers using the webform on behalf of registrants, you can also have exposed Existing Contact fields to look up whether registrants are already in the system or not, all on the same screen.
> 5 votes

---
Tags: civievent
---


# Question
Title: Migrating database into a newer version of civicrm?
I have tried importing the database from a production server running civicrm 4.4 into a development server running 4.7 - but it appears that only contact names are present - email, address, activities, memberships and contributions are all missing. Does this mean that I need to start again, downgrade civicrm to 4.4 on the dev server and only upgrade it after porting the database?

# Answer
If you want to migrate the complete database you should indeed do the following:

1. Set your old environment in read-only maintenance mode
2. Set up the new environment (CiviCRM & CMS) using exactly the same versions
3. Migrate the databases
4. Update CiviCRM and CMS to the latest versions
5. Properly test (quite some changes between 4.4. and 4.7)
6. Go-Live or rollback

As an alternative (if your data isn't too complex) you could export everything you need as csv-files and either use the UI import function of CiviCRM to import into the new environment or give Eileen's import extension a shot.
> 1 votes

---
Tags: migration
---


# Question
Title: My Configure Your Dashboard stopped working after update
After updating civicrm from version 4.7.10 to 4.7.11, the configure fucton does not work any more. There are no buttons any more in the configuration dahsboard:  and drag and drop does not work anymore. Meanwhile the Dashboard itself stays robust and in good health and keeps working okay.

I tried flushing all caches in the site, and sometimes this helps, and the dashboard then looks correct again and functions, but minutes later the image changes back to the button-less like the one in the image above. I checked with Firebug and this reports a javascript error, with a very long text that I do not understand at all. It is a pity because this has worked all the time in the versions before 4.7.11.

Any advice on what to do?

# Answer
In CiviCRM 4.7.11 the issue could be solved by closing all widgets before configuring them. In version 4.7.12 the issue does not present itself anymore: solved.
> 0 votes

---
Tags: joomla, dashboard, dashlet
---


# Question
Title: Dropdown Custom Field - Is this possible
We would like to have the ability to use a dropdown as one of the custom fields linked to an activity. This would enable us to search on this field without mis-spelling causing problems on the future. Is this possible as I can't see an option for a dropdown when setting up a new custom field?

# Answer
Yes, you can do this by using "select" option

Please try to use text - with select option (Data and Input Field Type) and fill up the details below or you can select an existing set from the drop down

If you are not sure about the option please let me know I can post some Example with screen shots

I guess this helps !!!
> 3 votes

---
Tags: custom-fields
---


# Question
Title: Importing without changing primary address
Is there a way to tell CiviCRM not to set newly-imported addresses as primary addresses?

For example, let's say I have a database where everyone has nicely-curated "Home" addresses. I make a new location type "Voter" to import voter file addresses. The import process will make "Voter" the primary, but I want "Home" to remain primary.

The only way I know of is to backup the civicrm\_address table and revert them using SQL, but it would be nice to skip that step.

# Answer
I don't know if there's a way to handle this through the User Interface. I added a function into a custom extension, which seems to solve the issue:

```
function myext_civicrm_pre($op, $objectName, $objectId, &$params) {
  if ($objectName == 'Address' && ($op == 'create' || $op == 'edit')) {
    if ($_SERVER['REQUEST_URI'] == '/civicrm/import/contact') {
      unset($params['is_primary']);
    }
  }
}

```
> 1 votes

---
Tags: import, addresses
---


title: Attach a file to a donation

text:
# Question
Title: Attach a file to a donation
I'd like to be able to attach receipts, notes, and other documentation to a contribution. Is this possible?

# Answer
> 4 votes
In a word, yes. You'll have to implement this as custom field sets, which is easy. That's menu option Administer/Customize Data and Screens/Custom fields. You can have a custom type of 'file' as a custom field, which then allows you to attach a file. You can have as many of these fields as you require, and you can set the custom field set as applying to contributions only.

---
Tags: activities, attachments
---


# Question
Title: Batch number missing in version number in civicrm.php
By default, WordPress uses the version information provided in ../civicrm/civicrm.php. However, the batch number is missing here:

```
<?php
/*
Plugin Name: CiviCRM
Description: CiviCRM - Growing and Sustaining Relationships
Version: 4.7
Author: CiviCRM LLC
Author URI: http://civicrm.org/
Plugin URI: http://wiki.civicrm.org/confluence/display/CRMDOC/WordPress+Installation+Guide+for+CiviCRM+4.7
License: AGPL3
Text Domain: civicrm
Domain Path: /languages
*/

```

WordPress uses the following code to extract the version information from a plugin:

```
$data = get_plugin_data("~/civicrm/civicrm.php");
$version = $data['Version'];

```

I am using this functionality to automate keeping track of my fixes until CiviCRM and other plugins make the necessary corrections in the next release.

> Would it be possible to update civicrm.php to add the batch number? So, it will return 4.7.12 instead of 4.7.

# Answer
> 1 votes
You can get the more granular CiviCRM version data with:

```
$version_file = CIVICRM_PLUGIN_DIR . 'civicrm/civicrm-version.php';
if ( file_exists( $version_file ) ) {
    require_once $version_file;
    $civicrm_version = civicrmVersion();
}

```

---
Tags: wordpress, 4.7
---


# Question
Title: Drupal Views Exposed Filter (operators) and CiviCRM Multiple Tags
We expose CiviCRM contact tags (Tag Name) fields via Drupal Views in order to create simple contacts search by tag(s) via Drupal as front-end. Since almost every contact has more than one tag, "Allow multiple selections" option for exposed filter is being selected in order to narrow searches. However, search by multiple tags gives all contacts, not an "exact match" (mean, only contacts which have all of selected tags).

Example:

* Bob has "black", "white", "yellow" tags;
* Sarah has "red" and "yellow" tags.

---
* Searching by "yellow" returns Bob and Sarah
* Searching by "black" and "yellow" returns Bob and Sarah again, while we've expected to get Bob only.

How it would be possible to perform an exact match search?

Drupal 7.x, CiviCRM 6.21

P.S. civicrm.core.inc describes "civicrm\_handler\_filter\_pseudo\_constant" as exposed filter handler for civicrm tag field; civicrm\_handler\_filter\_pseudo\_constant extends views\_handler\_field\_in\_operator and allows only "Is one of" and "Is not one of" operators to choose from; wouldn't it be more logical to use something like "many\_to\_one" handler? If memory serves, it's being used for Drupal taxonomy and provides exact match for search nodes by multiple taxonomy terms.

# Answer
Indeed, civicrm\_handler\_filter\_pseudo\_constant.inc should be altered and

`class civicrm_handler_filter_pseudo_constant extends views_handler_filter_in_operator`

should be replaced by

```
class civicrm_handler_filter_pseudo_constant extends views_handler_filter_many_to_one

```

Funny, I made a pull request in May 2016 (against wrong branch though so it was closed) and made it again in October. Hope this time it will pass.
> 2 votes

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


# Question
Title: How do I notify our targets that a petition has been signed?
I am creating a petition with multiple targets. Is it possible to have them be notified via email each time the petition is signed? Or is it possible to CC them in the email confirmation the petition signer receives?

# Answer
> 2 votes
The extension "Petition Email" should let you do this in CiviCRM.

---
Tags: civicampaign
---


# Question
Title: Using a Variable/Token for Config Directories to Get Site Root Path
I am using Drupal 7 with CiviCRM 4.7.12.

When setting the Directories for CiviCRM...

I know you can use \[civicrm.files\] and \[civicrm.root\] to get file system paths. However, I have my extensions, custom templates and custom php in the root of my web server.

Is there a token or variable that I can set that will point CiviCRM to the root directory of my site?

For example I could have the following for the "Custom Template Directory": \[site.root\]/CustomTemplates

Note: There is a Paths.php file that defines a Paths class that contains cms.root. However, when using that in the directories settings it tells me that the path cannot be found.

# Answer
> 2 votes
Take a look at issue CRM-19371. It a small bug and fixed in CiviCrm 4.7.13. I fixed my 4.7.12 installation by using this patch.

---
Tags: tokens, configuration, settings, directory
---


title: Dashboard links do not open

text:
# Question
Title: Dashboard links do not open
The links on our donor dashboards do not open unless you right click and select "Open in a new tab". I am referring to the "View" "Edit" & "Cancel" links that appear with recurring donations. I am using Wordpress 4.4.2 & Civi 4.6.14 this is a new website and Civi install so this is not something that was working and recently quit, it has never worked for me. Any suggestions so they function normally?

# Answer
The guys at Ginko Street fixed it for me. It was a conflict with my WordPress theme and Civi shortcodes.
> 2 votes

# Answer
If you turn on your browser 'inspector' you will possibly see some js errors. It is possible that a wordpress plugin is conflicting with the code that generates the 'pop up'
> 1 votes

---
Tags: dashboard, links
---


# Question
Title: CiviCRM logging enabled. I am now getting an error on mysqldump. Unknown storage engine 'ARCHIVE'
I getting the following error when I try to dump my civicrm drupal database

> Couldn't read status information for table log\_civicrm\_install\_canary () mysqldump: Couldn't execute 'show create table `log_civicrm_install_canary`': Unknown storage engine 'ARCHIVE' (1286)

This table is related to the civicrm logging feature as described in the article https://civicrm.org/blog/eileen/who-did-what-when. Logging was enabled a while ago and everything seemed to work fine. Since then the site has been migrated to a new host and has had both civi and the drupal core updated a number of times. Currently, The site is hosted on omega8 running barracuda which is an aeger based host so these updates are more like site migrations. The instructions in the blog required turning on INNODB with a civicrmapi call. This was run for the original site but not on any of the migrated sites. I don't know if this is relevant? I am now getting the error when dumping the database via mysqldump.

Does anyone have any idea what this table is for or what might be causing the error?

Thanks for any help.

# Answer
Short answer: Change the storage engine of the table with the following command in mysql:

`ALTER TABLE log_civicrm_install_canary ENGINE=InnoDB`

The `civicrm_install_canary` is a table used for installation purposes. The purpose is explained in the answer on What is the installation canary?
> 1 votes

---
Tags: logging, mysql-archive-format, db-logging
---


title: api: Get renewal activity for a contact

text:
# Question
Title: api: Get renewal activity for a contact
I need to find out in php if 'the current user' has recently renewed membership (or just signed up as a new member).

I don't think I can get data about renewal from the Membership entity. The 'Join date' seems to be the same as the 'Start date'. So for renewal, I'd have to look at Activities of the type renewal.

* I hoped I could do this with the ActivityContact entity, but it doesn't allow me to filter on activity type.
* I hoped I could do this with the Activity entity, but it doesn't allow me to filter on the 'target\_contact', or 'assignee', or whatever it's called.

So .. do I need to join api calls - how would I do that ? - or is there another way ?

# Answer
After a brand new update, the api explorer works fine. And the answer is, in PHP

```
$result = civicrm_api3('Activity', 'get', array(
  'sequential' => 1,
  'activity_type_id' => array('IN' => array("Membership Signup", "Membership Renewal")),
  'activity_date_time' => array('>' => time()-30*24*60*60),
  'source_contact_id' => $contactid,
));
$recent = ($result['count']>0);

```
> 0 votes

# Answer
Why not check against membership status New? The length of time it's New from and for is configurable I believe.

Personally I'd try to use the API with a get command. If the API for this didn't work on the install that I was working on, I would write a custom SQL query for CRM\_Core\_DAO. Happy to help you further with that if needed.
> 1 votes

---
Tags: civimember, api, activity
---


# Question
Title: CiviCRM WordPress Member Sync - adding a new role or changing an existing one
Christian Wach's excellent set of Wordpress plugins make that CMS viable for member's only sites - wouldn't work otherwise!

Here's the query. Using the "Roles" option as the synchronization option, a Wordpress user with the Wordpress user role being e.g. "Membership pending" signs up for a CiviCRM membership and via the plugin gets assigned to the Wordpress user role "Membership granted".

However, the Wordpress user now has two roles: "Membership pending" and "Membership granted".

The $64.000 question then is:

* Is this by default, i.e. CiviCRM WordPress Member Sync does not switch Wordpress roles, but rather adds them, or
* I do have the Member's plugin installed, with the multiple roles option not checked (although it had been in use previously), and I've now screwed up any forcing of only one user role per user until the end of time?

If latter condition is in fact false - any ideas of how to make (the plugin?) not add a role but in fact switch it?

Cheers!

# Answer
> 2 votes
The CiviCRM WordPress Member Sync plugin provides basic sync functionality and does not necessarily cover all possible use cases. What I would do in your case is use the `civi_wp_member_sync_add_role` hook to capture which user is being assigned which role. You can then remove the "Membership pending" role and make sure they only have the "Membership granted" role.

---
Tags: wordpress
---


title: Tracking Call Histories

text:
# Question
Title: Tracking Call Histories
I am looking to track the following information for each call made:

* Attempt Number
* Status of Call (No Answer, Busy, etc)
* Date and Time of call
* Who made the call
* If possible, the length of the call

Has any developer created a way to track calls and the result of that call in CiviCRM? If yes, how did you do it?

Or is this something that CiviCRM can do? If yes, where can I find this information?

Thank you,

LAE

# Answer
Yes, this is something CiviCRM can do.

You could create custom fields to track this information and record each (attempted) call as an activity. Using the activity method, you could even assign a follow up call to a staff member/volunteer if you wanted. You could use a Profile to simplify the entry of the information. If you are using Drupal as your CMS, you could create a streamlined webform that integrates with Civi and have a simpler and more specific interface for entry of the call data.
> 2 votes

---
Tags: evaluating-civicrm, phone
---


# Question
Title: Can I mock the CiviCRM API for unit tests?
Suppose I want to mock the API in unit tests for my extension, can I do that? Or should I implement an interface myself that is just a wrapper around civicrm\_api3, and create mocks of that interface?

Thank you!

johan

**update:** I think a part of the answer is here in the source: https://github.com/civicrm/civicrm-core/tree/master/Civi/API/Provider

# Answer
> 2 votes
Generally, you need to get a reference to the API kernel. (For testing, I usually build up a custom instance, but you can use `Civi::service("civi_api_kernel")`). Then call `registerApiProvider(...)` and pass along a new provider. I usually define mock APIs using `new AdhocProvider(...)`.

There are examples of mocking an API in api\_v3\_UtilsTest and CRM\_Core\_ManagedEntitiesTest.

(**Update**) I originally thought `api_v3_UtilsTest` was easier to read, but maybe `CRM_Core_ManagedEntitiesTest` is easier to generalize/imitate. Note how the `setup()` registers the API provider:

```
$this->apiKernel = \Civi::service('civi_api_kernel');
$this->adhocProvider = new \Civi\API\Provider\AdhocProvider(3, 'CustomSearch');
$this->apiKernel->registerApiProvider($this->adhocProvider);

```

and how `testRemoveDeclaration_CleanupUnused()` manipulates the `CustomSearch.getrefcount` API to return different values at different times, e.g.:

```
// Override 'getrefcount' ==> The refcount is 1
$this->adhocProvider->addAction('getrefcount', 'access CiviCRM', function ($apiRequest) {
  return civicrm_api3_create_success(array(
    array(
      'name' => 'mock',
      'type' => 'mock',
      'count' => 1,
    ),
  ));
});

```

# Answer
> 0 votes
Maybe I'm misunderstanding the question but do you mean this? https://wiki.civicrm.org/confluence/display/CRMDOC/Testing#Testing-PHPunittests

---
Tags: api, testing
---


# Question
Title: Change Email Address and Name Fields from required to not required during uploading of records
Newbie here :)

It appears that the following fields are required when you upload records:

* First Name
* Last Name
* Email Address

I have records to upload that some of the records do not have a First Name, Last Name and/or Email Address.

Is there a way to change these fields from required to not required in the uploading portion?

If I am incorrect about this, please let me know. :)

Thank you,

LAE

# Answer
For a tele-research project you could fill the empty spaces with something like "UNKNOWN' or even 'UNKNOWN@UNKNOWN.com" and then import. You can then use the powerful search tools in Civi to find all the UNKNOWN's for your researchers to update.
> 2 votes

# Answer
Contacts have to meet one of two criteria to be imported.

Either: First Name AND Last Name

Or: Email Address.

(in contrast to First name AND Last name AND Email Address).
> 2 votes

# Answer
You can create different 'matching rules' that would work for import 'only email', or 'only first and last', but i am not sure if you are saying you have contacts that you want to import that have no email or first or last. if you do, then what do you know about them.
> 1 votes

---
Tags: drupal, import, email
---


# Question
Title: Webfaction hosting, behind a proxy - broken dashlet
Webfaction hosted servers are behind firewalls/proxies. Unlike standing up apache (i.e., socket:xxxx on localhost), their wordpress installation appears to simply be the wordpress code. Therefore, they appear to application route the WP requests vs. NAT/firewall the TCP.

I would guess the civicrm plugin doesn't pass "HOST:" http headers ...

yes, no, solutions? (see pict)

Note:specific menu items (e.g., Administer-\> System Settings -\> Option Groups) render fine. (and, that messed up CSS is probably due to the 404 page's css)

# Answer
At least until the most recent 4.7 releases, CiviCRM needed to contact itself via http to populate the dashboard. Your picture suggests that it's not able to, probably related to how the proxy is setup. If you have a command line interface in environment that the code is executing, see if you can contact yourself using, say curl or wget. Sometimes hardcoding the domain in /etc/hosts is a solution.

Another way to mess up your dashboard is with a slightly broken certificate on a https only site - some will render for you in Chrome, but curl/wget won't like it. But in that case, you'd get a spinning thingy.
> 3 votes

---
Tags: dashboard
---


# Question
Title: Error when accessing Activities for contact (after upgrade to 4.7.2)
When a management user tries to open Activities tab for a contact he gets error message

Error that I see when I try to trace it:

*API permission check failed for Case/getcount call; insufficient permission: require Array*

That affects users with particular role (works fine for administrator) and appeared after upgrade to 4.7.2

# Answer
I just tested the same condition against a Plan copy of CiviCRM Version 4.7.2

I can View the activities without any error - so please try disabling all the installed extension first and try the same if you are still getting an error then - Try to install an Plan copy and test it again
> 0 votes

# Answer
Check the "CiviCase: access my cases and activities" missing from "Management" role.
> 0 votes

# Answer
This is a bug in earlier versions of CiviCRM 4.7. See CRM-18456. The solution is to upgrade to CiviCRM 4.7.7 or later.
> 0 votes

---
Tags: activities, permissions, ajax
---


title: Sybunt and Lybunt Report fields

text:
# Question
Title: Sybunt and Lybunt Report fields
I'm confused why Organization Name and Prefix are in the Lybunt report but not in the Sybunt report. They both have

```
'fields' => $this->getBasicContactFields(),

```

which I thought included these fields. Maybe I'm missing something.

I can quickly add Organization with this:

```
'organization_name' => array(
            'title' => ts('Organization'),
          ),

```

but I'm unclear how to add the prefix\_id and convert it to the correct output (Mr., Mrs., etc)

```
   'prefix_id' => array(
            'title' => ts('Prefix'),

```

Thanks in advance for your help.

Drupal 7.51, Civicrm 4.7.11

# Answer
Agreed that the correct solution is to work within `getBasicContactFields()`, but since your question is a good one with a more general application:

When you add organization name and prefix, you're doing so by adding them to the class's `_columns` property. As you note, this doesn't look up "pseudoconstants", such as converting prefix\_id to a prefix.

That happens in the `alterDisplay` method toward the bottom of the same file. Here's a good example in the Lybunt report of using a pseudoconstant lookup to convert the gender ID to a gender:

https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Contribute/Lybunt.php#L719

Hopefully this example is what you need; otherwise feel free to comment/update the question!
> 2 votes

---
Tags: civireport, custom-reports
---


# Question
Title: Nationalities extension with dual citizenship
I installed the Nationalities extension and it works fine. However, there are some contacts that have dual citizenship. I was wondering if somebody has already implemented this or have ideas how to do it?

thanks!

# Answer
Is "Nationality" a group of custom fields? If so, consider making the group multi-valued.
> 1 votes

---
Tags: extension
---


# Question
Title: How do I import contacts through the command line?
How can I import contacts in CiviCRM using the command line (CLI) rather than using the CiviCRM user interface and its importing wizard?

# Answer
> 13 votes
When you are importing a large number of contacts, you could face timeout issues when using the user interface. Importing through CLI is an alternative.

There is a file called import.php in /civicrm/civicrm/bin/csv/import.php. We will call this file from the command line.

After you have exported your CSV file, here are the steps for the import:

1. Put the CSV file on your CiviCRM server, outside the webroot somewhere. (Do not place this file within the website root, or you risk exposing your contacts' data to the internet.)
2. In the command prompt (shell), type `php path/to/import.php -e Contact --file path/to/file.csv` (check this forum post for some more detail). Provide an absolute path to the CSV file.
3. At this point, depending on the contents of your CSV file, you will likely get an error such as `ERROR line 2: Mandatory key(s) missing from params array: contact_type`. It expects you to pass a contact\_type parameter **inside the CSV file**. If you don't have one in your exported CSV file, you can very easily add a contact\_type column in it using a Notepad++ macro (note: turn off autocompletion for words and quotes in Notepadd++ as it may screw up the macro). Just add the new column at the end. Here is an example of a CSV file:

"email","contact\_type"
"blabla@example.com","Individual"
"asdf@example.com","Individual"
4. Now run the command again and you should see a success message for each imported contact. The message looks like this: `line 2: created Contact id: 114`

The down side is that you cannot (yet) assign a group or a tag to the imported contacts. I looked into the API but could not see an ability to add contacts to groups or tags.
Troubleshooting:

1. If you get an error such as "cli.php can only be run from command line.", and you wonder about it because you ARE running from the command line, then likely you are using php as cgi/fcgi. To overcome this there is a little hack (which I am not too happy with, but we actually are using the code as intended here). In /bin/cli.class.php, on line 85 the function \_accessing\_from\_cli() checks whether the program is run from CLI. It does this by checking the contents of PHP\_SAPI. But according to the first comment here, that variable is not reliable in some cases. So we can modify the function like this:

`public function _accessing_from_cli() {
 if (PHP_SAPI === 'cli') {
 return TRUE;
 }
 else {
 /* Temporary hack since the PHP_SAPI check does not work correctly for cgi/fcgi. See first comment here: http://php.net/manual/en/function.php-sapi-name.php */
 return TRUE;
 //trigger_error("cli.php can only be run from command line.", E_USER_ERROR);
 }
 }`

After you import your contacts, do not forget to return the file back to its original version.

2. I really suggest you either configure php to show up errors or make sure you have access to the php error log. This way, if the import suddenly stops after some time, you'll be able to see the reason and take appropriate measures (increase memory\_limit, max\_execution\_time, etc.).

# Answer
> 3 votes
Another option is to use *drush* in combination with the combination with the *cvapi* command. For example

`drush cvapi Contact.create sequential=1 contact_type="Individual" first_name="Ben" middle_name="Lee" last_name="User"`

creates one contact. Specially useful when sometimes one contact must created by automatically by an unix script.

---
Tags: api, import, cli
---


# Question
Title: BCC emails not working - is there a log I can view?
We're using Civi 4.7.12 on Joomla 3.6.2. Our Society has subgroups which need to be alerted when a contribution comes in for them. We have set the group contact's email address in the bcc field of the relevant contribution page. The contribution is accepted and the donor gets an emailed receipt but the bcc isn't being received. We have tried using an inhouse address as the bcc recipient and that doesn't work either.

Our SMTP mailer does not require authentication.

Is there a log in Civi of mail being sent? Any help would be very welcome.

Regards Claire

# Answer
The Administer Screen *Settings - Outbound Mail* gives you the option to enable *Redirect to Database*. (You can navigate to the screen with Administer -\> System Settings -\> Outbound Email (SMTP/SendMail), or with `civicrm/admin/setting/smtp?reset=1`)The mail is spooled to the table `civicrm_mailing_spool`.

*Update:* In case of the use of **cc:** and **bcc:** it is a bit tricky. I just did a short search in the code and found that, when the Pear mailing library is installed, the **bcc** and the **cc:** are removed from the Headers and added to the list of recipients. CRM-19173 explains the reason. So in the spool table, they can be found in the `recipient_email` appended to the list of email addresses, but not in the `headers`.

See the code at Mail.php line 260.
> 2 votes

---
Tags: email, logs
---


title: Redirect URL after contribution

text:
# Question
Title: Redirect URL after contribution
Profiles let you direct to some odd page after submission - why do contribution pages go nowhere (or maybe they do?)? Cheers

# Answer
You might find this Fuzion extension does what you need. Front End Page options adds the ability to choose an alternate thank you page instead of standard CiviCRM thank you page
> 3 votes

# Answer
@petednz - fuzion's answer will work - but it's eluded me. So here's a bit of a work-around: In the Contribution configuration mode go to "Receipt" and add in the Thank you message/footer a link that can be formatted to look like a button -\>

```
<p><a class="johnbutton" href="http://xyz/members-home/">Go to your membership page</a></p>

```

Why not use the `<button>` or `<input>` tags? Somehow they trigger an input that collides with the CiviCRM form...

I.e. its not a real redirect, but gives the user the option to trigger one.
> 0 votes

---
Tags: wordpress, contribution-page, redirect
---


# Question
Title: Fatal error: Uncaught CRM_Core_Exception: Found installation canary
I am new to civicrm and I have been recommended by a friend to try it out for my website. But before I do that I would like to try it our on my laptop via xampp.

I installed wordpress and then civicrm everything seemed to have went through but now when I click on civicrm it gives me this error.

***\[0: Found installation canary. This suggests that something went wrong with tracking installation process. Please post to forum or JIRA. thrown in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\civicrm\civicrm\Civi\Core\InstallationCanary.php on line 53***

Could someone please guide me on how to solve this.

Tanmaya

# Answer
> 1 votes
@Mike The name of your XAMPP installer suggests that you are testing with PHP 7. That is bleeding edge technology for CiviCrm. According to CRM-17789 thats supported for the first time in CiviCrm version 4.7.12. Maybe you can retry your installation using PHP 5.6.

---
Tags: wordpress, error, installation
---


title: White screen in 4.7.12

text:
# Question
Title: White screen in 4.7.12
I note with the 4.7.12 version of the difficulties of implementation, particularly with queries that only lead to blank pages. Track errors in apache located abnormalities in smarty. I returned to version 4.6.22 LTS that does not pose this problem.

Installation on a dedicated server ubuntu 14.04, apche 2.2 mysql 5.5.52 php5 wordpress 4.6

cordially

# Answer
> 2 votes
You don't mention your php5 version, that would be the most likely cause (i.e if it's less than 5.4).

But if the problem is seen in an apache error file and it's in the smarty file, then just give us the error and it should be clearer.

If you only updated the code files and didn't clear caches afterwards and run db updates, then you'll definitely want to do that, as per the documentation.

# Answer
> -1 votes
It sounds like this may be due to your PHP version. CiviCRM doesn't fully support PHP 7 yet.

See: CiviCRM PHP Requirements

---
Tags: wordpress, upgrade, smarty
---


title: How to create a campaign

text:
# Question
Title: How to create a campaign
I've been using CiviCRM for a few days now, and it's become pretty apparent that campaigns are a big part of how the system works. However, I'm unable to figure out how to create a campaign. Can anybody help me out?

# Answer
> 1 votes
After enabling the Campaign module and adding your Campaign Type, Statuses, and Engagement Index (if relevant), you can add a new campaign from either the Campaign dashboard (using the Add Campaign button) or from the Campaign menu \> New Campaign. From the docs:

---
Tags: civicampaign
---


# Question
Title: Using the link to Set up a Personal Campaign Page gives 404 page error
Sorry, I'm a newbee at CiviCRM, and frankly, I find the instructions aren't so clear. I'm trying to set up Personal Campaign pages for a fundraiser we are doing. I enabled the Personal Campaign Page settings on my contribution page, but when I click on the link it provides, it goes to a 404 page error. So I figured that maybe I needed to add short code to a new Wordpress page. The CiviCRM component isn't giving me the option for Personal Campaign page. What is the short code I should be using?

# Answer
I was able to figure it out. I had deleted the CiviCRM page so that's why it wasn't working.

Thank you!
> 1 votes

---
Tags: personal-campaign-pages
---


# Question
Title: finding members without e-mail addresses
I'm trying to create a report of members who are expired who have not provided an e-mail address so I can mail them a form.

In search builder I am using `"membership status"=expired`, `contacts->email->is empty` and it is not working. Any ideas??

# Answer
Rather than `is empty` try using `is null` in your search.
> 2 votes

# Answer
This seems to be working fine on dmaster. Which version are you using? Make sure you have filled the details properly. See below for an example -
> 2 votes

---
Tags: civimember, email, search-builder
---


# Question
Title: Disable Outbound email or change SMTP server with an SQL Query?
How can I activate the "Disable Outbound email" option or change the SMTP server address with only an SQL Query?

(My use case is when I copy live data to a test environment, I obviously want to make sure no real emails are sent from the test environment!)

Thanks,

# Answer
> 1 votes
Got it. To see current value, run:

```
select * from civicrm_setting where name='mailing_backend';

```

Because it's PHP serialise format, there is no easy change to change one value only! Sigh. I would recommend setting your app to dummy variables, then running the above to get the current value, then sticking that in a update statement to give you something like:

```
update civicrm_setting set value='a:10:{s:15:"outBound_option";s:1:"0";s:5:"qfKey";s:37:"xxxxxxxxxxxxx";s:8:"entryURL";s:131:"https://xxxxxxxxxxxx";s:13:"sendmail_path";s:0:"";s:13:"sendmail_args";s:0:"";s:10:"smtpServer";s:9:"localhost";s:8:"smtpPort";s:2:"25";s:8:"smtpAuth";s:1:"0";s:12:"smtpUsername";s:0:"";s:12:"smtpPassword";s:0:"";}' where name='mailing_backend';

```

Hopefully, in future that update statement will set your SMTP settings back to dummy variables!

# Answer
> 4 votes
In civicrm.settings.php, add the following:

```
define('CIVICRM_MAIL_LOG', 1);

```

This will route all email to files/civicrm/ConfigAndLog/mail (Drupal) or media/civicrm/ConfigAndLog (Joomla).

You can also specify:

```
define('CIVICRM_MAIL_LOG', "your_file_path");

```

to set a specific output file.

See https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers.

Another option is to perform the following queries to kill any scheduled or queued mail:

```
UPDATE `civicrm_mailing_job` SET `status`= 'Complete' WHERE `status` IN ('Scheduled', 'Running', 'Paused')
DELETE FROM `civicrm_mailing_spool` WHERE 1

```

# Answer
> 1 votes
You can use https://www.drupal.org/project/civicrm\_reroute\_email module and enable it on test env, which will reroute all CiviCRM emails to the specified email address. This will work with Drupal.

# Answer
> 1 votes
I created a small **drush** plugin that just does this. It also disables the standard drupal email. `function drush_modulename_commandname(){
 drush_print('Disabling outgoing email - drupal & civi');
 civicrm_initialize();
 $result = civicrm_api3('Setting', 'create', array(
 'mailing_backend' => array('outBound_option'=> CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB),
 ));
 if($result["is_error"]){
 drush_log('CiCRM Error'.$result['error_message'],'ok');
 }
 variable_set('mail_system',array (
 'default-system' => 'TestingMailSystem',
 'mimemail' => 'TestingMailSystem',
 ));
 drush_print('Done');
 }` Information how to create drush commands can be found on http://docs.drush.org/en/master/commands/

---
Tags: email
---


title: Update to 4.7.12 failed

text:
# Question
Title: Update to 4.7.12 failed
I updated from 4.6.10 to 4.7.12 and it failed at updating 4.7 beta 3 DB, now I cannot load the admin screen at all. This is the wordpress version. All I get now is: Sorry but we are not able to provide this at the moment. DB Constraint Violation - possibly dashboard\_id should possibly be marked as mandatory for this API. If so, please raise a bug report. Return to home page.

Any ideas on how to resolve this?

# Answer
I had the same issue when doing an upgrade to 4.7.12. I believe The problem was with the civicrm\_dashboard table. I copied the structure from a clean install of 4.7.12 and was able to get rid of the error.

*This is assuming you are starting from a point where you have reverted to a version of the site prior to attempting the update.*

**CIVICRM\_DASHBOARD TABLE** Make a backup of the civicrm\_dashboard table data. Then run the following on your DB to create the dashboard again.

Here is the SQL for my civicrm\_dashboard table schema:

```
DROP TABLE civicrm_dashboard;

CREATE TABLE civicrm_dashboard (
  id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  domain_id int(10) UNSIGNED NOT NULL COMMENT 'Domain for dashboard',
  name varchar(64) DEFAULT NULL COMMENT 'Internal name of dashlet.',
  label varchar(255) DEFAULT NULL COMMENT 'dashlet title',
  url varchar(255) DEFAULT NULL COMMENT 'url in case of external dashlet',
  permission varchar(255) DEFAULT NULL COMMENT 'Permission for the dashlet',
  permission_operator varchar(3) DEFAULT NULL COMMENT 'Permission Operator',
  fullscreen_url varchar(255) DEFAULT NULL COMMENT 'fullscreen url for dashlet',
  is_active tinyint(4) DEFAULT 0 COMMENT 'Is this dashlet active?',
  is_reserved tinyint(4) DEFAULT 0 COMMENT 'Is this dashlet reserved?',
  cache_minutes int(10) UNSIGNED NOT NULL DEFAULT 60,
  PRIMARY KEY (id),
  CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY (domain_id)
  REFERENCES civicrm_domain (id) ON DELETE RESTRICT ON UPDATE RESTRICT
)
ENGINE = INNODB
AUTO_INCREMENT = 18
AVG_ROW_LENGTH = 1365
CHARACTER SET utf8
COLLATE utf8_unicode_ci
ROW_FORMAT = DYNAMIC;

```

**CIVICRM\_DASHBOARD\_CONTACT TABLE** Make a backup of the civicrm\_dashboard\_contact table data and run the following on it. You will likely need to re-import your data to the new table.

Here is the SQL for my civicrm\_dashboard\_contact table schema:

```
DROP TABLE civicrm_dashboard_contact;

CREATE TABLE civicrm_dashboard_contact (
  id int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  dashboard_id int(10) UNSIGNED NOT NULL COMMENT 'Dashboard ID',
  contact_id int(10) UNSIGNED NOT NULL COMMENT 'Contact ID',
  column_no tinyint(4) DEFAULT 0 COMMENT 'column no for this widget',
  is_active tinyint(4) DEFAULT 0 COMMENT 'Is this widget active?',
  weight int(11) DEFAULT 0 COMMENT 'Ordering of the widgets.',
  PRIMARY KEY (id),
  UNIQUE INDEX index_dashboard_id_contact_id (dashboard_id, contact_id),
  CONSTRAINT FK_civicrm_dashboard_contact_contact_id FOREIGN KEY (contact_id)
  REFERENCES civicrm_contact (id) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT FK_civicrm_dashboard_contact_dashboard_id FOREIGN KEY (dashboard_id)
  REFERENCES civicrm_dashboard (id) ON DELETE CASCADE ON UPDATE RESTRICT
)
ENGINE = INNODB
AUTO_INCREMENT = 413
AVG_ROW_LENGTH = 199
CHARACTER SET utf8
COLLATE utf8_unicode_ci
ROW_FORMAT = DYNAMIC;

```

At that point I would try to run the update again. Let me know if it works...

If it fails again, check your apache logs (here for linux: /var/log/apache2/error.log) and see if it gives you any more detail on what is happening.
> 1 votes

---
Tags: upgrade
---


title: What is the installation canary?

text:
# Question
Title: What is the installation canary?
One of my CiviCRM instances database has the table `civicrm_install_canary`, another has not. In code it is marked as a mechanism that check whether the install has run before. But how does this mechanism work. Does it mean that the installation has been failed irreparable, and that the backup must be restored. Is er een method to fix it, or can it maybe restored (or ignored)?

The installation canary is part of the current code base (CiviCRM 4.7.12).

# Answer
> 11 votes
> What is the installation canary?

The `civicrm_install_canary` is fundamentally a test to see how well we control/understand the installation process. It's part of a bigger topic, so bear with me in giving the context.

The crux of the CiviCRM installation process has traditionally been two steps:

* Copy a config template and edit it (`civicrm.settings.php.tpl` =\> `civicrm.settings.php`).
* Load a SQL file into the database (`civicrm.mysql` *and* either `civicrm_data.mysql` or `civicrm_generated.mysql`).

When you use tools like `sites/all/modules/civicrm/install/index.php` or the Joomla installer or `setup.sh` or `civibuild` or `provision_civicrm`, these are basically all wrappers which do those two steps (plus *random-other-things*).

There are several installation-related things which aren't addressed by those two standardized steps, leading to some pain-points, e.g.

* System requirements are not enforced or communicated consistently across installers.
* If you install from `git` (instead of `.tar.gz` or `.zip`), then you need to run extra commands (`GenCode`).
* You cannot automatically activate CiviCRM extensions during installation.
* SQL triggers are generated using PHP logic. (The triggers should be generated during installation... and also when setting up custom-data or extensions...)
* If you want to use a different language, then you need to load localized `.mysql` files. The pre-generation process for this slows down developmental builds and produces slightly stale translations for users.
* PHP's MySQL API's have become a bit hostile to pre-generating SQL files.

For a long time, changing this was blocked because we simply didn't have a reliable way to add PHP logic during all installations... until someone proposed that we could do a bit of install logic during the first page-request. Sometime (maybe 4.7.0?) we introduced `SystemInstallEvent`.

Originally, the only thing `SystemInstallEvent` did was prove its own validity. The event should fire exactly once. If it fires a second time, then that's an error. Specifically, the `SystemInstallEvent` triggers the `InstallationCanary` which creates the table `civicrm_install_canary` (and failing if it already exists).

Eventually, we added `DatabaseInitializer` which also listens for `SystemInstallEvent`. During the first page-request, it runs the `System.flush` to ensure that triggers, caches, etal are current.

> Does it mean that the installation has been failed irreparable, and that the backup must be restored.

The system is probably OK. If you're getting an error, here are a few things to know:

1. On a new system (before the first page-view), the expected pre-condition is that the setting `installed` is untrue/undefined. The table `civicrm_install_canary` does not exist.
2. On an active system (after the first page-view), the expected post-condition is that the setting `installed` is true. The table `civicrm_install_canary` does exist.
3. If your system satisfies either pre-condition or post-condition, then it should be fine. You only get an error from a mix.
4. You might want to do a system flush and enable triggers, e.g.
    * Using Drupal website: `http://mysite.example.com/civicrm/clearcache?triggerRebuild=1`
    * Using drush CLI: `drush cvapi system.flush triggers=1`
    * Using cv CLI: `cv api system.flush triggers=1`

---
Tags: database, installation
---


title: Issue where soft-credits will not save

text:
# Question
Title: Issue where soft-credits will not save
We've been having this issue over at least one major upgrade where certain types of soft-credits just will not save, without leaving any type record in the error logs. Crediting an individual from another individual or organization works, but crediting an org or a household from an individual prevents the contribution from saving at all... if the soft-credit is removed the record will save fine. I took a video of what I mean and put it on YouTube here \>\> Video of soft-credit not saving

I have recently installed the Automatic Soft-credit extension Auto Soft-Credit Extension and it seems to bypass the issue, but there are many cases where I need to edit a contribution and cannot without deleting the soft-credit. Since we can't track payments toward an org or total household giving without soft-credits this leaves us with a serious issue.

Any ideas would be a great help. I am not a coder, but willing to use phpMyAdmin to look at the database or look into php code issues.

Thanks. We are on CiviCRM 4.6.22 and the latest Drupal 7 on a Debian 8 server with Apache.

# Answer
> 1 votes
Great to hear you're using my extension!

Since the extension works but the form doesn't, that strongly suggests the problem is with this form and not the database. From your video, it looks like a JavaScript issue. Here's what I would look at:

Press F12 in your web browser to bring up the dev tools.

* Look at the "Console" tab. Are there errors that appear there on save when the save fails vs. succeeds? If so, check out this post: Troubleshooting JavaScript in CiviCRM. Also feel free to update your question with said errors.
* Also check the "Network tab". Find the HTTP POST request that appears when you press "Save". Particularly, look at the "Response" subtab (I use Firefox, terminology may be a bit different with Chrome/Edge but it's all there). There is likely a helpful clue there.

---
Tags: javascript, soft-credit
---


# Question
Title: Adding a google pixel to a Contribution Page
What is the best way to integrate google Adwords to CiviCRM? Specifically we want to add a pixel to the contributions page, without messing with civi's functionality.

Thanks in advance! Jaime

# Answer
> 1 votes
You have two options:

* Set up a sidebar in your WordPress theme that only appears on contribution pages that contains the pixel. I know how to do this in Drupal using Blocks; I don't know how to do it in WordPress off the top of my head, but I'm sure it's doable.
* If you are or have access to a coder, you can write a CiviCRM extension to do this. I've written one for Facebook Conversion Pixels for successful donations. My guess is you could modify this pretty easily, or hire someone to do so.

---
Tags: wordpress, civicontribute, google
---


# Question
Title: How to use Amazon Simple Email Service for only verified email sender addresses
I have a site running SES for outgoing mail. It works just fine to send out mass email from the domain, but it fails every time I try to share a PCP from a non verified email.

For example if I create a PCP from the main account on civicrm, and I use the SES verified email address, the PCP sharing works just fine.

On the other hand if I create a PCP from my personal email address and try to share the PCP, then the send fails (Amazon SES does not accept unverified email senders).

Is there a way to use mail() instead of AWS SES for this? or a way to allow for the domain to be validated?

# Answer
> 1 votes
I have a similar setup, but I have solved this outside CiviCRM. In CiviCRM, I configured the *mail()* send option. The effect is that the mail is routed by the local Mail Transport Agent. On my system, I use *postfix* for this task.

Postfix can be configured to relay an email to an email service dependent on the email address. Use to do this the **sender\_dependent\_relayhost\_maps** parameter. An example can be found in this answer on the Unix site.

It is a good practice to send bulk mail with Amazon SES to prevent the email to be marked as spam.

# Answer
> 0 votes
While Kainuk's answer is better, a partial (but simpler to implement) solution is to prevent those emails altogether with the Outbound Domain Enforcement extension.

---
Tags: pcp, smtp, amazon, amazon-ses
---


# Question
Title: Did anyone have a problem with CKEditor after 4.6.22 upgrade?
After updating my Civi installation from 4.6.x to 4.6.22, my CKEditor was broken (blank screen in edit window, all areas).

# Answer
After checking my js console, I found my justify plugin folder was missing:

../civicrm/packages/ckeditor/plugins/justify \<= folder missing

I downloaded the plugin from here: http://ckeditor.com/addon/justify

Expand the .zip in plugins folder, it will create the justify folder and fixes the problem.
> 3 votes

# Answer
It looks to me like that plugin is *not* missing in the latest 4.6. But it's incorporated into the build of CKEditor, not in a separate file. Maybe you just needed to clear your caches?
> 0 votes

---
Tags: ckeditor
---


# Question
Title: Format Contribution Form Using Pricesets
We are creating a contribution page using a price set which is new to us. The format is a little weird. Is there a way to align the email address with the entries above it? Or can we eliminate the email address above the 'Donor Info' like and include it into the profile below? See image below.

Thanks in advance.

Using Civicrm 4.7.8 and Joomla 3.5.1

<sub>(source: corvair.org)</sub>

# Answer
> 0 votes
CiviCRM uses page template files to render its pages. These can be customized. On the developer Wiki is described how this is done. See https://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates .

The template where you can change the offending email lay-out is `[civicrm.root]/templates/CRM/Contribute/Form/Contribution/Main.tpl`

Search for the following code:

```
{assign var=n value=email-$bltID}
<div class="crm-public-form-item crm-section {$form.$n.name}-section">
  <div class="label">{$form.$n.label}</div>
  <div class="content">
    {$form.$n.html}
  </div>
  <div class="clear"></div>
</div>

```

# Answer
> 3 votes
For a short-term solution, consider adding some css to your page that fixes the styling.

For the medium-term, check out issue CRM-15067 which aims to solve this problem.

---
Tags: civicontribute, price-sets
---


# Question
Title: Can't Remove CiviCrm Membership Type From Being Visible Publicly
I tried disabling, making visibility admin only, and then finally deleting a specific CiviCrm Membership Type, but still can't remove it from being seen publicly on Contribution Page. Anyone know what is causing this and how to fix it?

FYI I was able to edit other membership types and those changes became visible.

Using Wordpress 4.6.1 Using CiviCrm 4.7.7

Thank you!

# Answer
I just saved the changes in the contribution page and that somehow fixed it. Not clear how the price changes updated (without saving) but not the actual membership type, but that's okay.
> 1 votes

---
Tags: civimember
---


title: Cron Error/CiviMail Stalled

text:
# Question
Title: Cron Error/CiviMail Stalled
Users reported that CiviMail is not pushing their messages. The scheduled mailings have Started, but not Completed. When I go to scheduled jobs and manually execute the Send Scheduled Mailings, it refreshes the page but doesn't send the mail. When I go to my host control panel and initiate the Cron manually, I receive the following error:

**Notice**: A session had already been started - ignoring session\_start() in **/home/mysite/www/www/includes/session.inc** on line **287**

I found a few "solutions" via Google that involve editing the session start php code.

For instance I entered this into the root php.ini file:

```
if(!isset($_SESSION))
{
    session_start();
}

```

It clears the error when running the cron manually, but it doesn't actually send the pending messages in Civi.

The log says:

> Parameters parsed (and passed to API method): a:1:{s:7:"version";i:3;}
>
> Full message: Finished execution of Send Scheduled Mailings with result: Failure, Error message: DB Error: syntax error

There was another "solution" to add "php\_flag session.auto\_start 0" to the .htaccess file. When I tried that, it gave me server not found errors when trying to access the site.

I also cleared my \_sessions table to see if that fixed the issue. No dice.

Does anyone have a possible solution to this issue? Thank you.

Civi 4.7.12 Drupal 7.51

Edit: 10-29-16 / 2159 to add log error message.

# Answer
> 1 votes
Kainuk referenced a post that I missed regarding this issue. It appears that after scheduling the mailings, users were deleted from the groups to whom those mailings were scheduled to send. A quick cancellation of those messages, then re-using them solved the issue.

---
Tags: civimail, drupal, cron-job, 4.7.1
---


# Question
Title: Rule will not create drupal user record for CiviCRM contact
Was trying to set up a rule to create drupal user records linked to CiviCRM records that do not have them, The rule is this:

EVENT CiviCRM Contact has been created
Contact has been updated

Conditions NOT Drupal User Account can be created for user (this condition creates the user) Parameter: CiviCRM Contact: \[civicrm-contact:civi-user..., Activate Account: true, Send account notification email: true, Instant signin: false

Actions Create or Load Linked Drupal User Account Parameter: CiviCRM Contact: \[civicrm\_contact\], Activate Account: true, Send account notification email: true Provides variables: Created or Loaded Drupal User (civicrm\_user)

Show a message on the site Parameter: Message: Drupal User Linked or...

Unfortunately we don't seem to be able to trigger the rule by updating a contact, we just seem to get this error in the watchdog:

MESSAGE Unable to get variable civicrm\_contact, it is not defined.

Does anyone know how to get this working? Thanks!

# Answer
There was a blog here about creating Drupal users by adding a civicrm tag (as one option for achieving this) and triggering a Drupal Rule from that which you may find it useful.
> 1 votes

# Answer
There's a working recipe on this CiviCRM wiki page. There's also an excellent discussion on the old forums here. In particular, I'd make sure you have all the modules named on that second link installed.
> 3 votes

---
Tags: drupal, user-account, rules
---


# Question
Title: Update custom field in CiviCase using batch profile?
I made a custom field in CiviCase and since I have hundreds of records where this field needs updating, I'd prefer to do it using batch update with profile.

I made a profile containing the custom field plus one other case field.

So I've tried: Find the records using advanced search, display the results as contacts - the profile I want to use is not available. Find the records using advanced search, display the results as cases - batch update via profile is not available. Find the records using 'find Cases' from CiviCase - batch update via profile is not available.

Thanks for any help.

# Answer
There is a write up here about using the API. May not be a lot of help to you but worth adding to the thread. I found it, and your question, while similarly searching for a solution to needing to 'bulk update' Cases - and having found and failed (in our situation) with VBO and Views it may be a case, for us at least, that we need to do some more development with VBO and civicrm Entities
> 1 votes

---
Tags: profile, civicase, batches
---


# Question
Title: Does Using CiviMail for mailing lists on AWS violate the AWS Terms of Service?
I noticed on a blog on the site (https://civicrm.org/blog/andrewhunt/alternatives-to-mandrill) a suggestion to use Amazon SES as an alternative to Mandrill for emails, and I also noticed an old CiviCRM/Drupal image on Amazon Marketplace. We've customized CiviCRM for a customer who is already using the software for their email campaigns and wanted to deploy on AWS but we're concerned about terms of service preventing the facilitation of mass unsolicited emails. Does anyone have experience with this?

Specifically the Amazon terms state:

You will not distribute, publish, send, or facilitate the sending of unsolicited mass e-mail or other messages, promotions, advertising, or solicitations (like “spam”), including commercial advertising and informational announcements. You will not alter or obscure mail headers or assume a sender’s identity without the sender’s explicit permission. You will not collect replies to messages sent from another internet service provider if those messages violate this Policy or the acceptable use policy of that provider.

# Answer
"Probably, no."

This seems to be a legal question, and CiviCRM is a tool. CiviCRM provides a lot of support for *not* violating those terms ... but someone could still contrive ways to break the agreement, so as with any tool it's how you use it that really matters.

If a large number of spammers used a specific tool, you might see bans targeted against the tool itself. I don't think this is the case for CiviCRM.

> You will not distribute, publish, send, or facilitate the sending of unsolicited mass e-mail or other messages, promotions, advertising, or solicitations (like “spam”), including commercial advertising and informational announcements.

If your emails are solicited (opt-in) you should be OK here.

> You will not alter or obscure mail headers or assume a sender’s identity without the sender’s explicit permission.

CiviCRM should be OK here, provided you aren't pretending to be someone else.

> You will not collect replies to messages sent from another internet service provider if those messages violate this Policy or the acceptable use policy of that provider.

This applies the policy to inbound/return email also.
> 2 votes

# Answer
What part - specifically - are you worried about? That statement certainly all seems completely in line with Canadian Anti Spam Legislation:

http://fightspam.gc.ca/eic/site/030.nsf/eng/home

In a (very tiny) nutshell - users must opt-in to receive Email from you.
> 1 votes

---
Tags: civimail, amazon-ses
---


# Question
Title: Could not create a database trigger on AWS RDS
I am installing CiviCRM in Amazon AWS environment. User civicrm has full rights on civicrm database. I certainly see TRIGGER among all others in my phpMyAdmin console. Out of abundance of caution I even gave global TRIGGER permission. Still, I am getting the error. I had a test installation with DB running on the same server as web server and didn't have any problems. Don't know if CiviCRM doesn't see TRIGGER permission because of different host, or because of RDS limitations, or yet something else.

Web Server is Amazon Linux (similar to Fedora/CentOS); Apache 2.4; MySQL is 5.6.27

**UPDATE**: I tried "root" account and I get the same error. I don't think (or at least I don't know how) I can spool the SQLs that get generated - so if somebody can point me to a query that tries to create a trigger and fails, that would be awesome!

# Answer
On https://stackoverflow.com/questions/8919907/can-i-create-trigger-in-an-rds-db is described how database triggers can be created on Amazon RDS.

Short summary:

* Create a new Parameter Group.
* Set `log_bin_trust_function_creators` to 1.
> 4 votes

# Answer
Turns out, Amazon RDS by default turns on binary logging that prevents "CREATE TRIGGER" to succeed, and CiviCRM interprets this as insufficient permissions. More here. For now I turned off automatic backups and completed installation successfully.
> 4 votes

---
Tags: database, installation, amazon
---


title: Error on CiviCRM Installer Page

text:
# Question
Title: Error on CiviCRM Installer Page
Warning: Invalid argument supplied for foreach() in /public\_html/wp-content/plugins/civicrm/civicrm/install/index.php on line 769

I'm also receiving the following under PHP Configuration: MySQL support not included in PHP.

I'm using Wordpress Version 4.6.1, CiviCRM Version 4.7.12, and PHP Version 5.5

I'm not sure if they're related issues or not.

Any advice?

Thank you

# Answer
> 1 votes
It sounds like you might be getting affected by this switch to require the mysqli extension: https://civicrm.org/blog/totten/psa-please-verify-php-extension-mysqli

---
Tags: wordpress, installation, mysql
---


# Question
Title: Considerations when choosing a theme for Drupal 7 + CiviCRM?
I'm helping a non-profit with their website and we have chosen to go with Drupal 7 + CiviCRM, and are now looking at different themes

In the feature list for the Danland theme it says that it is "CiviCRM friendly", implying that other's might not be, so I'm wondering: **What we need to think about when choosing a theme for our Drupal 7 website?**

(More specifically: I have for example been looking at the Bootstrap theme which is the most popular, will this work well with CiviCRM?)

Grateful for help and with kind regards, Tord

# Answer
> 5 votes
One consideration is to use different themes for the front office and the back office.

* The *front office* are the profile pages used to gather information from the constituents (or maybe you are using webforms in combination with webform\_civicrm). These should be themed according to the official stylebook of your organization. They are part of the marketing strategy. It is often a limited set of screens, so almost any theme can be selected. But in these days responsive is a must, making bootstrap a good option.
* The *back office* are standard CiviCRM screens used by your internal staff for searching and processing the data. These are complex screens, that work best with a simple, readable theme that uses the complete screen. I use adminimal for this task.

More of this discussion can be found at Theming Civi Vs Drupal.

---
Tags: drupal, theme
---


# Question
Title: DB Constraint Violation in - possibly domain_id
I have been presented with the following error on when using civicrm-webform and paypal standard:

CiviCRM\_API3\_Exception: DB Constraint Violation - possibly domain\_id should possibly be marked as mandatory for this API. If so, please raise a bug report. in civicrm\_api3() (line 45 of /home/shishukunj/www/www/sites/all/modules/civicrm/api/api.php).

Is this a site specific issue or something to do with the core or the module?

Happy to help fix in either case as we are now committed to using 4.7 but need to iron out the bugs as we using webform-civicrm, related permissions and paypal payments heavily.

# Answer
> 1 votes
This is NOT AN ANSWER but I am not allowed to comment since I only have 49 points. Seems ridiculous to me since I have been working with CiviCRM for over 8 years. Anyway I have the same problem as described above except that I am using eWay Payment processor. Is anyone able to respond with advice on this issue?

---
Tags: webform-civicrm, extension, contributions, paypal, civicrm-entity
---


# Question
Title: How can I filter click-through reports by date range?
long time user of civicrm. Have 4.7.6 installed on Drupal 7 in a linux environment and I'd like to look at an old email's metrics. I see I pull up specific URL click-through metrics, but it shows me ALL the clicks since I sent out the email to-date. I'd like to filter those results to only include a specific date range, but am having difficulty in finding how to do this. I would even be comfortable exporting all the results myself and then filtering in excel, but the export doesn't include dates at all. Am I the only one who needs this kind of thing? If I have to go into the DB tables to find what I'm looking for, where can I find it?

# Answer
There is currently no date filter on the mailing reports.

Adding date filters to the mailing reports and submitting a patch back to core would be one way to solve your problem. https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Mailing/Clicks.php shows the code that generates the clickthrough report. Adding a date filter to that *might* not be too difficult to do.

It would end up being similar to the date time filter in the activity report: like the https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Activity.php#L261 but from the looks of things you'd have to do a bit more playing around with the Report class than just adding it.

The mysql tables you are looking for are `civicrm_mailing_event_trackable_url_open` (which has a timestap) and `civicrm_mailing_trackable_url`
> 1 votes

---
Tags: civimail, reports, dates, click-through
---


title: "on hold" - what happens with mailings

text:
# Question
Title: "on hold" - what happens with mailings
Given that a contact may have a number of email addresses, what happens if one of them are on hold (bounce) when that contact is to receive a mailing?

There may be a number of scenarios here, I suppose, depending on if one of them is marked specifically for use for mass mailings.

Does another address get used? If so, even if a special mass mailing address was indicated?

# Answer
> 2 votes
CiviCRM will not try and send to an email address that is marked on hold (regardless of any other characteristics of that email (primary, bulk mailings).

If a contact has multiple email addresses and one or more of them is on hold, then CiviMail chooses the 'next' available email address and tries to sent to that.

More background here: https://docs.civicrm.org/user/en/stable/email/maintaining-healthy-email-lists/#what-do-i-do-if-an-address-is-put-on-hold

---
Tags: civimail, mailing
---


title: User info overwritten by new member

text:
# Question
Title: User info overwritten by new member
I created a contribution page to allow new members to sign up. Then I just signed up with the email of an existing member but other info (like a different name, address). As a result: the info of the existing member gets overwritten (name, address) in civicrm. I found out that the profile-setting for duplicate contacts is being ignored for online contribution pages (I don't really understand why ...), but even creating a new Duplicate Contact rule with type Unsupervised (specifying lastname,firstname and email) results in the same behavior. So: is there any way of blocking new members from changing the info for already existing members via a regular contribution-membership page?

# Answer
The issue was with your dedupe rules as you had not entered weights. You can't leave the weights empty.

Try reading civicrm.org/blog/spidersilk/understanding-civicrm-dedupe-rules or https://docs.civicrm.org/user/en/stable/common-workflows/deduping-and-merging/.

I think the former makes it a bit clearer about weight. But basically you need to have a weight, eg email 2 first 10 last 10; threshold 22, so that it means it must score a match on the email AND the first AND the last

reason for a lower 'score' on the email is that if a contact has 4 emails all of which are the same, then each 'counts' hence if you set email as 10, and first as 10 and last as 10, threshold 30, then the email by itself would score a 40 and hence 'match' even if first and last did not match! hope that helps
> 4 votes

---
Tags: civimember
---


# Question
Title: Joomla account creation fields not appearing on profile forms
I have exactly the problem listed in this forum post:

https://forum.civicrm.org/index.php?topic=11260.0

I'm not able to create any Joomla user via a CiviCRM profile form, because the Joomla user registration fields do not appear on the profile.

* the "Allow User Registration" option in User Manager is set to "yes"
* I've tried setting profiles to both "Give option" and "Require" Joomla account creation
* I've tried custom and simple out-of-the-box profiles
* Permissions all seem to be correct (anonymous users are allowed to create profiles, see all custom data fields, etc.)

I do also have Community Builder installed, but as far as I could discover that shouldn't cause any problems with the fields appearing.

Any ideas what else to check, or how to troubleshoot this further?

# Answer
> 0 votes
Community builder has a plugin called Community Builder System plugin that can be set to redirect or rewrite Joomla user component URLs. Perhaps this interferes and as a result keeps the field set of user registration URLs inaccessible and so out of view in the profile form.

I thank you for your check-list of steps to get the account creation fields to show themselves. It rescued me when I did not know how and why they kept not appearing in a new profile I was trying to get working. So: well formulated question that answered me in my quest.

---
Tags: profile, joomla
---


# Question
Title: Create Drupal user for contact joining as Organisation
Running Drupal 7.43 and civicrm 4.7.12.

We sell memberships to individuals and organisations.

The creation of an Individual works fine. The contact is created and the Drupal account created.

When signing up as an organisation with a name/address/email/create drupal profile, I get the error:

```
DB Error: already exists.

```

And the fatal error in Drupal logs:

```
$Fatal Error Details = Array ( [callback] => Array ( [0] =>
CRM_Core_Error [1] => handle ) [code] => -5 [message] => DB Error:
already exists [mode] => 16 [debug_info] =>
   INSERT INTO civicrm_uf_match (domain_id, uf_id , uf_name , contact_id)
   VALUES ( 1 , 1229 , 'user@ns9.com' , 2603 )
[nativecode=1062 ** Duplicate entry 'user@ns9.com-1' for key
'UI_uf_name_domain_id'] [type] => DB_Error [user_info] => INSERT INTO
civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,
1229 , 'user@ns9.com' , 2603 ) [nativecode=1062 ** Duplicate entry
'user@ns9.com-1' for key 'UI_uf_name_domain_id'] [to_string] =>
db_error:
message="DB Error: already exists" code=-5 mode=callback
callback=CRM_Core_Error::handle prefix="" info="INSERT INTO
civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,
1229 , 'user@ns9.com' , 2603 ) [nativecode=1062 ** Duplicate entry
'user@ns9.com-1' for key 'UI_uf_name_domain_id']"] )

```

Weird thing is that it seems to work fine.

* Organisation is created and given membership.
* Individual is created with relationship to organisation
* Drupal account is created for Individual

But they are just given the error and not logged in.

I can get them to manually create an account after creating membership and link it to their civicrm contact, but it seems like an unneeded extra step for users.

Maybe I need to use civicrm\_entity and trigger a rule? Thanks

# Answer
> 2 votes
In the database table that links CMS users to CiviCRM contacts, we store a few things:

* The CMS user ID (in Drupal's case, the "uid")
* The CiviCRM contact ID
* The email address that both records have in common.

Crucially - all three must be unique! For instance, you can't have a single CiviCRM contact linked to two Drupal user accounts.

The error you're seeing says, "Hey, Civi tried to create a link between a Drupal user and a Civi contact, but we found that another record in this table already uses that same email address."

Based on that - I'd guess that something about your setup is causing Drupal to try to create two user accounts at once - one connected to the individual and one for the organization.

Without knowing more about your setup, I can't tell you the exact steps to fix it, but hopefully this will make the solution clear to you.

One last thing: In CiviCRM, there's a philosophy of not creating "organization" accounts. "Organizations" can't log into websites; individuals can. So if what you're trying to do (it's not 100% clear from the question) is create two logins, consider instead using the relationship permissions to allow the individual to edit the organization instead.

---
Tags: drupal, civimember, contributions, user-account
---


# Question
Title: Error Backing Up Database using drush: Call to undefined function drush_sql_dump_execute()
I am running Drupal 7.37 and CiviCRM 4.3.8. I am in the process of upgrading both, but currently get an error when manually creating a backup of the CiviCRM database. All regularly occurring daily backups are fine.

I used this command:

```
root@web:/path/to/docroot# drush civicrm-sql-dump > ../civicrmdatabase-backup1610312230.sql

```

Which returned:

```
PHP Fatal error:  Call to undefined function drush_sql_dump_execute() in /var/www/html/civicrm/v4.3.8-d7/drupal/drush/civicrm.drush.inc on line 959
Drush command terminated abnormally due to an unrecoverable error. Error: Call to undefined function drush_sql_dump_execute() in /var/www/html/civicrm/v4.3.8-d7/drupal/drush/civicrm.drush.inc, line 959

```

It may be helpful to know that I am using a symlink from the Drupal modules folder to the civicrm install folder for now. Any insight into this error or an alternative to taking an immediate backup without installing anything would be appreciated, thanks!

# Answer
I would bet almost 100% that you're using drush 7 or higher. The function `drush_sql_dump_execute` doesn't exist in drush 7. Support for drush 7 was added as of CiviCRM 4.5.5 - see CRM-15567.

That link suggests that drush 6 has the same problem. I would recommend using `mysqldump` until you're upgraded.
> 2 votes

# Answer
I ended up being able to take a backup with the mysqldump command instead, but still wonder why Drush didn't work for it.

```
mysqldump -u -p database_name > backup_name.sql

```
> 1 votes

---
Tags: error, drush, backups
---


title: CiviCRM Multi-value Custom Data empty

text:
# Question
Title: CiviCRM Multi-value Custom Data empty
My civicrm version 4.6.2. Drupal version 7.51. I visited on this URL of the feature to test is /civicrm/import/custom?reset=1 This feature was not working correctly, such that if a custom field set was used for a specific Contact Type "individual". Here is the screenshot of my custom data screen.

I can't see any custom field in dropdown box. It is fresh installation. How can I get custom data there?

My task is to check import system in civicrm. I have a csv file. I have to import data here through this section just this my task. But here custom data required and I can't see dropdown value here. but I have custom data I checked.

# Answer
Based on your answer, you don't have any multi-value custom data, which is why the drop-down in question is empty. To import custom data, please use the normal import screen, found at **Contacts menu \> Import Contacts**.
> 1 votes

---
Tags: import, multi-record
---


# Question
Title: Date confusion with relationships - start date can be later than end date
When adding relationships, I have found that the start date entered can be a later date than the end date of the relationship without any error being indicated.

Is this intentional or can I "fix" it so that a user cannot enter a relationship with this error as displayed below

# Answer
> 1 votes
This is almost certainly not intentional. You can fix it if you're a programmer or have access to one!

---
Tags: error, relationships, dates
---


# Question
Title: Repeat Contributions Report - Where Is Data Pulling From?
We are new to CiviCRM and have just started importing data and running checks. We have imported the last five years of our donor contribution information and all of the data is correct in the BOOKKEEPING TRANSACTIONS REPORT but when running a REPEAT CONTRIBUTIONS REPORT the totals don't match even though the listed transactions and totals match the BOOKKEEPING TRANSACTIONS and our imported csv file. All of the filters and dates are identical. We thought this might have to do with merged or deleted records? We did permanently delete records that included contributions was this incorrect?

Any hints are appreciated - Thank You, Kim

# Answer
CiviCRM has a notion of recurring contributions that is slightly more than just repeated transactions with the same information. Users can set up a series of contributions on a monthly or annual basis (or actually daily or weekly) that will charge an online payment processor appropriately. There is a separate table for storing the information about the recurrence, civicrm\_contribution\_recur, which is accessible via the API. Note that you can connect contributions to the appropriate record in this table by setting civicrm\_contribution.contribution\_recur\_id.
> 4 votes

# Answer
Assuming you're just importing old data for reference, then a simple solution would be to introduce a custom financial type 'legacy recurring' or some such thing and assign that financial type to all the recurring contributions that you import. CiviCRM won't consider them 'recurring' by default in it's reports, but you can create your own to generate the information you want. Most of the functionality from setting them up as CiviCRM recurring contributions might be misleading anyway.

As Jon notes, you'll need a separate strategy for actually migrating over those recurring contribution schedules in a way that will continue working, which will depend on your payment processor.
> 2 votes

---
Tags: civireport
---