# Question
Title: CiviCRM - syntax error - memberships not being saved - random error
## **UPDATE...**

*this issue was inititally posted due to being unable to manually add memberships to a couple of organisation contacts that had been on the system for some years with previous memberships that had been added no problem. It seems there is also an issue with adding to individuals*

---

Currently using Civi 5.5.1 on a Drupal 7.59 and php 7.1

I have an issue when adding memberships with debugging giving a Syntax error. This issue appears to be random and occurs both when adding a membership against a contact record both manually and through a bulk import.

**To explain the randomness.**

Yesterday (6th December 2018) we imported 2 groups of members from two seperate .csv files through using the contact import routine. Group 1 (24 contacts) and group 2 (28 contacts).

**Group 1**...we then imported a membership type (through .csv import) called MILO (which points to an organisation contact named MILO) with a start date of 1st December 2018. No problem.

**Group 2 - FAILED**...we then tried to import membership type (through .csv import) called GCSS (pointing to an organisation called GCSS) to group 2 with a start date 1st December 2018. Despite civi confirming the import was successful nothing shows on the individual contact record.

I then tried to add a GCSS membership manually (start date 1st December) to an individual in Group 2 - failed. Also failed with trying to add the MILO membership type.

If however I set the membership start date to after the contact created date (which is 6th January) then I can both manually and bulk add any membership.

**Checking data** \- (civi and phpmyadmin)

* I looked at the contact records for both data import groups and can't see any discernable difference.
* Both 'membership types' look the same and bot have a relationship 'paid for by' assigned to them.
* Both 'organisation'contact records don't seem to have any difference
* I thought it might be related to tags added on contact import but having removed the tag nothing changes.
* Following Pete's advice (thanks Pete) I have added the contacts to the civi demo site and then bulk added a membership with a start date 1st December with no problem.

**Conclusion and help** This is really quite weird it appears that I can add (post date) memberships to some contacts but not others. I thought this was perhaps due to a corrupt individual contact import but the initial issue I posted here was after being unable to add a membership against a couple of organisation contact records. Plus using the same .csv file things work fine on the civi demo site.

If anyone has any idea what has gone wrong here any advice most appreciated

---

**Error message below**

```
*backTrace
#0 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(190): CRM_Core_Error::backtrace()
#1 /home/ehfa/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: syntax error", -2, 16, (Array:2), "\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#3 /home/ehfa/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-2, 16, (Array:2), "\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#4 /home/ehfa/www/www/sites/all/modules/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -2, 16, (Array:2), "\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...", "DB_Error", TRUE)
#5 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/common.php(1907): PEAR->__call("raiseError", (Array:7))
#6 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-2, NULL, NULL, "\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...", "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#9 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2415): DB_common->query("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#10 /home/ehfa/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1607): DB_DataObject->_query("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#11 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(438): DB_DataObject->query("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#12 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(1411): CRM_Core_DAO->query("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...", TRUE)
#13 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Member/Form/MembershipView.php(283): CRM_Core_DAO::executeQuery("\nSELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,\n...")
#14 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(585): CRM_Member_Form_MembershipView->preProcess()
#15 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
#16 /home/ehfa/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Member_Form_MembershipView), "display")
#17 /home/ehfa/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Member_Form_MembershipView), "display")
#18 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
#19 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Member/Page/Tab.php(253): CRM_Core_Controller->run()
#20 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Member/Page/Tab.php(370): CRM_Member_Page_Tab->view()
#21 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(309): CRM_Member_Page_Tab->run((Array:4), NULL)
#22 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:14))
#23 /home/ehfa/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#24 /home/ehfa/www/www/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:4))
#25 /home/ehfa/www/www/includes/menu.inc(527): civicrm_invoke("contact", "view", "membership")
#26 /home/ehfa/www/www/index.php(21): menu_execute_active_handler()
#27 {main}
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
DB Error: syntax error
Error Details
Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.contact_id = r.contact_id_a AND m.is_test = 0) LEFT JOIN civicrm_members' at line 8, 1064
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )
    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] =>
SELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,
       rt.name_a_b as relation, r.start_date, r.end_date,
       m.id as mid, ms.is_current_member, ms.label as status
  FROM civicrm_relationship r
  LEFT JOIN civicrm_relationship_type rt ON rt.id = r.relationship_type_id
  LEFT JOIN civicrm_contact c ON c.id = r.contact_id_a
  LEFT JOIN civicrm_membership m ON (m.owner_membership_id =
  AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_membership_status ms ON ms.id = m.status_id
 WHERE r.contact_id_b =  AND r.is_active = 1  AND c.is_deleted = 0 AND r.relationship_type_id IN (16) ORDER BY is_current_member DESC [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_members' at line 8]
    [type] => DB_Error
    [user_info] =>
SELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,
       rt.name_a_b as relation, r.start_date, r.end_date,
       m.id as mid, ms.is_current_member, ms.label as status
  FROM civicrm_relationship r
  LEFT JOIN civicrm_relationship_type rt ON rt.id = r.relationship_type_id
  LEFT JOIN civicrm_contact c ON c.id = r.contact_id_a
  LEFT JOIN civicrm_membership m ON (m.owner_membership_id =
  AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_membership_status ms ON ms.id = m.status_id
 WHERE r.contact_id_b =  AND r.is_active = 1  AND c.is_deleted = 0 AND r.relationship_type_id IN (16) ORDER BY is_current_member DESC [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_members' at line 8]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="
SELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,
       rt.name_a_b as relation, r.start_date, r.end_date,
       m.id as mid, ms.is_current_member, ms.label as status
  FROM civicrm_relationship r
  LEFT JOIN civicrm_relationship_type rt ON rt.id = r.relationship_type_id
  LEFT JOIN civicrm_contact c ON c.id = r.contact_id_a
  LEFT JOIN civicrm_membership m ON (m.owner_membership_id =
  AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_membership_status ms ON ms.id = m.status_id
 WHERE r.contact_id_b =  AND r.is_active = 1  AND c.is_deleted = 0 AND r.relationship_type_id IN (16) ORDER BY is_current_member DESC [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.contact_id = r.contact_id_a AND m.is_test = 0)
  LEFT JOIN civicrm_members' at line 8]"]
)
Return to home page.*

```

# Answer
The issue here seems to be that the `owner_membership_id` of the relationship is blank. The `owner_membership_id` is for "inherited" relationships, and store the id number of the membership being inherited from.

To troubleshoot this, check for problems in your membership type configurations for those memberships that have inherited memberships, and the relationships that define the inherited memberships.
> 1 votes

---
Tags: civicontribute, civimember
---


title: Migrating to WPEngine

text:
# Question
Title: Migrating to WPEngine
I'm working on migrating our Wordpress site to WPEngine, and I don't know how to get the civi database onto WPEngine. WPEngine doesn't allow the creation of a new database for civi. Has anyone done this before? I have found other topics regarding WPEingine here, but for now I just want to get the database onto WPEngine.

# Answer
> 1 votes
I have only used CiviCRM at WPE on test sites.

You will have to share the same DB as WP.

You need to prepare teh backup for restore offline. That said, I mean that if backed up from another server, the DEFINER (used in Triggers and Routines) have to be stripped out, and the database should be compressed. You'll need to restore via phpmyadmin from my.wpengine.com

A word of warning, WP Engine reserves the right to change the database user. When they do this they will update wp-config.php, but not civicrm.settings.php. This has not happened to me on CiviCRM (keep in mind I only use WPE for testing on CiviCRM) , but it has happened on WP sites I have supported at WPE.

---
Tags: wordpress, migration
---


# Question
Title: CiviEvent Confirmation Emails: Cutting off content
We've recently started using CiviCRM and CiviEvent but have found that the confirmation PDFs attached to confirmation emails are cutting off text and not appearing properly.

This is what they look like when I download the confirmation PDF that CiviEvent automatically generates.

Can anyone please advise how we can fix this?

Cheers

# Answer
> 1 votes
Josh - By the look of the invoice, it seems the width isn't adjusted correctly in your pdf file. Civi normally assigns width statically to the table added in the message templates. So my first attempt would be to either remove the width attribute from the `<table>` element and test the pdf receipts OR modify the width in the table tag to some other value and see if the issue gets fixed.

Eg. the event online receipt template seems to be adding the table as -

```
<table width="700" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">

```

Check by removing the `width` attribute from the above line and see if the pdf content is correctly adjusted in the document.

Note that the width you change in the table element also reflects in the email received to the users. So better to first check this in a dev environment.

# Answer
> 1 votes
I've often found good luck by switching to `wkhtmltopdf`. It's written in a coding language that makes it tough to distribute directly with CiviCRM, but takes a few minutes for someone who knows what they're doing to install. Someone posted wkhtmltopdf instructions here.

---
Tags: civievent, email, pdf, confirmation
---


# Question
Title: Access permission for Print Merge Documents
I have CiviCRM installed on Wordpress. I am trying to limit the Print/Merge Document function shown in the below image, to only certain Wordpress roles. Is there such a setting in CiviCRM for this? If not, how else can we achieve this?

# Answer
Also, if you are willing to develop an extension, you need to check https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_summaryActions/ hook to add permission to the "Print/Merge Document" action link.

Something like -

```
function mymodulename_civicrm_summaryActions(&$actions, $contactID) {
  $actions[print_pdf_key_name]['permissions'] = array(...); //your list of permission
}

```

If you need to create a new permission for this task - you need to check https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_permission/ hook as well.

Hope that helps.
> 2 votes

# Answer
As far as I know there is no specific Permission as you have probably already confirmed, therefore this would require a custom extension. If you have the development skills in-house then you may get the required support via https://chat.civicrm.org/civicrm/channels/dev-newcomers \- otherwise you might need to check out a professional development team eg https://civicrm.org/partners-contributors

but you are likely to get some more specific advice on here too if you can be patient.
> 1 votes

---
Tags: wordpress, permissions, printing
---


# Question
Title: How to display Individual Custom Fields in a Participants View
I want to create a View :

* which displays some Individuals Custom Data (e.g. Passport information)
* where Individuals are filtered according to their Participation to an Event (id=20)

I imagine 3 different ways to do that but none of them is working :

1. Create a Contact oriented View and filter via some civicrm\_participant fields but the civicrm\_participant table (and fields) is not accessible for filtering :
2. Create a Participant oriented View ans add some Individual Custom Fields : but in this case, the custom fields are not populated though I was able to add them :
3. Create a Smart Group based upon the Participants, and then filter the Contact View on this Smart Group, but Views does not seem to consider Smart Groups, but only Static groups

Of course, I checked that my custom field tables are included in settings

Clearing the caches has no effect

How can I solve my problem ? (civicrm 5.6.0 / Drupal 7.60)

# Answer
You should be able to achieve what is required by creating a CiviCRM Participants view and using the CiviCRM Participants: Participant's Contact ID as a relationship to bring in contact custom data –

Or import the belew view (I've removed custom data so this needs to be added yourself) -

$view = new view(); $view-\>name = 'individual\_and\_participant\_view'; $view-\>description = ''; $view-\>tag = 'default'; $view-\>base\_table = 'civicrm\_participant'; $view-\>human\_name = 'Individual and participant view'; $view-\>core = 7; $view-\>api\_version = '3.0'; $view-\>disabled = FALSE; /\* Edit this to true to make a default view disabled initially \*/

/\* Display: Master */ $handler = $view-\>new\_display('default', 'Master', 'default'); $handler-\>display-\>display\_options\['title'\] = 'Individual and participant view'; $handler-\>display-\>display\_options\['use\_more\_always'\] = FALSE; $handler-\>display-\>display\_options\['access'\]\['type'\] = 'none'; $handler-\>display-\>display\_options\['cache'\]\['type'\] = 'none'; $handler-\>display-\>display\_options\['query'\]\['type'\] = 'views\_query'; $handler-\>display-\>display\_options\['exposed\_form'\]\['type'\] = 'basic'; $handler-\>display-\>display\_options\['pager'\]\['type'\] = 'full'; $handler-\>display-\>display\_options\['pager'\]\['options'\]\['items\_per\_page'\] = '100'; $handler-\>display-\>display\_options\['pager'\]\['options'\]\['offset'\] = '0'; $handler-\>display-\>display\_options\['pager'\]\['options'\]\['id'\] = '0'; $handler-\>display-\>display\_options\['pager'\]\['options'\]\['quantity'\] = '9'; $handler-\>display-\>display\_options\['style\_plugin'\] = 'table'; $handler-\>display-\>display\_options\['style\_options'\]\['columns'\] = array( 'id' =\> 'id', 'display\_name' =\> 'display\_name', ); $handler-\>display-\>display\_options\['style\_options'\]\['default'\] = '-1'; $handler-\>display-\>display\_options\['style\_options'\]\['info'\] = array( 'id' =\> array( 'sortable' =\> 0, 'default\_sort\_order' =\> 'asc', 'align' =\> '', 'separator' =\> '', 'empty\_column' =\> 0, ), 'display\_name' =\> array( 'sortable' =\> 0, 'default\_sort\_order' =\> 'asc', 'align' =\> '', 'separator' =\> '', 'empty\_column' =\> 0, ), ); /* Relationship: CiviCRM Participants: Participant's Contact ID */ $handler-\>display-\>display\_options\['relationships'\]\['contact\_id\_1'\]\['id'\] = 'contact\_id\_1'; $handler-\>display-\>display\_options\['relationships'\]\['contact\_id\_1'\]\['table'\] = 'civicrm\_participant'; $handler-\>display-\>display\_options\['relationships'\]\['contact\_id\_1'\]\['field'\] = 'contact\_id'; /* Field: CiviCRM Events: Title */ $handler-\>display-\>display\_options\['fields'\]\['title'\]\['id'\] = 'title'; $handler-\>display-\>display\_options\['fields'\]\['title'\]\['table'\] = 'civicrm\_event'; $handler-\>display-\>display\_options\['fields'\]\['title'\]\['field'\] = 'title'; /* Field: CiviCRM Contacts: Display Name \*/ $handler-\>display-\>display\_options\['fields'\]\['display\_name'\]\['id'\] = 'display\_name'; $handler-\>display-\>display\_options\['fields'\]\['display\_name'\]\['table'\] = 'civicrm\_contact'; $handler-\>display-\>display\_options\['fields'\]\['display\_name'\]\['field'\] = 'display\_name'; $handler-\>display-\>display\_options\['fields'\]\['display\_name'\]\['link\_to\_civicrm\_contact'\] = 0;

/\* Display: Page \*/ $handler = $view-\>new\_display('page', 'Page', 'page'); $handler-\>display-\>display\_options\['path'\] = 'individual-and-participant-view';
> 3 votes

# Answer
We have managed to solve a similar scenario with the help of Views Field View extension. It's a bit laborious but you can define a (secundary) 'contact view' with the desired fields and then a (primary) 'participant view' with desired participant fields and the 'contact view' as a view field. You need to add a contextual filter on the participant view with the contact ID.
> 3 votes

---
Tags: drupal-views
---


title: Adding new grouping to a report

text:
# Question
Title: Adding new grouping to a report
I'd like to add a new grouping option to an existing report.

Is it possible to group by the payment instrument in the Contribution Summary Report? The option Payment Instrument is not showing up on the Grouping tab.

Is there any tutorial or explanation to do this? Or am I on an absolutely wrong way?

Thanks!

# Answer
There is no way to do this in the User Interface, you would have to develop a little extension that customizes the Contribution Summary Report by adding the Payment Instrument as an additional grouping. You can find some guidelines here: https://docs.civicrm.org/dev/en/latest/framework/civireport/

Or log a request at Gitlab for an improvement to the core report. You can do that here: https://lab.civicrm.org/dev/core/issues
> 1 votes

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


title: Are General Deduping rules working?

text:
# Question
Title: Are General Deduping rules working?
I am having a problem with custom general rules for deduping. Very inconsistent results that cause me to suspect that there may be significant issues. One strange observation is that at times a general clearing of caches makes a difference. But even that is not consistent and problematic if a rule is being used by a webform, for example.

Are users have success with general rules? Failures? My test case is using First Name, Last Name and birth date. Is this a case where a general rewrite is needed and perhaps a Make It Happen campaign?

Any insights would be appreciated.

# Answer
> 1 votes
I just used a general rule for org contact type import yesterday and it worked.

Import Contacts creating dupes despite dedupe rules

# Answer
> 1 votes
I have at least one customer that uses dedupe rules regularly in their processes and they work. They have different general rules like:

* Last name AND first name AND birth date
* Last name AND first name AND postal code
* E-mail OR (First Name AND Last Name AND Birth Date)

Mind you, they do this deduping in the backend, so in CiviCRM. Their CiviCRM is on a different server than their public website.

---
Tags: duplicate-contacts
---


title: Accessing a user's search history

text:
# Question
Title: Accessing a user's search history
It seems as though one of the members of my organization has used their access to our contact information in a way that they shouldn't have. I've been tasked with proving that they searched for, and accessed the email addresses of contacts and then copied or exported this information.

Is it possible to find a record of "who searched what" in drupal CiviCRM? I am open to either using the interface or mysql backend directly.

# Answer
> 6 votes
CiviCRM does not store information of who accessed what, for better and worse.

If you have the advanced logging turned on, you can see changes users made. The CMS may have a record of when they last accessed the site, if that's helpful. There's also an extension that adds a permission to restrict exports. While any of those might be helpful, none are what you're looking for, because it doesn't exist - sorry!

# Answer
> 4 votes
While there isn't a way to do it using native Civicrm - you might be able to get close using webserver logs - depends on how your server is set up and if they are still available for the time period concerned, and if the person was accessing the site from a location that no other users were, or will be identifiable by their user agent in combination with IP address. If they are using the same browser as everyone else and have done this on site then this solution isn't going to work.

Assuming your webserver logs ip address and uri (including parameters), and that the person accessing it is going to be identifiable via a unique IP address, or user agent or combination.

If it is recent you could use check the drupal watchdog table to look for ip addresses associated with the user. Then depending on what information is in your webserver you could use that to identify which requests have been made by that user.

If your webserver logs contain the full uri - including url parameters - then you should be able to filter down on pages at /civicrm/ (Assumming there is no ability to view/export contacts via drupal views). Specific types of pages in civi have the same base uri - with different parameters for different records. Run the steps you are looking for then look in the log to identify what shows.

---
Tags: search
---


title: Set memberships with no end date?

text:
# Question
Title: Set memberships with no end date?
It would be convenient for us to have open-ended memberships. For example, our board members are permanent members of the organization (this is different from lifetime memberships). I'd like to have their membership record maintain a start date but drop the end date. Is there an easy way to make that happen?

# Answer
You can create an additional membership type for Board members that is separate from your "normal" life membership. On the page where you create the membership type, you'll set the duration unit to be 1 lifetime. I'd suggest giving the membership a name such as "Board Member" to help distinguish them from your regular lifetime membership.

That gives you an open-ended membership. Here's a screenshot to show you what I mean:
> 2 votes

---
Tags: civimember
---


# Question
Title: Allow Website URL field without "http://" string
Is there a way to allow a user to input urls into the website field of a contact without adding `http://` or `https://` to the string?

I can't find a way to change settings for this field.

A number of my users want to manually enter web addresses or sub-domains and they get rejected by the validation.

Alternatively, is there some pre-process hook or extension that can handle insert the correct protocal as needed?

# Answer
> 1 votes
Unfortunately, there is no setting for this. You would indeed need to create an extension that pre-fills the field in teh way you need it. If you have not done so yet, you may have a look at the CiviCRM Developer Guide and/or get in contact with other developers: https://chat.civicrm.org/civicrm/channels/dev-newcomers

---
Tags: urls, user-experience, user-interface
---


# Question
Title: Event contribution summarized by price set
We use price sets for all of our events, and make extensive use of the price set header to display a "call to action" asking people to give generously/consciously/etc. We have a variety of wording for these, and we would like to do some A/B testing and measure results.

What I would like to do is use database queries or the Pivot Report extension or even Google Data Studio to create a view showing how effective a particular price set is. (The price set is a proxy for the call to action.)

I'm having a hard time getting contribution amount per event or per price set.

* I can get total contributions, but I don't seem to have a way to link contributions to individual events.
* I can't figure out how to get the price set from event data.

Can anyone help me figure out what fields I need to link together in order to be able to get something like "sum of contributions for events by event price set"?

Thank you

Edit: A few more details on our use case:

* All of our events are by donation.
* We use the header portion (pre-help text) of price sets to provide a call to action, encouraging the user to make a donation or to make a larger donation.
* We have a variety of call to action text samples, and we are developing more.
* What we are looking to analyze is how effective our different call to action text samples. Which ones drive donations up? Which ones are less effective? Which ones turn people off?

Definitely open to learning about other ways to manage and measure this rather than using price set help text.

# Answer
> 1 votes
There’s a custom search available in CiviCRM called Price Set Details for Event Participants which may be of use for your enquiry.

Search \> Custom Searches \> Price Set Details for Event Participants

/civicrm/contact/search/custom?csid=9&reset=1

This search allows you to filter on an event and also gives you an option to export your results.

---
Tags: civievent, contributions, reports
---


# Question
Title: CiviEvent: how to collect different custom data for different event participant roles?
My requirement: collect different custom data for different participant roles registering for the same event.

I know this would be simple with Drupal/Webforms but I'm on Joomla -- and this seems to be very difficult without the Webform integration!

This extension (Event Registration Based on Participant Roles) works great to provide the participant role I want to use to my registration form. However, I can't figure out how to switch to a different custom profile in the registration form based on the participant role.

I've tried using the buildForm hook to add in the specific custom fields I need based on the current participant role, but it seems that buildForm hook does not allow me to REMOVE custom fields that I DON'T want to appear on the form for specific roles. I can only add fields to the array of fields that are already included from the profile selected on the "Online Registration" configuration.

I thought about just using Jquery to hide the fields I don't need from whichever role is currently selected, but that causes validation problems -- and I don't want to have to rewrite validation rules for every participant role context!

I just can't believe this is this difficult, and think I must be missing something obvious. Or do I really need to hand-code a new, completely standalone registration form for each participant role?

Thanks in advance for your suggestions :-)

# Answer
if you setup your custom fields in profiles only for the roles that are needed then does it not automatically only display those fields that are relevant? p.s. we wrote and maintain the extension that your referring to!
> 2 votes

---
Tags: civievent, joomla, registration, online-registration
---


title: Error trying to change language

text:
# Question
Title: Error trying to change language
When I try to enter the localization management section, I encounter such an error.

Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. DB Error: insufficient permissions.

We use the newest version of joomla and Civicrm that i downloaded on the offical sites.

Tell me how to solve this problem?

# Answer
> 2 votes
I would check your MySQL permissions - my guess is that you lack the `CREATE VIEW` permission, which is necessary for multilingual installs. Here is a full list of MySQL permissions needed.

If you go to CiviCRM's **Administer menu » System Settings » Debugging and Error Handling**, you can turn on Debugging and Backtrace, which will give you a longer error message detailing exactly which permission is missing. If my answer doesn't fix your problem, please do so, then edit your question to include the additional info.

---
Tags: joomla, error, language
---


# Question
Title: Can multiple mailings have deduplicated email addresses, so each address will not receive multiple emails?
We'd like to send a mailing in a few slightly different versions to different groups. What we'd like to avoid is having two contacts, who share the same email address and are in different groups, receive two different versions of the email.

Deduping happens before a specific mailing is sent and I can exclude previous contacts who were recipients of the first mailing from the next mailing, but what I am trying to do is exclude previously emailed **addresses** from the next mailing, not just previously emailed contacts.

Is there any way to either exclude previously emailed addresses directly or to search for contacts who share a primary email with contacts in a previous mailing or group?

# Answer
> 1 votes
Hopefully someone else comes by with a simple strategy - here is an off the cuff idea.

a/ you know the emails you sent to b/ if you import emails then you can add them to a Group c/ i don't know if when you import an email that is used by several folk they all get updated, it may only update the lowest cid d/ if the import does do what you want then you can probably figure that path from there

---
Tags: civimail, email, duplicate-contacts
---


# Question
Title: View records by date added - not activity date/date received
Adding a bunch of contribution records with a variety of dates manually - I would like to see all the records I added today - what would be an easy way to do that? Last modified would be fine too.

# Answer
Since i found the answer - I might as well answer it.

Turn on Detailed Logging at Adminisiter - System Settings - Misc

When thats done - go to reports, contact logging report (now available when logging is turned on) and view results - you can filter for contributions, who entered the contibution (altered by), and other options. Customize to your liking and save as a copy so you can easily access the customized report.

After time - this report can get pretty resource heavy - but it may be worth it to you - like it is for me. Note: this will not work for past activities - only activities since detailed logging was turned on.
> 3 votes

---
Tags: civicontribute
---


title: Error when adding a contribution:

text:
# Question
Title: Error when adding a contribution:
When manually adding a contribution - I get the following error:

`Warning: A non-numeric value encountered in CRM_Contribute_BAO_Contribution::calculateMissingAmountParams() (line 383 of /home/sitename/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php).`

Line 383 is: `$params['net_amount'] = $params['total_amount'] - $params['fee_amount'];`

The contribution is processed without issue - but that error persists. When I add fee amount as 0 - the error does not display. Do we always have to provide a fee amount for manual contribution entries?

# Answer
It’s a warning (not an error) - so it should let you save the Contribution but nevertheless it should be logged as an issue.

On a production site you will always want display Errors/Warnings -\> to none;

In Drupal 7 the setting for that lives: /admin/config/development/logging
> 1 votes

---
Tags: civicontribute, contributions
---


title: Cannot see installed extension

text:
# Question
Title: Cannot see installed extension
Hello I using drupal 7 and civicrm 5.6.1

I am trying to use Postcode Lookup for Webform https://github.com/compucorp/webform\_civicrm\_postcode/blob/master/README.md

But I cannot see the extension after uploading it to the directory and refreshing

I have done the following.

1) Checked the directory it is installed in sites/default/files/civicrm/custom\_ext/ and checked the settings upload directory path (custom\_ext) and resource url (sites/default/files/civicrm/custom\_ext)

2) Cleared the civicrm cache and the drupal cache and pressed refresh (many times)

3) Viewed the extension page via view source to see if it isn't rendering on the page

4) Read the read me to see if there is anything different that I have to do

5) Checked the file permisions - it is the same as the other extensions in the folder.

Any ideas what to check next?

Thanks!

# Answer
Oh dear how embarrasing - its a drupal module not an extension!
> 3 votes

---
Tags: extension
---


title: Pulling info from Facebook into Civi

text:
# Question
Title: Pulling info from Facebook into Civi
I am working with an organization with a Drupal-based Civi instance that would like to have their people (members, event registrants, etc) sign into their Civi with Facebook and allow Civi to pull in specific information that they have entered on FB (e.g., email address, location, etc).

I know there are extensions to do this in Drupal (e.g., https://www.drupal.org/project/social\_auth\_facebook). Has anyone used this functionality to then get the info into Civi from Drupal? Does anyone have advice about the feasibility of such a project?

# Answer
> 3 votes
This is not a particularly good answer to your question, but since Erik asked :)

I've worked on a chatbot app that can be used to integrate between Facebook and CiviCRM. Chatbot interacts via the messenger platform and pulls in their first name, last name and picture (which is what the messenger app allows). You can then use it it to further populate fields via a chat interface, e.g. you could ask the question "What city do you live in?" and put the answer in the city address field. But that doesn't sound like what you want to do though.

The Drupal module you reference looks like a good start. If you were able to get the info you needed into Drupal that would be a good proof of concept and would probably be a worthwhile first step if you haven't done it already since there is point going down this road if Facebook is not willing to let you have the information that you require.

I suspect getting the info from their into CiviCRM will require some custom coding, unless there is an integration between Drupal user profiles and CiviCRM that I am not aware of.

Hopefully that is of some use - sorry I can't be of more help at the moment.

---
Tags: drupal, social-media, facebook
---


title: Notes about participants

text:
# Question
Title: Notes about participants
We need to fill some information about people that registered to specific event, for example room number where they will stay. Is it possible to store additional information about participants so that they won't see it? Personally I found the note field on the event registration screen for some participant. We could use it but it doesn't appear in the event reports. So I can't see the full list of participants with that field.

Thanks in advance!

# Answer
> 2 votes
You can add Custom Fields specifically to Participant records and you can be more specific than just 'all participants' since the options provided are

* Participants
* Participants (Event Name)
* Participants (Event Type)
* Participants (role)

# Answer
> 2 votes
You're on the right direction, participant notes are intended for this. But as you say, seems there is no way to show this field info on an event report.

Exists an improvement registered on CRM-20236 Include "Note" field of Registration record in event participant reports that would do what you want. If this is important for you and you don't have skills or resources to develop it, maybe Paid issue queue could be a good way to achieve this.

# Answer
> 0 votes
Since CiviCRM 5.8.0, participant notes column appear on the Event Participant Listing report.

---
Tags: civievent, custom-fields, profile, participants
---


# Question
Title: Search builder does not display date picker for contacts
I am running Drupal 7.61 and CiviCRM 5.8.0. I have recently upgraded from 5.3.1 and when I use search builder to locate contacts using created date the date picker does not display. (See attached video link). If I use search builder to find an individual using their birth date the date picker functions correctly.

I have not made any configuration changes to CiviCRM in the upgrade process.

Video showing date picker issue

Screenshot from Demo Site

# Answer
There was a small bug introduced in the last version where the calendar icon didn't show up in search builder date fields, but the actual datepicker still works fine.

The screenshots and videos are misleading, as they use *Contact:Created Date* as the example field - this is actually *not* a date field (despite the name) it is a *Timestamp* which doesn't work with the datepicker widget, unfortunately, so I don't believe this is a regression.

Edit: I stand corrected. Previous versions *did* provide a datepicker for timestamp fields, however it didn't work very well since it didn't allow you to specify time. I've created a fix to restore the datepicker and add a timepicker for those fields: https://github.com/civicrm/civicrm-core/pull/13249
> 3 votes

# Answer
This is what i am seeing on dmaster compared to a 5.3.1 site

seems like a regression. needs an issue opening.

More from 5.3.1

The datepicker in action

and the outcome
> 1 votes

---
Tags: search-builder
---


# Question
Title: Unable to load AngularJS pages, e.g., CiviVolunteer and CiviCRM status page
The following links in the CiviCRM admin menu don't work for me:

* Volunteers \> New Volunteer Project
* Volunteers \> Manage Volunteer Projects
* Volunteers \> Search for Volunteer Opportunities

When I navigate to these links the page never loads; the CiviCRM icon just keeps spinning indefinitely as though it's still processing my request.

I reset the paths and cleared the caches but that didn't help. I also don't see any errors in Reports \> Recent log messages (Drupal admin UI).

Background info:

These are my settings:

Extensions Directory: \[civicrm.files\]/ext/

Extension Resource URL: \[civicrm.files\]/ext/

URL Variables:

\[cms.root\] https://example.org/

\[civicrm.root\] https://example.org/sites/all/modules/civicrm/

\[civicrm.files\] https://example.org/sites/default/files/civicrm/

Path Variables:

\[cms.root\] /home/example/www/www

\[civicrm.root\] /home/example/www/www/sites/all/modules/civicrm

\[civicrm.files\] /home/example/www/www/sites/default/files/civicrm

Location of CiviVolunteer extension: /home/example/www/www/sites/default/files/civicrm/ext/org.civicrm.volunteer

**Update:** This issue occurs in parallel with another: my CiviCRM system status page is blank. (I realized they were related when both issues disappeared simultaneously, unfortunately temporarily.)

When navigating to any of the above links (CiviVolunteer and system status) my browser console shows the following errors:

# Answer
> 2 votes
It looks like you have a config mismatch between your CMS and your CRM. The tell is in the CORS error in the screenshot you provided. It looks like your site is serving content at https://www.example.org while CiviCRM has specified a base URL of https://example.org. (Note that one URL includes the "www" subdomain while the other does not.)

These URLs have to match,or you need to configure your server to allow cross-origin resource sharing (CORS).

I would recommend the easiest solution, which is to ensure that CiviCRM serves assets via the same base URL as your CMS. In civicrm.settings.php file:

`define('CIVICRM_UF_BASEURL', 'https://www.example.org/');`

# Answer
> 1 votes
When I had this issue, it was linked to the url paths. I know you said you checked these but I’d double check paths.

# Answer
> 1 votes
I would check you have the AJAX API permission enabled for your role. That will stop the page working properly.

---
Tags: angular
---


title: Items not showing up on activity log

text:
# Question
Title: Items not showing up on activity log
It appears that, following the last upgrade, items which previously showed on an individuals activity log now don't show up. A colleague sent out an email which was assigned to a case. The email shows on the case but not in the colleagues activity list. This list is used as a record that we can refer to as a quick check if something has been misassigned or that we did remember to do something. What was the reason for this being changed and is it something we can choose to bring back?

# Answer
> 0 votes
Yes this was changed recently. I preferred it the old way too, but there was a feeling that it was duplication. See https://github.com/civicrm/civicrm-core/pull/12620

---
Tags: civicase, activities
---


title: What is formal title used for?

text:
# Question
Title: What is formal title used for?
Just noticed the last import an employee did - confused Job Title with Formal Title - we fixed it - but then the question arose - what is the field Formal Title used for - and I have no clue.

Its not in the user guide - not visible on contact dashboard - and not much discussion about it on SE - can someone shed some light on how formal title is used?

# Answer
The formal title is used for an additional prefix. For example, in German someone might be called Herr Dokter Suchandsuch, where "herr" stands for "mister" and "Dokter" for doctor. So it can be used for those kind of cases.

If you want it to be visible on the contact summary you can switch it on with Administer\>Customize Data and Screens\>Display Preferences\>
> 3 votes

---
Tags: contacts, fields
---


# Question
Title: How do I find the web root in civicrm.settings.php?
I'd like to set

```
$civicrm_setting['Directory Preferences']['extensionsDir'] =

```

to a files directory relative to the web root. How do I do that?

# Answer
The easiest way to set those is using Civi::settings()-\>set('......').

In the UI it is Administer/System Settings/Directories.

Is that what you are looking for?
> 1 votes

---
Tags: configuration
---


title: changed the domain in Joomla

text:
# Question
Title: changed the domain in Joomla
I changed the domain in Joomla, in connection with which errors began to appear in crm. She believes that this domain is invalid. Tell me how to fix these errors?

# Answer
Review the page at https://docs.civicrm.org/sysadmin/en/latest/misc/switch-servers/

Did the directory path change in addition?

Stuff to try:

* look at your setting.civicrm.php file for any thing that needs updating
* clear out your civicrm cache directory. typically at media/civicrm/templates\_c Just get rid of everything in that directory (you can leave the .htaccess). But get rid of everything else including any subdirectories (e.g. en\_US) (see above link for info)
* if you can access your administrative page check your directories and resource\_url settings
* rebuild your menu's (described in above url)
> 2 votes

---
Tags: joomla
---


# Question
Title: How do I trigger a price calculation update on the event registration page?
The requirement is that if someone picks a complimentary part of the event they have to select a paid part.

I have updated with jquery the rule so that if someone checks a free option the corresponding paid for option is also checked. The price calculation update is not performed. How do I get the prices to update?

# Answer
Here's how we do it:

We do the two sets of items in a separate price field on the same price set. So the paid options that are required would be in one field, the complementary in another (or several others). I set the price field for the required options to required. Then they are forced to choose one of them. We only have one item in the required section and one in the optional section, but you could have more.

This then forces them to choose the mandatory item every time. We had to do this because folks would select the optional item, the book, and not select the training registration as well.
> 2 votes

# Answer
I ended up using click rather than just setting checked. This enables more than one payable item to enable access to the 'free' items.

```
function ConferenceManager() {
var mgr = this;
mgr.bootcamp = jQuery('#price_4_4');
mgr.pioneerAwards = jQuery('#price_4_6');
mgr.mainConference = jQuery('#price_4_7');
mgr.specialistRoundTables = jQuery('#price_4_8');

// Main conference is checked by default, but bootcamp is not.
mgr.mainConferenceChecked = true; // mgr.mainConference.defaultChecked is undefined
mgr.bootcampChecked = false;
mgr.changing = false;

mgr.bootcamp.change(function () {
  if (mgr.changing) {
    mgr.changing = false;
  } else {
    if (document.getElementById('price_4_4').checked) {
      mgr.bootcampChecked = true;
    } else {
      mgr.bootcampChecked = false;
      if (!mgr.mainConferenceChecked) {
        mgr.pioneerAwards.prop('checked', false);
        mgr.specialistRoundTables.prop('checked', false);
      }
    }
  }
});

mgr.pioneerAwards.change(function () {
  if (this.checked) {
    // Main conference is checked
    if (!mgr.mainConferenceChecked && !mgr.bootcampChecked) {
      mgr.changing = true;
      mgr.mainConferenceChecked = true;
      mgr.mainConference.click();
    }
  }
});

mgr.mainConference.change(function () {
  if (mgr.changing) {
    mgr.changing = false;
  } else {
    if (document.getElementById('price_4_7').checked) {
      mgr.mainConferenceChecked = true;
    } else {
      mgr.mainConferenceChecked = false;
      if (!mgr.bootcampChecked) {
        mgr.pioneerAwards.prop('checked', false);
        mgr.specialistRoundTables.prop('checked', false);
      }
    }
  }
});

mgr.specialistRoundTables.change(function () {
  if (this.checked) {
    // Main conference is checked
    if (!mgr.mainConferenceChecked && !mgr.bootcampChecked) {
      mgr.changing = true;
      mgr.mainConferenceChecked = true;
      mgr.mainConference.click();
    }
  }
});
}

var conferenceManager = new ConferenceManager();

```
> 1 votes

---
Tags: civievent, javascript
---


# Question
Title: Start/member since dates not being set since upgrade to 5.3.2
We recently upgraded from Civi 4.6.23 to 5.3.2. The upgrade has gone fairly smoothly, but today we discovered a problem where the Member Since and Start Dates are not being set for any new memberships started since the day we upgraded. Though these members are being giving the status of "Current", they are not being given correct access to our site.

I've checked our error logs, and there are no errors. I also checked the database, and the database does not have a Member Since or Start Date, and has no record of a membership in the member\_log table.

In this picture, you can see that there is no date set for Member Since or Start Date:

If we got to edit the member, though, it does have a Member Since date. But, still not Start Date.

# Answer
I never found the cause to this, but ended up using a Rule in Drupal to set the member\_since and join\_date variables when a new membership is created.
> 1 votes

---
Tags: civimember
---


# Question
Title: Is something wrong with the Schedule Reminder auto renewals for membership? I cannot find "Membership End Date" in list.
Description of issue: As per these instructions, am trying to setup a scheduled email reminder to all of our members 5 days before their membership expires. Our membership has a rolling intake date, so each of these emails is going to go out on a different day. I am relying on a tool to send these out according to a certain set of rules.

I am using the Schedule Reminder tool. After picking membership types (group of people to whom I want to send these email reminders; in the example below it is to the group of members in the "Individual" category), I want to set a specific amount of time prior to their "Membership End Date" for the emails to go out. Instead, when I go to pick "Membership End Date" from the dropdown menu, all I see in the drop down list is one entry called "Activity Date Time" (which to me seems like the generic one).

The documentation leads me to believe that this should be real simple and that dropdown should be pre-populated with that field - and I don't see anywhere to add something custom.

fig.1 Documentation suggests Membership End Date should be readily available and easy to find.

fig. 2 showing no options other than a generic "Activity Date Time" in dropdown menu

I am confident that there should be other options here/ Here is an example from StackOverflow i came across during some research.  fig.3 img shared by stackoverflow user in an unrelated discussion on setting up scheduled reminders that shows a type of

I am not sure what's up.. whether its just me.

---

Other perhaps related issues? On the off chance that these are related (ie, the plugin is not picking up on some folder or DB full of important arrays or images), I thought I would document a couple other weird things I noticed along the way:

I noticed that the calendar function (fig.2; which I don't need in this case) is not working.

fig.4

In the dashboard, I noticed that the menu items seem to have little images that are not populating. fig.3

fig.5 dashboard menu showing missing images

# Answer
Those other 'issues' suggest you need to review your Directories and/or Resource URLs under Admin \> System Settings.

IN terms of does Membership End Date get offered as an option after choosing Entity = Membership - yes - and here is screenshot from https://dmaster.demo.civicrm.org/civicrm/admin/scheduleReminders?action=add&reset=1 to show what is happening on a fully functioning site.

Hope the above hints help
> 1 votes

---
Tags: scheduled-reminders
---


title: CiviCRM password length in Joomla

text:
# Question
Title: CiviCRM password length in Joomla
I'm working on a version of CiviCRM installed in Joomla, I'm using a registration form with custom fields of Civi for the registration. The problem is that CiviCRM does not apply the same checks on passwords as Joomla does. I have not found solutions in the system, so I'm trying to insert custom controls using hooks. As indicated I created a file and specified the path and customize the code find on CiviCRM guide for my purpose, but does not detect any changes on the form I'm using.

```
function joomla_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors ) {
  if ($formName == 'Edit') {
    foreach ($fields['cms_pass'] as $key => $password) {
      if(strlen(trim($password)) > 8) {
        $errors['cms_pass[' . $key . ']'] = ts('Password must be 8 characters');
      }
    }
  }
  return;
}

```

# Answer
> 1 votes
Ok, I found an example on the Civi Wiki and, with a bit of workaround, it finally works:

```
function joomla_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) {

  $errors = array();

  // check we're targeting the right form
  if ($formName == 'Edit') {
    return true;
  }

   $password = CRM_Utils_Array::value( 'cms_pass', $fields );

   // ensure that password is present and valid
   if (!$password) {
      $errors['cms_pass'] = ts( 'Password is a required field' );
   } elseif (strlen($password) < 50) {
      $errors['cms_pass'] = ts( 'Password must be longer than 50 characters');
   }

  return empty($errors) ? true : $errors;
}

```

---
Tags: forms, gdpr
---


title: location of civicrm.css on Joomla

text:
# Question
Title: location of civicrm.css on Joomla
I just upgraded to 5.8.0 and quickly noticed that my contribution pages didn't look the same. Using an html inspector the page is using just css from the joomla template and not civicrm.css. Looking at the source on the contributions page I see:

link href="/components/com\_civicrm/civicrm/css/civicrm.css?r=LSlvr" rel="stylesheet" type="text/css"

However that is NOT where the civicrm.css file is located at. Its at administrator/components/com\_civicrm/civicrm/css.

I "fixed" it by creating a symbolic link in webroot/components/com\_civicrm to the directory in the administrator directory. (this is not the right way to fix it, but it works now!)

Is this a known problem? Is it something with my resource urls or directory settings? I've been playing with them without success.

# Answer
I fixed it. I opened Administer -\> System Settings -\> Resource URLs.

I then changed CiviCRM Resource URL from \[civicrm.root\]/ to administrator/components/com\_civicrm/civicrm/

I then removed my hack (the symbolic link), refreshed the contribution page and all is well. I also verfied by looking at the source for the contribution page and it show the correct urls for css and jquery now.
> 1 votes

---
Tags: joomla, css, directory, resource-urls
---


# Question
Title: Unable to make backend contributions with non-default payment processor (sometimes) "no class provided" error
As per the title, here's how it happens:

1. Create a payment processor instance (i.e. add payment processor here /civicrm/admin/paymentProcessor?reset=1)
2. Create a second one of the same type, different credentials. Leave the first one as default.

When trying to use the second payment processor on a 'backend/admin' contribution form (ie. /civicrm/contact/view/contribution?action=add&cid=etc.), we get an error at /CRM/Contribute/Form/Contribution.php, line 1165 (this is using civicrm 5.6.1, we had the same issue on 5.3.1). As far as we know this behaviour was introduced sometime shortly before 5.3.1 (that was the security update in the summer), i.e. this is new behaviour on several upgraded, existing installs.

I can see that the payment\_processor\_id value is getting to the server (I can see it in the submit values in the stacktrace).

To make matters a bit more confusing, we can't reproduce it reliably (but do have it reproduced on three separate sites, but not a fourth, new install), so there is some additional aspect going on here.

These tests are all using the iATS payment processor (of course ...), but I don't think that actually comes into play, since the code breaks before it can identify which payment processor is responsible for the payment.

# Answer
> 2 votes
Okay, first remind me to never exclude my iATS extension from being part of the problem ...

Karin tracked this down to the point in the (core) code where the list of available payment processors are reloaded a second time.

It occurred to me that the iATS extension interferes with this form for two reasons:

1. in order to remove the iATS ACH/EFT processor if any,
2. (or) to remove all but the swipe processor if it's the default

i.e., it's having to do some non-supported changes to core.

But ... it looks like the way it does this, by removing entries from various parts of the form, no longer works.

I think the best solution would be that instead of removing the payment processors from the option lists, the code will just disable them, (assuming that's possible).

And it turns out that this is easy, and you can try it out with the next iATS extension release or this commit/patch:

https://github.com/iATSPayments/com.iatspayments.civicrm/commit/2bf9dcdb1537fb75649aa6304cdab991a8a9d1eb

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


# Question
Title: Is it okay to use both Absolute Date and Repeats in Scheduled Reminders
Asking because the issue we are seeing is that if Absolute date is set for the reminder, and 'repeat' is enabled, then we get an sql condition like this: ("20181212123815" \<= DATE\_ADD(, INTERVAL 1 month) which causes problems.

Should this combination be allowed, and hence the code/query needs to be improved to cope with this, or should the combination not be allowed and hence the UI needs to prevent users setting this up

# Answer
> 2 votes
It seems reasonable to allow that, although since the repetition "Until" is always relative, I can see why coding might have assumed the start would be relative.

If you plan to enhance that chunk of code, it might make sense to also allow an absolute end date or number of repetitions as alternatives to the relative "until".

---
Tags: scheduled-reminders
---


# Question
Title: creating a custom group and and field using extension
I am trying to create a custom group and custom field using extension.
I created seperate funtion

```
function custom_group_create_example() {
$params = array(
    'title' => 'Test_Group_1',
    'name' => 'test_group_1',
    'extends' => array(
        '0' => 'Individual',
    ),
    'weight' => 4,
    'collapse_display' => 1,
    'style' => 'Inline',
    'help_pre' => 'This is Pre Help For Test Group 1',
    'help_post' => 'This is Post Help For Test Group 1',
    'is_active' => 1,
);

try{
    $result = civicrm_api3('CustomGroup', 'create', $params);
}
catch (CiviCRM_API3_Exception $e) {
    // Handle error here.
    $errorMessage = $e->getMessage();
    $errorCode = $e->getErrorCode();
    $errorData = $e->getExtraParams();
    return array(
        'is_error' => 1,
        'error_message' => $errorMessage,
        'error_code' => $errorCode,
        'error_data' => $errorData,
    );
}

return $result;

```

}

I call this funtion into

> function contact\_civicrm\_install()

this funtion(hook).
But problem is that it is not creating any custom group.
How to resolve this problem.

# Answer
> 1 votes
Here is how I add custom groups and fields:

* as a first step, add an upgrader to your extension with civix generate:upgrader
* then add the call to your creating function to the install function in the upgrader:

```
     public function install() {
        // install custom groups and fields
        CRM_Example_CustomData::createGroupsAndFields();

```
* I also think your extends does not have to be an array? I use

```
'extends' => 'Individual',

```

---
Tags: extension
---


# Question
Title: Wordpress - Membership: Sorry, due to an error, we are unable to fulfill your request at the moment
first things first, my setup:

* PHP 7.0.28
* Wordpress 4.9
* CiviCRM 5.8.0

So, I don't get my membership registration process to work, which is very frustrating because of the poor feedback of the system. After submitting the form is says:

"Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.

Zur Anfangsseite zurück."

In "ConfigAndLog" I got:

```
Dec 12 15:43:15  [info] $Fatal Error Details = Array
(
    [message] =>
    [code] =>
)

Dec 12 15:43:15  [info] $backTrace = #0 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(381): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1201): CRM_Core_Error::fatal()
#2 /qqq/wp/files/civicrm/ext/uk.co.vedaconsulting.gdpr/gdpr.php(259): CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_Contribution", NULL, "contact_id", "trxn_id")
#3 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(274): gdpr_civicrm_buildForm("CRM_Contribute_Form_Contribution_ThankYou", Object(CRM_Contribute_Form_Contribution_ThankYou))
#4 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(155): CRM_Utils_Hook->runHooks((Array:5), "civicrm_buildForm", 2, "CRM_Contribute_Form_Contribution_ThankYou", Object(CRM_Contribute_Form_Contribution_ThankYou), NULL, NULL, NULL, NULL)
#5 /qqq/wp/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(90): CRM_Utils_Hook_WordPress->invokeViaUF(2, "CRM_Contribute_Form_Contribution_ThankYou", Object(CRM_Contribute_Form_Contribution_ThankYou), NULL, NULL, NULL, NULL, "civicrm_buildForm")
#6 /qqq/wp/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(184): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent), "hook_civicrm_buildForm", Object(Civi\Core\CiviEventDispatcher))
#7 /qqq/wp/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:1), "hook_civicrm_buildForm", Object(Civi\Core\Event\GenericHookEvent))
#8 /qqq/wp/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_buildForm", Object(Civi\Core\Event\GenericHookEvent))
#9 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(164): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_buildForm", Object(Civi\Core\Event\GenericHookEvent))
#10 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(425): CRM_Utils_Hook->invoke((Array:2), "CRM_Contribute_Form_Contribution_ThankYou", Object(CRM_Contribute_Form_Contribution_ThankYou), NULL, NULL, NULL, NULL, "civicrm_buildForm")
#11 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(618): CRM_Utils_Hook::buildForm("CRM_Contribute_Form_Contribution_ThankYou", Object(CRM_Contribute_Form_Contribution_ThankYou))
#12 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
#13 /qqq/wp/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contribute_Form_Contribution_ThankYou), "display")
#14 /qqq/wp/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_ThankYou), "display")
#15 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
#16 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller->run((Array:3), NULL)
#17 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
#18 /qqq/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#19 /qqq/wp/wp-content/plugins/civicrm/civicrm.php(1240): CRM_Core_Invoke::invoke((Array:3))
#20 /qqq/wp/wp-content/plugins/civicrm/includes/civicrm.basepage.php(365): CiviCRM_For_WordPress->invoke()
#21 /qqq/wp/wp-includes/class-wp-hook.php(286): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))
#22 /qqq/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(FALSE, (Array:1))
#23 /qqq/wp/wp-includes/plugin.php(515): WP_Hook->do_action((Array:1))
#24 /qqq/wp/wp-includes/class-wp.php(726): do_action_ref_array("wp", (Array:1))
#25 /qqq/wp/wp-includes/functions.php(960): WP->main("")
#26 /qqq/wp/wp-blog-header.php(16): wp()
#27 /qqq/wp/index.php(18): require("/qqq/wp/wp-blog-header.php")
#28 {main}

```

which is not helpful at all, at least not for me. So maybe this is my most important question, how to improve the feedback/error message of the system? Or do you have any idea how to make the error go away in the first place and make the membership process work?

# Answer
> 1 votes
Your backtrace shows the GDPR extension is involved. Try temporarily disabling the GDPR extension and see if your membership form works. Make sure that the GDPR extension is the latest release and check it is fully configured. I have seen issues in an earlier version when the extension is installed but not configured.

If the problem only occurs when GDPR is enabled and you have done the steps above, try logging an issue on the extension's site.

---
Tags: wordpress, civimember
---


# Question
Title: Wordpress: MyISAM Database Engine Error after update
After update to Civicrm 5.8.0 I got a:

```
MyISAM Database Engine
Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.

```

Had a look into the db, found out it's just about three tables:

Is it save to do `ALTER TABLE tablename ENGINE=InnoDB;`?

# Answer
Yes, you can change the engine but they are temporary tables so will disappear soon - and more will appear.

It is a warning rather than an error. The data integrity message is intended to relate to the permanent tables, not these temporary ones. Since your permanent tables show as InnoDB you can safely ignore this message.

I've logged this here: https://lab.civicrm.org/dev/core/issues/591
> 2 votes

# Answer
You could adjust to remove error, but these tmp tables will always by MyIsam, every time they are created.

I am not sure if setting the default storage engine as InnoDB is okay.
> 0 votes

# Answer
We've been seeing this in Drupal installs as well (with CiviCRM 5.6.1) so this isn't a brand new issue. (Also - welcome to Civi SE, Stefan! We're glad you're here.)
> 0 votes

---
Tags: wordpress, database
---


# Question
Title: Countries of US addresses showing up as Foreign in some names
I have a mailing list of about 1,500 names. I have imported them into CiviCRM using a CSV spreadsheet file. The country field for all these names in my spreadsheet are all labeled United States. A good portion of my addresses after the import into CiviCrm are now listed as another country. Some show South Africa, etc. I've tried the import several times to no avail, but my original list is correct.

Any suggestions how to fix this? Thanks

Mark

# Answer
> 3 votes
(You're relatively new here BTW so welcome!) It sounds as though your import sheet did not specify a country, but your site allows for multiple countries and thus multiple states/provinces. Even if the United States is your default country, I've found that the import routine will pick the first country it finds in the list of countries with similar state abbreviations, rather than hitting the correct one. The workaround to this is pretty simple; include a column for country in your import and populate it with United States (or the appropriate country).

Hope this helps!

---
Tags: contacts
---


# Question
Title: Is is possible to restrict visibility of custom data sets?
Current install - WP5.0 / Civi 5.7.2

I'm just thinking through our Safeguarding / Child Protection process. We don't have any issues, but we're legally obliged to have a process. And I'd rather set this up now when there's no pressure than when, heaven forbid, there's an actual issue.

What I'd like to do is have a set of custom data fields against a contact (essentially notes, but I can't have them exposed like 'normal' notes) that our designated Child Protection Officer (me) has access to, so that any concerns / issues can be logged against a contact record.

Obviously, access to those fields needs to be tightly controlled. No one else in the organisation even needs to know they exist.

I know I can use ACL's to manage access to functions within CiviCRM, and I can hide fields from profiles. But if I have other people legitimately using CiviCRM, I can't have them seeing these additional fields (or even see if a contact has those fields present on their record, even if the content is hidden).

# Answer
> 2 votes
You can create a set of custom fields and then with ACL's provide access to that custom data set for a specific group.

The complication with this is that you also need to remove the 'access all custom data' permission (otherwise it overrides the ACL), and then add other ACL's to allow everyone access to each of the unrestricted custom field sets.

As regards your comment about anyone adding themselves to a group, there is a very useful little extension called Group Protect that allows you to 'protect' a group and control who can add or remove people from a specific group.

Be aware though that Administrators will be able to access the safeguarding fields, whatever ACL's or other restrictions you put in place.

# Answer
> 2 votes
There is such a concept as Private Notes which are Notes that are only visible to the author and to anyone with the permission to see 'all notes'. Try that. It may be less effort but still acceptable

# Answer
> 1 votes
I do not think you can do that out of the box with CiviCRM, but it is quite possible to develop (or get an expert to develop for you) an extension that does this.

---
Tags: custom-fields, acl
---


title: Proper work with incoming mail

text:
# Question
Title: Proper work with incoming mail
Already mastered the system. Faced problems, but not here they helped to solve them, for which many thanks. There was another question, the answer to which I can not find anywhere else.

1) I set up work with incoming mail, but all the letters go to the “Actions” tab, in the client's card. So it should be? Shouldn't they go to the "Newsletters" tab?

2) Where can I read about the organization of work with incoming mail? What is the best way to work with him so that it is most convenient? Are there any real examples of the organization of such work?

3) Is there some kind of Russian-language help, or forum?

Postscript I apologize if someone asked such questions somewhere. I do not know English, because it is difficult for me to understand a huge amount of information. Give thanks!

# Answer
> 2 votes
Newsletter tab would be for outgoing bulk mailings ie civimail.

Activities tab (what you translated above as Actions tab) is where incoming mail goes because they are created as an Activity.

# Answer
> 1 votes
On the Russian-language part, on https://chat.civicrm.org/ there are currently French and Dutch channels so I don't see why you couldn't create a Russian one. I don't whether there are any other Russian speakers who would join the channel, but you could be the first. As Pete said, most of us speak English as our first (or only!) language so if you put it in English there are more people who may be able to help.

Are you on a multi-language site (ie using Russian and other languages), or a single-language site in Russian? Multi-language is configured on Настройки - Локализация

If you are on multi-language then if you temporarily switch to English using the language switcher block when you do screen shots that would help us.

If you are on a single-language site, then there is a new feature that has just been merged (I'm not sure whether it will be in 5.9 or 5.10) that will let you do the same thing and switch to English without affecting other users.

---
Tags: civimail, joomla
---


# Question
Title: How do I add a new settings page for my extension?
I am trying to develop a module extension which needs to store some settings, I went through the documentation and found this to be the way to create settings.

Now when I put default as NULL the setting is not reflected in the table, if I put any value as default the setting is added to `civicrm_setting` table.

Also, though the settings have option to specify attributes for admin form, I couldn't figure out a way to present a new settings form for my module.

Is there anything else which I need to do apart from adding the setting folder and the following code to extension.php

```
function multisite_civicrm_alterSettingsFolders(&$metaDataFolders = NULL){
     _multisite_civix_civicrm_alterSettingsFolders($metaDataFolders);
}

```

# Answer
> 7 votes
You'll want to start with the civix generate:form command. Alter the generated code to have your form class extend `CRM_Admin_Form_Setting` instead of `CRM_Core_Form` and then follow the example of other such forms by declaring the settings that form is supposed to manage.

You may also wish to insert a link to this form into the navigation menu.

# Answer
> 3 votes
This took me way longer than I anticipated, so I thought I'd pen a fuller answer for the most minimal settings form. It assumes you're building a modern extension, generated with civix.

## Step 1: define your settings

Create a **settings** dir in your extension's base directory, and within that create a `whateveryouwant.setting.php`. Gotcha 1 is that while the directory is called setting**s** this file must be use the singlular "setting" or it won't get picked up. But, yes, it can have multiple settings in it.

That file contains a `return [ 'favourite_fruit' => [...], 'your_other_setting' => [...], ... ];` statement - see the docs

Gotcha 2: these `*.setting.php` files seem to be only sourced as *part of* a cache clear. i.e. I learnt that using the "Flush Caches" button (or running via `cv api system.flush`) not only flushes the caches, but also recreates some of them. This is different to Drupal, for instance.

## Step 2: create a form for it

As Coleman suggests:

```
civix generate:form Settings civicrm/path/to/your/form

```

Note that the use of `Settings` as the form class name is up to you.

Then edit the `CRM/YourMod/Form/Settings.php` file. You can strip this right down to just

```
class CRM_YourMod_Form_Settings extends CRM_Admin_Form_Setting
{
   protected $_settings = [
     'favourite_fruit' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
   ];

   public function buildQuickForm() {
     parent::buildQuickForm();
     $this->assign('elementNames', array_keys($this->_settings));
   }
}

```

The `$_settings` array is keyed by the names you define in your `*.setting.php`. In the `buildQuickForm()` function we just call the one we inherited, but then assign all our settings to the `elementNames` array, because the default form created by `civix` loops this array to output the elements; if you don't set this your form is empty.

You can then alter it as you need to, but thought it would be useful to have this minimal example posted, hope it helps a googler (or a duckduckgo-er).

For completeness' sake (as I use this as a reference myself!), in code you can access settings with:

```
$fruit = Civi::settings()->get('favourite_fruit');

```

And, should you need to

```
$fruit = Civi::settings()->set('favourite_fruit', 'lychee');

```

# Answer
> 2 votes
If your work is targeting versions 4.7+, you may not need to create a form like Coleman suggests. Check out the work done to overhaul the CiviCRM settings administration - it's referred to in this post as "Administer Settings improvements", and a team developed it during the Colorado sprint. You may want to ask a core team member the status of that work.

# Answer
> 0 votes
I use `Civi::settings()->set` and `Civi::settings()->get` to create and retrieve CiviCRM settings.

---
Tags: extension, gsoc, settings
---


# Question
Title: no menu error 500 after upgrade to 5.8.x
On Ubuntu 18.04, apache 2.4.29 all patches for both applied. Did an upgrade today to 5.8.0. The header civi nav menu isn't displaying. Installed 5.8.1 to make sure it wasn't something cooky, still no menu.

I've checked permissions for WP. I've checked that the path to the file is kosher, and it exists just fine. I've done the cache and path reset inside civi.

Error log in apache shows:

```
PHP Fatal error:  Uncaught Error: Call to undefined method CRM_Core_SelectValues::quicksearchOptions() in /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/AJAX.php:60
Stack trace:
#0 /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/AJAX.php(49): CRM_Admin_Page_AJAX::getSearchOptions()
#1 /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(275): CRM_Admin_Page_AJAX::getNavigationMenu()
#2 /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem(Array)
#3 /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke(Array)
#4 /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm.php(1240): CRM_Core_Invoke::invoke(Array)
#5 /home/folder/domains/secure.folder.org/public_html/wp-includes/class-w in /home/folder/domains/secure.folder.org/public_html/wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/AJAX.php on line 60,
referer: https://secure.narsol.org/wp-admin/admin.php?page=CiviCRM

```

# Answer
> 4 votes
Andy, Welcome to CiviCRM stack exchange.

This is a weird error, since this function is already present in CiviCRM 5.8.1. But to trace the problem I would

1. Check if the function quicksearchOptions() exists in civicrm/CRM/Core/SelectValues.php.
2. Check if this file is being over-ridden by any of the extension or custom php
3. Check if civicrm/CRM/Core/SelectValues.php file is being invoked.

HTH

Pradeep

---
Tags: menu
---


# Question
Title: How to add a values (html select) to custom field?
I am creating an extension. I created a custom group and custom field. The data and input field type is alphanumeric and select. I want to add multiple choice option into that custom field using an extension.

# Answer
You can use managed hook to create custom field on install

1. Create Option Group 2.Create option values for option group
2. Create custom group
3. Create custom field.

There is another way of doing this i.e by creating xml file. A good example to refer would be https://github.com/compucorp/civihr/blob/master/hrcareer/xml/auto\_install.xml

HTH

Pradeep
> 2 votes

# Answer
It sounds like you are looking for this hook: https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_fieldOptions/

It lets you set the values in the select dropdown on-the-fly.
> 0 votes

---
Tags: extension
---


title: Having Trouble With Paths

text:
# Question
Title: Having Trouble With Paths
I'm new to civicrm so I'm not totally sure if I'm using all the right language here.

---

Something seems to be messed up with the way civiCRM is resolving system paths. Causing jQuery to fail in resolving its own path and/or paths to some of the assets.

This problem is manifesting itself as a javascript error which causes various front-end features to break.

* I have attempted running the tools at: Admin \> System Settings \> Cleanup Caches and Update Paths. **No effect.**
* I've looked at `/wp-content/uploads/civcrm/civcrm.settings.php` the paths look correct.
* `/wp-content/uploads/civicrm/templates_c/` is getting new files written, so I don't believe there is a permissions issue.

Any ideas?

# Answer
That first error, "SyntaxError: expected expression, got "\<" suggests that something in WordPress - a poorly behaving theme or plugin - is injecting text on every page load. That'll screw up CiviCRM.

I would troubleshoot this by switching to one of the core themes (e.g. twentyseventeen) and disabling plugins (ideally on a test site if this site is already live). Assuming the problem goes away, you can turn things back on to identify the bad actor.
> 3 votes

# Answer
Check your Directories and Resource URLs - both under Administer \> System Settings
> 0 votes

---
Tags: jquery
---


# Question
Title: How do i delete country from my mailing label format
How do i delete country (United States) from my mailing label format. I can't seem to print mailing labels without United States on the last line and the USPS doesn't want that.

# Answer
> 3 votes
There are two ways to do this.

* If you are based in the United States, go to **Administer \> Localization \> Address Settings**. Set *Hide Country in Mailing Labels when same as domain country* to **Yes**. You can double-check that CiviCRM thinks you're US-based by going to **Administer menu \> Communications \> Organization Address and Contact Info** and checking the *Country* field under *Default Organization Address*.
* If you are NOT based in the United States, go to **Administer \> Localization \> Address Settings**. Remove **{contact.country}** from the bottom of the *Mailing Label* field. Note that this removes country for ALL mailings.
* If you need something more fine-grained (e.g. you're not US-based, but need to remove country from mailings sent to the US), install my extension com.megaphonetech.addressl10n. This will let you do per-country mailing label formats.

---
Tags: mailing, address-labels
---


title: Styling Contribution pages with buttons

text:
# Question
Title: Styling Contribution pages with buttons
Some users may want to display Price Set options as standard buttons rather than as radio buttons.

I am sharing my CSS for this below.

See how it looks here (Joomla).

# Answer
These styles change Radio buttons and checkboxes in Civi Price Sets into colored toggle buttons. Make this a separate file from your primary civi-custom.css so that these styles can be applied to individual price sets, rather than globally: i.e. for donation pages, but not for event registrations.

Add the following link tag `<link rel="stylesheet" type="text/css" href="[path-to-civi-custom-css-directory]/civi-button-inputs.css">` to the source text anywhere on the page, such as

* the Contribution Page description (to deploy these styles only on that one Contribution Page) or
* the Price Set (for all pages that use that price set). The Price Set Settings Pre-help is a sensible location for this, though if you don't have visible text in the pre-help section, there will be an empty div styled as your .help class). An alternate location in the Price Set is the pre-help for any field, which is less likely to have a visible empty div.

```

/* lines up top of all new buttons */
#priceset.crm-section  div.content {
    padding-top: 0px;}

/* prevents various sections from overlapping or wrapping weirdly if the description includes
images or divs, not a bad candidate for basic Civi css */
#crm-container.crm-public .crm-section, .crm-section {
    display: flow-root;}

/* Styling the buttons */
.price-set-option-content input[type="radio"],
.price-set-option-content input[type="radio"] + label,
.price-set-option-content input[type="checkbox"],
.price-set-option-content input[type="checkbox"] + label {
    float:left;
    width:180px;
    margin:4px;
    background-color:#e9e1ef;
    border-radius:4px;
    border:1px solid #D0D0D0;
    overflow:auto;
    padding:13px 6px;}

/* Styling the labels */
.price-set-option-content label,
.price-set-option-content label span,
.price-set-option-content input[type="checkbox"] + label {
    text-align:center;
    font-size: 32px;
    display:block;}

/* make Total Amount same size as button text */
#crm-container.crm-public .calc-value {
    font-size: 32px;}

/* Alternate text styles for the amounts, if both labels and amounts are shown for a field
(don't want everything to be large) */
.price-set-option-content input[type="radio"] + label .crm-price-amount-amount {
    font-size: 16px;}

/* puts the normal input controls out of sight */
.price-set-option-content input[type="radio"],
.price-set-option-content input[type="checkbox"],
span.crm-price-amount-label-separator {
    position:fixed;
    top:-50px;}

/* Style for hovered item */
.price-set-option-content input[type="radio"]:hover + label,
.price-set-option-content input[type="radio"]:hover + label .crm-price-amount-amount,
.price-set-option-content input[type="checkbox"]:hover + label {
    background-color:#eee6f4;}

/* Style for selected item */
.price-set-option-content input[type="radio"]:checked + label,
.price-set-option-content input[type="radio"]:checked + label .crm-price-amount-amount,
.price-set-option-content input[type="checkbox"]:checked + label {
    background-color:#663399;
    color:#fff !important;}

```
> 6 votes

---
Tags: contribution-page, css
---


# Question
Title: Can't use function return value in write context in ... civicrm.php on line 342 (5.8.1, WordPress)
After manual installation of the plugin in Wordpress (5.0.1), PHP (7.2.12), mySQL (10.1.36-MariaDB). I can't activate it.

I receive this info:

Fatal error: Can't use function return value in write context in .../public\_html/CRM/wp-content/plugins/civicrm/civicrm.php on line 342

# Answer
It sounds like you may be using an unsupported PHP version. CiviCRM 5.8.1 requires PHP 5.6 or higher.

If this solves your problem, please mark it solved; if not, please edit your question to indicate your PHP version?
> 1 votes

---
Tags: wordpress, installation
---


# Question
Title: Quicksearch "name/email not found. Did you mean to search by name/email instead ?"
After a Civi update from 4.x to 5.8.1, quicksearch stopped searching on email addresses when using the name/email option (the first and default option in the dropdown). It returns no results, and comes with the message "name/email not found. Did you mean to search by name/email instead ?"

If we use the 'email' option from the dropdown list, it works as expected.

The search preferences look like before. The first quicksearch option, "Name/email" can not be unchecked there.

Under the hood, the option is called "sort\_name", both in the preferences screen and in the quicksearch widget itself (however, as soon as you start to type, you are typing in another widget, without a name, but that could be voodoo)

After clicking enter, which takes you to the advanced search, it shows the results as expected, including matching emails (Results for "Name or Email LIKE - 'pike-foo'")

Is the sort\_name perhaps cached somewhere in 5.x , and do I need to build/rebuild it ?

# Answer
Have also experienced this after upgrading to 5.8.0. Bug has been reported and hopefully should have a fix very soon –

https://lab.civicrm.org/dev/core/issues/593
> 3 votes

---
Tags: email, upgrade, quicksearch
---


# Question
Title: Disable Automatic Receipts on Existing Recurring Donations
I'm on CiviCRM 5.8.1 on WordPress using the latest version of the Stripe extension, and I'm wondering if there's a way to disabled the automated receipts for existing recurring donations.

We'd like to change to a model where we're doing thank yous manually as needed when recurring donations come in, and while we can tell it not to send a receipt when we first enter a donation, I don't see anywhere that I can tell it to stop sending automated receipts if it's already doing it.

I do not have the "send receipt" box checked in the contribution page configuration for what that's worth.

Thanks for any ideas folks have.

# Answer
> 3 votes
In the Recurring Contribution series itself you can set Email Receipt to Off; if you have access to mysql you can stop sending CiviCRM Contribution receipts for all your existing Recurring series by setting is\_email\_receipt = 0 ( in civicrm\_contribution\_recur )

For the iATS extension we have added an additional setting that will override (a global setting) all individual recurring series.

---
Tags: civicontribute
---


# Question
Title: Change 'Used for' contact type of custom fields
I have custom field group set as used for 'individual' but I want to change it to limit it to a contact subtype. What is the best way to achieve this - I could create a new field group and copy data over - but there are several hundred contacts to do this for

# Answer
Jonathan, Welcome to CiviCRM stackexchange.

Sometimes its not possible to change custom group's used for since the CiviCRM creates a separate table for this with a Foreign key. However its possible to update if the 'Used for' share the same table.

In your case you want to make it visible for Individual subtype then its possible through UI by editing the custom group and then selecting the contact sub-type from the dropdown list.
> 1 votes

# Answer
I don't think you can change what the field is "used for" but you could use search builder to find all individuals where the field is non-null and then export these records. Then you can import the data for those contacts mapping to the new field that is "used for" a contact. Be careful not to overwrite any other data!
> 0 votes

---
Tags: custom-fields
---


# Question
Title: Is Civi compatible with Wordpress5.0? *SOLVED*
We just upgraded from WordPress 4.9 to 5.0 and right away Civi 5.2 disappeared. Is there something in WordPress 5.0 that prevents Civi from operating? The most current download for Civi says WordPress 3x to 4x.

\****SOLVED\****

# Answer
\****SOLVED\****

The issue is caused by the Civi-Calendar extension. I have contacted the developers about it and asked them to upgrade their extension to make it compatible with civi 5.8. The below files caused specific problems and were disabled.

**public\_html/wp-content/uploads/civicrm/custom/custom\_php/CRM/Core/SelectValues.php**

*Breaks the Add Relationships function. Breaks the search box on the top left corner.*

**public\_html/wp-content/uploads/civicrm/custom/custom\_php/CRM/Core/Event/BAO/Event.php**

*Breaks page: Events \> Manage Events Result Error 500*
> 2 votes

# Answer
A similar question was asked a few days ago but they indicated it worked with a more recent version of civi. You might need to upgrade. See Any issues in WordPress 5?
> 1 votes

---
Tags: wordpress
---


title: How to quickly update a Smart Group?

text:
# Question
Title: How to quickly update a Smart Group?
On CiviCRM 5.6.0

I have a Smart Group based upon custom\_param1=1 (as an example).

I change some values of custom\_param1, to update my Smart Group in order to send a mail to its updated members.

But the Smart Group is not updated immediately (I have to wait 5 minutes before it is)

How can I force its update to have it immediately ?

(rebuilding the smart group cache has no effect)

# Answer
> 1 votes
Clearing the Civi cache doesn't work? It should.

# Answer
> 1 votes
Change the 'Smart group cache timeout' which is in Administer/Customise data and screens/Search Preferences The default is 5 minutes but I normally set this to 1 for my clients. It can be set to zero but this isn't recommended according to this screen.

# Answer
> 1 votes
Instead of openning the Smart Group (e.g. /civicrm/group/search?force=1&context=smog&**gid=341**&component\_mode=1), you can call its pertaining Search (e.g. /civicrm/contact/search/advanced?reset=1&force=1&**ssID=263**).

You can get the Search Id (ssID) :

* either via "Edit Smart Group Searc Criteria ..." button (which calls the associated Search URL)
* or in the civicrm\_group table : saved\_search\_id field

**NO : this gives erratic results**

---
Tags: smartgroups
---


# Question
Title: Should I use Civi::settings()->get and set or
In this post on StackExchange How do I add a new settings page for my extension? the way to create settings in CiviCRM is stated as : Create a settings dir in your extension's base directory, and within that create a whateveryouwant.setting.php.

I always use Civi::settings()-\>set and Civi::settings()-\>get. What is the recommended way?

# Answer
> 2 votes
One option is to create settings using Setting Reference

How I would do through extension is

# Answer
> 2 votes
Thanks @Jon G, that makes sense :-) So summarizing the recommended way is:

* Register metadata for setting using `hook_civicrm_alterSettingsMetaData` or create `myfile.setting.php` in my extension
* Use either Civi::settings()-\>set to set the value of the setting and Civi::settings()-\>get to retrieve the value OR the Setting API.

# Answer
> 1 votes
Instead of `hook_civicrm_alterSettingsMetaData` you can also create a `myfile.setting.php` file in your extension.

See also issue core#495 for recent work that allows you to add settings to the UI based SOLELY on metadata - very exciting!

---
Tags: settings, coding-standards
---


# Question
Title: How to change the encoding in pdf documents?
How to change the encoding in pdf documents? Cyrillic characters are not displayed in my pdf documents. To display them, you need to change the encoding. Please tell me which file can this be done? I tried to find the answer in other questions, but unfortunately I could not.

css

Report pdf

Report html

# Answer
> 7 votes
I don't think it's the encoding it seems that none of the included fonts in dompdf support it. See also https://stackoverflow.com/questions/16384517/dompdf-character-encoding-utf-8. If you look in the vendor/dompdf/dompdf/lib/fonts folder there's a readme about DejaVu, and it says you can get the font from http://code.google.com/p/dompdf and copy it into your dompdf/lib/fonts folder. Then as the first link describes you need to change the font used by the Civi message template you're using, e.g. in the template under Administer - CiviMail - Message Templates if you edit the template you'll see either `<font>` tags or something like `style="font-family: Arial"`, and you can change the font there. If you're pdf'ing reports you can edit css/print.css.

**Note that clicking the .ttf files at the link above** seem to be redirects to another page where you can actually download the real file. If you just save the .ttf files directly they aren't really ttf files.

Also in order to get it to recognize the .ttf I had to add this to the print.css file:

```
@font-face {
  font-family: 'DejaVu Sans';
  font-style: normal;
  font-weight: normal;
  src: url(https://mysite.org/path/to/civicrm/vendor/dompdf/dompdf/lib/fonts/DejaVuSans.ttf) format('truetype');
}
@font-face {
  font-family: 'DejaVu Sans';
  font-style: italic;
  font-weight: normal;
  src: url(https://mysite.org/path/to/civicrm/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Oblique.ttf) format('truetype');
}
@font-face {
  font-family: 'DejaVu Sans';
  font-style: normal;
  font-weight: bold;
  src: url(https://mysite.org/path/to/civicrm/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Bold.ttf) format('truetype');
}
@font-face {
  font-family: 'DejaVu Sans';
  font-style: italic;
  font-weight: bold;
  src: url(https://mysite.org/path/to/civicrm/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-BoldOblique.ttf) format('truetype');
}

```

---
Tags: joomla, pdf
---


# Question
Title: It says 5.7 is a security release - should I upgrade?
"I thought we were on the latest security release but I'm seeing references to a Security Release (when logged in)?"

# Answer
No worries - from this popup I can tell you are on the latest CiviCRM security release -\> 5.3.1 - the Extended Security release is not more secure than 5.3.1
> 2 votes

---
Tags: civicrm-home
---


title: Sport organisation using CiviCRM

text:
# Question
Title: Sport organisation using CiviCRM
I've been asked to help setting up CiviCRM installation for local judo association. Never used the system before so if I could get some guidelines how to setup the organisation in the system I'd be grateful.

I've purchased the 2 existing books for CiviCRM and most of the functionality is clear to me. But I'm not sure how to setup the association levels. There are nationwide admins, then local clubs, their coaches and maybe extra secretary and at the bottom regular members (adults, kids and their parents). Should I set up each club as separate "Organisation" level type or a group? It is essential that coaches (and whoever is assign to particular club) only see their own club members and no-one else, obviously.

I'm using Civi on top of Drupal 7, if that's any help.

Any help appreciated.

Ralph

# Answer
Welcome to civi. The approach I would recommend, having done it for several situations, is to use the Permissioned Relationship extension. This then allows you to daisy chain permissions so that local officer has a relationship to local club - and hence can see anyone how has the specified type of relationship to the club. Then you can also stack the local, regional, national (global) in the same manner, so a global officer sees everyone, the national sees everyone at or below the national level etc.

I have a diagram of this which may help explain the concept

So to answer the other part of the question head on, yes set up each club as an Organisation :-)

To extend that, what we have done is to then build drupal Views and Webforms which means the general club officer rarely has to actually go in to civi but get all their data, contacts etc from Views and Webforms (but that is jumping in pretty deep for a first time usage).

Happy to demo this quickly if it would help.
> 1 votes

---
Tags: drupal, groups
---