title: How to explore API from command line?

text:
# Question
Title: How to explore API from command line?
Is there a way to explore the API from the command line instead of going to mycivicrmsite.localhost/civicrm/api in a web browser?

I wasn't able to learn much from the `cv` help. For example, you can `cv api contact.get...` but what else can you `cv api contact.do?`

I know I can just go over to the web browser and pull up that page, but I just wanna hang out in my terminal :)

# Answer
> 2 votes
The graphical api explorer actually fetches all its information *about* the api *from* the api. Since the CiviCRM api is available from the command line, you can explore it using the same methods.

* Fetch the list of entities:

$ cv api Entity.get
* List available actions for an entity:

$ cv api Activity.getactions
* Get fields for an entity/action:

$ cv api Activity.getfields action=create

---
Tags: api, cli
---


# Question
Title: Replace flash-based charts with something that doesn't use flash
Several core reports (as well as some reports provided via extensions) use the OpenFlashChart library to create nice looking charts via flash.

Unfortunately (or fortunately depending on how you look at it), flash is on the way out. Many browsers disable it by default.

Has anyone worked on a drop-in replacement for Reports that use html5 or javascript or anything but flash? I know about Xavier's CiviVisualize which looks very promising, but it's not clear how to use it in a report to replace the chart functionality provided by OpenFlashCharts.

# Answer
As Lobo would say, "patch welcome." I think everyone agrees the open flash chart library needs to be replaced, but that's about as far as it's gone to-date.
> 1 votes

---
Tags: civireport
---


# Question
Title: what should be the auto return url for paypal civicrm?
I am setting up membership renewal using a contribution page and payment processor is Paypal Standard, what should be the Auto Return URl which should be incorporated in paypal website payment preference so that it redirects to thank you page of contribution?

Currently, it does not redirect automatically (probably due to it being in sandbox),when I do click on button Return to Website , it takes to Thank You Page and shows message "You don't have access permission to view the page"

# Answer
> 2 votes
The Return URI should be the URL of your site. The docs says

> Enter your CiviCRM site home page as the Return URL. This is a placeholder. CiviContribute will pass the exact return URL to PayPal automatically during each transaction.

---
Tags: civimember, paypal
---


# Question
Title: Database update failing for CiviCRM upgrade in Joomla 2.5
I have installed Civi 4.2.19 in Joomla 2.5, to upgrade the 4.1.1 version. I cleared all cache and then tried to run the database update. I got this fatal error:

Fatal error: require\_once(): Failed opening required 'CRM/Upgrade/Incremental/php/FourFix.php' (include\_path='/home/xxxxx/public\_html/j25/media/civicrm/custom/code:.:/home/xxxxx/public\_html/j25/administrator/components/com\_civicrm/civicrm:/home/xxxxx/public\_html/j25/administrator/components/com\_civicrm/civicrm/packages:.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') in /home/xxxxx/public\_html/j25/administrator/components/com\_civicrm/civicrm/CRM/Core/ClassLoader.php on line 126

It's referencing file "FourFix.php" which does not exist. I'm stuck and can't continue. I tried updating to 4.4.21, then the database update. Same result. Anyone able to help??

# Answer
Just found the issue. In the /CRM/Upgrade/Form.php file, I found this:

static $\_numberMap = array( 0 =\> 'Zero', 1 =\> 'One', 2 =\> 'Two', 3 =\> 'Three', 4 =\> 'Four', 5 =\> 'Five', 6 =\> 'Fix', 7 =\> 'Seven', 8 =\> 'Eight', 9 =\> 'Nine', );

You can see 'Fix' where it should be 'Six'. I corrected that then was able to move forward.

ALSO, I found that I had to install version 4.2.0 before I could install 4.2.19 successfully. I also upgraded to 4.1.6 prior to 4.2.0. Not sure if that was required, but I was seeing what worked.

Hopefully this will help the next poor soul that gets stuck upgrading a 6 year old CiviCRM build in Joomla!
> 1 votes

---
Tags: joomla, database, upgrade
---


title: Error Message when saving Content

text:
# Question
Title: Error Message when saving Content
I have recently upgraded Civi to 5.4.0

When I want to save a content (Page, Webform, ...), I get the following error message :

Fatal error: Call to undefined function rules\_action\_drupal\_goto() in /home/.../www/www/sites/all/modules/civicrm\_entity/civicrm\_entity.module on line 4021

Before upgrading Civi, I have already been using Drupal 7.59 for some months without having this problem.

Any help would be very welcome.

# Answer
> 0 votes
This sounds something wrong with the Drupal Rules module. Did you try to upgrade the Drupal Rules module as well

---
Tags: core
---


# Question
Title: Replace Webform Date Select Dropdowns with Textfield
I am using a webform to edit cases in CiviCRM. I have a date field which I want to display, but keep disabled (the case start date). I want to replace the three select fields (day, month and year) with a single text field.

The three select fields cannot be disabled and I do not want users to be able to change the date, but only to view it. It would also look a lot neater if it was just a single field.

I tried the solution given here, which uses a template suggestion to overide the webform template, but this doesn't work for integrated CiviCRM (date) fields.

The solution referred to above was to create a template called webform-calendar.tpl.php with the following code:

```
<?php
 $idKey = str_replace('_', '-', $component['form_key']);
?>
<input type="text" id="edit-submitted-<?php print $idKey ?>" class="form-text <?php print implode(' ', $calendar_classes); ?>" alt="<?php print t('Open popup calendar'); ?>" title="<?php print t('Open popup calendar'); ?>" />

```

And also adding the following css:

```
.webform-container-inline.webform-datepicker  div.form-item.form-type-select {
    display: none;
}

```

This would then get triggered for the webform date field. But this template does not get triggered for the CiviCRM date field.

Can anyone suggest how I can either adpat this method or use a different way to replace the select fields with a single text field for the date, or at least disable the select fields?

# Answer
Following my comment, you can edit the case start date component and change the widget to be a textfield. I was also able to disable the field on my webform.

As you have a disabled text field, not sure what you mean by changing the date format. If it needs to be done in civi, you can navigate to `Administer -> Customize Data and Screens -> Date Formats`.
> 2 votes

# Answer
It wasn't for the date field, but I've also had a scenario I need to display a field but not have it look editable. I ended up going the custom style route (the field itself was disabled but as you've noted did not look very clean.)

With css you could you remove the border/select options (perhaps reduce padding) on those particular select fields so they no longer look editable but stay in the correct order.
> 0 votes

---
Tags: webform-civicrm
---


# Question
Title: What's the logic behind Contribution's Payment Method for offline Contributions?
I don't really understand Contribution / Payment Method (Instrument) workflow. This is a typical scenario when creating Contributions (In many organizations that collect manually the money offline):

1. Create a Contribution, Status: **Pending**, Payment Instrument: **EFT/Bank** *(or any custom)*
2. Then when go back to Contribution to Edit it, Payment Method drop-down is not displayed anymore (the only place to see the selected method is in Contribution / View)
3. Change Contribution Status to **Completed**
4. It creates a new **payment**, but its Payment Method is empty

So this behavior is kind of confusing, and I've got some questions to understand the logic behind it:

1. Why Payment Method is available to be selected when you create a Contribution, but then when go back to Edit it, it disappears ? *(just the drop-down, the payment\_instrument\_id value still stored in **civicrm\_contribution** table*)
2. Why when Completing the contribution, the payment created doesn't share the Payment Method of its parent contribution?
3. Is there any internal difference between Completing a Contribution or Recording a Payment?. Recording a Payment allows to select a Payment Method, but what's the point to select one for the Contribution then?

I think it's kind of confusing the way this was implemented in 4.7/5.x, but maybe I'm missing another point of view to understand it.

**PS: this is based on CiviCRM 5.4.0**

# Answer
> 1 votes
The reason is probably that no financial transaction (which is different from contributions) is recorded for pending contributions.

Once you have a financial transaction e.g. if you change the status to completetes you will be able to edit it in the edit contribution screen (click on the little pen - see screenshot).

I think this behaviour was introduced only recently and I am not sure if it is a bug or a feature that you cannot change the payment instrument before you have a financial transaction.

# Answer
> 1 votes
my observation is that whether the contribution was pending or not in the first place, you can no longer change the payment method without generating this history log. And, even if you do attempt to change the payment method, it does *not* change it.

---
Tags: civicontribute, contributions, payment
---


# Question
Title: Is there a way to update the contact.addressee field in batches?
I have about 50,000 contacts to update and I have a scheduled update greeting job set up (based on this post Update addressee values for all contacts after modifying Addressee Type Options \- thanks Sean!)

If I run the scheduled job, it never completes (it hits a max execution time limit.) I did find that I can limit the number of contacts (to say 2500) with the limit parameter, and the job will complete. But my assumption is that if I run the job again it just updates my first 2500 contacts over again. Is that a correct assumption?

Is there another way I can update the contact.addressee token in batches to avoid hitting the max execution time?

# Answer
There are several solutions. I'll go from least to most work - though the "least work" solutions generally need a level of expertise that the "most work" solutions don't.

* You can edit your `max_execution_time` in `php.ini`.
* The default execution time when running from the command line is unlimited. So you could run `cv api Job.update_greeting` or the equivalent using `drush` or `wp-cli` if you don't have `cv` installed.
* Greetings are updated whenever a record is updated. An easy way to batch update records is to import a list of all the contact IDs you want to update with no other info. This will force an update and thus a greeting update.
* You can delete all your addressee values that need updating (or all of them!) through MySQL/phpMyAdmin, then use "Update Greetings" with a limit of 2500 and set `force` equal to 0. With `force` equal to zero, only contacts without addressees will be updated, so you won't do the same 2500 every time.
> 2 votes

---
Tags: contacts, tokens, scheduled-job
---


# Question
Title: Report causes DB errors when AGE column is enabled
After CiviCRM upgrade from v4.7.14. to v5.4.1. on Drupal 7 some reports that use AGE column are broken, e.g. **Instance 8: Contribution Details.**

The report works fine, if AGE column is disabled (checkbox unticked), but produce the error listed below, if AGE column is enabled.

The error appears specifically with the upgrade to **v4.7.30**, but does not disappear all they way up to v5.4.1.

```
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: no such field
Error Details
Database Error Code: Unknown column 'contact.birth_date' in 'field list', 1054
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => CREATE TEMPORARY TABLE civireport_contribution_detail_temp1  DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AS SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, TIMESTAMPDIFF(YEAR, contact.birth_date, CURDATE()) as civicrm_contact_age, email_civireport.email as civicrm_email_email, phone_civireport.phone as civicrm_phone_phone, contribution_civireport.id as civicrm_contribution_contribution_id, contribution_civireport.financial_type_id as civicrm_contribution_financial_type_id, contribution_civireport.payment_instrument_id as civicrm_contribution_payment_instrument_id, contribution_civireport.currency as civicrm_contribution_currency, contribution_civireport.receive_date as civicrm_contribution_receive_date, contribution_civireport.total_amount as civicrm_contribution_total_amount, 'Contribution' as civicrm_contribution_contribution_or_soft, note_civireport.note as civicrm_note_contribution_note, value_member_since_1_civireport.membership_type_11 as civicrm_value_member_since_1_custom_11   FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
        ON contact_civireport.id = contribution_civireport.contact_id
        AND contribution_civireport.is_test = 0
 LEFT JOIN civicrm_contribution_soft contribution_soft_civireport
                         ON contribution_soft_civireport.contribution_id = contribution_civireport.id
      LEFT JOIN civicrm_phone phone_civireport
             ON contact_civireport.id = phone_civireport.contact_id AND
                phone_civireport.is_primary = 1

                 LEFT JOIN civicrm_address address_civireport
                           ON (contact_civireport.id =
                               address_civireport.contact_id) AND
                               address_civireport.is_primary = 1

            LEFT JOIN  civicrm_email email_civireport
                   ON (contact_civireport.id = email_civireport.contact_id AND
                       email_civireport.is_primary = 1)
            LEFT JOIN civicrm_note note_civireport
                      ON ( note_civireport.entity_table = 'civicrm_contribution' AND
                           contribution_civireport.id = note_civireport.entity_id )
LEFT JOIN civicrm_value_member_since_1 value_member_since_1_civireport ON value_member_since_1_civireport.entity_id = contact_civireport.id WHERE (1) AND ( contribution_civireport.contribution_status_id IN (1) ) AND (`note_civireport`.`id` IS NULL OR (`note_civireport`.`id` IN (SELECT id FROM `civicrm_note` WHERE ((entity_table = 'civicrm_relationship')) OR ((entity_table = 'civicrm_contact')) OR ((entity_table = 'civicrm_participant')) OR ((entity_table = 'civicrm_contribution')))))   GROUP BY contact_civireport.id, contribution_civireport.id  ORDER BY contribution_civireport.receive_date DESC  LIMIT 0, 50 [nativecode=1054 ** Unknown column 'contact.birth_date' in 'field list']
    [type] => DB_Error
    [user_info] => CREATE TEMPORARY TABLE civireport_contribution_detail_temp1  DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AS SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, TIMESTAMPDIFF(YEAR, contact.birth_date, CURDATE()) as civicrm_contact_age, email_civireport.email as civicrm_email_email, phone_civireport.phone as civicrm_phone_phone, contribution_civireport.id as civicrm_contribution_contribution_id, contribution_civireport.financial_type_id as civicrm_contribution_financial_type_id, contribution_civireport.payment_instrument_id as civicrm_contribution_payment_instrument_id, contribution_civireport.currency as civicrm_contribution_currency, contribution_civireport.receive_date as civicrm_contribution_receive_date, contribution_civireport.total_amount as civicrm_contribution_total_amount, 'Contribution' as civicrm_contribution_contribution_or_soft, note_civireport.note as civicrm_note_contribution_note, value_member_since_1_civireport.membership_type_11 as civicrm_value_member_since_1_custom_11   FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
        ON contact_civireport.id = contribution_civireport.contact_id
        AND contribution_civireport.is_test = 0
 LEFT JOIN civicrm_contribution_soft contribution_soft_civireport
                         ON contribution_soft_civireport.contribution_id = contribution_civireport.id
      LEFT JOIN civicrm_phone phone_civireport
             ON contact_civireport.id = phone_civireport.contact_id AND
                phone_civireport.is_primary = 1

                 LEFT JOIN civicrm_address address_civireport
                           ON (contact_civireport.id =
                               address_civireport.contact_id) AND
                               address_civireport.is_primary = 1

            LEFT JOIN  civicrm_email email_civireport
                   ON (contact_civireport.id = email_civireport.contact_id AND
                       email_civireport.is_primary = 1)
            LEFT JOIN civicrm_note note_civireport
                      ON ( note_civireport.entity_table = 'civicrm_contribution' AND
                           contribution_civireport.id = note_civireport.entity_id )
LEFT JOIN civicrm_value_member_since_1 value_member_since_1_civireport ON value_member_since_1_civireport.entity_id = contact_civireport.id WHERE (1) AND ( contribution_civireport.contribution_status_id IN (1) ) AND (`note_civireport`.`id` IS NULL OR (`note_civireport`.`id` IN (SELECT id FROM `civicrm_note` WHERE ((entity_table = 'civicrm_relationship')) OR ((entity_table = 'civicrm_contact')) OR ((entity_table = 'civicrm_participant')) OR ((entity_table = 'civicrm_contribution')))))   GROUP BY contact_civireport.id, contribution_civireport.id  ORDER BY contribution_civireport.receive_date DESC  LIMIT 0, 50 [nativecode=1054 ** Unknown column 'contact.birth_date' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="CREATE TEMPORARY TABLE civireport_contribution_detail_temp1  DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AS SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name as civicrm_contact_sort_name, contact_civireport.id as civicrm_contact_id, TIMESTAMPDIFF(YEAR, contact.birth_date, CURDATE()) as civicrm_contact_age, email_civireport.email as civicrm_email_email, phone_civireport.phone as civicrm_phone_phone, contribution_civireport.id as civicrm_contribution_contribution_id, contribution_civireport.financial_type_id as civicrm_contribution_financial_type_id, contribution_civireport.payment_instrument_id as civicrm_contribution_payment_instrument_id, contribution_civireport.currency as civicrm_contribution_currency, contribution_civireport.receive_date as civicrm_contribution_receive_date, contribution_civireport.total_amount as civicrm_contribution_total_amount, 'Contribution' as civicrm_contribution_contribution_or_soft, note_civireport.note as civicrm_note_contribution_note, value_member_since_1_civireport.membership_type_11 as civicrm_value_member_since_1_custom_11   FROM civicrm_contact contact_civireport
      INNER JOIN civicrm_contribution contribution_civireport
        ON contact_civireport.id = contribution_civireport.contact_id
        AND contribution_civireport.is_test = 0
 LEFT JOIN civicrm_contribution_soft contribution_soft_civireport
                         ON contribution_soft_civireport.contribution_id = contribution_civireport.id
      LEFT JOIN civicrm_phone phone_civireport
             ON contact_civireport.id = phone_civireport.contact_id AND
                phone_civireport.is_primary = 1

                 LEFT JOIN civicrm_address address_civireport
                           ON (contact_civireport.id =
                               address_civireport.contact_id) AND
                               address_civireport.is_primary = 1

            LEFT JOIN  civicrm_email email_civireport
                   ON (contact_civireport.id = email_civireport.contact_id AND
                       email_civireport.is_primary = 1)
            LEFT JOIN civicrm_note note_civireport
                      ON ( note_civireport.entity_table = 'civicrm_contribution' AND
                           contribution_civireport.id = note_civireport.entity_id )
LEFT JOIN civicrm_value_member_since_1 value_member_since_1_civireport ON value_member_since_1_civireport.entity_id = contact_civireport.id WHERE (1) AND ( contribution_civireport.contribution_status_id IN (1) ) AND (`note_civireport`.`id` IS NULL OR (`note_civireport`.`id` IN (SELECT id FROM `civicrm_note` WHERE ((entity_table = 'civicrm_relationship')) OR ((entity_table = 'civicrm_contact')) OR ((entity_table = 'civicrm_participant')) OR ((entity_table = 'civicrm_contribution')))))   GROUP BY contact_civireport.id, contribution_civireport.id  ORDER BY contribution_civireport.receive_date DESC  LIMIT 0, 50 [nativecode=1054 ** Unknown column 'contact.birth_date' in 'field list']"]
)
Return to home page.

```

# Answer
The issue is locked at https://lab.civicrm.org/dev/core/issues/325 and its fix is at https://github.com/civicrm/civicrm-core/pull/12660

You can either apply patch or wait for next release.
> 2 votes

---
Tags: issues
---


# Question
Title: Can you explain the relationship between groups, i.e a parent group
Can you explain the relationship between groups, i.e. a parent group

I have set up a new group which includes members who are also part of a larger group. What does it mean if I set it so the larger group, i.e. volunteers, is the parent of the smaller group, i.e. Monday weeders?

Thanks

# Answer
> 5 votes
If your *monday weeders* group belongs to the *volunteers* group, then members of the *monday weeders* will be acted upon automatically as members of the *volunteers* group. So when you send an email to the parent group of *volunteers* it will be sent to all the members of *monday weeders* and any other group that's a sub-group of *volunteers*.

Is that what you're wondering?

There's more information about groups here https://docs.civicrm.org/user/en/latest/organising-your-data/groups-and-tags/.

---
Tags: groups
---


# Question
Title: copy Address of Primary Registrant to Additional Registrants
I am once again working on an event registration for an annual convention. I'd like to kno, and searching has thus far yielded nothing, is it possible to copy the first registrant's address to subsequent registrants? We often have families registering their additional household members and duplication of data entry is often cited as an annoyance. Thanks in advance.

Rachel

# Answer
You can share address between contacts. You can use civicrm\_address.master\_id to store the parent address id programatically or through UI by adding/updating address and selecting 'Use another contact's address'.
> 0 votes

---
Tags: civievent, profile
---


title: HTML Editor for Mailings Not Displaying

text:
# Question
Title: HTML Editor for Mailings Not Displaying
We recently upgraded to 5.4 and now when we create a new mailing, we are unable to enter any HTML content. The HTML area shows without the white editor area and any HTML options. The plain text area shows fine.

See the screen capture - the HTML area is blank while the Plain Text area has a white space to enter content.

# Answer
I've seen this when the CiviCRM plugin directory is not actually located inside `wp-content/plugins` but a symlink is used instead. The solution is my case was not to use a symlink.
> 1 votes

# Answer
I had this same issue with 5.4.1 on Drupal 7. CKEditor was working fine in all other parts of the CMS, but the HTML input field on the CiviMail page was as above.

Clearing the browser cache resolved it for me.
> 1 votes

---
Tags: civimail
---


title: Delete contacts from group

text:
# Question
Title: Delete contacts from group
I'm tried to delete contacts group (basically entire contacts from the particular group), getting Gateway timed out error and only few contacts are getting deleted.

So I'm planning to delete contacts from the database. It quite complicated, customer details are stored in different tables.

If I go through the database approach what all the tables I need to join to get all contacts deleted from a group?

# Answer
> 2 votes
It's strongly recommended NOT to delete data directly via SQL. I don't think it's possible to say which tables you need to delete from - there are hundreds of tables, not including those added by extensions, and it's impossible for us to know which are in use for you.

Instead, consider the suggestions by Jitendra and Aidan above - the issue is that the server is misconfigured. Alternatively, consider using the API. Especially if done from the command line where there should be no `max_execution_time` set, this should resolve your issue much more cleanly without causing orphan database records.

---
Tags: joomla, database, groups, delete, civicrm-contact
---


title: Contribution Page Confirmation Emails

text:
# Question
Title: Contribution Page Confirmation Emails
So, we recently set up a contribution page for people to buy tickets for a raffle we're hosting on our website. However, we are not receiving confirmation emails upon purchases. We get them when people donate through our "Donate Now" button but not for the raffle. Also, we have several fields on the contribution page that are not being displayed under the contributors profile. Can anyone help with this?

I hope this makes sense. I am new to United Way and CiviCRM so I'm rather in the dark with all of this. Hope someone can help!

# Answer
Can you check if you have turned on send receipt? You can check by navigation to CiviCRM \>\> Contributions \>\> Manage Contribution Pages

Click on Configure link besides the contribution page and then 'Thankyou and receipting'

Once you on receipt page scroll down and check the box 'Email Receipt to Contributor?' if its turned off.

Also check under 'Profiles' tab if you have included correct profile.
> 2 votes

---
Tags: civicontribute, email, contributions, confirmation
---


title: preserving Member IDs on first import?

text:
# Question
Title: preserving Member IDs on first import?
I have a list of members that I'm importing from our old system. Since they have unique numeric member numbers, I'd like to preserve the original member number and not muddy the waters by making that an 'External ID'.

Using import memberships, the insert option doesn't allow me to assign member IDs. the update option fails because the member IDs don't exist.

Thoughts on how to preserve the original membership IDs? Or am I out of luck?

Keith

# Answer
We created a custom field to import it in so we had them on file, then as members renewed we switched over to using their contact ID's as member numbers and put a notice in their renewal emails that they would notice changes.
> 1 votes

---
Tags: civimember, data-import
---


# Question
Title: How to enable multi valued profile fields in contribution page?
I have included a profile in a contribution page, I need to add multiple combination of first name,last name and email value in the contribution in a way that I have an Add More Button which can load combination of fields if required How can I achieve it?

# Answer
> 2 votes
You can either create custom fields against contact and include them in a profile and using JS play hide and seek with those custom fields or you can create your own fields using buildform hooks and add it to profile form and include JS to hide show.

HTH

Pradeep

---
Tags: profile, multi-record
---


# Question
Title: Creating a Membership programmatically for Household creates multiple memberships?
My Requirement : Whenever a membership is assigned to Head of Household , I need to assign memberships to Household Member and Household.

I have a membership type Family with "Head of household, household member" as related contact to be assigned with the membership in the settings of membership.

Whenever the Head of Household fills the membership form, It creates a member of Household and a Household. Also, Membership assigned to Head of Household is assigned to Household programmatically as seen in the code below I am unable to understand why there are multiple memberships generated For Head of Household, It creates 2 Memberships

> Family
> Family (by relationship)

For Household it creates 2 membership

> Family
> Family

For Household Member it creates 1 membership

> Family (by relationship)

I need to know the reason of duplication and how I can avoid duplication and create memberships 1 each for Head of Household, Household member and Household.

My Code on Profile creation on hook\_civicrm\_post is

```
       add_filter( 'civicrm_post', 'alter_profiles_event', 10, 4  );
    function alter_profiles_event($op, $objectName, $objectId, &$objectRef){
        if (!is_user_logged_in()){
    if ($objectName == 'Profile'  && ($op == 'edit' || $op =='create') && isset($objectRef['custom_19'])){

          $primary_email = $objectRef['email-Primary'];
            $primary_contact_id = civicrm_family_profile_get_primary_contact_id($primary_email);

            $result = civicrm_api3('Contact', 'get',
              array(
                'sequential' => 1,
                'return' => array(
                  "custom_19","first_name","last_name","contact_id"
                ),
                'id' => $primary_contact_id,
              )
            );
            $is_household = FALSE;
            $last_name =  $result['values'][0]['last_name'];
            $household_id = '';
            $custom_19_first_name = $objectRef['custom_19'];
            $result1 = array();
            if (isset($objectRef['custom_19'])){
              $params = array(
                'contact_type' => 'Individual',
                'first_name' =>  $objectRef['custom_19'],
                'last_name'  => $objectRef['last_name'],
              // 'email' => $objectRefArr['custom_21'],
              );
                //partner contact created
              $result1 = civicrm_api3('Contact', 'create', $params);
            }
            $partner_contact_id  = $result1['id'];

              $result2 = array();
              //create household
            if (isset($objectRef['last_name'])){

              $params = array(
                'contact_type' => 'Household',
                'household_name' =>  $objectRef['last_name'],
                'email' => $objectRef['email-Primary'],
              );
              $result2 = civicrm_api3('Contact', 'create', $params);
              }

              $household_id = $result2['id'];
              //create household relationship
              $head_of_household = array(
                'contact_id_a' => $primary_contact_id,
                'contact_id_b' => $household_id,
                'relationship_type_id' => 7,
              );
              $result3 = civicrm_api3('Relationship','create',$head_of_household);
              $household_member = array(
                'contact_id_a' => $partner_contact_id,
                'contact_id_b' => $household_id,
                'relationship_type_id' => 8,
              );
              $result4 = civicrm_api3('Relationship','create',$household_member);

                $result5 = civicrm_api3('Address', 'get', array(
                  'contact_id' => $primary_contact_id,
                  'location_type_id' => 1,//"Main",
                  )
                );
                if (!$result5['is_error']){
                $id = $result5['id'];
                $address = $result5['values'][$id];
                $result5 = civicrm_api3('Address', 'create', array(
                  'contact_id' => $partner_contact_id,
                  'location_type_id' => "Main",//$address['location_type_id'],
                  'street_address' =>   $address['street_address'],//Street Address
                  'supplemental_address_1' =>   $address['supplemental_address_1'],//Supplemental Address
                  'city' =>     $address['city'],//City
                  'state_province_id' =>    $address['state_province_id'],//State
                  'country_id' =>   $address['country_id'],//Country
                  )
                );
                $result5 = civicrm_api3('Address', 'create', array(
                  'contact_id' => $household_id,
                  'location_type_id' => "Main",// $address['location_type_id'],
                  'street_address' =>   $address['street_address'],//Street Address
                  'supplemental_address_1' =>   $address['supplemental_address_1'],//Supplemental Address
                  'city' =>     $address['city'],//City
                  'state_province_id' =>    $address['state_province_id'],//State
                  'country_id' =>   $address['country_id'],//Country
                  )
                );
                }
            }
                if ($objectName == 'Membership' && ($op == 'create')){
                    print_r($op);
                    print_r($objectName);
                    print_r($objectRef);
                    die('ed');
            if ($objectRef->membership_type_id == 2){
                $contact_id = $objectRef->contact_id;
                $result = civicrm_api3('Contact', 'get', [
                 'sequential' => 1,
                 'contact_id' => $contact_id,
                ]);
                if ($result['values'][0]['contact_type'] == 'Individual'){
                  $result = civicrm_api3('Relationship', 'get', [
                    'sequential' => 1,
                    'relationship_type_id' => 7,
                    'contact_id_a' => $contact_id,
                  ]);
                  if(isset($result['values'][0])){
                    $contact_id_b = $result['values'][0]['contact_id_b'];//household
                    civicrm_family_profile_create_membership($contact_id_b,$objectRef);
                  }
                }
            }
          }
        }
    }

    function civicrm_family_profile_create_membership($contact_id,$objectRef){

      $result = civicrm_api3('Membership', 'get', [
      'membership_type_id' => 2,//"family",//@todo check if that works
      'contact_id' => $contact_id,
    ]);
      if (!isset($result['values'][0]['id'])){
        $result = civicrm_api3('Membership', 'create', [
          'membership_type_id' => 2,//"family",//@todo check if that works
          'contact_id' => $contact_id,
        ]);
      }
      else {
        if($result['values'][0]['end_date'] != $objectRef->end_date){
            $result = civicrm_api3('Membership', 'create', [
          'membership_type_id' => 2,//"family",//@todo check if that works
          'contact_id' => $contact_id,
        ]);
        }
      }
}

```

When I don't add code to create membership for a household programmatically, it does not create membership for Household member and Household both

# Answer
> 2 votes
Since you have configured membership type to use relationship it will automatically add membership to contact having relationship with the primary membership holder. So you have to exclude code in your plugin that creates memberships for other contacts as Civi already does that

---
Tags: wordpress, civimember, relationships
---


title: Missing CKeditor

text:
# Question
Title: Missing CKeditor
I have just upgraded from CiviCRM 4.6 to 5.4.1. In events and mailings the description boxes are missing CKEditor. I have tried clearing caches and I have installed I10N for GB as some. I have also looked for the Access CiviCRM permission and that is selected for Events.

I'm stumped and now all our events have raw html in the descriptions. Can anyone help please.

Gareth

# Answer
**BEFORE DOING THIS IT IS ESSENTIAL YOU HAVE A VALID BACKUP**

Our previous hosts had set up symlinks so that an upgrade could be tested and quickly swapped over. With the latest version, 5.4.1 symlinks break ckeditor. I removed symlinks and changed \[cms.root\] to /home/*USER*/public\_html. I corrected all the paths under Resource URLs & Directories. I also cleared out cache as if we were moving to a new server. CKEditor is working perfectly now.
> 1 votes

---
Tags: ckeditor
---


# Question
Title: preferred language not importing with contact data
I have tried this several ways, but can't seem to get the preferred language to come in with the contact import. The initial values I had were basic (English, French, etc.) and didn't match the labels in Civi. I changed them to match the Civi labels, with no luck and finally, have tried simply using the assigned values: en, es, etc. Still no luck.

Any thoughts?

# Answer
It seems that a country designation is required too, even though they are not easily shown in the prefered language interface. So fr is not valid, but fr\_FR is.
> 1 votes

---
Tags: import, language
---


# Question
Title: Events - Registration Confirmation and Receipt (on-line) is not sending to anonymous users
I have set up an event with webform/civievent and the registration confirmation & receipt is not sending to anonymous sign-ups. While logged in and signing up it will email me (if I am the sign-up), but for anonymous users it won't. I have the send receipt box ticked off in both the contribution page and the event itself. The payment is going through and the participant is being registered correctly, the receipt will just not auto-send. I am using Drupal 7, CiviCRM 5.3.1, and webform version 7.x-4.17.

# Answer
> 1 votes
Ah - ok - this is what's happening:

1. if the event is FREE -\> then no receipt is issued via CiviCRM workflow message templates
2. if the event is FREE && if participants make a donation -\> then the participants get an email message from the CiviCRM workflow message template - contribution online

So your workaround is a good one - a simple Email message that is triggered via CiviRules (add Participant to a certain event) - or you could even do a simple Email message from Webform -\> Emails.

---
Tags: civievent, webform-civicrm, system-workflow-messages
---


# Question
Title: Can Webform CIviCRM module do Line Items (PS yes it can!)
How can we sell a Membership and a Calendar (that we should charge Sales tax on) and let the user make a Donation all on the same Webform Civicrm page - in a way that only the Donation amount is eligible to receive a charitable tax receipt?

# Answer
> 5 votes
As of last week you can now create Additional Line Items with webform civicrm module (which is a Drupal/CiviCRM integration module). Coleman and I are thankful to Wilderness Committee (Canada) for sponsoring this new feature!

1. if you'd like to try this out before a next dev-release - you can download the latest webform\_civicrm code from: https://github.com/colemanw/webform\_civicrm.git
2. with the latest code in your Webform -\> navigate to your CiviCRM tab -\> Contribution tab and you'll see the new Configuration option 'Additional Line Items' at the bottom of that tab. In this example we'll use two and we'll let the user select their own financial type (of course you can configure that to any static financial type as well and/or hide these fields from the form the usual webform civicrm way)

3. Configure the new fields -\> We need to charge Sales Tax on the Calendar - while ensuring the Donation is of type Donation so that it becomes eligible for a Charitable Tax Receipt. We have also configured the form such that the user can add a Membership (and be charged the proper amount for it).

4. View/fill out the webform:
5. Next Page:

6. Contribution created in CiviCRM!

---
Tags: civicontribute, webform-civicrm
---


title: Unsubscribe group in scheduled mailings

text:
# Question
Title: Unsubscribe group in scheduled mailings
I want to send an email to a large group (\>50) and have created a smart group for this. Using the scheduled mailing function I selected this group as the recipients but now an extra box appears with an unsubscribe group, what is this for and can I do the mailing without this?

# Answer
The unsubscribe group provides a way for recipients to opt out of future mailings. It isn't possible to send a mailing without this.

Please read the documentation for more information about how this works: Mass mailings using CiviMail

Here's an extract that provides an overview:

> For mailings to search results, you are required to choose a Group from the Unsubscription Group dropdown menu. Here's why: Every mass mailing needs a way to track unsubscribe requests. A simple "unsubscribe" process is required by law in many countries and may help prevent your mailings from being treated as spam. Mailings sent to Groups have this capacity built-in. The next time a mass email is sent to that Group, anyone who has unsubscribed will not be included. However, mailings sent to search results do not have this built-in way to track who has unsubscribed, so you need to provide one.
> 3 votes

---
Tags: civimail
---


# Question
Title: **Network Error - Unable to reach the server
I am the manager of our organizations Drupal/CiviCRM site. Since we are an all-volunteer organization, I have other managing certain aspects of the system.

One of our board members is responsible for ensuring that membership records are up-to-date. For those who elect to pay by check, this means that he has to enter the site and manually enter the fact that the member has paid.

The process he uses for doing this is:

1. Go to CiviCRM
2. Type in the name of a contact in the search box, i.e. Smith
3. Select John Smith from the drop down box
4. Go to John's Membership Tab where his Pending membership is shown
5. Click on more, Renew

When he does this, he gets *Network Error - Unable to reach the server*.

I tried to duplicate this situation by giving my personal account (not the admin account) the same level of privilege as his account (note that I have the CiviGroup Roles Sync module installed, so this simply entails giving my account the same Role as his), logging into the system using a different browser (after deleting history, cookies, etc.), and following the same sequence outlined above. When I did this, the error did not occur.

Details:

* Drupal 7.37
* CiviCRM 4.6.3
* Permissions enabled: access administration menu; CivCRM: add contacts, view all contacts, edit all contacts, view my contact, edit my contact, delete contacts, access deleted contacts, import contacts, skip IDS check, profile listings and forms, profile listings, profile create profile edit, access CiviCRM, access contact dashboard, administer reserved groups, merge duplicate contacts, view all notes, access contact reference fields, access CiviContribute, edit contributions, access CiviMember, edit memberships, delete in CiviMember, access CiviMail, access CiviReport, access Report Criteria; use the administration pages and help; administer users; view user profiles

Can you please suggest why my colleague is getting this error and I am not? If not this, can you suggest some tests that can be run on his computer to try to get to the root cause of the problem?

# Answer
If you're not having this trouble but your colleague is, a very common issue is sessions on www/no-www or HTTP/HTTPS URLs. CiviCRM's base URL is hard-coded in the settings file, and while you can follow relative links around the site for a while, some links will be generated from that URL.

Let's say you have a site that's accessible at http://www.example.org and http://example.org. civicrm.settings.php has http://example.org as the base URL. If your colleague logs into Drupal at http://www.example.org/user and follows links from there, everything may be fine until he hits a URL that CiviCRM generates from the base URL. It'll be http://example.org/whatever, and Drupal will deny access, since there's no session at example.org--just at www.example.org.

I don't think it's necessarily precisely this, but I think it may be something similar. Maybe your colleague logs in at http://www.example.org instead of https://www.example.org. Maybe you have SSL enabled only for www.example.org, or maybe there's a redirect that's cached funny.

The way to avoid this is to make sure three of the following four URL variations all redirect to the fourth: \- http://www.example.org \- http://example.org \- https://www.example.org \- https://example.org

It doesn't matter whether you pick https://www.example.org or https://example.org as your official URL, but have everything redirect there and set that as the base URL in civicrm.settings.php.

Although I think something like this is probably the issue, Jon's answer is a good general process for debugging this sort of thing.
> 12 votes

# Answer
There are a number of reasons they could be getting this error and you're not. Here are the tests to try:

* There could be something on your colleague's computer (e.g. a browser plugin) that's affecting the URL being generated. Though unlikely, you'll potentially save yourself a lot of grief by testing this first! To test, use your computer with his login.
* Next test: Open the Net tab in your Developer Tools (F12 in Firefox or Chrome) before loading the page and look for errors there. If you find some you can't interpret, please update your question with them.
* Most important test - watch the web server's error log as your colleague triggers the problem.
* Also - on Civi 4.6, the "Renew" dialog pops up in a modal dialog by default. If you copy the URL and paste it into a new tab to do these tests, you'll have an easier time troubleshooting: the Net tab won't be as cluttered and you can easily retest by reloading the page.
> 4 votes

# Answer
I fixed it:

This error can occur when you **migrate** the server and the database user is different on your new server.

**I got this error and this is how I solved:**

In your civicrm -\> ConfigAndLog look for the most recent edited file (to do this run command $ls -ltr, your most recent file is listed in the end). Open that file and look for your old db username or for Fatal Error or DB Error.

This is what I got: "execute command denied to user 'myOLDuser'@'localhost' for routine 'mycivicrmdb.civicrm\_strip\_non\_numeric'\]

**To fix this** I ran the SQL : UPDATE mysql.proc SET definer = 'myNEWuser@localhost' WHERE db = 'mycivicrmdb';

For the SQL read https://stackoverflow.com/questions/10169960/mysql-error-1449-the-user-specified-as-a-definer-does-not-exist
> 1 votes

# Answer
Check CIVICRM\_UF\_BASEURL in civicrm.settings.php file. If your site base url is like http://www.example.com then set the base url like below

define( 'CIVICRM\_UF\_BASEURL' , 'http://www.example.com/');

**Node** Don't forget to add www.
> 1 votes

# Answer
I ran into this problem today.

Initially I thought that it was a problem with define( 'CIVICRM\_UF\_BASEURL' , 'http://www.example.com/'); In my case I am using a secure https://www.example.com/ but my civicrm.settings.php has the stock non-secure http://www.example.com/.

That was not the case so I enabled troubleshooting to log errors to the drupal watchdog log.

The error that was logged indicated that the civicrm\_contact\_log table was corrupted.

Honestly I couldn't see the problem but I used the repair tool in PHPMyAdmin and it corrected whatever was going on.

I hope this helps someone else.

Andrew
> 0 votes

# Answer
I encountered this error today on the Events tab, following an upgrade, and it was because I had not executed the 'only\_group\_by' change required here https://docs.civicrm.org/sysadmin/en/latest/requirements/
> 0 votes

---
Tags: permissions, configuration, webserver, cms-integration
---


# Question
Title: WordPress "Billing Name and Address" fields block not displaying
On our contribution page, I can select the amount and confirm, but then on the final screen the Billing Name and Address fields block does not display at all.

# Answer
This site was hacked prior to me working on it. I ended up restoring a backed up version of the plugin folder and the "files" folder. Now everything is working fine.
> 1 votes

---
Tags: wordpress
---


# Question
Title: Help validating our proposed WordPress/CiviCRM solution!
Looking for some support from those that have experience with WordPress and CiviCRM to help confirm if what I'm looking to do here is feasible!

We are a small charity and currently putting together a budget to migrate to CiviCRM as well as redesign our front-end website. We typically get around 60 - 80k views per year. We have the idea of breaking out services and giving access to volunteers that need access to specific areas (Wordpress blogging/Mailchimp for Marketing etc) but also to automate as much as possible to reduce IT maintenance overhead.

We are looking at:

* **WordPress as preferred chosen CMS**: We find WordPress is easier to use for our volunteers than Joomla and Drupal. Plus, we are primary and information/storytelling charity so we prefer the experience for our content contributors over Joomla or Drupal.
* **Membership area**: We need to offer a paid yearly subscription for a locked off membership area to the website. It will include downloadable assets plus specific WordPress articles only available to paying subscribers. We'd need the associated forms to collect information about new members, and also send membership renewal emails etc. I understand this needs to sync with a WordPress membership plugins.
* **Donations**: We are looking to offer GoCardless for recurring subscription memberships as a primary method, and Stripe for one-off donations secondary.
* **List Sync with MailChimp**: We are looking to use MailChimp to create our newsletter and marketing automation. We'd like to be able sync paid/unpaid member lists from CiviCRM to MailChimp automatically.
* **Giftaid**: Automatically processing of giftaid application periodically.
* **Exporting to accounting software**: We haven't decided on our new accounting software yet but it will be something SaaS-based - possibly Sage Cloud or Xero.

Questions we have about the proposed solution above:

1. Will this work? We plan to do a mix of the work ourselves but also work with a freelancer with build experience.
2. I'm all for using open source, I'm just concerned around the stability of the platform with upgrades etc. Do people have stable implementations like this?
3. Are they any recommendations for Membership plugins on the WordPress side that work well with CiviCRM?
4. How do people export their donations to their accounting software for end of year financials? Is it straightforward to do?
5. Looking at either self-hosting it on Google Compute Engine or a VPS - or looking at a hosted solution. Does anyone have any suggestions?
6. How are people supporting their solution once it's live? Any suggestions on ad-hoc use of a freelancer vs paid support options with an SLA?

We currently run Joomla with a membership management plugin that is no longer supported, and a few other plugins for mailing/backup etc that are all really challenging to use - hence the reason for looking at a new solution with some investment and hopefully, longevity!

Hopefully - this all makes sense. Really appreciate any suggestions and shedding some light on questions and design. Thanks.

# Answer
> 3 votes
In general I would say that this sounds feasible. Your requirements sound similar to how many other charities are using CiviCRM. However, you have asked several detailed questions and I think you could benefit from discussing this in more detail with one of the CiviCRM partners (and/or posting these as separate questions).

I would also recommend that you attend a CiviCamp to find out more about how CiviCRM works and meet others in the community. We are a friendly bunch and you will get a lot out of meeting people face-to-face. I see that you are based in the UK and can highly recommend attending CiviCamp Manchester on 6 October 2018 if you are able to.

# Answer
> 1 votes
Totally agree with @William Mortada, do contact a CiviCRM partner and attend a CiviCamp so you get connected and become part of the CiviCRM community.

One detailed answer:

People can export their donations to the accounting software using the functionality to export a batch of financial transactions to CSV.

---
Tags: wordpress, evaluating-civicrm, donations, gift-aid-extension
---


# Question
Title: Does Extension Relationship Permissions as ACLs work on CiviCRM 5.2.3?
The Extension says it is Compatible with CiviCRM 4.7.

It seems to work with CiviCRM 5.2.3, but am I safe using it?

I did notice one side-effect - when this extension is enabled I can't edit the permissions on existing Relationships. The little AJAX spinner never stops. Is this a known effect, or is it related to the CiviCRM version?

# Answer
Email from the author says:

"Yes - it should work on the latest 5.x release. I'll remove the reference to 4.7 as 5.3 was a security release & \< 5.3 is not secure.
I merged changes recently that probably mean the current version needs 5.4+ - I'd have to check."
> 1 votes

---
Tags: permissions, relationships, compatiblity
---


# Question
Title: How to create latitude and longitude automatically for civirm contact
I want to generate latitude and longitude automatically for CiviCRM contact when the address is present.

How to achieve this?

# Answer
You need to enable Mapping and Geocoding from `civicrm/admin/setting/mapping?reset=1`

* Enter your API Key or Application ID. An API Key is required for the Google Maps API. Refer to developers.google.com for the latest information.
* Save the form and you should be able to see latitude and longitude based on your contact's address. Note that it displays when you click on inline edit and load the address form as shown below.

Also see https://docs.civicrm.org/user/en/latest/initial-set-up/mapping/
> 4 votes

# Answer
Welcome to Stackexchange. Take a look at the docs about geocoding and mapping. If you're using Google then you need an API key for geo coding requests. To get Google API key you can find information here.

Once you have api key navigate CiviCRM \>\> Administer \>\> System Settings \>\> Mapping and Geocoding and set the API key there.

After enabling the mapping provider, you may need to use this script to generate latitude/longitude information for existing contact addresses.

* Navigate to CiviCRM \>\> Administer \>\> Localization \>\> Address Settings. Update Address Editing section with Latitude, Longitude, and Street Address Parsing enabled

+ Enable cron job 'Geocode and Parse Addresses' by navigating to CiviCRM \>\> Administer \>\> System Settings \>\> Scheduled Jobs. With geocoding=1 and parse=0/1 in the Geocoding Parameters.

You can also use CiviCRM Geocoder extension which provides additional information about the address.

HTH

Pradeep
> 2 votes

---
Tags: contacts, addresses, geocoding, map
---


# Question
Title: Converted Drupal to WordPress: Network Error when trying to save changes
The site is working except that any attempt to change content (i.e., update a contact) results in

Network Error Unable to reach the server. Please refresh this page in your browser and try again.

I've verified that the database id/password is correct and has all privs.

I don't see anyplace where the old URLs might be.

Is there a way to debug this?

I've been through over a dozen similar question/answers without finding a solution.

# Answer
Dammit! The views code in the database saves the userid for the query, which changed when I moved things. There's a WordPress plugin that can fix it, though I exported the database and did a search/replace to change the old user to the correct one.
> 1 votes

---
Tags: wordpress
---


title: Send PDF email through CiviRules

text:
# Question
Title: Send PDF email through CiviRules
I am having trouble using CiviRules to send PDFs automatically using PDF API for CiviCR. Namely, when I create condition and I need to add action Send PDF there is *to email* parameter. I want this to be created dynamically like send Email action picks up email from contact automatically.

When I leave it blank the email doesn't go through.

> \[info\] Civirules api action exception: Mandatory key(s) missing from params array: to\_email. API call: Pdf.create with params: to\_email="", template\_id="74", contact\_id="752"

I can't insert a token into that field. So, am I missing something obvious or is this functionality intended for a totally different purpose?

# Answer
> 3 votes
I ended up hardcoding it so it uses $contact\['email'\] instead of $params\['to\_email'\]

I am leaving it open for some time, if anybody has a better idea (or if I missed something obvious)

UPDATE:

The developers of the extension included this feature. Using version 2.0 the PDF will be emailed to the associated contact if the to email field is left empty. So no need for hacks anymore. Big thanks to ErikH - CiviCooP

---
Tags: civirules, pdf
---


title: Add Custom Field to Core Field Group

text:
# Question
Title: Add Custom Field to Core Field Group
I'd like to add a custom field to the "core" demographics fieldgroup: the place of birth. I created a custom field, but I can't figure out, how to put it into demographics fieldgroup. Is it possible to do somehow?

Thanks.

# Answer
> 5 votes
You can use JS to move custom field from custom group accordian to demographics accordian.

https://docs.civicrm.org/dev/en/latest/framework/resources/

https://docs.civicrm.org/dev/en/latest/standards/javascript/

# Answer
> 5 votes
You may find this new feature could deliver what you need - the MIH is still open and nearly fully funded iirc

https://civicrm.org/blog/colemanw/want-to-customize-the-contact-summary-screen

---
Tags: custom-fields
---


# Question
Title: How to ensure end-of-period donations are recorded in the correct fiscal year?
Suppose an organization's fiscal year ends December 31st, 2018. Organizations which operate on an accrual rather than a cash basis (most, in my experience) would recognize a check dated December 30th, 2018, that was not received until January 4th, 2019, as a 2018 donation.

On CiviCRM contribution entry screens, there are two date fields. "Receipt Date," the date that a receipt was sent to the contributor, is irrelevant to this discussion. The other is labeled "Date Received" and described as "The date this contribution was received." If data entry staff were to take this language at face value, they would enter January 4th for the donation in question, which would result in reporting (or accounting sync) inconsistent with the organization's accounting basis.

An obvious workaround is for staff to be instructed to enter December 31st as the "Date Received" for such checks. Is anyone doing something better than this?

# Answer
CiviCRM 4.7 have accrual integration where you can specify Revenue recognition for a contribution. You can enable the 'Enable Deferred Revenue' setting by navigating to CiviCRM \>\> Administer \>\> CiviContribute \>\> CiviContribute Component settings.

Once you have enabled the setting you will need to create 'Deferred Revenue' relationship between Financial type and Financial Account.

On new contribution form once you have selected financial type you will revenue recognition field

Documentation : https://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+Data+Flow#CiviAccountsDataFlow-DeferredRevenueImprovements
> 2 votes

# Answer
Date Received as in date on the cheque (i.e. the date that someone started giving you the funds) works just fine.

All our larger organizations/clients do just that. I would recommend against making things more complicated by adding in additional / new / not much used functionality that you really don’t need to solve this problem.
> 2 votes

---
Tags: accounting
---


title: How to customise Shoreditch?

text:
# Question
Title: How to customise Shoreditch?
When I do a contact search with the default layout my screen shows 13 contacts - I then have to scroll to see the rest. When using Shoreditch, I can see only 4 contacts before scrolling because so much of the screen is taken up with title, header and other areas that are generous in size & perhaps not optimally located. This is on a newish laptop with a 15.4" HD screen (1920px x 1080), which must be a pretty common device. This is using Firefox, full screen. With Chrome, full screen, only 2 contacts are visible before you have to scroll! My guess is that the developers of Shoreditch have 26" screens on which the layout probably looks great!! But it really doesn't suit a smaller screen and for that reason I wouldn't change my clients to Shoreditch. Is there a way it can be customised to fix this problem ? - apart from tinkering with the CSS, that is. With Coleman's wonderful summary screen layout extension depending on Shoreditch, Civi may be unwittingly going down a route of excluding itself from smaller screens, like my laptop - and my client's laptops. That would be a bad mistake. By the way, in case you're thinking, 'make the font smaller' when I do this to the point where I can still just read the screen, I now can see only 7 contacts!

# Answer
Your question appears to be:

> When using Shoreditch, I can see only 4 contacts before scrolling. Is there a way it can be customised - apart from tinkering with the CSS, that is?

Shoreditch does nothing but modify the look of CiviCRM via CSS. So, if you're unhappy with the out-of-the-box layout, CSS is what you'll have to use to modify it.

FWIW, my opinion is that http://thereisnopagefold.com/ but I agree that Shoreditch still needs to implement some responsive design for smaller screens. I'm guessing that one of the issues holding this back is that core templates need to be modified to achieve this.
> 2 votes

---
Tags: shoreditch
---


# Question
Title: Group - Added (by Email) - how do i prevent this?
I have a contact which is a member of 2 groups and the status is "Added (by Email)" - i don't want this to be possible!

on the same day, the account i use for bulk email received a (no subject) email from the relevant contact to civimail+u.1421.81227.ac26f752ec18f10b@

The IDs of the groups in question are 14 and 10.

in civimail accounts i have a default "bounce processing" with localpart "civimail+" account which i understand is for all bulk sending.

I also have one without a localpart used for "email-to-activity" - i don't think i actually want this at all now i look, but it's there currently.

What is triggering the "added (by email)" group join, and how can i block it in the future? Thanks!

# Answer
Added (by Email) is normally added when a contact is added to the group using a subscription URL provided in any mail.

It is basically used to know how a contact was added to the group. This information is stored in `civicrm_subscription_history` table(`method` column) in civicrm database.

If you want to simply remove `Email` method from your DB, you can do it by a simple SQL -

```
UPDATE civicrm_subscription_history SET method = 'Web' WHERE method = 'Email'

```

To avoid it in future, you can proceed in writing an extension and a post hook which updates `civicrm_subscription_history` after a group contact is created.
> 2 votes

---
Tags: civimail, groups, bounce
---


# Question
Title: Contacts visible in mailing list group, not on hold or otherwise dnd, but skipped by mail out
I'm fairly sure I've worked out why this is happening, but want some input to confirm the problem, and hopefully pointers for fixing it.

We totally refreshed our main mailing list in line with GDPR, so we've been mailing about 2000 people with only a handful of bounces and unsubscriptions; now suddenly with our latest mail out, CiviCRM is only finding half of these people. Looking at the group, they're still there, and only a dozen of these are on hold due to bounces. Anyone who unsubscribed isn't counted towards the group total, so that's not the issue. Checking for duplication, it's not that we accidentally created 1000 duplicate contacts, so that's not the issue.

What has happened between this mail out and the previous one is that I've imported additional contact info for a lot of our contacts, and although the emails have been matched, so the contact records have been filled rather than duplicated, the newly imported emails have all been added as 'Home' - and the original email was 'Main', or 'Work', or 'Billing'...

Which is fine, if messy - lots of duplicated emails in records, but all the info is in the correct contact record. The problem - as far as I can work out - is that none of the emails have been marked as the one to be used for bulk mailings, and rather than default to the primary email for those contacts, CiviMail simply skips those contacts completely.

So, assuming I haven't missed something, it seems like the only option I have is to edit the database with something along the lines of 'if email is primary, set is bulkmail to yes' - given that my confidence in editing via sql is more or less nil, I'd be grateful for any pointers in carrying this out.

ETA: I’ve noticed that a couple of contacts which do have the bulk mail selected (both with two different emails to send the mail out to, rather than duplicate emails) also did not get sent the mail out, so it looks like setting the bulk mail email isn’t going to fix this...

(It also appears to happen with a smaller mailing list - nearly 100 contacts in the group, none on hold, but only 49 recipients indicated when you add that group to a new mail out)

ETA #2: Finally managed to pin this down to missing values in the is\_deceased field - all the contacts with newly imported data seem to have lost the value for this field, even though I'd set the import mapping to skip that field entirely (as I'd already ~~eliminated~~ removed any deceased contacts from the import). Resetting the field to 0 fixed the problem - everyone is now back on the recipients list...

I will add the fix as an answer :)

# Answer
> 2 votes
As I've added to my question, it turns out the problem wasn't with the emails or the DND settings - the missing contacts all had a NULL value for is\_deceased, and apparently CiviCRM interprets this as them being dead (rather than just missing information). When you edit the entire contact record, this is flagged, but because I was just checking the emails and DND settings in place, I hadn't noticed this.

Setting all the null values to 0 fixed the problem - I ran the following SQL query on the civicrm\_contact table:

UPDATE civicrm\_contact SET is\_deceased = 0 WHERE is\_deceased IS NULL;

(As per the answer here: https://civicrm.stackexchange.com/a/7396/610 )

Following that, all the relevant contact records reappeared in the mailing list recipient count.

(Double checking the import field mapping, it turns out I didn't tell it to skip that field - CiviCRM exports the field as empty if is\_deceased = 0, so I guess importing it did overwrite the existing values)

# Answer
> 0 votes
You have probably checked that already but you have to make sure that the contacts do not have a global opt out which is different from the subscription status of the group.

Have a look at the opt out flag:

---
Tags: civimail, email, import
---


# Question
Title: form to unsubscribe from a newsletter but from all
I wish to propose a form to allow a contact to unsubscribe from a newletter but not from the set to which it subscribes.

currently, the form I created unsubscribed from all newsletters.

It is possible? If yes, how ?

# Answer
> 1 votes
You should be able to do this by directing folk to eg www.yourdomain.org/civicrm/mailing/subscribe and if you have your Mailing List groups set up correctly (ie as public) then they should be able to unsub.

for folk using Drupal you can also do this via Webform

also review instructions at https://docs.civicrm.org/user/en/latest/email/set-up/

---
Tags: forms, newsletter
---


title: Ajax issues on WordPress

text:
# Question
Title: Ajax issues on WordPress
I think the issue is that Civi is (1) not enquing the versions of jQuery that come with WordPress and (2) the code is not written for noconflict mode.

```
?page=CiviCRM&q=civicrm/ajax/l10n-js/en_US&r=NJqDM:8 Uncaught TypeError: Cannot read property '_defaults' of undefined
at ?page=CiviCRM&q=civicrm/ajax/l10n-js/en_US&r=NJqDM:8
at ?page=CiviCRM&q=civicrm/ajax/l10n-js/en_US&r=NJqDM:103

```

?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:32 Uncaught ReferenceError: cj is not defined at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:32 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:192 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:192 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:208 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:208 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:259 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:259 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:400 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:400 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:403 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:403 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:563 Uncaught ReferenceError: cj is not defined at skipPaymentMethod (?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:563) at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:577 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:618 Uncaught TypeError: CRM.$ is not a function at ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:618 ?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2:621 Uncaught ReferenceError: cj is not defined

# Answer
You need to cross check each and every path configured in `Administer -> System Settings -> Resource URLs`. Set them as per your site configurations.

* CiviCRM Resource URL : is the URL path to your civicrm directory - Eg `http://example.org/wp-content/plugins/civicrm/civicrm`
* Image Upload URL: is the URL path where your image will be stored. Eg `http://example.org/wp-content/plugins/files/civicrm/persist/contribute`
* Extension Resource URL: is the URL path of the extensions used in your site.

Navigate to `Administer -> System Settings -> Directories` and set the path as per your needs.

* Image Directory: should be the same path as above(Image Upload URL) without the URL part. Eg `/var/www/site-name/wp-content/plugins/files/civicrm/persist/contribute`
* Extensions Directory: same path as set for extensions in the resource URL(without the URL part). Eg `/var/www/site-name/path/to/extensions/`

Similarly, set all the paths and check if it fixes your site display.
> 1 votes

---
Tags: ajax
---


# Question
Title: Best way to search through multiple postcode regions
I'm in the UK where the postcode regions are - well not exactly designed for the digital age shall we say? I need to group everyone in our database into 7 regions that fit our organisation's needs but the list of postcodes per region is very diverse.

See below for an example of the postcodes from one of our regions.

I'm about to create smart groups via search builder for postcode regions like below, but I know it's going to have 20+ lines in the search builder.

So, I wondered before I start whether there is a better way of doing this? I don't want complicated smart group criteria slowing down our server, since we already have quite a few. Or would these queries not really be an issue?

I'm on Drupal 7.56 and Civi 4.6.24, and about to upgrade to 4.7. I could use Drupal Rules, Views or possibly Search Sorts if they're likely to yield better results.

Each of our regions have a list of postcodes like follows:

Postcodes beginning with: S 25, S 35, S 36, S 60 – 66, S 70 -75, LN 7, DL, YO, LS, DH, SR, TS, HG, HU, DN, WF, HX, HD, BD, NE 1-13, NE 15 – 47, NE 61 – 64, NE 99 (There’s no NE 14)

Thanks for any thoughts!

# Answer
> 1 votes
In the end I used Search Builder with regular expressions on the post code field. It was quite efficient once I'd learnt the syntax for regex's!!!

In case it's helpful for anyone else, here's some example regex's for postcode searches:

Eg1: - find all strings that begin with S25: `^S25.*`

Meaning: `^` = start at the beginning of the string, `.*` = followed by any character, repeated any number of times

Eg2, Find all postcodes beginning with a string between NE15 to NE47:

```
^NE(1[5-9]|[23][0-9]|4[0-7]).*

```

Meaning: `^` = start at the beginning of the string, and find all strings that begin with NE. From there it finds all strings containing any number from 15-47:

`1[5-9]` = the number 1 followed by any number from 5 to 9 (ie 15-19), OR, `[23][0-9]` = The number 2 or 3 followed by any number from 0 to 9 (ie 20 - 39), OR, `4[0-7]` = The number 4 followed by any number from 0 to 7 (ie 40-47), `.*` = any character, repeated zero or any number of times.

Numeric ranges have no meaning inside text string searches like Regex, so they have to be constructed as above. I found this online tool to generate them automatically: http://gamon.webfactional.com/regexnumericrangegenerator/

Eg3: Place many postcodes searches on one line of regex in search builder:

```
(^S25.*)|(^TS.*)|(^HG.*)|(^HU.*)|(^DN.*)|(^WF.*)|(^HX.*)|(^HD.*)|(^BD.*)

```

This finds all postcodes beginning with S25, or TS, or HG, or HU, etc etc.

Hopefully that's helpful.

# Answer
> 1 votes
Yes, I agree that RegEx is a good way to solve this. Here's my Search Builder RegEx to select all contacts with postcodes in Scotland, for example:

```
^(AB|DD|DG|EH|FK|G|HS|IV|KA|KW|KY|ML|PA|PH|TD|ZE)[0-9].*

```
* I'm using a list of Postcode Sectors (the initial letters) retrieved here: https://en.wikipedia.org/wiki/Category:Postcode\_areas\_covering\_Scotland;
* Following the list with **\[0-9\].\*** ensures that postcodes within **G** (Glasgow sector) are found but **GL** (Gloucester sector, for example) are not;
* Although using **\d** to find a digit is accepted by Search Builder it fails to find anything so has to be expanded to **\[0-9\]** instead. (I've not fully investigated this unexpected feature.)

This contribution is late to the party here but I hope it will be useful to someone.

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


# Question
Title: CRM API shows only the first char of the result?
I'm absolutely embarrassed. I try to get value as it in this thread (and sorry for the wrong use of the topic).

I try get a custom value via CRM API. With the API Explorer I can create the expression:

```
{crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
{foreach from=$result.values item=contact}
  {$contact.some_field}
{/foreach}

```

I can see the right result in the API Explorer. I insert it as it is into my tpl file, and I get back only the first character of the result.

What do I wrong?

# Answer
Since you are using getvalue, $result will be the contact's custom\_13 value, so you don't need a foreach loop.

Try using below snippet

```
{crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
Custom 13: {$result}

```

Pradeep
> 4 votes

---
Tags: custom-fields, api
---


title: submit button onclick

text:
# Question
Title: submit button onclick
First time using civicontribute. We get a transaction error when submitting a donation. (see below) Our donation form submit button has: onclick="return submitOnce(this,'Main','Processing');"

Other people with similar pages do not have an onclick function. Is that the cause of our problem? Should we have it? If not, how do we get the page to be rendered without it?

Here is the error message we get when clicking submit.

"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: unknown error Return to home page.

Fatal error: Uncaught CRM\_Core\_Exception: \[0: Transaction integrity error: Expected to find active frame thrown in .../wordpress/wp-content/plugins/civicrm/civicrm/Civi/Core/Transaction/Manager.php on line 107"

# Answer
> 2 votes
Problem solved - after updated mariaDB following Uncaught CRM Core\_Exception Transaction/Manager.php

and re-installed stripe.

---
Tags: civicontribute
---


# Question
Title: Difficulties generating an entity's DAO and SQL for a new extension
I have been trying to generate DAO and SQL files for an entity I created with `civix generate:entity ...` according to the documentation ("Add a new entity" - 4.d.).

Using the latest civicrm-core clone (latest commit e637260) I:

1. ran `composer install` on the root (civiroot);
2. verified that the vendor folder has the same packages that come along with, for example, CiviCRM 4.7.20 for Drupal 7.x (`sites/all/modules/civicrm/vendor`);
3. copied the new entity's schema to the `xml/schema` folder;
4. altered the `Schema.xml` itself to include this entity.

However, after running `bash bin/setup.sh -g` or `php xml/GenCode.php` this comes up:

> Fatal error: require\_once(): Failed opening required 'Log.php'

I.e. `<root>/CRM/Core/Config.php` is expecting:

```
require_once 'Log.php';
require_once 'Mail.php';

```

I searched for a while and I could not find these files, so I just thought of trying it out without these lines from `Config.php`, but once I rerun I got:

> Notice: Use of undefined constant *PEAR\_ERROR\_CALLBACK* \- assumed 'PEAR\_ERROR\_CALLBACK' in `<root>/CRM/Core/TemporaryErrorScope.php` on line 49
>
> Notice: Undefined index: \_PEAR\_default\_error\_mode in `<root>/CRM/Core/TemporaryErrorScope.php` on line 74
>
> Notice: Undefined index: \_PEAR\_default\_error\_options in `<root>/CRM/Core/TemporaryErrorScope.php` on line 75
>
> Warning: require\_once(**PEAR/ErrorStack.php**): failed to open stream: No such file or directory in `<root>/CRM/Core/Error.php` on line 36
>
> Fatal error: require\_once(): **Failed opening required 'PEAR/ErrorStack.php'** (include\_path='`.:<root>:<root>/packages:<root>/vendor/tecnickcom:<root>/vendor/phpseclib/phpseclib/phpseclib:<root>/vendor/pear/pear_exception:<root>/vendor/pear/auth_sasl:<root>/vendor/pear/validate_finance_creditcard:.:../packages:..`') in /CRM/Core/Error.php on line 36

I did find a PEAR folder but it is in `<root>/vendor/pear/pear_exception/PEAR`, without any `ErrorStack.php` file.

I also found a couple of related questions in here:

In the last one, I understand that people seem to run the code generator without such problems.

I apologize the long question, **TLDR;**

* what am I missing? What does `GenCode.php` need in order to run properly?
* is there another way to generate DAO and SQL files for new entities?

# Answer
`civix generate:entity` is experimental and, last I checked, broken.

When I need to do this, my approach is as follows:

1. create my XML file for the new entity
2. run a helper script to generate the SQL and DAO

Have a look at the helper files in CiviVolunteer for guidance; they should work for any project with minimal modification.
> 1 votes

# Answer
`civix` is now capable of generating the SQL and DAO with: `civix generate:entity-boilerplate`. The civix documentation gives more info.
> 1 votes

---
Tags: mysql, civicrm-entity, core, civix
---


# Question
Title: Cannot submit new contributions through webpage - One of the parameters (value:) is not of type integer
We're seeing the error 'One of the parameters (value:) is not of type integer' when submitting a new donation through a contribution page on CiviCRM 5.4.1. All custom templates have been removed so it should only be using the core Civi files. Here's the backtrace. Has anyone seen this or have any thoughts on the cause or resolution?

backTrace

```
0 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(377): CRM_Core_Error::backtrace()

1 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Type.php(554): CRM_Core_Error::fatal("One of parameters  (value: ) is not of the type Integer")

2 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1500): CRM_Utils_Type::validate("", "Integer")

3 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1464): CRM_Core_DAO::composeQuery("SELECT COUNT(*) as total FROM civicrm_membership WHERE contact_id = %1 AND me...", (Array:1), TRUE)

4 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/CivirulesConditions/Membership/ContactHasMembership.php(57): CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) as total FROM civicrm_membership WHERE contact_id = %1 AND me...", (Array:1))

5 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Engine.php(279): CRM_CivirulesConditions_Membership_ContactHasMembership->isConditionValid(Object(CRM_Civirules_TriggerData_Post))

6 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Engine.php(241): CRM_Civirules_Engine::checkCondition((Array:5), Object(CRM_Civirules_TriggerData_Post))

7 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Engine.php(27): CRM_Civirules_Engine::areConditionsValid(Object(CRM_Civirules_TriggerData_Post))

8 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Trigger/Post.php(90): CRM_Civirules_Engine::triggerRule(Object(CRM_Civirules_Trigger_Post), Object(CRM_Civirules_TriggerData_Post))

9 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Trigger/Post.php(75): CRM_Civirules_Trigger_Post->triggerTrigger("create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment))

10 /var/www/wp-content/plugins/files/civicrm/ext/org.civicoop.civirules/civirules.php(225): CRM_Civirules_Trigger_Post::post("create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment))

11 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(282): civirules_civicrm_post("create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment))

12 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(155): CRM_Utils_Hook->runHooks((Array:5), "civicrm_post", 4, "create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment), NULL, NULL)

13 /var/www/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(98): CRM_Utils_Hook_WordPress->invokeViaUF(4, "create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment), NULL, NULL, "civicrm_post")

14 [internal function](): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\PostEvent), "hook_civicrm_post", Object(Civi\Core\CiviEventDispatcher))

15 /var/www/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func((Array:2), Object(Civi\Core\Event\PostEvent), "hook_civicrm_post", Object(Civi\Core\CiviEventDispatcher))

16 /var/www/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:2), "hook_civicrm_post", Object(Civi\Core\Event\PostEvent))

17 /var/www/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php(167): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("hook_civicrm_post", Object(Civi\Core\Event\PostEvent))

18 /var/www/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch("hook_civicrm_post", Object(Civi\Core\Event\PostEvent))

19 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(366): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_post", Object(Civi\Core\Event\PostEvent))

20 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/MembershipPayment.php(71): CRM_Utils_Hook::post("create", "MembershipPayment", "15556", Object(CRM_Member_DAO_MembershipPayment))

21 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Member/BAO/Membership.php(1825): CRM_Member_BAO_MembershipPayment::create((Array:3))

22 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1592): CRM_Member_BAO_Membership::linkMembershipPayment(Object(CRM_Member_BAO_Membership), Object(CRM_Contribute_BAO_Contribution))

23 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1405): CRM_Contribute_Form_Contribution_Confirm->postProcessMembership((Array:71), "12546", Object(CRM_Contribute_Form_Contribution_Confirm), (Array:49), (Array:0), (Array:3), (Array:13), (Array:1), TRUE, NULL, FALSE, "2", (Array:1), TRUE)

24 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2426): CRM_Contribute_Form_Contribution_Confirm->processMembership((Array:60), "12546", (Array:0), (Array:3), (Array:49), (Array:1))

25 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2301): CRM_Contribute_Form_Contribution_Confirm->doMembershipProcessing("12546", (Array:60), (Array:49), (Array:1))

26 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(722): CRM_Contribute_Form_Contribution_Confirm->processFormSubmission("12546")

27 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(489): CRM_Contribute_Form_Contribution_Confirm->postProcess()

28 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()

29 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next")

30 /var/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")

31 /var/www/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next")

32 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")

33 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller->run((Array:3), NULL)

34 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84):
CRM_Core_Invoke::runItem((Array:15))

35 /var/www/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52):         CRM_Core_Invoke::_invoke((Array:3))

36 /var/www/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:3))

37 /var/www/wp-content/plugins/civicrm/includes/civicrm.basepage.php(141): CiviCRM_For_WordPress->invoke()

38 /var/www/wp-includes/class-wp-hook.php(286): CiviCRM_For_WordPress_Basepage->basepage_handler(Object(WP))

39 /var/www/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))

40 /var/www/wp-includes/plugin.php(515): WP_Hook->do_action((Array:1))

41 /var/www/wp-includes/class-wp.php(726): do_action_ref_array("wp", (Array:1))

42 /var/www/wp-includes/functions.php(960): WP->main("")

43 /var/www/wp-blog-header.php(16): wp()

44 /var/www/index.php(17): require("/var/www/wp-blog-header.php")

45 {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. One of parameters (value: ) is not of the type Integer

# Answer
> 1 votes
From the backtrace, it looks like the error pops up from the `civirules` extension enabled on your site. Make sure you have updated it to the latest version available at https://civicrm.org/extensions/civirules

---
Tags: civicontribute
---


# Question
Title: Allow users other than Administrator to view report details
We are using civi 5.4.1 on Wordpress 4.9. We want to allow users other than Administrator the ability to view reports and click on the names in the reports to view that contacts details.

Currently if the User searches, they can click on the names with no problems, but if it's a report, they can only view the list, if they click on the name they get the below error message. Is this a permission issue?

# Answer
> 2 votes
I found the issue, although it is a little confusing. First I gave all permissions to the role and it worked, then I started working back to find out which permission needed to be checked. It turns out that this one **"CiviCRM: access deleted contacts "** is the one that must be checked for other roles to view the details in a report. Weird.

---
Tags: wordpress, permissions, reports
---


# Question
Title: What does the 'access_civicrm_nav_link' permission allow?
I'm currently reviewing the permissions for a CiviCRM/WordPress site. Some of the user roles have the 'access\_civicrm\_nav\_link' permission but I'm not sure what this is used for. I couldn't find any documentation for it except for a reference to it in one of the WordPress integration files:

/CRM/ACL/Form/WordPress/Permissions.php

Am I right in thinking that this permission dates back to an earlier version of CiviCRM and is no longer used?

Is it safe to remove this permission from the user roles?

CiviCRM 4.6 / WordPress 4.5

# Answer
> 2 votes
If you do a search at https://github.com/civicrm/civicrm-core and https://github.com/civicrm/civicrm-wordpress there's a note about it being changed and the lack of search results indicate it's no longer used.

EDIT: At github you can go back as far as v4.4 and see that it's not used, and while the old svn repo is no longer available you can see from https://issues.civicrm.org/jira/browse/CRM-12731 that it was used at that point and possibly even removed as part of that issue, somewhere around 4.2.

---
Tags: permissions
---


# Question
Title: How to create and fetch custom URL for advanced search?
I like to search for very specific parameters, the resulting URL's look like this:

http://localhost/crm4/civicrm/contact/search/advanced?\_qf\_Advanced\_display=true&qfKey=5aa3233e9b46c807b76a536cee723745\_4637

Now I would like to save that URL and create a menu link for it, but it keeps changing dynamically...

How can I do that? Save it as a custom search?

# Answer
> 3 votes
\[SOLVED\]

Solution is over here:

http://brunovincent.net/data/how-to-add-custom-search-url-links-to-civi-crm-advanced-search/

# Answer
> 2 votes
Normally if you want to save an Adv Search you save it as a Smart Group

we have done a lot of work for a client to make various parameters available for links to preload on Adv Search - the PR is here - https://github.com/civicrm/civicrm-core/pull/12455

---
Tags: search
---


# Question
Title: CiviCRM Page Not Found Error After Copying Site to New Server
I wanted to do some testing on my CiviCRM site (on Drupal) and so copied everything over to another server. I am using CiviCRM 5.3.1 with Drupal 7.59.

I followed the steps in the "Moving an Existing Installation to a New Server or Location" guide but after re-enabling CiviCRM, when I try to navigate to any CiviCRM page I get an error in Drupal saying "Page Not Found". The CiviCRM menu link does appear in the admin menu and no errors are showing when I enable the CiviCRM module.

I have removed all the log files including the Config.IDS.ini file from the ConfigandLog folder, as well as emptying the templates\_c folder. I did copy the civicrm.settings.php file over, but have updated all the paths in this file as well as updating all the entries in settings.php. I aslo emptied all the cache tables in the Civi database.

I have not been able to review and update directory paths and base URLs because of the page not found error. Not sure if I am able to do this using Drush?

I have checked the error logs for any clues, but haven't found any. There is one javascript error which comes up, which I'm not sure is relevant or not:

> index.php?q=civicrm/admin:1 Refused to execute script from 'http://.../civicrm/ajax/l10n-js/en\_US?r=4hXrp' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Seems like I have missed something but I don't know what!

# Answer
> 3 votes
We Always make a tar.gz from all the files, and a database backup of the drupal database and the civicrm database, without disabeling any modules. The we extract the files on the new location, and give the files and folder the right permissions (in most case 755 is good and do not forget the .htaccess). Then we ajust the settings.php and the civicrm.settings.php, with the correct paths and database connection information. Than we change the "Temporary directory" in the "File system" in drupal, and the paths in "Directories", "Resource URL's" and "Cache" in civicrm. Clear the cache again and that's it!

Don not change anything on your current website!

* cd /var/www/html
* tar cvzf mywebsite.tar.gz mywebsite/
* mysqldump -u database\_user\_drupal -p database\_name\_drupal \> database\_name\_drupal.sql
* mysqldump -u database\_user\_civicrm -p database\_name\_civicrm \> database\_name\_civicrm.sql Copy everything to the new server and do
* tar -xvf mywebsite.tar.gz
* cp -rf mywebsite/ /var/www/html/mywebsitelocation
* chown -R username:www-data /var/www/html/mywebsitelocation/
* chmod -R 755 /var/www/html/mywebsitelocation (or 775 for testing)
* check the username of the DEFINER in the database\_name.civicrm.sql
    + with: sed -n '/DEFINER/p' database\_name.civicrm.sql
    + remove it with: sed -i 's#DEFINER=`username`@`%`\# #g' database\_name.civicrm.sql (replace username)
    + and: sed -i 's#DEFINER=`username`@`localhost`\# #g' database\_name.civicrm.sql (replace username)
    + and: sed -i 's#SQL SECURITY DEFINER#SQL SECURITY INVOKER#g' database\_name.civicrm.sql
* mysql -u new\_database\_user\_drupal -p new\_database\_name\_drupal \< database\_name\_drupal.sql
* mysql -u new\_database\_user\_civicrm -p new\_database\_name\_civicrm \< database\_name\_drupal.sql
* nano /var/www/html/mywebsitelocation/sites/default/settings.php
    + change the "$databases = array (" change the "$base\_url =" (if set)
* nano /var/www/html/mywebsitelocation/sites/default/civicrm.settings.php
    + change "define( 'CIVICRM\_UF\_DSN'"
    + change "define('CIVICRM\_DSN'"
    + change "$civicrm\_root ="
    + change "define( 'CIVICRM\_TEMPLATE\_COMPILEDIR'"
    + change "define( 'CIVICRM\_UF\_BASEURL'"
    + we do not use the "$civicrm\_setting\['Directory Preferences'\]" settings and "$civicrm\_setting\['URL Preferences'\]" settings in the civicrm.settings.php
* change the "Temporary directory" in the "File system" in drupal
* clear the cache, use the button in drupal
* "Reset Paths" on "civicrm/admin/setting/updateConfigBackend?reset=1"
* and you can clear the cache in civicrm also with the button on "civicrm/admin/setting/updateConfigBackend?reset=1"

---
Tags: drupal, error, installation, webserver
---


title: How to use civiprofile for contact form

text:
# Question
Title: How to use civiprofile for contact form
I want to use a civi profile for our contact form, so that all inquiries and new contacts are stored in civi. I created the custom fields and have them on a new tab and table, so multiple submissions will be stored. I am having two problems.

1. When the profile form is submitted it arrives in email with our organization's email address as the From address. Can I set this so the person who submitted it is the From address?
2. We would like to show the date it was submitted on in the table, but the only option I can find is for the user to select the date manually before submitting it. Is there a way to have the current date already pre-selected in view only mode on the profile?

Civi 5.3 on wordpress 4.9

# Answer
> 1 votes
Neither of those are doable with a profile without writing an extension. However, both should be quite doable using Caldera Forms with the CiviCRM integration plugin. I suspect you could also use Contact Form 7 with the Form Processor plugin to get similar results.

---
Tags: wordpress, custom-fields, profile
---