# Question
Title: Show Activity Source Contact in a Drupal View
I have created a Drupal view which is used to show any emails sent through CiviCRM to the currently logged in contact. To list the emails, the view shows activities for that contact where the activity type = 'email'. I am able to show the title, subject, details and date and the view works fine. However, everytime I try to add in the Activity Source Contact field, suddenly the view has no results. I am assuming that the Activity Source Contact field is the 'Added By' field in CiviCRM for the activity (which is the 'From' field for the email)? If it is, I can't understand why suddenly the view has no results when I add the field.

The other strange thing is, in the Activity Source contact field settings in the view, there is a numeral formatter, which is strange for a text field. See the attached image.

Can anyone suggest how I can display the Activity "Added by" field in the Drupal view?

# Answer
> 1 votes
Look at using the 'relationships' feature in drupal views (on right under Advanced) which should allow to add the Activity Contact, specify that you want to filter it to 'Source' and then add a Display Name field and use that Relationship

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


# Question
Title: Price set expire on/active on dates relative to event
We'd like to start incorporating expire on/active on dates for some of our price sets to enable early bird pricing, as the docs indicate. Is there a way to set the expire on/active on date for a price relative to an event start date, for every event it's used for? We're on CiviCRM 4.7.27. Thanks, Neal

# Answer
> 4 votes
Unless something recently changed, the answer is no. We've had to do a separate price set with specific dates for every one of our events. I'd much rather have one price set for each event type, as opposed to dozens of price sets each year.

---
Tags: price-sets
---


# Question
Title: DB Error when using CiviVolunteer Search
I am using civi 4.7.29 on Wordpress 4.9.4

I am having a problem searching the CiviVolunteer Positions. When I fill out the criteria and click search I get a DB Error with no information and it turns up no results when I know there are several positions available, as they are listed prior to attempting the search feature.
I am hoping this is a common issue and that someone knows where to start with resolving it.
Thank you

(UPDATED WITH ERROR LOG)

```
Mar 15 22:15:51  [info] $backTrace = #0 /home/oursite/public_html

/test/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(948): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#2 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#4 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, NULL, NULL, "SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...", "DB_Error", TRUE)
#6 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...", "DB_Error", TRUE)
#9 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, NULL, "1052 ** Column 'id' in where clause is ambiguous")
#10 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#12 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2446): DB_common->query("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#13 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#14 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(392): DB_DataObject->query("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#15 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO->query("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...", TRUE)
#16 /home/oursite/public_html/test/wp-content/uploads/civicrm/ext/org.civicrm.volunteer/CRM/Volunteer/BAO/Project.php(470): CRM_Core_DAO::executeQuery("SELECT DISTINCT vp.*\nFROM `civicrm_volunteer_project` vp\nINNER JOIN `civicr...")
#17 /home/oursite/public_html/test/wp-content/uploads/civicrm/ext/org.civicrm.volunteer/CRM/Volunteer/BAO/NeedSearch.php(69): CRM_Volunteer_BAO_Project::retrieve((Array:4))
#18 /home/oursite/public_html/test/wp-content/uploads/civicrm/ext/org.civicrm.volunteer/CRM/Volunteer/BAO/NeedSearch.php(43): CRM_Volunteer_BAO_NeedSearch->search()
#19 /home/oursite/public_html/test/wp-content/uploads/civicrm/ext/org.civicrm.volunteer/api/v3/VolunteerNeed.php(167): CRM_Volunteer_BAO_NeedSearch::doSearch((Array:10))
#20 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_volunteer_need_getsearchresult((Array:10))
#21 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
#22 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:7))
#23 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\API\Kernel->runSafe("VolunteerNeed", "getsearchresult", (Array:10), NULL)
#24 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(311): civicrm_api("VolunteerNeed", "getsearchresult", (Array:10))
#25 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(548): CRM_Utils_REST::process((Array:3), (Array:8))
#26 [internal function](): CRM_Utils_REST::ajax()
#27 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(275): call_user_func((Array:2))
#28 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:12))
#29 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#30 /home/oursite/public_html/test/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:3))
#31 [internal function](): CiviCRM_For_WordPress->invoke(Object(WP))
#32 /home/oursite/public_html/test/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
#33 /home/oursite/public_html/test/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
#34 /home/oursite/public_html/test/wp-includes/plugin.php(515): WP_Hook->do_action((Array:1))
#35 /home/oursite/public_html/test/wp-includes/class-wp.php(726): do_action_ref_array("wp", (Array:1))
#36 /home/oursite/public_html/test/wp-includes/functions.php(960): WP->main("")
#37 /home/oursite/public_html/test/wp-blog-header.php(16): wp()
#38 /home/oursite/public_html/test/index.php(17): require("/home/oursite/public_html/test/wp-blog-header.php")

```

# Answer
Is this a newer instance of mysql, or did you upgrade recently? Was this ever working in your instance?

What is your civivolunteer version? What is your mysql version?

It's a bit hard to tell given that the sql is truncated in the stack trace but I have an idea for you to investigate.

We can see that mysql is complaining, "Column 'id' in where clause is ambiguous". This is orginating in the retrieve() function of the Project in ext/org.civicrm.volunteer/CRM/Volunteer/BAO/Project.php on line 470.

You should add some logging to that function to get the full SQL statement in the php error log.

Find the line (#470):

```
$dao = self::executeQuery($query->toSQL());

```

and BEFORE it add,

```
trigger_error($query->toSQL());

```

Depending on your error\_reporting php setting, you may need to provide a second argument for the error level such as, E\_USER\_ERROR. https://secure.php.net/manual/en/function.trigger-error.php

Does this only happen when you supply the "with" organization?

A lot of people are having problems with MySQL's changes to strict\_mode, but I've verified this error is not associated with strict\_mode. I'm not sure if there is a similar change between mysql versions that impacts the handling of '\*' in select statements that is triggering this.

Cheers
> 1 votes

# Answer
Bug has been filed here: https://issues.civicrm.org/jira/browse/VOL-319

But additional steps to reproduce are still needed.
> 1 votes

---
Tags: civivolunteer
---


title: Upgrading a CiviCRM System

text:
# Question
Title: Upgrading a CiviCRM System
We have a CiviCRM system that hasn't been updated for 5 years and the guy who used to do this has left. Now I do have a lot of IT knowledge but am lost with this. Please, can someone advise how much of an easy task this is and if not anyone who can do it for us?

Thank you :)

# Answer
> 4 votes
Upgrading is not exactly simple, but it can be done with a lot of IT knowledge. You can find information about the upgrade at https://docs.civicrm.org/sysadmin/en/latest/upgrade/ .

If you need an expert to help you search in the partner list: https://civicrm.org/partners-contributors .

---
Tags: upgrade
---


title: Bounce pattern - SMTP Error Codes

text:
# Question
Title: Bounce pattern - SMTP Error Codes
Currently Bounce Mails are fetched from the smtp store, and a list of regexes are applied to the mail to try and categorize the bounce. There are 10 categories, and an eleventh for when a mail couldn't be matched (syntax bounce).

What I am missing are the defined SMTP status codes. Here is a list with an official list of codes from the RFC, as well as some lists I found convenient for translating the basic status code to the enhanced one:

In a test environment with 4000 bounce mails, 1290 couldn't be classified (syntax bounce), but out of those ~850 mails have some form of SMTP status code.

Did anyone ran into some of those problems as well? And wouldn't it make sense to implement those codes as regexp and push them to core?

If no one has done it yet, I would offer to implement the regex, but I don't want to re-implement something. I'm curious why/if nobody ran into the same problem!

# Answer
> 1 votes
This has been implemented in this extension. Currently a bit static, but patterns for smtp (enhanced and simple) as well as some german away patterns can be easily added.

Extension is alpha at the moment, so handle with care. Pattern files are JSON, and can be edited as well. The Extension does a bit more as well, check Readme.

---
Tags: civimail, smtp, bounce
---


title: Bounce Mail Retention Policy in Civi

text:
# Question
Title: Bounce Mail Retention Policy in Civi
I have the problem, that a bounce mailbox I am using ran full, and it's kind of hard to monitor , since the joblog of CiviCRM needs to be watched (Bounce Mail Cronjob).

Since Civi is managing the mailbox anyways, and moves mails to CiviMail/processed and CiviMail/ignored, shouldn't CiviCRM clean up afterwards and delete old mails? Or shouldn't there be at least an option for that?

Maybe there is an extension implementing that, but I haven't found anything yet.

# Answer
We integrated that into an extension, found here at github. Retention can be configured in days for each folder.

Extension is still alpha, handle with care.
> 2 votes

---
Tags: civimail, bounce
---


# Question
Title: Reports will no longer generate pdfs:Shows HTTP 500 error
Recently we have been getting an error when attempting to generate pdfs. The only change of note has been that our server just upgraded to FreeBSD 10. When the process is run I get a HTTP 500 error. I have looked at the error logs and am unsure that it is showing the error. Listed below is the error that is repeated in the log. This is a Civi (4.7.29) install via wordpress (4.9.4). Any help is appreciated.

```
#1 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(833): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
#2 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(828): CRM_Core_Controller->invalidKeyCommon()
#3 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(312): CRM_Core_Controller->invalidKey()
#4 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(204): CRM_Core_Controller->key("CRM_Report_Form_Contact_Summary", TRUE, FALSE)
#5 /wp-content/plugins/civicrm/civicrm/CRM/Core/Controller/Simple.php(66): CRM_Core_Controller->__construct(NULL, TRUE, NULL, "CRM_Report_Form_Contact_Summary", FALSE, FALSE)
#6 /wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(84): CRM_Core_Controller_Simple->__construct("CRM_Report_Form_Contact_Summary", NULL, NULL, FALSE, FALSE, FALSE, FALSE)
#7 /wp-content/plugins/civicrm/civicrm/CRM/Report/Page/Instance.php(89): CRM_Utils_Wrapper->run("CRM_Report_Form_Contact_Summary", NULL, NULL)
#8 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Report_Page_Instance->run((Array:4), NULL)
#9 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:14))
#10 /wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#11 /wp-content/plugins/civicrm/civicrm.php(1216): CRM_Core_Invoke::invoke((Array:4))
#12 [internal function](): CiviCRM_For_WordPress->invoke("")
#13 /wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
#14 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
#15 /wp-includes/plugin.php(453): WP_Hook->do_action((Array:1))
#16 /wp-admin/admin.php(224): do_action("toplevel_page_CiviCRM")
#17 {main}

[message] => We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.<br /><br />Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.<br /><br />Error type: Could not find a valid session key.
[code] =>

```

# Answer
After updating to the latest CiviCRM it seems the problem was corrected.
> 1 votes

---
Tags: wordpress, error, pdf, debugging
---


# Question
Title: Contacts not merged When creating Account on Event Page - DB Error: already exists
Running: CiviCRM 4.7.17, WordPress 4.9.4

When an anonymous visitor tries to register for an event, we have them required to sign in or create an account via Civi's profile settings to keep our existing contact information to be relevant.

* The profile used in the event requires a WP account
* Duplicate Civi contact matching is set to merge with an existing contact in the profile's settings
* I've only tried with pay later option (is there a way to use the test digital payment without being signed in? I the test option limits the test to certain users which have to be signed in to try it).
* Existing users who sign-in don't receive the error

The anonymous user enters creates a new WP account, as required. When the user enters the name and email which matches an existing contact in Civi, they are thrown the following, *DB Error: already exists* instead of the intended confirmation and contact merge.

CiviCRM/WP seems to:

* create a new contact based on their name and email instead of merging new details with the existing contact.
* Payment (Pay later) and event registration is recorded under the existing contact.
* Send out 2 new WP user emails. One has the username and email, *the second is blank*.

I've tried poking around but no results. Suggestions?

```
[info] $Fatal Error Details = Array (
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  44 , 'test@email.com' ,  1353 )  [nativecode=1062 ** Duplicate entry 'test@email.com-1' for key 'UI_uf_name_domain_id']
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  44 , 'test@email.com' ,  1353 )  [nativecode=1062 ** Duplicate entry 'test@email.com-1' for key 'UI_uf_name_domain_id']
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  44 , 'test@email.com' ,  1353 )  [nativecode=1062 ** Duplicate entry 'test@email.com-1' for key 'UI_uf_name_domain_id']"] )

```

Update: Trying to merge the duplicate contacts made (one with name and email - another with the full profile details) returns a different DB error:

```
    [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -18
    [message] => DB Error: no such table
    [mode] => 16
    [debug_info] => UPDATE IGNORE civicrm_action_log SET contact_id = 1353 WHERE contact_id = 1415 [nativecode=1146 ** Table 'our_database.civicrm_action_log' doesn't exist]
    [type] => DB_Error
    [user_info] => UPDATE IGNORE civicrm_action_log SET contact_id = 1353 WHERE contact_id = 1415 [nativecode=1146 ** Table 'our_databse.civicrm_action_log' doesn't exist]
    [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::handle prefix="" info="UPDATE IGNORE civicrm_action_log SET contact_id = 1353 WHERE contact_id = 1415 [nativecode=1146 ** Table 'our_databse.civicrm_action_log' doesn't exist]"]
)

```

# Answer
Maybe, you should check the profile settings, make sure you check the below input which updates the existing contact if profile finds a duplicate match -
> 2 votes

# Answer
That second error suggests that all may not be well with the DB

> Table 'our\_database.civicrm\_action\_log' doesn't exist.

Also if I read your Q right, could there be an issue if you are creating WP Users via the Profile too if there is already a civi contact AND a WP user? I don't know WP but it may be worth testing if you have a different outcome if

a/ there is a civi contact but no WP user, and a form is submitted that 'matches' the civi contact

b/ there is a civi contact with a WP user, and a form is submitted that 'matches' the civi contact

c/ WP users are set 'off' for the profile and there is an existing matching civi contact but no WP user, and a form is submitted that 'matches' the civi contact
> 1 votes

---
Tags: wordpress, civievent, database
---


# Question
Title: Error with recording membership payment offline
Is anyone aware of any issue with trying to record a membership payment offline? WE are running CiviCRM 4.7.11

Click on and existing Membership and edit membership.

Click on the checkbox that says Record Membership Payment. None of the fields to record the membership payment are being displayed such as amount, financial type etc.

If you then click on the Send Confirmation and Receipt checkbox, and then click 'Save' it of course gives an error saying Please enter the financial Type.

Not sure what is going on as we have not come across this issue before

Update:Just checked with Civihosting and they have confirmed its a bug.
Has anyone got a fix for this?

# Answer
I just confirmed the bug in http://dmaster.demo.civicrm.org. This means not fixed yet. I take a look on https://issues.civicrm.org and I have not found any related error.

You can see guideline Bug Reporting and report this issue.
> 2 votes

# Answer
Bug was addressed for upcoming CiviCRM 5.1 release. You can see more info to the related PR https://github.com/civicrm/civicrm-core/pull/11087 and reported issue https://issues.civicrm.org/jira/browse/CRM-19850.
> 1 votes

---
Tags: civimember
---


# Question
Title: Is there CiviContribute API documentation?
I'm wondering which CiviContribute API calls are required to make a donation happen. For example, I'm assuming that I don't need to make any calls to PayPal or Stripe, because the CiviContribute API will do this under the hood.

I'm using the REST api, but probably general CiviContribute API documentation would suffice.

Is there any documentation of the process for making a donation with the API, and which calls are needed in a typical scenario?

# Answer
I do not know what you want to achieve exactly, but the API that I use is called Contribution. It creates a contribution in CiviCRM but it does not automatically make calls to PayPal or Stripe.

And I am glad it does not because most NGO's in my corner of the world (Northern Europe) hardly use PayPal and have never heard of Stripe. They want all their payments processed with SEPA, which probably you never heard of.

Documentation on the API can be found here: https://docs.civicrm.org/dev/en/latest/api/
> 0 votes

---
Tags: civicontribute
---


title: CiviVolunteer Fails to Install

text:
# Question
Title: CiviVolunteer Fails to Install
After moving my Joomla-based CiviCRM site to a new server that included an upgrade to Joomla 3.8.2 on PHP 7.0 and CiviCRM 4.7.29, CiviVolunteer stopped working. I eventually uninstalled CiviVolunteer and have attempted multiple times to install the latest version (4.7.21-2.2.3). I have tried every relevant suggestion found on the web and here on StackExchange including that from Nicolas at Cividesk involving SQL scripts to clean up left-over garbage in the database. Additionally, I have sifted through the database to remove anything that remotely looked like a potential conflict. The installation failure mode is a blank screen. When I navigate to the previous page, I see many messages like those shown in the Nicolas post. Back Trace information doesn't seem to show anything useful. Any help would be appreciated at this point.

# Answer
A blank screen can sometimes mean an error on the server. It doesn't show anything in your logs, but might in the server logs. Usually I have to contact support at the web host to see what they can find out. Sometimes it's something as simple as a file/folder with the wrong user, wrong permission, etc.
> 1 votes

# Answer
I was the initial question on this thread. The problem was solved by rolling back from PHP 7.1 to version 5.6. Unfortunately, PHP 5.6 security support is slated to end Dec 31, 2018.
> 1 votes

# Answer
I am having the same problem after an upgrade of civi 4.7.27 to 4.7.29 Civimail is no longer functional. I did try the suggestion of changing the Resource URL's back to full path, but that did not help.

I get this error message when going to civi CP Warning: Invalid argument supplied for foreach() in /home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Core/BAO/SchemaHandler.php on line 750

I get this from my cron job
**Warning**: scandir(/cur): failed to open dir: No such file or directory in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
**Warning**: scandir(): (errno 2): No such file or directory in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
**Warning**: Invalid argument supplied for foreach() in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
**Warning**: scandir(/new): failed to open dir: No such file or directory in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
**Warning**: scandir(): (errno 2): No such file or directory in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
**Warning**: Invalid argument supplied for foreach() in **/home//public\_html/administrator/components/com\_civicrm/civicrm/CRM/Mailing/MailStore/Maildir.php** on line **85**
> 0 votes

# Answer
Need to change from mailer to SMTP. You are probably still set at the default Mailer Type: mail() Change it to SMTP, and it is a preferred approach to use "Authentication". From the civicrm menu: Administer, System Settings, Outbound Email.
> 0 votes

---
Tags: installation, civivolunteer
---


# Question
Title: $participant_status_id shows previous value in email template
Using version 4.6.9 on Drupal 7. I'm working on a revision to our email template for event registrants, and in our environment, it's important to distinguish between individuals who are awaiting administrative approval (status 8), those with completed registration (status 1), and those assigned to the waitlist(status 7). I thought the variable $participant\_status\_id would meet my needs, but emails generated after an update to participant status show the previous value for $participant\_status\_id, not the updated value. Is this how it's supposed to work? What smarty variable do I use to check the updated status?

# Answer
This was posted a while ago, but I thought I should post the solution I finally found to the problem (which still exists in my version 4.7.29 install)

The solution to this problem was an API call. While the value of $participant\_status\_id shows the value PRIOR to update, with this Smarty code added somewhere near the top of the template:

```
{crmAPI var='partinfo' entity='Participant' action='get' event_id=$event.id contact_id=$contactID}
{foreach from=$partinfo.values item=participant}{/foreach}</p>

```

I can then use the variable $participant.participant\_status\_id which will contain the correct status value reflecting the update made in the "Edit Event Registration" screen.
> 3 votes

---
Tags: civievent, message-templates, smarty, system-workflow-messages
---


# Question
Title: embedded link in email receipt to edit/cancel recurring contributions link only xml
Using iatspayments with Drupal 7 and CiviCRM. Recurring gifts are working properly and cron running daily.

When contributor donates - he correctly receives an email containing the following statement

This is a recurring contribution. You can cancel future contributions by visiting this web page. (https://www.iatspayments.com/NetGate/ProcessLink.asmx?WSDL)

You can update recurring contribution amount or change the number of installments for this recurring contribution by visiting this web page. (https://www.iatspayments.com/NetGate/ProcessLink.asmx?WSDL)

Both links don't work in all browsers

# Answer
> 1 votes
That’s an old issue; please see here for details/solutions:

https://github.com/iATSPayments/com.iatspayments.civicrm/issues/192

---
Tags: recurring-contributions, iats
---


title: New Profile adding custom fields issue

text:
# Question
Title: New Profile adding custom fields issue
I created a new Contact Type, Parish, based on Organization. No data added yet. I will display this as a field in a Contact Records as a Parishoneer of relationship.

I am following a tutorial screencast of Roundearth CiviCRM Profile Forms. I wanted to create a Parish Sponsor Leads profile. I have First Name, Last Name, Email, Phone Number and Notes.

When I try to use Parish as a custom field, to be the first field in the form, in the new Parish Sponsor Leads profile I get this error: Cannot add or update profile field type "Parish" with combination of "Individual".

# Answer
> 1 votes
CiviCRM doesn't allow you to add contact fields or custom fields of different contact type or contact sub type. The processing of mix profile is still not handled in CiviCRM.

You can create custom field for individual and then use hook to create organization contact and relationships.

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


# Question
Title: CiviMail - 'No recipients': nothing added to table civicrm_mailing_recipients
I have migrated an existing installation to a new server followed by an upgrade to 4.7.31.

When creating a new mailing I keep getting "No recipients" **when I add groups or smartgroups**. If I add recipients of past *mailings*, it works as expected (I get xx recipients).

In the database \- the table civicrm\_mailing\_group gets a new record (so OK) \- the table **civicrm\_mailing\_recipients** does not get new records added.

So the problem seems to be related to populating the civicrm\_mailing\_recipients table. How do I debug/solve this?

# Answer
> 2 votes
I tried clearing all kinds of caches and rerunning the Smart Group caching several times but to no avail.

I ended up redoing the entire migration and upgrade, and the problem no longer occurs now.

So it's fixed for me, but I have no idea what setting, add-on or cache was responsible.

**EDIT**: an issue has been opened for this: https://issues.civicrm.org/jira/browse/CRM-21856

---
Tags: civimail, groups
---


# Question
Title: How to programmatically open the option modal and listen to changes?
I would like to open such a modal programmatically and then listen to events related to this modal (such as "option created", "option updated", "modal closed" etc). I tried to look at the CiviCRM source code but could not find API for that. Is there such a possibility?

# Answer
It turned out to be possible:

```
CRM.loadForm('/some/url')
  .on('crmFormSuccess', function (event, data) {
    // do smth
});

```

Ref: https://docs.civicrm.org/dev/en/latest/framework/ajax/
> 2 votes

# Answer
What are you trying to achieve exactly? Your solution works for the UI but will never catch any of the changes done via the API?

So if you want to just catch the UI actions, your solution will be fine. But if you want to catch all changes to an option group you might miss a few.
> 1 votes

---
Tags: api
---


# Question
Title: Adding contribution_id or transaction_id to Receipt
I've searched and can't find anything that works.

How do I add the Contribution ID and/or transaction\_id to a receipt (Online and Offline)?

What I'm looking for is a way to easily find a contribution if a donor calls inquiring. I can ask them the contribution id and then search. Then I noticed that there's not a way to search by contribution id but there is by transaction id. However, transaction id isn't automatically created unless it's an online credit card donation. If I process a check or cash then it doesn't create a transaction id. Any suggestions on some options?

What do other's use on their receipts as the id?

# Answer
{$contributionID} should work ....
> 2 votes

# Answer
> Then I noticed that there's not a way to search by contribution id but there is by transaction id.

You can search for Contributions and use "Invoice Number" - which constitutes of Invoice prefix + **Contribution ID**.

For Example: Invoice Number: INV1234 -\> Contribution ID: 1234

(You can set that invoice prefix under administer-CiviContribute, where you can activate invoicing.)

The token {contributions.contribution\_id} should be useful.
> 0 votes

---
Tags: receipts, system-workflow-messages
---


title: Dokumente ablegen

text:
# Question
Title: Dokumente ablegen
gibt es in Civi eine Möglichkeit Dokumente, Bilder, Dateien abzulegen?

In der Demo Version finde ich die Möglichkeit nicht.

Vielen Dank für Eure Mühe.

Beste Grüße Horst

# Answer
> 1 votes
Depends on what you are asking really. There are parts of CiviCRM where you can add attachments. Also there is the documents extension, you can read more about it here: https://civicrm.org/blog/petednz/using-and-improving-the-documents-extension-a-drupal-extension-by-civicoop

But in general you would need to tell us what kind of documents you want to save and the exact functional requirement.

---
Tags: mysql
---


# Question
Title: Should new Scheduled Reminders (based on Activity Type = Email) send out to Emails created in the past?
Steps:

Created a Scheduled Reminder (SR) for Entity = Activity Type = Email Status = Completed When = 1 hour after Activity Date Time Recipients = Activity Assignees

When this was saved I created an email activity for myself. And then ran the scheduled job of ‘Send Scheduled Reminders’.

In addition to an SR going out for the new email activity, my Contact record had two completed email activities from the day before the creation of the scheduled reminder (and hence well beyond the "1 hour").

The result of running the scheduled job was an scheduled reminder sent for each of the two email activities from the day before. As well as one for the new email activity one hour after the activity date time.

Is the sending of scheduled reminders for historical activities expected behaviour? if not, are there steps via UI we should be taking to avoid this happening (other than devious ones of creating new Activity Types etc) or is this a bug that needs fixing.

My recollection is we have hit other nasty surprises of SRs going out to things that were way past, such as old Events.

# Answer
I've run into this issue before -- setup a scheduled reminder to follow up after events, and had it sent for all past events.

Personally I think this is a bug, and that we should define a window of time that the reminder is restricted to, in order to limit how far into the past it processes records.
> 1 votes

---
Tags: activities, scheduled-reminders
---


title: Adding and storing form fields

text:
# Question
Title: Adding and storing form fields
I figured out how to add form fields using the buildForm hook. I am adding a select element to a participant profile on an event registration form. Do the values from the added fields get saved when the user submits the form? If so, where can I see them? If not, how do I store them with the other profile info using code? The custom fields feature does not work (DB Error: Already exists) right now or else I would use that.

# Answer
`buildForm` hook is used to add the elements on the form. To store the values of your select element, you need to look at `postProcess` hook which is called after the form is submitted.

You'll get the submitted select value in `$form` parameter. Use this and store the value in your expected table.
> 2 votes

# Answer
As Jitendra explained you can use the `postProcess` hook and the `$form` parameter. The submitted values will be in an array `$form->_submitValues`.
> 0 votes

---
Tags: joomla, php, forms, quickform
---


# Question
Title: WYSIWYG editor not appearing in CiviCRM and Drupal
I am trying to edit a "Message Template" in CiviCRM 4.7.30 and Drupal 7.57, but the "HTML Format" is not showing a WYSIWYG editor, just a plain text editor.

I have gone to CiviCRM -\> Administer -\> Customise Data and Screens -\> Display Preferences. The "WYSIWYG Editor" setting is "CKEditor" (this is the only option).

In Drupal, I have the WYSIWYG module installed.

Any thoughts?

Thanks,

Carl

# Answer
Ah, I've figured out the problem after looking at the code in ./sites/all/modules/civicrm/CRM/Admin/Form/MessageTemplates.php. The WYSIWYG editor is only shown if the message template is not a system message
> 1 votes

---
Tags: drupal, wysiwyg
---


# Question
Title: Is there any way to import files into a custom field for uploaded files?
Is there any way through SQL commands, to import files into a custom field? E.g. photos of contacts?

# Answer
You asked about SQL, but it is generally recommended to use the API rather than direct SQL. See the Attachment API - examples in the Code Docs section of API Explorer.
> 2 votes

# Answer
I would do one manually with the UI, then look at tables civicrm\_file, civicrm\_entity\_file, and the custom table to see what it creates, then base it on that. The name of the custom table depends on what field group you've put the field in, but it starts with civicrm\_value\_XXX.

You might also want changelog records (civicrm\_log) and would need to deal with the filename suffixes that it adds to make it harder to guess the filenames for url hacking. See Aidan's answer for an alternative using php that should handle all this for you.
> 1 votes

---
Tags: import
---


# Question
Title: Wordpress main search widget - Search events
Does the search widget in wordpress integrate with CiviCRM. I need for people in mi site to be able to search for events in a particular city. For example if I have an event in Miami and someone searches in main site for Miami all events in that city to show up.

Is that possible???

# Answer
> 1 votes
If you use a short code for your event on a page and include the search terms you are looking for in the permalink it should be found in search results. So in your case you would create pages (or posts) for each event with the short code included and include the city in the permalinks.

Hope this helps.

# Answer
> 0 votes
I doubt this is possible without additional coding work. My experience in Drupal would be a 'this is only possible via the Search API, or by creating nodes for each Event'.

---
Tags: search
---


# Question
Title: How can i show the Count of Contributions in a give time period?
I checked the awesome Summary Fields extension and the Advanced Fundraising Reports one but neither seem to quite offer this.

I could do this as a Drupal View but that won't give me the full suite of 'Actions' that might be required.

# Answer
We did create additional Summary Fields to cover 1 Apr - Mar 31, and for July 1 - June 30. We then found out that by setting the Financial Year field in civicrm/admin/setting/date?reset=1 to the correct date had the desired outcome.

We therefore made a PR for the extension to improve the documentation to avoid this catching out others unaware.
> 0 votes

# Answer
If Summary Fields does not have the fields you need, it's pretty easy to add your own using `hook_civicrm_sumfields_definitions()`

Try dropping something like this into an extension:

```
/**
 * Implements hook_civicrm_sumfields_definitions().
 *
 */
function myextension_civicrm_sumfields_definitions(&$custom) {
  $custom['fields']['contribution_count_twelve_months'] = array(
    'label' => 'Count of Contributions in last 12 months',
    'data_type' => 'Int',
    'html_type' => 'Text',
    'weight' => '15',
    'text_length' => '32',
    'trigger_sql' => '(
      SELECT COALESCE(COUNT(id), 0)
      FROM civicrm_contribution t1
      WHERE t1.contact_id = NEW.contact_id AND t1.contribution_status_id = 1 AND
      t1.financial_type_id IN (%financial_type_ids) AND
      CAST(receive_date AS DATE) BETWEEN DATE_SUB(NOW(), INTERVAL 12 MONTH) AND NOW()
      )',
    'trigger_table' => 'civicrm_contribution',
    'optgroup' => 'fundraising',
  );
}

```

Tweak the `trigger_sql` for your preferred time interval.

See the Readme for more info.
> 0 votes

---
Tags: civicontribute
---


# Question
Title: Webform CiviCRM Event Confirmation Email Not Sending
CiviCRM 4.7.30, current Webform CiviCRM 7.x-4.19

When 'Send Confirmation Email' = Yes on the CiviEvent, filled out. When the user submits Webform CiviCRM, the event participant is registered successfully but no confirmation email is sent. I reverted the CiviCRM email template for Event Online Registration to default, to rule that out.

Workaround - we made the email send from Webform, but this is a bad workflow for staff who just wants to make CiviEvents.

Does anyone else have this issue?

# Answer
> 3 votes
You must also enable Thank you and Receipting in the CiviCRM Configuration for the Contribution Page associated with the webform;

---
Tags: webform-civicrm
---


# Question
Title: "API permission check failed" for admin user
(I'm using version 4.7 based on Wordpress)

When making a REST api call to retrieve a ContributionPage instance, the response tells me that I "require administer CiviCRM". However, the API key is associated with a user in the Administrators group of CiviCRM (this was configured as such using the "group" dropdown in the "New Individual" form of the CiviCRM contacts menu) . For other entities such as "Contact" the call works.

```
    # get contribution page
    resp = requests.get(
        url,
        params=dict(
            entity='ContributionPage',
            action='getsingle',
            api_key='xxxxxxxxxxxxxxxx',
            key='xxxxxxxxxxxxxxx',
            json={"id":1}
        )
    )
    print(resp.text)

{"error_code":"unauthorized","entity":"ContributionPage","action":"getsingle","is_error":1,"error_message":"API permission check failed for ContributionPage\/getsingle call; insufficient permission: require administer CiviCRM"}

```

Does anyone know what could be the problem?

# Answer
> 2 votes
You must also make the user an admin in the Users panel of the host CMS (wordpress, in this case). It's not sufficient to choose `Administrators` as the value for the "group" dropdown in the "New Individual" form of CiviCRM.

---
Tags: civicontribute, api, rest
---


title: Civi Membership

text:
# Question
Title: Civi Membership
I am currently using Caldera forms that would make a contact into civi. I was wondering if there was a way for me to set up for me to add contacts to memberships once they enter the database. To my knowledge caldera doesn't have a membership processor. Can you add memberships to contacts if they join a group? Thank you for your time reading this.

# Answer
> 1 votes
I am a bit confused about your question. You might be able to achieve what you want using the CiviRules extension (found here: https://civicrm.org/extensions/civirules with documentation here: https://docs.civicrm.org/civirules/en/latest/).

But it sounds like you might have to develop / have someone develop the CiviAction *add membership*.

---
Tags: wordpress, civimember
---


title: waitlist behaviour

text:
# Question
Title: waitlist behaviour
I'm wanting to keep track of event attendance and in particular to distinguish between those who let us know at the last minute from the complete no-shows. With earlier cancellations I can use the "cancelled" status, which will trigger an offer on the wait-list, but I'm concerned that if I set someone to "cancelled" after the event that it will still offer a place to someone on the wait-list which would be wrong. I can't see anything that stops registration after the date of the event and I presume that this means the wait-list would behave the same.

It would be good to know the default behavior before I explore a few work rounds. I can see a few ways round this:

a) set the online registration to explicitly stop on the day of the event (but would still need to check this would apply to the wait-list

b) explicitly disable the event booking before recording the attenance information

c) creating a new status of "Apologised" for late cancellations that is still counted in the attendance count.

# Answer
> 2 votes
I realised that I didn't have to wait for the participant status cron job to run and could run it from the console, so have done some testing and find that by default a cancellation after the event means that a wait-listed person will be offered a place to a now past event. So I looked at my alternatives.

a) does work and is probably the safest and sensibly matches any cut off time for event bookings.

b) works, but I think the person managing the event may forgot

c) works and I thinks its probably what I will use as it distinguishes between the two cases where the place can potentially be reused or not.

---
Tags: waitlist
---


title: Creating a new "Member" in one step

text:
# Question
Title: Creating a new "Member" in one step
If you "become a member" by going through the normal route of "joining" through the website front-end -- using a CiviCRM profile and requiring the creation of a Joomla (in my case) account -- it is an easy one step process. However, my organization has a lot of older members who join through the mail or in person.

This means that you have to: (1) Create a CiviCRM "Contact" (2) Create a CiviCRM "Membership" (3) Create a CiviCRM "Contribution" and (4) Create a Joomla user that is connected to the CiviCRM "Contact".

That is a cumbersome four step process that is being handled in one go if you join through the website front-end. In addition, you cannot create a Profile form that has more than one "category" in it, which means you cannot create a profile form so that somebody already logged in can create a new member, accomplishing all of these tasks in one form, or on one page.

I have thought to myself, "Surely somebody out there has faced this problem and solved it," but after nearly 6 months of searching the web, reading the CiviCRM wiki, searching the old boards and the new Stack Exchange board, I can't even find anybody discussing it.

Does somebody have a solution to this problem?

# Answer
> 1 votes
It should never be a 4 step process as the contribution and membership records are created at the same time. When you sign someone up for a membership offline via **Add Membership** on the membership tab of their contact record you tick the "Record Membership Payment" box and enter the payment during the membership creation or, if it is a credit card payment you choose **Submit Credit card membership** and the details for recording the payment are visible from the beginning.

You can get it down to 2 steps if it is a credit card payment and you make use of the "not you or want to do this for another person" feature at the top of the **online** sign up page.(The only step to do separately would be creating the onnected Joomla user.)

If you were using Drupal and the payment was by Credit card you could do it in one step if you used CiviRules to tag the contact when it was created and then implemented the steps outlined in Creating Drupal users made easy .

However, I note that you are using Joomla. I don't use Joomla and don't know if anyone has created a similar method for creating Joomla users by tagging civicrm contacts.

# Answer
> 0 votes
As an admin you can visit the contribution page path with &cid=0 appended on the path, that way the admin can fill in the Membership form as if you were logged out, and therefore do steps 1, 2 and 4 (at least) on one screen

# Answer
> 0 votes
You can do this by using fabrik. I'm currently working on a similar project.

I have created a list using civicrm\_contact table and then on the form submission i write own custom code to manually insert data to civi tables. Meantime it creates a Joomla account and add data to relevant tables. If you want to go down this route let me know. I can provide some help

---
Tags: civimember, contacts, contributions, user
---


# Question
Title: Add a contact to an organization through "profile" public form
For now our public subscription form is handled by a "profile" that create/modify a contact.

I want to add the organization which the contact belongs to but I don't know how to it ? Is it possible to have a public list the subscriber can have access to ?

# Answer
> 1 votes
I think that in pure CiviCRM all you can do is add the Current Employer field to the profile, which is then a text only field.

If you want that field to be an autocomplete then I think you should try the Public Autocomplete of Organisation Names extension. There is also a blog written about it here

---
Tags: profile, organization
---


title: CiviMail token for sender signature

text:
# Question
Title: CiviMail token for sender signature
Is there a token for email **sender's** signature?

I need the email generated from template to be signed by the person who is sending the email.

# Answer
Yes there is but it only works for regular mails not for mails sent by CiviMail (bulk mails):

1. Add signature to the CIviCRM contact that is connected to your CMS contact (see screenshot).
2. Click on send email for a contact and the signatures should be in the Text editor.

However, for Bulk Mails you would have to put the signature in a footer or th emessage template.
> 2 votes

# Answer
You might find the code in https://github.com/JMAConsulting/biz.jmaconsulting.sigs a useful starting place for a token for CiviMail - a PR for this would be welcome. Feel free to contact me if you would like us to develop it for you.
> 1 votes

---
Tags: civimail, tokens
---


# Question
Title: DB Error: unknown error - [debug_info] => INSERT INTO civicrm_contact
it's fresh install of CiviCrm into my Joomla, run with UniserverZ
(assume all Apps are in latest version)

When I clicked CiviCRM, in Components, there was a DB Error: unknown error
In the joomla/media/civicrm/ConfigAndLog displays

```

Mar 28 07:58:42  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , display_name , preferred_language , hash , first_name , last_name , communication_style_id , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' ,  NULL , 'User, Super' , 'Super User' , 'en_US' , '4657797a1e8c1944237e5e83dc3f8b38' , 'Super' , 'User' ,  1 ,  1 ,  1 ,  1 )  [nativecode=1436 ** Thread stack overrun:  8640 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , display_name , preferred_language , hash , first_name , last_name , communication_style_id , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' ,  NULL , 'User, Super' , 'Super User' , 'en_US' , '4657797a1e8c1944237e5e83dc3f8b38' , 'Super' , 'User' ,  1 ,  1 ,  1 ,  1 )  [nativecode=1436 ** Thread stack overrun:  8640 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , display_name , preferred_language , hash , first_name , last_name , communication_style_id , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' ,  NULL , 'User, Super' , 'Super User' , 'en_US' , '4657797a1e8c1944237e5e83dc3f8b38' , 'Super' , 'User' ,  1 ,  1 ,  1 ,  1 )  [nativecode=1436 ** Thread stack overrun:  8640 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.]"]
)

Mar 28 07:58:42  [info] $backTrace = #0 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Core\Error.php(232): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
#2 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB.php(984): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...")
#3 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...")
#4 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...", "DB_Error", TRUE)
#5 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\common.php(1905): PEAR->__call("raiseError", (Array:7))
#6 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...", "1436 ** Thread stack overrun:  8640 bytes used of a 131072 byte stack, and 12...")
#7 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...")
#9 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\DataObject.php(2446): DB_common->query("INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...")
#10 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\packages\DB\DataObject.php(1068): DB_DataObject->_query("INSERT INTO civicrm_contact (contact_type , contact_sub_type , sort_name , di...")
#11 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Core\DAO.php(525): DB_DataObject->insert()
#12 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Contact\BAO\Contact.php(214): CRM_Core_DAO->save()
#13 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Contact\BAO\Contact.php(308): CRM_Contact_BAO_Contact::add((Array:12))
#14 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Contact\BAO\Contact.php(1992): CRM_Contact_BAO_Contact::create((Array:12))
#15 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Core\BAO\UFMatch.php(298): CRM_Contact_BAO_Contact::createProfileContact((Array:5), (Array:0))
#16 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm\CRM\Core\BAO\UFMatch.php(118): CRM_Core_BAO_UFMatch::synchronizeUFMatch(Object(Joomla\CMS\User\User), "121", "temp@temp.com", "Joomla", NULL, "Individual", TRUE)
#17 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm.php(97): CRM_Core_BAO_UFMatch::synchronize(Object(Joomla\CMS\User\User), FALSE, "Joomla", "Individual", TRUE)
#18 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civicrm\civicrm.php(40): civicrm_invoke()
#19 C:\Users\USER\Desktop\UniServerZ\www\joomla\libraries\src\Component\ComponentHelper.php(382): require_once("C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\components\com_civi...")
#20 C:\Users\USER\Desktop\UniServerZ\www\joomla\libraries\src\Component\ComponentHelper.php(357): Joomla\CMS\Component\ComponentHelper::executeComponent("C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator/components/com_civi...")
#21 C:\Users\USER\Desktop\UniServerZ\www\joomla\libraries\src\Application\AdministratorApplication.php(101): Joomla\CMS\Component\ComponentHelper::renderComponent("com_civicrm")
#22 C:\Users\USER\Desktop\UniServerZ\www\joomla\libraries\src\Application\AdministratorApplication.php(159): Joomla\CMS\Application\AdministratorApplication->dispatch()
#23 C:\Users\USER\Desktop\UniServerZ\www\joomla\libraries\src\Application\CMSApplication.php(303): Joomla\CMS\Application\AdministratorApplication->doExecute()
#24 C:\Users\USER\Desktop\UniServerZ\www\joomla\administrator\index.php(51): Joomla\CMS\Application\CMSApplication->execute()
#25 {main}

```

I'm a newbie, don't know what went wrong? Please help

# Answer
The part of the error that matters is this part:

```
Thread stack overrun:  8640 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.

```

See https://docs.civicrm.org/sysadmin/en/latest/requirements/ under MySQL configuration - it needs to be 192k or higher. FYI the thread\_stack variable needs to be set in the mysql configuration file and mysql needs to be restarted - you can't change it on the fly.
> 2 votes

# Answer
Thank you for your help Demerit
I found the my.ini file in UniserverZ
I searched google to look for the same problem but it told me to find my.cnf file to edit the thread\_stack, I was in frustration last night for unable to find one.
> 3 votes

---
Tags: joomla, error, database, mysql, civicrm-contact
---


title: Delete a Missing Case

text:
# Question
Title: Delete a Missing Case
I ran a Case Detail Report to see a list of cases because my Views table count was not adding up. I realized from this report that there is a case with an "Active" status that does not have a Contact ID. I can't seem to find this case anywhere. The case is not "deleted" from what I can tell. Any ideas is appreciated!

# Answer
It's weird to see a case without a client. Maybe, it was created correctly and somehow `civicrm_case_contact` table row was deleted for this contact\_id?

If you wish to delete this case from your site, you can make use of the API explorer - `http://site-name/civicrm/api#explorer` OR can be navigated through `Support -> Developer -> API Explorer`

Use `Case` Entity with `Delete` action and pass the case id as a parameter -

If you don't know the case id - you can check by placing your cursor on the subject column of the case detail report. The URL will be shown on the bottom left of your browser which has the `caseId` param as shown in the screenshot -
> 5 votes

---
Tags: civireport, civicase
---


# Question
Title: Can't make an account on civicrm.org to use with gitlab
I want to log an issue on gitlab and it says to create an account. So I go to https://civicrm.org/user/register and fill in various details but there is nowhere to create a password. The form submits without error but when I go to "forgot password" tells me the account does not exist. If I try to create the same account again however, it tells me that the name and email address are already registered.

# Answer
Ah, turns out it just took a long time to get a confirmation email. Once I got that and clicked the link it allowed me to set a password.
> 1 votes

---
Tags: civicrm.org, gitlab
---


# Question
Title: Update addressee values for all contacts after modifying Addressee Type Options
I have updated the tokens in my *Addressee Type Options* (at **Administer \> Communications \> Addressee Formats**), and now CiviCRM is now generating my desired addressee values each time I save contacts.

This is great, going forward.

But how can I update the addressee values for *all* the contacts in my database, without having to go edit/save them all one-by-one?

# Answer
Use the `update_greeting` scheduled job.

1. Go to **Administer \> System Settings \> Scheduled Jobs**
2. Click **Add New Scheduled Job**, and enter the following values.

* "Name": "Force Update Addressee Values"
    * "Description": (blank)
    * "Run frequency": "Every time cron job is run"
    * "API call": select "Job", and enter "update\_greeting" in the text field
    * "Command parameters":

    ```
    ct=Individual,Household,Organization
    gt=addressee
    force=1

    ```
    * "Scheduled Run Date": (blank)
    * **Uncheck** "Is this Scheduled Job active?"

    (This is **important** because you don't want your scheduled job to run automatically.)
3. Click **Save**.
4. Find your scheduled job in the list of all jobs, and click **More \> Execute Now**
5. Find your scheduled job in the list of all jobs, and click **View Job Log**. Verify that you see "Success" in the log. Troubleshoot any errors.
> 2 votes

---
Tags: tokens
---


# Question
Title: Persistent "Your database has already been upgraded to CiviCRM" Problem
I am updating CiviCRM from 4.7.27 to 4.7.31 on WordPress 4.9.4. Other than CiviCRM, everything is up to date.

I've thoroughly Googled the problem, and have tried three times to do the update. But the "Your database has already been upgraded to CiviCRM 4.7.27" problem persists. I've followed the relevant portions of Upgrading CiviCRM for WordPress for current versions of WordPress and CiviCRM.

In particular, in response to problems other people have had, I've:

* Completely deleted my /wp-content/plugins/civicrm folder via FTP (*I didn't just rename it*).
* Downloaded a fresh copy of CiviCRM 4.7.31, unzipped it locally, and uploaded the civicrm folder to /wp-content/plugins. I confirmed that the remote copy of civicrm.php references version 4.7.31 in the header.
* Deleted the files in /wp-content/uploads/civicrm/templates\_c.
* Cleared the browser cache (I'm using Chrome).
* Searched the site files for a rogue civicrm plugin directory. There is none.

All of this in addition to all the other relevant steps in the Upgrading wiki article. (We're not using localization files.)

Nothing works, and I continue to be haunted by "Your database has already been upgraded to CiviCRM 4.7.27" when I run the upgrade script.

What could I be missing? What is causing the problem?

Thanks!

# Answer
> 1 votes
Huge thanks to @PradeepNayak for your help! The problem wasn't with the paths in civicrm.settings.php, but that suggestion led us to look at our configuration. Turns out that we had some confusion between a development and staging server, so were, in fact, not updating the right instance. In essence, the version number from the database was right, but it was looking in the wrong place for the files version.

---
Tags: wordpress, upgrade
---


# Question
Title: When editing participants, can I avoid having all questions from all current events displayed?
My site frequently has multiple CiviEvent-based registrations running. It is common for some questions to overlap (First Name, Last Name, Company) and for some questions to be unique to each registration (Do you want to attend session X?). As well, some of the unique questions require an answer.

When I go to edit a participant's details via "Find Participant" or "Advanced Search" I am presented with all of the currently enabled fields for all of the current registrations and the system compels me to answer all of the required fields from all of them.

Some of my events use Profiles that contain custom fields from more than one record type (Contact, Individual, Participant). This seems to be an impediment to using that Profile as an option when using the "Batch Update Participants Via Profile" action.

Is there a way for me to view and edit just the questions/responses in the fields related to one of my events?

# Answer
You should be able to limit the custom participant data to a specific event or event type and then it shouldn't show up in the back end for events you didn't mean it to.

This is done on the custom data itself (under "used for") rather than in the profile. Also to note, you usually only want to 'require' data inside the profile not inside the custom data set.
> 1 votes

---
Tags: civievent, 4.4
---


title: Hide "Add Relationship" Button

text:
# Question
Title: Hide "Add Relationship" Button
I would like to remove the "Add Relationship" button from the Relationship tab. I've been auditing some of the data and noticed that my users have been adding and removing relationships from this page. This caused a couple of data issues because the relationships are not connected to the cases. Then relationships were duplicating.

Anyway, I tried removing the "Add Relationships" button via css. The actions-link css, however, affects other pages.

# Answer
> 2 votes
Not sure what CMS you're using - it would be nice if you could permission this but I can't in WordPress so I see the need you have.

Just add the parent selector as well:

.contact-summary-relationship-tab .action-link (the parent id an ID not a class but when I place the pound sign it thinks it's formatting)

Keep in mind, there is still an option in the actions menu as well that you'll want to hide.

---
Tags: relationships
---


# Question
Title: Error creating Custom Data - DB Error: already exists
When I try to create Custom Data ( Administer--\>Customize Data and Screens--\>Custom Fields ), I get the following message. The query info is different depending on the type of Custom Data I am trying to create. The basic message is always the same. In #11-#13, it almost looks like it is trying to insert into the table 3 times or 3 different ways. Of course demo.civicrm.org works nicely.

backTrace

```
#0 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(187): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/administrator/components/com_civicrm/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/administrator/components/com_civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: already exists", -5, 16, (Array:2), "INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multipl...")
#4 /var/www/administrator/components/com_civicrm/civicrm/packages/PEAR.php(575): DB    _Error->__construct(-5, 16, (Array:2), "INSERT INTO civicrm_custom_group (    table_name ) VALUES ('civicrm_value_multipl...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -5, NULL, NULL, "INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multipl...", "DB_Error", TRUE)
#6 /var/www/administrator/components/com_civicrm/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multipl...", "DB_Error", TRUE)
#9 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-5, NULL, NULL, NULL, "1062 ** Duplicate entry     '0' for key 'PRIMARY'")
#10 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multipl...")
#12 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2438): DB_common->query("INSERT INTO civicrm_custom_group (table_name )     VALUES ('civicrm_value_multipl...")
#13 /var/www/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multipl...")
#14 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(482): DB_DataObject->insert()
#15 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(1112): CRM_Core_DAO->save()
#16 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/CustomGroup.php(195): CRM_Core_    DAO::setFieldValue("CRM_Core_DAO_CustomGroup", 0,     "table_name", "civicrm_value_multiples_of_12_12_0")
#17 /var/www/administrator/components/com_civicrm/civicrm/CRM/Custom/Form/Group.php(455): CRM_Core_BAO_CustomGroup::create((Array:16))
#18 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(431): CRM_Custom_Form_Group->postProcess()
#19 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
#20 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Custom_Form_Group), "next", "Next")
#21 /var/www/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Custom_Form_Group), "next")
#22 /var/www/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Custom_Form_Group), "next")
#23 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
#24 /var/www/administrator/components/com_civicrm/civicrm/CRM/Custom/Page/Group.php(172): CRM_Core_Controller->run()
#25 /var/www/administrator/components/com_civicrm/civicrm/CRM/Custom/Page/Group.php(139): CRM_Custom_Page_Group->edit(NULL, 1)
#26 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Custom_Page_Group->run((Array:4), NULL)
#27 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
#28 /var/www/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:4))
#29 /var/www/administrator/components/com_civicrm/civicrm.php(121): CRM_Core_Invoke::invoke((Array:4))
#30 /var/www/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
#31 /var/www/libraries/cms/component/helper.php(405): require_once("/var/www/administrator/components/com_civicrm/civicrm.php")
#32 /var/www/libraries/cms/component/helper.php(380): JComponentHelper::executeComponent("/var/www/administrator/components/com_civicrm/civicrm.php")
#33 /var/www/libraries/cms/application/administrator.php(98): JComponentHelper::renderComponent("com_civicrm")
#34 /var/www/libraries/cms/application/administrator.php(152): JApplicationAdministrator->dispatch()
#35 /var/www/libraries/cms/application/cms.php(257): JApplicationAdministrator->doExecute()
#36 /var/www/administrator/index.php(51): JApplicationCms->execute()
#37 {main}
 Sorry but we are not able to provide this at the moment.
DB Error: already exists
Error Details
Database Error Code: Duplicate entry '0' for key 'PRIMARY', 1062
Additional Details:
Array
(
   [callback] => Array
       (
           [0] => CRM_Core_Error
           [1] => handle
       )

   [code] => -5
   [message] => DB Error: already exists
   [mode] => 16
   [debug_info] => INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multiples_of_12_12_0' )  [nativecode=1062 ** Duplicate entry '0'     for key 'PRIMARY']
   [type] => DB_Error
   [user_info] => INSERT INTO civicrm_custom_group (table_name ) VALUES ('civicrm_value_multiples_of_12_12_0' )  [nativecode=1062 ** Duplicate entry '0' f    or     key 'PRIMARY']
   [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO     civicrm_custom    _group (table_name ) VALUES ('civicrm_value_multiples_of_12_12_0' )  [nativecode=1062 ** Duplicate entry '0' for key 'PRIMARY']"]
)

```

# Answer
Try creating the custom data fieldset with a completely different name. In the code, the fieldset name you provide gets converted into a 'safe' table name for the fieldset, and it's telling you that the table already exists.

For example, if you already have a custom data fieldset called 'Multiples of 12 12 0', then creating a new one with the name 'multiples of 12-12-0' will fail with your error above.

You can create the fieldset with any name that won't collide and then rename it afterwards.

At a guess, you might be misusing custom fieldsets if you've got more than one with similar names.
> 1 votes

# Answer
After many days of research, I piece together that there was something wrong with the AUTO\_INCREMENT setup of the civicrm\_custom\_group table. I did a SHOW CREATE TABLE civicrm\_custom\_group. Below is the messed up setup.

```
CREATE TABLE `civicrm_custom_group`
(
                      `id`                          INT(10) UNSIGNED NOT NULL comment 'Unique Custom Group ID',
                      `name`                        VARCHAR(64) collate utf8_unicode_ci DEFAULT NULL comment 'Variable name/programmatic handle for this group.',
                      `title`                       VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL comment 'Friendly Name.',
                      `extends`                     VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT 'Contact' comment 'Type of object this group extends (can add other options later e.g. contact_address, etc.).',
                      `extends_entity_column_id`    INT(10) UNSIGNED DEFAULT NULL comment 'FK to civicrm_option_value.id (for option group custom_data_type.)',
                      `extends_entity_column_value` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL comment 'linking custom group for dynamic object.',
                      `style`                       VARCHAR(15) COLLATE utf8_unicode_ci DEFAULT NULL comment 'Visual relationship between this form and its parent.',
                      `collapse_display`            INT(10) UNSIGNED DEFAULT '0' comment 'Will this group be in collapsed or expanded mode on initial display ?',
                      `help_pre` text COLLATE utf8_unicode_ci comment 'Description and/or help text to display before fields in form.',
                      `help_post` text COLLATE utf8_unicode_ci comment 'Description and/or help text to display after fields in form.',
                      `weight`               INT(11) NOT NULL DEFAULT '1' comment 'Controls display order when multiple extended property groups are setup for the same class.',
                      `is_active`            TINYINT(4) DEFAULT NULL comment 'Is this property active?',
                      `table_name`           VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL comment 'Name of the table that holds the values for this group.',
                      `is_multiple`          TINYINT(4) DEFAULT NULL comment 'Does this group hold multiple values?',
                      `min_multiple`         INT(10) UNSIGNED DEFAULT NULL comment 'minimum number of multiple records (typically 0?)',
                      `max_multiple`         INT(10) UNSIGNED DEFAULT NULL comment 'maximum number of multiple records, if 0 - no max',
                      `collapse_adv_display` INT(10) UNSIGNED DEFAULT '0' comment 'Will this group be in collapsed or expanded mode on advanced search display ?',
                      `created_id`           INT(10) UNSIGNED DEFAULT NULL comment 'FK to civicrm_contact, who created this custom group',
                      `created_date`         datetime DEFAULT NULL comment 'Date and time this custom group was created.',
                      `is_reserved`          TINYINT(4) DEFAULT NULL,
                      `is_public`            TINYINT(1) DEFAULT '1' comment 'Is this property public?',
                      PRIMARY KEY (`id`),
                      UNIQUE KEY `ui_name_extends` (`name`,`extends`),
                      UNIQUE KEY `ui_title_extends` (`title`,`extends`),
                      KEY `fk_civicrm_custom_group_created_id` (`created_id`)
         )
         engine=innodb DEFAULT charset=utf8 COLLATE=utf8_unicode_ci

```

I also did a SHOW CREATE TABLE civicrm\_custom\_group on a local development environment. The result of the good local dev environment is below.

```
CREATE TABLE `civicrm_custom_group` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique Custom Group ID',
`name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Variable name/programmatic handle for this group.',
`title` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Friendly Name.',
`extends` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'Contact' COMMENT
'Type of object this group extends (can add other options later e.g. contact_address, etc.).',
`extends_entity_column_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_option_value.id (for option group custom_data_type.)',
`extends_entity_column_value` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'linking custom group for dynamic object',
`style` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Visual relationship between this form and its parent.',
`collapse_display` int(10) unsigned DEFAULT '0' COMMENT 'Will this group be in collapsed or expanded mode on initial display ?',
`help_pre` text COLLATE utf8_unicode_ci COMMENT 'Description and/or help text to display before fields in form.',
`help_post` text COLLATE utf8_unicode_ci COMMENT 'Description and/or help text to display after fields in form.',
`weight` int(11) NOT NULL DEFAULT '1' COMMENT 'Controls display order when multiple extended property groups are setup for the same class.',
`is_active` tinyint(4) DEFAULT NULL COMMENT 'Is this property active?',
`table_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Name of the table that holds the values for this group.',
`is_multiple` tinyint(4) DEFAULT NULL COMMENT 'Does this group hold multiple values?',
`min_multiple` int(10) unsigned DEFAULT NULL COMMENT 'minimum number of multiple records (typically 0?)',
`max_multiple` int(10) unsigned DEFAULT NULL COMMENT 'maximum number of multiple records, if 0 - no max',
`collapse_adv_display` int(10) unsigned DEFAULT '0' COMMENT 'Will this group be in collapsed or expanded mode on advanced search display ?',
`created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this custom group',
`created_date` datetime DEFAULT NULL COMMENT 'Date and time this custom group was created.',
`is_reserved` tinyint(4) DEFAULT '0' COMMENT 'Is this a reserved Custom Group?',
`is_public` tinyint(4) DEFAULT '1' COMMENT 'Is this property public?',
PRIMARY KEY (`id`),
UNIQUE KEY `UI_title_extends` (`title`,`extends`),
UNIQUE KEY `UI_name_extends` (`name`,`extends`),
KEY `FK_civicrm_custom_group_created_id` (`created_id`),
CONSTRAINT `FK_civicrm_custom_group_created_id` FOREIGN KEY (`created_id`)
REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

```

There are several differences between the two table definitions. The issue I was having was caused by the lack of AUTO\_INCREMENT in the primary key definition. I also suspect I would have had other issues if I had just fixed the auto increment.

To solve the issue, I used the local dev create table statement to create a table called civicrm\_custom\_group\_mod on the production environment. I renamed the bad civicrm\_custom\_group table to civicrm\_custom\_group\_orig. **NOTE: Doing this will cause many pages with forms to display an error and not load even if they do not use custom field sets** I then renamed civicrm\_custom\_group\_mod to civicrm\_custom\_group. Reestablishing civicrm\_custom\_group table fixes the pages with forms not loading issue.

And all of the sudden this issue that has been plaguing the production environment for over 1.5 year, was solved. A better solution would be if, CiviCRM had a database integrity scanner which would be updated after each CiviCRM update. It could then be used anytime to troubleshoot issues.
> 0 votes

---
Tags: custom-fields, database, error, sql
---


# Question
Title: How can I get custom file fields in an activity to display correctly?
I have a Civi implementation that uses a custom activity type in which I have - amongst others - four custom fields of the field type "File".

These custom fields work fine in all but one situation. If I view an activity record of this type the pop-up does not display the fields or the links to the files. If I force the activity view to display in a new browser window/tab then the following warnings get thrown up:

> ```
> Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php).
> Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php).
> Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php).
> Warning: strtolower() expects parameter 1 to be string, array given in CRM_Core_DAO::getFieldValue() (line 1004 of /data/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php).
>
> ```

My guess being that the four repeated PHP warnings relate to the four custom file fields, and give a clue as to why they aren't getting displayed in the activity view pop-up. The current workaround is to edit the activity record, where the four fields and the links to files are displayed.

It would be really good to fix this. Any pointers most welcome. Currently using CiviCRM version 4.6.18 on Drupal 7.

# Answer
It sounds like you're encountering CRM-17791. This bug was discovered and fixed in CiviCRM 4.7. I would recommend upgrading a test copy of your site to 4.7 to see if that resolves the issue. If so, consider upgrading or funding the long-term support team to backport a fix to version 4.6.
> 4 votes

# Answer
Looks like this was fixed here: https://github.com/civicrm/civicrm-core/commit/f3ceb1120bd50a5ac830ba405b3c6f72144480cb#diff-33ffa83cfb2fd90a56c6f258f36062a0
> 0 votes

---
Tags: custom-fields, files
---


# Question
Title: Mailing stopped working after CiviCRM, PHP and Drupal upgrade
Recently I upgraded:

**Drupal** core to **7.57**

**PHP** from 5.6 to **7.0.28-1**

**CiviCRM** from 4.7.27 to **4.7.31**

Since I've done so I can't send mailings. Basically I get the same thing like in the post described here

When I select a group to send the mailing to, it says no recipients. And when I click send the mailing is listed as completed with 0 deliveries.

This is what I get in my php error log

> \[Tue Mar 27 10:02:14.592307 2018\] \[:error\] \[pid 10110\] \[client ip:45513\] PHP Fatal error: Uncaught Error: Call to undefined function module\_invoke\_all() in /var/www/mysite/sites/all/modules/civicrm/CRM/Utils/System/Drupal.php:857\nStack trace:\n#0 /var/www/mysite/sites/all/modules/civicrm/CRM/Utils/System.php(1413): CRM\_Utils\_System\_Drupal-\>onCiviExit()\n#1 /var/www/mysite/sites/all/modules/civicrm/extern/url.php(62): CRM\_Utils\_System::civiExit()\n#2 {main}\n thrown in /var/www/mysite/sites/all/modules/civicrm/CRM/Utils/System/Drupal.php on line 857, referer: https://mysite.org/civicrm/mailing/view?reset=1&id=709

I tried cleaning cache (drupal and civicrm) but it doesn't fix it. Rebuilding the smart groups didn't help either.

**EDIT**

This problem seems to be groups related and not mailing related. CiviCRM log is clean, and single mails work just fine.

**EDIT2**

However when I'm selecting mail recipients if I select recipients from previous mailings it counts them as it should but it doens't for groups (smart or regular).

**EDIT 3**

This seems to be an issue with multilingual installations.

The issue can be replicated by adding another language and then turning on Multiple Languages Support. After this the problem appears and disappears again when Multiple Languages Support is switched off.

4.7.27 was working, not sure whether the problem first appeared with 4.7.28, 4.7.29, 4.7.30 or 4.7.31

I updated this issue on Jira

# Answer
The issue was affecting multilingual installations. If the multilingual support is turned off in the settings everything works.

Applying the fix solves the problem for multilingual installations.

You can see the @monishdeb's fix on github, the fix will be included in the next version.

And here's the patchfile I used

```
131c131
<              ->where('mailing_id = #mailing_id AND entity_table IN ("!groupTableName", "civicrm_mailing")')
---
>              ->where('mailing_id = #mailing_id AND entity_table IN ("civicrm_group", "civicrm_mailing")')
133d132
<              ->param('!groupTableName', CRM_Contact_BAO_Group::getTableName())

```
> 4 votes

# Answer
This seems to be related to upgrading to 4.7.31. Upgrading it to 4.7.30 does not seem to cause this problem.

See these two other questions about the exact same problem with 4.7.31:

CiviMail - 'No recipients': nothing added to table civicrm\_mailing\_recipients

After upgrade to 4.7.31 send mail - recipients - "no recepients"
> 1 votes

---
Tags: drupal, upgrade, php, mailing, civicrm-home
---


# Question
Title: How do I set up recurring donations with Stripe?
Im operating in Drupal 7 with Civi 4.7.30 and the latest Stripe API.

I want to set up recurring donations but it keeps giving me errors. I have it enabled on the Contribution page.

In Stripe they said to set up "Subscriptions" Which I did in the form of recurring donations. This does not enable the recurring to happen.

Advise on how to solve this?

# Answer
> 3 votes
I had a similar issue, not sure if it's the same but I applied this patch to correct:

https://github.com/drastik/com.drastikbydesign.stripe/pull/249/files

---
Tags: civicontribute, payment-processor, recurring-contributions, stripe
---


# Question
Title: Is it possible to enable/disable logging using cv?
Can the command line cv tool be used to enable/disable logging?

# Answer
> 1 votes
Yes, it is possible, but you have to use some bash magic. For disabling it is:

```
echo '{"logging":0}' | cv api Setting.create --in=json

```

(In case you forget, `cv help api` shows an example of the bash trick)

---
Tags: logging, cv
---


# Question
Title: Is it possible to set the list of CiviCRM components from the command line using drush
`drush` and `cv` have both have commands to install extensions. But know I want to create a script that sets the CiviCRM components. Is it possible to do this?

# Answer
> 2 votes
Thanks to passing JSON objects to drush cvapi I found a solution:

```
echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | drush cvapi Setting.create --in=json

```

# Answer
> 2 votes
For those that use `cv` is also possible to use:

```
echo '{"enable_components" :["CiviContribute","CiviMember","CiviMail","CiviReport","CiviEvent"] }' | cv api Setting.create --in=json

```

---
Tags: installation, drush, cli, cv
---


title: Illegal mix of collations

text:
# Question
Title: Illegal mix of collations
Using Joomla 3.8.6, CiviCRM 4.7.31, php 7.0.28, mysql 5.6.39

What should the database collation be for the CiviCRM tables? Mine are all utf8\_general\_ci. None of the tables in the database are utf8\_unicode\_ci, but I'm getting the illegal mix error below. Not sure when it started (may have been after upgrade to 4.7.31), but clicking on "Reports listing" or one of the report collections like "Contribution Reports" generates the following error:

"1267 \** Illegal mix of collations (utf8\_unicode\_ci,IMPLICIT) and (utf8\_general\_ci,IMPLICIT) for operation '='"

The error seems to come from CRM/Report/Page/InstanceList.php. See traceback below.

Edit: I now realise that the whole Report menu is not as it should be. It looks like this:

whereas it should look more like this:

Could this be related to the upgrade issue CRM-12136?

If so, how can I correct the Report menu? Thanks.

```
[debug_info] =>
    SELECT inst.id, inst.title, inst.report_id, inst.description,  inst.owner_id, v.label, v.grouping, v.name as class_name,
    CASE
      WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
      WHEN v.grouping IS NOT NULL THEN v.grouping
      ELSE 'Contact'
      END as compName
      FROM civicrm_option_group g
      LEFT JOIN civicrm_option_value v
             ON v.option_group_id = g.id AND
                g.name  = 'report_template'
      LEFT JOIN civicrm_report_instance inst
             ON v.value = inst.report_id
      LEFT JOIN civicrm_component comp
             ON v.component_id = comp.id

      WHERE v.is_active = 1  AND v.component_id = 2
            AND inst.domain_id = 1
      ORDER BY  v.weight ASC, inst.title ASC [nativecode=1267 ** Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=']
[type] => DB_Error
[user_info] =>
    SELECT inst.id, inst.title, inst.report_id, inst.description,  inst.owner_id, v.label, v.grouping, v.name as class_name,
    CASE
      WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
      WHEN v.grouping IS NOT NULL THEN v.grouping
      ELSE 'Contact'
      END as compName
      FROM civicrm_option_group g
      LEFT JOIN civicrm_option_value v
             ON v.option_group_id = g.id AND
                g.name  = 'report_template'
      LEFT JOIN civicrm_report_instance inst
             ON v.value = inst.report_id
      LEFT JOIN civicrm_component comp
             ON v.component_id = comp.id

      WHERE v.is_active = 1  AND v.component_id = 2
            AND inst.domain_id = 1
      ORDER BY  v.weight ASC, inst.title ASC [nativecode=1267 ** Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=']
[to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="
    SELECT inst.id, inst.title, inst.report_id, inst.description,  inst.owner_id, v.label, v.grouping, v.name as class_name,
    CASE
      WHEN comp.name IS NOT NULL THEN SUBSTRING(comp.name, 5)
      WHEN v.grouping IS NOT NULL THEN v.grouping
      ELSE 'Contact'
      END as compName
      FROM civicrm_option_group g
      LEFT JOIN civicrm_option_value v
             ON v.option_group_id = g.id AND
                g.name  = 'report_template'
      LEFT JOIN civicrm_report_instance inst
             ON v.value = inst.report_id
      LEFT JOIN civicrm_component comp
             ON v.component_id = comp.id

      WHERE v.is_active = 1  AND v.component_id = 2
            AND inst.domain_id = 1
      ORDER BY  v.weight ASC, inst.title ASC [nativecode=1267 ** Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=']"]

```

# Answer
First check the default collation. If it's different it may be causing implicit conversion:

```
show variables like 'collat%';

```

If that's not it then note that individual columns can have their own collation. It seems unlikely to be the problem here given that particular reports query, but check the individual column definitions, e.g.

```
show create table civicrm_report_instance;

```
> 2 votes

---
Tags: civireport, database, reports, menu
---


# Question
Title: CiviCase case closed and remove remaining activities
On CiviCase, if you setup the standard timeline to be:

1. Open Case
2. Phone Call to Confirm Interest (offset, 2 days)
3. Setup Meeting (offset 7 days after phone call)
4. Case Closed

This example here will schedule the phone call and setup meeting on the case. If at the phone call activity, and person is not interested and case is closed, wouldn't the expected behavior be to remove the scheduled meeting out of the timeline? And/or, only show the "setup meeting" activity if the phone call is completed?

# Answer
I'm not sure what you're looking for other than to just confirm the behavior that you're seeing, in which case the answer is "no" and "no". i.e. it does not currently do those things.

Could it work differently? Probably. The history is that when the feature was first added it was left pretty basic because while there were lots of ideas tossed around, the feature itself and nailing down the full set of use-cases wasn't a priority, and it wasn't desired to spend time/money on things where it wasn't clear yet if they'd be used or not.

One way to implement your workflow is to have activities 3 and 4 be configured as part of another timeline/sequence, and then after the staffer does 2, if the person is interested the staffer chooses "Add timeline" and picks the other timeline/sequence.
> 1 votes

---
Tags: civicase
---


# Question
Title: Fix for "Incorrect Resource URL" message
In my Wordpress installation of CiviCRM I have had a persisting System Status:Error message since version 4.7.28 which was still present despite upgrade to 4.7.31. This appeared to be a false-positive as CiviCRM was working well. The Resource URL was correct and I could not get rid of the error until I upgraded PHP from version 5.6 to version 7.0, and the error message disappeared!!

# Answer
The error disappeared after upgrading php to version 7.0
> 1 votes

---
Tags: wordpress, error, php
---


# Question
Title: Incorrect Resource URL warning but menu arrows are present
I'm getting the *Incorrect Resource URL* warning on both an upgrade and a fresh install on WordPress 4.9.1 on an nginx external dev site and on an nginx local site (using Local by Flywheel for the environment).

Nevertheless, the arrows in the menus are present, at least this is what I see:

I'm new to CiviCRM so likely missing something obvious. Any pointers on how to debug this would be appreciated.

# Answer
I'm starting to regret having written this check!

So far, I have found four scenarios that result in this false positive:

* Your php.ini has `allow_url_fopen` set to `false`. This should be corrected, since it will subtly break other parts of CiviCRM (e.g. extension download, update checks).
* Your site is behind a `.htpasswd`, and thus needs HTTP authentication to access files.
* You're using WordPress, which has some much discussed issues regarding its ability to detect the directory its in when there's a symlink. Follow the third link ("issues") for a discussion of how to fix this until the WordPress-Civi wizards resolve this once and for all.
* Your server's firewall is configured to reject HTTP requests to itself. I don't know a way to test for this other than to SSH in and run `netcat`, something like `nc -v <my ip address> 80`. You want a connection that's "open" rather than "refused". Note that using `localhost` instead of the local IP address in that netcat command may yield a different result.
> 4 votes

# Answer
If you have a Security Plugin that filters based on user agent that will block the check and result in a false positive. https://issues.civicrm.org/jira/browse/CRM-21629

If you are using a local site or dev site that isn't connected to a real URL this check will also fail. You can solve this by editting the host file on the machine the site is running on.
> 2 votes

# Answer
Make sure that php is upgraded to version 7.0
> 0 votes

---
Tags: wordpress, resource-urls
---


title: Unable to edit recurring event

text:
# Question
Title: Unable to edit recurring event
When I attempt to save changes to an event that is part of a series (repeating), I am unable to save those changes to a single event, event onward or the entire series. Looking at the logs - I get the following error:

```
[warning] Deprecated function, use CRM_Core_PseudoConstant::getKey
Array
(
    [civi.tag] => deprecated
)

```

# Answer
Sounds like you're hitting CRM-21764. A patch has been submitted upstream; you can apply it now or wait for the Wednesday release, which contains it.
> 5 votes

---
Tags: civievent
---


# Question
Title: How to solve this error database looks to have been partially upgraded in CiviCRM
I Upgraded CiviCRM 4.6 to 4.7 latest version but when I try Import database using drush `$ drush civicrm-upgrade-db` this command that time showing this error. when I going to this path `http://example.org/civicrm/upgrade?reset=1` if anyone knows the solution of this issue please tell me. thank you in advance

# Answer
> 2 votes
You would be able to successfully upgrade following these steps:

1. Empty the civicrm database
2. Restore civicrm database from the backup that you had created before performing upgrade
3. Temporarily remove the paths for custom PHP/template files if you have through: Administer-\>System settings-\>Directories
4. Try upgrading to version 4.7 again
5. Restore the custom files paths if point 3 was applied

Hope this fixes the issue.

# Answer
> 0 votes
I would also suggest jumping on chat.civicrm.org to get support on it - but back up & try again is definitely a good step if you have a backup

---
Tags: civievent, civimail, civicontribute, webform-civicrm, civireport
---


# Question
Title: Localization and Address settings disappeared after domain change
We recently changed a site url. After the URL change and making changes in the settings file there was an issue loading so I cleared the cache and reset the paths.

Everything came back OK except all of the settings in localization, display settings and address settings are gone and fields just have 1 in them. See the screenshot below.

Has anyone seen this? If there is a way to get them back that would be great. Otherwise I can reenter them. They were all on the defaults for the most part.

Running CiviCRM 4.7.27 with WordPress 4.9.4

# Answer
> 0 votes
I haven't seen it - it seems odd because the defaults are correctly defined here https://github.com/civicrm/civicrm-core/blob/master/settings/Core.setting.php#L124

---
Tags: wordpress, 4.7, settings
---


# Question
Title: What is the GuzzleHttp\Psr7\Uri class, and is its absence in Windows the death knell to CiviCRM under IIS?
I switched a development environment running under Joomla and IIS to the CiviCRM:master branch. It now fails with

0 Class 'GuzzleHttp\Psr7\Uri' not found

Is this a Linux-specific class? If not, where do you find it? CiviCRM 4.7.x did not need it.

# Answer
> 1 votes
.

1. cd to PHP install directory.
2. composer require GuzzleHttp/psr7
3. Add this to CiviCRM.settings.php: require\_once $\_SERVER\["PHPRC"\]. '/vendor/autoload.php';

# Answer
> 1 votes
@stehpen what you could also do there is cd to the civicrm dir and run `composer install` That will ensure that everything the .lock file requires is installed and it will also update the composer autoloader for civicrm.

# Answer
> 0 votes
1. Guzzle is a client library for making HTTP requests. As with many PHP libraries required by Civi, it's declared in `composer.json`.
2. When setting up an installation via `git`, one's process must install all current dependencies. Whenever I change to a different version, I usually do this with `./bin/setup.sh -D` (or something even higher level, like `./bin/setup.sh` or `civibuild reinstall`), but I don't know if those work under Joomla. The main things to look out for:

* Install PHP dependencies with composer (i.e. `composer install`)
    * Install JS/CSS dependencies with bower (i.e. `bower install`)
3. If you want to install the `master` branch on Joomla -- without digging into the build system -- consider grabbing an autobuild file from https://download.civicrm.org/latest

---
Tags: mailing, core
---