# Question
Title: Find and merge duplicate contacts error: "this is incompatible with sql_mode=only_full_group_by"
When I try to use "Contacts \> find and merge duplicate contacts" (using the default rule) I get an error. Something to do with "subunion.weight" see error trace below.

Anyone able to advise? tia

Database Error Code:

```
Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'subunion.weight' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by, 1055
Additional Details:
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => INSERT INTO dedupe (id1, id2, weight) SELECT id1, id2, weight FROM (SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND t1.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)
        UNION SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND  t2.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)) subunion GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1055 ** Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'subunion.weight' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by]
    [type] => DB_Error
    [user_info] => INSERT INTO dedupe (id1, id2, weight) SELECT id1, id2, weight FROM (SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND t1.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)
        UNION SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND  t2.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)) subunion GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1055 ** Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'subunion.weight' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO dedupe (id1, id2, weight) SELECT id1, id2, weight FROM (SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND t1.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)
        UNION SELECT t1.contact_id id1, t2.contact_id id2, 10 weight FROM civicrm_email t1 JOIN civicrm_email t2 USING (email) WHERE t1.contact_id < t2.contact_id AND t1.email IS NOT NULL AND t1.email <> '' AND  t2.contact_id IN (111,970,2435,2545,2626,2692,2703,2750,2765,3035,3132,3159,3312,3407,3452,3597,3850,3865,3879,3889,4026,4470,4607,4626,4627,4885,5531,5795,5807,6073,6406,6415,7202,7423,7572,7583,7749,7819,7945,8076,8768,8787,8867,8877,9051,9913,9968,10096,10138,10283,10292,10348,10358,10377,10505,10524,10526,10550,10634,10775,10806,11216,11340,12540,12780,12806,12860,12923,13366,13413,13437,13526,13539,13544,13641,13715,13727,14000,14002,14451,14754,14766,14776,14812,14833,15137,15364,16149,16150,16263,16349,16362,16366,16402,16462,16615,16705,16729,16731,16785,16818,16950,16985,17080,17128,17341,17434)) subunion GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1055 ** Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'subunion.weight' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by]"]
)

```

# Answer
> 1 votes
The error suggests that on your MySQL database the `sql_mode` is set to `only_full_group_by` . This is a new feature of MySQL 5.7 and enabled by default. CiviCRM is able to handle this from version 4.7.10.

More information is found at https://issues.civicrm.org/jira/browse/CRM-18439 .

---
Tags: duplicate-contacts, mysql-5.7
---


# Question
Title: How can I merge two memberships in the same contact (without losing contribution info, etc)?
Occasionally, we end up with a single contact that has two membership records (e.g., an old expired one and a newer current one). I would like to programmatically merge the two memberships cleanly, so that, for example, the remaining membership gets the oldest start date, the current membership type, all contributions are retained, etc. Have browsed Dedupe.php looking for a call that might do this, but to no avail. Any suggestions?

# Answer
Currently there's no support for what you're describing built in to CiviCRM. You could implement this with API calls in an extension. If you do, please consider submitting it to the extensions directory!
> 3 votes

# Answer
I’ve started to work on a patch for CiviCRM (as it’s not that simple to implement this as an extension). The work-in-progress PR is available here. Comments and feedbacks are welcome ;)

Olivier;
> 3 votes

---
Tags: civimember
---


# Question
Title: Hosting a paid event with a member ticket and a non-member ticket
Consider the following situation. Martin is a member of our non-profit organization and would like to register for a seminar that we host. We offer either a member ticket of $150 and a non-member ticket of $250. Obviously, Martin opts for the member ticket. How does CiviCRM control whether Martin is indeed a member and is allowed to register for the $150 ticket?

# Answer
You could use the cividiscount extension and set up automatic discounts of $100 on the relevant events based on membership. Non-members pay $250, those with the automatic membership discount pay $150. Members need to log in before booking so that their membership status is known.
> 2 votes

---
Tags: wordpress, civievent, civimember, registration
---


# Question
Title: If statement involving "is not empty" in smarty template?
How do I do this in a Smarty template:

If {contact.supplemental\_address\_1} is not empty then

{contact.supplemental\_address\_1}

# Answer
```
{capture assign=temp}{contact.supplemental_address_1}{/capture} {if $temp ne ""} {$temp}
{/if}

```

is what I do. I got the idea from the source referenced above. You also need to ensure that smarty is turned on in civicrm.settings.php
> 4 votes

# Answer
Found a whole bunch of examples - including an isset one in Example 7.15

https://www.smarty.net/docsv2/en/language.function.if.tpl
> 1 votes

# Answer
A little cleaner approach

```
{if $contact.supplemental_address_1}{contact.supplemental_address_1}{/if}

```
> 1 votes

---
Tags: smarty
---


title: Change text for "Continue" button

text:
# Question
Title: Change text for "Continue" button
How do I go about changing out the text on the confirmation page for events so that it says something different? Right now it says "Continue" and we'd like it to say something like "Continue to pay via Paypal". I've been digging through the template files and can't find where I would change that.

# Answer
You can use the Word Replacement function for this! Here’s a nice tutorial: https://www.cividesk.com/blog/did-you-know-any-word-or-phrase-civicrm-can-be-replaced-another-one
> 5 votes

# Answer
If you're using WordPress, you can write a quick plugin to do this. The following code amends the submit button's text value on the Registration Confirmation form:

```
add_action( 'civicrm_buildForm', 'my_prefix_alter_form_button', 10, 2 );

/**
 * Amend the Registration Confirmation form submit button value.
 *
 * @param string $formName The name of the form.
 * @param CRM_Core_Form $form The form object.
 */
function my_prefix_alter_form_button( $formName, &$form ) {

    // bail if not the form we want
    if ( $formName != 'CRM_Event_Form_Registration_Confirm' ) return;

    // drill down until we find the submit element and change its value
    foreach( $form->_elements as $element ) {
        if ( isset( $element->_name ) && $element->_name == 'buttons' ) {
            foreach( $element->_elements as $item ) {
                if ( isset( $item->_type ) && $item->_type == 'submit' ) {
                    if ( isset( $item->_attributes ) && $item->_attributes['name'] == '_qf_Confirm_next' ) {
                        $item->_attributes['value'] = __( 'Continue to pay via Paypal', 'my-plugin-slug' );
                    }
                }
            }
        }
    }

}

```

You can adapt this methodology to work with Drupal too. You'd have to create a module with an appropriately-named function, but the code inside the function should be identical. Here's the code to add to a Drupal module:

```
/**
 * Amend the button value.
 *
 * @param string $formName The name of the form.
 * @param CRM_Core_Form $form The form object.
 */
function my_module_prefix_civicrm_buildForm( $formName, &$form ) {

    // bail if not the form we want
    if ( $formName != 'CRM_Event_Form_Registration_Confirm' ) return;

    // drill down until we find the submit element and change its value
    foreach( $form->_elements as $element ) {
        if ( isset( $element->_name ) && $element->_name == 'buttons' ) {
            foreach( $element->_elements as $item ) {
                if ( isset( $item->_type ) && $item->_type == 'submit' ) {
                    if ( isset( $item->_attributes ) && $item->_attributes['name'] == '_qf_Confirm_next' ) {
                        $item->_attributes['value'] = t( 'Continue to pay via Paypal' );
                    }
                }
            }
        }
    }

}

```

You need to substitute `my_module_prefix` with the actual prefix of your module so that the function receives callbacks from the hook.
> 5 votes

# Answer
Try changing the value with Javascript - as in:

```
document.getElementById("_qf_Confirm_next-top").value="Continue to pay via PayPal";

```

and something similar (but not the id is different) for the button at the bottom of the page.

Adding JavaScript - since this is a front-facing public Event registration page - I like adding it to the theme js.
> 3 votes

# Answer
This might not be a complete solution, but the text for the button is coded in `[civicrm.root]/CRM/Event/Form/Registration/Confirm.php` at line 305 in version 4.7.22 (and 4.7.27)

```
$contribButton = ts('Continue to pay via Paypal');
$this->addButtons(array(
    array(
      'type' => 'back',
      'name' => ts('Go Back'),
    ),
    array(
      'type' => 'next',
      'name' => $contribButton,
      'isDefault' => TRUE,
      'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"),
    ),
  )
);

```

Replace the first line with

```
if ($this->_allowWaitlist) {
    $contribButton = ts('Continue');
} else {
    $contribButton = ts('Continue to pay via Paypal');
}

```

The if statement is needed because the same code is used for confirmation of addition to the wait list.

Caveat is that I haven't checked that there are no effects elsewhere (unlikely as its in something called confirm.php) and that I'm not really a coder so would welcome confirmation that this is right (but it seems to work). But I'm quite proud of getting this far.

If I get the bounty then I can put one on one of my problems!
> 1 votes

---
Tags: civievent
---


# Question
Title: How to see "How often do people log in"?
Is there a way to see in civicrm that How often do people log in or to list the users who logged at least once in last 2 months? I have look advanced search but I couldnt find any criteria for this?

Note: I am using CiviCRM 4.7.12

# Answer
> 1 votes
**Drupal Views - CiviCRM integration** will let you combine Drupal data (e.g. Username, Role, Last Login) - with CiviCRM data (e.g. Source of Contact). I've trimmed the screenshots to strip out CiviCRM Sort Name, and Email address for privacy reasons.

To figure out who has logged in in the last 2 months - would then simply be a Filter on User: Last Login; If you'd like to filter by Group -\> you can do that here too;

If you don't already use Views -\> in CiviCRM Core -\> Administer -\> System Settings -\> CMS Database Integration;

# Answer
> 0 votes
There is no way in CiviCRM to see the login date out of the box. If you are using Drupal as a a CMS you can navigate to yourdomain.org/admin/people and see the time of the last login of a user.

There are also modules that allow you to have more information regaidng logins such as "Login History"

Not sure if/how that is possible with Wordpress or Joomla.

Finally, you can probably find out the time of the last login using SQL queires but this is probably not what youu had in mind.

---
Tags: drupal-views, user, logs
---


# Question
Title: How to stop CiviCRM deleting a scheduled follow up activity when the original activity is deleted
Apologies if this has been asked before. It's been a long day and I can't see anything similar in search results.

When using schedule follow up activity to create an activity, the follow up activity is deleted when the original is deleted. (Currently happening in 4.6)

I've not seen this happening on other installs (then again, I've never looked).

Is there a way to stop this happening, a magic button I'm overlooking?

# Answer
This is coming from the db schema. There's a delete cascade constraint on parent\_id. You could remove that constraint but it might be used elsewhere for different types of activity-pairing (not followup related) to enforce data consistency. Would have to review all the activity-related code that uses parent\_id. It's also possible that parent\_id for this pair of activities is never used again anywhere, so another possibility is remove that linking for followups (via some code, either override or extension), but again would need to review.
> 1 votes

---
Tags: activities, scheduled-follow-up
---


# Question
Title: Can I access/create InnoDB tables in the database
I have a WordPress website on my server. I have installed CVCRM plugin on that site. I have configured database name, MySql server, and user credentials. When I click on check requirements button in the connection setting page I am getting an error like this " Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server ". We installed CiviCRM WP Plugin version 4.1.0. Can anyone help me with this issue?

Thanks & Regards Surya

# Answer
> 1 votes
CiviCRM requires InnoDB support. It sounds like your MySQL server is not currently configured to provide this. If you have control over your MySQL server you should be able to enable this. If you don’t have control talk to your hosting provider to get it enabled.

Best practice is to have a separate database for CiviCRM.

---
Tags: wordpress
---


# Question
Title: How do I get Retrospective feedback for an event using a Webform (participant Custom Data)?
Is there a way to get 'retrospective' feedback from participants for an event?

I'm struggling to find any way to access Custom (or any) participant fields without the form becoming one for Registration of an event - at which time they are not going to be avle to give feedback.

Does anyone have any knowledge of how to get Custom Participant fields into webforms when not registering the users?

Any light shed would be much appreciated.

Thanks!

# Answer
OK - I have it, for this I've set up a Scheduled Job that fires off to "attended" participants a few days after the event. I set up a smart group of "participants whos participatory date was after \[a month ago\]" so i didn't spam older participants, and used the group as an "include" filter.

Set up an event, of the right type, so that it would get fired.

Added contacts to the event (and gave them the "Attended" status.

Created the webform and including (from the CiviCRM tab):

* existing contact
* firstname
* lastname
* contact ID
* checksum

then in the "Event Registration" section

* show past events: all
* Registration Options \> Disable unregistering participants: yes
* Registration Options \> Allow events populated from URL: yes
* under Contact1
* no of event sets for contact1: 1
* event(s): User Select
* & any needed participant custom fields

and build the checksummed url:

> http://example.com/node/xxx?event1={event.event\_id}&cid={contact.contact\_id}&checksum={contact.checksum}

think that's it. let me know if I missed a bit (or did anything stupid!) and I'll correct it.
> 2 votes

# Answer
How about:

* Find all your Event Participants in CiviCRM -\> Email them a link to a Webform\_CiviCRM that contains a checksum token to invite them to the Survey
* On that Webform\_CiviCRM -\> create your Questions - Consider not storing this data in CiviCRM -\> with native Webform Elements you can do awesome surveys -\> with Grid widgets (e.g.: indicate your excitement level about Webform\_CiviCRM from: 'not at all excited' to 'moderately excited' to 'super exicited');
* Furthermore you can easily chart your Webform Surveys with other modules like - Google Charts - for example: here's a four point grid question where 1 was defined as 'does not meet expectations' to 4 was defined as 'exceeds expectations'
> 0 votes

---
Tags: civievent, webform-civicrm, participants
---


title: Drupal/CiviContribute & Metatags

text:
# Question
Title: Drupal/CiviContribute & Metatags
We are running Drupal 7 and the Metatag module, which is working as intended on the rest of the site.

While our contribution pages are working fine, they do not contain the description and keyword meta tags that appear on the other pages on our site.

Can someone point me in the right direction to get this functioning?

Thank you! Rachel

# Answer
To anyone else trying to do this:

* Install/enable Metatag module
* Install/enable Context module
* Enable Metatag:Context submodule

In Metatag module settings you will now be able to enter either the path or the query string to set the tags. To make query strings work, you will also need to configure those in the Context module setup.
> 1 votes

---
Tags: drupal, civicontribute, contribution-page
---


# Question
Title: Upgrade from 4.7.14 to 4.7.15 failed on Database Upgrade
I tried to upgrade from 4.7.14 to 4.7.15 today. I followed the instructions 1 - 3 in the documentation.

Everything looked good up to that point. I got a message that installation was successful.

Then I clicked on the link to run the Database Upgrade, but I forgot to do step 4: delete the cached files in

```
   [yoursite]/media/civicrm/templates_c

```

I got the following error:

```
Initialization Error

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => simpleHandler
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => SELECT *,  config_backend, locales,         locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1054 ** Unknown column 'config_backend' in 'field list']
    [type] => DB_Error
    [user_info] => SELECT *,  config_backend, locales, locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1054 ** Unknown column 'config_backend' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19     mode=callback callback=CRM_Core_Error::simpleHandler prefix="" info="SELECT *,      config_backend, locales, locale_custom_strings
 FROM civicrm_domain

 WHERE (  civicrm_domain.id = 1 )

 [nativecode=1054 ** Unknown column 'config_backend' in 'field list']"]
)

```

At that point, I noticed that I hadn't deleted the cached files, and so I deleted them.

I tried to re-install 4.7.15, and again, I got a 'success' message. When I went to run the Database Upgrade, I got the same error as above.

I've been running CiviCRM for 2 years, multiple upgrades, and no problem until today. I checked the StackExchange and there are several mentions of this problem, and how it is fixed by running the Database Upgrade. But if I can't run the Database Upgrade, I don't know how to fix this.

# Answer
I experienced this same error today. In my case, I had mistyped a command into the version control system - so I had a Civi 4.7.15 database with a Civi 4.4 file system!

In Civi 4.7, the way that configurations were stored in Civi changed. You would only get this error if the code that was running was old. I would check to see if you have another copy of CiviCRM somewhere in your filesystem. Feel free to comment on my answer if you'd like some followup on how to find what I'm describing; let me know how you access your filesystem.
> 2 votes

# Answer
If you have access to the command line on your server, try running the upgrade from there using the cv tool.
> 1 votes

# Answer
Try clearing your php opcode cache (or just restart php-fpm or your web server, depending on how php is configured).

I always get that error and clearing the opcode cache fixes it. The issue is likely related to your opcode cache settings. The new code you download may have an old date on it and your opcode cache doesn't realise you've downloaded newer code.
> 1 votes

---
Tags: joomla, upgrade, 4.7
---


# Question
Title: How to update to new SQL database username and password?
We recently received a site dump from the previous host, inclusive of the Civi CRM SQL database. When creating a new account, I had to create a new database Username and Password. Does this need to be added/updated anywhere with the Civi CRM plugin (WordPress) in order to connect properly? Would like to be sure before repointing the domain.

Thanks,

Steven

# Answer
> 1 votes
These values need to be entered in the civicrm.settings.php file (i assume this is the same for WP as for Drupal)

---
Tags: wordpress, sql
---


# Question
Title: How to disable all scheduled jobs in civicrm.settings.php?
Similar to e.g.:

```
$civicrm_setting['Directory Preferences']['extensionsDir'] = '/Applications/MAMP/htdocs/Louise/git-7/sites/semper-it.local/civicrm/extensions';

```

Can I do something that sets all scheduled jobs to =\> disabled?

# Answer
There's a new feature in the latest 4.7 that allows you to configure your site as non-production, which should do a bunch of things like this.

https://docs.civicrm.org/sysadmin/en/latest/misc/staging-production/

If you're using an older version of CiviCRM, you can manually disable all the jobs with this sql:

`UPDATE civicrm_job SET is_active = 0;`

But you'd want to make sure (manually) that some don't get auto-enabled (e.g. via the managed record feature in an extension).

Ultimately, the safest way to run a non-production site is in some kind of container that doesn't allow outgoing requests/emails.
> 1 votes

---
Tags: scheduled-job, civicrm.settings.php
---


# Question
Title: Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of BAO/Event.php)
Running into a crazy error that came to me out of the blue. I have a simple page with a few views showing CiviCRM entities.

When I view this page as an administrator, or as the user showing the warning, everything looks and works just fine.

The issue is that the non-administrative users get this blaring error and I can't seem to figure out why...

Any ideas as to what permissions issue this might be?

Cheers!

```
Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).

```

# Answer
> 0 votes
Interesting. Thank you for the leads. I went through them all and they were all set to defaults. What ended up fixing my issue was assigning the user role permission:

```
CiviEvent: access CiviEvent
Create events, view all events, and view participant records (for visible contacts)

```

In the view in question I was using a PHP field to list all active events, then find all the "parent of" relationships for the currently signed-in user, pulling up their participations, then outputting a list of all the children registered for active events.

I see now that the code runs are the current user. Given that I do not actually want to allow said permissions to that user role, is there any way to have that field "run-as" some other role, rather than provide inordinate power to the user?

# Answer
> 1 votes
This is likely due to trying to pull a view to a user that isn't allowed to see it. Can you restrict access to those views to only the user and admin user so that other users can't see the views?

If that isn't the intensional effect, check the following permissions:

* views permission (in the views settings)
* CiviCRM permissions (in People \> Permissions on the Drupal side)
* block permissions (in the block settings)
* permissions on any custom fields that the view uses (in Drupal or in CiviCRM profiles)

---
Tags: civievent, drupal, permissions
---


# Question
Title: CiviCRM for selection and subscription to paid online content
Consider this case:

We manage a very very long hiking trail across many states. It's divided in 20 sections. To get the digital maps, section coordinator contacts, section emergency alerts, section online updates, right to access private land, people have to signup and select as many sections as they want during the signup process. For each section there will be specific email sent and online content available (1 page per section to start with, maybe a blog + forum + chat per section in the future). Some hikers might decide they need them all. Some only need a couple of the sections.

Hikers are then subscribed to the selected sections for 1 year, renewable. There is a specific cost associated per section. They pay for the total + a national annual membership fee.

Can we use CiviCRM for this purpose? It's mostly online digital subscription which is close to the concept of membership, IMHO. But I'm not clear on the data mapping and which entities to rely on.

Is each of the 20 section a different membership type? Or a different price in a price set? or a different priceset?

Should we use CiviRule to add contact to groups based on the membership types they selected (or priceset element?) Creating 20 membership types seems overkill, isn't it? Do I have to then create 20 organisations in CiviCRM to map the 20 sections?

I've used CiviCRM in the past for traditional NGO, so I'm keen to also reuse all the other features too. I have development background and will hire Drupal devs to help out.

# Answer
Very cool!

I think this has webform civicrm written all over it;

First thoughts:

20 Membership types -\> 20 checkboxes on one webform \+ annual fee; inject specific waivers based on Membership type selection(s)

All on one multi-page form!

Use Membership Role Sync to map Memberships to Drupal Roles so you can use Drupal access/permissiom to give hikers access to maps for specific sections from their /user account;

Those are just first thoughts - you can totally get very far native Drupal/CiviCRM on this.
> 1 votes

# Answer
An alternative approach which could be CMS agnostic could be to make each 'section' just a field, make a smart group for each field. and then see if CiviRules can be used either on the Field or on the Group to trigger an email. No membership involved
> 0 votes

# Answer
"Do I have to then create 20 organisations in CiviCRM to map the 20 sections?" No. All Membership Types can belong to the one Organisation.
> 0 votes

# Answer
> Can we use CiviCRM for this purpose? It's mostly online digital subscription which is close to the concept of membership, IMHO. But I'm not clear on the data mapping and which entities to rely on.

Yes - Membership is a good entity to use in this case. People have used it in the past for subscriptions to magazines amongst other things.

> Is each of the 20 section a different membership type? Or a different price in a price set? or a different priceset?

It is hard to recommend a specific model without knowing more about the workflows that you want to support. Sounds like you are doing this already but my advice would be base your decision on what best supports these workflows. What combination of entities allows you to make a smooth sign up form, and allows you to do the reporting you want.

Some basic prototyping and testing to see if you can get the results you need would make sense (like you are doing with Karin in the comments below :). Feel free to open new questions with on more specific topics.

> Should we use CiviRule to add contact to groups based on the membership types they selected (or priceset element?)

Only if it supports your desired workflow.

> Creating 20 membership types seems overkill, isn't it?

Not necessarily.

> Do I have to then create 20 organisations in CiviCRM to map the 20 sections?

No.

> I've used CiviCRM in the past for traditional NGO, so I'm keen to also reuse all the other features too. I have development background and will hire Drupal devs to help out.

Any reason why you wouldn't want to hire CiviCRM devs?!
> 0 votes

---
Tags: civimember, contributions, groups, contribution-page, smartgroups
---


title: Calculated field on mail

text:
# Question
Title: Calculated field on mail
I want to add some information on a mail which is in fact calculated based on existing fields. More specifically, I want to send a mail to all members with an expired membership. In the mail I want to add (what we call in Belgium) a structured message which is in my case "membershipID & (membershipID mod 97)". What is the best way to accomplish this?

# Answer
You could create a custom token to do the calculation and use the token in your mail. See eg https://wiki.civicrm.org/confluence/display/CRMDOC/Customized+%28and+Custom%29+Tokens
> 1 votes

---
Tags: civimember
---


title: Drupal Views Filtering on Subtype

text:
# Question
Title: Drupal Views Filtering on Subtype
I have an instance of drupal 7 installed… and it is storing its data in database A I have then installed CiviCRM… and it is storing its data in database B

I have placed the information shown at sites/all/modules/civicrm/install/index.php in to the settings.php file … so the CiviCRM tables can be seen and found. Also, the base URL is set correctly in the civicdm.settings.php file.

Now when I go to create a view…

1. I select “Add a view” and specify a name for the view (the view is of type page);
2. then i select CiviCRM Contacts from the Show drop-down list…
3. decide on the display format and then click continue and edit to get to the screen to add the fields as required.
4. On the view creation screen I have added the field **CiviCRM Contacts: First Name** and that shows correctly with no errors
5. but when I try adding the **CiviCRM Contacts: Contact Sub Type** field to the Filter Criteria section (or the Fields section for that matter) I get the following error message:

> Error Message states (*some info substituted with generic information*): **SQLSTATE\[42S02\]: Base table or view not found: 1146 Table** ‘\<*user\_which\_created\_drupal\_database*\>.\<*drupal\_pre-fix*\>**\_civicrm\_value\_**\<‘*civicrm* *custom field postfix*\> **doesn't exist**

**By the looks of things, the filter criteria section of the view is looking to the Drupal database** for the CiviCRM table for the subtype field - **which it obviously won’t find as the table is actually in the CiviCRM database (Database B)**. A similar situation occurs if I try to add the sub-type field into the 'Fields' sections of the view creation process.

Sounds like this is a configuration issue (E.g Views is looking in the Drupal database and not the CiviCRM database - but yet it does look in the correct database when looking up the Contacts Name) - anyone got any ideas or had this happen to them before, looking for a solution.

# Answer
> 4 votes
I think I might have figured out what's going on here... The tables that are trying to be used in the view have been created after the table details were taken from *sites/all/modules/civicrm/install/index.php* and pasted into the *settings.php* file (which was done initially when configuring the system). So when the new tables are created they do not exist in the settings.php file (I'm unsure whether CiviCRM should do this by default or not), but if I go in and update the settings.php file with the new mapping it seems to address the issue and Drupal then looks in the correct database.

---
Tags: drupal, custom-fields, database, drupal-views
---


# Question
Title: Drupal Views using over ride feature with civicrm fields - token
I am wonder whether someone can help explain how to use the Override feature for CiviCRM fields in views. For example, I have a field in Civi which is a file field... when i add it to a view it shows the URL to the image... I assume I can select the field in question and then when it opens the configuration window for the field:

Select over ride and in the text area write something like

```
 <img src=['token for the field']>

```

for it to render the image is this correct and if it is how would i workout what needs to be placed in the \['token for the field'\] portion of the string?

# Answer
> 1 votes
Ok have worked this one out... was very much a "DOH!" moment... there is a section called Replacement Patterns under the ReWrite section - which is collapsed by default and can be overlooked which had the taken information.

---
Tags: drupal, civireport, drupal-views, tokens
---


title: How to catch Fatal error in civicrm?

text:
# Question
Title: How to catch Fatal error in civicrm?
I'm getting below error message while exporting csv file of 40k record.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65552 bytes) in /var/www/html/crf-git/modules/syslog/syslog.module on line 115.

How to catch or handle this kind of error?

Thanks & Regards, Sachin

# Answer
You need to increase your PHP memory limits.

This is the recommended approach if you have access to the server's php.ini. This will not be possible in some shared hosting environments, though your host may be able to adjust it for you. Note that this change will affect all websites and PHP scripts on the server.

Locate the php.ini file used by your web server.

Edit the memory\_limit parameter in the php.ini file (usually in a section called Resource Limits). Make sure you use M to specify the number of megabytes (not MB). memory\_limit = 256M ; Maximum amount of memory a script may consume (256MB) If there is no section already for this, place the above line at the end of the file.

Restart Apache.

Credit: https://www.drupal.org/docs/7/managing-site-performance-and-scalability/changing-php-memory-limits
> 1 votes

# Answer
For such issues you generally have two possibilities: increase the memory available to the process, or do things in smaller chunks. You could try exporting the data in smaller batches.
> 0 votes

---
Tags: php
---


# Question
Title: Is it possible to automatically email individuals once I manually add them to a group?
I'm with a small non-profit, and we'd like new additions to our general mailing list to automatically receive a "welcome" email when we manually add them to the list (a group in Civi). Is this possible?

I read that we could set up an "automated message," but my impression is that this will only work if we have a subscribe button on our site that the individual must click on.

My preference would be to continue inputting new contacts manually then have an automatic email go out when I add them to the mailing list group, but I am open to new suggestions if this is not possible.

Could you provide insights on this or point me in the right direction? I am very new here; please let me know if I need to include more info and apologies for my ignorance. Looking forward to your input.

# Answer
You are able to use Scheduled Reminders (**Administer \> Communication \> Scheduled Reminders**) to automate messages and set when they go out. For your goal, you could limit the messages to go out only to a specified group/mailing list and you can based the automation on something such as when the contact record was initially created.

Click "Add Reminder", give it a title, choose entity type "contact" and "created date". Under "limit or add recipients" choose your mailing list. Then set up various messages and times based on creation date.
> 3 votes

# Answer
Another option would be to check what the CiviRules extension has to offer.
> 1 votes

# Answer
An other easy way to do that (if you are based upon Drupal and use webform integration) :

* Create a custom field such as "belong to group A" (yes or no")
* Create a dynamic group A for those who have this field set to "Yes"
* Create a webform to manage this contact custom field (or add it to an existing one)
* Use the webform emailing feature to send a pertaining email each time you complete this webform
> 0 votes

---
Tags: civimail, email, groups
---


# Question
Title: Custom Field Groups with File fields cannot be edited as a Tab
I have a site with several custom field sets that use the "Tab" style for displaying information about a contact. Included in one field set is a "File" field that is used to store a profile image for the contact.

After upgrading to 4.7.0, attempting to view this tab for a contact with a profile image results in an error message that says the value (the filename of the image) is not an Integer. For contacts that don't have an image, the tab is shown, but the file cannot be changed. The edit popover closes when I click "Save" but the file is not updated.

I replicated this issue using the CiviCRM demo site. The steps to reproduce are:

1. Go to Administer \> Custom Data and Screens \> Custom Fields in CiviCRM
2. Create a new set of Custom Fields or edit an existing one to use the style "Tab" and apply to Contacts (I used "Individual")
3. Place as many fields as you want in the Custom Field Set, including at least one File field
4. Find a Contact
5. Open the Tab of the Custom Field Set you created
6. Click the "Edit ..." button to change the values
7. Make changes to any (or several) field and click "Save"
8. You will be taken back to the Contact but your changes will not appear

---

**Update Feb. 8** \- I applied the diff from CRM-17949 and while it does allow changing other fields in a Tab, images still cannot be changed. Also, the error message on existing images still appears. I attempted to replicate this on the demo site, which is currently running CiviCRM 4.7.2, but it appears to have file system permission issues that prevent uploading files.

---

**Update Feb. 10** \- Here is how to reproduce this issues in 4.7.2:

1. Follow steps 1 through 6 in the previous numbered list
2. Upload an file (I used an image) into the file field and click "Save"
3. You will be taken back to the contact but the file will not be saved
4. Return to the Custom Fields, and click "more" \> "Settings"
5. Change the Display Type to Inline
6. Return to the contact and scroll down to the group. Click "Edit"
7. Choose a file for the file field, and click "Save"
8. The image will be shown in the group
9. Return to Custom Fields again, and change the Display Type back to Tab
10. Return to the same contact and click on the tab for your custom group
11. You will be shown a popover message "One of parameters (value: filename.jpg) is not of the type Integer" and the tab body will display "Sorry but we are not able to provide this at the moment."

# Answer
> 1 votes
A work around is to create the record without the upload and then edit. The upload works fine after that.

4.7.13 and Drupal

---
Tags: wordpress, contacts, custom-fields, 4.7
---


# Question
Title: Call event registration with specific language through Wordpress
I am using the latest Wordpress with Polylang and CiviCRM versions. I try to call the online event registration form in both German and English, but I don't know how to do it.

How can I force CiviCRM to switch to a specific language? The &lcMesssages=de\_DE parameter has no effect at all, neither does &lang=de.

Inherit language from CMS also does not work - I cannot even see a pattern. When I call CiviCRM from the Dashboard, it's always the current language, just from Wordpress itself, it does not work at all.

But there must be a way to force CiviCRM to use a specific language - or not? Any help is appreciated.

# Answer
Polylang is not supported by CiviCRM yet but it should change soon : I have just submitted a patch here : https://github.com/civicrm/civicrm-core/pull/11312

If you still have a need for this functionality, you should try it and confirm if it resolves the problem.

To make it work with the patch :

1. Install Polylang and configure at least 2 languages
2. Configure CiviCRM in multiligual mode with 2 languages and set "Inherit CMS Language"
3. In civicrm.settings.php, uncomment as needed lines like : `define('CIVICRM_LANGUAGE_MAPPING_xx_XX')` (to resolve ambiguity between language short 'fr' and language long form 'fr\_FR' or 'fr\_CA')
4. Create a contribution page and translate at least the title
5. Add a page with the shortcode to the contribution page and translate it to the second language
6. You should be able to go to one page you've created and switch language to have another version of the same form
> 1 votes

---
Tags: wordpress, civievent, localisation, i18n
---


# Question
Title: Is there a setting to prevent Paypal Express overwriting contact details with provided Paypal billing details?
We are using CiviCRM 4.7.22/Drupal 7.56 and are increasingly encountering a scenario where Civi contacts are sharing their log in details with admin/PA staff to make payment via PayPal with a credit card on their behalf. The problem we encounter is when the admin/PA checkout with Paypal they enter their own name, email address and billing info, not the Civi contact. When the contribution is made this then overwrites the Civi contact. This is particularly problematic for events as we use Civi data to make badges and email joining instructions.

Is this the designed behavior or is there a setting either in Civi or Paypal I'm missing?

# Answer
I found a solution for PayPalPro by editing the code at line 277 in \CRM\Core\Payment\PayPalImpl.php

```
  'billing_first_name' => 'firstname',
  'billing_middle_name' => 'middlename',
  'billing_last_name' => 'lastname',

```

ie I added "billing\_" at the start of the three Civi field names. This is how received information from PayPal is mapped to Civi fields. With my change the name goes into the billing fields and not the main/primary fields.

In my case there was not a problem for the address fields, ie they were getting through OK to the billing address.

I've done this as a customisation for my site. If it's correct then this should be converted into a bug report so it's incorporated into the main code. Anyone care to test?
> 2 votes

---
Tags: civicontribute, contacts, paypal
---


# Question
Title: Is there a way to allow partial payments for events?
An enormous benefit to many organisations would be a way to allow partial payments for events. Does CiviCRM provide the ability to book on for an event and pay a €50 deposit, and then the balance would be paid on the night of the event itself?

It seems that this is very standard practice for events I've come across in Ireland, at least, and I would love to see it as part of the core.

I've found various pages on the subject of partial payments, but none with anything recent. e.g. http://wiki.civicrm.org/confluence/display/CRM/Partial+Payments+for+Event+Registrations+and+Memberships http://wiki.civicrm.org/confluence/display/CRM/Partial+Payments+use-cases

but nothing seems of late. Sadly, I'm not in a position to make a big financial donation and I am not a techie. I just wanted to see if this can be done in any reasonable way.

# Answer
Partial payment for event registrations is not available for front-office public users as of 4.6. 4.5 provided this functionality for back-office staff users. I'm expecting a contract shortly that will support new APIs for orders and payments in 4.7 that will make it easier to develop functionality like this in extensions or the front-end.
> 5 votes

# Answer
As of right now, there's no way to set up events to work this way. The issue is that there's no way to set the "sticker" price of events to distinguish a deposit from just a regular cheaper price option.

For example, let's say you have an event with regular tickets and VIP tickets. You might set up a price set like this:

* regular ticket: $100
* VIP ticket: $200
* deposit only: $20

CiviCRM has no way of knowing that when you sign up online (as a regular visitor) and select $20 that it should charge your card for $20 but show your event fee as $100. If it somehow looked for the maximum option automatically, it might (incorrectly) guess that $200 was the real price.

That said, you have a really great use case here. My coworkers have built customizations for clients that handle this, but it's done in a way that isn't completely generalizable for all uses. Basically, the extension is told that price option X is a deposit for price option Y, and when someone registers for an event with price option X, it goes around and edits/records a bunch of transactions to make the accounts such that it's a partial payment.
> 3 votes

# Answer
I just watched the Back Office Thinking video from civicon denver and if I understand correctly they have an extension to do what you want: Take a look at this video.

Here is the project on github.

Caveat: I have not tried to use this (yet).
> 3 votes

# Answer
Partial payments registered via the back office work under 4.7.3, however, the payment display is confused and does not appear to itemise individual payments. In other words, if you view the participant, partial payments are not listed, and the payment status is shown differently in different parts of the display.

View Event Registration shows the amount paid, and the balance outstanding. View Participant payment shows just the first payment Clicking the arrow on the left shows payment complete!

Clearly some more work is needed. I'll post this as an issue.
> 3 votes

# Answer
The partial payment feature was rolled out in 4.5, you can see the issue documented here. It *almost* allows the functionality you have described - a participant can be registered for an event, pay less than the full amount, and the system will assign them a "partially paid" status. Your staff can collect additional payments before, during, or after the event, and when paid in full the participant's status will reflect that.

Update: unfortunately this workflow does not allow online registration.
> 2 votes

# Answer
Since the resolution of https://issues.civicrm.org/jira/browse/CRM-19263, here is what you can do :

1. define price options as mentioned by @andrew-hunt :

* regular ticket: $100
    * deposit only: $20
2. after the deposit payment is done, the organization staff changes in the backend the option chosen in the participation to "regular ticket" price which :

* change the contribution amount
    * change the contribution status to partially paid
3. the organization staff send the link to the contact for completing the payment : https://example.org/civicrm/contribute/transact?&reset=1&id=3&ccid=162 (with 3 =\> id of your contribution page and 162 =\> id of the contribution)

EDIT: note that there are some glich as described in https://issues.civicrm.org/jira/browse/CRM-21390 to be able to change the price option without fatal error
> 0 votes

---
Tags: civievent, civicontribute
---


# Question
Title: Exporting group contacts to an excel file
How do I export a group to an excel file? Pretty standard. Wanting to export email as well as name, mailing address, city, postal code.

Thank you, Shara

Using Wordpress

# Answer
> 4 votes
The User Guide has instructions and screenshots here for exporting contacts: https://docs.civicrm.org/user/en/latest/common-workflows/exporting-your-contacts/

Search for the contacts and select the `Export Contacts` action from the drop-down list.

---
Tags: contacts, export
---


# Question
Title: How can we hide the CiviCRM System Status page?
How do I hide CiviCRM System Status page (in CiviCRM) and Status Error pop-up messages from non-admin users? I am Using Drupal 7 with CiviCRM 4.7.

# Answer
This can be fixed by removing the permission 'CiviCRM: administer CiviCRM' from these users. You called them non-admin so they shouldn't need this menu? If they don't have this permission they won't get the messages.
> 1 votes

# Answer
You should post what CMS you are using.
For WordPress, I use a dashboard plugin. https://wordpress.org/plugins/abd-dashboard-widget-manager/ You can set which widgets users see based on user role.
> 0 votes

---
Tags: drupal, 4.7, status
---


# Question
Title: Can CiviCRM entities be used as events to trigger Drupal Rules?
I have CiviCRM Entity installed, Drupal Rules, up to date versions of both.

I'm just creating a simple rule that says when a CiviRM Contribution Page is viewed, a "Hello World" message is displayed.

Getting nowhere with it. It does not even trigger Rules at all, so no debug, no log entries.

Works fine with Drupal content.

Am I missing something?

# Answer
The rule will only trigger when the Drupal version of the contribution page at path /civicrm-contribution-page/(id)

We haven't added a feature to trigger the rule event when the civi version of the contribution page is viewed.
> 3 votes

# Answer
The way I'm doing it is to use Path Rules module to check the CiviCRM URL for the transact page. So we look for the path say /civicrm/contribute/transact?reset=1&id=1

That triggers the rule. We then fetch the CiviCRM contact entity for the current user.

The Contact entity has all of the custom data in it.

We pass that to a rule component that evaluates a custom field value and does an action as appropriate.

So this rule could be used in a situation where a user has to complete a complex professional registration procedure using Webform CiviCRM, where a profile is not appropriate. Upon completion they are directed to a membership renewal page.

If they try to access the renewal page first, without having made the declaration they are redirected back to the webform.
> 2 votes

---
Tags: civicrm-entity, drupal-rules
---


# Question
Title: Creating Drupal Accounts when a sub-type CiviCRM Contact is created - created by a webform
I have a scenario - which I have no doubt that others will have come a crossed and some will have implemented. The scenario is: to have a web form (created via the Webform module - which has CiviCRM fields integrated into it - via the Webform integration module) that has the CiviCRM fields such as:

* the first name,
* the last name,
* the e-mail address, and
* the address (e.g. address line 1, address line 2, city, post code) etc

and when the user (**whom is not logged in - as they do not have a Drupal account**) selects submit

1. The details entered are saved in CiviCRM, but equally
2. A Drupal user is created for the user (*no doubt using the Rules module in Drupal*).

**The issue is that**

1. I’d only want the rule fired if the web form was used, not if I create users via the CiviCRM admin interface (as I have sub-type contacts which wouldn’t need Drupal accounts assigned to them)
2. When I go into Rules - I can find the triggering event, which i assume would be “CiviCRM Contact: Contact has been created” e.g. when a Contact is created the rule will begin to fire…

***what I’m not sure about is:***

2a. how to configure the condition for the rule to say “**only do the action** if the contact is of sub-type x” or if triggered by webform x

2b. how to **configure the action portion** of the rule to create a new Drupal user

2)b)i. there is the “Create a new entity” option under the Entities section in the drop down for action to add, where i can choose “User” as the value …

*Image 2: The rules screen - where trigger specified in top section*

*Image 3: The options user the actions options*

**however**, on the next screen - where it asks for the login name of the user, the replacement patterns do not provide me with a means of saying use the e-mail entered in the registration form as the User name for the account that I want created; **nor** does it allow me to specify that the system should pick up the e-mail entered in the web form as use that as the email address for the new account being used.

* **side note:** I do realise at this point having written the above that the rule was written saying do x when event y is triggered - and without specifying that event y should be coming from webform a, which might explain why the action portion of the rule is not providing any replacement pattern for the username - e.g the rule is generic so would be fired if a contact record was created via a different form or the general CiviCRM admin panel.

So… anyone got any ideas on how to achieve what I’m trying to do above? I assume I can do the above without having to get involved with writing bespoke modules or using hooks etc.

# Answer
Most of what you need is here: How can I create a Drupal user when someone submits a CiviCRM-Webform? based on @petednz-fuzion's blog post. It uses civicrm\_entity which has seen a lot of activity since the previous question so there may be some changes but hopefully nothing that prevents you following it.

For limiting action to a specific contact sub-type, add a new Condition using 'Data comparison' with a data selector of `civicrm-contact:contact-sub-type`
> 2 votes

# Answer
Ok so the installation and use of the Webform Rules went a long way to contributing to resolve the issue in terms of restricting the triggering of the action of creating a user and also providing the webform fields to the rule process...

And Aidan's info seemed like a possible solution and provided another way of doing things (but, I think, as pointed out by Aidan a lot has moved on since that information was published and so some of the options are no longer available in their former guise).

... Then there was info from @Pierre.Vriens see the thread posted here:

Webform Rules - Create a Drupal User

... where the recommendation was to try and use variables to hold the field values and then assign the variable as the value of the Drupal User Entity, which I did and it resolved the second part of the issue.

Thanks to both @Aidan and @Pierre.Vriens for the help on this.
> 2 votes

---
Tags: drupal, webform-civicrm, user-account, drupal-rules, contact-types
---


title: Email Link Tracking not working.

text:
# Question
Title: Email Link Tracking not working.
I am using Civi 4.7.22 on Wordpress 4.8.1 I am having problems with the link tracking. In both the email template preview and the actual sent email, links are going to a 404 Error page when tracking is enabled. When tracking is disabled, the links work properly.
Also when editing the email template, when I click the "Browse Server" option I am redirected to a 404 Error Page.
This makes me think something in the url for tracking and the civimail feature itself is not configured properly. Can anyone tell me where to look to fix this? Please let me know what additional information you need.

Thank you.

# Answer
I'm not sure this is quite the same problem as I had, but it may be worth looking at. I'm in WordPress 4.9, CiviCRM 4.7.22. I was getting Error 500 for all the tracked links and I resolved this by changing \[civicrm.root\]/extern/url.php to 644 permission and the containing directory to 755. I've had a lot of similar problems (e.g. with getting images into KCEditor with KCFinder. One of the incomplete screens I get there (problem not entirely solved) is the same as I get with the Browse server button that you mention).

I think its all to do with the fact that I have a hosted solution (SiteGround) and it insists on 755 and 644 permissions whereas a lot of WordPress files are 775 and 664, which I think is only appropriate for stand alone hosting (again need more research).
> 1 votes

---
Tags: civimail, tracked-links
---


# Question
Title: Why after importing contact records were Addressee field values set to "Customized" for records where Custom Addressee had a null value?
I imported a large group of organisations into a sub-org group "Media". Some orgs had a specific generic addressee (ie, Editor) which I imported into the Custom Addressee field.

After import I noticed that any record that had a null value in Custom Addressee field now also had an Addressee field = "Customized" rather than the default Addressee tokens. This behavior seems a little odd but may be a product of how civi handles default field values that rely on tokens - guessing here.

I also tried to create a Profile that would allow me to bulk update the incorrect records. While it looked like I could select the default token string from the drop down list and civi seemed to be running the update nothing actually changed.

There are rather a lot of records to be going into each summary and changing them individually. Rather than doing a re-import and deferring import of Customs Addressee data until a subsequent import, I thought I would ask if anyone had a simple solution and/or an explanation for this behavior. Any assistance appreciated.

CiviCRM 4.4.10

Thanks

# Answer
I came across the same issue after upgrading a very old civicrm DB to latest (4.7.27)- i ran the following simple queries to reset to my default IDs (listed at civicrm/admin/options/addressee?reset=1 )

```
UPDATE civicrm_contact
SET addressee_id = 1
WHERE contact_type = 'Individual';

UPDATE civicrm_contact
SET addressee_id = 2
WHERE contact_type = 'Household';

UPDATE civicrm_contact
SET addressee_id = 3
WHERE contact_type = 'Organization';

```

I didn't need to retain any existing or "customized" but if one did, adding `AND isnull(addressee_id)` should work
> 1 votes

---
Tags: custom-fields, import, tokens
---


title: Cannot add a new role to any case

text:
# Question
Title: Cannot add a new role to any case
In a Case, when I try to add a New Role, there is an Error warning. First I get the window to indicate *Relationship Type* and to *Assign To:*, then no role is added.

*Error API (EntitySetting, get) does not exist (join the API team and implement it!)*

Here's the ConfigAndLog :

Thanks for help in the matter.

```
   $Fatal Error Details = array(3) {
  ["message"]=>
  string(77) "API (EntitySetting, get) does not exist (join the API team and implement it!)"
  ["code"]=>
  NULL
  ["exception"]=>
  object(CiviCRM_API3_Exception)#608 (8) {
    ["extraParams":"CiviCRM_API3_Exception":private]=>
    array(3) {
      ["is_error"]=>
      int(1)
      ["error_message"]=>
      string(77) "API (EntitySetting, get) does not exist (join the API team and implement it!)"
      ["error_code"]=>
      string(9) "undefined"
    }
    ["message":protected]=>
    string(77) "API (EntitySetting, get) does not exist (join the API team and implement it!)"
    ["string":"Exception":private]=>
    string(0) ""
    ["code":protected]=>
    int(0)
    ["file":protected]=>
    string(71) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/api/api.php"
    ["line":protected]=>
    int(45)
    ["trace":"Exception":private]=>
    array(10) {
      [0]=>
      array(4) {
        ["file"]=>
        string(81) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Case/BAO/Case.php"
        ["line"]=>
        int(3122)
        ["function"]=>
        string(12) "civicrm_api3"
        ["args"]=>
                string(12) "civicrm_api3"
        ["args"]=>
        array(3) {
          [0]=>
          string(12) "relationship"
          [1]=>
          string(6) "create"
          [2]=>
          array(3) {
            ["id"]=>
            string(4) "5467"
            ["is_active"]=>
            int(0)
            ["end_date"]=>
            string(3) "now"
          }
        }
      }
      [1]=>
      array(6) {
        ["file"]=>
        string(85) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Contact/Page/AJAX.php"
        ["line"]=>
        int(242)
        ["function"]=>
        string(11) "endCaseRole"
        ["class"]=>
        string(17) "CRM_Case_BAO_Case"
        ["type"]=>
        string(2) "::"
        ["args"]=>
        array(4) {
          [0]=>
          string(1) "1"
          [1]=>
          string(1) "b"
          [2]=>
          string(1) "2"
          [3]=>
          string(1) "9"
        }
      }
      [2]=>
      array(4) {
        ["function"]=>
        string(12) "relationship"
        ["class"]=>
        string(21) "CRM_Contact_Page_AJAX"
        ["type"]=>
        string(2) "::"
        ["args"]=>
        array(0) {
               ["args"]=>
        array(0) {
        }
      }
      [3]=>
      array(4) {
        ["file"]=>
        string(79) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php"
        ["line"]=>
        int(275)
        ["function"]=>
        string(14) "call_user_func"
        ["args"]=>
        array(1) {
          [0]=>
          array(2) {
            [0]=>
            string(21) "CRM_Contact_Page_AJAX"
            [1]=>
            string(12) "relationship"
          }
        }
      }
      [4]=>
      array(6) {
        ["file"]=>
        string(79) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php"
        ["line"]=>
        int(84)
        ["function"]=>
        string(7) "runItem"
        ["class"]=>
        string(15) "CRM_Core_Invoke"
        ["type"]=>
        string(2) "::"
        ["args"]=>
        array(1) {
          [0]=>
          array(12) {
            ["id"]=>
            string(3) "215"
            ["domain_id"]=>
            string(1) "1"
            ["path"]=>
            string(21) "civicrm/ajax/relation"
            ["access_callback"]=>
            array(2) {
              [0]=>
              string(19) "CRM_Core_Permission"
              [1]=>
              string(9) "checkMenu"
            }

                         string(9) "checkMenu"
            }
            ["access_arguments"]=>
            array(2) {
              [0]=>
              array(1) {
                [0]=>
                string(14) "access CiviCRM"
              }
              [1]=>
              string(3) "and"
            }
            ["page_callback"]=>
            array(2) {
              [0]=>
              string(21) "CRM_Contact_Page_AJAX"
              [1]=>
              string(12) "relationship"
            }
            ["breadcrumb"]=>
            array(1) {
              [0]=>
              array(2) {
                ["title"]=>
                string(7) "CiviCRM"
                ["url"]=>
                string(16) "/civicrm?reset=1"
              }
            }
            ["is_ssl"]=>
            string(1) "0"
            ["weight"]=>
            string(1) "1"
            ["type"]=>
            string(1) "1"
            ["page_type"]=>
            string(1) "3"
            ["page_arguments"]=>
            bool(false)
          }
        }
      }
      [5]=>
      array(6) {
        ["file"]=>
        string(79) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php"
        ["line"]=>
        int(52)
        ["function"]=>
        string(7) "_invoke"
        ["class"]=>
        string(15) "CRM_Core_Invoke"
        ["class"]=>
        string(15) "CRM_Core_Invoke"
        ["type"]=>
        string(2) "::"
        ["args"]=>
        array(1) {
          [0]=>
          array(3) {
            [0]=>
            string(7) "civicrm"
            [1]=>
            string(4) "ajax"
            [2]=>
            string(8) "relation"
          }
        }
      }
      [6]=>
      array(6) {
        ["file"]=>
        string(81) "/var/data/sites/photo/public_html/sites/all/modules/civicrm/drupal/civicrm.module"
        ["line"]=>
        int(448)
        ["function"]=>
        string(6) "invoke"
        ["class"]=>
        string(15) "CRM_Core_Invoke"
        ["type"]=>
        string(2) "::"
        ["args"]=>
        array(1) {
          [0]=>
          &array(3) {
            [0]=>
            string(7) "civicrm"
            [1]=>
            string(4) "ajax"
            [2]=>
            string(8) "relation"
          }
        }
      }
      [7]=>
      array(2) {
        ["function"]=>
        string(14) "civicrm_invoke"
        ["args"]=>
        array(2) {
          [0]=>
          &string(4) "ajax"
          [1]=>
          &string(8) "relation"
         [1]=>
          &string(8) "relation"
        }
      }
      [8]=>
      array(4) {
        ["file"]=>
        string(51) "/var/data/sites/photo/public_html/includes/menu.inc"
        ["line"]=>
        int(527)
        ["function"]=>
        string(20) "call_user_func_array"
        ["args"]=>
        array(2) {
          [0]=>
          &string(14) "civicrm_invoke"
          [1]=>
          &array(2) {
            [0]=>
            string(4) "ajax"
            [1]=>
            string(8) "relation"
          }
        }
      }
      [9]=>
      array(4) {
        ["file"]=>
        string(43) "/var/data/sites/photo/public_html/index.php"
        ["line"]=>
        int(21)
        ["function"]=>
        string(27) "menu_execute_active_handler"
        ["args"]=>
        array(0) {
        }
      }
    }
    ["previous":"Exception":private]=>
    NULL
  }
}

Nov 26 13:11:45  [info] $backTrace = #0 /var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Core/Error.php(456): CRM_Core_Error::backtrace("backTrace",$
#1 /var/data/sites/photo/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(55): CRM_Core_Error::handleUnhandledException(Object(CiviCRM_API3_Exception))
#2 /var/data/sites/photo/public_html/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#3 [internal function](): civicrm_invoke("ajax", "relation")
#4 /var/data/sites/photo/public_html/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
#5 /var/data/sites/photo/public_html/index.php(21): menu_execute_active_handler()
#6 {main}

```

# Answer
**The problem was not from the code**. But that was in fact from imported data in the table *civicrm\_relationship*. There were in the table some data left by a test (in the case\_id column). My mistake. So the matter is solved.
> 2 votes

---
Tags: civicase
---


# Question
Title: How do I format a webform to register for events so I can fill it out multiple times without cancelling previous registrations?
We are using a Webform to allow people to sign multiple people up for multiple events.

If someone has registered themselves for event A & B then later decided they want to go to event C & D as well, how would you set up a webform to allow a second submission that doesn't cancel the first registrations?

Currently if I revisit the form all the events are on offer, there is no indication of which events I am already registered for. If I fill in the form to register for C & D (having previously registered for A & B) and do not select A & B also then when I submit the form it cancels my registration for A & B.

If I am registering multiple people for events. eg person A registers person A and person B to go to lunch. Then person C registers person C and person B to go to dinner. Where lunch and dinner are both events that can be registered for on the same form then currently when person C completes the form person be will have their registration for lunch cancelled.

I am using Drupal 7.56, CiviCRM 4.7.27, Webform-CiviCRM 7.x-4.19

# Answer
Found the solution, it is a setting that was there all along.

On the CiviCRM configuration page under the Event Registration tab there is a section called Registration options. In here there is a checkbox to "Disable unregistering participants from unselected events" if you check that then as it says contacts will not get unregistered from events.

Doesn't show them what they are currently registered for but we are ok with that as they are not going to lose the registration.
> 5 votes

---
Tags: civievent, webform-civicrm, participants
---


# Question
Title: confusing interface for staff registering contacts for events
When staff (at a client org) go to register people for paid events there is a difference in the interface and the ability to actually take/process a payment depending on what path is taken to the registration form.

If they start from the event admin page and click "Event Links" -\> "Register Participant" they get a form that only allows for entering the last 4 digits of the credit card number (which of course is not enough data to actually charge the person the fee)  If they start at a contact record, click the Events tab and then Submit Credit Card Event Registration, once they select the event and the price from the price set, they get a form that allows for entering all necessary payment information which does allow them to charge the user the fee.  Why is there a difference? Is this a bug, or intentional for some reason?

# Answer
> 2 votes
This is an inconsistency in the CiviCRM interface that others have noticed before as well.

This inconsistency does NOT exist for the "New Contribution" screen - because that screen has a "submit credit card contribution" link to bring you to the live entry screen.

For kicks, I added `&mode=live` to the "New Event Registration" URL - and it APPEARS to work.

I would recommend:

* Append `&mode=live` to the "New Event Registration" URL and confirm that it works correctly.
* If it does, it should be a simple matter to submit a patch to generate the "submit credit card registration" link to the appropriate template.

# Answer
> 1 votes
Another approach for them would be to use the public facing 'event registration' form, and when logged in they should see a "want to register as someone else".

---
Tags: civievent, payment
---


# Question
Title: Email a user when they are assigned as case manager?
Can anyone advise on the best way of sending an email to a newly assigned case manager/advisor? (ie to a specific case relationship when it is first made)

I've looked at the civirules extension but could only get it to send to both parties (client as well) and without any case specific tokens to tell them what it was regarding..

thanks!

# Answer
For sending a message to new case managers - I would suggest using Scheduled Reminders.

* Create a new group "Case Managers". Add all case managers to the group.
* Set a Scheduled Reminder on "Activity" of type "Open Case".
* Limit recipients to members of the group "Case Managers".

With regard to the tokens - there has been recent work to support case tokens on activities. See CRM-19767 and the accompanying casetokens extension. Note that I'm not sure that this will extend the functionality to Scheduled Reminders - but if it doesn't, I imagine it will get a coder 80% of the way there.
> 3 votes

# Answer
You could also fund the development of your solution in the CiviRules extension.
> 2 votes

---
Tags: email, civicase, civirules
---


# Question
Title: what is the correct method for upgrading an extension on a live site after pulling its updated code from a development site?
We use a development site and github.com repository, and then pull from github.com down to our live site.

So when upgrading our extensions we update the code on our dev site, test it's all ok, then push it to github.com, ready to pull it down to our live site.

What's the correct thing to do on the live site in this case? Disable the extension before downloading the code and then re-enable it? Or what?

Apologies if my searching missed this in an obvious part of the documentation or elsewhere.

We're on Civi 4.7.27 and Drupal 7.56

# Answer
What I tend to do is:

1. if the upgrade is on my extensions page within the UI then I try upgrading from the UI (obvioulsy on test first as you mention).
2. if there is no upgrade on my extension page, I tend to download a release rather than link the production site directly to the master branch on GitHub. I tend to do that only in test. I am sure there are pros and cons for pulling directly but this is what I do.
3. if the extension is a tiny one and I know for a fact the impact is minimal I replace the extension directory with the extracted new release without disabling first.
4. if I know the extension is a bit bigger I will disable first, then extract and replace the extension directory and enable again.
> 1 votes

---
Tags: extension, developer
---


# Question
Title: Wordpress Media Library not refreshing with new upload
when we upload a file to the Media Library at https://OurSite.org/wp-admin/upload.php the file doesn't show up onscreen immediately. It looks like nothing has happened. But when we refresh the browser, the file appears.

We thought perhaps this was a SiteGround caching issue, so added wp-admin/ to the exclusion list and used the Supercacher testing tool to confirm that https://OurSite.org/wp-admin/upload.php was now excluded.

We also purged the SiteGround cache, but still the Media Library does not dynamically refresh when uploading a file. Wordpress version is 4.7.2 and CiviCRM version is 4.7.13

We have the same Wordpress version installed on a different host and it is working properly. We confirmed that it is caused by CiviCRM when we disabled the CiviCRM wordpress plugin. We looked for possible collisions of libraries, but it is not evident why CiviCRM is affecting any of the output on that page. We're looking for insights from someone with additional Wordpress expertise.

# Answer
> 1 votes
Not quite a complete answer yet, but I had the same problem with SiteGround and it is to do with file permissions. See Adding images in CKEditor for what I changed.

Also see my recent question file permissions with hosted wordpress about the wider issue.

---
Tags: wordpress
---


# Question
Title: It looks like Curl is installed but still getting Curl not installed error
When I go to certain parts of CiviCRM, such as **Administer \> Extensions**, or the dashboard, I get a message saying that Curl isn't installed.

I'm running Debian with Apache.

When I run `curl --version` I am greeted with:

```
curl 7.38.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP

```

I've run `service apache2 reload` to reload apache and it's services, even though curl was already installed before I set the site up as well as cleared the caches `drush cc civicrm`.

I've looked at the phpinfo in command line and don't see any reference to curl.

This only seems to be an issue on my test site, running CiviCRM 4.7.15 on Drupal 7.

Edit: `/etc/php5/cli/conf.d/20-curl.ini` shows:

```
; configuration for php CURL module
; priority=20
extension=curl.so

```

# Answer
> 2 votes
Command-line curl and php-curl are usually different packages. Assuming you're using unix you would do something like `yum install php-curl` or `apt-get install php-curl`. The exact command depends on what OS and version.

Or it might be installed, e.g. as part of the php-common package for example, but for whatever reason it's not enabled, in which case check /etc/php.d/20-curl.ini (the exact file/location depends again on which OS/version - it might even be directly in php.ini), and enable the curl module in there.

---
Tags: drupal
---


# Question
Title: How are soft credits used for membership payments in webform?
Using Drupal 7.56, CiviCRM 4.7.x and Webform CiviCRM 7.x-4.15. I have a webform that allows a parent (primary user) to pay the membership fees for up to four children (CiviCRM contacts). The total payment (contribution) is recorded against the parent. Apart from the fact that the membership for the children is renewed there is nothing to show that they have paid when looking at their contact record. Is it possible when using the Webform/CiviCRM module to have the membership contributions for the children to be recorded as soft credits? If so how is that achieved?

**Later information** Unfortunately we have separate membership types for parents and children so it is not possible to use inheritance (as far as I can tell). Parents can have different levels of membership and there are different memberships for first, second, third and subsequent children. Maybe we have complicated our membership structure unnecessarily, however it is what it is at the moment. We create family relationships and when we view any child we can see the associated parent where the payment has been made. So what we have to do at the moment is view the child record, click on one of the parents (hopefully the one who has paid), select the contribution and view it. This will at least show the breakdown of the payment into the constituent parts. The only place where we can see the payment against the child is in a book keeping report. Soft Credits would absolutely solve our issues since we could see who has made the single payment and who it has be on behalf of (i.e. the children) IMHO this would be a useful enhancement to CiviCRM.

# Answer
Download the latest -dev of webform\_civicrm module. We recently merged in some code that should let you do this (explicity add the soft credit).

This is the commit: https://github.com/colemanw/webform\_civicrm/commit/bc7e0eee2a39ca0c35e34109d3ff05ee2e26b8d3
> 1 votes

# Answer
Soft Credits may not be the way to go here. The Contribution/monies correctly land with the parent (who pays); You can connect them by relationship: \[perhaps you already are\] - parent-child relationship -\> or in case of a Family type of membership you can also have the membership inherited by the children and then you can clear see a Primary Member (parent) and the children (who inherit); You can then View Primary Member (and his/her payment history) right from the Children's Membership tab;
> 0 votes

# Answer
I believe this would require a custom extension. If you're a coder, my Automatic Soft Credits extension is very close to what you need. Instead of triggering a soft credit on a related contact when a contribution is made, you'd change it so that it triggered when a membership payment of a certain type is made.
> 0 votes

# Answer
Given your 'later information' and since you are using Drupal, you could do this via a Views block exposed on the Contact Summary screen. A bit of effort but you should be able to knit together exactly what you want.
> 0 votes

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


# Question
Title: How do you import (custom) relationship fields?
I am prototyping and testing import from M$ Access. Up to now I could quite easily import relationships, but I am missing the way to import also the relationship core Start date and custom fields I created in some relationship types. It seems like contact import is not prepared for this, right? So the only other way would be writing custom import scripts using the API? Any hints or documentation are appreciated!

# Answer
From what I can tell this functionality is not available in core imports, which allow relationships to be imported as a side function (e.g. when importing contacts, you can specify relationships on the side).

There is an extension available called "CSV GUI Import to api" which allows more targeted imports, including one directly to Relationships.

I think you need to use Internal Contact IDs (I tried to find how to do it with external IDs and couldn't manage it), as well as having other info specified:

In the screenshot above (from the second field matching step), "Year" is a custom field that I added to a certain relationship type, and which can be imported to in this way. You can see the core date fields are also available.
> 4 votes

# Answer
Laryn's answer is good. The other popular method is the command-line CSV import tool: https://civicrm.org/blog/jamie/the-new-and-improved-cliphp-now-a-new-way-to-interact-with-api-v3

If you had a file that looked like this:

```
contact_id_a,contact_id_b,relationship_type_id,custom_34
4,8,2,1997
5,12,2,2008
etc.

```

You could import it with:

`php /path/to/civiroot/bin/csv/import.php -e Relationship --file /path/to/your.csv`
> 2 votes

---
Tags: custom-fields, import, relationships
---


# Question
Title: how do I create a new template on civicrm / mosaico
Is not a question, i just want to share with you how you can create a new template on civicrm / mosaico!

for wordpress:

Template directory:

```
/www/yoursite/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/packages/mosaico/templates/

```

here you find 3 templates directory that already exists

choose one of the folders (important) and duplicate and rename folder and the.html inside (respecte the nomenclature)

next step view your template in the selection area in wordpress

go to

```
/www/yoursite/wp-content/uploads/civicrm/ext/uk.co.vedaconsulting.mosaico/js

```

edit index.js

and add your template here:

```
var viewModel = {
        showSaved: ko.observable (false),
        edits: ko.observableArray (initialEdits),
        templates: [{
          name: 'versafix-1', desc: 'The versatile template'
        }, {
          name: 'tedc15', desc: 'The TEDC15 template'
        }, {
          name: 'tutorial', desc: 'The Tutorial'
        }, {
          name: 'newtemplate', desc: 'newtemplatetitle'
        }]
      };

```

Final step is create / modify your own template put your new template with correct name in your Template directory

sorry for my poor english ... I'm french: p

# Answer
> 3 votes
Thanks for this - it helped me out.

I believe the second part of your answer is no longer valid.

The new place to reference your template seems to be in: `uk.co.vedaconsulting.mosaico/CRM/Mosaico/BAO/MosaicoTemplate.php`.

Edit the `findBaseTemplates()` method to return another record with your new template's details and it should show up under the `Mailings -> Mosaico Templates` menu option in the `New from base template:` section

---
Tags: wordpress, custom-templates
---


# Question
Title: How to debug Smarty mail template codes, broken after upgrade
I have a few Mail Templates that have conditional smarty codes like:

```
{capture assign=pp_scan}{contact.custom_74}{/capture}{if $pp_scan}You have already provided{else}You have not yet provided{/if} a scan of your passport.

```

This code ran just fine until I upgraded to 4.7.27 (from 4.7.21). Don't know if it is related to the upgrade or just a coincidence. Now, this code resolves to

> {capture assign=pp\_scan}{/capture}{if $pp\_scan}You have already provided{else}You have not yet provided{/if} a scan of your passport.

in the text of the email.

How do I debug the smarty code in mail templates? I tried adding {debug} to the mail template, but that didn't help.

# Answer
Any chance in your settings file the "CIVICRM\_MAIL\_SMARTY" just needs to be turned back 'on'?
> 1 votes

---
Tags: message-templates, smarty
---


# Question
Title: Mandatory volunteer contribution to maintain membership status. How would you implement?
Volunteer-based cooperatives often have requirements for its members to maintain an 'Active' status in order to be eligible to vote in meetings or elections.

For example, my cooperative requires:

A) at least 24 hours of volunteer service in the financial year when applying for membership.

B) at least 24 hours of volunteer service in subsequent financial years to maintain an 'Active' status.

Typically, individuals declare on a paper form their annual volunteer contribution. It would be ideal to scan/upload PDF documents into CiviCRM annually and simply tick a checkbox that the member has complied with the requirement of active membership.

I can see multiple ways to implement this but does anyone with CiviCRM experience have a suggestion on how they would implement this?

Which Module would you use or customise?

Cheers,

Troy

# Answer
> 2 votes
I would probably use the CiviRules extension for this (to be found here: https://civicrm.org/extensions/civirules with documentation here: https://docs.civicrm.org/civirules/en/latest/ ) and then:

1. set up an activity for uploading the document
2. set up a CiviRule with trigger new activity, condition on activity type and status (and possibly attachment) and action tag the contact as an active member.

---
Tags: civimember, custom-fields, status
---


title: Moving CiviCRM from Windows to Linux

text:
# Question
Title: Moving CiviCRM from Windows to Linux
I created a CiviCRM database locally on my windows machine on Wordpress. I am using a linux webserver to which I would like to move the data. I think there should be no issues in moving the data using phpmyadmin. Will there be any issues due to difference in OS ?

https://wiki.civicrm.org/confluence/display/CRMDOC32/Moving+the+database+using+phpMyAdmin

What other issues can be expected due to this movement?

# Answer
If Drupal you need to update the temporary files folder under Administer - Configuration - File System, and possibly in the files table you might have paths using a backslash that need to be converted.

Also even for non-drupal for the windows to linux direction pay attention to capitalization for any file paths. Linux is case-sensitive but windows is not.

And your civicrm.settings.php file may need updating for backslashes and capitalization.

File permissions and file/folder ownership also tend to be more varied on linux. You may have to grant permission to the web server (see e.g. Are there recommended directory ownership and permission settings for CiviCRM files?)
> 1 votes

---
Tags: installation, civicrm-home, install
---


# Question
Title: Not found "Create Add new " option in the Current Employer field if the org name typing
We're already apply " Access API Permission " to anonymous user for creating Add New option organization to the current employer field but still not works. Civicrm-4.7. And added public automcomplete ext. to the current employer field. I go through the documentation https://github.com/TechToThePeople/publicautocomplete and added code in the civicrm.setting.php

# Answer
From the documentation:

> If you want to force the user to submit only a value from the list (or leave to leave it blank), thereby **preventing the user from creating new organization records**, set the require\_match config option to TRUE (it defaults to FALSE):
>
> ```
> global $civicrm_setting;
> $civicrm_setting['eu.tttp.publicautocomplete']['require_match'] = TRUE;
>
> ```

This means, if you want to **allow the user to create new organization records,** you would omit this line, or set it to `FALSE`.

Also note: If you omit the line or set it to FALSE, you won't actually see a "Create New" option; you'll just be able to type in the name of an organization that's not in the list of options.

EDIT:

Regarding the potential for typos and duplicates, that will always exist any time you allow the user to enter a new organization name. CiviCRM will follow the unattended dedupe rule for organizations when deciding whether to use an existing org or create a new one.
> 4 votes

# Answer
As we understand it, this default is an either-or. Either it is set to FALSE, i.e. allows user to input anything into the field, including misspellings (?)

-or-

user may choose from a restricted list (group) "submit only a value from the list (or leave to leave it blank), " i.e. forced to leave.

We would want it as a conditional. If the user cannot locate their employer, then they have option to "create new" organization (and create the ensuing relationship in civi) H
> 0 votes

---
Tags: civievent, civicontribute, extension, autocomplete
---


# Question
Title: Looking for Webform Calculator Experience
Has anybody experienced Webform Calculator Module with civicrm ?

Could it, for instance, enable conditions such as :

if field1= YES, then field3 = field2

or

if field1= YES, then field2=field2+30

Should (or can) field1, field2, field3 be civicrm field, or simple webform fieldsets ?

# Answer
you could use the 'share address of' option, set that to 'user selects' then change it to a yes/no type field and use conditionals on that.
> 0 votes

# Answer
Coleman is listed as a maintainer for webform\_calculator so there is a very strong chance that it works well with CiviCRM :-)
> 1 votes

# Answer
Yes we have used Calculator for some pretty complex stuff - first off you switch the "contribution amount' field to use the Formula widget. then you build up your calculation in the Formula Value field.

Here is a snipet of what we have put in the Formula value field

> ({civicrm\_1\_contribution\_1\_cg10\_custom\_118}\*30)+({civicrm\_1\_contribution\_1\_cg10\_custom\_122}\*25)+({civicrm\_1\_contribution\_1\_cg96\_custom\_287}\*80)+({civicrm\_1\_contribution\_1\_cg96\_custom\_293}\*30)+({civicrm\_1\_contribution\_1\_cg96\_custom\_294}\*30)+({civicrm\_1\_contribution\_1\_cg96\_custom\_295}\*8)

Outcome for us is something like this:
> 1 votes

---
Tags: webform-civicrm
---


title: I am trying to set up easycron

text:
# Question
Title: I am trying to set up easycron
I am trying to set up easy cron and everythingI am seeing says:

name=username&pass=password&key=site-key

Am I suppose to substitute my wordpress username and password for this? What is the site-key?

# Answer
> 2 votes
The username and password are for a WordPress user. I would recommend setting up a user specifically for this purpose and don't use it for anything else.

You will need to give the user the correct permissions:

* View all contacts
* Access CiviCRM
* Access CiviMail

Please see the documentation for more details: Scheduled jobs

You will need to set the site key in the civicrm.settings.php file - see: Site key

---
Tags: wordpress, cron, scheduled-job
---


title: Wrong return URLs in PayPal Standard

text:
# Question
Title: Wrong return URLs in PayPal Standard
I'm using the api to process contributions from some custom pages I have created, specifically the call to civicrm\_api3('Contribution', 'transact', $params).

When I use PayPal Standard as my payment gateway how do I get the Cancel URL and Success URL to point back to the pages I have created? I can't see a way to override the default urls.

The Success url is http://example.com/administrator/?option=com\_civicrm&task=civicrm/contribute/transact&\_qf\_ThankYou\_display=1&qfKey= However I would like to redirect to http://example.com/index.php?option=com\_xxx&task=payments.success

The Cancel url is http://example.com/administrator/?option=com\_civicrm&task=civicrm/contribute/transact&\_qf\_Main\_display=1&cancel=1&qfKey= However I would like to redirect to http://example.com/index.php?option=com\_xxx&task=payments.cancel

Do I need to create my own Payment Gateway that inherits from the PayPal Payement Gateway? Or can I redirect the CiviCRM Tranact pages to point to the pages I need?

# Answer
I used the alterPaymentProcessorParams Hook to override the parameters 'return' and 'cancel\_return'.

The code looks like this:

```
function civicrm_alterPaymentProcessorParams($paymentObj,  &$rawParams,  &$cookedParams)
{
    if ($paymentObj->_processorName == "PayPal Standard")
    {
        if (!empty($rawParams['successUrl'])) {
            $cookedParams['return'] = $rawParams['successUrl'];
        }
        if (!empty($rawParams['cancelUrl'])) {
            $cookedParams['cancel_return'] = $rawParams['cancelUrl'];
        }
    }
}

```

$rawParams is the parameters that you passed to the payment processor in CiviCRM and cookedParams is what is passed from CiviCRM on to the Payment Site.
> 3 votes

---
Tags: api, contributions, paypal
---


# Question
Title: Canceling Recurring Contributions Without PayPal
I just noticed that our receipts for recurring contributions say "You can cancel this recurring contribution by visiting this page" with a link to PayPal's homepage and "You can update your amount by visiting this page" again, with a link to PayPal's homepage.

Almost all of our contributors are using credit cards, not PayPal. How can I set this so our contributors can cancel a recurring contributions or increase the amount, when they are not using PayPal?

Thank you CiviCRM 4.7.22 on WordPress 4.8.22

# Answer
Have a look at this Q&A. I think it is the answer you are looking for

Wrong return URLs in PayPal Standard
> 1 votes

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


# Question
Title: CiviRules opens strange window after disabling rule
I'm experiencing strange behavior of CiviRules v1.12 (CiviCRM 4.7.14.)

If I **disable** a rule, an unrelated window pops-up. In this case, *Fundraising call report*. Why should it open a report, if I disable a rule? (screenshot added)

# Answer
> 1 votes
I think this is due to a bad user context somewhere in CiviRules. And probably related to this issue: https://github.com/CiviCooP/org.civicoop.civirules/issues/78.

The obvious next question is when will it be fixed? There are a few answers to that:

1. as soon as someone with programming skills feels the need to contribute a fix, which will earn him or her eternal fame.
2. when one of the CiviRules customers pays me (or another CiviCRM partner) to fix it.
3. When I get to my monthly community time and it is on top of my to do list.

The latter one is possibly in december, the earlier ones are unpredictable for me :-)

# Answer
> 0 votes
The fundraising call report is not part of CiviCRM core, my best guess is that whichever extension it comes from is behaving badly, i.e. not playing well with CiviRules.

---
Tags: civirules
---