title: Could not find a valid session key

text:
# Question
Title: Could not find a valid session key
Since i installed CiviCRM on my Drupal site i can't save users anymore.

> Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance.
>
> Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.
>
> Error type: Could not find a valid session key.

Civi Resource urls for Civi is correct. It happens when i create a user with a form.

Drupal: 8.4.0

CiviCRM: 4.7.28

**Edit:** Because the original website was already built in Drupal 8 and it relies on some Drupal 8 features it will not be possible to switch to Drupal 7.

# Answer
Same accepted answer: https://stackoverflow.com/a/51280077/4329215

If you build a custom form, Civi need some fields for when a new Drupal user is created.

1: Go to Civi profiles (/civicrm/admin/uf/group?reset=1) and select the desired profile you want to include in the form. I selected "Your registration form". Go to settings of the profile and select "used for =\> Drupal User Registration" In Advanced Settings check Account creation required

2: In your custom form, implement the function: 'civicrm\_form\_user\_register\_form\_alter'.

```
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
    $validators = array(
        'file_validate_extensions' => array('jpg jpeg png'),
    );
    $form['uname'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Username*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['organisation'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Organisation name*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['password'] = array(
        '#type' => 'password_confirm',
        '#placeholder' => t('Password*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['name'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Full Name*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['email'] = array(
        '#type' => 'email',
        '#placeholder' => t('Email Address*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );

    $form['street'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Street*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['nr'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Nr*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['zipcode'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('Zipcode*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );
    $form['city'] = array(
        '#type' => 'textfield',
        '#placeholder' => t('City*'),
        '#required' => TRUE,
        '#attributes' => array('class' => array('form-control')),
    );

    //This did the trick!
    if( function_exists('civicrm_form_user_register_form_alter') ) {
        civicrm_form_user_register_form_alter($form,$form_state,'customRegistration');
    }

    $form['actions'] = array('#type' => 'actions');
    $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => $this->t('Create'),
        '#attributes' => array('class' => array('btn', 'btn-cs', 'btn-outline')),
    );
    $form['#validate'][] = array($this, 'regValidate');
    return $form;
}

```

2: In your template, add the fields with the field name from the Civi function:

```
{{custom_registration_form.civicrm_profile_register}}

```

You find the name in /modules/civicrm-drupal/civicrm.module

```
$form['civicrm_profile_register'] = array(
    '#markup' => \Drupal\Core\Render\Markup::create($html),
    '#cache' => [
      'max-age' => 0,
    ],
);

```

The fields from the profile will be included in your custom form and no problems with sessions key anymore.
> 1 votes

---
Tags: drupal, drupal-8, session
---


# Question
Title: how to have seperate contribution pages for each membership type.?
i have 3 membership types. below is the screen shot

so if a users wants to pick one of the memberships same contribution page opens up with a list of 3 membership types.

i don't want this list to be displayed at all.how can i do this so that picking up any one leads to the contribution page and no list ,may be selected membership type in hidden . is there hook available for attaching membership type before final contribution.??

i am not getting 'Receipt ' on successful contibution. as i have configured receipt message properly .

# Answer
You can create 3 contribution pages, each having single membership type(selected under Memberships tab of contribution page) and set it to default and change the link(boxes from the screenshot) to use respective contribution page.

To hide the option you can use JS or CSS.

For emails not getting send make sure you have configured everything correctly like 1. Postfix package 2. From address in CiviCRM (CiviCRM \>\> Administer \>\> CiviMail \>\> From Email Address) 3. Updated the default mail accounts (CiviCRM \>\> Administer \>\> CiviMail \>\> Mail Accounts) 4. Updated Organization Address and Contact Info (CiviCRM \>\> Administer \>\> Comminications \>\> Organization Address and Contact Info

Probably looking in Civi or CMS or apache logs for any suspicious errors might help to find the problem.

HTH

Pradeep
> 3 votes

---
Tags: wordpress, civicontribute
---


# Question
Title: What fields need to be on Gift Aid declaration form to avoid uncaught exception?
We're running Wordpress 4.9.7, CiviCRM 5.2.2, and UK GiftAid extension 3.0.1 from compucorp.co.uk. The previous extension version had a single field ('UK Tax Payer?') to add to the donation form and worked OK. As of version 3 the donation form is throwing an uncaught exception indicating that additional fields need to be on the form. Including all 8 new gift aid fields does work, but ends up duplicating address fields and making the form rather unwieldy.

Is anyone else using the new Gift Aid extension successfully? How can the process be made as simple as possible when integrated with an existing donation form?

# Answer
If you miss out required fields it should show you an user-freindly error, not throw an exception. It should also indicate what fields are required. So whether or not the required fields have been entered, this is a bug in the gift aid module.

You can raise it with the developers of the gift aid module. They have an active issues queue here https://github.com/compucorp/uk.co.compucorp.civicrm.giftaid/issues

Regarding scheduled jobs - did you get it working? If so, I recommend updating their documentation and issuing a pull request.
> 1 votes

---
Tags: wordpress, gift-aid-extension
---


# Question
Title: I'm having new trouble with CiviCRM in multisites in Wordpress
tldr; I'm after a Wordpress multisite setup that uses the same CiviCRM data for all the subsites. Each subsite can then show the relevant data, and users for each subsite can be given the appropriate permissions.

I've had this working previously, but now, using CiviCRM 5.2.2 it's refusing to work.

---

Previously (around Civi 4.6 ish) I did a multisite install of Civi.

All I did (IIRC) was install to the root site, then set it up.

When I went to the sub-sites, it showed me the CiviCRM information in the same way that it had it on the root site.

Everything was installed and working. I could see people and information about them.

I've just been trying to set up the same thing again, but this time I'm using CiviCRM 5.2.2

Now I successfully install CiviCRM in the main site.

But when I go to the sub sites, it has CiviCRM showing as needing installing. And when I try clicking the button it gives an error of:

Oops! CiviCRM is already installed CiviCRM has already been installed. To start over, you must delete or rename the existing CiviCRM settings file - civicrm.settings.php - from /wp-content/plugins/civicrm.

---

But civicrm.settings.php does not exist there.

It exists in /wp-content/uploads/civicrm

So the error message appears to be wrong as a first problem.

In the previous install that did work, it created a set of directories in:

/wp-content/uploads/sites/3/civicrm

And the civicrm.settings.php file was in there.

It has not done that in this case.

I'm very confused about what's going on.

Is this a major change between 4.x and 5.x that hasn't been documented?

Or something?

---

Things I've done I've deleted the civicrm installation canary table from the the database.

I've added the lines to the civicrm settings file as per: https://docs.civicrm.org/sysadmin/en/latest/install/multi-site/

But it still refuses to let me get into CiviCRM on the subsites.

Thanks for any insight.

Norman

# Answer
> 1 votes
I see you've commented on the recent documentation update to handle this, but in short: Newer versions of CiviCRM under WordPress have moved the default location of `civicrm.settings.php`. When installing multi-site, it's looking in the wrong location. You can either define your `CIVICRM_SETTINGS_PATH` in `wp-config.php` or put the `civicrm.settings.php` in its old location.

---
Tags: wordpress
---


# Question
Title: Edit Multi-Value / Multi-Record Fields in Profiles
I really need to allow WordPress users to submit their work experience via a page and shortcode... I've read here that it's not possible to allow a multi-value set of fields to be edited via a profile (being embedded into a WordPress page): Multi-value fields in profiles - how to?

...but these docs show it happening with a really tempting screenshot (search for "work experience" to find the section): http://book.civicrm.org/user/current/organising-your-data/profiles/

...so I wondered if it was now possible somehow or if this documentation was incorrect? Perhaps it's only possible with Drupal? We're stuck with Wordpress atm.

\****** EDIT \***** Re-created issue on http://wpmaster.demo.civicrm.org/\**

To recreate this issue, create a multi-value custom field group, then set up a profile and add the fields (following documentation). Try to test the profile in Create Mode, the error is thrown:-

"Sorry but we are not able to provide this at the moment. The requested Profile (gid=14) is not configured to be used for 'Profile' edit and view forms in its Settings. Contact the site administrator if you need assistance."

PHP Warnings:- Warning: Invalid argument supplied for foreach() in /srv/buildkit/build/wpmaster/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomOption.php on line 84 Warning: Invalid argument supplied for foreach() in /srv/buildkit/build/wpmaster/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomOption.php on line 84 Warning: Invalid argument supplied for foreach() in /srv/buildkit/build/wpmaster/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomOption.php on line 84 Warning: fopen(/srv/buildkit/build/wpmaster/wp-content/uploads/civicrm/ConfigAndLog/CiviCRM.8ae48cedfddd4cf1265fa95ce1274dd9.log): failed to open stream: Permission denied in /srv/buildkit/build/wpmaster/wp-content/plugins/civicrm/civicrm/packages/Log/file.php on line 216 Warning: fopen(/srv/buildkit/build/wpmaster/wp-content/uploads/civicrm/ConfigAndLog/CiviCRM.8ae48cedfddd4cf1265fa95ce1274dd9.log): failed to open stream: Permission denied in /srv/buildkit/build/wpmaster/wp-content/plugins/civicrm/civicrm/packages/Log/file.php on line 216

# Answer
Seems the only workaround is to use the "Edit" mode for the profile, rather than "Create" mode.

The limitation being this will only work for logged in users.
> 2 votes

# Answer
Since this is in theory in-built capability i expected it to be cms agnostic but i don't see it working when i try on demo at http://wpmaster.demo.civicrm.org/civicrm/?page=CiviCRM&q=civicrm/profile/edit&gid=14&reset=1

Which may mean this is a bug that should be added to Jira
> 1 votes

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


# Question
Title: Gift aid uploaded declarations are only showing the first image for each entry
I have a gift aid issue - basically when you upload scanned declarations against a contact, they don't show each scanned image but only the first one repeadly (for each gift aid declaration entry). The rest of the text data remains the same for each entry.

The uploaded image I have added should make things clear - the red circles indicate a scanned declaration. The issue is that they are all the same image even though in the database I see different images referenced.

Also, when I click on 'Edit Gift Aid Declaration', clicking on the images for each entry shows the different uploaded images properly. So that is a workaround but not good as a HMRC officer won't be happy if someone doesn't know of that workaround!

Any help or guidance would be much appreciated. I had a stab at trying to see where in the codebase this bug is happening but its still a puzzle.

Cheers.

# Answer
If anyone still has this problem, I can confirm that upgrading to at least 4.7.31 fixes it.
> 1 votes

# Answer
I am able to reproduce the issue in GiftAid.

However, this appears to be a CiviCRM issue. I have also tested with a standard multi-submit custom fieldset containing a file upload field by submitting two different picture files. When I click on "View" submission, the same picture got shown in the modal.

I would recommend to open an issue in CiviCRM core Jira. If you are a developer yourself, you are more than welcome to submit a fix.

Best
> 0 votes

---
Tags: civicontribute, contacts, custom-fields, gift-aid-extension, upload
---


# Question
Title: How to trigger JQuery event when drop down select list is changed in CiviCRM?
My JavaScript is triggered correctly, but I **cannot attach to the change event** for a drop down list in CiviCRM.

The ID of the actual select element is "custom\_385\_14".

I am trying to attach an event to a drop down list in CiviCRM, which populates the "Subject" field of an Activity with the value from the drop down list.

The actual input element doesn't seem to trigger the change event when the list value is changed. I've tried the following:-

```
$("#custom_385_14").change(function() {
            alert('test!');
           $("#subject").val($("#custom_385_14").val());
        });

```

\******* UPDATE \********* So thanks to Jon G pointing out Chosen isn't the library used, but Select2. According to their docs: https://select2.org/programmatic-control/events#listening-for-events I should use the following:-

```
  $('#custom_385_14').on('select2:select', function (e) {
      alert('changed!');
  });

```

However this is still not triggering the event.

I have searched the developer docs for civi and couldn't find an example of this, just a link to the Select2 docs here: https://docs.civicrm.org/dev/en/latest/framework/quickform/entityref/#select2

HTML Source below for the `<td>` containing the select list:-

```
 <td class="html-adjust">
      <div class="select2-container crm-select2 crm-form-select select2-allowclear" id="s2id_custom_385_14" style="width: 200px;"><a href="javascript:void(0)" class="select2-choice" tabindex="-1">   <span class="select2-chosen" id="select2-chosen-9">standard</span><abbr class="select2-search-choice-close"></abbr>   <span class="select2-arrow" role="presentation"><b role="presentation"></b></span></a><label for="s2id_autogen9" class="select2-offscreen">tutorial type</label><input class="select2-focusser select2-offscreen" type="text" aria-haspopup="true" role="button" aria-labelledby="select2-chosen-9" id="s2id_autogen9"></div><select class="crm-select2 crm-form-select" data-crm-custom="Tutorial_fee_details:tutorial_type" data-api-entity="Activity" data-api-field="custom_385" data-option-edit-path="civicrm/admin/options/tutorial_type_20180704095928" name="custom_385_14" id="custom_385_14" tabindex="-1" title="tutorial type" style="display: none;">
    <option value="">- none -</option>
    <option value="1" selected="selected">introduction</option>
    <option value="2">standard</option>
    <option value="3">portfolio review</option>
</select>
<a href="/civicrm/admin/options/tutorial_type_20180704095928?reset=1" class="crm-option-edit-link medium-popup crm-hover-button" target="_blank" title="Edit Options" data-option-edit-path="civicrm/admin/options/tutorial_type_20180704095928"><i class="crm-i fa-wrench"></i></a>
          </td>

```

How can I use Jquery code to watch for when the values change in CiviCRM drop down lists?

# Answer
> 3 votes
You cannot always predict the id or name for custom field for an activity, it is either `custom_385_14`(incase of saved custom field for activity where 14 is id from custom value table) or `custom_385_-1` incase of new one.

I always follow below snippet to work incase of custom field and it does call my change event when i change option from select dropdown. I believe you choosed wrong id to actually call change event.

```
CRM.$(function($) {
  $("div#customData select[data-api-field='custom_385']").change(function() {
    $("#subject").val($(this).val());
  });
});

```

Or

> Try after installing the extension https://github.com/pradpnayak/org.civicrm.jsoncaseactivity . I have added the JS in https://github.com/pradpnayak/org.civicrm.jsoncaseactivity/blob/master/templates/CRM/Case/Form/Activity.extra.tpl

HTH

Pradeep

# Answer
> 0 votes
I have struggled in the past to add JS behaviours to elements rendered by CiviCRM. But then I came across "extra templates" as described here. https://civicrm.org/blog/dave-greenberg/now-its-easier-add-custom-behaviors-templates and I have had success with that method.

You can put them in your configured Custom Templates directory or you can put them in a CiviCRM extension.

I don't think they work if you put them in a Drupal module, however.

---
Tags: drupal, jquery, 5.1.0
---


title: Live links are not working for Events

text:
# Question
Title: Live links are not working for Events
I am using Joomla 3.8.8 stable and CiviCRM 4.7.25 New or copied live event and payment links are being redirected to the homepage. Existing events work and go to forms.

# Answer
When I click your links I can see that the "bad" link returns a 302 redirect - but the "good" link does not. I would review your CiviCRM log (in ConfigAndLog for an error that appears when someone hits the bad link.
> 1 votes

---
Tags: civievent, links
---


# Question
Title: Can I remove old discount codes without affecting contribution records?
We've got a fairly long list of discount codes piling up. Many of them are specific to old events and are no longer used. Can I just delete them without affecting other data in the database?

# Answer
> 3 votes
I tested deleting a discount code with CiviCRM 5.2.1 and CiviDiscount 3.4

When deleting a discount code I saw this warning:

WARNING: Deleting this discount code (GMC610) will prevent users who have this code to avail of this discount. Do you want to continue?

After I deleted the code I searched for the contact id in the "cividiscount\_track" table and the item was still there. However, it appears the code was removed from the "cividiscount\_item" table as would be expected. So, it appears the code is removed from the list but the tracking data remains in the database.

I checked the Contributions in the contact record of the contributor before and after and I did not notice any changes.

It looks like the only thing that is removed in the contact record is on the 'Codes Redeemed' tab, you will no longer see the code in the CODE column. However you do see the date so you will know some type of code was redeemed.

In summary, it seems safe to delete discount codes as long as you don't mind losing the record of which code was used by a contact.

---
Tags: cividiscount
---


# Question
Title: How are folk storing lots of Files on Cases?
I know there are File fields on Activities, and we can add File Fields to the case itself.

But say there are 20 documents to add over time.

while googling I found this which sounds interesting https://github.com/CiviCooP/org.civicoop.documents since their roadmap talks about searching by 'case type'

# Answer
> 2 votes
There are different solutions as you suggested. One is using custom fields of the type file upload or use activities. There is indeed a document extension and this is one also capable of storing documents on a case. The advantage of the latter is that it could also store versions of the same document.

It is not yet possible to search for documents on a case.

# Answer
> 2 votes
We did end up using Documents \- we added quite a few new features to it to extend its capabilities which you can read about here

---
Tags: civicase, attachments, files
---


# Question
Title: Getting CORS error from CiviCRM dashboard dashlets
I've been having problems with a new install of CiviCRM 5.3 in Multisite on Wordpress.

It seems to be working properly in the main site.

My intent is to have one CiviCRM database that works across all the subsites, sharing the contact data.

On the subsites, when I go to the CiviCRM dashboard, I get the dreaded Network Error pop up. IN the Web Developer console it shows this error:

Access to Font at 'https://dev.domain.nz/wp-content/plugins/civicrm/civicrm/bower\_components/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0' from origin 'https://crew.dev.domain.nz' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://crew.dev.domain.nz' is therefore not allowed access.

---

And the default and the Activities dashlets just spin with the CiviCRM logos.

If I remove those dashlets from the dashboard, then the problem goes away.

I would of course like to keep them.

I have added

Header set Access-Control-Allow-Origin "\*"

to my .htaccess file for Wordpress. This did not help.

I'm sure that this isn't 100% a CiviCRM problem, but I'm not sure where else to ask...

Thanks, Norm

# Answer
OK. So I've found what I think is a pretty serious problem with the current Civi CRM setup and multisites...

There's an entire section up the top of civicrm.settings.php that has these lines:

```
$civicrm_paths['wp.frontend.base']['url'] = (URL path)
$civicrm_paths['wp.backend.base']['url'] = (URL path to admin)
$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] =(URL path) to civicrm

```

The paths are hardcoded to the main site URL.

This seems to be what's causing these problems I'm having. Because if I change it using the code below, then it appears to work again.

=======================

```
if(function_exists('is_multisite') && function_exists('home_url')) {
  $url = home_url();
}
else {
  $protocol = strstr('HTTPS', $_SERVER['SERVER_PROTOCOL']) ? 'https://' : 'http://';
  $url = $protocol . $_SERVER['SERVER_NAME'];
}

// Additional settings generated by installer:
$civicrm_paths['wp.frontend.base']['url'] = $url.'/';
$civicrm_paths['wp.backend.base']['url'] = $url.'/wp-admin/';
$civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = $url.'/wp-content/plugins/civicrm/civicrm';

```

===================

But is this a good idea? I don't know...

Norm
> 2 votes

---
Tags: wordpress, multisite
---


# Question
Title: Free registrations still asking for payment info
We are using CiviDiscount and when a discount is 100%, either with a code or automatic discount, and the submissions cannot be completed with a "Payment Info Missing" error. Using civi 5.2.2 and Stripe payment plugin. Any ideas?

# Answer
> 3 votes
I found out there is a fork of the Stripe payment plugin for Civi 5.X. This fixed my issue. Can be found here:

https://github.com/mattwire/com.drastikbydesign.stripe

# Answer
> 1 votes
This is known bug with the Stripe payment processor but unfortunately there’s no one assigned for the fix as yet –

https://github.com/drastik/com.drastikbydesign.stripe/issues/215

# Answer
> 0 votes
It sounds like a bug in CiviDiscount.

They have an active issues list here https://github.com/civicrm/org.civicrm.module.cividiscount/issues.

If your issue is not already reported, I would suggest doing so.

---
Tags: cividiscount, stripe
---


# Question
Title: How do I set the margins on a PDF print out of a CiviReport?
How do I set the margins on a PDF print out of a CiviReport?

Things I tried: Setting these in print.css on the body element. had no effect.

# Answer
> 3 votes
As of CiviCRM 5.3 the margins on a PDF print of a CiviReport take their margins from the default PDF page format. This can be administered at:

Choose: Administer \>\> Communications \>\> Print Page (PDF) Formats

Then edit the format marked default and set the margins individually. The margins are set in the Unit of Measure of that page format.

---
Tags: civireport, printing
---


# Question
Title: How to get job.execute to run with drush
I have the command in cron `cd /home/quabbinm/ && /usr/local/bin/drush -r /home/quabbinm/public_html/trainingactivebystanders.org -l https://trainingactivebystanders.org -u nan civicrm-api job.execute` which results in errors

```
X-Powered-By: PHP/5.6.33
Content-type: text/html; charset=UTF-8

<br />
<b>Notice</b>:  Undefined variable: argv in <b>phar:///usr/local/bin/drush/drush</b> on line <b>114</b><br />
<br />
<b>Warning</b>:  array_shift() expects parameter 1 to be array, null given in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>171</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>182</b><br />
<br />
<b>Warning</b>:  pcntl_exec() expects parameter 2 to be array, null given in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>359</b><br />
<br />
<b>Notice</b>:  Use of undefined constant STDERR - assumed 'STDERR' in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>363</b><br />
<br />
<b>Warning</b>:  fwrite() expects parameter 1 to be resource, string given in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>363</b><br />
<br />
<b>Notice</b>:  Use of undefined constant STDERR - assumed 'STDERR' in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>364</b><br />
<br />
<b>Warning</b>:  fwrite() expects parameter 1 to be resource, string given in <b>phar:///usr/local/bin/drush/includes/startup.inc</b> on line <b>364</b><br />

```

When I run the same command at the command line it runs fine

# Answer
> 1 votes
It looks like you are using an incorrect version of php when this command runs from cron. According to this resource you are receiving these errors because you are using php-cgi rather than the php CLI binary. Most reports of this error are regarding 1 & 1 hosting.

Rather than using /usr/bin/drush use something like this:

> /usr/bin/php /usr/local/bin/drush {rest of the command}

Where /usr/bin/php is the path to the php CLI binary on your system.

# Answer
> -1 votes
Add this line to the crontab file:

```
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

```

---
Tags: cron
---


# Question
Title: Python Civicrm API Keeps Giving 404 Error
I'm trying to use the Python Civicrm API located here: https://github.com/tallus/python-civicrm . I can connect to the site just fine, but anytime I try to query any of the content I get a 404 Error from the /extern/rest.php.

I am using an Admin account that has an API key.

```
from pythoncivicrm.pythoncivicrm import CiviCRM

url = 'http://sitename.org'  # works
site_key ='642346924242934720'  # works
api_key ='dbJKbjkse903332'  # works
civicrm = CiviCRM(url, site_key, api_key) # works

search_results = civicrm.get('Contacts') # ERROR

```

> pythoncivicrm.pythoncivicrm.CivicrmError: request to https://sitename.org/extern/rest.php failed with status code 404

If I'm already admin, what other possible reason could it be that I'm still getting blocked?

Thank you!

# Answer
> 1 votes
The URL was wrong like, @user4278 suggested. It should have been: **sitename.org/sites/all/modules/civicrm/extern/rest.php**

# Answer
> 0 votes
Why do you use the Python library? You can just call the URL directly with the library request. If you want to get the correct URL you can fo to the page http://domain.tld/civicrm/api#explorer and chose an action, once you chose one, you get the full URL of the request. You'll have to make some changes to the URL tho, you have to replace the site\_key and the api\_key.

---
Tags: api, admin, rest
---


# Question
Title: Creating Membership Directory using Views in Drupal 7
I was trying to create a membership directory view in Drupal 7 but came across this error:

```
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'egyptia2_ess.droe_civicrm_membership' doesn't exist

```

I created the view and selected Show CiviCRM Memberships for the Content, and then after clicked continue and edit, it gave me the above error.

Double checking, I don't see that table in my MySQL database and am curious if there something I have to activate first prior to creating a view such as this one...

I'd appreciate any help - Matt

# Answer
> 4 votes
If you have separate databases then you need to enable CiviCRM Drupal views integration you need to add some information to the sites settings.php file.

Visit - /civicrm/admin/setting/uf?reset=1

Data from the above CiviCRM page needs to be copied and pasted into your sites settings.php file.

Detailed info can be found here

---
Tags: drupal, drupal-views, directory
---


# Question
Title: Can IATS be used with Simple Donate Extension? - SOLVED
\****ISSUE RESOLVED. SEE COMMENTS BELOW\****

We are using Civi 5.1 on WordPress 4.9.7

A month ago, we switched our payment processor to IATS which we really like. Now we would like to simplify our donation pages with the Simple Donate extension.

Normally we would have what you see in screenshot number 1 .

When I install the IATS extension, that Simple Donate option is removed from the menu and the IATS option replaces it, as you see in screenshot number 2.

The question is, can IATS and Simple Donate be used together? How do I get both options to appear on the menu?

Thank you.

# Answer
I suggest that if you can copy the SimpleDonate link before it goes from your menu and then assuming you can visit that page then you can probably just add yourself a new link in the menu
> 6 votes

---
Tags: wordpress, contribution-page, iats, simple-donate-form
---


# Question
Title: zero s after the decimal in simple donate
Hi I am using CiviCrm 5 on wordpress,

donation amounts displayed with zeros floating points after the decimal for example 25.00000000 instead of 25

Is there any solution?

# Answer
**Short answer**: I've prepared a patch that I'd love for someone to test to fix this.

**Longer answer**: In recent months, CiviCRM has implemented support for currencies with more than two digits after the decimal point. This is important both for cryptocurrencies as well as certain countries' tax calculations. The decision was, "Store all currencies in the database with nine significant digits, and when displaying them, format them according to the rules of that currency."

This all happened in CiviCRM core and it went so well that end users who didn't need the greater accuracy didn't notice. Unfortunately, no one updated Simple Donate.

I don't use Simple Donate, but recently handled a similar problem in my custom code, so I looked and it was a 4 line fix.

I'd love for someone affected by this problem to test my patched version and report back if you have any problems with it. If there are no issues, I'll submit the patch to the original authors. I'd especially love feedback from users who don't use US dollars as their currency!

Find the fix on my Github repo or download directly. When unzipping, please be sure to rename the folder to match your old extension folder name that you're replacing.
> 5 votes

---
Tags: contribution-page, simple-donate-form
---


# Question
Title: How can I report a bug caused by an extension?
CiviCRM.org has a page on reporting bugs, but my bug is in an extension. How should I report it?

# Answer
> 3 votes
You must report it to the extension author. The CiviCRM core team doesn't have any control over third parties who write extensions.

To find the author's preferred place to report a bug:

* Go to **Administer menu » System Settings » Extensions**.
    + It might be in **Administer menu » Customize Data and Screens » Manage Extensions** if you upgraded from an older version.
* Click the **triangle** to the left of the misbehaving extension (see screenshot below).
* Click on the *Support* link and submit your issues there.

Usually the link will be to an issue repository - possibly on Github, possibly on the CiviCRM GitLab. Occasionally it will be to Stack Exchange.

Some authors may only offer paid support. Please remember that extension authors give their work away for free and treat them well!

---
Tags: extension, issues, bug-reporting
---


title: creating complex structure

text:
# Question
Title: creating complex structure
1\> Is it possible in civicrm to create a structure where . there is a main Branch this BRANCH has 4-5 sub branches BRANCH1,BRANCH2,BRANCH3,BRANCH4,BRANCH5 each of sub branches has 4-5 membership type.

2\> what type should i mention for custom fields like 'RESEARCHING SCHOLAR LINKS' where somebdy was member of Branch1 and new member is trying to be member of branch 2,.

3\>what should be the content type be given to custom fields so that relationships can be easily created/established.

# Answer
> 1 votes
> Is it possible in civicrm to create a structure where there is a main Branch this BRANCH has 4-5 sub branches BRANCH1, BRANCH2, BRANCH3, BRANCH4, BRANCH5 each of sub branches has 4-5 membership type.

Yes - just make a Membership Type and set each of the sub-Branches as the 'Organisation' for that Memb Type

> what type should i mention for custom fields like 'RESEARCHING SCHOLAR LINKS' where somebdy was member of Branch1 and new member is trying to be member of branch 2,.

Probably a Contact Reference field

> what should be the content type be given to custom fields so that relationships can be easily created/established.

Relationships do not have anything to do with Custom Fields. You can use Contact Reference custom fields to link one Contact to another, but it is more common to use Relationship Types

---
Tags: wordpress, civimember
---


# Question
Title: Relationship Type "name" as Drupal [Rules] Token in Civicrm Entity module
Is it possible to retrieve Relationship Type Name in addition to an ID as Rules Token in Drupal 7? It would add some value to "Create/Edit Relationship" Rules action: we could use it in emails, like "Hello mr. Dow, congrats, you're Organizaton Boss of The Company now" instead of "Mr. Dow, you are \[Relationship ID\] of The Company". I'd like to provide a patch for civicrm\_entity but not sure where to start from. Any advise, please?

*Cross-posted here: https://www.drupal.org/project/civicrm\_entity/issues/2986112*

# Answer
It seems that **Fetch CiviCRM entity by property** action loads anything else but ID, so, in order to get a full Relationship Type, one may want to use another action with almost the same name has been used ( **Fetch entity by id**) which loads Relationship Type by its ID from any Relationship.
> 0 votes

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


# Question
Title: LIKE search in API for membership_type_id
Is it possible to do a membership get api request with a "LIKE" operator **with wildcards** for membership\_type\_id? Trying this out, I get

> CiviCRM\_API3\_Exception: \[2001: 'Something%' is not a valid option for field membership\_type\_id

Which is fair enough enough but it means that LIKE isn't supported even though it's in the api explorer's operator dropdown.

Thanks!

# Answer
SQL doesn't support LIKE for integer fields. For something like membership type id I'm not even sure what it would mean unless you have 10 or more, and even then still not really meaningful.
> 1 votes

# Answer
Please use the following -

For any integer you can use IN rather than Like

```
$result = civicrm_api3('Membership', 'get', array(
  'sequential' => 1,
  'membership_type_id' => array('IN' => array("General", "Student")),
));

```

If selecting string LIKE is used

```
$result = civicrm_api3('Membership', 'get', array(
  'sequential' => 1,
  'source' => array('LIKE' => "payment"),
));

```

I guess this helps!!!
> 0 votes

# Answer
It seems it is working now in 2018 (have tried to find Relationships Type). Just put a search term (a word or part of something) in"LIKE" text area as **%YourSearchTerm%**
> 0 votes

---
Tags: api
---


# Question
Title: payment page - total not correct when using Tax
I have setup a webform to take registrations and payments for events. I have enabled tax to be 10% and have calculated the cost of each event to be 10% less, so Civi will add on the tax to each line item (i assume that this is the only way Civi Tax works). The total is $0.1 by out. Here is why:

$75 - 10% = $68.18 (I have set the Participant Fee to $68.18)

$68.18 * 3 events = 204.54 Add the tax: 204.54 * 0.1 = 20.454 ($20.45, rounded)

$20.45 + 204.54 = $224.99

Edit: Seems like a similar issue to https://github.com/civicrm/civicrm-core/pull/9711 & https://github.com/civicrm/civicrm-core/pull/9710

Are these patches still relevant?

# Answer
> 1 votes
Sales Taxes in CiviCRM are added on checkout - so if you want to get to nice rounded numbers you may need to give your participant\_fee a few more decimals.

Glad that worked for you Ben!

---
Tags: webform-civicrm, taxes
---


# Question
Title: Can I convert a smart group to a static group by editing the db directly?
We have a bunch of smart groups that a lot of other smart groups rely on. I'd like to turn these former groups into regular groups and then generate them once a day, to improve performance. But deleting them and reconfiguring all the other groups with the replacements will be quite fiddly, so I'm wondering if I can convert them.

Has anyone tried this? Can I just edit civicrm\_group to remove the:

* saved\_search\_id
* where\_clause
* select\_tables
* where\_tables

? Just wondering if there are any gotchas I need to be aware of.

# Answer
Unfortunately **NO**, updating saved\_search\_id to NULL will actually convert it to normal group but no contact's will get added into this group since for smart group the contact are calculated from civicrm\_group\_contact\_cache table which is rebuild periodically and for normal group its from civicrm\_group\_contact which is static. So you will need to first rebuild the contacts for a group and then move data from cache to static table like

```
INSERT IGNORE INTO civicrm_group_contact (group_id, contact_id, status)
SELECT group_id, contact_id, 'Added' FROM civicrm_group_contact_cache
  WHERE group_id IN (1);

```

HTH

Pradeep
> 5 votes

---
Tags: smartgroups
---


# Question
Title: CiviCRM reports Cron not running, but my web host is adamant that it is
I'm using the cli.php method to run cron as described in the System Administrator Guide.

I am able to run this command from ssh, and it seems to execute fine:

```
php /var/sites/c/<mydomain>/public_html/sites/all/modules/civicrm/bin/cli.php -s <mydomain> -u <mydrupalusername> -p <mydrupalpassword> -e Job -a execute

```

Immediately after running that CiviCRM's System Status page will be updated with the time it ran.

However, when I use my host's control panel to run that every 15 minutes, nothing seems to happen, and the CiviCRM status page eventually returns to saying 'Cron not running'.

The advanced view of my host's control panel, which supposedly lets me edit the raw crontab, shows the following line:

```
*/15 * * * * php /var/sites/c/<mydomain>/public_html/sites/all/modules/civicrm/bin/cli.php -s <mydomain> -u <mydrupalusername> -p <mydrupalpassword> -e Job -a execute

```

But nothing is happening at the 15 minute intervals. CiviCRM's status page doesn't update. I have the CiviCRM Update Check set to always run as well, and that doesn't update on the scheduled jobs settings page either.

I've spoken to my host's support, and they insist that it *is* running the command every 15 minutes, and that it should be doing it with the same rights and in the same location as it does when I run it manually via ssh.

The host's logs that I can see via the control panel update every 15 minutes with this line:

```
Jul 17 12:45:24 cron2-lxc crond[107640]: (<myhostingusername>) CMD (php /var/sites/c/<mydomain>/public_html/sites/all/modules/civicrm/bin/cli.php -s <mydomain> -u <mydrupalusername> -p <mydrupalpassword> -e Job -a execute)

```

What's going wrong?

# Answer
I think you probably will need to provide full path of php to execute php files.

You can try the option from https://stackoverflow.com/questions/19916949/running-php-from-cron-did-not-run-as-cli/19917512#19917512

HTH

Pradeep
> 2 votes

---
Tags: drupal, installation, cron, cli
---


# Question
Title: information on how to translate the component for joomla
where can I find the italian translations of the civicrm component for joomla? or how can I do the translation in Italian?

* List item

# Answer
CiviCRM has its own setting to set default language. To configure CiviCRM to use an translation:

* Download the translations distribution - civicrm--l10n.tar.gz - from the CiviCRM downloads page. This tarball contains all files for the latest available translations.
* Uncompress the tarball and you will see a directory called civicrm, containing two subdirectories called l10n and sql. The l10n directory contains a set of sub-directories named using their local codes. (Example: the Italian translation files will located in /civicrm/l10n/it\_IT).
* Copy this l10n directory, together with all its subdirectories into your CiviCRM codebase root directory.(note if creating the l10n folder manually it should be ell-ten-n, not capital-I-ten-n)

```
For Joomla this would be site_root/administrator/components/com_civicrm/civicrm. So if you wanted the it_IT language it would look like this site_root/administrator/components/com_civicrm/civicrm/l10n/it_IT/

```

**To enable the default language**

* Login to CiviCRM (as a user with "administer CiviCRM permissions").
* Go to Administer » Localization » Languages, Currency, Locations.
* You should now be able to see and select all the localization options in the Default Language and drop-down menu. If you don't, and instead can just see the default 'English (United States)' option, check the preceding steps as the drop-down options are set by the directories under your l10n directory. Also be sure to confirm that the l10n directory is correctly named as l10n (that is: el-ten-en and not eye-ten-en).

HTH

Pradeep
> 1 votes

---
Tags: joomla
---


# Question
Title: How can I (on page 2) show First Name of an Existing Contact - static (on page 1) without dragging it to page 2?
The First Name must also show on page 1 (and page 3/4/5/6 etc). If I'd just have two pages I could show Existing Contact on page 1 (display name) and then show First Name on page 2 but I've got 3/4/5/6/7/8 pages

First Name is an input\[readonly\] field - just a handrail to remind the parents which child's info they are updating to e.g. get the allergies and the busing filled out correctly.

Only easy 'option' I can see thus far is to put First Name (of Student 1) in a Fieldset Student 1 (on page 1). Then add a Fieldset Student 1 (on page 2) - and move the custom fields from Student 1 that need to go to page 2 (healthcare / allergy fields in this case) into that. Same for page 3 (selecting busing options). Etc. But then the parents have to remember who Student 1 (2/3/4) is all the way through.

Any ideas on how one could re-show Existing Contact fields on a next page? I've been thinking about perhaps creating a Student Name field in each of the custom data sets for contact type Student - and then PHP populate that with = First Name (or Display name) - make them readonly etc - pull these into the Webform - and they'd always 'travel' to any page with the rest of the fields in their dataset. But that would look a bit odd on the Student's CiviCRM Contact summary page.

# Answer
I could not see a way to get tokens working in webform conditionals - so I've worked it out with a hook\_form\_alter hook. It's like building your own token.

On page 2 create a fieldset:

```
Label = STUDENT1TOKEN - Health
Field Key = student1token

```

Then in code you can replace your token: STUDENT1TOKEN with any value that has already been submitted on page 1 of this specific webform.

Dependence on field\_key is not great - in a next pass I should probably just scan for STUDENT1TOKEN in all fieldset titles, \[and then of course STUDENT2TOKEN, STUDENT3TOKEN, STUDENT4TOKEN\].

```
function webform_civicrm_mystuff_form_webform_client_form_342_alter(&$form, &$form_state, $form_id) {
  // if we're on page2...
  if ($form['details']['page_num']['#value'] == 2) {
    if (isset($form_state['input']['submitted']['layoutbox_students']['civicrm_3_contact_1_fieldset_fieldset']['civicrm_3_contact_1_contact_first_name'])) {
      $student1_first_name = $form_state['input']['submitted']['layoutbox_students']['civicrm_3_contact_1_fieldset_fieldset']['civicrm_3_contact_1_contact_first_name'];
      $text_fieldset_title = $form['submitted']['student1token']['#title'];
      $new_fieldset_title =  str_replace('STUDENT1TOKEN', $student1_first_name, $text_fieldset_title);
      $form['submitted']['student1token']['#title'] = $new_fieldset_title;
    }
  }
}

```

End result: your CiviCRM contact's name in a fieldset label on the next page!
> 2 votes

# Answer
I know this question is pretty old but I recently had a similar requirement for a client where they wanted the user to see the value of a field they had entered on the first page to be displayed on subsequent pages.

In this example we want the value of first name to be displayed on page two that has been entered on page one.

Page 1 of the webform as seen by the user -

The value of first name as entered on page one can be displayed on page two by using a token in a markup field in the below format -

\[submission:values:civicrm\_1\_contact\_1\_fieldset\_fieldset:civicrm\_1\_contact\_1\_contact\_first\_name\]

The token is built using the field set form key and the field name form key –

Page 2 of the webform as seen by the user with the value of first name displayed -
> 2 votes

# Answer
You might be able to do this with webform conditionals. Take your first idea (putting first\_name on page 1 as a hidden field) then create some extra throwaway webform fields (like name\_page\_2, name\_page\_3, etc) and set up a webform conditional rule to fill their values with the value from page 1.
> 1 votes

---
Tags: webform-civicrm
---


# Question
Title: Disable select fields in a drupal webform
I've created a webform for reviewers to make a decision on a scientific abstract which is a CiviCRM activity.

Their review is a second activity in CiviCRM, all linked within a case.

All is working as needed using the activity1=\[id\] parameters in the url.

However, I want reviewers to be able to see the details of the abstract activity to make their review decision, but not change them. Text fields / areas are simple as webforms allow you to disable (see image below), but select fields, this option doesn't appear.

Is there a way I can disable select fields / make them uneditable but visible?

# Answer
> 1 votes
When you are on the page for editing the form component, you can change the widget from select options to a textfield. Then the option to disable becomes available.

However, it will display the *value* of the select, not the *label* \- for example I tried with Name Prefix and for "Dr" it put "4".

But if you are dealing with custom fields where you can set the values to be the same as the labels that shouldn't be a problem.

Where it might cause a problem is activity status - could you get away without showing that?

# Answer
> 0 votes
You will need to make sure your webform has more than one page.

Make sure your select option is on page 1 of the webform.

Select “Private” for the select option. This is presuming your reviewers don’t have webform results permission granted. This option will then be hidden for your reviewers.

Then follow the steps as described here

The select option will then appear on any subsequent pages as a read only field.

---
Tags: webform-civicrm
---


title: Mosaico: Packages are missing (Beta 4)

text:
# Question
Title: Mosaico: Packages are missing (Beta 4)
Just upgraded to Beta 4 - getting the following error.

> Mosaico: Packages are missing Mosaico requires dependencies in its "packages" folder. Please consult the README.md for current installation instructions.

Wordpress 4.9.7 Civi 5.3

# Answer
The "releases" on GitHub don't include the dependencies and aren't supposed to be downloaded directly for "consumption" - the supported workflow is either to use the advanced instructions in the readme file (running install.sh) or to install using the tarball from the CiviCRM extensions directory.

The final build process for mosaico merges GitHub repos to create the tarball.

**Extensions Directory page:** https://civicrm.org/extensions/email-template-builder

**Chat discussion on the same issue:** https://chat.civicrm.org/civicrm/pl/p7ih3bq36trp5frqnmccy1o3fy
> 2 votes

---
Tags: wordpress, civimail, mosaico, 5.0
---


# Question
Title: Event Registration on Behalf of a Contact is Broken
**Wordpress**: 4.9.6 **Civi**: 5.3.0

When trying to add event registration on behalf of a contact, I encounter a javascript error that is causing a couple issues:

1. I am unable to select an existing event.
2. Any event custom field accordions are missing. They usually appear at the bottom of the other fields.

This is the error that I'm seeing in the Chrome Console:

**Uncaught SyntaxError: Unexpected token ,**

```
// Event and event-type custom data
CRM.buildCustomData('Participant', eventId, , null, null, null, true);

```

Looking in Participant.tpl, `{/literal}{$eventNameCustomDataTypeID}{literal}` seems to be the missing parameter or token.

I'm wondering if there is a DB issue. I can't find anything useful in the Civi logs. This Civi instance was migrated from Joomla to Wordpress and I'm wondering if something got lost in the move.

Here is a side by side screenshot if you need a visual reference.

Any help would greatly be appreciated!

# Answer
> 2 votes
This error usually occurs when the option values for Custom data type are disabled or deleted. Make sure you have all the options values required for event are enabled for Custom data type option group. Here are the options

If a option value is missing then you will need to add the option value either through UI or api. However for some option values its not possible to add same options with same machine name so it is always better to add such options through API Explorer.

Navigate to CiviCRM \>\> Support \>\> Developer \>\> API Explore. And use the options shown in the image below once you are done with selection then click on execute button for api to process the params you selected.

HTH

Pradeep

---
Tags: civievent
---


# Question
Title: Financial Account cannot be change to non deductible
This seems like a core issue, possible with 4.7, but I cannot find under https://lab.civicrm.org/groups/dev/-/issues

Once a Financial Account has been marked as deductible, it cannot be changed back to non-deductible.

To reproduce: Edit a non deductible Financial Account Check box for "deductible?" Save On the Financial Accounts screen, the account will now show as Deductible Edit the same Financial Account (which is now deductible) Uncheck box for "deductible?" Save On the Financial Accounts screen, the account will not have changed

# Answer
> 3 votes
This is a core bug and have reported issue at https://lab.civicrm.org/dev/financial/issues/28 and also submitted fix at https://github.com/civicrm/civicrm-core/pull/12500

Can you please try after applying the patch from here?

If the patch works without any error than please comment on the PR as it would help for PR to get merge quickly into core.

HTH

Pradeep

---
Tags: financial-accounts
---


# Question
Title: webform participants extension - maximum of 9 tickets until error
I'm using this extension for invoicing tickets bought via a webform. https://github.com/fuzionnz/nz.co.fuzion.webformparticipants

When buying 9 or less tickets it works as required. Once 10 or more tickets are bought and the user submits payment its takes a long to load the next page which is white.

The payment is taken via eWay and the participants are entered into Civi. No confirmation emails are sent.

Without the extension enabled the payment goes through. I would like to use the extension, otherwise only 1 ticket is included on the invoice.

CMS/modules/Civi are on the latest version. Does anyone have any advice how to fix this issue? Cheers

# Answer
> 0 votes
You could raise an issue if you can identify the actual issue but we have this working on webforms with up to 30 tickets afaik

Pls dig in to your logs and see if you can find more information

---
Tags: civievent, webform-civicrm, extension
---


title: Sponsored events

text:
# Question
Title: Sponsored events
I am just browsing CiviCRM as a possible tool to run an annual sponsored event. I'm a bit overwhelmed by the size of the tool and I wondered if someone could please point me in a good direction to get me started?

The event is an annual sponsored cycle ride. Each participant signs up with a range of options:

* Distance (100km or 30km)
* Transport to the event (chargeable) (Yes or No)

They have their own fundraising page with a link that they can promote by email or on Social Media and friends click on a "Give Now" button to sponsor them. The fundraising pages are customisable with a photo of the participant and the ability to write a few lines explaining why they are taking part. It would be good to be able to pre-populate the page with some default text.

Some participants take part over several years and it would be good to be able to track their previous participation and fund-raising over the years.

It would be good for each sponsor to be able to view all their donations. Some people sponsor several participants.

# Answer
> 1 votes
PCP (or Personal Campaign Pages) is the tool you are looking for. You can investigate this a bit more by going to a demo site eg and looking at one of the Contribution Pages eg https://dmaster.demo.civicrm.org/civicrm/admin/contribute/pcp?reset=1&action=update&id=1 which is the tab where you set up the PCPs and then at

https://dmaster.demo.civicrm.org/civicrm/contribute/campaign?action=add&reset=1&pageId=1&component=contribute where you can create your PCP eg https://dmaster.demo.civicrm.org/civicrm/pcp/info?reset=1&id=2&ap=0 (which will disappear within 24 hours when the site gets reset)

it currently shows the widget for my $500 goal.

Donating for multiple folk in one go can't be done via this approach. Only way I could think would be using PriceSets on Events but that has no way of letting each fundraiser see how they are going.

HTH

---
Tags: wordpress
---


# Question
Title: "SyntaxError: Unexpected token" error on l10n-js files
I have a Wordpress site (v4.2) and Civi 4.6.4 (although about to update). Every page on the public facing site generates a JS error (SyntaxError: Unexpected token '\<') referring to wp-login.php redirecting to the l10n-js file. I'm getting nowhere trying to understand a) why a public facing page is referencing wp-login.php in any event, let alone why a JS error is then getting generated.

On contribution pages where the name and address profile uses the AJAX lookup for state/province, this is failing, leading to users not being able to successfully make a transaction. Not sure if the above JS error is the root cause of this, but two additional JS errors are appearing on these pages when trying to complete the profile:

CRM.url called before initialization - referring to Common.js (line 1371) and then TypeError: undefined is not an object (evaluating 'tplURL\[mode\]') - referring to crm.ajax.js line 26

Any insights most welcome.

# Answer
> 6 votes
Finally located the source of the problem. Every page on the site included a widget in the footer using an HTML snippet for a CiviCRM sign-up form. The HTML snippet, despite being the one generated by the profile, was incorrect, and included a reference to an admin URL for a script, which wouldn't be accessible to non-logged in site visitors. Removing it resolved the issue.

# Answer
> 2 votes
Generically: You have a Javascript error, so I would definitely consult the Troubleshoot Javascript errors post which describes additional steps to try.

That said - I know what your problem is, and would like to give a step-by-step of how I worked it out.

In your Javascript console (press F12 in your browser, then "Console" tab) you'll see a bunch of errors - but the first starts with "SyntaxError". A syntax error in JS will generally disable all the following JS on the page, which will lead to other JS not loading. So ignore everything after the SyntaxError, that will get fixed when you find the syntax error.

Assuming your error is:

```
SyntaxError: expected expression, got '<'[Learn More] en_US:1
...(more errors below)

```

I can see the problem is on line 1 of the `en_US` file.

So I open my browser's developer tools (F12). Then I go to the "Network" tab, filter by JS, and reload the page. I look for the en\_US file. I right-click and select "Open in New Tab" (see screenshot below).

What you SHOULD see is a JavaScript file that tells CiviCRM how to load the correct translations for certain fields. What YOU will see is a first line with `<[Learn More]` on it.

The reason that's happening is you have some CMS plugin/module that's injecting data on to every page. You'll need to identify the plugin and change its settings.

---
Tags: wordpress, ajax
---


# Question
Title: Backend Registrations face group-based pricing (extension) selections
https://github.com/zengenuity/civicrm\_groupprice/issues/7

Does anyone have a creative work-around or fix for this? Basically, when we make a back-end registration, we want to see all price set fields/options, regardless of the group-based pricing. The staff member doing the registrations, as it currently stands, only sees price sets based on the groups they may or may not be a part of.

CiviCRM 4.7.x (sigh:I know)

It should be working, but isn't. The user has 'Administer CiviCRM' permission assigned to their role.

```
 // If the user is an admin, just put a message next to the "hidden" options.
  // Otherwise, really hide them.
  if ($hide) {
    if ($isAdmin) {
      $amount[$amount_id]['options'][$priceOption['id']]['label'] .= '<em class="civicrm-groupprice-admin-message"> (visible by admin access)</em>';
    }
    else {
      $removed = $amount[$amount_id]['options'][$priceOption['id']];
      unset($amount[$amount_id]['options'][$priceOption['id']]);
      if ($removed['is_default'] && !empty($amount[$amount_id]['options'])) {
        $amount[$amount_id]['options'][reset(array_keys($amount[$amount_id]['options']))]['is_default'] = 1;
      }
    }
  }

```

# Answer
Solved: they have to be in the CiviCRM group 'Administrators' to see the price fields restricted by group.

This wasn't documented as far as I noticed...but obvious in the code. Thanks extension creator! /civicrm/group/search?reset=1&force=1&context=smog&gid=1
> 2 votes

---
Tags: extension, groups, price-sets
---


# Question
Title: status page not loading nor new mailing page
so I get this error in console

```
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542
SyntaxError: expected expression, got '<'[Learn More] en_US:1
Error: CRM.url called before initialization Common.js:1605:16
Error: tplURL is undefined
CRM.url@https://domain.tld/sites/all/modules/civicrm/js/crm.ajax.js?r=rtOiJ:26:9
CRM.api3@https://domain.tld/sites/all/modules/civicrm/js/crm.ajax.js?r=rtOiJ:68:12
crmApi@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:4866:13
next@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:5040:9
enqueue@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:5057:11
save@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:2474:16
selectedMail@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:615:20
invoke@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:42:6
m/<@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:5334:32
q@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:8:57
m@https://domain.tld/civicrm/asset/builder?an=angular-modules.js&ap=TU%2B7CsMwDPyXzKZLt25pSrcuCfkANRaOQJGDLYXS0n%2Bv7anLPeAO7j7dFr0x5u7SgQRjSHdinHeO4N2Stn7fG6nCsm4o2pxpzHBg1cNLKt3OFR9ATBL%2BZH%2BtZsQcLS2tMEZTvJJ4TNXO1FCJnSfgGCZMB5WohJYsPIGQ0htdVlDLOwR0Rqcck8KTm7bSz86krvLDWq6US98f&ad=cee702615cc276585c8e78ed78bbaa0d:5333:479
e/<@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:132:434
$eval@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:147:65
$digest@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:144:123
$apply@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:147:361
c/<@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:21:115
invoke@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:42:6
c@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:21:36
Gc@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:21:332
se@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:20:1
@https://domain.tld/sites/all/modules/civicrm/bower_components/angular/angular.min.js?r=rtOiJ:323:54
i@https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js?r=rtOiJ:2:27444
fireWith@https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js?r=rtOiJ:2:28213
ready@https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js?r=rtOiJ:2:30004
K@https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js?r=rtOiJ:2:30366
angular.js:14199:17
f/<
angular.js:14199:17
vf/this.$get</<
angular.js:10707:6
e/<
angular.js:16704:8
$eval
angular.js:17994:15
$digest
angular.js:17808:14
$apply
angular.js:18102:12
c/<
angular.js:1812:8
invoke
angular.js:4771:15
c
angular.js:1810:4
Gc
angular.js:1830:11
se
angular.js:1715:4
<anonymous>
angular.js:32616:4
i
https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js:2:27444
fireWith
https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js:2:28213
ready
https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js:2:30004
K
https://domain.tld/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js:2:30366

```

checked permissions, double checked resource url's, disabled asset caching, removed all browser cache, checked different browsers.... And not sure where to go next...

Update: it was not a duplicate. the javascript did not load because of database error

# Answer
the problem was inconsistency in the civicrm\_uf\_group\_en\_US view I recreated the view based on another installation including the missing field 'frontend\_title'.
> 1 votes

# Answer
Generically: You have a Javascript error, so I would definitely consult the Troubleshoot Javascript errors post which describes additional steps to try.

That said - I know what your problem is, and would like to give a step-by-step of how I worked it out.

I see in your second line that you have a syntax error of some sort. A syntax error in JS will generally disable all the following JS on the page, which will lead to this issue. So ignore everything after line 2, that will get fixed when you find the syntax error.

From the SyntaxError, I can see the problem is on line 1 of the `en_US` file.

So I open my browser's developer tools (F12). Then I go to the "Network" tab, filter by JS, and reload the page. I look for the en\_US file. I right-click and select "Open in New Tab" (see screenshot below).

What you SHOULD see is a JavaScript file that tells CiviCRM how to load the correct translations for certain fields. What YOU will see is a first line with `<[Learn More]` on it.

The reason that's happening is you have some CMS plugin/module that's injecting data on to every page.
> 2 votes

---
Tags: javascript
---


title: Errors only randomly on admin pages

text:
# Question
Title: Errors only randomly on admin pages
I'm getting randomly the errors below when I go to an admin page. They don't always happen. Any idea what this is?

Warning: Invalid argument supplied for foreach() in /home/sporti62/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/SchemaHandler.php on line 750

Warning: Invalid argument supplied for foreach() in /home/sporti62/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/SchemaHandler.php on line 750

Usually get a bunch of these...

PHP version 5.6.32 CiviCRM 4.7.28 Wordpress 4.9.1

# Answer
> 0 votes
This is fixed in later versions.

# Answer
> 1 votes
This is most likely happen on the page load after you press the "Fix Missing Indices" button on the Administration Status page. A more permanent automated fix is being worked on, but is fairly difficult. You can see the answer here for how to fix this manually if you're SQL-savvy.

---
Tags: error, admin
---


# Question
Title: civicrm/upgrade?reset=1 to 5.3.1 from 4.7.30
Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. Your database is marked with an unexpected version number: 5.2.2. The automated upgrade to version 4.7.30 can not be run - and the 4.7.30 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using prior to beginning this upgrade until you resolve this problem.

# Answer
> 1 votes
Problem solved by putting back the right version and doing reset. The doing the upgrade to 5.3.1.

---
Tags: upgrade
---


# Question
Title: How to make webform forget a selected event?
I'm using Views to display some events, the user clicks on one and that fires up a webform where they can sign up for the chosen event (so passing the event id in the url). All working well but...if the user then selects a different event in the webform (not unreasonable) then that event becomes the default event - and won't go away. Even when the user later selects a different event in Views, when they come to the webform the previously chosen event will be selected - not the one they selected and was passed in the url. This feels like a bug, and should be easy to reproduce, but maybe there's an explanation or way of stopping this? (Upgraded to latest 5.3.1 still same problem). First screenshot is Views & you can see the url correctly generated for event id 19. Second screen shows event on Aug 4 incorrectly selected which is event id 18 (I selected this at a previous time)

# Answer
> 1 votes
Be very careful when sending people to a webform that has multiple events on them. If they return to that webform (or another webform that pulls in the same Events) at a later time and select another event -\> what they are technically doing is canceling their participant registration for the event they un-select and registering themselves for the newly select event.

The setting to not unregister participants from Events will just affect the processing of the form; On load of the webform it does makes sense to me that it shows the Event one is current registered for.

---
Tags: webform-civicrm, drupal-views
---


# Question
Title: How can I generate a search results page from a list of contact IDs, programatically?
I have an extension that lets people filter contacts in various ways. I'd like them to be able to click to show these contacts in a standard Civi results page - with the action box at the top etc. So that they can manipulate them in the normal ways, by adding to groups and such.

Is there a recommended way to do this, programatically?

# Answer
We have done work that is hopefully heading to Civi core which makes the following possible:

Below is the table of field name vs params that can be used in the URL to force the search results.

**Contribution Tokens**

Field Name \> \> Param in URL

contribution\_page\_id \> \> pid

financial\_type\_id \> \> fid

contribution\_status\_id \> \> status

is\_pay\_later \> \> pay\_later

receive\_date\_from \> \> (receive\_date) start

receive\_date\_to \> \> (receive\_date) end

Eg of complete search URL -

"civicrm/contribute/search?reset=1&force=1&status=1&fid=2&pay\_later=1&start=20181206&end=20181210"

**Membership Tokens**

Field Name \> \> Param in URL

membership\_type\_id \> \> type

membership\_status\_id \> \> status

start\_date \> \> start & start\_high

end\_date \> \> end & end\_high

Eg of complete search URL -

"civicrm/member/search?reset=1&force=1&type=1&status=1&start=20181002&start\_high=20181004&end=20181103&end\_high=20181109"

**Participant Tokens**

Field Name \> \> Param in URL

event\_id \> \> event

status\_id \> \> status

role\_id \> \> role

is\_pay\_later \> \> pay\_later

register\_date\_from \> \> register\_start

register\_date\_to \> \> register\_end

Eg of complete search URL -

"civicrm/event/search?reset=1&force=1&event=1&status=2&role=3&pay\_later=1&register\_start=20181210&register\_end=20181214"

**Activity Tokens**

Field Name Param in URL

activity-type id \> \> type

activity\_status \> \> status

has a follow-up activity \> \> hasFollowUp

is a follow-up acivity \> \> isFollowUp

start date \> \> dateLow

end date \> \> dateHigh

Eg of complete search URL -

civicrm/activity/search?reset=1&force=1&status=1&hasFollowUp=1&isFollowUp=1&dateLow=20181210&dateHigh=20181212&type=3

Here is the link to the gitlab ticket https://lab.civicrm.org/dev/core/issues/252
> 2 votes

# Answer
If you rejig your extension so that your filtering is done via "custom search" then you automatically get that. See https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-search
> 1 votes

# Answer
Another way would be to use the api in your extension to create a group out of the results, then redirect to the group's group page, which has the same actions dropdown that search results does.

You might end up with a lot of stale groups lying around, but you could have a cron script delete the groups daily or something like that.
> 1 votes

---
Tags: search
---


# Question
Title: Should I use CiviCRM 4.x or 5.x is this like D7 and D8?
I want to use the most stable version with the most extensions as possible, with Drupal, 7 is still better than 8 for most projects.

Is it the same with civi?

I already installed and configured 5.x can I downgrade to 4.x ?

# Answer
> 1 votes
Many extensions will work with both 4.6.x and 5.x while some only work with one. Some extension authors are dropping support for 4.6. For example, in the recent security release announcement, the extended reports extension was available for 4.6 but is now only supported on current 5.x

The proponents of 4.6 and LTS emphasise stability.

If you want features and extensions then 5.x is the better choice.

You can upgrade from 4.6 to 5 but there is no supported downgrade process.

FYI (you didn't quite ask this!) - CiviCRM on Drupal 8 is moving rapidly but D7 is much better supported at this point.

# Answer
> 2 votes
Support for CiviCRM 4.6 is nearly at an end. It is slated to end at the end of this year.

5.x is the supported stable release. 4.6 is pretty much a security only branch now.

---
Tags: civimember
---


# Question
Title: How can I change the label name of a field and it's data also?
I'm attaching the file as it's easier to explain. I want to change the label of a field, and also the resulting data. Kind of like changing both the fields and it's display in Drupal.

Can I do this with a find and replace in PhpMy admin?

# Answer
> 2 votes
You can use Word Replacement to change eg Household Name via /civicrm/admin/options/wordreplacements?reset=1 but what you are needing to do may be better accomplished via another mechanism (see comment above)

---
Tags: templates
---


# Question
Title: Activity 'Result' field missing from API
The default field on the Activity API doesn't return 'result' field by default, or even when specified as a return value. I've never added one of these before, if someone could let me know how it's done I'll sort a PR out. Thanks!

If anyone's interested - the use case is deleting Twilio's copy of messages after a period on a scheduled job. The return value is Twilio's SMS Unique ID.

# Answer
Api result doesn't return if the fields value is NULL. In your case result field must be **NULL** for the activity you trying to get. Try using to check if the result key is present in api result and use accordingly.

$result = CRM\_Utils\_Array::value('result', $activityResults); or !empty($activityResults\['result'\])

HTH

Pradeep
> 2 votes

---
Tags: api
---


# Question
Title: How to apply different Sales Tax rates to the same Membership Type - Back Office
In Canada we need to charge Sales Tax depending on what Province the Member resides in. How can we do this in the Back Office. In other words: an administrator signing up a Member in CiviCRM.

# Answer
You can do this with Price Sets. I'll document the entire set up:

1. Go to Administer -\> CiviContribute -\> CiviContribute Component Settings and check the box Enable Tax & Invoicing (Tax = Sales Tax; Invoicing you get as a bonus)
2. Go to Administer -\> CiviContribute -\> Financial Accounts and create one Financial Account for each Sales Tax Rate

Ignore Tax-Deductible - it is not related to Sales Tax; it potentially could be used to track whether monies are deductible for Income Tax purposes but I don't recommend it \[there are other ways to track that; will document that at some point\]. Click Is Tax -\> (Tax = Sales Tax) and enter the Tax Rate right below it.

Repeat until you have the 3 Financial Accounts needed (3 different Sales Tax rates):

3. Set up Financial Types -\> And associate each one with a one of the Financial Accounts we just created. Note we can add a 4th one \[for out of Country residents\] - i.e. with no Sales Tax.

4. Next are Price Sets - create a Price Set - for each Membership Type/Sales Tax Option - Yes that's a lot of Price Sets. Let's look at one: in the Maritime Provinces the Sales Tax is 15% -\> so we need to create a Priceset that has a Line Item that hooks up to the Financial Type that has the 15% Tax Rate associated with it:

Looking at the Individual Price Fields:

5. Putting it all together - in Back Office -\> from a Contact Summary record -\> Membership tab -\> Add Membership or Create Credit Card Membership

And selecting that Priceset results in the correct Amounts
> 6 votes

---
Tags: price-sets, taxes
---


# Question
Title: Volunteer Signup - Display quantity/quantity_needed
I've been modifying the sign up page to better suit our needs. I've figured out how to add Quantity but how would I go about counting the remaining need?

In other words, I'd like to show the total needed and the remaining needed after someone signs up.

# Answer
> 1 votes
quantity\_assigned is the variable.

---
Tags: civivolunteer
---


title: System Status Page Blank after Upgrade

text:
# Question
Title: System Status Page Blank after Upgrade
After upgrading from 4.7.31 to 5.2.0 the system status page is blank. I made sure the Directory and Resource url settings match; I cleaned up caches and reset paths; I disabled the Asset Cache; no luck. Anything I'm missing?

EDITED TO ADD:

I have since upgraded, and when I go to the status page I get an error that CiviCRM is unable to retrieve an extension. After I update paths, then it just goes to a blank page. The console says: Error: Syntax error, unrecognized expression: #/status

# Answer
> 3 votes
Here's one answer that fixed my problem (see my comment above). The cause was that when I created the Drupal system I just used the domain name without the www. But Civi was loaded with www. This is an old problem and I'm a bit ashamed to admit I made this mistake again! But if your system has this mismatch then system status won't work. Fix was to change the base url in Drupal.

# Answer
> 1 votes
In addition to cleaning up caches via **Administer menu » System Settings » Cleanup Caches and Update Paths**, it also pays to delete the templates\_c directory.

# Answer
> 1 votes
Reinstalling Sparkpost extension did the trick.

---
Tags: wordpress, upgrade, angular, status
---


# Question
Title: What is the best approach for displaying / modifying behavior of Activity Subject & Custom Field?
I have several custom fields in for a CiviCRM Activity ("Client Need"). Which of the following scenarios would be the best approach for me to sort and view Activity Summaries? And how would I go about doing that?

1. When data is collected into the "Client Need" custom field, dump that data into the CiviCRM "subject" field as well. In other words, these two fields essentially would need to mirror each other at all times.
2. Edit the default "Activity Subject" field so that it is a drop-down with a list of options when someone is entering a new Activity into the database. If that's possible, then I can just completely remove the secondary "Client Need" field.
3. Collect the data in the Client Need field, don't collect data in the Activity Subject field, and modify CiviCRM's default behavior for displaying the Activities, so that it displays the custom field instead of the activity subject field (so in the below screenshot, display Client Need field, and don't display Subject field):

# Answer
If you need to adjust Subject to be a select field for use directly in Civicrm then would need to change the field type in the db and customise so it uses a set of Option Values

If the data is mostly being added via a Webform then you can adjust the widget on the Component and set it up as a Select field without needing to mess with the machinery
> 1 votes

---
Tags: activity
---


# Question
Title: Drupal Webform for Activities - CiviCRM Permissions
I have created a Webform that will be used to create CiviCRM activities for a particular (existing) client. The form is structured in such a way that the client must exist in CiviCRM first, and the person creating the Activity must select the existing client:

When I'm logged in as an administrator, and submit the form, the data correctly populates the CiviCRM database. However, when I'm logged in as a different role ("Volunteer") with much more limited permissions, the data does not get entered into the database (the webform gets submitted, and I can see the webform results when logged in as an administrator, but the data doesn't get entered into the related CiviCRM fields).

Ideally, the Volunteer role should not be able to create new clients, and should not be able to edit any client data. The Volunteer should ONLY be able to create new activities (Client Needs).

So in the Drupal permissions, I have things like the following turned OFF for the "Volunteer" role:

* CiviCRM: add contacts
* CiviCRM: edit all contacts
* CiviCRM: delete contacts
* CiviCRM: Delete activities
* CiviCRM: access CiviCRM backend and API

... and I have things like the following permissions turned ON for the Volunteer Role:

* CiviCRM: view all contacts
* CiviCRM: view all activities
* CiviCRM: access Contact Dashboard
* CiviCRM: add contact notes
* CiviCRM: access AJAX API

Clearly, I'm missing some sort of permission that the volunteer needs in order to create a new activity for a client. Can anyone point me in the right direction?

# Answer
> 1 votes
I think the issue in your case was that Contact 1 was not set on the form

---
Tags: webform-civicrm, permissions
---


# Question
Title: access denied on member signup with civicrm for anonymous
My question has to do with Civicrm member signup page. I am getting an error for anonymous users that they are not allowed access to the page. I am using Drupal 7 and CiviCRM 5.3. I am relatively new to Drupal. The site is located on a domain that is being used simply for testing purposes. I have researched this already and have not received much in the way of finding anyone with a similar issue. Other then seeing posts about user 0. I checked and user 0 is there and seems fine. As part of trying to resolve the issue I also setup a mock event. Same thing happens on that also. An anonymous user can see the event but as soon as the registration page is clicked it gives the access denied message. I have also checked the permissions and roles and anonymous is allowed to access the pages. In other words sign up for events and make contributions is checked. Here is the page for the membersignup. https://hebrewburialofnewhaven.org/civicrm/contribute/transact?reset=1&id=1 Event info page https://hebrewburialofnewhaven.org/civicrm/event/info?reset=1&id=1 Event registration page https://hebrewburialofnewhaven.org/civicrm/participant/add?reset=1&action=add&context=standalone&eid=1 This is the actual site https://hebrewburialofnewhaven.org/# Please keep in mind this is only a development site and not a production site. We are testing using Drupal with Civi. Because wordpress has really become very resource intensive and seems to have a lot of issues running civi cleanly.

I thank everyone for any help or guidance on this. It is probably something stupid I am missing or didn’t configure.

# Answer
> 1 votes
The "event registration" link you give isn't the public-facing event registration page, which is why you're getting "Access Denied". The page you're linking to is intended for staff to add event registrations on the back end. The public-facing page will be: https://hebrewburialofnewhaven.org/civicrm/event/info?reset=1&id=1. When I go, it says that online registration hasn't been enabled for this event. You'll need to go to **CiviCRM Events menu » Manage Events**, then click **Configure » Online Registration** next to the test event. Check the **Allow Online Registration** checkbox and save the event.

The error on the contribution page isn't as obvious to me - but if you didn't change the default permissions for CiviCRM, then it's a configuration issue on the contribution page itself.

If you still need help, questions like this are well-suited to chat: https://chat.civicrm.org, in either ~town-square or ~user-support channels.

---
Tags: civievent, drupal, civicontribute, civimember, permissions
---


# Question
Title: Why have menu links to extensions eg DataViz, CiviDiscount, LogViewer now give the civi home page
After upgrading to 5.3.1 and clearing out templates\_c and doing two drush cc all we are still finding sites where then menu link to eg CiviDiscount or LogViewer just show the civi home page

What is the long term fix for this?

# Answer
> 1 votes
We know one quick fix is to resave the Directory page civicrm/admin/setting/path?reset=1

(Note: we tested with making a minor change then saving but it may work with just using Save)

Looking for other broken sites so I can next test civicrm/admin/setting/updateConfigBackend?reset=1

---
Tags: extension, cache
---


title: CiviMail DKIM signature failure

text:
# Question
Title: CiviMail DKIM signature failure
We have DKIM configured with the MTA we are using with CiviCRM, and it appears to be working. However, the DKIM signature fails consistently; using a checker it appears the mail has been altered after being signed. Has anyone else experience of this?

I've done some more investigation. I have an IIS based development system. Configuring SMTP leads to the test email failing DKIM. Sending a CiviMail test environment passes DKIM. Sending a CiviMail test from Linux Apache based test environment leads to a DKIM failure. Webmail and Thunderbird SMTP both lead to DKIM passes. Any suggestions?

# Answer
> 3 votes
We did experience that for specific mail providers. Local delivery and most mail providers were fine or not having any non 7bit encoded characters.

We ended up forcing a downconversion to 7bit encoding on our MTA prior to signing with DKIM as described here for postfix: http://postfix.1071664.n5.nabble.com/On-DKIM-and-Content-Transfer-Encoding-tp68767p68769.html

---
Tags: email, mailing, mailserver
---


# Question
Title: Running cron job CiviCRM on Drupal in the CPanel
I am trying to configure the CiviCRM file "sites/all/modules/civicrm/bin/cron.php" to be run as a cron job. If I paste the url:

https:// domain.com/sites/all/modules/civicrm/bin/cron.php?name=**username**&pass=**password**&key=**key**

in to the web browser, with the username, password and key specified then the cron.php is triggered.

But if I create a cron entry via the CPanel and define the command as:

**/usr/local/bin/php** /home/username/domain/sites/all/modules/civicrm/bin/cron.php?name=**username**&pass=**password**&key=**key**

then the cron job is not triggered.

If i try:

**/usr/bin/wget** https://domain/sites/all/modules/civicrm/bin/cron.php?name=**username**&pass=**password**&key=**key**

then the cron job is equally not triggered.

Any ideas what the issue might be? Or what else i could try to get it to run?

At the moment I do not have access to server logs so can't see what is causing the issue.

# Answer
> 1 votes
I appear to have resolved the issue with the help of the thread at Cron job with shared hosting CPanel

The issue was related to missing backslashes after the username and the password.

/usr/bin/wget https://domain/sites/all/modules/civicrm/bin/cron.php?name=username\\&pass=password\\&key=key

---
Tags: cron-job
---


# Question
Title: Repeatable Custom groups w/ required field
I am unable to save a contact with a that has 2 or more repeatable custom groups with a required custom field. The validation fails.

I am using CiviCrm 4.7.9. Has anyone else experienced this?

# Answer
I've just tried this out on the demo sites (WordPress and Drupal) CiviCRM 5.5.alpha1 and its still not working. I'll look into reporting it as a bug, but I have found a partial work round (though this isn't what I want).

The problem only occurs with the custom field set using the inline option, so you could use tab or tab with table.
> 1 votes

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


# Question
Title: CiviCRM upgrade from 4.6 to 5.3 > [warning] Both parameters should have an equal number of elements Relationship.php:2222
Subject says it all. Just wondering if anyone has seen something like this before?

# Answer
> 1 votes
This error is displayed when some Names for a relationship type do not match the Labels.

For example in civicrm\_relationship\_type table you may have something like

name\_a\_b = Mayor name\_b\_a = Mayor label\_a\_b = Mayor of label\_b\_a = Mayor is

You can correct these either in SQL or via the UI

---

UPDATE

To identify the rows causing the issue

```
select name_a_b, label_a_b, name_b_a, label_b_a from civicrm_relationship_type where name_a_b <> label_a_b;
select name_b_a, label_b_a from civicrm_relationship_type where name_b_a <> label_b_a;

```

**To fix we want to set the name = to the label**

Make a temporary backup - this will be dropped when you log out of mysql.

```
create temporary table temp_civicrm_relationship_type as select * from civicrm_relationship_type;
update civicrm_relationship_type set name_b_a = label_b_a where name_b_a <> label_b_a;
update civicrm_relationship_type set name_a_b = label_a_b where name_a_b <> label_a_b;

```

Confirm that the number of rows updated matches result of the query.

(nb I just grabbed this from a ticket in our own system but hope it is helpful in your case)

---
Tags: upgrade
---


# Question
Title: Keeping historical demographic information, while updating donor information
So we have a unique use case. The organization collects donations from employees of various departments with various roles at the organization. Collecting employee information like title, department, etc seems pretty straight forward using custom fields and profiles. However, lets say, 3 years down the road, a donor changes their department, the field would be updated when they renew their donation and would be accurately reflected in the system, but it would now impact historical information. Their donation records would stay the same, but their donations would be affiliated with the new department.

Am I making sense? Is custom fields the right approach? Alternatively, we may just download historical data and use that for reports comparing campaign years.

# Answer
There are several approaches to handling this. Custom fields are one approach. Another is to use Detailed Logging, which will keep historical records, although they may not necessarily be in the format you most desire. They also take up a lot of disk space, since you're keeping the history of every change in CiviCRM!

If you try the detailed logging approach, also considering installing the Extended Reports extension, which has reports that pull data from the log tables.
> 1 votes

# Answer
Jon mentions 'Custom Fields' - to expand on that - if you put the Custom Fields on the Contribution record then when someone changes it will not change the values in previous Contributions.

You may be able to do this via an Extension or some js to copy the current value from the Contact record in to the custom field on the Contribution at the time of the Contribution record being created.

May be more effort than you are wanting but does deliver the outcome.
> 1 votes

---
Tags: custom-fields, reports
---


# Question
Title: Personal Campaign Pages don't have a donate button
We are using version 4.6.3 on Drupal. Our Personal Campaign pages aren't displaying a donate button on them: it just has a link to have people make their own PCPs, and the honor roll and thermometer.

Does anyone know why this might be the case?

Thanks!

# Answer
Looking at the code, I can see that the donation button only appears if `$validDate` is TRUE and `$contributeURL` is TRUE.

Enable debugging (**Administer menu \> System Settings \> Debugging and Error Handling**, select "Yes" to "Enable Debugging"), then reload your PCP page, adding this to the end of the URL: `&smartyDebug=1`. You'll get a pop-up showing all your Smarty variables. Make sure that there's a value for both `$validDate` and `$contributeURL`.

My guess is either:

* You're before the PCP begin date;
* You're after the PCP end date;
* Your server has the wrong time set.

PS - also make sure there's a value set for `$contributionText`. You can set this by editing the PCP and filling in the value for "Donation Button".
> 2 votes

# Answer
Based on the information in your last comment, I think the lack of donate button is indicative of a larger issue - this PCP isn't linked to a contribution page. I don't know if this is a data issue or a bug; I don't have any PCP-using sites running 4.6 yet.

If you know how to use SQL, try running this statement on your Civi database:

```
SELECT id, page_id, page_type FROM civicrm_pcp;

```

The first `id` corresponds to the PCP id you see in the URL for that page. `page_id` should be the contribution page it's linked to, and `page_type` should be "contribute". If they're not, you could fix the SQL directly, or figure out what caused the PCP to not be linked to the contribution page. If this doesn't answer your question, you may want to post the results of that SQL as an edit to your question.
> 1 votes

# Answer
We just had to resolve this for a site - in our case the client had fired up the PCPs using a Contribution Page which had an End Date set that was in the past - which is close to what Jon said above but for our case the solution is with the Contribion Page settings not the PCP settings
> 0 votes

---
Tags: civicontribute, personal-campaign-pages, pcp
---


# Question
Title: Bug with Check for Matching Contact(s) button
Following the upgrade to 5.3.0, we are finding that the 'Check for Matching Contacts' button, which is in the edit contact screen, is not working. The screen refreshes and reloads the same contact, with no error message.

If you run the default supervised rule from the 'Find and Merge Duplicate Contacts' screen, it picks the duplicate up. But the Check for Matching Contacts function has stopped working. Is this a bug anyone else is seeing?

Thank you!

Robin

Drupal 7

# Answer
Coleman recently pushed a fix for this on git. Can you please apply the patch and QA if it fixes your problem(if so please comment on PR about your QA result)

HTH

Pradeep
> 3 votes

# Answer
the hook per comments looks like hook looks like

```
/**
 * Add dedupe searches to actions available.
 *
 * @param array $actions
 * @param int $contactID
 */
function dedupetools_civicrm_summaryActions(&$actions, $contactID) {
  try {
    $ruleGroups = civicrm_api3('RuleGroup', 'get', array(
      'contact_type' => civicrm_api3('Contact', 'getvalue' , array('id' => $contactID, 'return' => 'contact_type')),
    ));
    $weight = 500;

    $contactIDS = array($contactID);
    foreach ($ruleGroups['values'] as $ruleGroup) {
      $actions['otherActions']['dupe' . $ruleGroup['id']] = array(
        'title' => ts('Find matches using Rule : %1', array(1 => $ruleGroup['title'])),
        'name' => ts('Find matches using Rule : %1', array(1 => $ruleGroup['title'])),
        'weight' => $weight,
        'ref' => 'dupe-rule crm-contact_activities-list',
        'key' => 'dupe' . $ruleGroup['id'],
        'href' => CRM_Utils_System::url('civicrm/contact/dedupefind', array(
          'reset' => 1,
          'action' => 'update',
          'rgid' => $ruleGroup['id'],
          'criteria' => json_encode(array('contact' => array('id' => array('IN' => $contactIDS)))),
          'limit' => count($contactIDS),
        )),
      );
      $weight++;
    }
  }
  catch (CiviCRM_API3_Exception $e) {
    // This would most likely happen if viewing a deleted contact since we are not forcing
    // them to be returned. Keep calm & carry on.
  }
}

```

> 1 votes

---
Tags: contacts, duplicate-contacts
---


# Question
Title: All seems fine but I still get this: You are not currently subscribed to any Groups
Can't get customers to show up on "My contacts Dashboard" URL.

Using CIVE CRM 5.x and Drupal 7

I checked all settings, created a group,assigned customers to group, but still not showing up...on the My Contacts link :

http://localhost/crm/civicrm/user?reset=1

# Answer
The dashboard only shows public groups that a user is subscribed to. You will need to set group visibility to 'Public Pages'. So you might need to update the groups that you would prefer to show up on user dashboard.

Thanks

Pradeep
> 4 votes

---
Tags: contacts
---