# Question
Title: Membership report showing different status than membership dashboard
We customised the names of the membership status rules to better suit our needs. For example in the membership status rules screen, 'New' was changed to 'New Members' and 'Current' was changed to 'Paid Up.

On the membership dashboard, the revised names for membership status rules show up correctly. However, when I run membership reports, it's still showing the original names of 'New' and 'Current' in the Membership Status column. I've run Update Membership Statuses but no change in any of the membership reports. Am I missing something here?

Thanking you for your time.

# Answer
You've found a bug! I've confirmed it and reported it here: https://issues.civicrm.org/jira/browse/CRM-19855

Most folks don't change the names of the CiviCRM membership statuses, so this has slipped under the radar for a while. Internally, membership statuses have both a "Name" and a "Label". The vast majority of the time, they're the same. In your case, they're different.

The fix for NEW reports is easy - you literally need to change a single word in the report file. I'll put instructions below.

Since this was so quick, I had intended to write a patch pro-bono to submit to the CiviCRM core team so this could be fixed for everyone - but in testing I found that this change causes the "Membership Status" field to fall off of existing saved reports. Fixing this properly means writing an upgrade script, which I unfortunately don't have pro-bono time for.

You can fix this on your own copy of CiviCRM, but until this is fixed in the "upstream" software, you'll have to fix it every time you upgrade.

To fix this:

* Find CiviCRM on your web server.
* From your CiviCRM root, go to the `CRM/Report/Form/Member` folder.
* In that folder are the files that control the reports. Open the file that corresponds to the report you want to change with a text editor.
* in the `$fields` array, you'll find an entry for Membership Status. It will look something like this:

```
'civicrm_membership_status' => array(
  'dao' => 'CRM_Member_DAO_MembershipStatus',
  'alias' => 'mem_status',
  'fields' => array(
    'name' => array(
      'title' => ts('Status'),
      'default' => TRUE,
    ),
  ),
  'filters' => array(
    'sid' => array(
      'name' => 'id',
      'title' => ts('Status'),
      'type' => CRM_Utils_Type::T_INT,
      'operatorType' => CRM_Report_Form::OP_MULTISELECT,
      'options' => CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'),
    ),
  ),
  'grouping' => 'member-fields',
),

```

Take this line:

```
'name' => array(

```

Change "name" to read "label":

```
'label => array(

```

This will fix your reports! Don't forget to re-add the "Status" field to existing saved reports, and don't forget to make this fix on every upgrade until someone steps forward with time or money to fix this. UPDATE: For the Membership Contribution report, find this section:

```
  'civicrm_membership_status' => array(
    'dao' => 'CRM_Member_DAO_MembershipStatus',
    'alias' => 'mem_status',
    'fields' => array(
      'membership_status_name' => array(
        'name' => 'name',
        'title' => ts('Membership Status'),
        'default' => TRUE,
      ),
    ),

```

change:

```
'name' => 'name',

```

to

```
'name' => 'label',

```
> 2 votes

---
Tags: civimember, reports
---


title: Search by User that Created the Contact

text:
# Question
Title: Search by User that Created the Contact
I would like to create a group of contacts added by a particular admin. How can I search for contacts added by x contact?

Thanks!

# Answer
> 3 votes
In Advanced Search you can use the Change Log to enter the Admin's name in the 'added by' section and set it to 'Added'.

You have to put in the contact's "Sort Name" in the box for this to work (as of 5.7, at least) \[citing Alan Dixon's comment from below\].

Then you should be able to make a Smart Group from this.

---
Tags: search
---


title: Smarty and future proof code

text:
# Question
Title: Smarty and future proof code
I am trying to be a more conforming civicrm coder.

Smarty used by civicrm for pages (and forms?)

I have never used Smarty.. Is it going to be part of civicrm going forward? And are there any tips for writing good future proof smarty?

# Answer
Going forward, much of the Civi UI will be written in Angular. However at least 95% of the application uses Smarty and it's still a perfectly acceptable way to mark up a form or page.

Depending on your use case you may be able to create an Angular page for what you want.

If you are writing an extension, you can try both. Use `civix generate:page` or `civix generate:form` to create traditional smarty-based pages & forms. Or try the newer `civix generate:angular-*` commands for the alternatives.
> 3 votes

---
Tags: php, smarty, coding-standards
---


# Question
Title: Custom Case Fields do not work in Drupal Views
I have correctly setup views to work for civicrm fields and am also using the civicrm entity module for Drupal to expose fields. In my testing it seems like the custom fields work for certain types of civicrm components. For example, if i use a custom field for All Contact Types then it works correctly and even the dropdown shows CiviCRM:Custom - Field name. However, for a custom field for Cases it does not work and has the same issue i.e. refers to SQLSTATE\[42S22\]: Column not found: 1054 Unknown column 'civicrm\_case.custom\_3' in 'field list'. Has anyone had any success in using custom civicrm case fields in Drupal views?

# Answer
I spent some time on the setup of the Views and it does actually work. However, what is missing is the relationship in the View. It is subject to the type of view you try to create and the relationships. Also remember to choose the CiviCRM Custom: \[Field\_name\] instead of the one provided by CiviCRM Entities.
> 1 votes

---
Tags: civicase, drupal-views
---


# Question
Title: Can not add both Individual and Organisation to case
When a case is created one contact is added. But later, when I want to add another contact, sometimes that is not possible. I've figured out, I think, that if the first contact is of one type, Individual, say, and the other one is an Organization, that is not possible because the search dialouge limits to the previous type.

Furthermore, if I add one Individual and one Organization when I *create* the case, it seems to be no problem.

I wonder why? And I'm fairly sure that it has been possible since we have cases in our database that have this.

Or is there a way to do this anyway?

# Answer
> 3 votes
I too had this problem. What worked for me is modifying the Contact Type A and Contact Type B to All Contacts in the Relationship section (administer---customise data and screens---relationship types) Remember to do it for any Case Related Roles e.g. the Case Manager. I was then able to select the organisation type. I have set it up so a User can submit the case as the Original Submitter but the case is assigned to the Organisation so multiple users can submit cases but they get organised to the Same Organisation which makes it easy to keep track. Hope this helps.

---
Tags: civicase, relationships
---


title: Cron - Invalid key value sent

text:
# Question
Title: Cron - Invalid key value sent
Really getting frustrated trying to get cron to work.

WP 4.7 / CiviCRM 4.7.14

using via ssh:

/usr/bin/wget 'https://hbb.org.uk/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=JohnB&pass=123&key=456'

Generates the error.

my settings.php has:

if (!defined('CIVICRM\_SITE\_KEY')) { define( 'CIVICRM\_SITE\_KEY', '456'); }

Where the two keys are identical. There are no special characters, it's a 20 char string, I've re-entered a new string into both settings.php and the wget. Each time generates a new error log file with the msg.

When I enter the url into Chrome I get "Invalid key". Yet they're identical in the wget and settings.php.

Is there some super-sekret settings file somewhere?

# Answer
Site key should be defined in `civicrm.settings.php`, not `settings.php`, which isn't necessarily bootstrapped when cron is run.

If that was mis-stated in your question (likely, since you're using WordPress), you can try to troubleshoot this by debugging.

* Find your CiviCRM log and your CiviCRM root.
* In your CiviCRM root, find the file `CRM/Utils/System.php`.
* Find this section (around line 553):

```
if ($key !== $siteKey) {
  return self::authenticateAbort(
    "ERROR: Invalid key value sent. " . $docAdd . "\n",
    $abort
  );
}

```
* Add two debugging lines so that section now looks like:

```
if ($key !== $siteKey) {
  CRM_Core_Error::debug_var('key', $key);
  CRM_Core_Error::debug_var('siteKey', $siteKey);
  return self::authenticateAbort(
    "ERROR: Invalid key value sent. " . $docAdd . "\n",
    $abort
  );
}

```
* Run your cron job again, get the same error.
* Check the CiviCRM log. At or very near the bottom of the log file, you should see lines that look like:

```
$key = 456;
$siteKey = 456;

```

...except I'm guessing that one of them looks slightly wrong! Use that information to either fix this problem and/or update this question with more info.
> 0 votes

---
Tags: wordpress, cron
---


# Question
Title: Send alert if smart group contains any contacts
**The problem:**

I'm trying to monitor daily for contacts meeting certain criteria, and would thus like to have a way to receive a scheduled email if a smart group contains contacts.

**Possible solution: Using CiviReport?**

CiviReport supports scheduled delivery of reports, configurable under a report's "Email Delivery" tab.

Is there a way to avoid sending the report if it contains no rows?

Alternately, I could do something in cron with `drush sql-query` or some such, but ideally I'd like to do this within CiviCRM.

**Other options:**

Are there other to achieve this goal within CiviCRM that would not require custom code?

# Answer
We've done just this using CiviRules and CiviReport, though the solution does still send emails if the smart group is empty.

I've outlined the steps here: https://civicrm.stackexchange.com/a/4873/105
> 1 votes

# Answer
Have you tried using CiviCRM Rules integration? Not sure if it would work in the context of a scheduled job, but it can send emails.
> 0 votes

---
Tags: civireport, scheduled-job
---


# Question
Title: Changed Resource URL setting, now can't access Civi on Wordpress
I've been getting 404s on public pages due to my directory setup, so I changed the default Resource URL in **Administer \>\> System Settings \>\> Resource URLs** from the default (\[civicrm.files\]?) to the URL for my civi directory.

I now can't get back to reset it to the default.

I've tried overriding the Resource URL in settings.php to:

```
http://mysite.org/mysite/wp-content/plugins/civicrm/civicrm/

```

but that doesnt work.

Any advice appreciated.

# Answer
> 2 votes
If I understand your question correctly, you are asking how to return the settings back to default.

I believe that the default settings for WordPress (in Administer \>\> System Settings \>\> Resource URLs) are as follows:

* CiviCRM Resource URL: \[civicrm.root\]/
* Image Upload URL: \[civicrm.files\]/persist/contribute/
* Custom CSS URL: (blank)
* Extension Resource URL: \[civicrm.files\]/ext/

You would typically only need to override the Resource URL in civicrm.settings.php if you have moved your site. I suggest that you set this back to how it was previously.

You may want to post a separate question about the problems you are having with 404s if this is still an issue.

---
Tags: wordpress, civicrm.settings.php, resource-urls
---


# Question
Title: How can I resolve Civi Dashboard Javascript error: widget.name is null?
I've just upgraded a Civi 4.6.18 install to 4.7.15. All has gone fairly smoothly, apart from the fact that the CiviCRM front page/dashboard is broken.

My Firebug console reports: "TypeError: widget.name is null" and refers to http://siteroot.com/sites/all/modules/civicrm/js/jquery/jquery.dashboard.js line 467 col 13

I know that some of the dashlets that display in my dashboard have been created by setting up some reports to suit, and simply making those available as dashlets.

Looking in the database, I checked the civicrm\_dashboard table, and noticed that three of these 'custom' dashlets had NULL in the name column. Interestingly, other similarly created dashlets had an entry in the name column of the form 'report/xx'.

# Answer
> 1 votes
Also in the database in the 'url' column I see the url of the dashlet in the form: civicrm/report/instance/42?reset=1&section=2&snippet=5&context=dashlet and comparing entries with data in the name column I can see that the report instance number matches. So I replace the NULL entry with 'report/xx' where xx is the report instance number as reported in the url column, and the dashboard now loads as expected.

Question is: why did 4.6.18 work fine with NULL entries in this table while 4.7.15 breaks, and how did the broken entries get to be badly created in the first place?

# Answer
> 3 votes
I'm glad you found the cause of your problem. It does sound like something went wrong back when you originally created those dashlets, and it's not clear what that was. But it would be good to proactively repair this during the upgrade.

I've created a PR to do so: https://github.com/civicrm/civicrm-core/pull/9672

---
Tags: dashboard, javascript, dashlet
---


title: Multiple custom field in a custom group

text:
# Question
Title: Multiple custom field in a custom group
I need to create a new tab for a Contact, with a custom field with multiple values. So I think I have to create a Custom group displayed in a tab, but then I can not add another custom group in this custom group, or a multi-valued custom field.....

How can I do that ??

Thanks

# Answer
Go to edit your custom group and enable multiple records. Users then will be able to add the field more than once.

Depending on your use case, the "Tab with table" may look better than the "Tab" display. Tab with table is easier to view and edit in most cases; try them and see which you prefer.
> 2 votes

---
Tags: custom-fields
---


# Question
Title: 404 errors for loading CSS on Event pages (Wordpress)
I'm using a fresh install of Civi 4.7.15 on Wordpress 4.7.1

I can use the back-end of Civi fine, but when I try to load public pages - e.g. Event Registration Page, the page can't load the necessary CSS and JS files (hangs for a long time and then displays wrong).

I believe it's somethng to do with paths - my Wordpress install is at: `http://mysite.org/mysite/wp-content`

(but points to `http://mysite.org/` as the default address)

When Civi tries to load the scripts, it looks for the files in `http://mysite.org/mysite/mysite/`

Changing the Base URL to just `http://mysite.org/` fixes the public pages but breaks the back-end.

Is there somewhere I can change this behaviour?

# Answer
> 2 votes
It looks like you have WP installed in it's own directory as per https://codex.wordpress.org/Giving\_WordPress\_Its\_Own\_Directory

The short answer is that this is not (yet) supported by CiviCRM. We've been documenting it here:

https://wiki.civicrm.org/confluence/display/CRM/WordPress+installed+in+its+own+directory+issues

The issue is tracked here : https://issues.civicrm.org/jira/browse/CRM-16421

For now I would move WP out of it's own directory, it may not be your optimum configuration, but it will work.

---
Tags: wordpress, civievent, registration, css
---


# Question
Title: Civicrm Activities - Scheduling conflicts
CiviCRM 4.6.11, Joomla 3.4.8

So we're using activities to schedule meetings between our clients and our staff.

Our admin assistant selects the date and time, and the staff member that will be meeting with the client and creates the meeting activity. The creation generates an email and sends the notification to the staff. Which is all great.

The issue we have is the creation of conflicting meetings. Is there anything in Civicrm that would notify the activity creator that there is already an activity scheduled for that date / time for that staff member? Rather than having to look up their activities before making the meeting?

Any help would be appreciated, and please let me know if additional details are needed.

Thanks!

# Answer
> 1 votes
" Is there anything in Civicrm that would notify the activity creator that there is already an activity scheduled for that date / time for that staff member?"

No there is nothing in CiviCRM that can do this currently.

For anyone using Drupal (I realise this user is on Joomla) then you could make a Views Calendar of Events and that could be used to view existing meetings, including filtering by contact.

---
Tags: activities, scheduling
---


# Question
Title: What is causing default membership type error?
On contribution page, I set "Membership One" as default membership, but then "Membership Two" is what shows up as default membership choice for public. I tried changing the default to other membership type, and it never "sets" as the correct membership I want defaulted but rather chooses another membership. It's like the membership type that is visible to public, is actually programmed as something else in Civicrm. Using WP.

How do I fix this?

Thank you!

# Answer
I think the answer to this was that there was a bug whereby the 'weight' was being used in one situation, whereas the type ID was being used in the other. And this error only showed up if you had changed the 'weight' ie the order of your Membership Types.

To quote the ticket in JIRA

> In the contribution page edit form, the default is selected by membership\_type\_id. When the contribution form is displayed, it's using the weight of the membership type instead

This has now been fixed by the Fuzion Team.
> 2 votes

---
Tags: civimember, default-settings
---


# Question
Title: Civi does not email to some contacts (Not CiviMail, just mail)
We've got some contacts in a search result. Selecting all or checking "All x contacts" and choosing "Email - send now (to 50 or less)" leads to the email screen stating that three of the contacts won't receive the mail. But all of the possible reasons (is\_deceased, do\_not\_email, ...) aren't true. The db says:

```
select do_not_email, is_deceased, is_opt_out from civicrm_contact where id = x;
+--------------+-------------+------------+
| do_not_email | is_deceased | is_opt_out |
+--------------+-------------+------------+
|            0 |           0 |          0 |
+--------------+-------------+------------+

select email, is_primary, on_hold from civicrm_email where contact_id = x;
+--------------------------------+------------+---------+
| email                          | is_primary | on_hold |
+--------------------------------+------------+---------+
| m.muster@domain.tld            |          1 |       0 |
+--------------------------------+------------+---------+

```

The contacts in question are able to receive emails if triggered by »send email«-action in contact's summary and even when selected in the result's list. The problem occurs only when sending to bunch of contacts.

Their email addresses seem valid and do not contain crazy chars.

I just can't find any reason why civi sorts such contacts out. I've read

But nothing helped. Any ideas?

# Answer
Thanks to michaelmcandrew's comment I investigated deeper and found the reason being a bug. Created issue https://issues.civicrm.org/jira/browse/CRM-19876 which is really weird but contains a somehow simple patch (https://github.com/civicrm/civicrm-core/pull/9676).
> 5 votes

---
Tags: email
---


# Question
Title: When exporting contacts using custom selected fields, results in "Undefined Index ...Mapping.php Line 622"
When trying to export a list of Contacts selecting a previously defined set of Export Fields, system throws this error:"Notice: Undefined index: in /home/.../Core/BAO/Mapping.php on line 622"

When exporting using primary fields, the export is successful.

What is the issue with Mapping.php?

# Answer
> 1 votes
This is a bug, albeit a minor one because of the simple workaround.

In PHP (the language most of CiviCRM is written in), there are various levels of problem: notice, warning, error, etc. A notice generally means, "This software's code has something ambiguous but not *wrong* about it. We're going to infer what the code's author meant to do, but they may want to make it explicit."

Good software strives to be notice-free, and CiviCRM is mostly notice-free. You've discovered an exception - though you haven't noted your CiviCRM version, so it's quite possible this is already fixed.

The reason this is less important than many other bugs is that notices should be *suppressed* on a live instance of CiviCRM - they should only really pop up if you're a developer. So the fix for this is to change your PHP settings to hide notices. This issue should go away after that. There's a few ways to disable notices; this Stack Exchange answer outlines them: https://stackoverflow.com/questions/2867057/how-do-i-turn-off-php-notices

# Answer
> 0 votes
I have found a corrupted line entry in the database table civicrm\_mapping. Went to Administer \>\> System Settings \>\> Import/Export mappings and tried to delete the line entry, but the system hung there without completing the step.

DROPPED the tables CIVICRM\_MAPPING, CIVICRM\_MAPPING\_FIELD, and CIVICRM\_SAVED\_SEARCH and recreated them from a backup copy (blank tables), but this still hasn't fixed the error.

When executing a contacts search and using "Select fields for export":

I get this error:

**Notice: Undefined index: in .../joomla/administrator/components/com\_civicrm/civicrm/CRM/Core/BAO/Mapping.php on line 622**

Any ideas??

---
Tags: contacts, php, export
---


# Question
Title: Unable to add multiple participant registrations for one contact
We use CiviCRM to collect anonymous feedback and equal opps data from event attendees in custom fields connected to an event participant role, and to avoid having to create multiple anonymous individual contact records, we have been registering multiple participant instances for a single anonymous record. Unfortunately, following the latest update to 4.7.14, this is no longer possible.

I realise that we've been taking advantage of something many would consider a bug - I'm pretty sure this change is a result of this bugfix: https://issues.civicrm.org/jira/browse/CRM-19550 \- but it makes our life vastly more complicated, because we'll have to create upwards of 100 anonymous records and anyone entering data will have to keep track of which participants have already been added (not a problem when there's 10 attendees; definitely a problem when there's 75).

I'm also concerned that if we have to correct information in participant records that are already in the system, we won't be able to without re-assigning the participant contact record, or, worse, that the custom participant data will become conflated.

Is there a way to disable/edit whatever dedupe rule is being used here? (I'm assuming that the participant records are still saved with a unique id and won't get overwritten - if this isn't case, I'd appreciate a heads up)

I think this may be related to this issue: Enable multiple event registration for same purchaser/participant \- however, that problem relates to individuals signing themselves up to events, not participants who are being registered by an administrator, and so the suggested fix doesn't apply here (even if it did, it would require us to enable online registration, which we definitely don't want!)

# Answer
> 1 votes
As I understand you correctly, you were exploiting a bug, and now its is fixed you search for another solution. One option is to undo the bugfix.

You can do this with the following actions:

`wget https://github.com/civicrm/civicrm-core/pull/9303.patch > CRM19550.patch`

* Reverse apply the patch on your 4.7.14 installation

`git apply -R CRM19550.patch` in the `[civicrm.root]`.

You have to follow the same procedure with every upgrade.

# Answer
> 0 votes
Perhaps you could do this via a non-Civi webform accessible only to your data entry volunteers (use webform if you are using Drupal as your CMS, or one of the forms plugins that are available for Wordpress) and not collect it in CiviCRM at all. Given that CiviCRM is all about linking data to named contacts and you expressly don't want to do this, then using Civi for it seems to be going against the grain.

---
Tags: civievent, registration, duplicate-contacts
---


# Question
Title: How do contact hashes work, and how do I keep them secure?
Currently we don't use contact hashes but we'd really like to.

My understanding is that contact hashes are exposed as a token that can be used in CiviMail where they are appended to links. They're unique to each user (stored in the contact table), and they look like they're an `md5` of something.

We're able to use them fine, but my question is around they work.

**Are they ever regenerated?**

**Are there best practices to keeping them secure?**

From what I can gather they carry the same privacy considerations as a forgot password link. Though where a forgot password link give the link holder full control of the account, the contact hash only allows forms to be prefilled (still exposes PII).

I'm lead to believe contact hashes should be regenerated within a hour of being clicked (some people might stuff something up, and need to click the link again).

Can anyone shed any light on this?

*(sorry for the brain dump)*

# Answer
1. Yes contact hashes are regenerated every time they are created. the microtime is embedded in the contact hash.
2. Contact hashes have a specific life time (by default, this is 7 days). So they are invalid after 7 days
> 5 votes

# Answer
My understanding is that Lobo's answer above is slightly misleading (at least if you read it 100% literally--the gist what he is saying is exactly correct, as usual, but the exact terminology may lead some of us astray).

The *contact hash* is a value stored in the civicrm\_contact table of the database (i.e., *civicrm\_contact.hash*).

The *contact hash* is used to generate the *contact checksum*, which is more precisely what Lobo is discussing above. It's easy to conflate to two, because they are closely related. To add to the confusion, the *contact checksum* is itself a type of hash--but a different one from that hash found in the database under *civicrm\_contact.hash*.

The *contact checksum* isn't stored in the database but is generated afresh by a call to a CiviCRM function each time it is used. The *checksum* encodes the time it was generated and also the time it should expire, along with the pertinent civicrm\_contact.hash to make a new hash. So the *checksum* is designed to be shared (e.g. with the contact associated with it) to allow temporary access to various parts of CiviCRM, and it expires after a set period. By default, checksums that civicrm generates will expire after 7 days. But tou can set that expiration time period to whatever you want, including infinite, when you request a checksum to be generated.

The *civicrm\_contact.hash*, by contrast is a *secret* and shouldn't be shared publicly--probably not even with the contact. It is something like the user's password, and someone with the *contact hash* could use it to permanently gain access to do anything with that contact that they could do with a valid *checksum*: edit that contact's information, view payment and general CiviCRM history for that contact, register for events or making payments on behalf of that contact, etc.

Also, as far as I know, the contact hash is never automatically regenerated. (If it were ever changed or regenerated, it would immediately invalidate any checksums that happened to have been recently issued for that contact--generally not something that you would want to do. If you want to give temporary access that expires, you would send them a checksum that expires, not change the hash.)

So leaking the hash is not quite as serious as, say, leaking a person's Drupal password, but it is still a privacy breach and something you'll want to avoid in almost all cases I can imagine.

Just for example, someone with the hash could generate a valid checksum to allow access to that CiviCRM contact at any time.

In short, when working to allow contacts temporary/non-password access to view or update their account info, you want to use the *checksum*--which is \*based on the \*contact hash\** but not the *hash* itself. The *hash* is a secret and you should keep it secret.

An example of how to get the contact's checksum & turn it into a URL that could be used to edit the contact's profile:

```
// initialize civicrm stuff
// Source: https://forum.civicrm.org/index.php?topic=21438.0
civicrm_initialize(true);
require_once(drupal_get_path('module', 'civicrm').'/../CRM/Contact/BAO/Contact/Utils.php');
require_once(drupal_get_path('module', 'civicrm').'/../CRM/Utils/Mail.php');

// try looking up the contact
$result = civicrm_api('Contact', 'get', array('email' => $email, 'version' => 3));
foreach($result['values'] as $contact) {
    // generate a url for this contact
    $checksum = CRM_Contact_BAO_Contact_Utils::generateChecksum($contact['contact_id'], time(), 24); // 24 hour checksum
    $query = "reset=1&gid=9&id=".$contact['contact_id']."&".$checksum;
    $url = CRM_Utils_System::url('civicrm/profile/edit', $query, true, null, false);

```

Code from CRM/Contact/BAO/Contact/Utils.php showing the header for the checksum generation function

```
  /**
   * Generate a checksum for a contactID
   *
   * @param int    $contactID
   * @param int    $ts         timestamp that checksum was generated
   * @param int    $live       life of this checksum in hours/ 'inf' for infinite
   * @param string $hash       contact hash, if sent, prevents a query in inner loop
   *
   * @return array ( $cs, $ts, $live )
   * @static
   * @access public
   */
  static
  function generateChecksum($contactID, $ts = NULL, $live = NULL, $hash = NULL) {

```

Header from Utils.php showing how to use the checksum validate function:

```
  /**
   * Make sure the checksum is valid for the passed in contactID
   *
   * @param int    $contactID
   * @param string $inputCheck the checksum to validate
   *
   * @return boolean           true if valid, else false
   * @static
   * @access public
   */
  static
  function validChecksum($contactID, $inputCheck)  ...

```

Sources: https://wiki.civicrm.org/confluence/display/CRMDOC/Tokens

Get or generate a contact checksum via API?

https://drupal.stackexchange.com/questions/140841/how-to-ensure-civicrm-checksum-cid-are-valid-in-custom-drupal-module

http://backofficethinking.com/blog/civicrm-tip-did-you-know-you-can-use-checksum-tokens-webforms
> 12 votes

---
Tags: civimail, best-practice, tokens
---


title: Clean Up Caches and Update Paths

text:
# Question
Title: Clean Up Caches and Update Paths
Running CiviCRM 4.3.8 on Drupal 7.37 (for now, but we're in the long process of a major upgrade of our website). Often I have to update the paths because they revert to a different docroot which may have been originally set up for testing purposes. (Let's call them A and B, A is the correct one and B is the wrong docroot.)

When it reverts seems to be at random and I cannot find the cause, but it causes problems such as emails going out with links to a test website in B's docroot, the reports will not load, etc.

Update file paths settings will show:

Old Base Directory - /var/www/html/B/docroot/sites/default/files/

New Base Directory - /var/www/html/A/docroot/sites/default/files/

Edit: The CiviCRM installation is in a separate docroot from the Drupal installation (for now) and uses symlinks in sites/all/modules in order for Drupal to find it.

# Answer
Our CiviCRM was installed outside of the Drupal root in order to circumvent performance issues with Drupal commons. I have re-engineered so that CiviCRM is now inside the Drupal root and upgraded. I also noticed multiple instances of Drupal in /var/www/html so I moved all other copies to a backups folder outside of the html folder.

We no longer have this problem.
> 3 votes

# Answer
Check your civicrm.settings.php file to be sure that the $civicrm\_root variable is correctly set, as is all the other settings in that file. Be sure to check all the way to the end of the file, just in case some override was done.
> 1 votes

---
Tags: civimail, drupal, cache
---


# Question
Title: Smart Groups Not an Option after Upgrade
We recently upgraded our Wordpress 4.7.1 installation to CiviCRM 4.7.15. I went to make a smart group today and noticed the option was not available. I previously added people to smart groups by going to **Report**\> **Membership** \> Select Approriate Report and results \> **Action** \> **Add to Smart Group**

When I got to Action now on the left there is no Add to Smart Group.

When I got **Contacts** \> **Manage Groups** \> I see the Smart Groups, but can't create a new smart group. I can create a regular ole managed group though.

Did something change?

# Answer
> 5 votes
A smart group is a stored search. To create one a search is the starting point.

1. Do a search.
2. Opt for all records
3. Use the action "Create Smart Group".

In order to make a smart group selecting contacts that have a membership, you can start with an advanced search.

For example - Go to *Search -\> Advanced Search*. Expand the membership section (this takes a bit of scrolling, in the illustration below I closed the other sections):

Add the selection criteria (in the example Lifetime membership and Current Member). Execute the Search, do select all results and select the Create Smart Groep Option. Below an example of the Create Smart Group screen with criteria:

---
Tags: wordpress, contacts, groups, smartgroups
---


# Question
Title: Sort issue with CiviCRM Entity Reference on a Drupal node
I'd like to link a Drupal node (e.g. content type = 'event' with some custom fields in Drupal) to a CiviCRM event via an entity reference field.

The use case is that there are some events that don't require registration, but some that do, but we want them all to show in the same Events list with the same theming options (these will be pulled in various places on the site in various ways, not just in a calendar list). So: we create all the events in Drupal, and for the ones with registration options, we set up a parallel event in CiviCRM which is linked to the Drupal event by the entity reference field I mentioned at the outset, and we would link with a registration button from the Drupal event directly to the CiviCRM event registration page if there was an entity entered.

I've installed CiviCRM Entity and managed to add a field of type 'entity reference' to the Drupal event node.

I can tell it that this is a CiviCRM event, and asked it to sort on the event's start date in descending order, so that new events would be at the top.

When trying to edit the field (or create an event node if I just leave the field untouched), I get this:

`PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'civicrm_event.event_start_date' in 'order clause': SELECT civicrm_event.id AS entity_id, :entity_type AS entity_type, NULL AS revision_id, :bundle AS bundle FROM {civicrm_event} civicrm_event ORDER BY civicrm_event.event_start_date DESC; Array ( [:entity_type] => civicrm_event [:bundle] => civicrm_event ) in EntityFieldQuery->execute() (line 1192 of /home/public_html/includes/entity.inc).`

It looks like the column name in the database should actually be 'civicrm\_event.start\_date' -- am I right? I grepped in the civicrm\_entity folder and didn't see any references to 'event\_start\_date' in the code, so where should I look next?

**UPDATE:** As a temporary fix, if I disable sorting it works as expected.

# Answer
> 1 votes
When you install Entityreference, you get a Views Display, 'Entityreference'

You can create a Entityreference view, and use that View to choose what the options are for your entityreference field widget.

In this view you can sort, and get your sort order that way.

---
Tags: drupal, civicrm-entity, entity-reference
---


title: CiviCRM Entity and ACL Permissions

text:
# Question
Title: CiviCRM Entity and ACL Permissions
We are a federated political organisation migrating to CiviCRM 4.6. I have integrated CiviCRM with Drupal views and civicrm\_entity so we can create customised search pages for local organisers.

I'm finding civicrm\_entity and various fuzion extensions to be excellent help, but setting up permissions across a large grassroots organisation is still complex. We are currently managing this with a combo of permissioned relationships and auto-generated smart groups.

Question:

Currently, to view entity via *civicrm\_entity* (at e.g. civicrm-contact/\[id\]), a user seems to require the 'view all contacts' Drupal permission.

Is there an easy(ish) way to make *civicrm\_entity* respect CiviCRM ACLs? Or at least check that the logged in user has permissioned relationship with that contact?

thanks, L

# Answer
I wish i would have seen this question earlier, I can certainly help you out.

checkout civicrm\_entity.api.php in the civicrm\_entity module

I don't believe the controller is checking the ACL's when loading an entity. We may be able to add 'check\_permissions' =\> True to the call there in civcirm\_entity\_controller.inc CivicrmEntityController::loadEntites... food for thought, make a feature request in the civicrm\_entity queue if you still need this.

Alternatively

There is a hook, hook\_civicrm\_entity\_supported\_info() that you can implement and add entities to be exposed by the module or alter settings for the currently exposed entities. See the api information for full details.

Here you can alter what permissions are necessary to view/add/edit/delete entities via the CiviCRM Entity Drupal based forms or even set a custom callback.

```
function MYMODULE_civicrm_entity_supported_info(&$civicrm_entity_info) {
      $civicrm_entity_info['civicrm_contact'] = array(
        'permissions' => array(
          'access_callback' => 'MYMODULE_some_custom_callback_name'
        ),
      );
    }

```

This will tell CiviCRM Entity to use your custom callback instead of 'user\_access'

Your callback will look something like this:

```
    function MYMODULE_some_custom_callback_name($op, $entity_type, $entity, $account) {
      if (is_null($account)) {
        global $user;
        $account = $user;
      }
       if($entity_type == 'civicrm_contact' && $op == 'view') {
         // fetch contact_id for user via a uf_match api get call
         // do your custom permission check
         $rules = getAllByContact($contact_id); //maybe get the acl rules for a contact
        // determine whether the contact can view with some code here
        // then assuming the contact can view the contact
        $contact_can_view = TRUE;
        // or if not
        $contact_can_view = FALSE;
         return $contact_can_view;
       }
    }

```

see some useful information about getting ACL rules for a contact here: https://wiki.civicrm.org/confluence/display/CRM/Access+Control+List+Permissioning+Specification
> 4 votes

---
Tags: permissions, acl, civicrm-entity
---


# Question
Title: 4.7.14 Upgrade: Custom fields missing from views' filter criteria
Noticed this this morning after upgrading to 4.7.14 yesterday, so I believe there's a connection, but can't confirm 100%.

I have a view that shows how many contact records (that have a custom field 'Leader') are marked Yes. That's done by doing a distinct count on contact IDs, and then using the custom field to filter those.

This has worked absolutely fine until the upgrade, and now views does not show that custom field in the filter criteria. (FYI, I am also using CiviCRM entity and the entity field shows there)

I have experienced similar before, so have went and replaced by CMS database integration code in settings.php to no avail.

Does anyone have any ideas?

# Answer
> 3 votes
This relates to CRM-19545. PR-417 will hopefully be released in 4.7.16 but until then, you could apply the patch to restore the previous functionality.

---
Tags: contacts, drupal-views, civicrm-entity
---


title: Smarty Template CMS-agnostic URL

text:
# Question
Title: Smarty Template CMS-agnostic URL
Please can someone remind me how to create a CMS-safe URL in Smarty Templates?

Thanks

# Answer
{crmURL p="civicrm/points/grant" q="cid=$cid&type=$type"}

^this

The p is the address of the page The q is the list of parameters The domain is added first

So the above code (with $cid=A and $type=B) translates into:

http://example.org/civicrm/points/grant?cid=A&type=B
> 3 votes

---
Tags: smarty
---


# Question
Title: Adding password creation to registration form (Civi + Wordpress)
I've been trying to find a way to add password creation to the member registration form, and have the password sync with the Wordpress user profile. The membership itself syncs perfectly, but the password fields I've tried don't work. I'm using CiviCRM 4.6.19 and WP Version 4.7.1. Is there an easy way to do this?

# Answer
Yes, assuming you're talking about a public-facing registration form and not the back-end form.

* Go to **Contributions menu » Manage Contributions**.
* Next to the listing for your membership page, select **Configure menu » Include Profiles**.
* Note the name of one of the profiles you're including on the page. If you don't have one, include one! If you have two, either will do.
* Go to **Administer menu » Customize Data and Screens » Profiles**.
* Find the name of your profile, and next to it click the "Settings" button.
* Under "Advanced Settings", set "WordPress user account registration option?" to "Account Creation Required" and press "Save".

That's it! To test it, make sure you're logged out. You can't create a user if you're already logged in, since that means you have one!
> 1 votes

---
Tags: wordpress, civimember
---


# Question
Title: trouble with CiviCRM Installer on wordpress
I am trying to setup CiviCRM 4.7 on most recent Wordpress -- copied the folder to /var/www/html/wp-content/plugins/ and was able to see the plugins in Wordpress.

When I click on "configure CiviCRM", it takes me to a blank page -- there are no options available.

I am using Apache2, PHP, MariaDB on CentOS 7

# Answer
> 1 votes
CiviCRM is a very different beast than other plugins - it has more code than WordPress itself! Unfortunately the "normal" WordPress installation doesn't work. You can find detailed instructions here: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress. Also feel free to ask both here and on https://chat.civicrm.org for help!

---
Tags: wordpress, installation, configuration
---


# Question
Title: Invoice generation wkhtmltopdf font missing
I have a problem generating invoices on CiviCRM-4.6.16 with wkhtmltopdf-0.11.0\_rc1 on Drupal (7.43).

In the template I define a font-family

```
@font-face {
font-family:LiberationSans-Regular;
src:
url(/ABSOLUTE/PATH/TO/fonts/LiberationSans-Regular.ttf);}

```

In the Body I define a table I want to use the font like this:

```
      <table style = "padding-right:19px;font-family:LiberationSans-Regular;" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">

```

The font is always ignored, except when I use a system/default font (e.g. Courier).

I tried numerous locations on where to put the fonts, since I suspected a permission problem or something like that, but apparently nothing helps and I can't get other fonts in the pdf export.

I verified that wkhtmltopdf is used (via meta data of the pdf).

Help would be appreciated!

# Answer
Another option to try is to use inline fonts encoded in the base64 format. This prevents file system permission problems. More information can be found in this blog entry.
> 1 votes

---
Tags: drupal, pdf, invoice
---


# Question
Title: Multi-Record Custom Data Set - Permissions (View/Edit)
I am using some multi-record custom data sets and they are working well. I have been able to import records, use them in reports, use them in searches, add/edit and delete records. All seems to work fine for me except the authorization.

I have simple permissions - 1) Edit everything and 2) View Only. However, the multi-record custom data sets are open for update (add/edit/delete) for the view only users. The view only users cannot edit any other aspect of a contact yet they can do anything to a custom data set.

I have tried refining the permissions using ACLs for the custom data sets with the same result.

Is there something I can do to make the multi-record custom data sets not open for change?

We are using Drupal and CiviCRM 4.6

# Answer
Probably not the answer you were hoping for :-(, but confirming that is a current limitation. ACL's for custom data do not distinguish between View & Edit. On the New ACL screen, when you set the type of data to custom data, a message is shown:

> NOTE: For Custom Data ACLs, the 'View' and 'Edit' operations currently do the same thing. Either option grants the right to view AND / OR edit custom data fields (in all groups, or in a specific custom data group). Neither option grants access to administration of custom data fields.

It would be a useful enhancement to fix that, but you can't do what you want without writing code.

If you just want to deter some people from changing the data then adding a bit of jQuery to disable options would be fairly simple. That is not secure since a user can bypass it.

For a more robust approach, you could try hook\_civicrm\_validateForm.
> 2 votes

---
Tags: drupal, custom-fields, permissions, acl
---


title: Cannot access civicrm/report/list

text:
# Question
Title: Cannot access civicrm/report/list
As an administrator i go to

```
 Contributions > Contribution reports
```

but I am getting an error: access not allowed

In the Drupal log:

```
cannot access civicrm/report/list
```

In the CiviCRM log:

```
Jan 06 17:00:24  [info] $Fatal Error Details = Array
(
    [message] =>  is not of type String
    [code] =>
)

Jan 06 17:00:24  [info] $backTrace = #0 <path_to_civicrm>/CRM/Core/Error.php(331): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 <path_to_civicrm>/CRM/Core/DAO.php(1399): CRM_Core_Error::fatal(" is not of type String")
#2 <path_to_civicrm>/CRM/Core/DAO.php(1284): CRM_Core_DAO::composeQuery("\nSELECT v.id, v.label, v.value, v.name, v.weight, v.description\nFROM   civi...", (Array:2), TRUE)
#3 <path_to_civicrm>/CRM/Core/OptionGroup.php(602): CRM_Core_DAO::executeQuery("\nSELECT v.id, v.label, v.value, v.name, v.weight, v.description\nFROM   civi...", (Array:2))
#4 <path_to_civicrm>/CRM/Report/Utils/Report.php(423): CRM_Core_OptionGroup::getRowValues("report_template", NULL, "value")
#5 <path_to_civicrm>/api/v3/Job.php(224): CRM_Report_Utils_Report::processReport((Array:3))
#6 <path_to_civicrm>/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_mail_report((Array:3))
#7 <path_to_civicrm>/Civi/API/Kernel.php(161): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
#8 <path_to_civicrm>/Civi/API/Kernel.php(92): Civi\API\Kernel->runRequest((Array:7))
#9 <path_to_civicrm>/api/api.php(23): Civi\API\Kernel->runSafe("job", "mail_report", (Array:3), NULL)
#10 <path_to_civicrm>/CRM/Core/JobManager.php(134): civicrm_api("job", "mail_report", (Array:3))
#11 <path_to_civicrm>/CRM/Core/JobManager.php(79): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob))
#12 <path_to_civicrm>/CRM/Utils/System.php(1691): CRM_Core_JobManager->execute(FALSE)
#13 [internal function](): CRM_Utils_System::executeScheduledJobs()
#14 <path_to_civicrm>/CRM/Core/Invoke.php(276): call_user_func((Array:2))
#15 <path_to_civicrm>/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:12))
#16 <path_to_civicrm>/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#17 <path_to_civicrm>/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#18 [internal function](): civicrm_invoke("admin", "runjobs")
#19 /home/<account_name>/public_html/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
#20 /home/<account_name>/public_html/index.php(21): menu_execute_active_handler()
#21 {main}
```

As an administrator i should have full access, but i do not see the place where i can check (or change) this "full access", nor allowing myself to access report/list.

Thanks for all information and help!

# Answer
> 1 votes
Go to `/admin/people/permissions` and look for the CiviReport permissions.

---
Tags: drupal, permissions
---


# Question
Title: CiviEvent - front end registration error page - permissions or something else
All our event registration pages have stopped working in 4.7.14 & 4.7.15

Error is: You do not have permission to access this page. I've checked all Joomla ACLs for the public group and everything that needs access does and it worked ok before.

In the Logs I see this:

.../administrator/components/com\_civicrm/civicrm/CRM/Event/Form/Registration.php(243): CRM\_Core\_Error::fatal("You do not have permission to access this page.") ...

And that file around line 243 has this:

```
  // check for ability to add contributions of type
  if ($isMonetary
    && CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
    && !CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($this->_values['event']['financial_type_id']))
  ) {
    CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
  }

```

I have checked the financial type records on the events and I've also checked the new minimum amounts in the price sets etc..

I can't work out why this would be failing.

Has anyone seen this or knows if there is a bug in 4.7.14/15?

Cheers,

Dave

# Answer
> 2 votes
OK, found out what this was. There is a new check box in CiviContribute Components Settings 'Enable Access Control by Financial Type' In the users system this was checked. I don't know whether an administrator accidentally ticked that without knowing what it did or whether an update process ticked it.

Anyway, this being ticked with no civi ACL obviously locked everyone out of being able to access the financial types and therefore broke the front-end event registration process.

Un-check that field and save and the system is fine once again.

Hope this helps anyone else in this situation.

(PS - it looks like super users within Joomla are somehow treated differently which threw me initially the normal civi ACL checks obviously don;t apply to Super Users - hmm)

---
Tags: civievent, permissions, issues, registration
---


# Question
Title: UI glitches and "Invalid Classname" error when editing summary fields via AJAX
When trying to edit fields on contact summary using AJAX hover method, the fields don't open up properly for editing (scroll bars are sometimes missing, and not enough space is revealed). On clicking save, I get a fatal error: "Invalid classname".

I'm on Drupal but not using JS or CSS aggregation.

\[Edited:\]

I had thought this was due to upgrading to 4.7.15. But my dev site (same version) does not have this problem.

\[Edited to add more info\]:

In the browser console, when loading the contact record I get this error:

```
Refused to execute script from 'https://my.site.com/index.php?q=civicrm/ajax/responsiveadminmenu/7242/en_US/1/2ChmFGPv&1' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

```

Then when clicking on a field such as email or phone I get:

```
jquery.js:339 Uncaught SyntaxError: Unexpected token <

```

These errors do not come up on the dev site so I suspect they are related.

# Answer
> 1 votes
Turned out to be the fault of an extension called SlickNav. Once that was disabled it worked. I'll post a bug against the extension.

---
Tags: drupal, upgrade, ajax
---


title: How can I import dropdown options?

text:
# Question
Title: How can I import dropdown options?
I have defined a custom field of type Integer Select. How can I import a list of integers into the dropdown options list (rather than enter them manually, one at a time)?

# Answer
There are several extensions designed to do exactly this.

First is the aptly-named Option Values Importer. It hasn't been updated recently, and it only does the one thing - but it may be simpler to use as a consequence.

There's the configitems extension. This one has a bit more setup, but is great if you have to add/remove values on a regular basis.

Finally, there's the CSV API GUI extension. This is an alternative to the "API Explorer" approach Pete suggests, that lets you import in bulk from a CSV file. This works with all modern versions of CiviCRM and is probably the best bet if you don't want to mess with putting files into your web server's file system.
> 2 votes

# Answer
Is your motivation to transfer the configuration from test to production in a controlled way? A way to do this is to use the API that is part of CiviCRM. It contains a function *Optionvalue* for this purpose. The API can be called from PHP, drush or as a REST call. The best way to learn more is to use the API Explorer. You can find it via the following menu: *Support -\> Developer -\> API* explorer menu.

An example to add a soup to the Food preferences on the standard dataset is in PHP:

```
$result = civicrm_api3('OptionValue', 'create', array(
  'sequential' => 1,
  'option_group_id' => "soup_selection",
  'label' => "Onion Soup",
  'name' => "Onion_Soup",
  'value' => "onion",
  'weight' => 45,
 ));

```

Or directly with Drush:

`drush cvapi OptionValue.create sequential=1 option_group_id="soup_selection" label="Onion Soup" name="Onion_Soup" value="onion" weight=45`
> 0 votes

# Answer
Just to add to the options above. for brave (and knowledgable) souls who always take backups before operating on production (to paraphrase Dan's comment below) you can also do as an sql insert. For a few you can just 'copy as sql' an existing row then modify and run as a query eg

`INSERT INTO`civicrm\_option\_value`(`option\_group\_id`,`label`,`value`,`name`,`grouping`,`filter`,`is\_default`,`weight`,`description`,`is\_optgroup`,`is\_reserved`,`is\_active`)
VALUES
 (93, 'Broth', 'broth', 'Broth', NULL, NULL, 0, 1, NULL, 0, 0, 1);`

And if you have a lot to do I tend to do in a spreadsheet and use Concatenate and then insert.

Also a screenshot for the API Explorer approach
> 0 votes

---
Tags: contacts, option
---


title: How to report all event payments

text:
# Question
Title: How to report all event payments
The CiviReport's Event Income Report (Detailed) does not show each payment. How can I show (and hopefully total) all the payments registered in the system in one report?

# Answer
You could have a look at whether Extended Report extension that was built by Fuzion has what you need.
> 1 votes

---
Tags: civireport
---


# Question
Title: How to automatically generate DAO classes for my DB tables
I have about 22 DB tables for my extension and more are coming in as I work on the extension, I need to be able to automatically generate the DAO and BAO files to access these tables from my code, I followed this thread How do I add a new table to my extension? and it seems to be worked for the author of the post but I need more light on how generate the xml schema files if they can be generated and where do I run the xml/phpGencode.php specified in the comment to get the DAO files.

# Answer
> 2 votes
Installing civix and generating Extension using civix is the correct way you can find more details in the below link http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension

Or

For shortcut create an hook\_civicrm\_install and use the statement $sql = "CREATE TABLE "; $dao = CRM\_Core\_DAO::executeQuery( $sql );

The above code will do the trick - but always try to use the first method using civix

# Answer
> 1 votes
You could possibly rewrite the question. "How do I define a new Entity type in my extension?"

If that is the question you are asking, then the most up to date reference for adding an entity to an extension can be found here: https://docs.civicrm.org/dev/en/master/extensions/civix/#add-a-new-entity

---
Tags: extension
---


title: Cannot Find Civicrm.settings.php file

text:
# Question
Title: Cannot Find Civicrm.settings.php file
I'm relatively new to CiviCRM so this might sound like a question with an obvious answer.

I have set up my cron for my drupal CiviCRM site with easycron.com and have found that it always reports back the same error:

```
Could not load the settings file at: /home/content/06/10588406/html/sites/all/modules/civicrm/../../../default/civicrm.settings.php

```

Now, I have gone through and verified that I have followed the instructions (I even created a new site with absolutely no purpose other than to test this issue with civicrm) and it come up with this error too. All of the requirements are met, permissions checked, everything...

So what can I do to change this? Is there anything I can hardcode into the civicrm config file? Or does anyone know where I might find the directory that it's currently looking in to paste a copy of the civicrm settings file (currently located in /sites/default) into it?

Thank you!

Matt

# Answer
> 1 votes
As per the suggestion of @Volker - this module Drupal Cron for CiviCrm (drupal.org/project/civicrm\_cron) appears to do the work I need it to. However, I'm still going to try and work on as to why going through the cron.php function of CiviCRM fails when this new module works.

# Answer
> 1 votes
the path suggests a problem which i can't suggest the fix for, but if it helps I would expect to have the civicrm module at

/sites/all/modules/civicrm

which it looks like you have but the settings file would be at

/sites/default

not at

sites/all/modules/civicrm/../../../default/civicrm.settings.php

---
Tags: drupal, installation, configuration
---


# Question
Title: How to add additional custom translation for a payment processor?
I have installed a payment processor extension and it is only in english by default. The vendor delivered a .po and a .mo file with a german translation of the extension. What is the best way to implement the translation of the extension? As I'm new to CiviCRM and following what i have read in the documentation i need to do it via a team on the Transifex project?

Is this the only way? Or can i do it manually as well? It is connected to a drupal CMS and i know how to translate custom modules in drupal.

Any hint appreciated!

# Answer
Just after starting the bounty i have found what i was looking for:

To merge two .po files you'll need to use some shell magic. I did the following:

* extract the original civicrm.mo file to a .po file with this gettext-command: `msgunfmt civicrm.mo -o civicrm.po` to an empty folder
* paste the .po file of the extension to the same folder
* merge the two .po files with this command: `msgcat --use-first *.po | msgfmt -o civicrm.mo -`
* replace the original civicrm.mo file on the server with the newly created one
* clear cache

This is working for me. The extension is translated.
> 4 votes

---
Tags: drupal, payment-processor, localisation, translation, transifex
---


# Question
Title: Renewal link mangled by webmail client with ISP
We have been successfully using the contact.checksum link in renewal reminder emails for our Wordpress site. The link in the received email typically looks like:

https://sdbikecoalition.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2&cs=yyyyyy&cid=xxx

However, one user has different behavior when opening the email on a webmail client (it will be OK when reading the email in another client). The webmail client is with a local ISP, cox.net. The link has an extra path in the URL, e.g.

https://webmail.west.cox.net/do/mail/message/sdbikecoalition.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2&cs=yyyyyy&cid=xxx

This seems to be CLEARLY the fault of the ISP. The SAME email, when forwarded to another mail provider is correct. The user with this problem has talked to their ISP (cox.net) and they cannot provide an answer.

I'm just posting to see if anyone has encountered something like this with either cox.net or any other ISP.

# Answer
> 3 votes
Here is an answer that explains the prefix https://webmail.west.cox.net/do/mail/message/ that was added to the front of our primary domain. Looking at the CiviMail source for this message (and a number of other similar messages, propagated by copy/paste) the mail source did not specifically set the protocol prefix to "https://". Instead, the source had the default "other". Evidently, most of the ISPs we tested tack just http:// on the front and since we redirect that to https://, everything works. However, the ISP cox.net adds a bit more when the link isn't fully specified. We can't really blame them and there may be different prefixes added by other ISPs. LESSON LEARNED: make sure you add https or http protocol when inserting the contact checksum link (hopefully noone is non-SSL, so it really should be https ;))

---
Tags: civimail, scheduled-reminders, checksum
---


# Question
Title: Enable use of do_shortcode when using CiviCRM and WordPress templates
I am trying to add a simple CiviCRM profile shortcode to a template of my theme, but the required CiviCRM files are not being loaded in the wp\_head and therefore the shortcode does not render the profile form.

I have traced the issue to CiviCRM only loading these files if the shortcodes are being added to the content of the page or post.

This means that not only does the do\_shortcode function not render CiviCRM shortcodes, but also any ACF (Advanced Custom Fields) fields created cannot render the shortcode either.

The php function that handles all of this, is the 'prerender' function in the CiviCRM\_For\_WordPress\_Shortcodes class of civicrm.shortcodes.php.

The shortcode I'm trying to add is as follows...

```

do_shortcode('[civicrm component="profile" gid="14" mode="create" hijack="0"]')

```

Does anyone know if this behaviour can be modified, so that the files are enqueued on all WP pages?

Thanks for any help!

Matt

# Answer
Personally, I don't think loading CiviCRM on all pages regardless of whether there's a shortcode present is a good idea. What you should be able do, however, is something along the lines of:

```
add_action( 'get_header', 'force_civi_scripts_to_load' );
function force_civi_scripts_to_load() {
  if ( is_page_template( 'your-template.php' ) ) {
    add_action( 'wp_enqueue_scripts', array( civi_wp(), 'front_end_page_load' ), 100 );
  }
}

```

This should force CiviCRM to load the appropriate scripts when (and only when) the template that your shortcode is located in is loaded. If, however, your shortcode sits in a template part, then you may have to be less specific about when you force CiviCRM's scripts to load.
> 3 votes

---
Tags: wordpress, profile
---


# Question
Title: How to speed up CiviCRM 4.7 php execution time
Anyone have an idea of how to speed up CiviCRM PHP execution time ?

I'm an administrator of CiviCRM on Wordpress production set-up, and I find it too slow. I've conducted a little investigation using NewRelic and the whole execution time of (around 2,000ms per request in average) is due to Php execution. All the requests below are CiviCRM's (all URLs are of this type /wp-admin/admin.php?page=CiviCRM)

I'm running an SSD server with 2CPU@3.1Ghz + 7G RAM, with only one Wordpress&CiviCRM running on an Ubuntu 16.04, Php5.6, MariaDB, Nginx, Memcached, and FPM with 25 workers. The whole system is using under 40% of RAM, 10% CPU, for an average load of around 0.3. I find it hard to believe that the server is under-sized.

Thanks for any input on that issue !

# Answer
> 3 votes
This would appear to be a fairly general question of Linux server optimization, which is a complicated subject. The details of such optimization depend on a myriad of factors and settings and is, generally speaking, not the kind of thing that can be answered on a site like this--it depends as much upon the hardware as it does on the software and settings.

To optimize your server would require an analysis of your server and its details by a sysadmin with Ubuntu experience.

# Answer
> 3 votes
If you're lucky, you just need to turn on the php op-code cache. My experience using on Centos6 was that it wasn't on by default. But I'm intrigued if your slow execution time is specific to CiviCRM. If it isn't, your server specs sound reasonable, but there are many devils in the details, and I'd tend to agree with Hershel that you should go back and make sure your server is correctly setup before involving CiviCRM in the diagnosis. You should likely be aiming for a php response time under 500ms.

# Answer
> 1 votes
We run newrelic to monitor most of our servers, your stats look very slow compared to what we normally see. It looks to me as though theres some performance issues specifically with your instance.

---
Tags: php, performance, sysadmin, nginx
---


# Question
Title: Error when assigning Activity to a contact
We're on 4.6.8 and having an issue where when saving an activity which is assigned to a contact the following error is displayed:

> Sorry but we are not able to provide this at the moment.
>
> Sorry an Error Occured MysqlColumnNameOrAlias is not a recognised (camel cased) data type.

If it is not assigned to anyone there is no error. However, if you click back and go into the record again the activity has in fact been saved. Not a massive issue as the activity is saved but it's not good from a usability perspective.

From looking online it looks like the following code is where the error is being generated from:

https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/Type.php

Any ideas what is causing this?

# Answer
Ah, you have the answer in your question. If you look at your reference to the current code, it should be recognizing that MysqlColumnNameOrAlias instead of generating the error in the default clause of the switch.

So I checked the history of that file, and the MysqlColumnNameOrAlias case was only added mid-last year.

Conclusion - upgrade your Civi to the latest 4.6 (which you should do anyway because of security reasons).
> 1 votes

---
Tags: error, activity
---


# Question
Title: How to download a copy of the CiviCRM User and Administrator Guide?
I am a new admin user of CiviCRM and want to know how to download a copy of the latest Admin Guide rather than view online? This is referred to in the introduction and refers to the chapter 'History of this Guide' but I can't find a link to a file anywhere.

# Answer
> 3 votes
What follows are steps to download and view the User Guide offline using the MkDocs software.

*Caveats: this solution (a) requires some technical skill to set up, and (b) still requires a web browser to read (though not an Internet connection).*

1. Install pip (python package manager)

* OS X: `brew install python`
    * Debian/Ubuntu: `sudo apt-get install python-pip python-wheel`
2. Install MkDocs

```
sudo pip install mkdocs

```
3. Download the source files for the guide from GitHub.

```
git clone https://github.com/civicrm/civicrm-user-guide.git
cd civicrm-user-guide

```
4. Run MkDocs

```
mkdocs serve

```
5. View through your browser at http://localhost:8000

More information about the process is available on the documentation page within the CiviCRM Developer Guide.

# Answer
> 1 votes
I'm not sure how you can get a download version of the Admin Guide other than to Copy and Paste.

On the CiviCRM Documentation wiki page at https://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Documentation, in the bottom left hand corner, there is reference to some CiviCRM books that are available for purchase. I believe that if you use a discount code PACKT20, you can get a 20% discount but I haven't personally tested this out.

Hope this helps.

---
Tags: documentation
---


title: Find CiviCRM version programmatically?

text:
# Question
Title: Find CiviCRM version programmatically?
Within a CiviCRM extension, what's the best way to determine the current CiviCRM version in versions 4.6.x and above?

# Answer
> 8 votes
Agree with Chris that `System.get` is a great API for inspecting the system -- with a trade-off of breadth vs speed.

If you need something more performant, use `CRM_Utils_System::version()`, e.g.

```
$ cv ev 'return CRM_Utils_System::version();'
"4.7.16"

```

# Answer
> 7 votes
I'd use `System.get` API call. (source)

In the return values, there's a value for `version` which corresponds to the value in `civicrm-version.php`

```
$ cv api System.get name=version
{
    "is_error": 0,
    "version": 3,
    "count": 1,
    "id": 0,
    "values": [
        {
            "version": "4.6.20.0",
            "uf": "Drupal",
            "php": {
            // lots more info ...

```

Only worry about this might be how heavy that API call is - since I see data there from OS etc, it might not be suitable for calling frequently if rebuilding the data each time. There seems to be a bit of overhead to this API call (~0.07s per call in a randomly picked test environment), so for frequent use you'd want something lighter.

---
Tags: extension, developer
---


# Question
Title: Membership Confirmation & Receipt Message Template
I am facing an odd issue, below is my "Membership Confirmation & Receipt" but it is missing the transaction ID, and it is missing the check number when I record the transaction as a check. But I cannot find "Membership Confirmation & Receipt in my message templates in the system workflow message templates page.

So where would I go to add those two field? I'm lost as to where I can edit this template when it isn't in the place it should be.

Thanks! Matt

**UPDATED INFORMATION -- 2017 JAN 18**

Below is the HTML format for the Message Template for the Contributions - Receipt (off-line) at least what is available to me.

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
</head>
<body>

{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}

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

  <!-- BEGIN HEADER -->
  <!-- You can add table row(s) here with logo or other header elements -->
  <!-- END HEADER -->

  <!-- BEGIN CONTENT -->

  <tr>
   <td>

    {if $formValues.receipt_text}
     <p>{$formValues.receipt_text|htmlize}</p>
    {else}
     <p>{ts}Thank you for your support.{/ts}</p>
    {/if}

    <p>{ts}Please print this receipt for your records.{/ts}</p>

   </td>
  </tr>
  <tr>
   <td>
    <table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
     <tr>
      <th {$headerStyle}>
       {ts}Contribution Information{/ts}
      </th>
     </tr>
     <tr>
      <td {$labelStyle}>
       {ts}Financial Type{/ts}
      </td>
      <td {$valueStyle}>
       {$formValues.contributionType_name}
      </td>
     </tr>

     {if $lineItem and !$is_quick_config}
      {foreach from=$lineItem item=value key=priceset}
       <tr>
        <td colspan="2" {$valueStyle}>
         <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
          <tr>
           <th>{ts}Item{/ts}</th>
           <th>{ts}Qty{/ts}</th>
           <th>{ts}Each{/ts}</th>
           {if $getTaxDetails}
             <th>{ts}Subtotal{/ts}</th>
             <th>{ts}Tax Rate{/ts}</th>
             <th>{ts}Tax Amount{/ts}</th>
           {/if}
           <th>{ts}Total{/ts}</th>
          </tr>
          {foreach from=$value item=line}
           <tr>
            <td>
            {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
            </td>
            <td>
             {$line.qty}
            </td>
            <td>
             {$line.unit_price|crmMoney:$currency}
            </td>
            {if $getTaxDetails}
              <td>
                {$line.unit_price*$line.qty|crmMoney:$currency}
              </td>
              {if $line.tax_rate != "" || $line.tax_amount != ""}
                <td>
                  {$line.tax_rate|string_format:"%.2f"}%
                </td>
                <td>
                  {$line.tax_amount|crmMoney:$currency}
                </td>
              {else}
                <td></td>
                <td></td>
              {/if}
            {/if}
            <td>
             {$line.line_total+$line.tax_amount|crmMoney:$currency}
            </td>
           </tr>
          {/foreach}
         </table>
        </td>
       </tr>
      {/foreach}
     {/if}
     {if $getTaxDetails && $dataArray}
       <tr>
         <td {$labelStyle}>
           {ts} Amount before Tax : {/ts}
         </td>
         <td {$valueStyle}>
           {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
         </td>
       </tr>

      {foreach from=$dataArray item=value key=priceset}
        <tr>
        {if $priceset ||  $priceset == 0 || $value != ''}
          <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
          <td> {$value|crmMoney:$currency}</td>
        {else}
          <td> {ts}No{/ts} {$taxTerm}</td>
          <td> {$value|crmMoney:$currency}</td>
        {/if}
        </tr>
      {/foreach}
     {/if}

     {if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
      <tr>
        <td {$labelStyle}>
          {ts}Total Tax Amount{/ts}
        </td>
        <td {$valueStyle}>
          {$totalTaxAmount|crmMoney:$currency}
        </td>
      </tr>
     {/if}

     <tr>
      <td {$labelStyle}>
       {ts}Total Amount{/ts}
      </td>
      <td {$valueStyle}>
       {$formValues.total_amount|crmMoney:$currency}
      </td>
     </tr>

     {if $receive_date}
      <tr>
       <td {$labelStyle}>
        {ts}Date Received{/ts}
       </td>
       <td {$valueStyle}>
        {$receive_date|truncate:10:''|crmDate}
       </td>
      </tr>
     {/if}

      {if $receipt_date}
      <tr>
       <td {$labelStyle}>
        {ts}Receipt Date{/ts}
       </td>
       <td {$valueStyle}>
        {$receipt_date|truncate:10:''|crmDate}
       </td>
      </tr>
     {/if}

     {if $formValues.paidBy and !$formValues.hidden_CreditCard}
      <tr>
       <td {$labelStyle}>
        {ts}Paid By{/ts}
       </td>
       <td {$valueStyle}>
        {$formValues.paidBy}
       </td>
      </tr>
      {if $formValues.check_number}
       <tr>
        <td {$labelStyle}>
         {ts}Check Number{/ts}
        </td>
        <td {$valueStyle}>
         {$formValues.check_number}
        </td>
       </tr>
      {/if}
     {/if}

     {if $formValues.trxn_id}
      <tr>
       <td {$labelStyle}>
        {ts}Transaction ID{/ts}
       </td>
       <td {$valueStyle}>
        {$formValues.trxn_id}
       </td>
      </tr>
     {/if}

     {if $ccContribution}
      <tr>
       <th {$headerStyle}>
        {ts}Billing Name and Address{/ts}
       </th>
      </tr>
      <tr>
       <td colspan="2" {$valueStyle}>
        {$billingName}<br />
        {$address|nl2br}
       </td>
      </tr>
      <tr>
       <th {$headerStyle}>
        {ts}Credit Card Information{/ts}
       </th>
      </tr>
      <tr>
       <td colspan="2" {$valueStyle}>
        {$credit_card_type}<br />
        {$credit_card_number}<br />
        {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
       </td>
      </tr>
     {/if}

     {if $softCreditTypes and $softCredits}
      {foreach from=$softCreditTypes item=softCreditType key=n}
       <tr>
        <th {$headerStyle}>
         {$softCreditType}
        </th>
       </tr>
       {foreach from=$softCredits.$n item=value key=label}
         <tr>
          <td {$labelStyle}>
           {$label}
          </td>
          <td {$valueStyle}>
           {$value}
          </td>
         </tr>
        {/foreach}
       {/foreach}
     {/if}

     {if $customGroup}
      {foreach from=$customGroup item=value key=customName}
       <tr>
        <th {$headerStyle}>
         {$customName}
        </th>
       </tr>
       {foreach from=$value item=v key=n}
        <tr>
         <td {$labelStyle}>
          {$n}
         </td>
         <td {$valueStyle}>
          {$v}
         </td>
        </tr>
       {/foreach}
      {/foreach}
     {/if}

     {if $formValues.product_name}
      <tr>
       <th {$headerStyle}>
        {ts}Premium Information{/ts}
       </th>
      </tr>
      <tr>
       <td colspan="2" {$labelStyle}>
        {$formValues.product_name}
       </td>
      </tr>
      {if $formValues.product_option}
       <tr>
        <td {$labelStyle}>
         {ts}Option{/ts}
        </td>
        <td {$valueStyle}>
         {$formValues.product_option}
        </td>
       </tr>
      {/if}
      {if $formValues.product_sku}
       <tr>
        <td {$labelStyle}>
         {ts}SKU{/ts}
        </td>
        <td {$valueStyle}>
         {$formValues.product_sku}
        </td>
       </tr>
      {/if}
      {if $fulfilled_date}
       <tr>
        <td {$labelStyle}>
         {ts}Sent{/ts}
        </td>
        <td {$valueStyle}>
         {$fulfilled_date|truncate:10:''|crmDate}
        </td>
       </tr>
      {/if}
     {/if}

    </table>
   </td>
  </tr>

 </table>
</center>

</body>
</html>

```

# Answer
If you go to civicrm/admin/messageTemplates?reset=1 you should see two tabs, one of which should say 'System Workflow Messages'. If you click on that you should find a list such as "Contributions - Receipt (off-line)"

If you Edit those you should then be able to insert tokens such as {$contributionID} in to the 'header' section. Such as we use the following so we can either say

Invoice: 23456

or

Receipt: 23456

depending on whether the payment was completed or not

{if $is\_pay\_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} No:{$contributionID}

and that goes after we have put in the client logo and address etc in between the BEGIN and END HEADER

If that is not working for you then you might need to tell us your civi version and consider upgrading to latest version (as i recall some earlier versions had issues similar to this).
> 1 votes

---
Tags: civimail, civimember, message-templates
---


# Question
Title: Installing Civi as a standalone site vs part of your existing site
I was just looking for some opinions regarding installing Civi in a current wordpress webpage (the non-profit's front facing regular ole website) versus creating a separate Wordpress installation to specifically house Civi.

Are there any major pitfalls to a separate directory?

# Answer
If the CiviCRM is installed on a different Wordpress site, important features and functions would be completely crippled by not being connected to the front-end website:

* Letting users input and manage their own contact information either deliberately or through contribution and sign up forms
* You wouldn't be able to take donations through the CiviCRM through the front-facing website
* Users wouldn't be able to sign up for events or memberships and be managed through CiviCRM
* You wouldn't be able to collect user email addresses or get newsletter sign ups through the front-facing website to be managed through the CiviCRM.
* Staff would have two different company websites to sign into for managing different things, instead of just one

I can't think of many pros for doing it this way. Even if there are features you aren't planning to use now, you might want to grow into them.
> 1 votes

# Answer
For balance, there are a few pro's for using a separate site and linking between them. The main website can have information about events or ask for donations and then link to Civi for bookings/contributions etc

* Your website and Civi are not tied to the same version of WP so upgrading is independent
* Your website and Civi don't even need to use the same CMS so you could leave your existing website in WP but have Civi on Drupal if you want Views, Webforms etc
* Your Civi site will (probably) have fewer extra modules/plugins/extensions which in theory reduces your number of vulnerabilities and improves your data security posture.

I'm not saying this is *better* overall, just that there are some benefits to separating your main site from Civi.
> 1 votes

---
Tags: wordpress
---


title: Security approach

text:
# Question
Title: Security approach
As someone responsible for IT-security, I have to state that everything has been done that can reasonably be expected to keep people’s data safe.

Therefore I want to ask in the round:

Did you do anything further to protect your CiviCRM installation as:

* keep CiviCRM up to date
* keep the CMS up to date
* keep the operating system up to date
* encrypt the site via SSL
* block unused ports
* keep client computer up to date?

Thanks in advance, Benedikt

# Answer
> 7 votes
Besides keeping things up to date as you mentioned, a number of security principles can be helpful from steps needed for PCI Compliance. There are a couple of questions here about that topic:

Here is another helpful question/answer about security and Civi, but with reference to Joomla (same principles apply really): Installing CiviCRM - best security practices

Agreeing with Erik, using SSL is at the top of the best practices list (you can check your site's security for free with https://www.ssllabs.com/ssltest/). With "SSL" as a practice though, you will want to adjust your ciphers to disallow known vulnerabilities. Limiting your server to just TLSv1.1 and TLSv1.2 is becoming the standard (and just TLSv1.2 is preferred if you don't need to support older browsers). Our payment vendor (iATS) requires the use of a service like TrustWave that scans our setup once per month (and ad hoc as needed) and lets us know of any vulnerabilities and updates needed to maintain PCI Compliance.

As a piece of that, you will also want to make sure your whole site defaults to HTTPS, not just the Civi sections. Google's search results looks favorably on sites which are entirely HTTPS, and with HTTP/2 now becoming a reality for folks, the speed hit should be mitigated (somewhat). Lullabot has a great deep dive on the topic: HTTPS Everywhere: Security is Not Just for Banks

As far as server practices go, keeping OpenSSL and OpenSSH updated are crucial. Closing ports that are not used, or limiting them based on IP address, is another helpful step to take.

A perhaps obvious step to take is to double and triple check your Drupal and Civi permissions and make sure access to data is limited to only those parties who need it and nothing more. This is especially pertinent if it's been a while since the CMS and Civi were first installed. Time often creates complacency.

# Answer
> 3 votes
The key operative word is ofcourse 'reasonably' :-) I do not have in-depth knowledge of server security or configuration but I tend to explain that the most secure setup is the one where your public facing website and CiviCRM are on separate servers. The first should be in the WWW, the second in a VPN. Ideally the two communicate via CiviProxy so you can configure which API calls will be acceptable and which not etc.

Obviously this is also the most costly alternative, and it also means you can just use CiviCRM Webform out of the box as it assumes CiviCRM and Drupal are on the same server.

Generally I advise organizations to check every security patch, and decide if installation is required or not. Ideally with the new LEXUM approach the security releases should not also have new and exciting functionality which then requires you to re-test some of your vital processes. But always take an informed decision on your environment would be my recommendation, not necessarily automatically install every update without doing your own thinking.

And I would certainly recommend usign SSL.

Good luck, share you decision with us if you can?

---
Tags: drupal, security
---


title: Mailing settings not displaying

text:
# Question
Title: Mailing settings not displaying
For some reason none of the mailing settings seem to be accessible for me anymore. When I go to e.g. Administer \> CiviMail \> Mailer settings all I get is a blank screen, and it's the same for other mailing settings as well. We haven't been able to find why the settings aren't visible anymore so any advice would be much appreciated. We're running on CiviCRM 4.7.15 and Drupal.

Thanks, Saeunn

# Answer
Sometimes when unexplainable things like this happen, it helps to just clear all the caches. Administer \> System Settings \> Cleanup Caches

If you use drush, `drush cc civicrm`. If that doesn't work, you could delete everything inside of the templates\_c folder.

`rm -r /[path/to/drupal_root]/sites/default/files/templates_c/*`
> 1 votes

# Answer
We have seen instances where civimail produced a blank screen after we hit rollback issues related to a CiviRule that was set to create an Activity after an online Contribution was added. (and changed some backtrace stuff)

Just mentioning this as an example of weird and wonderful and seemingly unrelated 'changes' can trigger failures such as this (ie angular pages not loading)

This is not a technically 'deep' answer but might give you an 'ah ha' moment if you can think of other things that have been added since you last successfully sent an Mailing.
> 1 votes

---
Tags: civimail, email
---


title: Help with QuickForm Image Upload

text:
# Question
Title: Help with QuickForm Image Upload
I have created a form and I am trying to get an image to upload. I have the following set:

```
$this->add(
      'file', // field type
      'image_file', // field name
      'Upload Image', // field label
      TRUE // is required
    );

```

However, when I submit the file it does not upload anywhere. Any ideas on what I am doing wrong?

Thanks!

# Answer
> 2 votes
You missed a param to that function. The 4th param is attributes, which you can pass as an empty array, and the 5th param is required, which you can pass TRUE.

---
Tags: quickform, upload
---


# Question
Title: Inbound SMS from Twilio not showing up in CiviCRM (getting 404 error on HTTP POST)
I'm really enjoying CiviCRM (recently upgraded to 4.7.13) and was excited about its SMS capabilities. So far, I have been successful in using CiviSMS with Twilio to schedule/send bulk messages.

**But, I cannot yet receive inbound SMS responses in CiviCRM with Twilio.** For example, if someone responds to one of our messages, it does not show up as an Activity in CiviCRM.

I followed the instructions for setting up Twilio for inbound SMS, but no inbound SMS arrived in CiviCRM.

Here's my configuration of Twilio in CiviCRM:

In my Twilio logs, you can see my configuration as well as the report on how the HTTP POST is running into a 404 error. Here is the detailed error log from Twilio

I've done a number of things to try and fix this--I disabled security plugins, played around with case of the API info entered in CiviCRM.. and now I've started to look at the htaccess files and permissions. But this kind of tinkering is out of my league, so am stopping before I do any damage.

So, I could use any advice y'all could provide.

Thanks! Chris

# Answer
> 3 votes
The callback path shown in your Twilio debug is

```
/civicrm/sms/callback?provider=org.civicrm.sms.twilio

```

For WordPress, this needs to be

```
/?page=CiviCRM&q=civicrm%2Fsms%2Fcallback&provider=org.civicrm.sms.twilio

```

The former is suitable for Drupal CMS, but won't work in WordPress CMS. WordPress paths for CiviCRM callbacks are generally `/?page=CiviCRM&q=civicrm/callback/here`

Per wiki: Setting up a SMS Provider for CiviSMS, the callback URL to use for Twilio/WordPress seems to be:

```
https://www.example.org/?page=CiviCRM&q=civicrm%2Fsms%2Fcallback&provider=org.civicrm.sms.twilio

```

Try adjusting the settings for callback over on Twilio and see if that fixes it?

---
Tags: wordpress, api, sms, civisms
---


# Question
Title: How to change ckEditors config.colorButton_colors
I previously did this by hacking

```
config.colorButton_colors = 'fff,eee,ccc,aaa,999,666,333,000';

```

into

```
./sites/all/modules/civicrm/packages/ckeditor/config.js

```

the config has moved .. I can probably still do this in the bower\_components, but it makes it all too clear it's a hack and will again be overridden in due time.

So, is there a place to customize ckeditor config safely, and more advanded than the wizard ?

# Answer
Sorry. The question is sufficiently answered here

How do I override the default CKEditor configuration?

The file I was looking for is

```
sites/default/files/civicrm/persist/crm-ckeditor-config.js

```

but it isn't 100% permanent :-/
> 1 votes

---
Tags: configuration, ckeditor, wysiwyg
---


# Question
Title: Error with Contact Custom Field in Advanced Search
We had an issue with the addresses of our contacts, so for now we added a temporal custom field that saves the province of that contact, so we can easily filter them. The thing is that when I do an advanced search filtering for that field, it doesn't show any results. What could be the problem?

Thanks in advance!

# Answer
It sounds like the custom field you created isn't searchable.

You can fix this by editing the custom field and ticking the box that says 'Is this field searchable?'
> 1 votes

---
Tags: custom-fields, search
---


# Question
Title: Workflow approach for anonymous users, or limited roles to create events
**Problem:** Currently, we need a trained content editor to create events. The event content, often comes via email from others inside (or outside) the organization. This typically involves copy/paste of event info. I could setup a form but this would still require manual effort.

**Objective:** I'm looking for a clever workflow adjustment to allow people (authenticated or even anonymous) to stage the event content for approval so that many people can initiate the event workflow and an event coordinator can finalize/approve. Civi already has the public/active flags for events. I know many folks are developers and jump to a dev solution, but wondered if some creative folks had an approach to this for a system builder without much new coding - Anyone up to the challenge?

**Scope:** Clearly this can be done via development of an extension/api or custom tpl, but wondered if someone has a lower cost/maintenance approach to preparing/staging content in CiviCRM (like drafts/workflow in a CMS.) I'm using Drupal.

**Approaches:** Since I'm using Drupal, one path I considered is civicrm\_entity which now supports domain.com/civicrm-event/add or domain.com/civicrm-event/edit. This exposes the laundry list of event fields so I would need display suite or some other module to hide most of the irrelevant fields and set the event to inactive. The problem here is that price / location / etc. are actually different entities so I believe i'd need code to join them. The nice thing here is that the user can see the template content and then just edit it or leave it.

Another thought was creating to webform or entityform to ask the user to fill-in things like event title, description, etc. and then using drupal rules, create an event based on a template and copy those fields to a new, unpublished event.

# Answer
I admire the principle of not being too ambitious in building customizations, but I worry that you'd be going through far more trouble than you'd need to. You might consider just building a custom Drupal module that did exactly what you need.

Set up a Drupal form with all the fields that you need. Then in the submit function, use the CiviCRM API to create the event, location, and whatever else--including leaving the event inactive. It won't be very reuseable, but it will be more reliable and understandable than a Rube Goldberg Does Drupal sort of contraption.
> 4 votes

# Answer
There is a new submodule to the CiviCRM Entity Project, CiviCRM Entity Reference Field

This module was originally developed for your exact desire, to be able to edit Event location block addresses from the Drupal Event edit form. It became apparent that this module would be useful for many similar purposes, such as editing a contacts civicrm addresses from the Contact entity Drupal edit form.

This module defines a field type of the same name that can be added to CiviCRM Entity types.

It stores no data in the Drupal field tables, but accesses the CiviCRM directly for add/edit/delete...so you can call it a "remote reference field"

It makes use of the Inline Entity Form module for manipulating the data.

So for your event, you add a CiviCRM Entity Reference field, labeled Location

In the field settings, match the screenshot below:

So what you are doing is reference the LocBlock entity from the Event entity, all data in CiviCRM

Then on the LocBlock form, add a field Addresses and configure like so:

Using the Inline Entity Form - Single widget for each field. What you get when you edit an event is:

In addition, there are two other new field types provided by submodules of the CiviCRM Entity project

**CiviCRM Entity Price Set Field** Provides a field type to edit the price set of an Event. At this time it only enables editing of the options of the first price field in the set, but is good for simple events.

On Event display, it provides a Drupal multi-page ajax powered form for event registrations.

**CiviCRM Entity Profile**

Allows select which profiles are used for the event registration page, and on the Price set Field Display event registrations
> 0 votes

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


title: View With CiviCRM Line Items

text:
# Question
Title: View With CiviCRM Line Items
I am trying to use Views to create a report to easily filter by an event and then see the specific line items for a registration. I cannot find a way to list the line items for a specific contribution.

I have tried Views as well as CiviCRM Entity but I have not been able to figure this out.

Any ideas on how to do this are greatly appreciated.

Thanks, Steve

# Answer
> 2 votes
The Extended Reports extension includes Priceset Reports. It works great for our org to see reports with LineItem info.

https://civicrm.org/extensions/extended-reports

# Answer
> 1 votes
There's also this extension that may suit your needs: https://github.com/Skvare/com.skvare.lineitemreport

# Answer
> 1 votes
The LineItem entity is now exposed by CiviCRM Entity as well. This gives line items exposure to Views.

I think all you are missing is some relationships to connect the event participant contributions, to the line items. This really wouldn't take a huge amount of effort to develop the finishing touches.

---
Tags: contributions, drupal-views, civicrm-entity
---


title: deduping - case sensitive?

text:
# Question
Title: deduping - case sensitive?
In many case, when visitors register to a public event, they use either capital case for or small case for their last name. Therefore, the deduplication engine considers both to be different. Can it be circumvent?

# Answer
> 1 votes
On workaround/better solution is to change the format of the value entered by end users so DAMIEN is converted into Damien, and the dedupe rule compares Damien=Damien and all works smoothly.

https://github.com/TechToThePeople/civicrm-normalise

X+

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


# Question
Title: Changing the content of the group that I have created
How do I change the content of the group i have created? The group that I have exists now is not what I intended to create but I am having difficulty changing it.

# Answer
> 1 votes
To start with take a look at the user guide: Managing Groups

If that doesn't help, perhaps you could edit your question to provide a bit more information (and a screenshot if possible).

---
Tags: groups
---


# Question
Title: conditional tax in financial payment page for membership
I am trying to setup conditional tax based on province for one membership in payment page. is there any reference I can use? is this hook needed and also custom code?

I am using drupal 7 with civi crm 4.7.1 version

some references would be great.

thank you

# Answer
> 1 votes
The easy - non-code - way to handle this is to create a Drupal node (page) with a select Province - and then based on Province selected popup a button with a link to a Contribution page that is configured with a Priceset that sells that Membership at that Province's General Sales Tax.

Edit: this is the only sustainable way to do this right now (see comment below).

# Answer
> -1 votes
One way of Doing this: First of all you need to create priceset for the membership and you need to create an Extension for handling this calculation and you can use hook\_civicrm\_buildAmount() and please put all you code in the extension

Please refer to the below link for hooks

https://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference

---
Tags: taxes, financial-accounts
---


# Question
Title: When will Drupal 8 be officially supported?
As I understand it, the Drupal 8 version of CiviCRM is available but still in bug fixing and feature adding mode. Is there news on when it will be officially on the civicrm.org website?

# Answer
> 8 votes
I've recently been reviewing the code, testing against Drupal 8.2.5, and developing and submitting Pull Requests to the D8 module. I've been roughly estimating the time that would be required to get it working good enough to install on a client's site.

The core module has all the CiviCRM admin pages and menus working, albeit with some JavaScript errors occasionally. The install process could use a little work, and the profile integration on the user view and edit pages needs an overhaul.

I think this all could be fixed up and QA with 40-120 hrs work to achieve a reasonable Minimum Viable Product(MVP) to release as an alpha version. That's a purposefully broad estimate, there's bound to be a few things to fix that remain unknown.

That being said, one organization with a decent budget that wants CiviCRM in D8 could have it, and make it happen for the rest of the community at the same time, there's definitely plenty that does work.

You can see the current installation procedure if you want to try it out in a related article: Does CiviCRM work with Drupal 8 and how can I help?

---
Tags: drupal-8
---