title: Dashboard hangs; forces apache restart

text:
# Question
Title: Dashboard hangs; forces apache restart
This is in planning for upgrade to J!3. I have found no workable solutions here or elsewhere on the web.

CiviCRM 4.6.4
Joomla 2.5.28
MySQL 5.5.38-1~dotdeb.0
Apache 2.2.16
PHP 5.3.29-1~dotdeb.0
Debian Squeeze 6
Linux 2.6.32-5-amd64

On all virtual hosts before I updated CiviCRM (4.4.x and 3.5.x) the Dashboard shows up but the Ajax "Loading..." widget just keeps spinning and freezes the whole GUI. If I click on another CiviCRM link and restart Apache, it will go to that page and I can navigate around but going back to the Dashboard locks it up again. I then updated both instances to 4.6.4 to the same result. I've disabled all other third party extensions to no avail.

I get no unusual errors in Firebug. Under Net, just a bunch of GET 304 reports for a lot of CiviCRM jQuery and other Javascript libraries.

Turning on Debugging with backtrace produces no output. Clean page.

Any help would be greatly appreciated. Thanks in advance.

# Answer
You are experiencing CRM-16035 - Dashlet refresh can crash server.

The default dashboard config is pretty close to maxing out the default Debian config for either Apache or PHP-FPM.

Depending on your server setup (question says just Apache which typically suggests via mod\_php) you probably need to increase either the number of connections Apache permits.

You could also remove some dashboard widgets for the affected contact - if the dashboard is currently inaccessible so not editable for you, you could do this by directly editing entries in `civicrm_dashboard_contact` in the DB.

If you are using Apache + php-fpm or fcgi, you might need to increase the max\_children setting in your php-fpm config instead. For non-Apache users, other StackExchange will explain how to increase server limits for your php/webserver configuration.
> 2 votes

# Answer
How many dashlets do you have?

The way they are implemented unfortunately triggers 2 http requests (one to get the dashlet, the other behind to generate the content of that dashlet if it's not cached)

So if you have "many", you might end up with more queries that what your server can handle in parallel and slow things, or trigger some protection against denials of services or...

Try increasing the number of php processes that run and see if it fixes things. if it does, you can then remove some dashlets?
> 1 votes

---
Tags: ajax, dashboard, 4.6.4, javascript, dashlet
---


# Question
Title: At what line in a file should I add a new variable
I want to add a new variable to the variables.php file. Should I add it at the bottom of the file, or where it logically sits in the order of the variables, ie under the variable that will be above it on the form?

# Answer
I assume you mean CRM/Core/Config/Variables.php

If you're adding something to that file that you're going to **submit as a pull request or patch back to core**, put your changes where they fit most logically. It'll make more sense to others in the future.

If you're doing a **site-specific customization** and want to edit the file, *don't*. You'll have trouble when it comes time to upgrade. Instead, create an extension.
> 3 votes

# Answer
Neither place is appropriate for my use. CRM/Core/Config/Variables.php is 'deprecated'. (I didn't know that when I asked my question.)

New variables for settings should be added to the appropriate file in the settings folder.

See http://wiki.civicrm.org/confluence/display/CRMDOC/Settings+Reference for more details.
> 2 votes

# Answer
If you want to make local changes to core files there's also the Custom PHP directory. This won't get overwritten on upgrade but you'll need to review your patches to make sure the underlying core file hasn't significantly changed.
> 1 votes

---
Tags: developer
---


title: Issue after provider changed serveur/db

text:
# Question
Title: Issue after provider changed serveur/db
I have now a new issue with one of my CiviCRM website.

My provider (Infomaniak) decided to move to a new server.

All my Joomla website works well but I have now a trouble with CiviCRM.

When I start it I get this :

```
XML data could not be loaded. Make sure you specified the correct path.
Call stack
#   Function    Location
1   JAdministrator->dispatch()  JROOT/administrator/index.php:46
2   JError::raiseError()    JROOT/administrator/includes/application.php:164
3   JError::raise() JROOT/libraries/joomla/error/error.php:251

```

Could someone help me ?

Thanks a lot for your answer !

# Answer
> 3 votes
You need to delete /media/civicrm/civicrm/ConfigAndLog/Config.IDS.ini file.

This will fix the issue.

This is clearly mentioned in Step 9 in the docs - http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location . Make sure you (your provider) follow these instructions when moving CiviCRM to new server/location

---
Tags: webserver
---


# Question
Title: How to expose participant information to the event's trainer?
**Setup**

We have a multisite CiviCRM (Version 4.4.13) and the latest Drupal. CiviEvent is used to create events and manage participants. CiviCRM contacts and Drupal users are connected.

Each event has a custom contact reference field "Trainer". Admin staff will select the appropriate event's trainer (CiviCRM contact) in this field. Participants register via Drupal Webforms.

**Aim**

The aim is for every trainer to be able to see the names and certain registration information of his/her own training's participants (and only those). It should be accesible once the trainer logs in with his/her Drupal credentials.

**Thoughts so far**

One could probably use CiviCRM ACL feature. However, this would probably require to set up one ACL group per event - which is not feasible/comfortable as there are too many events.

We were considering a relationship created by the webform that grants the trainer permissions to view participants but wasn't able to come up with something viable either...

IMHO, most promising seems to be a Drupal View that shows the partcipants in question. However it would need some kind of filter or access restriction so that only the registration information of the trainer's participants is shown.

So far, I wasn't able to find a good solution. Maybe a contextual filter would work?

**Question**

Does anyone know, how to solve that in a Drupal View? Or of yourse any other approach which does not require a lot of manual work per event?

Any ideas or hints would be highly appreciated.

# Answer
> 1 votes
From my limited knowledge of the module, this sounds like the perfect use case for CiviCRM Entity.

You should be able to add an entity reference field to the Event entity (that CiviCRM Entity would create), the Participants entity (I think that CiviCRM Entity would create) and one to the Trainer Content Type (that you'd create) and link them together.

From there, you should be able to create whatever View you want with logged on user as the contextual filter.

---
Tags: civievent, drupal-views, multisite
---


# Question
Title: How to display more than 100 as a search result?
When doing a search, and getting a result of more than 100, it is not possible to display all at the same page. It is only limited to 25, 50 or 100.

How can I display more than 100 search results on the same page?

# Answer
> 3 votes
In CiviCRM version 4.5+ you can control exactly how many results are shown per page. At the bottom-right corner of the search results, click the up/down arrows to increment the count by 25, or type in whatever number you wish:

# Answer
> 2 votes
If you choose to display 100 as search result, your URL will change. The last number in the URL is setting how many you want to display.

Simply overwrite the number 100 with the number you desire, and then hit enter.

---
Tags: search-results
---


# Question
Title: Module or extension to use for tracking agreements?
I'm looking for a module or extension that has been written for tracking contracts/agreements between organizations within CiviCRM (on drupal). We would like to be able to track all the activities that happen related to that agreement within CiviCRM.

I thought Cases might be a good way to do this, but they are started based on a single contact.

# Answer
> 4 votes
You can setup CiviCase to enable multiple clients per case, by editing your xml/configuration/Settings.xml file. Set `<AllowMultipleCaseClients>1</AllowMultipleCaseClients>`

# Answer
> 2 votes
Perhaps CiviMember? We have a client that is the purchasing consortium for Higher Education institutions in Southern Africa. They are a non profit membership body and help their members collaborate on procurement contracts. A few years I built them a D6 + Civi system to manage member and supplier info, and tweaked CiviMember, with custom fields and Views to manage their Contracts. It captures supplier and supplier contact info, contract descriptions start/expiry dates, documents etc.

---
Tags: drupal, civicase
---


title: Omitting soft credits from reports

text:
# Question
Title: Omitting soft credits from reports
**I need to omit soft credits from some reports.** Financial reports currently double the amount of some contributions when the contributions include a soft credit. For example, matching donations are entered with soft credits to the original donor, but these matching donations should not be included in the report totals.

# Answer
There is a default criteria in (some of the reports) that can be checked for contributions only, or soft credits only.

But difficult to be more specific, unless you state your Civi-version, and the name of the report.
> 1 votes

---
Tags: civireport, contributions
---


# Question
Title: Upgrade from 4.6.3 to 4.6.4 not completed
I tried to upgrade version 4.6.3 (Drupal 7.37, dutch) to version 4.6.4. After upgrading the database, `[Executed: Upgrade DB to 4.6.4]` the process seemed to stop on 2/3 of the bar. After 10 minutes I tried to use CiviCRM and it worked showing version 4.6.4.

There are no errors in the logfile server or on screen, in civicrm.log the normal logging `[Executed: Upgrade DB to 4.6.4]` and `[upgrade:4.6.4.upgrade->4.6.4]`

Maybe the problem was that I first tried the upgrade without being signed in on Drupal. After the error I started the upgrade again and it did not completed, but CiviCRM works.

Will this cause problems going forward or am I okay?

# Answer
You can see exactly what queries are being run by this incremental upgrade by opening up the CRM/Upgrade/Incremental/sql/4.6.4.mysql.tpl. In this case it's basically nothing. There is one query in there, which you could copy and paste into e.g. PHPMyAdmin and run it from there (although it honestly doesn't look very important).

Normally I would worry about a hung upgrade and recommend you restore from backups and try again. But in this case I think you lucked out.
> 1 votes

---
Tags: upgrade
---


# Question
Title: How to integrate with Drupal migrate to create a periodic import into CiviCRM?
We have a requirement to periodically update a set of contacts in the CRM from an external source. Our preferred base technology is Drupal migrate. This is so that we can automate some transforms and the user can trigger the imports as well as review the results. It's also so that we don't run into the performance limits that we typically do with the CiviCRM import procedure.

Which module is the best option for creating the CiviCRM integration?

1. civicrm\_migrate
2. civimigrate
3. civicrm\_entity

# Answer
I would expect 2/ ie https://github.com/eileenmcnaughton/civimigrate which we have made lots of use off for migrating legacy data. From memory we have one situation where client can 'click a switch' to run a migration to pull in latest data. I will flick a note to eileen to see if she can expand
> 4 votes

---
Tags: drupal, import
---


# Question
Title: How do I put a thermometer on a contribution page?
My organization occasionally does one-off fundraising drives for specific situations where we need to raise a certain amount of money (e.g. "Send our youth employees to the US Social Forum"). Creating a new contribution page makes sense here. But we'd like to have a thermometer on the page.

Using a personal campaign page would give us a thermometer, but it's an extra hassle to set up, and doesn't quite fit the situation as well because of the way the PCP creates soft credits.

The contribution page provides a widget with a thermometer that I can embed on *other* sites. I can even embed this widget within the contribution page to obtain a thermometer. But then I get a bunch of superfluous stuff in the widget, like a "Contribute" button which takes people to the page they're on. No good.

# Answer
> 2 votes
Seems like it works well for you to copy and paste the embed code onto the contribution form, there are just certain redundant bits you'd like to hide. You could add some generalized global rules for this to your website's css. e.g.

```
form.CRM_Contribute_Form_Contribution_Main .crm-contribute-widget h5,
form.CRM_Contribute_Form_Contribution_Main .crm-contribute-widget .crm-comments,
form.CRM_Contribute_Form_Contribution_Main .crm-contribute-widget .crm-campaign,
form.CRM_Contribute_Form_Contribution_Main .crm-contribute-widget .crm-contribute-button-wrapper {
  display:none;
}

```

# Answer
> 1 votes
The best solution I've come up with is to generate the widget, edit the code, append the following CSS, and paste into the contribution page's introductory message source:

```
h5#crm_cpid_35_title,
div#crm_cpid_35_comments,
div#crm_cpid_35_campaign,
div#crm_cpid_35_button {
  display: none;
}

```

This works for me, but I'd like to find a better solution that is more usable by non-technical staff.

---
Tags: contribution-page
---


# Question
Title: Importing Household Address if Already Exists
I've seen several requests for this, but some seems outdated. **Goal: Import contacts and households and update existing records.** I'm using http://forum.civicrm.org/index.php?topic=29506.0 as a reference. **Should it work for contact updates?**

1. Using 4.6.3 and import GUI.
2. Import household contact with primary home address **(complete)**
3. Associate relationship for contacts as Member of household **(complete)**
4. Associate relationship for contacts of Spouse **(TBD but suggestions welcome)**
5. Associate contacts as having Master Address belonging to household

This seems like a very common use case and I'm almost there...now attempting steps 4 and 5.

**Status:**

* Created csv with household info and imported successfully.
* Used mysql to collect master address record id.

When importing individuals:

* Selected Update method
* I selected "Master Address Belongs To..." and included the Address ID from mysql **\- Import successful but Address is not updated for existing contact addresses and does not belong to household**

Could this be related to: CRM-16588?

So now I have some related addresses (although I have to manually save to show them properly in view screen) but others belonging to individuals. I suppose I could delete all the individual addresses and reimport but don't like that idea ....

BTW perhaps this could drive a rather large feature request/refactor: *Rather than import master address belongs to ... use the same relationship method but enable an option like "Let Household fields override Household Member" Perhaps this could work like relationship permissions. This could mean any updates to a contact address would update the linked field (consistent with how event pricesets/address work...)*

# Answer
If the households and individuals exist in the database but individuals do not have a shared address with the household, you can run the following sql to create a csv that you can import.

On the import use update and link the first 7 columns to the appropriate columns. (If you don't link the street address, city, state, etc., the individual's shown address will be whatever it was before). The last two columns are just for sanity so you can double check the csv is going to update the right things.

```
select r.contact_id_a internal_id,
       ah.street_address,
       ah.city,
       p.name state,
       ah.postal_code,
       co.name country,
       ah.id master,
       ci.sort_name Ind_name,
       ch.sort_name hh_name
from   civicrm_relationship r,
       civicrm_contact ci,
       civicrm_contact ch,
       civicrm_address ah,
       civicrm_country co,
       civicrm_state_province p
where  r.contact_id_b = ah.contact_id
and    r.contact_id_a = ci.id
and    r.contact_id_b = ch.id
and    r.relationship_type_id = 7  -- hh
and    ah.master_id is null  -- make sure hh isn't mastered off ind
and    ah.is_primary -- use the hh primary address
and    ah.country_id = co.id
and    ah.country_id = p.country_id
and    p.id = ah.state_province_id
and    not ci.is_deleted
and    not ch.is_deleted
and    not exists (select 'does individual have master address id'
            from   civicrm_address ci
            where  ci.contact_id = r.contact_id_a
            and    ci.master_id is not null)

```

If you did an import update and only linked the master address you fix the displayed address of the individuals with sql.

Here are two queries. One lists the people with a master address but missing the details. The other fixes them.

```
select ca.street_address,
       ca.city,
       ca.state_province_id,
       ca.postal_code,
       ca.postal_code_suffix,
       ca.country_id,
       pa.street_address,
       pa.city,
       pa.state_province_id,
       pa.postal_code,
       pa.postal_code_suffix,
       ca.country_id
from   civicrm_address ca,
       civicrm_address pa
where  ca.master_id = pa.id
and    ca.master_id is not null
and    ca.street_address is null

```

Fix missing

```
update civicrm_address ca,
       civicrm_address pa
set    ca.street_address = pa.street_address,
       ca.city = pa.city,
       ca.state_province_id = pa.state_province_id,
       ca.postal_code = pa.postal_code,
       ca.postal_code_suffix = pa.postal_code_suffix,
       ca.country_id = pa.country_id
where  ca.master_id = pa.id
and    ca.master_id is not null
and    ca.street_address is null

```
> 3 votes

# Answer
A workaround is to import the address along with the Master Address ID. So import like you are importing a new address but also include the Master Address ID, mapped to the "Master Address Belongs To" field. It links them and populates the address.
> 3 votes

# Answer
This is in answer to the how to create spouses from household members.

Here is some sql. You can use it to create a csv to do an import update individual or paste into the Specify SQL Query box after selecting Specify SQL Query for data source.

You'll have to manually link the second column to Spouse Of Internal Contact ID. The others should default correct. The last three do-not-import columns are just for sanity sake to make sure things look correct.

Notes about sql: If the spouse relationship already exists it will skip that one. If the household is made up of more than two individuals e.g. husband, wife, kid1, it will make two of them spouse and ignore the third. Not sure which two will be used.

```
SELECT rh.contact_id_a internal_id,
       ri.contact_id_a 'Spouse of',  -- on import link to spouse of internal id
       ch.sort_name '-- Household',  -- do not import
       cs1.sort_name '-- Spouse1',   -- do not import
       cs2.sort_name '-- Spouse2'    -- do not import
FROM   civicrm_contact ch,  -- household
       civicrm_contact cs1, -- first spouse
       civicrm_contact cs2, -- second spouse
       civicrm_relationship rh,
       civicrm_relationship ri
WHERE  ri.contact_id_b = rh.contact_id_b
and    ri.relationship_type_id = 7
and    rh.relationship_type_id = 7
and    ri.contact_id_a <> rh.contact_id_a
and    rh.contact_id_b = ch.id
and    rh.contact_id_a = cs1.id
and    ri.contact_id_a = cs2.id
and not exists (select 'is there already a spouse relationship'
                from   civicrm_relationship re
                where  (rh.contact_id_a = re.contact_id_a
                   or   rh.contact_id_a = re.contact_id_b)
                and     re.relationship_type_id = 2) -- spouse
group by rh.contact_id_b  -- sneaky way to get only one row for each pair otherwise get two rows

```
> 1 votes

---
Tags: import, addresses, households
---


# Question
Title: Not sure that I have Contribution Tracker configured correctly
Drupal 7.37, CiviCRM 4.4.15

Principles outlined in this **page** to embed a variable in the URL that gets stored in a hidden field on the contribution page.

Do I need to make the custom fields required or read-only? I made them searchable. For each contribution I am getting a row inserted into the database table "civicrm\_value\_campaign\_1", but the three fields are all blank.

URL: www.domain.org/civicrm/contribute/transact?reset=1&id=8&custom\_1=sponsorship&custom\_2=15&custom\_3=child&amount=35.00

```
<?php

function pptsponsorship_civicrm_buildForm($formName, &$form)
{
// enable tracking feature
if (($formName == 'CRM_Contribute_Form_Contribution_Main' ||
        $formName == 'CRM_Contribute_Form_Contribution_Confirm' ||
        $formName == 'CRM_Contribute_Form_Contribution_ThankYou') &&
    $form->getVar('_id') == 8 ) { // use  CONTRIBUTION PAGE ID here

    // use the custom field ID and custom field label here
    $trackingFields = array('custom_1' => 'Campaign',
        'custom_2' => 'Appeal',
        'custom_3' => 'Fund');
    $form->assign('trackingFields', $trackingFields);

    if ($_GET['amount']) {
        $defaults['price_3'] = $_GET['amount']; //set the other value
        $defaults['frequency_interval'] = 1;
    }
    $form->setDefaults($defaults);
}
}

```

changed the code to the following:

function pptsponsorship\_civicrm\_buildForm($formName, &$form) { // enable tracking feature if (($formName == 'CRM\_Contribute\_Form\_Contribution\_Main' || $formName == 'CRM\_Contribute\_Form\_Contribution\_Confirm' || $formName == 'CRM\_Contribute\_Form\_Contribution\_ThankYou') && $form-\>getVar('\_id') == 8 ) { // use CONTRIBUTION PAGE ID here

```
    if (!$_GET['custom_1']) {
        require_once 'CRM/Core/BAO/CustomGroup.php';
        $defaults = CRM_Core_BAO_CustomGroup::extractGetParams( $this, "'Contact', 'Individual', 'Contribution'" );
    } else {
        $defaults['custom_1'] = $_GET['custom_1'];
        $defaults['custom_2'] = $_GET['custom_2'];
        $defaults['custom_3'] = $_GET['custom_3'];
    }

    // use the custom field ID and custom field label here
    $trackingFields = array('custom_1' => 'Campaign:Campaign',
        'custom_2' => 'Campaign:Appeal',
        'custom_3' => 'Campaign:Fund');
    $form->assign('trackingFields', $trackingFields);

    if ($_GET['amount']) {
        $defaults['price_3'] = $_GET['amount'];
        $defaults['frequency_interval'] = 1;
    }
    $form->setDefaults($defaults);
}

```

}

It is now working.

# Answer
> 1 votes
It looks like you're not using the jQuery snippet mentioned here to populate your hidden values.

Also, there's a Google Summer of Code 2015 project that will hopefully make this question obsolete: Also, this may not be ready in time for you, but some of what you want is coming to core: forum.civicrm.org/index.php?topic=36091.0

---
Tags: civicontribute, drupal
---


# Question
Title: Is it possible to modify content in the invoice template based on contribution currency?
We have a client who has membership bases in two countries (e.g. Australia and New Zealand). I understand that we can have two membership organisations to manage the two membership bases.

The issue seems to be that the invoice template, for contributions, shows the Name, Address, Currency etc for the primary domain.

Due to legal requirements as to what should appear on an invoice we need to be able to change the invoice content a little to reflect the address of the member organisation, rather than the primary organisation.

Is it possible to have the content of the Invoice change to reflect the membership organisation? Maybe by detecting the Contribution Currency and adjusting the invoice template markup to suit?

The API explorer is throwing an error for me, when trying to search for Contributions, so it's hard to know where to start on this one.

# Answer
Yes, you can change the invoice value based the currency

To start with please create an extension using

hook\_civicrm\_tokens and hook\_civicrm\_tokenValues

Make the necessary changes in Message Templates -\> System Workflow Message -\> Contribution Invoice Receipt

This will allow you to make the changes in Invoice
> 2 votes

---
Tags: civicontribute, currency
---


# Question
Title: field like "Current Employer" that creates new organization and relationship
Is there a way to create in a new custom field the functionality in an Individuals "Current Employer" field?

For example, trying to create a generic "Organizational Affiliation"...

How to create the relationship between the Individual and this Organization? And if the organization does not already exist then to create it on-the-fly?

Then this field could be added to profile for use contribution page for membership signup.

Edit: This is on Drupal.

Edit: This question turning into "How to create relationships between contacts on contribution pages?" I started out saying "in a new custom field" but *new custom field* isn't important and as @Coleman points out is bad idea. But some sort of field that allows constituent to enter name of another contact they're related to and have the relationship get created upon form submission.

# Answer
If you want a custom "Contact Reference" field to *always* create a relationship whenever it is saved, you would need to add some custom code implementing hook\_civicrm\_post.

However, before you go down that road I suggest you clarify why you want to create both a custom field *and* a relationship to store the same data. Is it just because that's what the "Current Employer" field does? Not a great reason in my opinion. It's generally a bad practice to store the same data in two places, so the overly-complex "Current Employer" field is not setting a great example of tidy database practices.

I suggest you decide to use a custom "Contact Reference" *or* a custom relationship type, and not both. Trying to store the same data in 2 places is rarely worth the trouble it causes.
> 3 votes

# Answer
If you are using Drupal then the Webform-CiviCRM module can be used to allow user to add their Employer, or find an existing organisation, and create a relationship of 'employee of' between them. Works equally well with a custom relationship type you define. This is well explained in the excellent documentation.
> 2 votes

---
Tags: contacts, custom-fields
---


title: Bar graphs have disappeared

text:
# Question
Title: Bar graphs have disappeared
Bar and pie charts no longer render - and I didn't do anything on my end. I just get a little box now where there used to be a chart.

I've cleared caches and just did an upgrade from 4.4.5 to 4.6.4 in the hopes it would be solved - no joy.

Resources and extension directories are set; I'm stumped here. Any ideas? Thanks!

Further info:

Update: After turning debugging on and off (and seeing no errors), bar graphs now work on the report pages, but not in the dashlets, unless viewing the dashlet fullscreen, in which case they now appear. This is for Firefox and Safari; in Chrome, the graphs don't appear under any circumstances, even when viewing the full report. Hmmm...

# Answer
> 1 votes
Did you change browser?

I experience that Firefox fails to show graphs in CiviCRM, even though it displays without problems in Chrome or Safari

# Answer
> 1 votes
Ad-blocking software in your browser can sometimes cause this, as can an outdated (or missing) copy of Flash.

---
Tags: civireport
---


# Question
Title: Add large amounts of custom data to contacts
I have "contacts" that are websites. I want to add large amounts of custom data to my contacts. An example of the type of data I want to add can be seen in this "report" https://freephile.org/wikireport/?wikiUrl=http://wikia.com

How should I setup my CiviCRM with all these custom fields (profiles?, custom field sets?)

Once the database is setup, I envision populating the data through the API, but is there any particular method for populating data sets that I should be aware of? (I've already figured out the basics of checking a record, and storing a simple relationship like contact+website)

# Answer
> 2 votes
You need to configure one or more Custom Data Sets to contain the information you wish to maintain. Generally you would want to split the information across data sets to reflect any natural categorization, for instance having datasets for 'Wiki Report', 'Extensions', and 'Statistics'.

If you are planning on using the API to load the data, you don't necessarily need profiles (unless you anticipate also doing some manual entry). Profiles can also be used for display, but (if on Drupal) you may find views much more useful for display.

(datasets maintain the actual definition and storage of custom fields; profiles generally provide forms for the entry of the custom field data, or for display of information.)

Using the API is fairly straightforward so you shouldn't have any problems with that I don't think. Using the API explorer (yoursite/civicrm/api/explorer) is a hugely useful tool for figuring out the proper call methods.

---
Tags: custom-fields
---


# Question
Title: Participant Status vs. Participant Status ID
Did I miss something or has there been a architectural change with these parameters? The search builder gives a list of the status options for both of these parameters, but for the Participant Status ID is throws an error: is not of the type Int

In which release has there been recent changes to this part of civicrm? And which Github or JIRA issues document that change?

# Answer
I don't think anything has changed. Every participant status has both a label/name as well as an assigned ID (integer) value. The search builder lets you construct a search using either construct.

I do see on the 4.6 sandbox, that when I select to search on Participant Status ID that its possible option values are the names rather than the ID's.... however the result set still came back correctly and displayed the ID's.

I suspect this behaviour goes back to v3 days.
> 1 votes

---
Tags: civireport
---


title: how to add fieldset to profile

text:
# Question
Title: how to add fieldset to profile
I added a multi-record field set to individual contacts:

> Field set name = Organizational Affiliations
>
> * Field 1 = Organization Name
> * Field 2 = Position or Title

...and see I can now add multiple affiliates to an individual via site/civicrm/contact/add?reset=1&ct=Individual.

How do add that field set to a profile? It seems I can only add individual fields, not a set of fields, to a profile?

I intended to put this field set in a profile because the profile can be embedded in the contribution page for membership signup forms. If there's another way new members can enter this data without using a profile that would be fine too.

# Answer
I don't believe there is a way you can add a data (field) set en masse.... you need to add each field in the data set individually.
> 1 votes

---
Tags: civimember, profile, contacts
---


# Question
Title: REST API - setting an activity's custom fields
How do I set a custom field value for an Activity via the REST API?

I can create an activity on a contact. I am looking to set a value for a custom field within that activity as well.

For reference my current POST request looks something like this:

```
<www_path>?entity=activity&action=create&activity_id=0&target_contact_id=0

```

Any insight is appreciated! Thanks for the help!

# Answer
> 3 votes
You need to know the custom field ID of the field in question. If the ID is 14, you can use:

```
<www_path>?entity=activity&action=create&activity_id=0&target_contact_id=0&custom_14=myvalue

```

In general, if you're asking these sorts of questions, you can answer them best by using the API explorer: **Help menu \> Developer \> API Explorer**. You can use it to design your query, and it will build your REST string for you - including looking up custom field IDs.

To get the ID via the GUI, you can go to **Administer menu \> Customize Data and Screens \> Custom Fields**, then select "View and Edit Custom Fields" for the appropriate group. If you hover your mouse over the "Edit Field" link, you'll see a URL that ends in "&id=x". "x" is your field ID.

To get the field ID via the API, do a call to CustomField.get. Here's a REST call to get the ID of a field called "Mail Designation":

```
/sites/all/modules/civicrm/extern/rest.php?entity=CustomField&action=get&json={"sequential":1,"label":"Mail Designation"}&api_key=yourkey&key=sitekey

```

Better still, use CustomField.getvalue to return just the ID:

```
/sites/all/modules/civicrm/extern/rest.php?entity=CustomField&action=getvalue&json={"sequential":1,"return":"id","label":"Mail Designation"}&api_key=yourkey&key=sitekey

```

---
Tags: api, rest
---


# Question
Title: Cloudflare kills dashboard + Relationship tab error. Any ideas?
Drupal 6.36; CiviCRM 4.5.8

I am experiencing two problems after making changes to my site. Not sure if the problems are related. I will start troubleshooting but any guidance would be very helpful.

**1. Civi dashboard** loading icon spins and dashlets don't load. This may be related to us installing Cloudflare (http://forum.civicrm.org/index.php/topic,27176.msg142612.html#msg142612).

**2. Relationships tab** generates error on click. Screen loads but the relationships list doesn't open. The following two popups appear:

> DataTables warning: table id=DataTables\_Table\_0 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
>
> DataTables warning: table id=DataTables\_Table\_1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

Clicking the Add relationship button opens the dialogue and allows it to be completed, but on saving the above errors appear again.

**Background:**

* Moved the site to a faster server with no apparent problems
* 6 hrs later...
* Upgraded Drupal 6.36 security release. All seems fine.
* Tried to install Civi4.6.4 but it errored out so I reverted to the 4.5.8 backup. It was late and I didn't copy the error :-(
* Implemented Cloudflare. Civi is appreciably faster. Cloudflare needs www. domains so I set up a redirect in htaccess and updated the Civi paths and resource URLs. Also cleared all caches

Thanks Davy

# Answer
Disabling Cloudflare or switching off popups as suggested didn't help. Neither did setting up a Cloudflare PageRule to bypass all Civi pages

But this worked:

I followed the instructions here (http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades) to clean up my database schema, and then the upgrade to 4.6.4 worked - and fixed the problems.
> 3 votes

# Answer
First (and easiest to do) disable Cloudflare and see if the site operates correctly. Disabling Cloudflare is super easy to do.

This may be related to the pop-up forms in recent versions of CiviCRM. You can go to civicrm/admin/setting/preferences/display and unselect "Enable Popup Forms" and see if that corrects the problem as well.
> 0 votes

---
Tags: upgrade, relationships
---


# Question
Title: Problem after upgrading: table not found
I have a big issue after installing an upgrade of CIVICRM.

The debug output indicates a table is missing but does not identify which one: DB Error: no such table

What should I do?

I have add a debug line to see what is happening :

```
CRM_Core_DAO_Domain: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO_Domain: QUERY: /*!40101 SET NAMES utf8 */
CRM_Core_DAO_Domain: query: QUERY DONE IN 0.00063800811767578 seconds
CRM_Core_DAO_Domain: QUERY: SET NAMES utf8
CRM_Core_DAO_Domain: query: QUERY DONE IN 0.00042486190795898 seconds
CRM_Core_DAO_Domain: find: 1
CRM_Core_DAO_Domain: QUERY: SELECT *, config_backend, locales, locale_custom_strings
FROM civicrm_domain

WHERE ( civicrm_domain.id = 1 )

CRM_Core_DAO_Domain: query: QUERY DONE IN 0.00088405609130859 seconds
CRM_Core_DAO_Domain: find: CHECK autofetchd 1
CRM_Core_DAO_Domain: find: ABOUT TO AUTOFETCH
CRM_Core_DAO_Domain: FETCH: a:8:{s:2:"id";s:1:"1";s:4:"name";s:45:"Connaissance et Vie d'Aujourd'hui - Charleroi";s:11:"description";s:22:"Association culturelle";s:14:"config_backend";s:2955:"a:79:{s:18:"dateformatDatetime";s:14:"%E %B %Y %Hh%M";s:14:"dateformatFull";s:8:"%E %B %Y";s:17:"dateformatPartial";s:5:"%B %Y";s:14:"dateformatYear";s:2:"%Y";s:14:"dateformatTime";s:5:"%Hh%M";s:15:"dateInputFormat";s:8:"dd/mm/yy";s:15:"fiscalYearStart";a:2:{s:1:"M";s:1:"1";s:1:"d";s:1:"1";}s:15:"civiRelativeURL";s:44:"/administrator/?option=com_civicrm&task=";s:21:"includeWildCardInName";s:1:"1";s:18:"includeEmailInName";s:1:"1";s:21:"includeNickNameInName";s:1:"0";s:24:"includeAlphabeticalPager";s:1:"1";s:20:"includeOrderByClause";s:1:"1";s:22:"smartGroupCacheTimeout";s:1:"0";s:22:"defaultSearchProfileID";s:0:"";s:10:"lcMessages";s:5:"fr_FR";s:25:"monetaryThousandSeparator";s:1:",";s:20:"monetaryDecimalPoint";s:1:".";s:11:"moneyformat";s:5:"%c %a";s:16:"moneyvalueformat";s:3:"%!i";s:12:"countryLimit";a:1:{i:0;s:4:"1020";}s:13:"provinceLimit";a:1:{i:0;s:4:"1020";}s:21:"defaultContactCountry";s:4:"1020";s:15:"defaultCurrency";s:3:"EUR";s:14:"legacyEncoding";s:12:"Windows-1252";s:23:"customTranslateFunction";s:0:"";s:14:"fieldSeparator";s:1:",";s:11:"_qf_default";s:17:"Localization:next";s:21:"_qf_Localization_next";s:4:"Save";s:13:"inheritLocale";i:0;s:21:"defaultCurrencySymbol";s:3:"â‚¬";s:16:"enableComponents";a:5:{i:0;s:10:"CiviMember";i:1;s:9:"CiviEvent";i:2;s:8:"CiviMail";i:3;s:10:"CiviReport";i:4;s:14:"CiviContribute";}s:18:"enableComponentIDs";a:5:{i:0;s:1:"3";i:1;s:1:"1";i:2;s:1:"4";i:3;s:1:"8";i:4;s:1:"2";}s:11:"mapProvider";s:6:"Google";s:9:"mapAPIKey";s:0:"";s:11:"geoProvider";s:6:"Google";s:9:"geoAPIKey";s:0:"";s:10:"userSystem";O:23:"CRM_Utils_System_Joomla":4:{s:9:"is_drupal";b:0;s:9:"is_joomla";b:0;s:12:"is_wordpress";b:0;s:24:"supports_form_extensions";b:0;}s:11:"initialized";i:0;s:15:"DAOFactoryClass";s:23:"CRM_Contact_DAO_Factory";s:17:"componentRegistry";O:18:"CRM_Core_Component":0:{}s:9:"inCiviCRM";b:0;s:18:"recaptchaPublicKey";N;s:5:"debug";i:0;s:9:"backtrace";i:0;s:12:"resourceBase";N;s:15:"timeInputFormat";i:1;s:15:"currencySymbols";s:0:"";s:14:"gettextCodeset";s:5:"utf-8";s:13:"gettextDomain";s:7:"civicrm";s:27:"userFrameworkUsersTableName";s:9:"jos_users";s:21:"userFrameworkFrontend";b:0;s:20:"userFrameworkLogging";b:0;s:17:"maxImportFileSize";i:1048576;s:14:"maxAttachments";i:3;s:11:"maxFileSize";i:2;s:13:"geocodeMethod";s:0:"";s:12:"mapGeoCoding";i:1;s:15:"contactUndelete";b:1;s:7:"logging";b:0;s:12:"versionCheck";b:1;s:11:"civiModules";a:0:{}s:9:"enableSSL";b:0;s:18:"fatalErrorTemplate";s:20:"CRM/common/fatal.tpl";s:17:"fatalErrorHandler";N;s:17:"maxLocationBlocks";i:2;s:15:"captchaFontPath";s:25:"/usr/X11R6/lib/X11/fonts/";s:11:"captchaFont";s:17:"HelveticaBold.ttf";s:21:"dashboardCacheTimeout";i:1440;s:15:"doNotResetCache";i:0;s:13:"oldInputStyle";i:1;s:14:"formKeyDisable";b:0;s:21:"doNotAttachPDFReceipt";b:0;s:13:"verpSeparator";s:1:".";s:12:"mailerPeriod";i:180;s:16:"mailerSpoolLimit";i:0;s:16:"mailerBatchLimit";i:0;s:13:"mailerJobSize";i:0;s:13:"mailerJobsMax";i:0;}";s:7:"version";s:5:"4.1.5";s:12:"loc_block_id";s:1:"2";s:7:"locales";N;s:21:"locale_custom_strings";s:453:"a:1:{s:5:"fr_FR";a:2:{s:7:"enabled";a:2:{s:13:"wildcardMatch";a:0:{}s:10:"exactMatch";a:0:{}}s:8:"disabled";a:2:{s:13:"wildcardMatch";a:9:{s:11:"Ã©vÃ©nement";s:9:"activitÃ©";s:7:"Billing";s:11:"Facturation";s:4:"Save";s:11:"Enregistrer";s:3:"and";s:2:"et";s:3:"New";s:7:"nouveau";s:12:"Contribution";s:8:"paiement";s:3:"Add";s:7:"Ajouter";s:4:"Both";s:8:"Les deux";s:7:"Address";s:7:"adresse";}s:10:"exactMatch";a:1:{s:7:"Pending";s:10:"En attente";}}}}";}
CRM_Core_DAO_Domain: find: DONE
CRM_Core_DAO: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO: QUERY: SET NAMES utf8
CRM_Core_DAO: query: QUERY DONE IN 0.00046706199645996 seconds
CRM_Core_DAO: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO: QUERY: SET NAMES utf8
CRM_Core_DAO: query: QUERY DONE IN 0.00047397613525391 seconds
CRM_Core_DAO: QUERY:
SELECT name, group_name, value
FROM civicrm_setting
WHERE ( group_name = 'Directory Preferences'
OR group_name = 'URL Preferences' )
AND domain_id = 1

CRM_Core_DAO: query: QUERY DONE IN 0.00061798095703125 seconds
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:9:"uploadDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";s:14:"s:7:"upload/";";}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:14:"imageUploadDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";s:27:"s:19:"persist/contribute/";";}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:19:"customFileUploadDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";s:14:"s:7:"custom/";";}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:17:"customTemplateDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";N;}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:16:"customPHPPathDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";N;}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:13:"extensionsDir";s:10:"group_name";s:21:"Directory Preferences";s:5:"value";N;}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:24:"userFrameworkResourceURL";s:10:"group_name";s:15:"URL Preferences";s:5:"value";s:53:"s:45:"administrator/components/com_civicrm/civicrm/";";}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:14:"imageUploadURL";s:10:"group_name";s:15:"URL Preferences";s:5:"value";s:41:"s:33:"media/civicrm/persist/contribute/";";}
CRM_Core_DAO: FETCH: a:3:{s:4:"name";s:12:"customCSSURL";s:10:"group_name";s:15:"URL Preferences";s:5:"value";N;}
CRM_Core_DAO: FETCH: N;
CRM_Core_DAO: FETCH: Last Data Fetch'ed after 0.0010199546813965 seconds
CRM_Core_DAO_Setting: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO_Setting: QUERY: SET NAMES utf8
CRM_Core_DAO_Setting: query: QUERY DONE IN 0.00049209594726562 seconds
CRM_Core_DAO_Setting: find:
CRM_Core_DAO_Setting: QUERY: SELECT *
FROM civicrm_setting

WHERE ( civicrm_setting.group_name = 'CiviCRM Preferences' ) AND ( civicrm_setting.domain_id = 1 ) AND ( civicrm_setting.is_domain = 1 )

CRM_Core_DAO_Setting: query: QUERY DONE IN 0.00073695182800293 seconds
CRM_Core_DAO_Setting: find: CHECK autofetchd
CRM_Core_DAO_Setting: find: DONE
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:2:"12";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:30:"activity_assignee_notification";s:5:"value";s:4:"i:1;";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"6";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:14:"address_format";s:5:"value";s:179:"s:170:"{contact.address_name}
{contact.street_address}
{contact.supplemental_address_1}
{contact.supplemental_address_2}
{contact.postal_code}{ }{contact.city}
{contact.country}";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-18 12:34:39";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"5";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:15:"address_options";s:5:"value";s:21:"s:13:"123459";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-18 12:34:39";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"3";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:23:"advanced_search_options";s:5:"value";s:42:"s:34:"1234567891013161719";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:2:"11";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:26:"contact_ajax_check_similar";s:5:"value";s:4:"i:1;";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:2:"13";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:28:"contact_autocomplete_options";s:5:"value";s:10:"s:3:"1";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 11:12:19";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"2";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:20:"contact_edit_options";s:5:"value";s:26:"s:18:"123457811";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:2:"14";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:25:"contact_reference_options";s:5:"value";s:10:"s:3:"1";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 11:12:19";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"1";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:20:"contact_view_options";s:5:"value";s:26:"s:18:"123468910";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"8";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:19:"display_name_format";s:5:"value";s:111:"s:102:"{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:2:"10";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:9:"editor_id";s:5:"value";s:8:"s:1:"2";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"7";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:14:"mailing_format";s:5:"value";s:176:"s:167:"{contact.addressee}
{contact.street_address}
{contact.supplemental_address_1}
{contact.supplemental_address_2}
{contact.postal_code}{ }{contact.city}
{contact.country}";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-18 12:34:39";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"9";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:16:"sort_name_format";s:5:"value";s:51:"s:43:"{contact.last_name}{, }{contact.first_name}";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: a:10:{s:2:"id";s:1:"4";s:10:"group_name";s:19:"CiviCRM Preferences";s:4:"name";s:22:"user_dashboard_options";s:5:"value";s:16:"s:9:"1345";";s:9:"domain_id";s:1:"1";s:10:"contact_id";N;s:9:"is_domain";s:1:"1";s:12:"component_id";N;s:12:"created_date";s:19:"2012-07-19 03:15:52";s:10:"created_id";s:1:"1";}
CRM_Core_DAO_Setting: FETCH: N;
CRM_Core_DAO_Setting: FETCH: Last Data Fetch'ed after 0.0021209716796875 seconds
CRM_Core_DAO_Setting: 1: Clearing Cache for crm_core_dao_setting
CRM_Core_DAO_Cache: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO_Cache: QUERY: SET NAMES utf8
CRM_Core_DAO_Cache: query: QUERY DONE IN 0.00047802925109863 seconds
CRM_Core_DAO_Cache: find:
CRM_Core_DAO_Cache: QUERY: SELECT *
FROM civicrm_cache

WHERE ( civicrm_cache.group_name = 'ed50fd1f927546a457b32960d2469b00' )

CRM_Core_DAO_Cache: query: QUERY DONE IN 0.00069308280944824 seconds
CRM_Core_DAO_Cache: find: CHECK autofetchd
CRM_Core_DAO_Cache: find: DONE
CRM_Core_DAO_Cache: 1: Clearing Cache for crm_core_dao_cache
CRM_Core_DAO_Cache: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO_Cache: QUERY: SET NAMES utf8
CRM_Core_DAO_Cache: query: QUERY DONE IN 0.00046586990356445 seconds
CRM_Core_DAO_Cache: find: 1
CRM_Core_DAO_Cache: QUERY: SELECT *
FROM civicrm_cache

WHERE ( civicrm_cache.group_name = 'ed50fd1f927546a457b32960d2469b00' ) AND ( civicrm_cache.path = 'mapper/moduleFiles' )

CRM_Core_DAO_Cache: query: QUERY DONE IN 0.00062990188598633 seconds
CRM_Core_DAO_Cache: find: CHECK autofetchd 1
CRM_Core_DAO_Cache: find: DONE
CRM_Core_DAO_Cache: 1: Clearing Cache for crm_core_dao_cache
CRM_Core_DAO: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO: QUERY: SET NAMES utf8
CRM_Core_DAO: query: QUERY DONE IN 0.00042104721069336 seconds
CRM_Core_DAO: QUERY:
SELECT full_name, file
FROM civicrm_extension
WHERE is_active = 1
AND type = "module"

CRM_Contact_BAO_Contact: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Contact_BAO_Contact: QUERY: SET NAMES utf8
CRM_Contact_BAO_Contact: query: QUERY DONE IN 0.00041103363037109 seconds
CRM_Contact_BAO_Contact: 1: Clearing Cache for crm_contact_bao_contact
CRM_Core_DAO: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO: QUERY: SET NAMES utf8
CRM_Core_DAO: query: QUERY DONE IN 0.00046300888061523 seconds
CRM_Core_DAO: QUERY:
SELECT v.label as label ,v.name as value, v.grouping as grouping
FROM civicrm_option_value v,
civicrm_option_group g
WHERE v.option_group_id = g.id
AND g.name = 'languages'
AND g.is_active = 1 AND v.is_active = 1 ORDER BY v.weight
CRM_Core_DAO: query: QUERY DONE IN 0.00060510635375977 seconds
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:9:"Afrikaans";s:5:"value";s:5:"af_ZA";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:8:"Albanian";s:5:"value";s:5:"sq_AL";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"Arabic";s:5:"value";s:5:"ar_EG";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:9:"Bulgarian";s:5:"value";s:5:"bg_BG";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:18:"Catalan; Valencian";s:5:"value";s:5:"ca_ES";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:15:"Chinese (China)";s:5:"value";s:5:"zh_CN";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:16:"Chinese (Taiwan)";s:5:"value";s:5:"zh_TW";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:5:"Czech";s:5:"value";s:5:"cs_CZ";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"Danish";s:5:"value";s:5:"da_DK";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:5:"Dutch";s:5:"value";s:5:"nl_NL";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:19:"English (Australia)";s:5:"value";s:5:"en_AU";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:16:"English (Canada)";s:5:"value";s:5:"en_CA";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:24:"English (United Kingdom)";s:5:"value";s:5:"en_GB";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:23:"English (United States)";s:5:"value";s:5:"en_US";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:8:"Estonian";s:5:"value";s:5:"et_EE";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Finnish";s:5:"value";s:5:"fi_FI";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:15:"French (Canada)";s:5:"value";s:5:"fr_CA";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:15:"French (France)";s:5:"value";s:5:"fr_FR";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"German";s:5:"value";s:5:"de_DE";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:14:"German (Swiss)";s:5:"value";s:5:"de_CH";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:13:"Greek, Modern";s:5:"value";s:5:"el_GR";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:15:"Hebrew (modern)";s:5:"value";s:5:"he_IL";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:5:"Hindi";s:5:"value";s:5:"hi_IN";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:9:"Hungarian";s:5:"value";s:5:"hu_HU";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:10:"Indonesian";s:5:"value";s:5:"id_ID";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Italian";s:5:"value";s:5:"it_IT";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:8:"Japanese";s:5:"value";s:5:"ja_JP";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:5:"Khmer";s:5:"value";s:5:"km_KH";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:10:"Lithuanian";s:5:"value";s:5:"lt_LT";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:17:"Norwegian BokmÃ¥l";s:5:"value";s:5:"nb_NO";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"Polish";s:5:"value";s:5:"pl_PL";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:19:"Portuguese (Brazil)";s:5:"value";s:5:"pt_BR";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:21:"Portuguese (Portugal)";s:5:"value";s:5:"pt_PT";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:29:"Romanian, Moldavian, Moldovan";s:5:"value";s:5:"ro_RO";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Russian";s:5:"value";s:5:"ru_RU";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"Slovak";s:5:"value";s:5:"sk_SK";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Slovene";s:5:"value";s:5:"sl_SI";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:26:"Spanish; Castilian (Spain)";s:5:"value";s:5:"es_ES";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:27:"Spanish; Castilian (Mexico)";s:5:"value";s:5:"es_MX";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:32:"Spanish; Castilian (Puerto Rico)";s:5:"value";s:5:"es_PR";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Swedish";s:5:"value";s:5:"sv_SE";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:6:"Telugu";s:5:"value";s:5:"te_IN";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:4:"Thai";s:5:"value";s:5:"th_TH";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:7:"Turkish";s:5:"value";s:5:"tr_TR";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: a:3:{s:5:"label";s:10:"Vietnamese";s:5:"value";s:5:"vi_VN";s:8:"grouping";N;}
CRM_Core_DAO: FETCH: N;
CRM_Core_DAO: FETCH: Last Data Fetch'ed after 0.0016689300537109 seconds
Sorry but we are not able to provide this at the moment.
DB Error: no such table
Return to home page.

CRM_Core_DAO: CONNECT: Checking for database specific ini ('') : database_ in options
CRM_Core_DAO: QUERY: SET NAMES utf8
CRM_Core_DAO: query: QUERY DONE IN 0.00045299530029297 seconds

```

---

I succeeded to enable the backtrace :

Here you go :

backTrace

```
#0 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: no such table", -18, 16, (Array:2), "\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#4 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-18, 16, (Array:2), "\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#5 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -18, NULL, NULL, "\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...", "DB_Error", TRUE)
#6 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-18, NULL, NULL, NULL, "1146 ** Table 'fxjp_cvacharleroibe.civicrm_extension' doesn't exist")
#7 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#9 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#10 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#11 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#12 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(1179): CRM_Core_DAO->query("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...", TRUE)
#13 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Extension/Mapper.php(300): CRM_Core_DAO::executeQuery("\n        SELECT full_name, file\n        FROM civicrm_extension\n        WHE...")
#14 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Core/PseudoConstant.php(1837): CRM_Extension_Mapper->getActiveModuleFiles(FALSE)
#15 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook.php(247): CRM_Core_PseudoConstant::getModuleExtensions()
#16 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook.php(165): CRM_Utils_Hook->requireCiviModules((Array:1))
#17 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook.php(137): CRM_Utils_Hook->commonBuildModuleList("joomla")
#18 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook/Joomla.php(102): CRM_Utils_Hook->commonInvoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config", "joomla")
#19 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Utils/Hook.php(1043): CRM_Utils_Hook_Joomla->invoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config")
#20 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/civicrm/CRM/Core/Config.php(257): CRM_Utils_Hook::config(Object(CRM_Core_Config))
#21 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/admin.civicrm.php(66): CRM_Core_Config::singleton()
#22 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/admin.civicrm.php(80): civicrm_initialize()
#23 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/com_civicrm/admin.civicrm.php(40): civicrm_invoke()
#24 /home/clients/a668016378523b2aa52441a2e692c8e7/web/libraries/joomla/application/component/helper.php(380): require_once("/home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/c...")
#25 /home/clients/a668016378523b2aa52441a2e692c8e7/web/libraries/joomla/application/component/helper.php(348): JComponentHelper::executeComponent("/home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/components/c...")
#26 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/includes/application.php(153): JComponentHelper::renderComponent("com_civicrm")
#27 /home/clients/a668016378523b2aa52441a2e692c8e7/web/administrator/index.php(46): JAdministrator->dispatch()
#28 {main}

DÃ©tails additionnels:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] =>
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibe.civicrm_extension' doesn't exist]
    [type] => DB_Error
    [user_info] =>
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibe.civicrm_extension' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::handle prefix="" info="
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibe.civicrm_extension' doesn't exist]"]
)

```

---

Goodmorning everyone,

I have just tried to upgrade again my Civi after restoring my Civi (and it worked well at that time).

So, I followed the whole process step by step but I get again the same error.

Actually the installation works well. I got the succeed message of this but after that I tried to run the page : http://www.cva-charleroi.be/test/administrator/?option=com\_civicrm&task=civicrm/upgrade&reset=1 and it gave me a error 001 Civi : `CiviCRM 4.6.4 requires MySQL trigger privileges`

If I now click on the CiviCRM button I get the same than previously :

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

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] =>
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibetest.civicrm_extension' doesn't exist]
    [type] => DB_Error
    [user_info] =>
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibetest.civicrm_extension' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::handle prefix="" info="
        SELECT full_name, file
        FROM civicrm_extension
        WHERE is_active = 1
        AND type = "module"
       [nativecode=1146 ** Table 'fxjp_cvacharleroibetest.civicrm_extension' doesn't exist]"]
)

```

What have I to do ?

Thanks a lot for you help !

---

Ah, and by the way, lolcode, I want to upgrade from a 4.1.5 to the newest one.

---

CiviCRM runs on Joomla 2.5.28 (upgrading it is panned) with PHP 5.4 (5.5 and 5.6 available) and MySQL 5.5

# Answer
> 3 votes
Whenever you have a serious database error after installing an upgrade the best approach is to restore the previous version from the backups taken before the upgrade as follows:

1. Delete all tables, views and procedures in the database with the error.
2. Restore the pre-upgrade database by importing it (using PHPMyadmin or mysql command line for example)
3. Restore the previous version of the civicrm code

Now you can run the upgrade again and try to determine at what point it fails.

If you do not have a backup then you will need a different approach.

In this case it sounds like you have 2 specific problems:

1. You may need to give MySQL TRIGGER permissions to the user specified in your civicrm.settings.php database connection.
2. You may be affected by a bug in the upgrade process.

**Regarding 1:** See the wiki for reference:

```
-- Assuming a database called "civicrm" and a user called "civicrm_user"
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, TRIGGER,
CREATE ROUTINE, ALTER ROUTINE ON civicrm.*
TO 'civicrm_user'@'localhost' IDENTIFIED BY 'realpasswordhere';

```

**Regarding 2:** A bug related to upgrading from the 4.1 series was reported here on the forum and you may be able to use the workaround noted there:

> 'civicrm\_extension' doesn't exist on upgrade from 4.1.6 to 4.3.5 ....(I) worked around by commenting out the public static function &getExtensions() in CRM/Core/PseudoConstant.php,

Alternately you could upgrade in stages which is often a good approach. Upgrade from 4.15 to the latest version of 4.2. If that is successful take another full backup of the database and code before proceeding further. Now upgrade to the latest version.

By doing the upgrade in smaller stages you are taking advantage of the fact the the upgrade is more heavily tested on the previous one or two versions.

# Answer
> 1 votes
are you using MySQL for your DB? You got from 4.1.5 to 4.1.6 without errors logged - when you upgrade to 4.2, even before going to the CiviCRM Dashboard - can you go into MySQL and do 'show tables' and are they the same number/name of tables as your 4.1.5, do you see 'civicrm\_sms\_provider'? As lolcode above asked, did you grant all on your database 'user' (can you, for example, log in to that database and create a table (just a test)? Maybe I should ask, are you comfortable using SQL?

---
Tags: upgrade, debugging, installation
---


# Question
Title: How do I prevent membership renewal reminders originating from VERP addresses?
On CiviCRM 4.5.5, I have an email address of contactus@example.org configured under Administration \> Communication \> From Address.

When I send the test email the reply to address is the correct email address.

However when I sent a membership renewal reminder the address is a random set of letters and numbers viz:

> ```
> Return-Path: <b.85.1343.f05de58212341234@example.org>
> Reply-To: <r.85.1343.f05de5812341234@example.org>
> From: "APMA" <contactus@example.org>
> To: "Paul Murdoch" <prmurd@example.net>
> Subject: [CiviMail Draft] Your APMA membership
> Date: Sun, 14 Jun 2015 20:27:25 +1000
> Message-ID: <E1Z458P-001P0k-9z@s42.example.net>
> MIME-Version: 1.0
>
> ```

I am guessing this has to do with the automated tracking of newsletters or similar. However I would like the reply to email address to be contactus@example.org.

How do I debug, track this down and correct this?

# Answer
Testing this on v4.6.3, you can define the reply address for a scheduled reminder by editing it at **Administer \> Communications \> Schedule Reminders** (`civicrm/admin/scheduleReminders`). Check if you can configure it there first? I've tried a scheduled reminder just now and see the expected email address when I receive it.

The "random set of letters" is a feature called Variable Envelope Reply Path ("VERP") which permits CiviCRM to better identify and track bounces, unsubscribes and other mail system errors by having them "return" to a unique, identifiable email address.

See also this question: How does Civimail reply tracking and forwarding work?
> 1 votes

---
Tags: civimail, email
---


# Question
Title: How to make the SyntaxConformanceTest use sensible values when it calls the create action of my new API?
I created a patch for CiviCRM that allows saved searches to be created using the API.

Now it turns out that this SavedSearch API does not pass certain syntax conformance unit tests.

One of the problem is that some of the tests try to create a new saved search, and they try to assign a string like `form_values_273form_values_576` to the `form_values` field of the saved search entity.

The saved search BAO expect `form_values` to be a serialized array, and because `form_values_273form_values_576` obviously is not, errors occur, causing some the unit tests to fail. (see e.g. line 239 of /CRM/Contact/BAO/SavedSearch.php)

Is there a way to make those unit tests use a sensible value for `form_value`? `NULL` should do as well, I guess.

# Answer
For most of the tests, it was sufficient to provide an `assignTestValue` method in the SavedSearch BAO.

This did not solve the problem though for testCreateSingleValueAlter.
> 1 votes

---
Tags: api
---


# Question
Title: Activity emails aren't sent when using sender's primary email address
I am looking for an option where a signed in volunteer can send an email to a contact using his primary email address - when I select "send an email" from the actions drop down I do see the default as the signed in user's primary email address, however, if I use that to send an email there doesn't seem to be any email sent even though an activity is registered and i get a notification of a successful email being sent

On the other hand I have added an email to the "From Email addresses" section under civimail (this coincides with the registered domain as well) - if I select this email address and send an email it successfully goes through

any help would be appreciated

Thanks

# Answer
> 2 votes
Are your volunteers are using an email from an external provider as their main address?

If it's the case, say john.doe@yahoo.com or john.doe@gmail.com, it's "normal" that the emails are automatically filtered and flagged as spam: It's a feature for pretty much any big mail provider to whitelist what servers are authorised to send emails on their behalf (SPF) in order to limit spam and prevent "rogue" servers to try to impersonate one of their user.

Obviously, your civicrm server isn't one of the authorised servers, so it ends up directly into the spam, or even simply discarded.

The way emails are sent with civimail is different (no matter what you put as the from sender, it's the email that you defined as bounce that is used to really send the email) so it might be why you experience something different there

Try to use as the sender for "regular" emails an email from a domain you control (your own), the email should be sent properly

---
Tags: civimail
---


# Question
Title: CiviMail sending delayed - how do I configure a cron job?
I am trying to set up CiviMail however I cannot seem to get my emails to go. They remain scheduled.However, when I execute them manually at administer-\>system settings-\> scheduled jobs they go. When I click the edit button , no matter what selection I make on run frequency, that is hourly, daily or every time cron job is run, the emails are never sent.(Until I choose execute now option). I have tried reading on setting up a cron job and managing Scheduled Jobs but can not really understand. I am running CiviCRM 4.6.3 and Drupal 7. I have admin privileges and can access command line if need be.

# Answer
I sounds like you either don't have a cron job configured to run the Scheduled Jobs at regular intervals, or you don't have it configured correctly.

What have you tried using as the cron command when you tried to set that up, and/or what errors does it give? (Edit your question above with further information)
> 1 votes

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


# Question
Title: Embed webforms into site that is custom php
Our site is all custom php/html. It is not built using tools like Joomla or Drupal.

Is it possible to embed webforms directly into our site?

# Answer
CiviCRM standalone profile forms can be embedded anywhere. They are just cut-n-paste html snippets. http://book.civicrm.org/user/current/organising-your-data/profiles/
> 2 votes

---
Tags: webform-civicrm
---


# Question
Title: Webform and multiple memberships with same Member Organisation
When we create several membership types, with the same "Membership Organisation", it looks as if the previous membership has been replaced by the latest one. Assume we have two, MEM1 with 1 year membership at £30 and MEM2 with 2 year membership at £70.

1)Contact signs up for MEM1 fist, membership period is 1 year (June 2015 to May 2016 ), gets charged £30 2)Then signs up for MEM2, the membership period gets extended to 2 years (June 2015 to May 2017), gets charged £70

So what actually happens is, it does not track the memberships separately, and the contact seems to have lost the MEM1 membership.

Even if we were to consider "renewal with upsell" for this scenario, the contact should be charged only the difference in price and not the full price of MEM2, since the duration only gets extended.

Previously webform handled the membership types separately, so what will happen if we were to upgrade to the new version?

Also in civicrm we are still able to add more than one membership type for the same organisation.

Thank You!

# Answer
> 4 votes
Currently you cannot use Webform-CiviCRM to sign members up for two membership types of the same organization concurrently, and this is true for the current release (4.10) and is unchanged in the upcoming v4.11.

What you described in your testing is working as designed. If a user signs up for type MEM1 and pays the fee, then comes back a year later and signs up for MEM2, it will change their membership type to MEM2, charge them the price for MEM2, and extend their expiration by a year. The only thing in your testing that made it look weird is that you did both of those things on the same day. Just wait a year between signups and it will make sense :)

If you do want to use a webform to sign members up for 2 different membership types, simply set them up in CiviCRM as belonging to different member organizations, and then the webform will understand it as a separate signup and not a renewal.

---
Tags: civimember, webform-civicrm
---


# Question
Title: Is there a way for a user to verify themselves when following a checksum link?
Use case:

1. Email a checksum link to a user asking them to update their profile data.
2. When that user clicks the checksum link, request that they fill out a couple of verification fields such as postcode/date of birth/account number before being shown their data (just in case its not them).

I saw this demo'd at CiviCon London 2014 but can't remember who presented it, what it was called or if it was already part of CiviCRM or an extension. Googling for it has been unsuccessful.

# Answer
> 1 votes
I dont remember this session at CiviCon London. By any chance, are you referring to the email address validation on unsubscribe (the user has to enter their email address to unsubscribe)

I suspect the way the above would need to be done, would be:

a. Take the user to a different validate and confirmation page.

b. On confirmation, send the user to the real profile edit page

c. Add a hook to the profile edit page to ensure that any user coming here has come via the confirmation page

# Answer
> 1 votes
roxca, et al - could this be what you're looking for? It is from back in Oct. 2010 : http://forum.civicrm.org/index.php?topic=16030.0 Source code is here: https://app.box.com/shared/dsti564nkn

---
Tags: email, security
---


# Question
Title: Google Apps bounce processing - is the wiki current?
I'm fairly savvy with civicrm in general but bounce processing seems to always stump me. **Trying to use Google Apps for the return channel**, I saw this post on the wiki: Step-by-step+Return+Channel+on+Drupal+-+Google+Apps+-+CentOS, which is referenced here: CiviMail+Installation.

**Is this still the best practice** to get the return channel to work? If so, **I'm confused by the reference to return@domain.org**. If the organization sends from info@domain.org can't one simply use the info+return@domain.org as the return channel or does this example expect the sending address to be return@domain.org?

**The return address does not change at all if I enable/disable VERP setting in civicrm mail component settings.** I have used return+ in the "localpart" and have **Return Path blank**. I assume that it is automatically generated.

Also, the **wiki says** that there are "**There are four possible solutions** for handling of the return channel." but lists only 2. Furthermore it says " Second, some SMTP services (notably **google**) insert their own Return-Path address headers, superseding the headers set by civiMail and **effectively disabling bounce tracking**." **Does that refer to "Gmail" or "Google Apps"?** When using an outlook client, it does let me change the Reply to address.

I'm using IMAP and after executing the bounce processing job manually I see the mail moved to "label:inbox-civimail-ignored".

**Any delicious google app recipes** or updates to the wiki appreciated.

BTW - I've had **similar problems** with SMTP bounce processing **using Mandril** so I'm sure I'm doing something dumb,

# Answer
So first, the VERP setting you see is about processing replies, it isn't the same as the VERP used for the bounces, that are always in.

For the bounces, you need to create a mailbox dedicated for that purpose, (eg. return@domain.org) that is different than your normal sending email (info@domain.org). You could in theory use info@domain.org, but that's likely to create problems for your org.

To test if it works, create a contact with an invalid email address, send a civimail mailing to a group with that address and verify that the bounce email is properly into the return@domain.org mailbox. If it is, you are almost there, as your cronjob seems to be properly setup to fetch that mailbox.

As for the label:inbox-civimail-ignored, it is simply that you have an email in your "bounce/return" mailbox that isn't a bounce. One of the many reasons to keep your info@domain (where recipients might reply to) separated from your return@domain (where only the mail servers are supposed to reply to when there is a bounce).
> 2 votes

---
Tags: civimail, email, bounce
---


title: Cron sending reports weekly

text:
# Question
Title: Cron sending reports weekly
Sending reports by email is a really nice feature in CiviCRM. This is done by creating a specific cron job for each report.

However, this will be sent only at the intervals given. And they are "daily", "hourly" or "every time cron job is run". I would love to send some reports on a weekly basis, or even monthly basis. Suggestions on the forum is to set the cron to run only once a week, but I need to run the cron every minute.

Is there any way to send, by email, specific reports automatically on a weekly basis?

# Answer
You can set up cron jobs besides the main one driving all the scheduled jobs on the Scheduled Jobs page. The way to do it is explained at http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod

You might have your main job going every 10 minutes like:

```
*/10 * * * * php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute

```

You'll just need to add a new one for the report, let's say to send the report instance with the ID of 123 every Monday at 8:00:

```
0 8 * * 1 php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a mail_report --instanceId=123

```

You don't need anything in the main Scheduled Jobs page for this--this is 100% separate.

Back in the old days, this is how you had to do all scheduled jobs! Uphill--both ways!
> 12 votes

# Answer
As noted there are various ways documented for scheduling jobs. At our organisation we wanted an easy way to allow our users to set up scheduled email reports and came up with a shared Google Sheet which lets people enter a report instance Id and reporting frequency.

The Sheet uses Google Apps Script to trigger the report generation via the URL method. The template and code has been written up here https://mashe.hawksey.info/2015/06/custom-regular-reporting-from-civicrm-with-google-sheets-and-google-apps-script/ (Disclosure: I'm the author)

\[We also extended the solution to extract csv attachments and import into separate Google Sheets\]
> 4 votes

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


title: system wordpress/drupal confusion

text:
# Question
Title: system wordpress/drupal confusion
I'm a newbie. Attempting to install local MAMP Drupal CiviCRM - following the wiki steps. When I get to the CiviCRM install script, it throws the following error - for some reason the install script seems to think I'm running WordPress.

I've purged it all, tried a again from scratch. Same issue.

========================= Notice: Use of undefined constant WP\_PLUGIN\_DIR - assumed 'WP\_PLUGIN\_DIR' in /Applications/MAMP/htdocs/drupal/sites/all/modules/civicrm/install/index.php on line 63

Notice: Use of undefined constant WP\_PLUGIN\_DIR - assumed 'WP\_PLUGIN\_DIR' in /Applications/MAMP/htdocs/drupal/sites/all/modules/civicrm/install/index.php on line 64

Notice: Use of undefined constant WP\_PLUGIN\_URL - assumed 'WP\_PLUGIN\_URL' in /Applications/MAMP/htdocs/drupal/sites/all/modules/civicrm/install/index.php on line 65

Warning: require\_once(WP\_PLUGIN\_DIR/civicrm/civicrm//CRM/Core/ClassLoader.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/drupal/sites/all/modules/civicrm/install/index.php on line 75

Fatal error: require\_once(): Failed opening required 'WP\_PLUGIN\_DIR/civicrm/civicrm//CRM/Core/ClassLoader.php' (include\_path='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in /Applications/MAMP/htdocs/drupal/sites/all/modules/civicrm/install/index.php on line 75

# Answer
I haven't experienced this myself, but -- skimming the code in `index.php` -- it appears to track a variable called `civicrm_install_type`. The variable defaults to `drupal` but can be set to `wordpress` by passing `?civicrm_install_type=wordpress`. Once it is set, it's stored in the `SESSION` and reused for future page-views.

One way you could probably trigger this behavior is to install WordPress+CiviCRM, swap out the code base, and replace it with a Drupal+CiviCRM codebase (on the same server, using the same browser session).

If this were the situation, you could get around it by either:

* Resetting the PHP session (eg deleting cookies or logging out).
* Explicitly passing `?civicrm_install_type=drupal` when visiting `civicrm/install/index.php`.
> 4 votes

---
Tags: drupal, installation, mamp
---


# Question
Title: How to use auto-complete reference field in a profile?
I am currently using an auto-complete field to indicate which member is representing which organisation. When I preview the field, either in the personalized fields or in the profile I am using it in, the field appears fine (see first image). However, when I use that profile in a contribution page, the field is only ever rendered as a textbox without any kind of auto-complete enabled (see image 2). Is there some kind of custom permission I need to set or is this simply a bug?

Thank you

Image 1:

Image 2:

# Answer
Based on testing on the demo server, it looks like custom contactRef fields *do* work when embedded in the "profiles" section of the contribution page, but fail to work properly when in the special "on behalf" profile. This looks like a bug.

Can you please file an issue in the bug tracker for this?
> 2 votes

# Answer
This may be due to the field's visibility. You may need to set it to public pages in the settings of the field in the profile (\>\>Administre CiviCRM \>\>Profiles \>\>Edit Profile Field). Here's a Screenshot:
> 1 votes

# Answer
Unfortunately I don't believe that CiviCRM supports contact lookup fields on the profiles currently. If you use the Webform CiviCRM integration on the Drupal platform you can use the "existing contact" field to get this feature.

Just be aware that in effect having a contact lookup field is exposing your data to a public form!
> 0 votes

# Answer
I tested this on a demo site, creating a custom contact reference field in a profile on a contribution page, like so:

I then visited that contribution page, and the field looked fine, and I was able to select a contact without any problem:

I suggest you check your browser's console for any javascript errors, and go through these troubleshooting steps. Also upgrade to the latest version of CiviCRM if you haven't done so already.
> 0 votes

---
Tags: custom-fields, contact-reference
---


# Question
Title: 403 Forbidden When Trying to Edit Contributions
I am running Civi 4.5.5. with Drupal 7. I think this happened after the most recent Drupal update but I cannot be 100% sure when it started.

When trying to edit a donation I get this error "Unable to reach the server. Please refresh this page in your browser and try again." I already followed all the suggestions at http://forum.civicrm.org/index.php?topic=28718.0 but none of those worked.

I am getting two JS errors in the console.

```
    GET https:// www.site.org/civicrm/contact/view/contribution?reset=1&
action=update&id=52533&cid=6016&context=contribution&snippet=json 403
(Forbidden)m.ajaxTransport.send @ js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:136m.extend.ajax @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:136m.each.m.(anonymous function) @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:136m.extend.getJSON @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:136$.widget.refresh @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:1992(anonymous function) @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:143(anonymous function) @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:143m.extend.each @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:134m.fn.m.each @
js_i5iWWCnof58nOcdnrel29-OfwCcKR_GKWdqmdMYmb9Q.js:134e.widget.bridge.e.fn.
(anonymous function) @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:143CRM.loadPage @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:2098CRM.loadForm @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:2123CRM.popup @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:2285m.event.dispatch @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:135m.event.add.r.handle @ js_i5iWWCnof58nOcdnrel29-
OfwCcKR_GKWdqmdMYmb9Q.js:135view?reset=1&keyy=469e050135485c6c038247bb3e4b4c9a_7700&cid=6016:1
XMLHttpRequest cannot load https://www.site.org/civicrm/contact
/view/contribution?reset=1&action=update&id=52533&cid=6016&
context=contribution&snippet=json. No 'Access-Control-Allow-Origin' header is
present on the requested resource. Origin 'https:// site.org' is therefore
not allowed access. The response had HTTP status code 403.

```

I thought the problem might be my .htaccess file but I am using the same version of the file from before the Drupal upgrade.

Any help is greatly appreciated.

# Answer
I upgraded to the newest version of CiviCRM and this appears to be resolved.
> 1 votes

---
Tags: civicontribute, drupal
---


# Question
Title: Why aren't my advanced search results sorting properly?
A copy of this issue: http://forum.civicrm.org/index.php/topic,36263.msg154206.html#msg154206

Which says: "column header sort option does nothing at my advanced search results."

# Answer
There's a setting in the Administer -\> Customize Data and Screens -\> Search Preferences called "Include Order By Clause". If you set that to "No" (presumably to improve performance as it recommends), then your search results will be ordered by contact id even when you try to change the sort order by clicking on the column headers.
> 2 votes

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


# Question
Title: How can I programmatically authenticate a contact (via checksum or other method)?
*Reposted/rephrased from http://forum.civicrm.org/index.php/topic,36059.30.html*.

> I am currently working on an extension to log in a user in CiviCRM using Facebook.
>
> The user is sent to facebook for auth request/permissions, and if successful redirected to a callback page where it receives a code which is valid for one login. Now the server gets all the details to this page and create a contact and save it.
>
> I am thinking of now sending back the user to the earlier page with the contact id and the checksum. Something which is described in the following link: https://aghstrategies.com/content/how-create-one-click-personalized-links-civicrm-emails
>
> Now I need to keep track of if someone is logged in, is there anything I can store this constraint into or I need something, or should I directly use SESSION and store it there?

# Answer
> 1 votes
`CRM_Contact_BAO_Contact_Utils::generateChecksum($contactId)` is the function used to generate checksums.

Ideally your extension would call this via a corresponding API method, but I don't think one exists yet?

There's corresponding code (see validChecksum etc below that) which is used in some CiviCRM pages to identify a request with a checksum parameter.

Simple code to identify a checksum and persist against the *contact* is the following -

```
if ($cs = CRM_Utils_Request::retrieve('cs', 'String' , $this, false)) {
  if ($id = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false, $userID)) {
    if (CRM_Contact_BAO_Contact_Utils::validChecksum($id, $cs)) {
      $session->set('userID', $id) ;
    }
  }
}

```

If they are landing on your callback already, then you can just dispense with using the checksum parameter and set the session directly before redirecting them to the page they authenticated to use.

# Answer
> 0 votes
`CRM_Contact_BAO_Contact_Utils::validChecksum` is the method used to validate a checksum in the url. You can see how it's used in a 3rd party module in this example from webform\_civicrm:

```
if (!empty($_GET["cs$c"]) && CRM_Contact_BAO_Contact_Utils::validChecksum($cid, $_GET["cs$c"])) {
  $filters['check_permissions'] = FALSE;
}

```

---
Tags: authentication, session, checksum
---


title: participant status doesn't export

text:
# Question
Title: participant status doesn't export
I just upgraded to Civi 4.6.3 yesterday. I'm running it on Drupal 7. I tried to export some participant records today, including the participant status. Everything exported fine except the participant status. It's blank for every record. Any ideas? Bug? User error? TIA - John

# Answer
It appears you have found a bug. I tried just now on the Civi 4.6/Drupal demo site and got the same results as you with both Export Primary fields and selecting my own fields. I would log it on JIRA. https://issues.civicrm.org/jira/secure/Dashboard.jspa

I did a quick Google search and could not find any relevant issues already logged for this.
> 1 votes

---
Tags: export
---


# Question
Title: Is there an autorespond email function for profile form sign ups (wordpress)?
I have a sign up form that adds users to a group- essentially a mailing list which also saves other information about the subscriber. It's a civiCRM 'profile' form.

This all works OK. A user adds their information to the form and their information is saved in a group called members. Now my client would like to automatically email them when a new user signs up. There doesn't seem to be any way to do this 'out of the box'. Someone has raised this issue with regards to Joomla before HERE. But, being reasonably new to web development and civiCRM and don't know how to do this with my WORDPRESS installation.

I think you have to do something with hooks and create a wordpress plugin? http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference

I guess I'm wondering whether someone has already done this? OR they can point me to instructions that a newbie may be able to understand?

I'm using wordpress 4.1.5 and civiCRM 4.6.2

# Answer
> 3 votes
Third option is to use the CiviCRM extension CiviRules. It allows you to set up a rule (in this case when contact is added to group), a condition (group is xxx) and an action (send email). You will have to add the send email to a specific address option (or wait for someone else to sponsor this action development as there is already a GitHub issue for it). More information on http://redmine.civicoop.org/projects/civirules/wiki and you can get the extension from https://github.com/CiviCooP/org.civicoop.civirules

The CiviRules extension is now live at MAF Norge and will be tested by Amnesty International Flanders.

# Answer
> 1 votes
You might look into using the CiviCRM/Mailchimp Integration Extension: https://civicrm.org/extensions/mailchimp-civicrm-integration

When you add someone to a Group in CiviCRM, it can sync them to a List in Mailchimp. I believe you could set up an auto-responder there.

Perhaps a complex work around, but thought it might help you out.

In Drupal land, I would use CiviCRM Entity and the Rules modules to accomplish your task.

# Answer
> 1 votes
You're better off doing this with a CiviCRM extension rather than a WordPress plugin. I wrote an extension that does this (amongst other things) a while back. It's available here: https://github.com/PalanteJon/coop.palantetech.module.cpehn.joinnetworkcheckbox/tree/automatic-email-only

I just created a new branch called "automatic email only" where I stripped out all the code that's not relevant to this question.

You'll need to customize this extension a bit to only fire when people join a certain group(s). It will send the "Welcome" automated message at **Mailings menu \> Headers, Footers, and Automated Messages**.

---
Tags: wordpress, profile
---


# Question
Title: How do I get the time in the change log to be the same as my local time?
I am working with CiviCRM in a Joomla environment. The Joomla server time is set for UTC and can verify changes to articles are logged at the correct time. However changes made to CiviCRM consituent records are shown as 6 hours behind. How do I get the CiviCRM change log time to be UTC?

# Answer
> 1 votes
Check your timezone setting in Joomla.

Go to System, Global Configuration

Click on the Server tab and go to Location Settings

---
Tags: joomla, logs, sysadmin, timezone
---


# Question
Title: Correct means to update Drupal Node after user submits a donation
Drupal 7.37, CiviCRM 4.4.15

We are collecting tracking information when a user makes a contribution associated with child sponsorship (using URL parameters, custom fields, and a profile assigned to the contribution form). The tracking information included the id of the Drupal Node that needs to updated. We need to change the Sponsored field, Boolean value, to true after the payment has been processed successfully (credit card or ACH).

Would we use something like this:

myhooks\_civicrm\_post($op, $objectName, $objectId, &$objectRef) {

```
if ($op == 'create' && $objectName == 'Contribution') {
   //retrieve contribution from civicrm database
   //retrieve tracker information from civicrm database
   //if tracker.appeal > 0
   //   retrieve node from drupal database
   //   update node in drupal database
}

```

# Answer
That looks correct, though I have some suggestions for improvement:

* Your first step is "retrieve contribution from civicrm database". The contribution is already going to be stored in $objectRef, so that should be unnecessary.
* If you want to avoid coding, you can probably accomplish this with the Drupal Rules and civicrm\_entity module.
> 1 votes

---
Tags: drupal, contributions
---


# Question
Title: Change group after a mailing is scheduled results in mailing still being send to the original members
When we *schedule a mailing* in civimail we use a normal group (not a smart group) as the target audience for this mailing. Prior to 4.6.2 (we think), we could change the group before the mailing was send (even though it was scheduled) and the changes to the group would be taken into account when the actual sending of the mail occurred.

We are now on version 4.6.4 and looked into the database a bit to see what happens when somebody schedules a mailing. It seems as the schedule button fills the "*civicrm\_mailing\_recipients*" table and this table is used when the mailing actually starts. So adding a contact to the group(s) you used does nothing.

Is this behavior correct/by design? And is there a workaround to get the latest group members when the mailing actually starts?

# Answer
This is a duplicate of CiviMail and Smart Groups: when does CiviCRM identify the actual list of email recipients?. I don't think your fix is likely to be accepted upstream for the reasons Lobo provided on that ticket. That doesn't mean you can't use this fix if it works for you, of course, just that it can't be merged into the upstream code.
> 1 votes

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


# Question
Title: Including Activity Dates and Subjects in a Profile for a Directory or Search
We're trying to create one table for phonebanking purposes that show the last two or three activities of one type associated with each row of contacts, putting that into a directory or search profile, and allowing users to edit the table through a Batch update or other means.

Columns:

* First Name
* Last Name
* Phone
* Email
* Notes
* Most recent activity (or Activity type 1)
* Second most recent activity (of Activity type 1)

# Answer
> 1 votes
pmoz has a good solution, but it's Drupal-only, and your View is going to be read-only, though perhaps you can get something approximating what you want with Views Bulk Operations.

Making a writable version of what you're decribing is going to be very difficult to implement, and will require custom coding. The reason for this is based in database theory and normalization. "Flattening" your data - multiple records on one line - goes against database design principles, and without getting into the math, the performance would be orders of magnitude slower than just grabbing the most recent activity.

If you can live with not being able to edit the activities, and you're not afraid of custom coding, here's a performant and relatively simple way of doing what you want:

* Create custom fields on the contact - "Most Recent Activity" and "Second Most Recent Activity".
* When an activity is created, use `civicrm_hook_post` to write the relevant values from the activity into your custom field.
* If the "Most Recent Activity" field isn't empty, first copy its value into "Second Most Recent Activity".
* Now you can use "Batch Update via Profile", using the custom fields rather than the activities themselves.

Finally - depending on what data you're trying to change, you may want to consider CiviSurvey instead of Batch Update via Profile.

# Answer
> 1 votes
We accomplish basically the same thing using Views and a profile.

Create a profile with the fields you want people to be able to edit.

Create a View of CiviCRM Activities, add a relationship of Activity Contact ID, select the contact you want to list (source, target, assignee).

Add Display Name, Phone, email, Activity Date and a custom text field (name it edit and link to your profile) fields.

Sort first by sort name, then by activity date.

Filter by activity type.

Add an exposed filter for Display Name contains.

That should almost get you there.

---
Tags: profile
---