title: Recurring Payment Issues

text:
# Question
Title: Recurring Payment Issues
I have a site that is using PayPal Standard as their Payment Processor and WordPress as the CMS. After the upgrade from 4.4.x to 4.5.8 Recurring Payments are no longer working.

Could this be related to issues where the PayPal IPN callback fails? I suspect that the issue is that PayPal is not communicating properly with the site. Where can we find the code that would handle this?

# Answer
> 4 votes
Currently this is working on my development site:

Code removed as the actual solution is now in CiviCRM v 4.6.3

The first part is gets the payment status to flip to completed, the second section lets the IPN call back complete and send the email. This is by no means perfect as if wp-load.php is NOT in the doc root it will fail.

It is a working solution for now. Will comment if a better more flexible solution can be found

Patches for this problem are documented here: https://issues.civicrm.org/jira/browse/CRM-15629

CiviCRM version 4.6.3 for WordPress fixes the issue

# Answer
> 3 votes
There's a bug report that sounds like the same issue - it's because the WordPress wp-load.php file isn't getting bootstrapped properly in some circumstances. I had a similar problem and used Brian Shaughnessy's fix, which worked - but Kevin Cristiano reported that he needed to also alter an IPN file.

I got fed up with counting relative directories, so my actual code in CRM\_Core\_Permission\_WordPress was:

```
    if (!defined(ABSPATH) || !defined(WPINC)) {
      $path = $_SERVER['DOCUMENT_ROOT'];
      $path .= "/wp-load.php";
      require_once($path);
    }

```

Obviously alter the location as your setup requires...

# Answer
> 0 votes
I think we have the same issue in Drupal CiviCRM 4.5.5. PayPal IPN history shows the notifications are being sent through, but nothing is being recorded or updated in CiviCRM.

Thesee are recurring contributions which were previously set-up successfully.

---
Tags: wordpress
---


title: CIVIEVENT shopping cart status

text:
# Question
Title: CIVIEVENT shopping cart status
I'm considering testing the shopping cart functionality in CiviCRM's CiviEvent module (installed here with Drupal 7) and was wondering if anything has changed in the description page on the CiviCRM site that includes bug reports. I saw it was last updated in 2013 - thought I'd check.

Thanks!

# Answer
> 3 votes
There have been no significant changes or modifications to the shopping cart functionality in CiviEvent. You might want to give it a shot and see if it does work for you and/or meets your needs.

I suspect that code needs some love and care and might require some developer skills to fix and improve. There is no maintainer for that part of the civievent code base

# Answer
> 2 votes
I'm talking to Dave Greenberg about this later today actually so I'll let you know. But from my initial tests, it needs some work to get working smoothly.

Jon-man

---
Tags: civievent, documentation
---


# Question
Title: Message: "CiviCRM does not have permission to write temp files" after login into back-end Joomla
My host updated PHP to 5.5. last night. Now, I can't login to my Joomla back-end because of an error. It says that CiviCRM does not have permission to write temp files.

What can I do to make sure that I can login to Joomla again? I was thinking about:

a) Deleting all files in media/civicrm/templates\_c or

b) Disabling all CiviCRM folders

Any help or tips would be great.

# Answer
They may have changed how they're running PHP for your hosting, which could lead to your old templates\_c files being unwritable to the new PHP process.

As Lobo's comment advises, removing the files and ensuring that the `templates_c` is world-writable should resolve the permission issue.

It'd be ideal if `templates_c` belongs and is writable only to the new PHP process.
> 3 votes

---
Tags: joomla, upgrade, php
---


# Question
Title: How to enter a discounted fee after the discount date for an event
Using CiviCRM v4.5.8 with WP v4.2.2 and no Price Set, using Regular Fees and Discounted Fees

We have a 5K Run Event with a discount fee of $20 before June 1 and after that date the fee is $30. Some of the participants sent in payment via mail. When we are manually entering them we can not enter the discount amount. It is defaulting to the amount after June 1. We are selecting "Advanced Discount" in the Discount set area but it does not change the amount that we can select. Is this a bug or am I missing something? THANKS.

# Answer
One way to handle this involves using a price set. Insert a price field with the value of `-1` called *Discount* that is visible only by Admin. This allows you enter a discount to registrations entered in the back-end without affecting the front-end pricing.

I believe the only way to do this without using a price set is to change your advance discount date, enter your mail-in registrations, and then reset the date. This does run the risk of people getting the discount rate if they register while you are entering the mail-in registrations.
> 2 votes

# Answer
One option is to use the CiviDiscount module. You can set up a promo code for $10 off, with the code known only to back office users. When adding the registration, apply the code.
> 2 votes

---
Tags: civievent
---


# Question
Title: Using a Java Applet in CiviCRM Extension
Does anyone have any idea how to get a Java Applet to work in a CiviCRM Extension? In particular, I'm trying to load the QZ-Print applet.

The first problem I'm having is getting the location of the jar. Currently the code to embed the applet is (where the applet is in www/qz-print/ dir on the localhost):

```
<applet id="qz" name="QZ Print Plugin" code="qz.PrintApplet.class" archive="/qz-print/qz-print.jar" width="100" height="100"></applet>

```

The code is in the main page TPL file for my extension. This seems to (sometimes) completely hang the web page/browser... On the occasion where it does load the page, I get the following: "SecurityException JAR should not contain JNLP-INF/APPLICATION.JNLP".

Anyways, I'm at a loss for what to do right now. Any help on getting an applet to work with an extension would be greatly appreciated.

UPDATE: So I looked into this and realized that I need to load the JNLP file. So I'm doing that now. HOWEVER, I'm having trouble getting the path to the jnlp/jar file. When working with an extension paths aren't typical.

How does one go about getting the path to the JAR/JNLP within an extension?

Thanks!

# Answer
> 2 votes
It looks like the archive path is incorrect. You can make it an absolute path by assigning it to the template from php:

```
$path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('myextension');
$this->assign('basePath', $path);

```

Your archive url can then begin with the smarty variable `{$basePath}`

---
Tags: extension
---


# Question
Title: Enabling membership reminders - will it only mail expirations valid this day?
On a newly imported database, I am about to enable membership reminders. The first reminder is set to two months before expiration.

Can someone reassure me this mail will not get send to members that have *passed* the two months date, and are now eg 1 month before expiration ? And in particular, that it doesnt get send out to expired members ?

I guess I am asking - how does 'send\_reminder' work ? Does it mail out on one particular day, or does it mark members to be mailed because they pass a treshold, and unmark them when done ? Because in the latter case, members that are due to expire in one month *would* receive the 2 month notice too, which is bad.

# Answer
My advice would be to test this carefully in a test environment with the setting 'Outbound Email' set to 'redirect to database'. This means emails do not actually get sent, but you can see them in the database, and so also in the contact summary. That would be the best way to reassure you. Whatever someone says here about the core CiviCRM functionality, it will not show you what will happen in your specific installation and configuration. So I would always strongly recommend a local test.
> 2 votes

# Answer
Echoing Erik, test it to be sure your configuration does what you want it to (there are at lot of variables in play... hard to say exactly what it will do). Note that Civi has an internal record for whether or not a reminder has been sent, so if you do your testing on a live server it may not send that particular reminder again. So use a test server, set the email to "redirect to database" and see what happens.

Also see Where/How does CiviCRM track sent reminder notices?
> 1 votes

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


# Question
Title: Why doesn't creating a case from API work?
I think this is a bug.

From the API Explorer, I can successfully run this to create a new case, and it is auto-populated with the default Sequence:

```
$result = civicrm_api3('Case', 'create', array(
  'sequential' => 1,
  'contact_id' => 4243,
  'case_type_id' => "member_application",
  'creator_id' => 1033,
  'subject' => "Application",
  'medium_id' => 6,
));

```

But running that same code as a hook fails with the error:

```
CiviCRM_API3_Exception: "source_contact_id is not a valid integer"

```

It actually does create the case and the initial Open Case activity, but seems to fail while trying to create the first activity in my Sequence, which is not created.

I can fix it by editing api/v3/utils.php and adding this at line 1956:

```
if ($fieldValue =='user_contact_id')
  $fieldValue = 1033;

```

I think what's happening is that somewhere along the line, it sets the value of source\_contact\_id to 'user\_contact\_id'. The \_civicrm\_api3\_validate\_integer function is supposed to replace this with the currently logged in user. This works correctly when running from the API Explorer, but not when running from a hook.

The proper solution would be to pass the API "creator\_id" through to "source\_contact\_id" for the extra activities, but I don't know how to fix that. My hack to hard code the contact works for me for now.

# Answer
Thanks for sharing this, I agree that it looks like a bug. Instructions on filing a bug report here: https://civicrm.org/bug-reporting
> 2 votes

# Answer
I believe this is normal behavior for the api, although the error message is a bit obtuse. By default it will not create cases or activities (or anything else for that matter) if the logged-in user does not have permission to do so.

Add `'check_permissions' => 0` to your api params if you wish it to proceed without permission checks.
> 0 votes

---
Tags: api, civicase
---


title: mail_report format parameter

text:
# Question
Title: mail_report format parameter
When configuring a Mail Report to be sent via Scheduled Jobs, using 'mail\_report' API call, I need to pass the 'instanceId' and 'format' parameters.

For the 'format' parameter I have the options 'csv' (to output the report as a CSV file), 'print' (to output the report as printer-friendly HTML) or if I ignore the parameter, I have a PDF report.

Also, I can input a sendmail=0, that tells the job NOT to email the report, so I can use this in combination with print or csv format to only write report to stdout.

If I use the 'format=print', the job always write to stdout. My problem is that stdout, in this case, is the server's cron, what makes cron send an email to the administrator with the report, what I don't want to happen. Is is possible to tell the job **NOT** to write the report to stdout?

# Answer
Yes, if the problem is the stdout being sent to cron, I can avoid it appending "1\>/dev/null 2\>/dev/null" to the end of the command in the cron script called. This makes both stdout and stderr to be sent to null.
> 2 votes

---
Tags: civireport, cron-job
---


# Question
Title: Extension Manager fails and so do certain scheduled jobs
I am using civicrm ver. 4.6.2 on Drupal 7; PHP version is 5.3.29, safe mode is off and open\_basedir is not set:

When I try to upgrade through extensions manager I get:

WARNING: The downloader may be unable to download files which require HTTP redirection. This may be a configuration issue with PHP's open\_basedir or safe\_mode.

Unable to extract the extension.

Extension Upgrade Failed Download failed - ZIP file is unavailable or malformed

Also, the scheduled jobs for iatapayments fail:

Entity: Job Action: IatsRecurringContributions Summary Finished execution of Call Job.IatsRecurringContributions API with result: Failure, Error message: API (Job, iatsrecurringcontributions) does not exist (join the API team and implement it!) Details

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

Full message: Finished execution of Call Job.IatsRecurringContributions API with result: Failure, Error message: API (Job, iatsrecurringcontributions) does not exist (join the API team and implement it!)

I believe problems must be related. Anyone know how to resolve this? I believe my resource directories and urls are configured properly. Everything is in the right place.

# Answer
> 6 votes
I was able to reproduce your issue and fix it on my Linux install.

1. It seems to only happen with Linux, not MacOSX.
2. I can fix it by changing the filename of the job to be first letter caps only, i.e. not camel case. Don't make any other changes.

Following the advice in various other locations, including civix or related issues, does not fix it (shortening, changing to all lower case, etc.).

I think part of the noise of this issue is related to changes in the upcoming v4 api which are not true of the v3 api that were introduced in 4.6.

My suspicion is that this patch is responsible for breaking things: https://github.com/colemanw/civicrm-core/commit/bfcb4795c83dc61e854f4268ef149b6c761636aa

# Answer
> 1 votes
There seem to be two issues in the question:

1) Downloads in the extension manager fail on HTTP redirection (which in turn causes the malformed zip issue).

* It sounds like you already know how to work-around this issue -- by manually putting the files in place. If using this technique, you should do it consistently (for both installation and upgrade).
* See also: https://issues.civicrm.org/jira/browse/CRM-14126

2) The API call used by the cron job is missing/unknown. This sounds like a bug for which you may want to report, but there are a few areas one might investigate:

* The current iATS module (v1.3.2) does not advertise compatibility with Civi v4.6. The unreleased master version does (but it's... unreleased).
* That API action has a long, multiword name. Civi v4.6 tightened the way it handles these kinds of names. https://issues.civicrm.org/jira/browse/CRM-15988
* That API action has a long, multiword name. Calling that API requires translating from the API name (`Job.IatsRecurringContributions`) to a filename (`api/v3/Job/IatsRecurringContributions.php`). This is susceptible to edge-cases involving filename case-sensitivity (where, eg, an API+filename might work in OSX but fail in Linux).

# Answer
> 0 votes
ad 1) did you do a complete rm -r everything iATS code files that you had downloaded via the Manage Extensions GUI before you unzip-ed the 1.3.2-zip file? Did you add 4.6 to its info.xml file \[it only contains labels 4.4 and 4.5\]? Did you clear all CiviCRM caches and go back to the Manage Extensions GUI screen and run the database updates \[you had mentioned to us you upgraded from well before 1.3.2 - I bet you there are likely some of these to be dealt with\].

I think the reason the automated process failed may very well be b/c 1.3.2 is indeed not labeled as compatible with your CiviCRM core - so it's trying to stop you from installing it.

ad 2) I would not recommend git clone master at this point - in addition to working on testing all 21 payment pathways in 4.6.x - Alan is working on adding Direct Payment Method \[comes with lots of JS edits in lots of places\] and I'm working on adding in some new extensive reporting features. There is just a lot going on right now. And unreleased (not in our test matrix yet).

I'll try and reproduce your issue (installing the 1.3.2 on a 4.6.x) - If I can reproduce it I'll work on that and make it a patch re: scheduled jobs - code edits from 4.4./4.5 to 4.6 - a patch which you would then need to manually apply to your 1.3.2

**New:**

3. Try deleting the iATS scheduled jobs from your /civicrm/admin/job?reset=1 - and then manually add them \[using the Add New Scheduled Job button\]. I just ran iATS 1.3.1 jobs on a 4.6.4ish (see screenshot).
4. Obviously that's a workaround - we need to dig deeper to find out why these jobs don't survive the upgrade better. Perhaps scheduled jobs get stored elsewhere/differently in the CiviCRM db compared to 4.4/4.5?

# Answer
> 0 votes
I *was* having the same iATS Payment issue. I looked at what Alan said, then renamed the Job file name, the actual .php files in the iATS Extension folder (…custom\_ext/com.iatspayments.civicrm/api/v3/Job/) and now it works!

---
Tags: civicontribute, extension, cron-job
---


title: Errors Adding Registrant

text:
# Question
Title: Errors Adding Registrant
Recently created an event and started adding registrants. When I add a new registrant these errors appear:

Notice: Undefined index: is\_show\_location in CRM\_Event\_Form\_Participant-\>postProcess() (line 1516 of /home/\*****/www/www/sites/all/modules/civicrm/CRM/Event/Form/Participant.php). Notice: Undefined index: metric in CRM\_Core\_BAO\_PdfFormat::retrieve() (line 309 of /home/\*****/www/www/sites/all/modules/civicrm/CRM/Core/BAO/PdfFormat.php). Notice: Undefined index: metric in CRM\_Core\_BAO\_PdfFormat::retrieve() (line 309 of /home/\*****/www/www/sites/all/modules/civicrm/CRM/Core/BAO/PdfFormat.php).

I recently updated to 4.6.3 but it all seems to be working otherwise. Suggestions?

# Answer
> 2 votes
Did you back up your database before the update (as suggested) - can you find 'name' = 'metric' in your civicrm\_option\_value table?

---
Tags: civievent
---


# Question
Title: Price Set fields with Quantity per Option
We want to have our price set have options such as

A B C D

but we want to have a quantity field for each option

X A X B X C X D

and have it calculated at the end of the form.

Is this possible or achievable with native CiviCRM functionality, or is there a way to adjust the code to suit our needs that has been done before?

# Answer
> 4 votes
This can be done if you set the Input field type to **Text/Numeric Quantity** when you create a price field.

You will need to create one price field per option. There are two slight variations for this field type. Based on your question I think the following will work for you:

* If A costs $5, set the "**Price**" field to 5.00 and make the field's label something like "Number of $5 Widgets"

and so on for B, C and D.

The other option, mostly used for donations, can be found in our book in the section on membership pricesets. You will need to scroll down to the section on **Non-membership price fields**.

---
Tags: civicontribute
---


# Question
Title: Handling organizations and subscriptions
How would you handle the case of organizations & libraries that receive a copy of our quarterly publication? If the organizations are "members" it might be possible to schedule payment reminders and generally keep track of the money, and delivery preferences (online or postal mail). I could create a membership type of "Organization". If they are just "Organization" contacts, not members, I think it fits better in the sense they are not actual persons, but I don't know how you would deal with payments and reminders. Any suggestions appreciated.

# Answer
> 3 votes
Agree with others that Memberships is way to go. Organisations tend to have someone with fingers who can fill in an 'on behalf of Organisation'-type Membership form. This automatically creates a Permissioned Relationship between the contact person and the Org which can then be utilised for sending out renewal / resubscription reminders.

Note: if you want to rename Memberships as "Subscriptions" then be aware that text strings including words Members or Memberships often in multiple places in the System Template (Membership Receipt) messages. You may be able to fix some of these via Word Replacement but I suspect some need tackling direct in the template - possibly with an 'if' statement if you have some Membership Types for Subs and others for Members

# Answer
> 0 votes
If you are dealing with money then I would recommend using a membership. There is no requirement or assumption that memberships are for individual contacts only - they can be set for organizational contacts as well. The profile(s) on the Membership signup and renewal form should be set to onclude fields from an organizational contact, or ones related to it.

---
Tags: civimember
---


title: Mailing sending to removed users

text:
# Question
Title: Mailing sending to removed users
I had 50 people in a group and I had to remove 5 before i sent a mailing. I removed the 5 and they all had the red removed next to them, so when I went to send the mail I had 47 recipients.

How do i stop those 2 getting the email?

# Answer
The list of recipients is created during the mailing creation process (i.e. when you assign the groups to the mailing). This is primarily to avoid any permissioning issues when sending the mailing.

The easiest approach is to edit and save the mailing again, which will create a new set of recipients from the groups.

Alternatively if the mailing is still in scheduled stage, you could delete the relevant entries from civicrm\_mailing\_recipients
> 3 votes

---
Tags: civimail, groups, smartgroups
---


title: White Screen During Joomla Installation

text:
# Question
Title: White Screen During Joomla Installation
I installed the previous version of Civi for Joomla just fine. I removed the older version and tried installing the current version but a few seconds after the installation process starts, I get a white screen and it stalls. The error is:

(/home7/accountname/public\_html/administrator/components/com\_civicrm/civicrm.settings.php): failed to open stream: No such file or directory in /home7/accountname/public\_html/tmp/com\_civicrm/com\_civicrm/admin/configure.php on line 115

The configuration is:

Joomla 3.1.1 PHP 5.2.17 MySQL 5.5.42-37.1

As mentioned, I had installed a previous version in the same account with the same configuration without any problem at all. Any suggestions that would help me install Civi would be much appreciated.

# Answer
> 2 votes
Did you follow the steps here: http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrade+Joomla+Sites+to+4.5

When you say that you removed the older version, what steps did you follow to do this? My first guess is that something wasn't removed correctly.

---
Tags: joomla, civicrm-home, installation
---


# Question
Title: CiviMail mailing sometimes has 0 intended recipients
I'm creating some CiviMail mailings using the API. Sometimes my mailings get created and scheduled, but when they execute, they are marked as "completed" but show as having `Intended Recipients: 0` in the mailing report, even though the recipient group is correctly populated:

When I create the exact mailing manually through the GUI, I get the proper intended recipients and the email is sent.

The code I'm using can be found in my CiviMail Tools Drupal module that provides rules integration for CiviMail using the CiviCRM API.

So, I have a rule component set up that creates a CiviMail mailing when a node is published. If I execute or schedule (rules scheduler) the rule component manually, the mailing gets intended recipients. However, if the component is scheduled automatically by an event trigger, then the CiviMail mailing is created and scheduled, but has `Intended Recipients: 0` as in the above screenshot.

Any idea what might cause this? Again, it only happens when Drupal schedules my rule component based on an event trigger. If I schedule it manually, it all works. Very strange and difficult to troubleshoot!

# Answer
> 3 votes
Check your user permissions. All too often something that works for me via the GUI, fails in the automation.

---
Tags: civimail, api
---


# Question
Title: Search builder operators do not work for Preferred Communication Method
You can reproduce this yourself on the demo site:

```
Search Builder > Contacts > Preferred Communication Method = Phone

```

Returns the *exact same* results as

```
Search Builder > Contacts > Preferred Communication Method != Phone

```

See the screenshots:

and then:

# Answer
You've found a bug. Check out Reporting a Bug, starting with step 7.

As a point of interest - variations on this bug have been reported before. For instance, CRM-6652, several years ago, which was only fixed last month with CRM-16483.

If you're looking to patch this yourself, I would definitely look to CRM-16483 as a model.
> 2 votes

---
Tags: issues, search-builder
---


# Question
Title: seeking information on CiviCRM 4.1 version of "CRM/Core/BAO/PaymentProcessor.php" file
The Vanco Payment Processor module uses a core file (*CRM/Core/BAO/PaymentProcessor.php*) in CiviCRM 4.1 that I'm unable to find in CiviCRM 4.4. Does anyone have knowledge of the file and might know if it has been renamed or moved within the file structure?

# Answer
> 6 votes
This was removed before CiviCRM moved to git, so I browsed the old Subversion repo. I can see that revision 44887 removed it. It's present if you click the first link but not the second: http://svn.civicrm.org/civicrm/!svn/bc/44886/trunk/CRM/Core/BAO/ http://svn.civicrm.org/civicrm/!svn/bc/44887/trunk/CRM/Core/BAO/

I then attempted to view the SVN log, and then to check out the SVN repo: svn log -v http://svn.civicrm.org/civicrm svn checkout http://svn.civicrm.org/civicrm/trunk civicrm

Both failed with a 503 error, I suspect this is to blame: https://community.bitnami.com/t/varnish-throwing-503-on-svn-requests/25828

So I Googled "civicrm r44887" and found an IRC log:

```
[08:54] <civi-bot> r44887 by yashodha: CRM-11334 -- https://fisheye2.atlassian.com/changelog/CiviCRM?cs=44887

```

So there are your answers! Check that atlassian.com link and CRM-11334, you'll find what you're looking for.

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


# Question
Title: Where to put api wrapper class in an extension
I just wrote an extension with short-name "genderselfidentify" (it's cool, you should check it out), which implements hook\_civicrm\_apiWrappers. This hook requires you to declare a class for your api wrapper functions, but the docs for it don't say exactly what you should name the class or where you should put it. The example given is:

```
function example_civicrm_apiWrappers(&$wrappers, $apiRequest) {
  $wrappers[] = new api_v3_APIWrapperExample();
}

```

Which implies that

* The class name should start with `api_v3_`
* It should be placed in the extension's `api/v3` directory
* (noting the lack of `require_once` in the example) it will be autoloaded by CiviCRM.

I found all the above to be true, naming my class `api_v3_GenderselfidentifyAPIWrapper` the autoloading and wrapper functionality worked great... but then I noticed something strange in the API Explorer:

Why is my wrapper class showing up as if it were an entity?

# Answer
> 5 votes
The example in the wiki was problematic. If you look at the wrappers included with core, they're never placed under the `api/v3` folder -- they're always under `CRM/Utils/API`. (I've updated the wiki to use a different name.)

That's merely a matter of convention, though. The API-wrapper system doesn't impose any constraints on where to put the class or how to name it. As far as that system is concerned, you can use any valid PHP class (as long as it implements the `API_Wrapper` interface).

The limitation here is in the reflection mechanism (`MagicFunctionProvider->getEntityNames()` and `getActionNames()`) which maps between API entities/actions and files/folders/functions. This is tricky to do because the naming conventions have been traditionally loose/ambiguous, so the current implementation uses a general rule of thumb: if you put *any* PHP file under "api/v3", then it will be reported as an entity name.

---
Tags: api, hooks
---


title: Combining reports

text:
# Question
Title: Combining reports
I've created a few (membership) reports, and the client is happy. Only, they would like the csv output of the reports to be combined into one. Preferably with some headers in between. The filters of each report are mutually exclusive, so I can't do it in one report (or can I?).

Is there any smart way to do this ?

# Answer
It would be easiest to do this if the client is willing to accept fixed configurations for at least one report. You want to hook in (or more likely have to override) the creation of the csv export from the report output. IIRC most reports build arrays in PHP before rendering them as csv. After one has been built, build the other. Add column(s) if necessary so the first report array has at least as many as the second, then append the tows of second array to first then send to function that converts array to csv file for download.

A more advanved but nicer approach would be to put each report on a separate sheet in an .xls .xlsx file. (Micosoft opened up the spec for Excel file formats a few years ago and I believe Xavier made an extension to make .xls available as an additional output format for CiviReports.) As I recall it's slightly easier to render first array directly to file then open file and insert second sheet before closing, then sending for download.

A third approach we've taken in an extension was to generate more than one report and zip them into a single file for download. This has the advamtage of single click UI and being relatively easy to program.
> 3 votes

---
Tags: civireport
---


# Question
Title: How to add memo type comment field for memberships?
We have a set of custom fields for memberships, including one that is "Comments". I set the alphanumeric size to 1028. Problem is that the text box really should be a memo area.. the text box is just too small. I don't see Memo as one of the options for creating a custom field. Ideally it would be best to convert the existing field over to a memo control without changing the database too much. Could this be accomplished within the system or would you have to edit a template or something?

# Answer
Coleman's answer is the correct one; however, this doesn't satisfy the second part of your question, copying your data to the new field. The easiest way to do this is via SQL.

* First, do as Coleman suggests and create a new field of type "Notes".
* Next, back up your database.
* Find the custom group ID. Go to **Administer menu \> Customize Data and Screens \> Custom Fields**, then click the corresponding "View and Edit Custom Fields" link. The URL will end in "&gid=x", x being the custom group ID.
* In MySQL, run "SHOW TABLES", and find the group starting with "civicrm\_value" and ending in your custom group ID.
* Still in MySQL,run "DESC {tablename}" to find the field names of your old and new field (should be fairly obvious).
* Finally, run "UPDATE {tablename} SET '{newfield}' = '{oldfield}'.
> 2 votes

# Answer
You can set the data type to "Note" and the input type to either "TextArea" or, if you prefer a wysiwyg editor, "RichTextArea".
> 5 votes

---
Tags: civimember
---


# Question
Title: Display menu and pages of a newly created extension
I am working a new extension that i created throough civix. i have added some pages and some forms, how do i display the menu on the home page of the extension and navigate to the different pages and forms. when i install my extension and run it, i get this message: Thank you for creating with WordPress.

Version 4.2.2

# Answer
> 4 votes
Whenever you modify a menu xml file you must clear CiviCRM's menu cache.

Go to **Administer \> System Settings \> Cleanup Caches & Update Paths** and click the **Cleanup Caches** button.

---
Tags: extension, civicrm-buildkit, civix
---


title: Setup cron job generate emails

text:
# Question
Title: Setup cron job generate emails
I have a number of cases where I need to run a cron job to use a custom search and a template. It should be simple to schedule a mailing to automatically run on some basis.

I have 2 current examples, Once a month I need to send a summary to a contact listing the status of their constituents. I have a group listing all the recipients of a report. For each person a template is called and from the use of tokens generates and sends the report.

In another case I have a search which identifies the payments from the previous day. The cron runs and based on a template sends acknowledgements.

I would think there should be an easy way of setting up a cron which calls a search and a template. Unfortunately I don't see how to easily specify the two parts, If a current module exists where I can just name the search and the template that would solve my problem. This would be like automatically launching a mailing daily from a cron.

# Answer
It doesn't exist for search, but it does for reports. Could you use a report instead of the search?
> 1 votes

---
Tags: civimail, cron-job
---


# Question
Title: How to make the contact autocomplete in Webform Civicrm to search for contacts that contain a search term, not start with
When you add an existing contact field to Webform Civicrm the autocomplete searches for contacts that start with the search term. How do you change the autocomplete function to search for contacts that contain the search term in any part of the name, not just the beginning?

# Answer
> 4 votes
In search preferences /civicrm/admin/setting/search?reset=1: Automatic Wildcard should be "yes" to search for contacts that contain the search term in any part of the name.

---
Tags: webform-civicrm
---


title: Membership proration

text:
# Question
Title: Membership proration
I'm attempting to setup proration on fixed memberships via the civicrm\_membershipTypeValues hook. I'm assuming that once the minimum\_fee value is modified, this new amount should display on the contribution form.

In using the basic test code, with some debug messages inserted, I can see the hook is called, and the minimum fee value is updated, however the radio button selections for the membership types, retains its original "full period" price.

Currently testing with the following on Drupal 7.37/Civi 4.6.3 to test the ability to update the amount without success....

Appreciate any thoughts on how to implement proration....

```
function prorated_memberships_civicrm_membershipTypeValues( &$form, &$membershipTypeValues ) {
  require_once "CRM/Core/Error.php";

    foreach ( $membershipTypeValues as &$values) {
   CRM_Core_Error::debug( 'olddump', $values);
          if ( $values['name'] == 'General') {
              $values['minimum_fee'] = "5.55";

          }
          if ( $values['name'] == 'Family') {
              $values['minimum_fee'] = "2.22";

          }
   CRM_Core_Error::debug( 'newdump', $values);
    }
}

```

# Answer
> 2 votes
Even if you don't use a price set on a contribution page, the options that get presented end up being treated as a price set in the database. Membership options in a price set don't need to be the minimum value of the membership itself, so my suspicion is that your hook isn't affecting the price options on the page, since they're set when you create the contribution page itself.

You'll need to use hook\_civicrm\_buildamount to change the actual price options' values on the form.

---
Tags: civimember, hooks
---


# Question
Title: Can CiviCRM handle Extensions in tar.gz format (automated distribution)
We have a couple of extensions (e.g. CiviSEPA) that are approved for automated distribution. This means, users should be able to download and install the extension from the CiviCRM menu.

We uploaded the extensions as \*.tar.gz files - which works fine if we install the extension manually.However, CiviCRM seems to expect \*.zip files when installing from the menu - users reported an error (see screenshot).

**Hence my question: Can CiviCRM's automated distribution handle \*.tar.gz files? And/or is anyone familiar with the error message?**

--\> If it can't, it should probably not be possible to upload \*.tar.gz files.!

PS: I am aware that we could create a git tag and let the autoreleaser script on civicrm.org do its thing - however this is currently not an option.

# Answer
> 5 votes
No, it does not support tar.gz files -- it only supports zip files.

The relevant logic is in CRM\_Extension\_Downloader. Note that `checkRequirements()` and `extractFiles()` are written to use PHP's ZipArchive.

**Update**: Another tip. You may want to test that a given file can be downloaded+extracted correctly, but that usually requires publishing a new release (which means that you have publish something untested... oops). To test the download+extract steps *before* publishing the release, you can do something like this:

* Create the zip file and determine its URL.
* Run `drush cvapi extension.download key=org.example.myext url=http://example.org/myext-test.zip`

---
Tags: extension
---


# Question
Title: User and Permission table distorted in Civi/WP
I'm trying to configure Civi 4.63 on WP 4.2.2. and the rows for the users and specific permissions don't line up. I tried expanding the Permissions column to be a single line (like the User columns) with no luck. Here's what I get:

I'm new at WP, but this was a whole lot easier in Drupal. Any advice will be much appreciated.

# Answer
Slightly hacky way around it: zoom out. In Chrome that's CTRL and -.
> 2 votes

---
Tags: wordpress, permissions
---


title: Migrating email servers

text:
# Question
Title: Migrating email servers
We are migrating our hosting and need to point to a new email server. Can we turn off/delay scheduled/automatic notifications (CiviMail) while we reconfigure/test? Perhaps this is not necessary (i.e. mail is held if the connection to the mail server is lost).

Maybe there is a better way? Any advice to best manage pointing to the new server so as not to lose automatic mail scheduled while migrating would be great.

# Answer
> 5 votes
I'm reasonably sure that if you don't have a valid mail server, the mail will be lost. I mitigate this by installing a mail server (Postfix) on the same server as CiviCRM, and use that to relay to the third-party server. Not only is this more robust - Postfix will hold the e-mails that don't go through while your main mail server is down for testing - but you get much finer-grained control over e-mail. For instance, throttling the number of e-mails per second.

# Answer
> 2 votes
You should consider how long the outage will be: if it's more than a day, you may actually want to not send messages during that time if you know they'll arrive well after they're intended. It would be embarrassing to remind people about an even after the fact, for example.

If you disable the scheduled jobs for scheduled reminders and outbound CiviMail, you'll be able to have better control over what messages go out when--if at all.

That said, you'll still need to deal with receipts and "send an email" messages that don't rely on cron, and Jon's method is a good way to handle that.

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


# Question
Title: How do I call an SMF function from CiviCRM?
I want to write a postProcess hook to post submitted form info to a Simple Machines Forum. How do I call SMF functions from Civi?

# Answer
In a standalone test script, I could call the SMF createPost() function by first requiring some SMF files:

```
require_once('/path/to/forum/index.php');
require_once('/path/to/forum/Sources/Subs-Post.php');
createPost($msgOptions, $topicOptions, $posterOptions);

```

But I ran into php variable scope problems when trying to include index.php from my hooks plugin in the middle of Civi's chain of processing code. index.php include()'s Settings.php which defines important variables, but they don't wind up in the global scope, so when index.php then calls various other functions they don't have access to the variables.

I hacked around this based on something I found somewhere. I used this code within the postProcess hook to manually put all the variables defined in Settings.php into the global scope:

```
$__defined_vars = array_keys(get_defined_vars());
require_once('/path/to/forum/Settings.php');
$__newly_defined_vars = array_diff(
  array_keys(get_defined_vars()),
  $__defined_vars,
  array('__defined_vars')
);
foreach ($__newly_defined_vars as $var)
  $GLOBALS[$var] = &$$var;
$GLOBALS['smcFunc'] = array(); //also need to define this in GLOBALS
require_once('/path/to/forum/index.php'); //this and next line needed to call SMF createPost function
require_once('/path/to/forum/Sources/Subs-Post.php');
createPost($msgOptions, $topicOptions, $posterOptions);

```

I welcome other input on better ways to do this...but it works!
> 2 votes

---
Tags: hooks, integration
---


# Question
Title: How can I find the code that produces a certain error message (e.g. "Sorry, can not load CMS user account.")
When confirming donation I'm receiving the following error message "Sorry, can not load CMS user account." How can I track down which file this message is generated in?

Other details: I'm working through the vanco payment processor 4.1 code to make it work with 4.4 CiviCRM. The URL is similar to: www.domain.org/civicrm/contribute/transact

# Answer
> 4 votes
This particular phrase appears to be in these files:

```
./CRM/Utils/System/Drupal.php
./CRM/Utils/System/Drupal6.php

```

Here are two ways you can search for specific phrases within the codebase:

**1) GREP**

Using this command from the base `civicrm` directory:

`> grep -R "Sorry, can not load CMS user account." ./`

**2) GITHUB**

And if you don't have a command line handy, you can do the same on the CiviCRM GitHub page with the "Search this repository" function at the top (using the quotation marks to search for the exact phrase):

---
Tags: error-page
---


# Question
Title: Exporting related contact's information on a contact that is a subtype
We have a relationship type that is designated between a "Student" subtype of Individual and a "School" subtype of Organization ("Student of/Student is"). When we do a search for Students and try to export the School name via the relationship, we find that the "Student of" relationship does not show up in the fields available for export so we cannot select "Student of \> Organization Name" as an export field.

However, if we modify the relationship so that it is for all Individuals rather than just for Students, it shows up.

The JIRA bug report is here.

# Answer
It sounds to me like you've already confirmed it's a bug, if you can replicate it on the demo server. I'd open an issue for this.
> 1 votes

---
Tags: contact-types, export
---


# Question
Title: Does CiviDiscount work with Pay Later Memberships when using Price Sets
While I have the 'discount' field showing and applying as expected both for back end memberships, and on the Contribution page, my testing shows the outcome of a Pay Later is that when as an admin updates the payment to 'completed' there is no indication on the Pending Membership record that the user applied a coupon and it is not recorded as a Code Redeemed for that contact.

I tried both 'update pay later' options ie via Membership and via Contribution.

If i use the Update Payment Status on the membership record it provides the Amount field prefilled with the undiscounted amount and no indication of a coupon being associated with this membership - and if i don't overwrite this it will end up recording the payment incorrectly as being the full amount.

Alternatively if i used the Edit option on the related contribution which shows the discounted amount the person is committing to pay and refers to the discount on the line item - when i set payment to Completed and save, nothing is recorded on the Codes Redeemed for the contact nor the Codes Assigned for the Organisation to which the discount 'belongs'. Am I missing something or is this a 'gap' in the current code?

This was testing on civi 4.6.3 and cividiscount 3.0.

# Answer
> 1 votes
In Pete's case the problem turned out to be price sets not pay later. There is a fix now merged into master - but be aware that the code is 'consumed' when the pending transaction is created - not when it is confirmed

---
Tags: price-sets, cividiscount
---


# Question
Title: How should I add CiviCRM contact fields to Drupal node submit / comment submit forms?
We have occasional need to allow submissions of content (either Drupal nodes or comments on existing nodes).

What is the recommended way to expose CiviCRM contact fields on a node or comment submission form so that the person filling the form can add their contact/credit information, which is added to CiviCRM if it doesn't exist, or linked to a contact record and potentially updated if the contact already exists?

# Answer
> 2 votes
I'd try using civicrm\_entity with entityreference.

# Answer
> 2 votes
If the above doesn't 'do it' for you. You can set Drupal Webforms to work on any node content, so that would be one option. Just go to eg admin/structure/types/manage/page and set Webform to be enabled.

Otherwise you could set a Drupal Webform to be a Block and expose that block in the situations where you need to catch this info. Just look in Webform tab \> Form settings \> Advanced Settings.

---
Tags: drupal
---


# Question
Title: Tags used for Cases, Activities or Attachments in Drupal Views?
We are trying to achieve a hierarchical approach to some of our case types by using case tags.

It works great on the back-end, but if I try to filter a view by the case tag, I get no results.

In the View UI, I add a filter of CiviCRM tags, see the case tags in the list, but if I select any of them, I get no results.

I've tried with tags attached to contacts, cases, attachments and activities. The only one that appears to work is when the tag is attached to a contact.

Since Smart Groups don't appear to function correctly in Views either, this functionality would be very useful.

Tables look good, view appears to be set up correctly. Tags is available as a field and I can see the correct Case Tags in the list of available tags.

I brought this issue up before, but have no resolution yet.

Here is a link to the old issue: Case Tags in View

# Answer
On a development server, I edited sites/all/modules/civicrm/drupal/modules/views/components/civicrm.core.inc.

In the Tag section, I added:

```
$data['civicrm_tag']['table']['join']['civicrm_case'] = array(
    'left_table' => 'civicrm_entity_tag',
    'left_field' => 'tag_id',
    'field' => 'id',
  );

```

and

```
 $data['civicrm_entity_tag']['table']['join']['civicrm_case'] = array(
    // Directly links to tag table
    'left_field' => 'id',
    'field' => 'entity_id',
    'extra' => array(
      array(
        'field' => 'entity_table',
        'value' => 'civicrm_case',
        'numeric' => FALSE,
      ),
    ),
  );

```

After that, I was able to filter by case tags.

Would this have any unforeseen ramifications? Does this cover all of my bases?

Would this be best put into a separate custom module?
> 1 votes

---
Tags: activities, civicase, drupal-views, cms-integration
---


# Question
Title: How do I view cookie or session information on the server?
This question is because of troubleshooting I've been doing on Why won't data entered into CiviCRM profile html snippet save? Loading a Profile makes otherwise malfunctioning embedded forms work, and I suspect something is happening on the server side to allow access/give permission to something.

So: how do I view what's happening with cookie data in CiviCRM on the server side? I've tried rgrep to search all files in the web directory for the cookie name, and have dumped the CiviCRM database and the Joomla database and searched for the cookie name. I can't think of anywhere else to look. Thanks for any pointers!

# Answer
> 1 votes
*More debug titbits.*

Your question sounds like you're looking for the submitted/missing value name in the codebase - this form field name is probably not mentioned in the codebase if it's a value configured in the DB, as the form will then be generated.

Also, this name (say "volunteer\_reason") may have been "munged" to a degree thanks to HTML\_QuickForm's naming form inputs (you might see "contact\_1\_volunteer-reason\_1" or whatever).

The most frequent cause of these not being populated as expected is when there is a mismatch between the originating and resulting request URLs. For those purposes, http://www.example.org and https://www.example.org are not the same thing; neither are http://example.org and http://www.example.org

This comment almost makes it sound like you're hitting session initialization issues - and that including the iframe prevents this. Weird.

# Answer
> 0 votes
*I suspect this answer isn't what you need, but it might help your understanding.*

PHP has superglobals `$_SESSION` and `$_REQUEST` which CiviCRM is probably using to access that data.

* $\_REQUEST contains data from $\_COOKIE, but *generally* CiviCRM doesn't refer directly to cookies; it tends to use $\_SESSION for that, and $\_REQUEST for submitted form variables.
* $\_SESSION is stored server-side, and
* PHP handles the mapping internally to identify the right local session from supplied cookies (or other methods, in a pinch).

# Answer
> 0 votes
To view the cookie / session information on profile submission:

* Read Debugging for developers and become familiar with how to view values when CiviCRM is processing the form submission.
* Go back through your posted backtrace and find where the value that fails validation is first validated. (Looks like `CRM_Core_DAO::composeQuery()` from the backtrace posted in other question.)
* Inspect the submitted / missing value before it's validated.
* Debug from there.

---
Tags: profile
---


# Question
Title: Profile search/listings not working in 4.6.3/4?
I updated to the 4.6.3 version of CiviCRM for Wordpress, and discovered that I'm not able to bring up a listing/search page via the 'Use Profile-Listings Mode' - I get taken to a page on the front-end of WordPress with a message 'No fields in this Profile have been configured as searchable. Ask the site administrator to check the Profile setup.'

The listings/search option seems to work fine in the Drupal installation I usually use, which is on 4.6.2, but the problem does seem to happen in both the Wordpress and Drupal demo versions of CiviCRM 4.6.4.

As far as I'm aware there's only two places to set searchability - on the field itself, and in the Profile fields edit list. In 4.6.2, I get the error message if I forget to set the Profile fields as searchable, but when I edit them to be searchable, the search listing works fine - as far as I can tell, I've not done anything different when trying it in 4.6.3.

# Answer
For a profile field to appear in the search settings, it needs to be:

1. Have the "is searchable" option selected
2. Have the visibility, set to: "Public pages and listings"

the latter is needed, so that everyone can see the fields and hence search on it.
> 1 votes

---
Tags: profile
---


# Question
Title: What are the implications of changing the SITE_KEY?
See also Generating a new SITE\_KEY

If I change the SITE\_KEY in civicrm.settings.php, what might stop working as a result?

Eg:

* Will checksums emailed to contacts last week still be valid?

(you're welcome to to edit question or comment to add to this)

# Answer
1. Change all cron jobs and scripts that use the site key for authentication
2. Reenter any passwords, specifically payment processors and mail/sms passwords
3. All prior checksums sent in the last 7 days (if that value has not been changed), will no longer work

A grep for SITE\_KEY in the code base will uncover a few more things :)
> 5 votes

---
Tags: security, civicrm.settings.php
---


# Question
Title: How to get over 'Failed to locate CMS...' exception on civix?
I was working to create skeletal extension module through civix but unfortunately I am getting this exception "Failed to locate CMS. Please call civix from somewhere under the CMS root."

# Answer
Maybe the standard wrong suggestion :-) but did you try the generate:module whilst in a subfolder of your website root?
> 1 votes

# Answer
The problem is resolved now, actually when I called civix from var/www/drupal I was getting this exception. Then after installing buildkit and setup of drupal-demo site, I again called civix but this time under the drupal-demo CMS root dir (viz. /opt/buildkit/build/dmaster/sites/all/modules). Now I am successfully able to generate a skeletal extension module.
> 0 votes

---
Tags: civix, gsoc
---


# Question
Title: Customizing the CiviContribute form through Drupal module
I need to perform a simple update of default values to a few CiviContribution forms on a client site. I was reminded that developing a Drupal module to customize the behavior of CiviCRM was the way to accomplish what we are in need of accomplishing. I coded up the following module:

```
<?php

/**
 * buildForm hook
 */
function civicrm_cir_civicrm_buildForm( $formName, &$form )
{
  // Only operate on CiviCRM Contribution Forms
  if ( $formName == 'CRM_Contribute_Form_Contribution_Main' )
  {
    // Test for specific contribution forms by CiviCRM form ID
    if ($form->getVar( '_id' ) == 15 ||  // Yearly CC
        $form->getVar( '_id' ) == 16 ||  // Yearly PP
        $form->getVar( '_id' ) == 13 ||  // Monthly CC
        $form->getVar( '_id' ) == 14 ||  // Monthly PP
        $form->getVar( '_id' ) == 8  )   // Weekly CC
    {
      // Set the check box for recurring contribution
      $defaults['auto_renew'] = array('checked' => '1');
      $form->setDefaults( $defaults );
    }
  }
}

```

Initially when the CiviContribution forms are loading, the Drupal module fires in the desired form data change... The recurring contribution check box is checked.

However when the form finishes loading the check box flips back to unchecked, and the default selection price becomes bolded simultaneously.

A Drupal developer I know who is not vary familiar with the code of CiviCRM suggested perhaps if CiviCRM uses the Drupal Form API to build its forms, then I could use the "Hook Alter" type API's to rearrange the order these events fire in... allow the CiviCRM form default population to occur first, and then fire my custom module (above) to check the AutoRenew check box.

Or if this is still not the correct way to check the AutoRenew check box in current CiviCRM powered by Drupal 6.x, then please kindly advise what is the correct way to check the AutoRenew check box.

I am thankful,

Michael

# Answer
From what you describe, it sounds like you are seeing some of CiviCRM's contribution page JS kick in after your customised form is rendered.

It is probable that configuring your CiviCRM Contribution page to use the defaults you desire will resolve this issue. Your approach of setting the defaults should translate to setting the form values, which should then be respected on initial load, but ... that's not happening :)

Take a look at the JS inlined on a default CiviCRM contribute form, eg the CiviCRM Demo site's Member Signup and Renew form when configured to permit optional membership auto-renew.

If you inspect the code immediately after the `auto_renew` element, you'll see this block coming from CiviCRM's templates.

```
<script type="text/javascript">
CRM.$(function($) {
    //if price set is set we use below below code to show for showing auto renew
    var autoRenewOption =  '0';
    $('#allow_auto_renew').hide();
    if ( autoRenewOption == 1 ) {
        $('#allow_auto_renew').show();
    } else if ( autoRenewOption == 2 ) {
        var autoRenew = $("#auto_renew");
        autoRenew.prop('checked',  true );
        autoRenew.attr( 'readonly', true );
        $('#allow_auto_renew').show();
    }
});
</script>

```

That code is fairly straightforward to read - if auto\_renew is set to 2 (from the contribute form settings, which allow you to configure this behaviour per contribute form), then the JS will check that box on page load, as you're seeing.

If I'm reading all that right, and with the caveat of not having seen your actual site at all, *I think you can configure this from your contribute form settings* for each of the form IDs listed above. The setting is on the "Membership" tab and looks like this:

The recurring defaults are tied to the settings in the Contribute form (and depend on settings in both Membership Type and Payment Processor config).

If that's not enough, you can override the JS by customising CiviCRM's templates, and you can add your own JS also if need be. That then would be your next path forward - modify that template variable based on the switch statement in your existing code.

You can certainly do it via JS though, as demonstrated by this customised contribute form (js here).
> 1 votes

# Answer
If you want a more "Drupal-style" form which you can hook\_alter() wantonly, look into using CiviCRM Contribute forms with Webform CiviCRM.
> 0 votes

---
Tags: civicontribute, drupal
---


# Question
Title: Setting up an "ethics wall" - anonymous contributions
Now that we have the basics of civicrm set up for our cathedral, we are looking at migrating giving recording - i.e. contributions and pledges.

The primary requirement is that contribution is anonymous. No one (with the exception of one giving recorder) knows how much anyone has contributed. The current system uses a donor number for each person, so whoever is doing data entry should be able to record contributions by entering this number only, and not see the person's name.

Contributions are via cash \[edit\](in numbered envelopes)\[/edit\], EFTPOS and automatic payment.

Desired output: At the end of each financial year, the giving recorder can generate a single tax receipt which accumulates a person's donations throughout the year - and send it to them so that they can claim a tax credit.

That's a long way from the standard usage of civicontribute and civipledge, but I hope that someone out there has had to build something similar and can light the way.

\[edit\]As a supplementary question: it has been suggested that we store the donor numbers in the external ID field. How can we restrict access (view and edit) to this built-in field to a single role?\[/edit\]

Richard

# Answer
> 7 votes
As far as the end-of-year giving statements are concerned, this has been available in CiviCRM since 4.4, but not documented in the user and admin guide.

It is documented in the 4.6 version of the guide which will be published soon. (The publishing software we were using has stopped working, so we are working hard to get it ready to publish via a different route). In the mean time the relevant section is:

# Answer
> 4 votes
You could also utilize Drupal Webforms or a CiviCRM profile to let your staff (or donors) enter donations and just provide the CiviCRM or external ID (without seeing any contact information).

On the issue of year-end statements, there may be good news. We developed an extension that generates donation receipts for your tax authorities - including anual bulk receipts. Please find more information on our website.

The development of the extension was initially funded by seven German organisations and has been in productive use since January 2015. The rightholders plan to publish the extension under a free license in late 2015.

It is also possible to join the consortium and start to use the extension now - please contact us if you are interested.

# Answer
> 2 votes
If I understand your question correctly, you're asking how you might go about recording the cash contributions and the EFTPOS contributions in CiviCRM without the person recording the contribution knowing who the contributor is.

I would probably have my contributors utilize an envelope system for cash contributions with their "giving number" on the envelope. This number could be either their civiCRM ID or the External ID (if you want to continue using your current number system just input the current number into the external ID of the civi contact). The person collecting the money could then enter the envelope number into a spreadsheet along with the amount of the contribution and type of contribution. Then you could use the Import Contribution option to import the list.

CiviContribute will allow your people to make one time contributions through your site as well as recurring. If you set this up to not notify anyone other than your giving recorder person then no one would know what anyone gave unless they had the permissions to see the contact's Contribution tab.

I can't tell you how to get the EFTPOS contributions into civi because I don't know how they are currently being made. However, depending on which payment processor you choose to integrate with Civi this could all automatically be entered with civi.

I use Stripe payment processor. It only does credit/debit cards and not e-checks, however it integrates with civicrm so that if a person makes a contribution through our website the contribution is recorded to their record and only the people with appropriate permissions can view that.

As far as printing year-end giving statements, that's where civicrm is lacking big time. There's been several attempts by various people to create solutions to this but currently (in my opinion) this is one of the great missing features of civicrm and quite frankly I can't understand how a system that markets itself to nonprofits doesn't do this out of the box. I don't know a single non-profit that doesn't provide end of year giving statements to their donors. There is a feature to print pdf letters and you can include a total amount given through using a token but to be able to list off all contributions given like in a table you would have to do some custom programming.

---
Tags: civicontribute, permissions, civipledge
---


title: Generating a new SITE_KEY

text:
# Question
Title: Generating a new SITE_KEY
One of my clients' webhosts posted the SITE\_KEY of their site on a publicly accessible webpage. How do I generate a new SITE\_KEY with the same random process that generated the original?

# Answer
> 4 votes
Any source of unknown data should be fine - I'd use a command like this just because it's quicker:

```
head -n 1000 /dev/urandom | md5sum

```

# Answer
> 2 votes
There is no requirement to generate the SITE\_KEY in the same way. (In fact, the algorithm changed in v4.6.3.) Rather, follow these requirements:

* Stick to alphanumerics
* Provide decent entropy (I think 90 bits would be decent, but there's no downside to going higher)

For some better ways to generate a SITE\_KEY:

* On Debian/Ubuntu-based systems, run: `sudo apt-get install makepasswd && makepasswd --chars=32` (~190 bits)
* Use mkpasswd.php from civicrm-buildkit, eg: `mkpasswd.php 32` (~190 bits)
* Do something closer to v4.6's algorithm: `php -r 'echo md5(rand() . mt_rand() . rand() . uniqid("", TRUE) . "www.example.org") . "\n";'` (~128 bits)

**Random Tip**: If you use an authenticated SMTP service for mail delivery and you change the SITE\_KEY, then you may need to re-enter the SMTP password.

---
Tags: civicrm.settings.php
---


# Question
Title: Simple, consistent N. Am. phone validation/reformatting everywhere?
If we want to put in some validation and reformatting for phone numbers to make sure they conform to N. Am. standard for 10 digit numbers, is there a simple way to catch this for everywhere a phone number is entered or edited (including edit in place), rather than having to search and deal with each form separately?

# Answer
> 7 votes
There's an extension that does precisely this: https://github.com/cividesk/com.cividesk.normalize

It used to be in the extensions directory, but it's gone now for some reason. It uses libphonenumber, and it formats international numbers appropriately based upon the country in the address.

# Answer
> 4 votes
I'm not sure where exactly phone input fields are built (is it always Phone.php?). But if building phone inputs can be patched to add `type="tel"`, you could then put JS in the footer of all Civi pages to scan for that input type and run your required logic against it.

# Answer
> 4 votes
FYI Civi already does one pass at normalization behind the scenes - whenever a phone number is entered or updated, a numeric-only version of it (stripped of all punctuation and spaces) is stored in the `phone_numeric` field in the database. This is the field that is used for search.

It doesn't enforce a certain number of digits, but thought you'd want to know that this calculated field exists.

# Answer
> 3 votes
Rather than trying to solve it at the form level, you could use `hook_civicrm_post()` to look for a 'Phone' object. From there, doing a phone number reformat by talking to libphonenumber is pretty straightforward. I've built a little Node app that exposes it as a service; if that helps I could chuck it onto GitHub. There is also a PHP port of that library.

I realize it's not ideal as we are cleaning up after the data comes in rather than bringing it in pristine, but it's a smaller dev effort for something workable.

---
Tags: extension, validation, phone
---


# Question
Title: Is this a bug, or a feature? Redirect on contribution landing page triggering while editing
My organization uses a redirect on the landing page after someone makes a contribution so they can fill our a survey for us. This redirect is triggering when we are trying to edit the "Thank you and receipting" information on the back-end of the donation page after upgrading to 4.6 (it didn't previously). This is also happening on the demo site (see the "Member Signup and Renewal" page).

This seems like a bug to me, but I wasn't sure, so I thought I would ask about it here before reporting it. The pages can still be edited if you push the stop button on your browser at the exact right moment before the redirect takes hold, it is just annoying to work around.

Thanks!

# Answer
> 4 votes
Looking at the demo site, you are inserting JavaScript directly into the thank-you message:

```
<p>Thanks for supporting our organization with your membership. You can learn more about membership benefits from our members only page.</p>

<p><br />
<script type="text/javascript">
<!--
window.location = "https://civicrm.org/"
//-->
</script></p>

```

CKEditor renders the whole thing when the tab is loaded or the field edited. This causes the JS to run, which fires the redirect. It's technically a feature that CKEditor allows us to enter JavaScript and executes it for us, but I'd never recommend doing this. It will become a huge pain to troubleshoot later, when someone other than you goes to edit the thank-you email receipt and it keeps kicking them to a survey page. I recommend moving your redirect into a template override or an extension, so that it only loads when the user gets to the actual thank-you page.

---
Tags: civicontribute, contribution-page, redirect
---


# Question
Title: Console error with Google Plus and "Help spread the word"
I was testing a contribution form today and noticed an error in the console on the thank you page. I'm guessing it is related to the Google Plus portion of the "Help spread the word" section, but am not certain. The site does also have a Google Plus URL set as rel="Publisher" using the Metatag module (Drupal).

If I leave the page open and the console open, this error just keeps recurring again and again:

**Refused to display...in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'**

What would cause this?

# Answer
This is usually a local issue; if you clear your browser's cookies the error should go away.
> 2 votes

---
Tags: civicontribute, social-media
---


# Question
Title: Drupal module to check "auto renew" checkbox for membership getting overridden, why?
**Edit Note: Since I first began looking into this, I have been reminded that the Drupal way to solve this challenge is to develop a Drupal module to customize the default CiviCRM behavior. I have now done so, however something is overriding the custom Drupal module behavior it injects into CiviCRM.**

We have understood that with CiviCRM, there are three options for the auto-renew of Civi Memberships:

*civicrm\_membership\_type Add column - auto\_renew TINYINT(4), default 0 values: 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;*

We have need of an "auto-renew by default / you may opt out" membership mode, as a handful of potential members are absolutely offended that the *"Please renew my membership automatically."* check box is checked and grayed out.

This particular site runs CiviCRM with Drupal 6.x, latest version of CiviCRM.

# Answer
I had an almost identical problem to solve today, which was to default a recurring contribution checkbox to "yes". I think your original code is close, but QuickForm doesn't expect an array for a default value for a checkbox. So, for instance, here's the code that worked for me:

```
function alwayscheckrecurring_civicrm_buildForm($formName, &$form) {
  if ($formName == 'CRM_Contribute_Form_Contribution_Main') {
    // "recurring" should always be set to "yes" if it exists.
    $defaults['is_recur'] = 1;
    $form->setDefaults( $defaults );
  }
}

```
> 2 votes

# Answer
It sounds like you want to have the option defaulted to true, which is a good thing to do in a small site customization of the membership signup page(s).

You just need to put a single line of code in the right place to set the option.

A developer could use civix to create an extension for custom code for your site, then implement the buildForm (iirc) hook, check the args to filter so the context is the page(s) you want to change, then set the value of the correct field to true.
> 1 votes

# Answer
hhhmmm... brushing the dust off this five year old module code is a bit of a challenge... Enabling the module updated for the present requirement causes Drupal to completely "white screen". Does the error I made come to mind?

```
<?php

/**
 * buildForm hook
 */
function civicrm_cir_civicrm_buildForm( $formName, &$form ) {

  // Pre-set the membership join forms to recurring
  if ( $formName == 'CRM_Contribute_Form_Contribution_Main' ) && (
         $form->getVar( '_id' ) == 15 ||    // Yearly CC
         $form->getVar( '_id' ) == 16 ||    // Yearly PP
         $form->getVar( '_id' ) == 13 ||    // Monthly CC
         $form->getVar( '_id' ) == 14 ||    // Monthly PP
         $form->getVar( '_id' ) == 8  ) ) { // Weekly CC
    // Set the check box for recurring contribution
    $(function() {
      $('#auto_renew').attr('checked', true);
    });
  }

}

```
> 0 votes

# Answer
It looks like I have the Drupal module firing the needed behavior into the CiviCRM Contribution page form initially... however once the page completes loading, the check box is flipped back to UNCHECKED. Not funny! \>:-|

Also, at the same time the check box gets cleared, the default price option also becomes bolded. Once the default price gets bolded, also the "Please renew my membership automatically." check box gets unchecked.

Here is the form while the page is still loading into Mozilla Firefox:

And here is the form when the page finishes loading:

So, this is the only CiviCRM customization on the site, what else could be adjusting the contribution form?

```
<?php

/**
 * buildForm hook
 */
function civicrm_cir_civicrm_buildForm( $formName, &$form )
{
  // Only operate on CiviCRM Contribution Forms
  if ( $formName == 'CRM_Contribute_Form_Contribution_Main' )
  {
    // Test for specific contribution forms by CiviCRM form ID
    if ($form->getVar( '_id' ) == 15 ||  // Yearly CC
        $form->getVar( '_id' ) == 16 ||  // Yearly PP
        $form->getVar( '_id' ) == 13 ||  // Monthly CC
        $form->getVar( '_id' ) == 14 ||  // Monthly PP
        $form->getVar( '_id' ) == 8  )   // Weekly CC
    {
      // Set the check box for recurring contribution
      $defaults['auto_renew'] = array('checked' => '1');
      $form->setDefaults( $defaults );
    }
  }
}

```

I am thankful,

Michael
> 0 votes

---
Tags: drupal, civimember
---


# Question
Title: How to register a unknown company for an known event participant?
we are using the civi event module and are currently registering participants for an event. Some of the participants replied that they will be accompanied by a friend or someone else without giving that persons name. Since we don't need these details really, we are searching for a way to register that first to us known person plus the unknown second participant. Has anyone an idea on that? Albeit what we need out of the civi event module at the end is a correct number of participants to plan the seats.

Thanks for looking into that problem. Best regards

Esther Reichert

# Answer
I think you got Erik right. If you want to get the correct number of participants from CiviCRM, you will probably have to use "dummies". If that is all you want, you wouldn't even need a relationship between them and the "real" participants.

In order to facilitate that, you could make a csv-sheet including 100 dummies using the columns First Name (Dummy1, Dummy2...), Last Name (Dummy1, Dummy2...) and E-Mail (dummy1@dummy.de...). You could then import the contacts into CiviCRM, give them a "dummy" tag at the same time and delete them after the event.

I have to admit, this is not the most elegant approach but as you kind of trick CiviCRM this is probably the price you'd have to pay ;)

If you are willing to do a bit of manual work, you could of course create a custom field asking "How many people will you bring along" and add up the numbers in the end. However, in that case, CiviCRM would obviously not display the right number of participants but you would have to calculate yourself.
> 1 votes

# Answer
It sounds to me like using a Price Set that allows the user to enter the number of people coming as an integer. Set the Price Set field to count each as a participant, then you will get your total number.
> 2 votes

# Answer
Are you manually registering the participants or are they registering themselves from a registration page? If the first is the case, you could create a dummy contact and company with something like 'Second' in the name?
> 1 votes

---
Tags: civievent
---


# Question
Title: Report with household, individuals and contributions
I am tasked with creating a report on households and the respective members of the households and their contributions.

Can anyone please direct me to any reports that are already available in CiviCRM or an SQL statement that does this?

# Answer
There is a Contributions by Household report available under **Reports \> Contribution Reports** by default in CiviCRM. This should provide at least the basics of what you need. You may need to edit the filter criteria to set "Household Member is" as the Relationship Type rather than "Head of Household is".
> 2 votes

---
Tags: civireport, contributions, households
---


# Question
Title: Display CiviCRM Survey in Drupal Content Type
I have created a CiviCRM survey (under Campaigns \> New Survey in the CiviCRM menu) but would like to embed this survey into a Drupal Content type. How might I do this? I am using

* Drupal 7.37
* MySQL 5.6.24
* PHP 5.6.8

# Answer
> 6 votes
By design, a CiviCRM survey can't be displayed anywhere on your website. From the docs (emphasis mine):

> CiviCampaign has a feature that enables **offline** surveys by providing a standardised way to record survey responses and to then generate reports from the survey data.

If you want an **online** form for your website visitors to fill out, alternatives are CiviPetition and Webform-CiviCRM Integration. For your use case I recommend the latter. Webform-CiviCRM can do everything CiviPettion can do, plus a whole lot more, including the ability to be embedded into drupal content (well, technically a webform *is* drupal content, so you can do anything with it that you can do with other nodes or blocks).

# Answer
> 3 votes
Webform-CiviCRM would meet your requirements and can be provided as a Block if that is what you are after (ie it can be set to show on certain Content Types)

---
Tags: drupal, civisurvey
---


# Question
Title: Number of contacts vs. hosting space required
Apologies if these questions seem pretty elementary, but I am having a hard time finding definitive answers anywhere else on the web:

1) Is there a maximum number of contacts one can include in a CiviCRM database? A lot of free CRM options out there have a 10,000-contact maximum, and I wanted to make sure CiviCRM does not.

2) If there is no contact maximum, approximately how much hosting space would a 10,000-contact database require? What about a 25,000-contact database?

Thank you so much in advance for any help with answering these questions!

# Answer
CiviCRM is distributed under a GNU AGPL 3 license; there are no legal limits as to the number of contacts or number of users you can have.

---

On the question of storage, it isn't easy to say definitively what a maximum number of contacts would be, or even how much disk space a certain number of contacts would require.

* Contacts are only a small part of a CRM system. You're also recording event participation, contributions, memberships, mailings, and so on. The more numerous these data points, the faster your storage needs will multiply.
* There can be huge variation in uploaded files like profile pictures, logos, or attached PDFs— these still count against any storage quota, even if they're not stored in the database.
* Even considering the database alone, not every field of every record will be populated; turning off geocoding or stripping down greetings will make a difference.
* Every site will have different custom fields, in number, type, and population.

Two identical databases can further differ based on the configuration of the system. For example, the number of *characters* you store in a database is different from the number of *bytes* of space it takes up. In a character set like Latin-1 (ISO-8859-1), all available characters can be stored in a single byte, but because UTF-8 includes a vastly larger range of characters, it might take up to 4 bytes (as of MySQL 5.6, MySQL will use up to three bytes) to do so. The differential will not be significant for Western European languages, but would be radically so if your database contained Chinese characters for example.

With MySQL, size limitations generally depend on the file system (which relates to the operating system). Since InnoDB tables can span multiple files, your db can be quite large indeed; however, the time and memory it takes to search through exceptionally large databases could render CiviCRM impractical, and this of course relates to how fast the hard disk is and how much memory is available, and how your MySQL is configured. There is a whole cottage industry around MySQL tuning, though many of the tools like MySQL Tuner wouldn't be usable in a shared hosting environment.

---

To illustrate, I have a CiviCRM 4.6.3 database with 2500 contacts in UTF-8 stored on an ext3 drive that is 202MB in size; there are various complex membership levels, monthly events, and frequent mailings maintained in CiviCRM. Another organization on the same server has almost 8800 records, also UTF-8, and 12 custom fields. Yet this database takes up only 13MB of space (!). That is because the vast majority of contacts are only a name and email address, and there are only a few dozen mailings stored in the system.
> 15 votes

# Answer
To speak to your question about whether 10k or 25k might be too big for CiviCRM, I think everyone has a different personal take on what constitutes a "big" database, and use-cases do vary a lot, but from talking to different Civi users I get the general sense that (very roughly):

* A "small" database is \< 100k contacts
* A "medium" database is 100k - 1M
* A "large" (sometimes called "enterprise") db is \> 1M contacts

Since the numbers you are talking about are on the smaller side of small, I don't think you'll have much trouble. I do know that people running medium-large and enterprise Civi sites have to get into some pretty serious caching/optimization/hardware, but I doubt you will need to.
> 10 votes

# Answer
1) There is no imposed restriction on the number of contacts. MySQL has some theoretical limit that your would reach if you entered every person on the planet multiple times.

2) As @choster spells out so thoroughly, every implementation is different so we can't say for sure what it will take. Unless you have a tremendously rich and complex contact record, your 25k database will almost certainly be less than 100MB, probably much (much) smaller. In terms of hosting, 1GB will cover you for a LONG time.
> 6 votes

---
Tags: contacts, hosting, performance
---


title: contact match script?

text:
# Question
Title: contact match script?
I'd like to import an **inconsistent list of contact names with associated donations** and match the names to contacts. IMO there are 3 options:

1. Clean the csv in advance by displaying contact alternatives (ideally showing contact ID for matching)
2. Run an import script and use interactive matching logic.
3. Use forms for batch entry and interactively match contacts.

The problem is that the person who understands the matching is not the same person who can do the interactive import.

I was wondering if someone has used an excel function / drush or extension of some sort to process a list of names and retrieve likely matches that I could present (with contact ID) in excel so the user would not have to use the autocomplete widget. Would like to avoid a developer.

The

# Answer
Step 1 - Use a program to make your data consistent. There are lots of possibilities out there - try OpenRefine (open refine.org).

Step 2 - once consistent, try to assign the contact.id (aka contact id, internal contact id) to a column. This will remove de-duplication issues

Step 3 - Import

Its really hard to have a script that finds inconsistencies, and they vary so much across data sets: some have all sorts of titles, others have improper address (street vs st vs str), etc. I find its almost always less time to invest in work before the import instead of counting/hoping on finding duplicates later.
> 1 votes

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


# Question
Title: Why is isFrontend set differently for Profile in create mode vs HTML snippet?
I had trouble with ajax Country / State dropdowns in a profile used as an HTML snippet embedded in a Joomla page. The dropdowns worked fine in the profile in create mode. I realized that the HTML snippet defines isFrontend as "false", whereas the create mode defines it as 1.

When set to "false", the query for a list of states upon a country change tries to access the administrator area, which fails because of authentication problems. Changing the HTML snippet code to set isFrontend to 1 fixes that problem.

Is there a reason it's set to "false"? Am I in danger of breaking something else? Is this a bug in the generated HTML snippet?

# Answer
> 1 votes
That is most likely a bug in the html snippet generator. Changing the snippet is indeed the solution to your problem, and as long as it works for your form no I wouldn't worry about that change causing problems.

---
Tags: ajax
---


# Question
Title: CiviMail tracked URLs give "Missing input parameters" from /extern/url.php
Any mailing that I send through CiviMail converts URLs to links in the form of:

`http://mysite.org/sites/all/modules/civicrm/extern/url.php?u=193&qid=52`

But when I visit this URL I get a white page with "Missing input parameters" and the address is `http://mysite.org/sites/all/modules/civicrm/extern/url.php`

Curiously I looked at some old CiviMail mailings and those URLs still work!

I don't think this is related to Missing Input Parameters Error

I'm running 4.6.3. Thanks for your expert insight and helpful suggestions.

# Answer
> 3 votes
It seems your host configuration is the problem, as it forces redirection from https to http and somehow lost the parameters in the convertion

Can you try to access the https version with the parameters?

https://mysite.org/sites/all/modules/civicrm/extern/url.php?u=193&qid=52

In any case, if you want to use https, be sure your configuration is set with https (CIVICRM\_UF\_BASEURL in your civicrm.settings.php), so it directly creates the right url and avoid a redirect

---
Tags: civimail, issues
---


# Question
Title: How to get a/b testing on the number of unique open?
It seems that the A/B testing is looking at the total number of open. in one case, we were surprised to experience a big difference between two versions, but it turned out that one of the recipient opened the email dozen of time (most likely it was forwarded to a mailing list)

Is there a way to display and compare what really matters (the number of different contacts that opened, not the number of time they opened it)?

# Answer
> 3 votes
I suspect this is a code change and should be made at the api level:

api/v3/MailingAB.php, function civicrm\_api3\_mailing\_a\_b\_graph\_stats

(which in turn calls function in the CRM\_Mailing\_Event\_BAO\_Opened class)

Would be good to fix the definition of opened as you suggest across both A/B stats and the reports since that is the accurate and valid number

---
Tags: civimail, abtesting
---


# Question
Title: Why do links in system PCP welcome emails fail?
I am using 4.6.3 on D7. I have set up PCP campaign associated with a contribution page. Contribution page is active (no end date). The user creates a page successfully, but they do not create a password in process of creating the PCP, even though the profile I am using in the PCP tab requires a user login.

So, they can't log back in after successfully creating the page.

When the user gets their system-generated PCP Welcome email, they are provided links to "login to your account" and "Click this link and follow the prompts". These fail (get page not available message in Chrome).

I looked at the system template for the email. Looks good.

Any thoughts about the problem would be helpful! Thanks!

# Answer
I think you may have two different issues here. I left a comment for one.

As for the lack of account signup - go to www.yoursite.org/admin/config/people/accounts (or, if you have standard Drupal menus, *Configuration menu \> People \> Account Settings*. Under Registration and cancellation, Who can register accounts - ensure that the value is set to "Visitors" or "Visitors, but administrator approval is required". If it's set to "Administrators Only", the account signup won't appear on the profile.
> 1 votes

---
Tags: civimail, civicontribute, pcp
---


# Question
Title: How do you print a single envelope for a contact?
How does one print off a single envelope for a contact?

# Answer
> 5 votes
* Create a new envelope PDF format that corresponds to your printer's settings at **Administer CiviCRM » Communications » Print Page (PDF) Formats**
* Create a new mailing template from **Mailings menu » Message Templates**. Fill in the template with the appropriate tokens you'd like - and also a return address if applicable. Select the envelope PDF Format that you just created.
* When viewing a contact, press the "Actions" button below their name and select "New PDF Letter", and select the envelope template and print.

This video tutorial covers a similar workflow, but for sending envelopes to a larger group of folks: https://www.youtube.com/watch?v=i00269Y7pB4

---
Tags: pdf, envelope
---


title: PDF Generation Error

text:
# Question
Title: PDF Generation Error
Civi 4.5.6 on Drupal 7.3.5

Go to make a single contribution receipt and get the following error

Fatal error: Maximum execution time of 30 seconds exceeded in /srv/www/yyyyyy/public\_html/sites/all/modules/civicrm/packages/dompdf/include/line\_box.cls.php on line 78

any thoughts ?

# Answer
> 5 votes
It might depend of the template layout you use or token or... plenty of reasons that the pdf generation can become slow.

In general, if you want good performances for pdf generations, install wkhtmltopdf and configure civicrm to use it

The way pdf generation works is that civicrm generates an html page first, then convert it to pdf. wkhtmltopdf is a software that does it way faster than doing it in php native

---
Tags: pdf
---


# Question
Title: How do I add a currently unsupported field to Views?
For example, the email\_greeting\_display field of the civicrm\_contact table is not available as a field in Views. How do I add that to a View?

See also How to include a token in a view?

# Answer
You will need to add the field manually to:

drupal/modules/views/components/civicrm.core.inc

and then submit a PR to civicrm-drupal repository, so the fix gets merged into the main code base.

In D8, the situation is a lot better, as torrance has automated the process and the fields and their definition get picked up automatically. So a lot cleaner and easier on everyone.

But for now, the above is your best bet and will help views intergration for D7 and prior
> 4 votes

# Answer
There are three ways to do this. Lobo detailed one of them, and alluded to work done for D8 to automate this - but similar work has been done for D7 as well.

The other two options each involve installing a module: Either civicrm\_entity 2.0, or Views CiviCRM Expose Tables. Views Expose Tables can expose every field in every CiviCRM table. CiviCRM Entity works with fewer tables, but a) it's the ones you probably want, and b) it has applicability beyond Views - e.g. you can use it for Rules integration.

There was an excellent presentation by Mark Hanna from Sqvare at CiviCon Denver 2015: https://denver2015.civicrm.org/sessions/civicrmdrupal-integration-showcase. The video's not up yet, but the PDF of the slides is, and it's well worth reading, not just for Views integration.
> 4 votes

---
Tags: drupal-views
---


# Question
Title: Is the cache field 'expired_date' no longer used?
After inspecting some cache entries in the civicrm\_cache table I've come across the field called 'expired\_date' which is set to NULL in all cases.

The only reference to the field I can find anywhere in the codebase is in the schema file. So it looks like this is an old field definition that is no longer used and can be removed?

# Answer
I had the same reaction when I saw that field -- it doesn't appear to be used.

In fact, I don't think it was ever used. Grepping some of the older releases (http://svn.civicrm.org/civicrm/branches/v2.0, http://svn.civicrm.org/civicrm/branches/v2.2), the field appears as part of the 2.1 schema upgrade; however, even then it's not used in any logic.

My suspicion is that the field is more aspirational. (Theory: One person designed the cache layer and included `expired_date` in the schema because it's standard in caching systems; then another person implemented the cache logic but ignored that part of the design.)

I wish the cache supported expiration/TTL, so I'm not anxious to remove the field. It would be even better if someone finished TTL support.
> 3 votes

---
Tags: database, cache
---


# Question
Title: Where can I download the latest version of CiviCRM?
I'm trying to install Civi 4.6 with Drupal 7, using the instructions in the wiki page referenced in the title. In step 2, it says:

> As administrator in Drupal, go to Modules, click on Install New Module, and it will ask you to fill in the URL of the module. It will then fetch it and install it for you. You will need to enable the Update Manager module in the drupal modules page to see the Install New Module link.
>
> The current link is http://sourceforge.net/projects/civicrm/files/civicrm-testing/4.6.alphax/. You will need to replace 4.6.alphax with the current minor version number.
>
> Hit the Install Button.

Apparently the current minor version is alpha1, so I enter http://sourceforge.net/projects/civicrm/files/civicrm-testing/4.6.alpha1/, and hit Install. I get:

> Cannot extract *temporary://update-cache-b2aa7d22/4.6.alpha1*, not a valid archive.

Maybe I should add that I'm trying to install this on my account at the web host webfaction.com. Not sure if this makes any difference.

Advice?

# Answer
You can always find the latest version on the CiviCRM website, or on Sourceforge. If using the Sourceforge link, there is a direct link to the latest version (Drupal) (others who may be interested in other CMS's can select the version for an alternate CMS):

* *(per @petednz) It is a good idea to double check that you are getting the latest version if you use the big green "Download" button as occasionally that button lags behind the latest version slightly.*
> 4 votes

---
Tags: drupal, installation
---


# Question
Title: How do I create a profile listing of multiple-record user relationships?
I am trying to generate a profile that lists and allows the user to edit his employment/education history in their Drupal My account page. I was hoping to get something similar to what is described in:

http://wiki.civicrm.org/confluence/display/CRM/Multiple-record+Custom+Data+Sets+in+Profiles

The issue is that I have no idea how to do it. I tried Views, but that one does not allow data editing. I also tried advanced search but I don't know how to limit the search results to the contacts related to the current user.

Any help/advice will be very appreciated.

# Answer
Interesting question. I was about to launch in to my usual - do this with either webforms, or Views, CiviEntities, VBO etc but knowing that the VBO interface is not 'great' for general users I wondered what could be done via multiple record fields and profiles.

You hadn't specified if you were thinking of using Civi Relationships, though the word is in the subject. But I don't think civi can give a user access to edit their own relationships particularly easily.

A Webform could be the solution since it does allow you to manage your start / end date etc so may be worth exploring more.

ANyhow, on demo site (which will of course be refreshed within 24 hours and lose this set up) I set up a multiple record field set with 2 types of 'employer fields' in case Contact Reference would be an option too (seems not from my testing based on the existing permissions for 'demo')

http://d46.demo.civicrm.org/civicrm/admin/custom/group/field?reset=1&action=browse&gid=8

There is also a profile set up with this used for View/Edit

So now if you go to

http://d46.demo.civicrm.org/user/2/edit/Employment\_History\_16

you will see the fields, and the user can Edit and Add new records to these fields.

Not sure how close this gets to answering your question since it does not use the Current Employer field, and does not use civicrm Relationships.

But i thought I would go down this route as I need to familiarise myself with what is now possible with multiple record fields in the newer versions. ;-)

Also noting that the Contact Reference field works fine in the civicrm tab on the contact record eg for http://d46.demo.civicrm.org/civicrm/contact/view?reset=1&cid=202 but not when it is used in a Profile which may be a well known limitation but just mentioning it here in case it might just be permissions or less likely a regression
> 2 votes

# Answer
Multiple record fields have some limitations in profiles, so am not sure if exposing them to Drupal user account will work.

You might want to check out CiviHR: http://hrmaster.demo.civicrm.org/

which also tackles some of these issues and you could potentially reuse some of the extensions built for that
> 1 votes

# Answer
You want to create a profile (**Administer menu \> Customize data and screens \> Profiles**) and create a profile with the fields you want. Then go into the Settings for that profile and check off "View/Edit Drupal User Account". Users should be able to edit the data on that profile by going to http://example.org/user/edit.
> 0 votes

# Answer
"View/Edit Drupal User Account" sort of works. My observations:

* The multiple record needs to be in a profile by it self, adding it with other fields makes the multiple records field disappear
* After adding a record, user is thanked with no way to get back to the list, other than going to account and editing again.
* Clicking cancel gives an error
> 0 votes

---
Tags: profile, relationships
---


# Question
Title: How do I create a Drupal View to display last activity date.
I'm trying to set up a View of Clients, Case Managers and date of last activity. Most of the clients have many activities, but I only want the most recent one displayed.

Normally, I would use the Multiple Field Settings in Drupal Views, but it isn't an option for the CiviCRM Activity Date or Activity ID fields.

Everything else is working but can't get it to only display the last date.

Any ideas?

Asked this question before here: http://forum.civicrm.org/index.php/topic,35580

# Answer
> 5 votes
All right...I did it but just wanted to follow up.

Expand Advances in the View UI, click next to Aggregation on the word No.

Turn it on.

Now Add the Scheduled Activity Date field.

Click Apply, then the Aggregation options will pop up.

Select Maximum in the drop down list.

Then click Apply.

Here is part of my output (with other fields too of course).

---
Tags: activities, drupal-views
---