# Question
Title: Custom extension, what hook to use for UserDashBoard
I'm writing a custom data extension and I would like to show some things on the Contact Dashboard (not the 'full' dashboard).

I see the hook for the regular Dashboard and Dashlets, but nothing to output anything on the UserDashBoard

CRM/Contact/UserDashboard.php seems to eventually call a lot of hardcoded functions for components.

I've gotten to hook\_civicrm\_pageRun where I can add stuff by doing this: `if ($page->getVar('_name') == "CRM_Contact_Page_View_UserDashBoard")` and then simply echo-ing stuff but that doesn't seem to be the 'correct' way of doing things, the CSS doesn't get applied correctly etc.

I've also tried to create a page (using civix generate:page) and then adding UserDashboard.php and tpl files similar to how CRM/Events does it but that doesn't seem to get called at all. I see in Core Components a function named getDashboardObject but there is virtually no documentation, no comments or a way of calling it from within an extension.

I'm trying to affect the User Dashboard which gets generated at http://site/civicrm/user

# Answer
> 2 votes
By contact dashboard, do you mean the contact summary? In that case, there is a hook for that:

https://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_summary

Can you try to see if it alters the page you want?

Otherwise and more generally, they are two "catch all" hooks for the ui, one for page https://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_pageRun (likely the one you need) and one for form
https://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_alterContent

With these two, you should be able to modify pretty much any content generated by civi

---
Tags: extension, user-dashboard
---


# Question
Title: Responsive Email Layouts - Why move away from Smarty?
I'm looking at this GSoC project that I'm willing to take on.

https://wiki.civicrm.org/confluence/display/CRM/Google+Summer+of+Code+-+2016#GoogleSummerofCode-2016-responsivelayoutforemails

Which has "move away from smarty" on it's project description. Smarty, in the context of email messages, is used to replace the contact greeting names in email templates. So, I don't understand why we want to move away from smarty. Is it because we can accomplish the same task by using a simple PHP variable without having to use an extra library? What type of better solution are we looking for?

# Answer
You are right, we *do* need some templating system and we don't *need* to replace smarty. It's just that it's not the framework that seems to have a lot of traction these days and as generally, we are thinking of moving away from it, we might as well start with the mail feature

Moreover, I do recall performances issues being mentioned for big mailings (smarty was generating tons of temp files), so that might be another incentive.

This being said, I the focus should be on improving the layout of transactional emails and make it easier to brand them consistently for an organisation, so replacing smarty might not be super useful in that context.
> 2 votes

---
Tags: email, gsoc
---


# Question
Title: How to suppress columns from Manage Group search results
I'm customizing a version of the Manage Groups page. Users don't want to see Description, Group Type, or Visibility. I thought I could just customize a version of Group/Form/Search.tpl .

It's easy to suppress the column headers by commenting out the tags. I need help learning how to suppress the actual tags though. I can't make sense of the js in that template.

# Answer
> 3 votes
I just learned how to use bVisible = false to suppress columns. I found what I needed at http://legacy.datatables.net/usage/columns, the columns documentation for datatable plugin.

---
Tags: custom-templates
---


# Question
Title: Problem with loading (jqery / css) CiviCRM files in Joomla 3.4.8
Jqery / css etc. CiviCRM files from the folder: components/com\_civicrm are not loaded.

In another site they are loaded well, see links below.

Both sites are in Joomla 3.4.8 with CiviCRM 4.7.3. Both sites use the latest version of admin tools to protect the site.

Thank you for your help!

http://www.cecsweden.org/cms/registration-festival-sweden-2016 http://tools.pingdom.com/fpt/#!/gP8gq/http://www.cecsweden.org/cms/registration-festival-sweden-2016

https://www.srivast.org/en/register http://tools.pingdom.com/fpt/#!/eaOYc7/https://www.srivast.org/en/register

# Answer
> 1 votes
You need to ensure that your paths are set correctly. In the menu go to Administer \> System Settings \> Resource URLs and correct the CiviCRM Resource URL. (if the menu isn't working, type directly the path `civicrm/admin/setting/url&reset=1` to get there) In 4.7 in most cases it should simply be `[civicrm.root]/`.

If you're unclear what the correct url should be, try doing "view source" in your browser and check what urls are being prepended to Civi's js/css files - what about it is incorrect? That should give a hint of what needs fixing.

---
Tags: joomla
---


# Question
Title: Change multi select custom field to single select?
We need to convert a multi select box to single select, and the option for doing this in the Change Field Form window looks scary.

> Warning: This functionality is currently in beta stage. Consider backing up your database before using it. Click "Cancel" to return to the "edit custom field" form without making changes.

The option most suitable appears to be "Radio (not safe)". What does "not safe" mean? This field is a crucial element of our membership system and can't be at risk.

# Answer
> 2 votes
I am not sure what would happen if the field contains multiple values.

What I would do if I where you is the following:

* Create a new field, exactly as you want.
* Export your contacts with only 2 fields: internal id, and the multi-select field
* Check the export and fix the records with multiple values
* Import again, but then use the new field via import mapping
* Check your data
* Disable old field (disabling means you can enable again when needed)
* After a few months and no need to see the old field -\> Delete old field

---
Tags: custom-fields, 4.7
---


# Question
Title: Can't complete install CiviCRM in Drupal 7
Trying to complete Step 4 "Run the Installer" where I go to the index.php page.
Here is my page, I get no install screen -- LINK REMOVED --

Any help is greatly appreciated.

# Answer
Firstly, you shouldn't post a link to an install screen directly. Please edit your post to remove the link.

Secondly, I saw the install page just fine. It has fields for your civicrm and drupal database settings. Do you mean that filling out this information and then clicking "install civicrm" took you to a blank screen?

If you can't see the screen with the fields that need to be filled in I would recommend clearing your browser's cache.

John
> 1 votes

---
Tags: drupal, installation
---


# Question
Title: Error after upgrade to 4.7.1 "Call to undefined method CRM_Utils_System::isUserLoggedIn" (WordPress)
I've just upgraded from 4.5.2 to 4.7.1 and everything seemed to be working OK. I was able to use the system fine for an hour or so.

Then I was trying to re-assign some transactions from one user to another using PHPMyAdmin (by changing the contact id--I've done this before without problems) and suddenly I get a 500 Server error and nothing works.

Looking in the logs I find:

> Fatal error: Call to undefined method CRM\_Utils\_System::isUserLoggedIn() in /var/www/vhosts//httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/UFMatch.php on line 98

I also can see some references to:

> Call to undefined method CRM\_Utils\_System::getUFLocale()

I can't see how a change in data can have caused this??

I re-imported the db (back to the 4.5.2 version) but I still can't access anything--I can't even run the upgrade script.

I put a clean install of the 4.7.1 plugin code and that's not fixed it either.

I'm stuck, it works fine on the test system but is totally broken on my live system now.

Thanks

**Update 9th Feb:**

I'm running: PHP Version 5.3.25 MySQL Version: 5.5.32 Unfortunately because it's a shared hosted system, I'm not sure I can get the version of PHP updated.

# Answer
A few possibilities:

You may have an old version of the file **customised**. Check in your custom PHP folder, or do a find on the name of the file that contains CRM\_Utils\_System::isUserLoggedIn to see if this is a possibility. You may need to update it to match the newer version of the file, while keeping your change (a consultant will happily help you here if it gets tricky - either myself john@civifirst.com or a partner organisation https://civicrm.org/partners-contributors).

Alternatively, are your resources and URLs **set correctly** in your administer tab?

Failing all of those, double check the site's URL in your **civicrm.settings.php** file.

Good luck!
> 1 votes

# Answer
Does the method CRM\_Utils\_System::isUserLoggedIn() exist in the files? i.e. CRM/Utils/System.php have a method isUserLoggedIn()? Seems more like a code issue than a data issue.
> 0 votes

---
Tags: wordpress, upgrade, error
---


title: Master address - not saving choice

text:
# Question
Title: Master address - not saving choice
I have been working to finalize import of approximately 2,000 contact records from our old systems. Our old db had 2 people in one record, so have been working to separate. Imported the primary contact and was using import on the second contact and utilize the "master address belongs to" field. My 2 smaller groups of the second contact worked just fine and properly "mapped" and saved the master addressee belongs to. Yesterday I was importing my last batch of about 600 names. The import took longer than normal but eventually I just went to a screen saying there was a web server error. About 94 of the last records didn't get imported. As I was working on some cleanup I realized that when I would manually go edit someone's address and tie it to a master address nothing would save. I was able to take one contact, put in an address, save, and then edit again and tie the master address. However, I haven't been able to replicate that again. I ran the system job to clean cache and that didn't help. I was on 4.6.5 and decided to go ahead and do my upgrade yesterday to see if that might clear up whatever, and it didn't. The crash of the import seems to be the point where something changed. Has anyone experienced this or recommend anything (even at the table level in phpMyAdmin -- which I am comfortable navigating in) that I can check/try?

# Answer
> 1 votes
I'm not sure this is the answer Drew is looking for or it even addresses his issue. It sounds like it was working for him and then he had a timeout and it messed a number of them up. The comments, which I added too many to, show that it doesn't work in some cases.

To import contact with a master address belonging to someone else, you need to include the actual address along with the address belongs to. It is looking for the ID of master address. How one might know that without sql is beyond me. Whenever I've imported people with shared addresses, I've imported all the people each with an address and then wrote some sql to pull out the address id of those that would be the master and id of the contact that would use that address and id and did an import update.

I just imported a Joe Blow into Demo46 having him share an address id 3. My cvs had first, last, street, city, state, postal, country and master address belongs to.

I'm guessing way back when for ease of implimenting shared addresses it appears it was decided not to quite do them as relational database should. You'd expect the id to be there and for the forms, queries, etc. to follow that id for the address, but it appears it depends on the address actually being in the record. I suspect the contact form sees that and does a copy when you share an address or the master gets changed.

So Drew you might look at your database and see if you have records in civicrm\_address that have a master address id but the street, city, etc. are blank. If so this sql should fix it. (A caution, I wrote this sql a while ago but it think it's still fine. In case your wondering why it is ca and pa, I was dealing parents and children.)

```
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

```

If you don't have the master\_id populated but you do have the two people both having the address, you could write some sql to add the address id of the first to be the master\_id of the second.

---
Tags: contacts, import
---


title: Exporting multiple choice fields

text:
# Question
Title: Exporting multiple choice fields
Does anyone know how to export a multiple choice field into a spreadsheet in a way that filters each response into a different column?

For example, a field has options:

1. apple
2. banana
3. pineapple

A contact record has "apple" and "banana" selected for the field.

In exporting their record, I would like three columns to represent the data in the field, one column for apple, one for banana, one for pinapple.

Is there a way to do this in CiviCRM, or would I need to export and then run a script in Excel?

Thanks!

# Answer
> 1 votes
I do not know of anything that can be done via CiviCRM UI to address this, so I think you would be better to manipulate it after exporting.

---
Tags: custom-fields, export
---


# Question
Title: EXACT search on a custom field instead of LIKE
How do I do an EXACT search on a custom field – so instead of ending up with “LIKE” %Eastern Metropolitan%, in the search results I have an EXACT match?

I tried “Eastern\_Metropolitan” “Eastern-Metropolitan” but I still get this result (with the word LIKE) - i.e STATE\_UPPER\_HOUSE Like %Eastern\_Metropolitan% - which shows “South-Eastern” and “Eastern Metropolitan” also.

Here is how do the search

1. Advanced Search • Address Fields: Australia + Victoria • CUSTOM Fields - ELECTORATES: State\_upper\_house = “Eastern Metropolitan”
2. After exporting the file and reviewing it we notice 2 things: a. The list contains contacts with state\_upper\_electorate as “South-Eastern” and “Eastern Metropolitan” b. There is an error on the first row of the .csv which not sure what this means;
    * **Warning**: strpos(): Empty needle in **/home/righttolife/www/www/administrator/components/com\_civicrm/civicrm/CRM/Export/BAO/Export.php** on line **621**

# Answer
Hi from across the ditch.

Not clear if your custom field is text or select. Assuming Text (which raises the question of why isn't it select)

You can use Search Builder for this. Search \> Search Builder.

Select contact type that your custom fields apply to. Set operator to =

Outcomes:

No matches found for: Contact Type = 'Individual' ...AND... electorate freehand = East

1 Contact
Contact Type = 'Individual' ...AND... electorate freehand = Eastern Metropolitan

Does that help?

Fields are on http://d46.demo.civicrm.org/civicrm/contact/search/builder for the next x(\<24) hours
> 1 votes

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


# Question
Title: My users can't unsubscribe themselves from (or subscribe to) smart groups from Wordpress
I am running 4.4.2 of Wordpress with Civi 4.6.10. I have a test site (WP 4.4.2, Civi 4.6.4) that works fine with the same set up. I have set up a profile with a groups field, and 2 public groups, one "dumb" and one smart. I am able to use the profile to unsubscribe from the regular group, but ticking (or unticking) the smart group has no effect on the membership of that group. Is this a regression that anyone is aware of? Or perhaps I have missed something in the set up?

# Answer
> 1 votes
NOTE: Having written the below as an 'answer' I am less certain it is since it seems to raise more questions but will leave as such for now.

A contacts who is 'in' a Smart Group, is not 'added' to the Smart Group in the same way as they are to a General Group.

Hence I would not expect such a contact to see the checkbox for the Group 'ticked' when they go to the Profile.

Ie when I go to http://d46.demo.civicrm.org/civicrm/profile/edit?gid=16&reset=1 I do not see the group 'name like lan' checked, so it cannot be unchecked.

Does that make sense in your situation.

if lan does tick that group, then he gets sent an email for the double opt-in.

But when i Search within that Group for members Pending, it shows me all 11 contacts which I did not expect

11 Contacts Group(s) In name like lan ...AND... Group Status 'Pending'

Wondering if the latter is a bug but not digging on other sites to prove outcome with older versions.

---
Tags: wordpress, smartgroups
---


title: api csv import - cannot find start page

text:
# Question
Title: api csv import - cannot find start page
I have installed the api csv importer

https://civicrm.org/extensions/api-csv-import-gui

I cannot find where the start page is.

I have looked in read me which says civicrm/csvimporter/import

However I get an error message CRM\_Core\_Config::$maxImportFileSize.

I had this problem once before and managed via google to find the answer. Frustratingly I did not write it down and now cannot work out how to get round this. Has anyone got any tips? Thanks Caroline

# Answer
you are correct, the page is civicrm/csvimporter/import

(as defined here: https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport/blob/master/xml/Menu/csvimport.xml)

Your error is something else, like not having a compatible civicrm version. Can you give more details on your configuration? what version of civicrm and what CMS do you use (drupal, wordpress or joomla)?
> 1 votes

---
Tags: import
---


# Question
Title: How to disable sending an email after a recurring contribution?
The email sent isn't very clear, and offer an option to change the amount and instalment details

"You can update recurring contribution amount or change the number of installments details for this recurring contribution by visiting this web page."

And this change page has a warning message:

> Updates made using this form will change the recurring contribution information stored in your CiviCRM database, but will NOT be sent to the payment processor. You must enter the same changes using the payment processor web site.

Rather than confusing users that have no clue what a CiviCRM database or a payment processor are nor where its website could be, I'd rather skip sending that email. Is there a way to disable that?

# Answer
> 2 votes
Just a thought, but recurring givers may want to receive both the initial confirmation that their contribution was processed, and the monthly/quarterly/etc. notifications of additional payments being drawn. A better option might be to remove the links to cancel/modify the recurring information from the relevant Smarty receipt templates. That way they have their information but they're also not confused.

---
Tags: civicontribute, recurring-contributions
---


# Question
Title: After 4.7 Upgrade Contact Pages Throwing Error
The following error's are throwing at the top of each personal contact pages. It does not show these errors on an orgs contact page. I would appreciate any feedback.

Thank you!

Erin

detects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: array\_keys() expects parameter 1 to be array, null given in /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php on line 1037

Warning: Cannot modify header information - headers already sent by (output started at /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1037) in /home/connectionsvol/public\_html/civicrm/wp-includes/option.php on line 820

Warning: Cannot modify header information - headers already sent by (output started at /home/connectionsvol/public\_html/civicrm/wp-content/plugins/civicrm/civicrm/CRM/Utils/Array.php:1037) in /home/connectionsvol/public\_html/civicrm/wp-includes/option.php on line 821

# Answer
> 2 votes
I got this error in Drupal after upgrading 4.6.9 to 4.7.3. Exact text (repeating several times):

```
Warning: array_keys() expects parameter 1 to be array, null given in CRM_Utils_Array::formatArrayKeys() (line 1037 of /home/mysitename/public_html/sites/all/modules/civicrm/CRM/Utils/Array.php)

```

I was able to fix one record by editing & saving. But doing that for thousands of records wasn't an option.

So comparing custom fields of fixed records to broken records in phpMyAdmin, I found that the fixed records had blank entries whereas broken records were NULL, and that the number of fields that were checkboxes matched the number of error messages. I disabled my custom field sets and the errors went away.

After disabling my fields, I updated the custom field to set the value to blank where value is null. The SQL was similar to this:

```
update `civicrm_value_custom_table_1` set `custom_field_123`="" where `custom_field_123` IS NULL;

```

I repeated that for all problematic fields, enabled my custom fields and all was well.

**tl;dr: Cause is NULL values in custom checkbox fields. Fix is to update NULL values to blank values**

# Answer
> 0 votes
I got the same error but in my case the custom field had no value at all (no row for this id). Adding isset solves the issue, but not sure whether this is a correct way of working. Can anyone confirm?

```
public static function formatArrayKeys(&$array) {
++    if (isset($keys)) {
      $keys = array_keys($array, 1);
      if (count($keys) > 1 ||
        (count($keys) == 1 &&
          (current($keys) > 1 ||
            is_string(current($keys)) ||
            (current($keys) == 1 && $array[1] == 1) // handle (0 => 4), (1 => 1)
          )
        )
      ) {
        $array = $keys;
      }
    }
++  }
}

```

---
Tags: upgrade, error, 4.7
---


title: Preview page not shown in webforms

text:
# Question
Title: Preview page not shown in webforms
I'm trying to show the preview page in a CiviCRM Webform and it's not working. I have activated the option in Webform \> Form settings \> Preview Page but when I press the Send button it goes directly to the thanks page.

I'm using CiviCRM 4.6.10 and Webform CiviCRM Integration 7.x-4.15

Any ideas?

Thanks in advance.

# Answer
> 0 votes
We have found the error: In the preview's page configuration, when the "Preview button label" is set to the value "Submit", then there's a bug and the webform thinks it's the submit button and not the preview page one.

It's really strange. We have opened a bug: https://issues.civicrm.org/jira/browse/CRM-18237

Thanks!

# Answer
> 1 votes
Hi Just tested the same preview against same version of Civicrm 4.6.10 and webform integration 7.x-4.15 works find

Both in Pay-later option and also using an payment processor

I guess you need to look for any PHP error log and also look for any Ajax issue - thanks

---
Tags: webform-civicrm
---


title: DB Error: unknown error

text:
# Question
Title: DB Error: unknown error
I'm trying to do some site development on my dev copy of the site, but I'm seeing the following error, both in the browser and in `drush` commands like `drush cc all`:

```
Sorry but we are not able to provide this at the moment.
DB Error: unknown error

```

I get this on every page in the browser, e.g. the home page. I'm suspecting CiviCRM is a culprit here, because I see that `sites/all/modules/civicrm/packages/DB.php` defines `DB_ERROR` as the string `"unknown error"`.

How can I debug further? Can I get `drush` or `php` to give me a stack trace somehow?

I'm using Drupal 7.41 with CiviCRM 4.6.8.

**EDIT**: If I fire up a shell with `php -a` and paste in the contents of `index.php`, I get the error when it runs `menu_execute_active_handler();`. However, if I run that function *again* then I get the home page, seemingly correctly rendered. Not sure what that means.

**EDIT 2**: Following up on Alan's suggestion, I did try manually adding database rows as follows, but it didn't give me any traces:

```
insert into civicrm_setting set group_name='Developer Preferences', name='backtrace',
  value='s:1:"1";', domain_id=1, contact_id=NULL, is_domain=1, component_id=NULL;
insert into civicrm_setting set group_name='Developer Preferences', name='debug_enabled',
  value='s:1:"1";', domain_id=1, contact_id=NULL, is_domain=1, component_id=NULL;

```

**EDIT 3** @JitendraPurohit pointed me to a log file (I didn't realize CiviCRM had its own separate log directory!) that contains a stack trace, here it is:

```
Nov 02 08:22:43  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]
    [type] => DB_Error
    [user_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]"]
)

Nov 02 08:22:43  [info] $backTrace = #0 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#4 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#5 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...", "DB_Error", TRUE)
#6 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d...")
#7 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#9 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#10 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#11 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#12 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/DAO.php(1234): CRM_Core_DAO->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...", TRUE)
#13 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Lock.php(151): CRM_Core_DAO::singleValueQuery("SELECT GET_LOCK( %1, %2 )", (Array:2))
#14 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/Civi/Core/Lock/LockManager.php(84): CRM_Core_Lock->acquire(NULL)
#15 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/BAO/Cache.php(154): Civi\Core\Lock\LockManager->acquire("cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._")
#16 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Cache/SqlGroup.php(96): CRM_Core_BAO_Cache::setItem((Array:0), "3a9e8c34426bc6dde01d5581d9654dcf", "mapper/moduleFiles", NULL)
#17 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Extension/Mapper.php(321): CRM_Utils_Cache_SqlGroup->set("mapper/moduleFiles", (Array:0))
#18 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/PseudoConstant.php(1837): CRM_Extension_Mapper->getActiveModuleFiles(FALSE)
#19 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook.php(247): CRM_Core_PseudoConstant::getModuleExtensions()
#20 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(104): CRM_Utils_Hook->requireCiviModules((Array:0))
#21 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(83): CRM_Utils_Hook_DrupalBase->buildModuleList()
#22 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook.php(1043): CRM_Utils_Hook_DrupalBase->invoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config")
#23 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Config.php(257): CRM_Utils_Hook::config(Object(CRM_Core_Config))
#24 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/drupal/civicrm.module(220): CRM_Core_Config::singleton()
#25 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/drupal/civicrm.module(862): civicrm_initialize()
#26 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/plugins/views_plugin_query_default.inc(1405): civicrm_views_query_alter(Object(view), Object(views_plugin_query_default))
#27 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/includes/view.inc(1049): views_plugin_query_default->alter(Object(view))
#28 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/plugins/views_plugin_display_page.inc(217): view->build()
#29 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/includes/view.inc(1345): views_plugin_display_page->execute()
#30 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/views.module(540): view->execute_display("page", (Array:0))
#31 [internal function](): views_page("frontpage", "page")
#32 /Users/ken/Documents/SIA/site-upgrade/includes/menu.inc(527): call_user_func_array("views_page", (Array:2))
#33 /Users/ken/Documents/SIA/site-upgrade/index.php(21): menu_execute_active_handler()
#34 {main}

```

# Answer
> 6 votes
Reviewing the stack trace you provided, the line `[debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]` is the important one.

I googled `nativecode=3057 ** Incorrect user-level lock name` and it reported to be an error added to MySQL in v5.7.

To the best of my knowledge, CiviCRM has not been tested w 5.7. You should revert your MySQL version back to an earlier version (5.5 is the most recent version tested with CiviCRM I think) and try again.

# Answer
> 4 votes
**Browser** \- From the browser, go to Administer \> System Settings \> Debugging and Error Handling and you can turn on Enable Debugging and Display Backtrace. That should provide you with more specific errors that you need to debug.

Also, per the help item on "Enable Bugging" you can do the following to any Civi URL for a stack trace:

> Stack Trace - To display a stack trace listing at the top of a page, add *&backtrace=1*

Since you're working on your dev copy, you don't have to worry about your production environment being affected.

**Drush** \- For drush, you can enable debugging with this command:

```
drush civicrm-enable-debug

```

Source: http://drushcommands.com/drush-6x/civicrm/civicrm-enable-debug

**Database** \- If you are locked out of Civi (no pages displaying) and Drush is not an option, you can also enable Debugging and BackTrace if you have access to your database.

From the `civicrm_settings` table, find the lines with a *group name* of `Developer Preferences` and the *name* `debug_enabled` and `backtrace`. For the *value* of each line, change `s:1:"0";` to `s:1:"1";` and save. That will enable them.

# Answer
> 2 votes
Sorry for the late post here, but this tip might help someone going forward with this error.

I too was receiving this error on a fresh install of CiviCRM with WordPress. It was noted there were ajax errors. We guessed that the script was calling for more memory than the server had allotted. Memory allocation was increased and the error went away. It was that easy.

Hope this helps someone else with the same problem.

# Answer
> 1 votes
Based on the following line in the CiviCRM log file:

```
   [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]

```

this appears to be an issue with Pantheon's database setup. I would submit a ticket with Pantheon support to see if they can resolve it.

---
Tags: debugging, drush
---


# Question
Title: Targetting CiviCRM input field labels with css
I can see how to hide an input field using custom css, but I cannot figure out how to hide the specific label for that field. All the labels on the contact form seem to have the same selector. I am missing something?

# Answer
> 1 votes
You can use an attribute selector in css, for example

> label\[for="middle\_name"\] { display:none; }

For more info see: http://www.w3.org/TR/CSS21/selector.html#attribute-selectors or https://stackoverflow.com/questions/2599627/how-to-select-label-for-email-in-css

Does even work in IE, from version 8.

---
Tags: css
---


title: Documentation on email templates

text:
# Question
Title: Documentation on email templates
I'd like to customize the event registration email. When looking at the template, I see things like

```
{capture assign=headerStyle}
{capture assign=labelStyle }

```

I haven't been able to find information about what these lines do. I'm going to guess its adding generated markup. Could someone provide some guidance?

Or, if anyone could tell me where headerStyle and labelStyle is configured, maybe I could figure it out by looking at that.

Thanks for your help!

# Answer
The answer:

These lines allow CiviCRM tokens to be available to Smarty functions. The headerStyle value is contained within the `{capture}` item.

Documentation found here:
> 2 votes

# Answer
I wonder if it's worth mentioning that you can use smarty comments like {\* this \*}. That way when you research you can update the templates with your findings.
> 1 votes

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


# Question
Title: What setting is this asking me to change?
I created what I thought was a simple custom report and am receiving the the following error message. I can get to the file, and normally I can stumble through deciphering what Civi is trying to tell me- but I'm at a loss on this one. Kind regards.

# Answer
To me it looks like you need that $joinsForFiltersOnly parameter in your implementation of customDataFrom
> 1 votes

---
Tags: civireport
---


# Question
Title: Working with Individual Contact Suffixes
I'm having a horrible time with individual contact suffixes, Struggling with input, display and reports having to do with suffixes. I'm about to create a new custom text field for suffix(2) and abandon the original suffix field. Whether I can modify the standard displays to accommodate change field change, I don't know. In the old days there would quickly be a discussion about something like this on this board, frequently ending up with discovering the system was just fine and I needed to look at the issue a different way.

Relevant previous thread - found others with this unresolved issue on this forum, but could not post a general reply, seems to be blocked: https://forum.civicrm.org/index.php?topic=10948.msg47111#msg47111

My specific issue is that for activists that they may have multiple suffixes. John Smith II may be an RN and also MSW. So there are many many possible combinations. In our case a text field may work better. However, I entered all the combinations we've run across so far, afraid of the data coming in from spreadsheets, so changed the values to the same as the dropdown display. The Suffix appears OK on the view / edit, but on reports just shows up as a 0.

Have others run into this issue - suggestions?

# Answer
> 2 votes
I consider things like RN and MSW to be qualifications that should be dealt with in some other way rather than adding them to the suffix field.

A contact is always Charles Montague III but he is only a RN whilst he maintains his regisitration as an RN which will involve a certain number of hours of professional development and practical work each year.

If you need to be able to search for people with a particular qualification then a custom multiselect field to deal with them would be the best option I suspect. The final option could be **Other**, and you would have an associated free text field so they can specify exactly what you have left off your extensive list.

Alternatively, if you just want to be able to tack these on after the formal name, then a free form text field may be easier.

# Answer
> 1 votes
As JoAnne notes, all name suffixes are not created equal. For one client, we define no fewer than six (!) different text fields in addition to the generational suffix to handle various types:

* Academic degrees and qualifications (e.g. *Ph.D.*, *MD*, *PgDip*, *MFA*)
* Professional licenses/certifications/charters (*CFA*, *PE*, *PMP*, *CBBA*)
* Professional admissions (*FACS*, *FACC*)
* Professional associations/affiliations (*AIA*, *AICPA*)
* Religious order or institute (*S.J.*, *O.P.*)
* Military branch (*USMC*, *USAAF*)

The rules are even more complicated in the UK and some other countries.

The great majority of organizations will not need this level of granularity. It can be useful, however, to segregate the types to some degree to allow them to be reordered or selectively included. For example, most style guides will say it is incorrect to name someone as *Dr. John Doe, MD* — it is either *Dr. John Doe* or *John Doe, MD* — and that is difficult if you've got the *MD* mixed up with *MD, MHSA, FAAP*.

At a minimum, where the values are only needed for formal addresses and lists, we provide a free-form *post-nominal initials* field and allow the end user to populate it as they please. The built-in "individual suffix" field is reserved purely for generational suffixes.

---
Tags: contacts
---


# Question
Title: Sending an invoice per email goes to primary address, not to billing
I am not sure if I overlooked a setting or if it could be considered to be a bug.

When we do a search on contributions and with the results we select "Print or Email Contribution Invoices" and we select Email, the invoices are sent to the Primary email address for the contact, but we need them to go to their "Billing" email addresses (Which I think is logical for an invoice).

Is this a setting I overlooked, a feature (I don't understand) or a bug?

# Answer
There is no setting that you overlooked. Since Billing is not necessarily utilised it sounds like you requirement is a setting that says 'set my system to email to Billing email if it exists, otherwise send it to Primary' (NB I realise I may not be adding much to above comments but am trying to get some unanswered questions answered as that is currently the 'weakest' aspect of our Beta civicrm stackexchange according to these stats)
> 1 votes

---
Tags: civicontribute, drupal, email, invoice, 4.6.10
---


title: Are we going to switch to angular 2?

text:
# Question
Title: Are we going to switch to angular 2?
Angular has a new shiny version that seems to offer several new features and a faster experience.

https://angular.io/features.html https://medium.com/google-developer-experts/angular-2-introduction-to-redux-1cf18af27e6e#.pbxw78lb1

What is the plan for civi to migrate to angular2? The upgrade doesn't seem to be too complicated, but is there something to look at for the extensions?

I'm wondering if the switch should be done before 4.7 is stable, because changing a library in the 4.7.x seems to be a bit risky, but 4.8 is far away.

# Answer
> 2 votes
This will not be happening for 4.7, 4.8, 4.9, 5.x...

(NB I realise I may not be adding much to above comments but am trying to get some unanswered questions answered as that is currently the 'weakest' aspect of our Beta civicrm stackexchange according to these \[stats\]\[1\])

---
Tags: developer, angular
---


# Question
Title: Can an optout link be included in a scheduled reminder?
We have started collecting "prospective members" from callers to our 24/7 helpline. Email addresses are collected via a webform and at the same time a civicrm activity is created. We have set up one scheduled reminder to go out 24 hours after that activity is created and a second to go out 29 days after the activity created date.

We want to give these prospective members the ability to optout from all communications with us from either email.

It appears that {action.optOutUrl} does not work for scheduled reminders. Is that correct and if so, can anyone suggest a way to let these prospective members opt out?

We are using CiviCRM 4.4.19 on Drupal 7.

# Answer
> 1 votes
Provide them with a link back to a webform with checksum plus activity id if necessary so the existing Activity is loaded, and set the webform submission to change the status of the Activity to something that is excluded in the Scheduled Reminder.

(NB I am trying to get some unanswered questions answered as that is currently the 'weakest' aspect of our Beta civicrm stackexchange according to these \[stats\]\[1\])

---
Tags: scheduled-reminders
---


title: Database table name for events

text:
# Question
Title: Database table name for events
I want to access the details of registered members for an event through database.So I want the table name in which the details of the registered participants will store.

# Answer
The table is called civicrm\_participant which holds all the event participant record

If an single user is registering for multiple user then you can find the registered user using column name registered\_by\_id

I guess this help
> 3 votes

# Answer
I am confused by 'registered members for an event' and assume you mean contacts that have registered for an event, not necessarily members (=contacts that have an active membership). The details of participants are stored in civicrm\_participant
> 2 votes

# Answer
Are you sure you need the database table? The preferred way to access CiviCRM data is via the CiviCRM API.

It is very likely you can get the data you need, with a much lesser chance to harm the data integrity of your CiviCRM

https://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
> 2 votes

---
Tags: civievent
---


# Question
Title: push notification for the registerd participants for an event
I want to send the push notifications for the participants who have registered for the particular event.How can I approach using drupal push notification module? can anyone please help me?

# Answer
If you want to send notifications to event participants, the best way to do that is with CiviCRM Scheduled Reminders (https://book.civicrm.org/user/email/scheduled-reminders/) or with the extension CiviRules (https://civicrm.org/extensions/civirules).

Did you look at those?

If you, after looking at them, prefer a drupal module, you can get the CiviCRM information via the CiviCRM API or maybe even via drupal views.
> 2 votes

---
Tags: drupal
---


# Question
Title: Which payment processor offers line item capability?
We have a membership sign up that has membership fee and a contribution amount. We have enabled the contribution section.

> Contribution Amounts section enabled

Using PayPal standard, only one amount is returned for the transaction. Which processor will offer multiple line items returned? We need the membership fee and donation returned to civicrm as separate amounts. The treasurer needs to send the money to different recipients. Is there another way to handle this?

# Answer
> 4 votes
I don't think there is a payment processor the will do what you want, it needs to be handled on the CiviCRM side.

If you create a price set with the membership fee as one field and the contribution amount as second field, you assign different financial types to each component of the transaction. So although it looks like one contribution, the amount for each financial type will be recorded separately in the line\_item table.

If you install the Extended reports extension and use the Contribution Based Line Item report you can get a breakdown of income by financial type.

# Answer
> 1 votes
There is a 'separate membership payment' option at the bottom of the membership section of the payment page configuration, that might work for what you want? It's not a general solution to the line item problem.

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


title: Attendance and custom field tracker

text:
# Question
Title: Attendance and custom field tracker
My question is could I use civicrm and Drupal for this.

There is a sign up form for students, I have attached an image, all fields would not be used, this is just an example.

There are an estimate of 10 students.

Daily attendance needs to be tracked (Present or Absent) and the date. Would also be nice to add a custom field to be able to track....let's say points for good behavior.

So daily, someone can input if john was present or absent for a particular day and how many points for "good behavior".

A search so someone can see how many students were present on a certain day, or how many females attended and how many points they received for good behavior on a particular month or day.

# Answer
> 1 votes
You could set up custom fields for each day's attendance and points. Then set up a profile using those fields

An admin user can then search for the participants, select all, Action \> Batch update via profile.

If the students attend multiple similar events, the custom field for each day would be unique, eg Attendance 3/15. Otherwise you could use Attendance Day 1.

You should be able to advance search (or search builder) for the custom fields to see the results you want.

If this is something that is going to take a lot of admin time, you should consider a customized solution (extension).

Note: The question was sent to me directly and I asked him to post here on SE, in case others have a better solution and/or my option helps others.

# Answer
> 1 votes
We have done something for an education provider that tracked Attendance. In our case they wanted to have summary reports for each week. Therefore we made an Activity with 10 fields representing Mon am, Mon pm, Tue am, etc

Each week an Activity is added in bulk to each Student (via Adv Search).

We then provide a link to 'this weeks attendance' which takes users to a customised Report that allows the staff to mark the attendance for all their students on a single page - ie the Report is 'inline editable'. This refinement was provided because of the large number of students involved.

I hope the initial suggestion of using Activities is helpful. Unfortunately the Views summaries and the Report functionality are quite specific to the client so cannot be easily shared. But I am adding a screenshot of the inline editor for the Report in case it looks useful enough and in case you or anyone who comes along can fund it becoming an extension.

---
Tags: civievent
---


# Question
Title: Split multiple user registration profiles into separate pages
I have three profiles as well as a custom form that I show on drupal's user/register/ page. I want to split the registration form into first Drupal's user info, then the first profile, and the rest of the profiles on the third page with my custom form as well. Illustration:

```
    Page 1                       Page 2                     Page 3
+------------------------+   +-----------------------+  +-------------------------+
|                        |   |                       |  |                         |
|  +------------------+  |   |  +-----------------+  |  |  +------------------+   |
|  |Drupal Account    |  |   |  | Profile 1       |  |  |  | Profile 2        |   |
|  |Registration      |  |   |  |                 |  |  |  |                  |   |
|  |                  |  |   |  |                 |  |  |  |                  |   |
|  |                  |  |   |  |                 |  |  |  +------------------+   |
|  |                  |  |   |  |                 |  |  |                         |
|  |                  |  |   |  |                 |  |  |  +------------------+   |
|  |                  |  |   |  |                 |  |  |  |Profile 3         |   |
|  |                  |  |   |  |                 |  |  |  |                  |   |
|  |                  |  |   |  |                 |  |  |  +------------------+   |
|  |                  |  |   |  |                 |  |  |  +------------------+   |
|  |                  |  |   |  +-----------------+  |  |  |Custom form       |   |
|  +------------------+  |   |                       |  |  +------------------+   |
+------------------------+   +-----------------------+  +-------------------------+

```

# Answer
One option would be to do this using Webform (which allows for multipage forms) and utilising Rules to trigger the Drupal User creation. There was a blog Fuzion wrote sometime ago outlining such an approach.

In order to ensure that people visiting user/register end up on this form use the Redirect module to push them through to the relevant node.
> 1 votes

---
Tags: drupal, profile, registration, user-account
---


# Question
Title: Donation/Contribution Page Best Practices
Are there examples of Donation/Contribution Pages that have been created with CiviCRM or Drupal Web Form that you think work well?

Are there advantages of creating it with CiviCRM or Drupal Web Forms?

Also are there ways to get it to work, so it uses the organization's url? name.org/donate?

Thank you.

# Answer
After going back and forth from CiviCRM forms to Drupal Webforms for contribution forms, I find that the way to go for Contribution pages is CiviCRM forms.

A couple of issues that come to mind with Drupal webforms as a contribution form was: 1) The payment instrument was always set to "Check" even though they pay with Credit Card. 2) The Contribution thank you letters weren't sending out automatically.
> 1 votes

# Answer
In short, CiviCRM-Contribution pages work well if you can stick to the default workflow and functions and if your requirements regarding layout and functionality are not too fancy. Examples:

* You can decide which information to ask from donors for each donation page but you for example not easily create a activity at the time the form is sent
* You cannot change layout and style of the form easily and there is usually a three-step form (data entry page - confirmation page, thank you page)
* Conditional forms are not easy to implement with CiviCRM contribution pages
* Changing content and layout of the automated confirmation mail can be a pain

On the plus side, those forms are really easy to set up and most CiviCRM payment processors should work out of the box.

With Drupal webform integration you can do all kind of fancy stuff with your forms, including adding other pages, conditional fields, massively changing the layout, decide on the url you want to use, record other data whne the form is filled out etc.

The downside is that you will need more ressoruces and technical expertise to set up, and you have to test your custom forms properly. Creating the forms and integrating them with the website can be a bit more complex for inexperienced users too. Finally, there range of available payment processors is more limited.

So it really depends on the project planned. There is also the option to build a completely separate form and connect it to CiviCRM via the API which gives you utmost flexibility but is even more complex to set up than a webform.
> 1 votes

# Answer
A third approach that could be developed is through the CiviCRM Entity module which Fuzion and Skvare have put a lot of effort in to. Mark Hanna is outlining future developments for the module in this blog which could include Contribution forms and the discussion is occurring here.
> 1 votes

---
Tags: civicontribute, webform-civicrm, contribution-page, simple-donate-form
---


title: custom field for subscribe page?

text:
# Question
Title: custom field for subscribe page?
is it possible to add custom field in :

```
http:/drupalsite.com/civicrm/mailing/subscribe?reset=1

```

I tried looking for custom field additional in the settings but not available? is there a hook needed to process?

as its only collecting one email info for now?

thank you

# Answer
You can replicate the functionality by creating a Profile which includes the 'public' groups you want users to sign up for.

A second approach is to use the webform\_civicrm module where you can similarly include specific Groups and any other custom fields you want.

I don't think adding a field to civicrm/mailing/subscribe?reset=1 is available through the UI.
> 1 votes

---
Tags: custom-fields, forms
---


# Question
Title: How to add many event's participants to a single group
Civi 4.5.8 - We have many Events with the same name but different dates. For example. "Build House A", Date March 4th 8am to 4pm. "Build House A" March 7th 8am to 4pm. "Build House A", Date March 8th 8am to 4pm.

We could have many of these Events for the same Build(Event Type). Everything works fine until I try to build a list of all participants for the same Build or same Event Title. Is there any way to group/list/report on all participants of an Event with the same Title?

# Answer
couple of options

if you go to Participants for your event eg http://d46.demo.civicrm.org/civicrm/event/search?reset=1&force=1&status=true&event=3 then you can select all and 'add contacts to group'

or if you have the Event ID then Search Builder accepts the id for an = query on Event - ie entering 3 gets me

18 Contacts Event = Rain-forest Cup Youth Soccer Tournament

So your query would be Participant \> Event \> '=' \> 3

in the example above.

Any help?
> 1 votes

---
Tags: civievent, groups
---


title: Total Donations By Contact

text:
# Question
Title: Total Donations By Contact
I am looking to pull a report that has the donation total for each contact. Basically the top donor report but for all donors.

What report will give this to me.

Thanks, Josh

# Answer
> 2 votes
If you leave the filter called **Show no. of Top Donors** empty then you will get a list of all contacts and their donation totals.

# Answer
> 1 votes
I would recommend using the extension summary fields \- which provides a number of additional information regarding contributions including "lifetime donations".

---
Tags: civicontribute, civireport
---


# Question
Title: CRM_Utils_Array::value how to set value to a hook_buildForm?
There is a https://wiki.civicrm.org/confluence/display/CRMDOC/hook\_civicrm\_buildForm manual page, but not sure I've got it right.

Say, there is a value in a custom function, which should be set as default in a form, built using hook\_buildForm (where form itself opens in a modal frame and outside civicrm/ path).

I've a suspicions **CRM\_Utils\_Array::value** might be used to set a custom variable somewhere (anywhere) and get it later on wherever it might be needed;

Have an attempt to **set value outside of hook\_buildForm** like this:

```
$myVeryOwnPid = CRM_Utils_Array::value('myveryownpid', $contact['contact_id_b'], $contact['contact_id_b']);

```

and **get it from inside hook\_buildForm**:

```
  $myVeryOwnPid = CRM_Utils_Array::value('myveryownpid', $_GET, '0');

```

..but, of course, nothing works, just because I clearly don't understand, how it should work. As they say, CRM\_Utils\_Array is the most often used feature in CiviCRM, but digging inside a source code Ive realized there is no forest for the trees (at least, for me). Any advice, please!

# Answer
> 0 votes
Found an answer here https://wiki.civicrm.org/confluence/display/CRMDOC/Update+custom+fields+in+contributions+and+events+by+passing+variables+in+a+URL

Nothing to do with CRM\_Utils\_Array though; just plain simple passing vars via an URL.

---
Tags: hooks, php, quickform
---


# Question
Title: How can I integrate custom fields in CiviCRM?
Is there any way to integrate custom fields in the CiviCRM. If yes how can Integrate the fields in the CRM? as I am having a Bulk SMS service website I want to add some custom fields in the CRM

# Answer
> 0 votes
Under the "Administer" menu there is a "Customize Data and Screens" option. You can add custom fields there.

In future I recommend searching through the menu before posting :)

---
Tags: wordpress
---


# Question
Title: API vs GUI language code inconsistency or how to best use ISO 639-3?
I am comparing the values that appear in GUI Administration \> Localization \> Preferred Language options with the ones returned with the API. There you can see that Chinese Taiwan and Chinese China have the same value zh so that they cannot be distinguished.

Then when you use the API:

```
$result = civicrm_api3('OptionValue', 'get', array(
  'sequential' => 1,
  'option_group_id' => "languages",
  'options' => array('limit' => 0),
  'id' => array('IN' => array(557, 558)),
));

```

Then it will return beside this GUI 'value' also 'name':

```
{
    "is_error": 0,
    "version": 3,
    "count": 2,
    "values": [
        {
            "id": "557",
            "option_group_id": "78",
            "label": "Chinese (China)",
            "value": "zh",
            "name": "zh_CN",
            "is_default": "0",
            "weight": "137",
            "is_optgroup": "0",
            "is_reserved": "0",
            "is_active": "1"
        },
        {
            "id": "558",
            "option_group_id": "78",
            "label": "Chinese (Taiwan)",
            "value": "zh",
            "name": "zh_TW",
            "is_default": "0",
            "weight": "138",
            "is_optgroup": "0",
            "is_reserved": "0",
            "is_active": "1"
        }
    ]
}

```

The Administration GUI keeps this 'name' hidden and I cannot change it nor add it in new Languages, but it is this what is stored as preferred language for a contact, which again can be seen using the API and 'value' is not used anywhere.

May be I am missing something obvious here, but am I right that the GUI does not provide any facility to change code to for instance ISO-639-3? What would be the preferred way to get rid of Civi's default language 'name' options and use an ISO-639-3 equivalent in stead? Setting the 'value' is useless. Is there anyone that has been doing this successfully? Should I pursue using the API or direct MySQL manipuation to import my own Language options?

# Answer
> 1 votes
* First I needed to find a source of ISO-639-3 to import in MySQL. I found this one at the SIL website
* I used phpmyadmin to import the table, used \t as column delimiter and used iso\_639\_3 as table name
* I used phpmyadmin to discover that (in my case?) the language option\_group\_id equals 78. Just search for a language for instance Dutch and you will find the row with the value.
* Knowing this value you can now delete all default language options:

DELETE FROM `civicrm_option_value` WHERE `option_group_id` = 78
* Alternatively you can also deactivate them:

UPDATE `civicrm_option_value` SET is\_active=0 WHERE `option_group_id` = 78
* I used this query to import all languages in active state:

SET @weight := 0; INSERT INTO civicrm\_option\_value ( option\_group\_id, label, value, name, weight, is\_active ) SELECT 78, Inverted\_Name, Id, Id, (@weight := @weight + 1 ), 1 FROM iso\_639\_3 ORDER BY Inverted\_Name ASC
* Alternatively I found that this query allows me to import all iso-639-3 options but only a subset activated:

SET @weight := 0; INSERT INTO civicrm\_option\_value ( option\_group\_id, label, value, name, weight, is\_active ) SELECT 78, Inverted\_Name, Id, Id, (@weight := @weight + 1 ), (SELECT Id IN('nld','eng','fra','deu','ita','por','spa')) FROM iso\_639\_3 iso ORDER BY Inverted\_Name ASC

---
Tags: custom-fields, developer, localisation, administer
---


# Question
Title: How do I create multiple records fieldsets for contacts?
I think this is a simple question, only i can't work out the answer! How do I create multiple record fieldsets? Your help is much appreciated,

Cheers,

Kate

# Answer
When you create the custom field group, you select Contact, and then click anywhere and you should see a field pop in to view re 'multiple

See

And once you have added the Fields too, then you should see something like  on a contact record. (Grabbed before demo gets flushed)
> 2 votes

---
Tags: contacts, custom-fields, multi-record
---


# Question
Title: Membership reminders sending each time scheduled job runs after 4.6.2 upgrade
We upgraded to 4.6.2 in our test environment and since then our membership renewal reminders are sending emails each time the cron job runs. The reminder is scheduled to send 2 days before membership expiration with no repeats. Our cron job runs every 30 minutes, so the reminder is sent every 30 minutes for the entire 24 hour period. Is there something I need to reset? This only happens with reminders that were set up prior to our 4.6.2 upgrade. All new reminders work properly.

This does seem really similar to issues.civicrm.org/jira/browse/CRM-16514. Could use some help looking into it. I can duplicate the issue.

# Answer
> 1 votes
There has been a recent JIRA ticket 18326

* Scheduled reminder set to run one week before membership end date
* Reminder runs once, then membership end date is changed
* When the next date comes around it correctly sends a reminder but it incorrectly sends a reminder every cron until the next date has ended

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


title: Signing up household type memberships

text:
# Question
Title: Signing up household type memberships
The organization wants to have the ability to have multiple contacts for custom membership types of Household, Sustaining, Patron. I've set up the membership types for this, with the "household member is" relationship setting. This works only if the primary contact type is "Household". The problem with this is that the public facing membership sign up form (contribution form) only lets you sign up as the Individual contact type. Is there some way to tie the membership type to the contact type at the time the contact is created?

This looks like the most relevant forum post: https://forum.civicrm.org/index.php?topic=27970.0 Looks like there might be a way with drupal, but not wordpress. Just how much additional code would this require? -- I could write this very quickly with c#... but php/wordpress never.

# Answer
One approach would be to extend to code which makes the 'on behalf of Organisation' approach work for Households as well.

The membership type would be set up so that an individual 'inherits' the membership based on a specified relationship.

When an Individual signs up they either be given the option of selecting 'on behalf of', or the 'household' membership page would be set up to require it.

The outcome of a new membership would be that the individual is created, a household is created, the membership 'belongs' to the household, a permissioned\* relationship would be created between the individual and the household, and due to that relationship the individual would 'inherit' the membership provided in the settings of the Membership Type.

* my understanding of the 'on behalf of Organisation' code is that for the individual to be able to renew on behalf of the organisation (ie for their Organisation to prefill on the form if the user is logged in or using a checksum link) the individual is set up with the 'employee of' Relationship, they are also set as 'current employee' and the relationship is set so the individual is 'permissioned over the organisation'.

For a household equivalent, there is no equivalent for 'current employee' so the solution would need to step around that but that sounds fairly trivial.
> 1 votes

---
Tags: wordpress, civimember, 4.6.10
---


# Question
Title: Is it possible to insert a table in a fieldset?
In a custom 'health form' field, I want to be able to fill in multiple pieces of information about medication; what it is, what it's taken for, how much, how often, when it's taken. Is it possible to have a table that allows each of these pieces of information to be gathered, relating to each medication? I.e. responding to each of the above questions about each medication taken. Or is there a different way to achieve this?

Ideally we could export this information, but if that's not possible I'd still settle for being able to gather the information in a logical way!

Perhaps the answer is as simple as multiple records fieldset? I'm trying this at the moment, but I'm not sure how to enter multiple records - or perhaps how to set the fieldset so that entering multiple records is blatantly obvious.

Obviously I'm no IT person, but your help would be wonderful!

Thanks heaps, Kate

# Answer
> 1 votes
See http://wp46.demo.civicrm.org/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fcustom%2Fgroup%2Ffield&reset=1&new=1&gid=4&action=browse where you have an example of a bunch of fields for

* medication
* frequency
* amount

is that what you need?

---
Tags: wordpress, contacts
---


# Question
Title: Impossible to login with new civicrm user
I have created a Drupal 7 website with civicrm . My problem is when I create an account with Drupal and I would like to reset password I don't have problem's. The account is automatically created in civiCRM . But when I create a contact in civiCRM, an user is created in Drupal 7 . When I would like to reinitialize this user password, the process don't have problem's.

But when I would like to log out and login with new password, I can't.

I have checked in drupal's table "user" .

They don't have difference between drupal user created and civicrm user created. The permissions are same and the generated passwords are ok and the cache cleaned.

Any person have any idea ? I use Drupal 7.43 and 4.7.3

# Answer
OK, I have found my problem's solution. The cause was the user generated by civicrm had a username that wasn't the e-mail. I trying to login using the e-mail not the username. I have install this module and now they works .

https://www.drupal.org/project/email\_registration
> 1 votes

---
Tags: drupal, contacts, user
---


title: Date range profile search problem

text:
# Question
Title: Date range profile search problem
I've fairly recently upgraded from 4.4 to 4.6.12 in Drupal. We have a custom date field that is Searchable and Search by Range is Yes. This used to work but doesn't now: The error includes this: *No matches found for: Start date In '20 May 2, 20 July 2' ...AND...* Searches for date fields not by range are OK.

I've just tried this in the 4.7 WordPress demo (UK locale) and can repeat the problem there, though the no matches error report format is better.

The specific date case is handled in convertFormValues() in 4.6.12 CRM/Contact/BAO/Query.php - but not in 4.7.2.

Any suggestions for how to fix this?

Thanks, Chris

# Answer
In 4.6.12 CRM/Contact/BAO/Query.php I've added this case in convertFormValues() to fix this - someone may do it more beautifully:

```
elseif (!empty($values) && is_array($values) && self::isCustomDateField($id)) {
    $from = FALSE;
    if (array_key_exists('from',$values)){
        $from = $values['from'];
        $from = CRM_Utils_Date::processDate($from);
    }
    $to = FALSE;
    if (array_key_exists('to',$values)){
        $to = $values['to'];
        $to = CRM_Utils_Date::processDate($to);
    }
    if( $from && $to){
        $q = array('BETWEEN' => array($from,$to));
    } else if ($from){
        $q = array('>=' => $from);
    } else if ($to){
        $q = array('<=' => $to);
    }
    $params[] = array($id, '=', $q, 0, $wildcard);
}

```

This handles the case when the custom field is a date but the supplied $values is not a single value, but is instead an array with from and/or to values.
> 2 votes

---
Tags: profile
---


title: Food Coop Model for CiviCRM setup

text:
# Question
Title: Food Coop Model for CiviCRM setup
I'm helping our food coop transition from a home grown membership system to CiviCRM. We have a number of unique requirements and am wondering whether any members have a model configuration to share for coop membership. Some of the uniqueness includes:

* Equity for membership is paid in different amounts and over different periods of time for individual versus family memberships. During the equity period one is still an active member and must also pay a yearly fee.
* There is also an option for sweat equity for those who cannot pay the equity fee. This also needs to be tracked for completion.

I'm currently struggling with the using membership types versus membership status to track the above.

* The coop has varying discount levels based on the amount of hours volunteered. This can change on a monthly basis and the monthly discount rate needs to be tracked. A separate PHP/MySQL based system tracks the actual hours posted.

Realizing that this is a very broad subject and request, I am hoping there are some members here who have a similar system they've set up for their coop and could share some insights and even some configuration info.

# Answer
Firstly, props for the work you're doing!

Secondly, the first two bullet points I'm fairly sure you can do out of the box just with config - you can have two membership types with different fees, and you can definitely offer discounts.

The last point is the most interesting. I wonder if a combination of one of either CiviPoints (a brilliant extension written by DaveFF) or CiviVolunteer (a brilliant extension written by Ginkgo Street Labs) with CiviRules (a brilliant extension written by CiviCoop) with perhaps some custom jiggery would help you with the latter.

CiviPoints lets you collect "points" that people have accumulated through different means. CiviVolunteer lets you track Volunteers' hours and shift allocation. CiviRules lets you perform actions when conditions are met. I.e. people who donate time, money, or food could then trigger CiviPoints to be awarded and tracked, and when enough points made you could adjust a value that says what discount memberships are allowed.

I know that all of the extensions' authors would be happy to be contacted :)
> 3 votes

# Answer
IN case this helps and since there have been no answers yet.

You can have multiple memberships for a contact, but i think this is easiest if the membership types 'belong' to different organisations (ie i think civi has a built in 'only one membership per owning organisation')
> 1 votes

---
Tags: civimember
---


# Question
Title: Problem with Event Calendar extension after upgrade to 4.7.3
I just upgraded civicrm from 4.6 to 4.7.2. The event calendar extension, which is supposed to be compatible up to Civicrm 4.4, actually worked fine in 4.6. BUT, in 4.7.3 it seems to work in most respects but it does not display color coding for event types. All events show up in blue. When I try to go to the Event Calendar Settings page (in the Administer/Civievents section), I get the following message:

“Sorry but we are not able to provide this at the moment. Cannot set unrecognized property CRM\_Core\_Config::$civicrm\_events\_event\_types”

Please let me know how to fix this.

# Answer
> 1 votes
https://github.com/osseed/com.osseed.eventcalendar/issues/21

The author has said he'll look into updating the extension to match 4.7 - clearly it's popular! It might be worth contacting him, particularly if you're able to help contribute to the next release.

# Answer
> 1 votes
An alternative for Drupal sites is explained here \- involves Views and the CiviCRM Entities module. An example view is available here

---
Tags: civievent, upgrade
---


# Question
Title: Price Sets - Won't let me use recurring contributions
I'm running civicrm 4.6.10, drupal 7.41, and I'm trying to add a field to a price set that would let users select from a couple of different price levels for membership.

* Maximum Dues $33
* Regular Dues $22
* Minimum Dues $11
* Sub-Minimum Dues $6

They are each attached to a membership type that has recurring payments listed as an option.

However, I keep getting this error.

"You can include auto-renew membership choices for only one price field in a price set. Another field in this set already contains one or more auto-renew membership options."

I get this error even when there are not other fields in the set, or when I only make one option is the field for the memberships (like just listing maximum)

Any ideas? Is this something I'm doing wrong or possibly a bug?

# Answer
> 1 votes
Turns out it was a bug that I was able to fix by updating to the latest version of civicrm 4.7.4

---
Tags: civimember, contributions, price-sets, recurring-contributions
---


# Question
Title: Default value in custom field cannot be searched
i am working on CiviCRM 4.6.10 and came across this problem which doesn't seemed to be asked on the web:

1. I created a custom field with radio button of 3 options
2. I defaulted the field to one of the value and made it a required field
3. When a new contact is created through a event registration, the field does not show any value when the contact is viewed through in "View Contact".
4. Searching or reporting that use the field as a column shows nothing in the field
5. However, upon clicking the field in View Contact, it shows the defaulted value
6. After saving the field without changing anything, the field now shows the defaulted value
7. Searching and reporting using the field as a column now shows the default value as expected

I suppose this would be a bug ? Thanks for your time and advice.

# Answer
> 1 votes
Perhaps this is your answer. There are two processes involved in getting a field on an event

1. add a Custom Set of Fields and then create the field
2. display the field in the Profile

so if you want a default value showing on the Event you need to set it when you add the Field to the Profile (ie 2.), you do not need to make the field itself.

---
Tags: civievent
---


# Question
Title: CiviCRM issue when subscribing on behalf of an organisation with 4.7.3 and 4.7.4 releases
A few weeks ago, my team started using CiviCRM (4.7.1) with Drupal (7.42). We created different Web pages to test different membership types (individual and on behalf of organization). Everything seemed to be good back then. When someone subscribed on behalf of an organization, both types of contacts were created and a relationship (Employer/Employee) was set. We upgraded to CiviCRM 4.7.3 and now when someone subscribes on behalf of an organization, only the contact is created, not the organization anymore. Same issue with the 4.7.4 release.

Once the membership is submitted:

with 4.7.1:

```
Notice : Array to string conversion dans   CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Array to string conversion dans    CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Undefined index: html_type dans CRM_Contribute_Form_Contribution_Confirm->buildQuickForm() (ligne 520 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php).
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).

```

with 4.7.3 or 4.7.4:

```
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Undefined index: html_type dans CRM_Contribute_Form_Contribution_Confirm->buildQuickForm() (ligne 521 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php).
Notice : Undefined offset: 0 dans CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship() (ligne 235 dans ******/sites/all/modules/civicrm/CRM/Financial/BAO/FinancialAccount.php).
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).
Notice : Array to string conversion dans CRM_Contribute_Form_ContributionBase->buildCustom() (ligne 650 dans ******/sites/all/modules/civicrm/CRM/Contribute/Form/ContributionBase.php).

```

The only difference is a new bug from 4.7.3:

```
Notice : Undefined offset: 0 dans CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship() (ligne 235 dans ******/sites/all/modules/civicrm/CRM/Financial/BAO/FinancialAccount.php).

```

We tried this on the demo site and we have the same behavior. See http://dmaster.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=4

Any hint would be welcome!

# Answer
> 0 votes
I changed it to be 'optional' and it worked for me. http://dmaster.demo.civicrm.org/civicrm/contact/view?reset=1&cid=225

Can you confirm this is the issue?

I feel like this has come up recently but don't have time to search SE or JIRA - can you try and track down if an issue exists, or if one has been 'fixed' recently, then reopen it?

---
Tags: civimember, forms
---


# Question
Title: Change quick search ACL from "Access CiviCRM" to "Edit all Contacts"
CiviCRM 4.6 - client requirements - how to go about changing which ACL the Menu (including Quick Search) is tied to?

The Menu appears to be tied to Access CiviCRM - but we'd like to change this to "Edit all Contacts".

Ideally, we'd just like to hide the Quick Search - "Access CiviCRM" appears to grant all access to contacts, even if "view" and "edit" all contacts is not expressly assigned.

# Answer
Time for a custom extension! I'd hook\_civicrm\_navigationMenu this bad boy - just hiding it in the JS won't help you from a security perspective.
> 1 votes

---
Tags: acl, civicrm-home
---


# Question
Title: Error when executing Update Membership Statuses Scheduled Job
For some reason, the Scheduled Job for Update Membership Statuses has not been working on my site for some time. When I run it, I get the following error message:

Fatal error: Call to a member function delete() on a non-object in /home/neftempo/public\_html/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php on line 665

I just updated the site from 4.6.8 to 4.7.4 and the problem was not resolved.

Can someone please suggest how to resolve this problem - we need to update our membership statuses.

p.s. The site is hosted on a shared server, so I do not have access to the actual log files - hopefully the above provides sufficient guidance.

# Answer
I took a look at the code for you, and I couldn't see a stand out problem. The bad news is that you need a developer to look at this, insert debug information (or run it in the debugger) and really figure out what's going on.

Most helpful would be if you requested the logs from your SysAdmin, and then posted back when you have them. We need to figure the path of execution.

Do you have custom extensions installed, and does it work if they are disabled?
> 1 votes

---
Tags: civimember, scheduled-job
---


title: DB Error: connect failed (code 24)

text:
# Question
Title: DB Error: connect failed (code 24)
Anyone have any idea how I can fix this? Just done install and CiviCRM did not load (all OK on wizard) then nothing. Removed CiviCRM from the WordPress install and uploaded again (also removed database) but error below appeared.

Have I missed something?

Initialization Error

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

```
[code] => -24
[message] => DB Error: connect failed
[mode] => 16
[debug_info] =>  [nativecode=php_network_getaddresses: getaddrinfo failed: Name or service not known]
[type] => DB_Error
[user_info] =>  [nativecode=php_network_getaddresses: getaddrinfo failed: Name or service not known]
[to_string] => [db_error: message="DB Error: connect failed" code=-24 mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info=" [nativecode=php_network_getaddresses: getaddrinfo failed: Name or service not known]"]

```

)

# Answer
> 2 votes
Need to recreate your civicrm.settings.php file - or at least check the DB settings in there.

It's typically created upon install and located in wp-content/plugins/civicrm/civicrm.settings.php

---
Tags: wordpress, database, error
---


# Question
Title: Fatal error: Class 'CRM_Core_Resources' not found in
```
 if ($formName == 'CRM_Contribute_Form_Contribution_Confirm' && $form->_id == 1) {

   CRM_Core_Resources::singleton()->addScriptFile(drupal_get_path('module','custom_water') .'/',
     'custom_water.js');

}

```

When I use the above code as mentioned in the link https://wiki.civicrm.org/confluence/display/CRMDOC43/Resource+Reference#ResourceReference-Introduction

Add a Javascript file PHP CRM\_Core\_Resources::singleton()-\>addScriptFile('com.example.foo', 'bar.js');

I get an error : **Fatal error: Class 'CRM\_Core\_Resources' not found in**

I am using drupal 7 with CiviCRM

# Answer
> 0 votes
if it is on drupal module add civicrm\_initialize(); method above that line

---
Tags: drupal, javascript
---


title: Using event listeners in my extensions

text:
# Question
Title: Using event listeners in my extensions
I am developing an extension for civicrm 4.7. This extension includes several tokens. One of the tokens I want to include is a token for the activity assignee to be used in scheduled reminders.

In Civi 4.7 the hook system is expanded with Symfony Event Dispatchers and it looks like the token evaluate event will give me the oppurtunity to do exactly what is needed.

However I am confused in how to register an event listener. I have implemented the hook\_civicrm\_container but my events are never called.

```
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

function tokens_civicrm_container(containerBuilder $container) {
   $container->addResource(new FileResource(__FILE__));
   $container->findDefinition('dispatcher')->addMethodCall('addListener',
     array(\Civi\Token\Events::TOKEN_EVALUATE, 'tokens_evaluate_tokens')
   );
}

function tokens_evaluate_tokens(\Civi\Token\Event\TokenValueEvent $e) {
  foreach ($e->getRows() as $row) {
    /** @var TokenRow $row */
    $row->format('text/html');
    $row->tokens('profile', 'viewUrl', 'http://example.com/profile/' . $row->context['contact_id']);
    $row->tokens('profile', 'viewLink', ts("<a href='%1'>Open Profile</a>", array(
      1 => $row->tokens['profile']['viewUrl'],
    )));
  }
}

```

What is wrong with my code?

# Answer
> 5 votes
I have found why it was not working. I was looking in the user interface whether my tokens showed up in the list with tokens a user can use. But they did not. After digging all the core code I found out that I had to use a combination of hook\_tokens and an event listener for evaluate tokens.

I also had to put a require once statement to my token listener class in top of my module file otherwise it would fail with loading the file.

I also found a bug report indicating that token handling is redone and indicating that not all steps are done. See https://issues.civicrm.org/jira/browse/CRM-16553

---
Tags: extension, developer
---


# Question
Title: Pay later instructions don't show on membership contribution
This one has me baffled. I've got a membership contribution page that works just fine with paypal standard payments (membership is processed and everything ends up correct, no problems.) It also has a pay later option. This works in so far as a pending transaction and membership is created. It does not, however, show the pay later instructions at any point to the user. It does not send any email from the contribution page, I think it should. When you manually enter payment then it will send a receipt.

I'm stuck for things to look for. I can't find any errors in any drupal logs or the civiCRM log file that look remotely relevant. There is no custom code being used anywhere, everything is straight up configuration of civiCRM. There is no customization of email templates. The only thing I've done that is unusual is this used to be a civiCRM installation on Joomla that has now been moved to Drupal. I thought the pay later instructions were being displayed correctly when I fist did the transfer to Drupal, but maybe I saw things that were not there, not sure. I've added more extensive instructions since then and they don't show. The same instructions for pay later do show on event bookings (I've used the same text copy and paste.) Pay later works as expected on the events and sends emails and everything.

The civiCRM version currently running is 4.7.2 after just upgrading from 4.7.1 - there was no change with this upgrade.

Any ideas on where to look next? Do I need to turn on debugging and stat looking for things that way? Is there an obvious answer I've overlooked? I welcome all ideas.

# Answer
Just Managed to test the same against CiviCRM 4.7.2

Membership has been created with an contribution pending status

But in pay later option their is no email sent in Civicrm 4.7.2 Where as when payment is made using dummy payment processor an receipt is been sent out

I guess this is an Bug in this version so you should wait till the next release or you need to roll back to CiviCRM Version 4.6.10 where this option is working fine - Please raise an issue for the same so this gets fixed in next release

* I guess this helps
> 1 votes

# Answer
**UPDATE: Issue returned in 4.7.4** .... "pay later" does not display on LIVE pages, while it does on the backend when using the 'test drive' link.

I was able to test the patch on my website, and the "pay later" now shows the proper instructions.

However, I'm still having issues with receipts not being sent. Different issue, and I'll pursue that elsewhere.

That said ... I wish whoever is in charge of maintaining the Joomla demo site would take the time to UPGRADE the site to 4.7.3, or 4.6.14 at least
> 0 votes

# Answer
Just updated to 4.7.4 ... Pay Later block no longer appears.

While 4.7.4 is supposed to have a fix, it DOES NOT and reverts back to old behavior.

Did some additional testing. While the Pay Later block appears on the backend when you do a 'test drive', when you go to the 'Live Page' it does not.

Major regression issue here !!

**UPDATE** reverted back to 4.7.3. With the patch from 18118 to file CRM/Contribute/Form/Contribution/Main.php installed under 4.7.3 the pay later block appears on the main page.

**UPDATE2** added the patch to CRM/Contribute/Form/Contribution/Confirm.php as listed in CRM-18118, and emails are being sent. I am going to hold off on reinstalling 4.7.4 until I see any responses on this issue.
> 0 votes

---
Tags: civimember, contribution-page
---


title: Exporting custom profile questions

text:
# Question
Title: Exporting custom profile questions
Is there a way to export custom profile questions? Either as a event report or just in general?

# Answer
Yes you can export Custom Data. If those fields are used for Contacts rather than eg Participants it is probably easiest to do this via Adv Search. Find the contacts you want. Then \- go to Actions and \- select 'Export Contacts' and then click on \- Select Fields for Export \- then choose the fields you want to export \- once you have done this you can Save your Export Mapping and choose it another time

If the data was stored on the Participant record then you might find this easier to do via Find Participants

If you are not sure if the Custom Fields are used for Contacts or for Participants (look in the Custom Field Set page at /civicrm/admin/custom/group?reset=1 and see what it says it is Used For.
> 1 votes

---
Tags: profile, export
---


# Question
Title: DB Upgrade Fails when creating Getting Started Dashlet
CiviCRM 4.6.11 to 4.7.1 Update Joomla 3.4.8

Error page during DB upgrade utility:

```
[Error: Add Getting Started dashlet]

Error Field
Error Value
Type
DB_Error
Code
-3
Message
DB Error: constraint violation
Mode  16
UserInfo
INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active) SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 0, IF (SUM(is_active) > 0, 1, 0) FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`famcafe_sandbox`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]

DebugInfo

INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active) SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 0, IF (SUM(is_active) > 0, 1, 0) FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`famcafe_sandbox`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]

PEAR_Exception: DB Error: constraint violation in unknown on line unknown
- DB_Error: DB Error: constraint violation in unknown on line unknown

Exception trace
#
Function  Location
0 CRM_Core_Error::exceptionHandler(Object(DB_Error))
unknown:unknown
1  call_user_func(Array, Object(DB_Error))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php:931
2 PEAR_Error->PEAR_Error('DB Error: constr…', -3, 16, Array, 'INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php:976
3 DB_Error->DB_Error(-3, 16, Array, 'INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php:564
4  PEAR->raiseError(null, -3, null, null, 'INSERT INTO `civ…', 'DB_Error', true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php:1905
5  DB_common->raiseError(-3, null, null, null, '1452 ** Cannot a…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php:895
6  DB_mysql->mysqlRaiseError()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php:328
7  DB_mysql->simpleQuery('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php:1216
8  DB_common->query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php:2435
9  DB_DataObject->_query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php:1627
10  DB_DataObject->query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:334
11  CRM_Core_DAO->query('INSERT INTO `civ…', true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:1267
12  CRM_Core_DAO::executeQuery('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php:272
13  CRM_Upgrade_Incremental_php_FourSeven::addGettingStartedDashlet(Object(CRM_Queue_TaskContext), '4.7.alpha1')
unknown:unknown
14  call_user_func_array(Array, Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Task.php:88
15  CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Runner.php:214
16  CRM_Queue_Runner->runNext(true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Page/AJAX.php:52
17  CRM_Queue_Page_AJAX::{closure}()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/ErrorPolicy.php:106
18  CRM_Queue_ErrorPolicy->call(Object(Closure))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Page/AJAX.php:54
19  CRM_Queue_Page_AJAX::runNext()
unknown:unknown
20  call_user_func(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:278
21  CRM_Core_Invoke::runItem(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:86
22  CRM_Core_Invoke::_invoke(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:54
23  CRM_Core_Invoke::invoke(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm.php:116
24  civicrm_invoke()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm.php:40
25  require_once('/home/famcafe/pu…')
/home/famcafe/public_html/libraries/cms/component/helper.php:392
26  JComponentHelper::executeComponent('/home/famcafe/pu…')
/home/famcafe/public_html/libraries/cms/component/helper.php:372
27  JComponentHelper::renderComponent('com_civicrm')
/home/famcafe/public_html/libraries/cms/application/administrator.php:98
28  JApplicationAdministrator->dispatch()
/home/famcafe/public_html/libraries/cms/application/administrator.php:152
29  JApplicationAdministrator->doExecute()
/home/famcafe/public_html/libraries/cms/application/cms.php:252
30  JApplicationCms->execute()
/home/famcafe/public_html/administrator/index.php:47

```

# Answer
I just encountered this and solved it.

I've opened a ticket CRM-18264 to address this issue, and I've submitted a pull request for both 4.6LTS and 4.7. They've been merged, so you just need to upgrade to CiviCRM 4.6.15+ or CiviCRM 4.7.5+.
> 1 votes

---
Tags: upgrade, database, dashlet, error-page
---


title: Click tracking on anchor links

text:
# Question
Title: Click tracking on anchor links
We recently re-designed a regular e-mail to include a "menu" at the top. The menu is a list of anchor links to sections further down the e-mail. However, we are not seeing any clicks being tracked on these anchor links. Is there a way to track these clicks?

# Answer
No. Links that do not go to a website cannot be tracked by CiviCRM. The reason is that anchor links simply scroll the document the user is reading - they will not take them to an external site, which is how CiviCRM does the tracking.
> 4 votes

---
Tags: civimail
---