# Question
Title: Is the activity id of an activity created in webform available as a token to then use in an email generated by the webform?
I have a form that when submitted creates a new activity. I want to be able to send out an email from that same webform to a contact with a link to a second form that preloads the activity based on the activity id being in the url.

What would the token be (if there is one) that I could use to display the ID in the email generated from the webform? The activity id is not a field that I can display on the webform so cannot just copy the form key to get the token.

# Answer
The latest version (7.x-4.20) has a token for that: \[submission:activity-id:?\] Replace ? with 1 for the first activity.
> 5 votes

---
Tags: webform-civicrm
---


# Question
Title: Is there a way to interface CiviCRM with QuickBooks Online?
We can probably use the existing QB interface to manually export accounting batches from CiviCRM and then import these in QBO, but I am specifically looking for a solution that would use QBO's RESTful APIs (https://developer.intuit.com/docs/api/accounting) to automate this process as much as possible.

# Answer
> 3 votes
Agileware has developed a CiviQuickbooks extension - in this case "Quickbooks" means "Quickbooks online".

# Answer
> 1 votes
JMA Consulting is interested in providing an extension which would implement this service. I will contact you directly about this so we can work up a spec and scope the work on http://wiki.civicrm.org.

---
Tags: accounting
---


# Question
Title: CiviMail was sending mails, now it isn't
I could really use some guidance on how to troubleshoot this. This morning, we sent an email out to about 100 addresses using CiviMail and it worked fine.

Now, we can't. We didn't make any changes in the meantime. I can't send a test email, and when we schedule a job and the cron runs, CiviCRM shows it as successful, but no one is receiving emails.

When I log the mail to a file, we can see it going there, it's just not getting sent out. Other mail from contacts or the test mail() function still works.

I've checked the logs and can't see anything. Our hosting provider is not being helpful right now, and I could use some other guidance on information I can provide them to help troubleshoot. I could also use some suggestions on where to look in Civic.

I know everyone says "it used to work". Honestly, it really did.

We are using 4.7.15 with wordpress.

# Answer
I had exactly the same problem.. emails going out fine for months then BAM! nothing other than an error. I fixed it by updating our SparkPost API Key.
> 1 votes

---
Tags: civimail
---


# Question
Title: All emails are sent from the same address
I've noticed recently that when you send an email via Actions-\>Send Email, it does not show as being from the address you are logged in with or the one you choose from the drop-down. Instead it always comes from the same address (presumably one that is configured globally somewhere).

The reply-to address is correct, but the from address is not.

There is nothing in the bug tracker about it. Is anyone else having this problem? I have not consciously changed any email settigs... I'm on civi 4.7.22 on Drupal.

# Answer
Ah - yes that sounds like a regression. This is working fine in 4.6.28 - I just confirmed that in 4.6.28 the From is (correct) the Email that I am selecting from the From list - and not the default From as configured in:

```
civicrm/admin/options/from_email_address?reset=1

```

Open a JIRA ticket for it to try get some attention to this issue. Label it with **regression** \- and any detail you may have e.g. do you remember when this was last working?
> 1 votes

# Answer
Turns out it isn't defaulting to the site default address, but to the address used to authenticate with the SMTP server, which is in our case Gmail.

I think it is actually Gmail that is changing the From address, because the one that Civi is attempting to send from is not verified as an alternative address to send from that account.
> 0 votes

---
Tags: email
---


title: contacts where name = email

text:
# Question
Title: contacts where name = email
I inherited an installation where a predecessor imported an email list of 70K records and populated the Contact Name AND the Email address with the email address.

How can I isolate, export, and remove them?

Warning: noob alert.

# Answer
> 2 votes
Welcome to S.E. and CiviCRM. Having Contacts without First and Last is quite common and is often done intentionally to get Contacts signed up for Mailing Lists. If a contact has no First or Last then it is correct that the email shows as their Display Name and their Sort Name.

That said, if you really want to find and destroy/cull, then Search Builder (under Search) is your friend as it offers a Filter for 'IS NULL or IS Empty' hence you should be able to do something like the following

Individual \> First Name \> Is NUll (or empty) Individual \> Last Name \> Is NUll (or empty)

From the Actions tab you can then Export them, and then Delete them

# Answer
> 2 votes
If the First or Last Name field has been populated with the email address do a Search Builder search, and select the appropriate field and search for %@% using the Like operator.

Individual \> First Name \> Like \> %@%

---
Tags: contacts
---


title: Is there Support?

text:
# Question
Title: Is there Support?
Do you provide support services to users? If so, what is the cost or cost of additional add-ons? I've heard that this is priced a-la-carte per submitted request

# Answer
civicrm has a community of professionals who provide commercial support. We - Fuzion - are one such company. Others are listed at https://civicrm.org/partners-contributors

The Core Team also do paid work, though I think they focus on bigger improvements - see https://civicrm.org/paid-issue-queue.

If you are a 'member' then there is a discount for the Core Team work - https://civicrm.org/become-a-member

Community provided support includes

https://civicrm.stackexchange.com

https://chat.civicrm.org/civicrm/
> 5 votes

---
Tags: installation
---


# Question
Title: Session invalidated after returning from PayPal CiviCRM v 4.7.31
I've just upgraded to CiviCRM 4.7.31 from 4.7.30 on Drupal 7 and we've identified an issue which wasn't there previously. After being redirected to PayPal from a contribution form, the session is invalidated once you return to the site. I've checked the qvKey from the form to the "return page" (which throws an error) and it is correct. Payments are lodged correctly. Any ideas?

**Error log is**

```
$backTrace =
#0 /www/sites/all/modules/civicrm/CRM/Core/Error.php(381): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /www/sites/all/modules/civicrm/CRM/Core/Controller.php(833): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
#2 /www/sites/all/modules/civicrm/CRM/Core/Controller.php(853): CRM_Core_Controller->invalidKeyCommon()
#3 /www/sites/all/modules/civicrm/CRM/Contribute/Controller/Contribution.php(74): CRM_Core_Controller->invalidKeyRedirect()
#4 /www/sites/all/modules/civicrm/CRM/Core/Controller.php(312): CRM_Contribute_Controller_Contribution->invalidKey()
#5 /www/sites/all/modules/civicrm/CRM/Core/Controller.php(204): CRM_Core_Controller->key("CRM_Contribute_Controller_Contribution", TRUE, FALSE)
#6 /www/sites/all/modules/civicrm/CRM/Contribute/Controller/Contribution.php(55): CRM_Core_Controller->__construct("CiviContribute", "null")
#7 /www/sites/all/modules/civicrm/CRM/Core/Invoke.php(304): CRM_Contribute_Controller_Contribution->__construct("CiviContribute", TRUE, "null", NULL, "false")
#8 /www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15))
#9 /www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#10 /www/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:3))
#11 [internal function](): civicrm_invoke("contribute", "transact")
#12 /www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
#13 /www/index.php(21): menu_execute_active_handler()
#14 {main}

```

# Answer
Update - this was actually unrelated to CiviCRM. I had not updated the htaccess file correctly after a core upgrade.
> 1 votes

---
Tags: drupal, civicontribute, paypal
---


# Question
Title: How to add Thai language to CiviCRM in WordPress?
I'm using WordPress v4.9.5 and install CiviCRM v4.7.31 I want to activate 'Thai' language to CiviCRM, but there is no option to include this one into system. I try to check at Administrator \> Localization \> Language, Currency, Locations There is only one available which is "English (United States)"

I also try to contribute to translate project at https://www.transifex.com/civicrm/civicrm/translate/#th\_TH but there is no progress yet, it's about 5%

I download l10n from https://download.civicrm.org/civicrm-4.7.31-l10n.tar.gz but don't know how to install these folders to CiviCRM (there are multiple folders of l10n, and sql folder which does not have Thai files)

Could anyone help me?

# Answer
Since it's below 20% they aren't included in the download. You can use the instructions in the Administrator Guide wiki to get the files into CiviCRM. There is also more information at https://lab.civicrm.org/dev/translation/wikis/home
> 2 votes

# Answer
Would it be possible if I use some script of Google Translate or another plugins to WordPress for making translation directly on CiviCRM?

I try to use this one \>\> Translate WordPress with GTranslate https://wordpress.org/plugins/gtranslate/ but it works on frontend pages, but it does not work on backend system.
> -1 votes

---
Tags: localisation
---


title: Can't find 'longitude' in import wizard

text:
# Question
Title: Can't find 'longitude' in import wizard
I have civicrm 4.7.31 on D7. From my old civicrm 4.1.1, I have exported the following fields in a csv file:

1) civicrm\_contact (my external\_identifier) in 4.7.31 2) geo\_code\_1 (latitude) 3) geo\_code\_2 (longitude)

Now, when I want to fill fields in the import contact wizard in 4.7.31, I find the latitude field, but there is no longitude field. I have tried unsuccessfully to update the geocodes using the mapping function and Google in the Mapping and Geocoding section of the system settings.

# Answer
Make sure it is enabled under address settings. Go to Administer \> Localization \> Address Settings.
> 3 votes

---
Tags: geocoding
---


# Question
Title: What's the optimal method to archive a lot of mailings?
I look after a Civi install which has hundreds of completed mailings. I'd like to tidy things up a bit by archiving a lot of the older mailings, but there's no way that I can see to achieve this using the user interface.

Would it be OK simply to set the is\_archived field in the civicrm\_mailing table to '1'? I know for a lot of stuff tinkering directly with the database isn't a good idea, but in this case?

Ideally the mailing search results pages would work in the same way as contact search results pages and have checkboxes and an action menu, but that's not evident in the version currently running here (4.7.29 I think).

# Answer
> 4 votes
We have done some recent work on an Extension through which you can nominate a 'before' date and it then cleans out the Mailings along with the abundance of Activities, Activity Contacts etc.

So this is not 'Archiving' as per the OP, this is deletion and does not answer your question but am hoping it proves a useful answer for others who might stumble on this. We will be writing up a blog shortly. On the big databases we are testing this on it is clearing out millions of rows of data and speeding up other queries particularly related to Actvities.

Extension is at https://github.com/jitendrapurohit/nz.co.fuzion.deleteoldbulkmailings

NOTE: Usual warnings apply. Turn off logging before running this.

---
Tags: mailing
---


title: Geocode and Parse Addresses problem

text:
# Question
Title: Geocode and Parse Addresses problem
I have the following error when I attempt to execute the geocode operation in civiCRM 4.7.31 on D7:

> Entity: Job Action: geocode Summary Finished execution of Geocode and Parse Addresses with result: Failure, Error message: Aborting batch geocoding. Hit the over query limit on geocoder. Details
>
> Parameters raw (from db settings): geocoding=1 parse=0 start=1 end=100 throttle=1
>
> Parameters parsed (and passed to API method): a:6:{s:7:"version";i:3;s:9:"geocoding";s:1:"1";s:5:"parse";s:1:"0";s:5:"start";s:1:"1";s:3:"end";s:3:"100";s:8:"throttle";s:1:"1";}
>
> Full message: Finished execution of Geocode and Parse Addresses with result: Failure, Error message: Aborting batch geocoding. Hit the over query limit on geocoder.

I've entered my Google API map provider key in Settings - Mapping and Geocoding Providers. I've selected Google on the pull-down menus for Mapping and Geocoding Provider. I didn't think 100 records were too many to geocode.

In the **Name (Frequency)/Description** column, I have the following: Geocode and Parse Addresses (Daily) Retrieves geocodes (lat and long) and / or parses street addresses (populates street number, street name, etc.) API Entity: Job API Action: geocode

Any suggestions of changes in my settings?

# Answer
> 1 votes
The limits are listed here: https://developers.google.com/maps/documentation/geocoding/usage-limits

It looks like you've set throttling so it probably isn't a queries-per-second problem.

You can log into your developer console at google to see how much you actually are using. I'd start there.

# Answer
> 0 votes
There is a lot of geocoding going on in CiviCRM. Geocoding can be activated when contacts w/ addresses are imported; we’ve also hit geocoding limits issuing TaxReceipts (for which we had to retrieve addresses from the database); we have clients unexpectedly run into geocoding limits - a common factor has been ‘we were exporting data’ - though we have not gotten to the bottom of it yet.

---
Tags: geocoding
---


# Question
Title: How to debug variables inside function invoked via ajax call?
I want to debug a function on this file https://github.com/Project60/org.project60.banking/blob/9dc6bdcc486753f70948edfd4ea36df0eb9d2f86/extension/api/v3/BankingTransaction.php

```
/**
 * Analyses the given bank transactions
 *  used as AJAX call
 *
 * @param  list    list of bank_tx ids to process
 * @param  s_list  list of bank_tx_batch ids to process
 *
 * @return  array api result array
 * @access public
 */
function civicrm_api3_banking_transaction_analyselist($params) {
CRM_Core_Error::debug_var ('params', $params);

}

```

The above function is invoked by button which has onclick event https://github.com/Project60/org.project60.banking/blob/9dc6bdcc486753f70948edfd4ea36df0eb9d2f86/extension/templates/CRM/Banking/Page/Review.tpl

The code is as follows

```
  <a id="analyseButton" onClick="analysePayment()" class="button"><span title="{ts}Analyse (again){/ts}"><div class="icon preview-icon ui-icon-refresh"></div>{ts}Analyse (again){/ts}</span></a>

```

But I dont see anything on the log files, how can I get the variables I have checked it under sites/defaut/files/civicrm/ConfigandLog/ I dont see any civicrm.log files or any other files ending with .log dont have value of debug which I have entered Also debug settings has been set to Yes

# Answer
The `sites/default/files/civicrm/ConfigAndLog/` directory *should* contain your CiviCRM debug log (and some other files), provided that you're using Drupal, that your Drupal multisite directory is "default", and that the webserver is able to write to that directory. If you're not seeing that, you could:

* Check assumptions of what `CRM_Core_Error::debug_var()` will do with the input you're handing it (eg, check that if you pass in a string like `SNORK` instead of an array, you see that same word appear in a logfile). `::debug_var()` looks like it does print\_r
* `tail -f /path/to/*.log` might reveal which logfiles are being printed to when you hit that endpoint.
* Check the multisite directory is what you think (should be the same as your `settings.php` and `civicrm.settings.php`)
* Check again for typos (I see `defaut` in your question, but that's probably not it!)
* Check that the `sites/default/files/` directory and its descendant directories are writable to the webserver (typically user `www-data`, `httpd`, `_www` etc)
* Double check usage of the debug functions - there have been docs inconsistencies which might lead you astray.
* Check out CiviCRM docs on debugging
* There are other SE questions on debugging, eg tips on debugging when you can't view page output also applies well to AJAX callbacks etc where you can't/shouldn't *modify* page output.

CiviCRM has a more modern log interface available in `Civi::log()->debug('debug info');` (see How to print variable/debug data from your extension.php? for an answer on that).

If even that doesn't work, you could fall back to "stock" PHP debugging methods like `error_log()` and `file_put_contents()` if CiviCRM debugging isn't working.
> 1 votes

---
Tags: logs, civibanking, configandlog
---


title: Contribution pages don't work

text:
# Question
Title: Contribution pages don't work
My contribution pages (that I use to collect new members on a website) are completely crazy, just showing the page title repeatedly some 10 or more times.

But when I try to do a test-drive everything looks fine.

Based on a similar question here, I tried to create a new page from scratch, but the problem persists. No idea where to start digging :/

# Answer
> 2 votes
You need to set a WordPress base page. Create an empty page (e.g. titled "CiviCRM" with the slug "civicrm") and enter the page slug in the basepage field in `wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fsetting%2Fuf&reset=1`. Your form(s) should then render properly.

---
Tags: wordpress, contribution-page
---


# Question
Title: How can I prevent Contribution Pages forcing the email to be of type Billing
Only just stumbled on this after realising that a client was correct. They set the Profile to use Email (home) but the Contribution page overrides this and makes the email be Billing.

This ticket seems closest to the issue though it is initially about the idea of being able to collect additional email addresses.

If John K is correct then current approach is

* If the contact is logged in this field defaults to the 'Billing' email, if set, otherwise the 'primary' email
* When the contribution is confirmed the email address is saved/updated on the contact as the 'Billing' email

(ie: If the field was prefilled from the primary 'home' email, the contact would now have two email addresses the same for 'home' and 'billing')

# Answer
> 1 votes
One solution is to create your own custom module/plugin to do what is required. Steps:

1. Use hook\_civicrm\_postProcess hook for the target contribution page, you can give the contribution id or name in if condition.
2. Use civicrm contact create api call to edit email address type.

# Answer
> 1 votes
There is an extension here which includes email fields in profiles on the contribution page. The standard billing email address field is removed when an email field is found in profile.

If the contact is logged in - this field defaults to the 'Billing' email, if set, otherwise it is set to 'primary'.

When the contribution is confirmed the email address is saved/updated on the contact as the 'Billing' email

---
Tags: civicontribute, location-type
---


title: Editing donation fields

text:
# Question
Title: Editing donation fields
I'm trying to edit the 'If other, please specify' line on our donation form. I'm very new to this position and can't find an answer through my own searching.

# Answer
> 1 votes
Might be worth checking if your page uses a Price Set and then investigating the issue there. Otherwise it might be a field in a Profile, and that text may either be in the field 'pre help' or in the Profile 'pre or post help'

---
Tags: donations
---


# Question
Title: KCFinder - Is there a way to allow the user to specify the upload folder? Or change the default?
We use images stored in Civi for our CiviMails and our events, and our site is getting nearly a thousand images in the default image folder, sites/default/files/civicrm/persist/contribute/images. (Drupal 7.58, Civi 4.7.27)

As a result, KCFinder is increasingly stalling and not loading the directory tree or any images. This particularly happens for users with poor internet. So, following on from this earlier question, I'm now wondering if there's anyway to either:

1. Allow the user to specify which folder to put uploads into (ideal solution), Or
2. Change the default upload folder.

Where could I go to make these changes?

Thanks for your help.

# Answer
Right-click on the "images" folder in the kcfinder browser. You can choose New Subfolder.
> 2 votes

---
Tags: ckeditor, images, kcfinder
---


# Question
Title: Preventing slow performance with smart groups
After doing some research (Capacity Planning), it appears as if Civi slows down when there are a lot of smart groups or if the smart groups are children of other groups. What should be some good practices to put in place so that the performance/speed of Civi isn't dramatically impacted by a large number of smart groups? Thanks.

# Answer
Do you have a few smart groups on which many others depend? If so it's worth making sure they're as quick as possible. We have a script that generates the important ones once per hour - but by putting the contacts into regular groups, rather than smart groups. Regular groups are much faster, and that speeds things up a bit.

We've also turned *off* smart group caching. This very much depends on your use-case. But if you have a lot of intermittently-used smart groups it can be better to generate each one as needed rather than have a cron job regularly slow everything down by generating them all. But obviously ymmv on this.
> 3 votes

# Answer
Have you used Smart Group caches? https://docs.civicrm.org/user/en/latest/organising-your-data/smart-groups/#smart-group-caching
> 1 votes

---
Tags: smartgroups, performance
---


title: Restoring uploaded file records

text:
# Question
Title: Restoring uploaded file records
WE had some sort of corruption on our CiviCRM db and somehow lost data in different fields

One of these was a custom field containing uploaded files

THese files are still listed in the civicrm\_file table and the file ids are also associated with the civicrm entity in civicrm\_entity\_file.

BUt they do not show up in the contact profile.

I tried adding a new file to a contact and this shows up. I can't see any difference between the record for the new file and the one for the old file.

Any ideas how to restore these? there are 756 files, so it would be a lot of work to manually do it.

# Answer
If you say the file record is correctly present in `civicrm_file` and `civicrm_entity_file` table, then only thing which is missing seems to be the entry for it in custom value table. To verify this yourself -

* Check the custom value table name mentioned in `civicrm_entity_file` (`entity_table` column).
* Open the above custom table and make sure it contains the mapping of `civicrm_file` id and `entity_id`(contact id)
> 7 votes

---
Tags: files
---


title: Credit Card Receipt after 4.7 update

text:
# Question
Title: Credit Card Receipt after 4.7 update
Prior to updating to CiviCRM 4.7 our customers received receipts that included:

* Membership fees with each item listed separately with a description and price.
* The Transaction number
* The Billing Name and Address
* The Credit Card Information (only last four of credit card)

After we installed 4.7 this information stopped displaying on the receipt.

I have reviewed the receipt template. I did not see anything that should change this.

Is there a new setting that I am missing to display the transaction details?

# Answer
This fix in JIRA is meant to have fixed this problem
> 1 votes

---
Tags: receipts, authorize.net, 4.7
---


# Question
Title: Fixing the CiviCRM db when someone deleted "phone" from system dropdown menu options
Got a problem with how someone (I suspect) has gone in to CiviCRM » Administer CiviCRM » Option Groups » Phone Type Options and thought "hey, we don't need a dropdown item of "phone" because that's kinda dumb" and summarily deleted it.

Now all the phone numbers whose type is set to "phone" (landline) are missing that part of the designation when it comes to displaying a contact record as this phone number type is essentially un-hooked (no pun intended) or disconnected (okay, couldn't resist that time). Also, you can't designate it in new/updating phone numbers in the records as the drop-down phone type is no longer available.

A separate (technically savvy this time) staffer thought it would help if he added "phone" in as an option (without taking a briefing from me on the issue) which now has ID #7 associated with it and still hasn't restored the effectively lost data in the slightest.

This, as I suspected, requires a deep dive in to the database to fix the damage and restore the phone type options and values. I've had a look and discovered that phone\_type\_id is the item we are looking for and that the phone (landlines) were using a value of 1. I can find where there are tables such as civicrm\_option\_group and civicrm\_option\_values but my greater sense is that I'm more likely to bollox something at this stage as I really know little of how the database is organised and what everything really means.

Does anyone have some handy instructions to effectively restore the 'phone type options' data to what they originally were? Much appreciated.

Yes, we have backups but it was about a week before the issue was discovered and other updating and transaction work has happened in the interim.

# Answer
> 1 votes
If you have logging on then take a look in the log\_ tables related to the above - you will then be able to a/ see who did what when, and b/ have a template that may help you to restore the missing options

# Answer
> 1 votes
You're on the right track. I'm assuming you currently have a mix of records with 1 and 7 so the steps would be

1. Take another backup first (as always just in case).
2. On the admin edit screen for the phone option change the Value field from 7 to 1.
3. Update the recently entered phones in the database with:

UPDATE civicrm\_phone SET phone\_type\_id=1 WHERE phone\_type\_id=7;

---
Tags: custom-fields, database, default-settings
---


# Question
Title: How can I help review/test a Webform CiviCRM PR
Please describe the exact steps and requirements - of what I can do if I see a PR in https://github.com/colemanw/webform\_civicrm/pulls \- that I think would be useful to our organization.

# Answer
> 5 votes
You will need ssh access to the code base (on your server):

First: when working on latest code edits you may need to pull in the latest edits (that may not have been released yet) -\> for example:

`karins-macbook-pro-2:webform_civicrm sysadmin$ git pull origin 8.x-5.x
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 9 (delta 7), reused 9 (delta 7), pack-reused 0
Unpacking objects: 100% (9/9), done.
From https://github.com/colemanw/webform_civicrm
 * branch 8.x-5.x -> FETCH_HEAD
Updating 823e673..3f7294a
Fast-forward
 includes/wf_crm_webform_preprocess.inc | 5 +----
 js/webform_civicrm_forms.js | 6 +++---
 js/webform_civicrm_payment.js | 2 +-
 webform_civicrm.libraries.yml | 8 +++++++-
 4 files changed, 12 insertions(+), 9 deletions(-)`

Here are the PR specific steps:

1. navigate to your modules/webfrom\_civicrm directory and pull in the PR you would like to review/test - for example:

`[karin@louise webform_civicrm]$ wget https://patch-diff.githubusercontent.com/raw/colemanw/webform_civicrm/pull/128.diff`

2. patch it. Use a dry-run first - so see if there are any conflicts - the output will look something like this:

`[karin@louise webform_civicrm]$ cat 128.diff |patch -p1 --dry-run`

```
patching file includes/wf_crm_webform_postprocess.inc
Hunk #2 succeeded at 1772 (offset 9 lines).
Hunk #3 succeeded at 1793 (offset 9 lines).
Hunk #4 succeeded at 1810 (offset 9 lines).
Hunk #5 succeeded at 1835 (offset 9 lines).
Hunk #6 succeeded at 1862 (offset 9 lines).

```
3. If no issues - then for real:

`[karin@louise webform_civicrm]$ cat 128.diff |patch -p1`

```
patching file includes/wf_crm_webform_postprocess.inc
Hunk #2 succeeded at 1772 (offset 9 lines).
Hunk #3 succeeded at 1793 (offset 9 lines).
Hunk #4 succeeded at 1810 (offset 9 lines).
Hunk #5 succeeded at 1835 (offset 9 lines).
Hunk #6 succeeded at 1862 (offset 9 lines).

```
4. Check if there are any database updates to be executed (if you miss this step - you could get white screens of death). I use drush - and here's an example output:

`[karin@louise bin]$ drush updatedb`

```
Webform_civicrm  7403  Add field to create new relationship for duplicate records(expiredinactive).
Do you wish to run all pending updates? (y/n): y

```
5. Ok all done -\> navigate to a webform on your website and check out the new functionality! Take screenshots and note in the PR what exact steps you took - and what you compared/evaluated;
6. Bonus points for doing this on 4.7.x as well as 4.6.x

Thank you!

---
Tags: webform-civicrm, developer, user
---


# Question
Title: Issues with Migration - Cannot add foreign key constraint
I'm having multiple issues with a CiviCRM 4.7.17 on WordPress 4.9.5 which has encouraged me to make different attempts to migrate the site following the official SysAdmin Guide. The closest I've gotten so far is:

* Clean WordPress install
* a migration of Wordpress.
* Removed all CiviCRM plugin files, settings, and the civi sql tables.
* Installed CiviCRM (same ver. as the original site) but I made a separate SQL database - could this cause issues when migrating?

Attempted to import the original civi database via phpmyadmin but receive the following:

```
  CREATE TABLE `civicrm_acl` (
  `id` int(10) UNSIGNED NOT NULL COMMENT 'Unique table ID',
  `name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'ACL Name.',
  `deny` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Is this ACL entry Allow  (0) or Deny (1) ?',
  `entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)',
  `entity_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'ID of the object possessing this ACL',
  `operation` varchar(8) COLLATE utf8_unicode_ci NOT NULL COMMENT 'What operation does this ACL entry control?',
  `object_table` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The table of the object controlled by this ACL entry',
  `object_id` int(10) UNSIGNED DEFAULT NULL COMMENT 'The ID of the object controlled by this ACL entry',
  `acl_table` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'If this is a grant/revoke entry, what table are we granting?',
  `acl_id` i[...]
MySQL said: Documentation

#1215 - Cannot add foreign key constraint

```

After looking at various posts with similar errors, I can't make the import work. What gives?

I believe the database itself is screwed up beyond my limited understanding which makes me think a "start from scratch" would be useful but losing all the data isn't acceptable. (One issue I've been having lead me realize other things were wrong: Contacts not merged When creating Account on Event Page - DB Error: already exists)

Is it at all possible to export all the data that's been user-created with Civi to import on a clean Civi install besides the way listed in the SysAdmin guide?

ie. Move contacts (I know this can be exported via Civi), their history, custom profiles, custom fields, events, etc. to the testing site.

# Answer
It looks like your error message is truncated, which makes this a little hard to troubleshoot, so if you can find a way to generate a non-truncated version of this message, I think the solution should be clearer.

That said - I'm looking at a CiviCRM database dump. The first two tables to be created are `civicrm_acl` and `civicrm_acl_cache`. Your error references `civicrm_acl` \- but `civicrm_acl` doesn't have any foreign key constraints defined, so it makes no sense that you'd get this error on the line in your question.

However, `civicrm_acl_cache` DOES have a foreign key constraint - on `civicrm_acl`. So I would assume that one of the following is true:

* Your PHPMyAdmin user doesn't have the permission to create `civicrm_acl`, or perhaps to insert data into it.
* Your database dump you're loading is missing data from `civicrm_acl`.

Please check the following:

* Does `civicrm_acl` exist after you've imported it? If not, check permissions.
* Does `civicrm_acl` exist but contain no data? If yes, open your database dump in a text file and ensure that there's a line starting with `INSERT INTO `civicrm_acl` VALUES`. That line should be between the lines starting with `CREATE TABLE `civicrm_acl`` and `CREATE TABLE `civicrm_acl_cache`` \- somewhere right near the top of the file.
* If that line DOES exist, you might not have `INSERT` permissions.
* If that line doesn't exist, you should try getting a dump that does.
> 3 votes

# Answer
You'll likely need to make some temporary changes to your files to avoid the foreign key error. I do the same when I have to do an import to fix schema integrity.

Here's the page I am referencing: https://wiki.civicrm.org/confluence/display/CRMDOC42/Ensuring+Schema+Integrity+on+Upgrades

Here's what it says:

A note on possible Foreign Key Constraint Violation errors during import (and what to do about them): You may receive Foreign Key constraint violation errors on import because of the order in which the tables are exported and then imported, which is alphabetical.

For example, data for the civicrm\_activity\_assignment table would be imported before data for the civicrm\_contact table, violating the Foreign Key constraint defined on the civicrm\_activity\_assignment.assignee\_contact\_id field. You can avoid this by instructing MySQL to disable Foreign Key checks before the import and to re-enable it when the import is complete.

Before importing the datafile.sql file, open it in a text editor and add the following MySQL code to the first line of the file:

`SET foreign_key_checks = 0;`

And append the following code to the last line of the file:

`SET foreign_key_checks = 1;`
> 2 votes

---
Tags: wordpress, mysql, migration
---


# Question
Title: Add contacts to group using CSV with contact e-mails
I'm looking for a way to add contacts to a group from a CSV file including e-mails of contacts already existing in Civi.

When I import into Civi, I use the **update option** and select **primary e-mail**, and even when the e-mail is the same, it ads a second e-mail entry with the same e-mail that already exists.

Is there a way around this? It doesn't seem like it's the correct action as it pollutes the contact card with repeated e-mail entries.

# Answer
> 2 votes
You have to select an appropiate Dedupe Rule so that the importer can detect by which criteria you want to treat an existing contact and a imported contact as the same.

Using the predefined Email - Unsupervised Rule should work for this purpose.

If you chose the same location as is defined for the contact email it will just update the existing contact.

However, the option to select the primary e-mail does not seem to be working as expected. It will create a new adress without setting a proper location.

You may want to report this as a bug.

---
Tags: import, tags
---


title: NG-Hide Volunteer Search

text:
# Question
Title: NG-Hide Volunteer Search
I only have 12 items per volunteer project so I was hoping to hide the Search as it's pointless. I looks like there's code to control that but I can't find a way to turn it on or it's not functioning properly.

Kind regards,

# Answer
> 4 votes
appended &hideSearch=1 and that took care of it. Modified the css for the cart to width 100%.

---
Tags: civivolunteer
---


# Question
Title: Problem with recurring contributions on PayPal sandbox
I am setting up a CiviCRM website and using one of its modules to try to set up a recurring payment using PayPal. From the CiviCRM website, I get taken to the first PayPay screen:

I click on "Pay using debit or credit card" and get to this screen:

I fill this in with some dummy details, and click "Continue". At this point, my browser says "waiting for www.sandbox.paypal.com" and never returns.

I have tried this on a number of occassions, at different times of day, but always the same result.

I did wondering if it was hanging at the point of sending an IPN back to my website, but PayPal does not list any IPN attempts.

Can anyone shed any light on this?

Thanks

# Answer
Normally I create an account on the Paypal Sandbox server and then create a sub-account on that which has a bank account, balance, etc. And then when I test via the sandbox, I log into that sub-account and "pay" via it. I've never tried creating an account once I get sent over there to pay. Maybe that is the issue. But since it's stuck over at Paypal, this sounds more like a Paypal issue?
> 0 votes

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


# Question
Title: Where is IPN information stored in Civi?
We are using Civi 4.7.29 on Wordpress 4.9.4

Recently we moved our civi install of the root directory oursite.com to a subdomain subdomain.oursite.com.

While we were on the root directory, we were able to take recurring payments with out any problems. Suddenly on the subdomain, we are not able to accept recurring transactions anymore through paypal. It shows the recurring transactions as Pending/Incomplete in civi.

It just occurred to me that the IPN paths might still be hooking to the root directory and need to be changed to the subdomain.

Can someone tell me which folder these IPN hooks are in, so I can review them?

Thank you.

# Answer
Your IPN path is configured in paypal - the best path to point it to is yoursite/civicrm/payment/ipn/x where x is the number of the processor. Once you have updated it in paypal it is possible to re-send missed ipns from the paypal console
> 3 votes

# Answer
Have a look at civicrm/extern/ipn.php.

Perhaps you could solve this by adding a rewrite or redirect statement in your .httaccess in the root directory.
> 1 votes

# Answer
Which IPN file is used depends on what payment processor extension you use. So it might be a different file, not necessarily extern/ipn.php

The webhook URL that your payment processor tries to contact is sent along with the payment information. So for the old payments, your payment processor probably has the old URL stored and it's probably not possible to change that in their system.

The redirect option BobS mentioned here is probably what you need to do. Or add a Rewrite rule (that way the payment processor is not redirected)
> 1 votes

---
Tags: wordpress, api, recurring-contributions, ipn, pending
---


# Question
Title: CiviCRM_API3_Exception: Expected one CustomField but found 0 in civicrm_api3() (line 45 of sites/all/modules/civicrm/api/api.php)
I was cleaning up some extra custom fields in our DB. ONe of these , though it was disabled did not stop displaying in the contact profile. So I clicked to delete it.

I then got this error when I tried to do anything in Civi:

```
CiviCRM_API3_Exception: Expected one CustomField but found 0 in civicrm_api3() (line 45 of /var/www/crm/sites/all/modules/civicrm/api/api.php).

```

I tried commenting out the offending code in api.php, which got me past the error, but produced a whole bunch more warnings.

I saw in the table - `civicrm_custom_field`, that the record for the field that I tried to delete was still there. I manually deleted it but that did not help.

IN this situation I can;t get into CiviCRM at all to turn on backtrace or any other logging.

Really and truly stuck. Any help would be appreciated.

# Answer
Probably it's existance is cached - try truncating civicrm\_cache and / or calling the System.flush api
> 1 votes

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


# Question
Title: first CiviCRM request of each session takes 4 minutes, afterwards works fine
I have an issue where the first CiviCRM request of any session takes 4 minutes to load. This can be a request for the dashboard, or an administrative screen, it doesn't matter. There are no errors on screen and no errors appearing in the CiviCRM runtime logs. The first pageload simply takes four minutes, then everything works fine -- until the user logs out, and logs in again. Then the first request takes another 4 minutes.

I've been trying to research this and have come across several other questions that are relevant but don't exactly match my situation (Slow to open at first daily use, https://civicrm.stackexchange.com/questions/12886/civicrm-dashboard-hangs-for-5-minutes?rq=1,https://civicrm.stackexchange.com/questions/14343/civicrm-dashboard-hangs-for-5-minutes-part-2?noredirect=1&lq=1)

Based on info in the many answers, I've discovered the following:

* removing all dashlets/reports from the dashboard doesn't improve speed. Dashboard still takes 4 minutes to load -- but so do the other requests (except, strangely, for searches, which load right up)
* hosting provider has confirmed we don't have a NAT Fire setup and that internal requests should be working normally
* database doesn't seem to be the issue because 1) it's not maxed out, and 2) 2 concurrent sessions making the same requests one after the other exhibit the same behavior

I'm pretty sure this is an environment problem, because I have two CiviCRM installs on the same server which are exhibiting the same behavior (two different versions: 4.7.24 and 4.7.29). Clones of these environments do not have this problem on my local test servers.

It smells like a timeout, but I just can't for the life of me figure out where to start looking for what is timing out, and why only on the FIRST request of a session!

Seen in two installs of CiviCRM on the same server:

1st: Joomla 3.6.5, CiviCRM 4.7.24, PHP 5.6 2nd: Joomla 2.5.28, CiviCRM 4.7.29, PHP 5.6

# Answer
> 2 votes
I had a lot of trouble tracking down a problem that sounds the same. We ARE behind a firewall so pingbacks to CiviCRM etc WILL timeout. The last piece of the puzzle (once normal version checks were disabled) was adding this to civicrm.settings.php

global $civicrm\_setting; $civicrm\_setting\['CiviCRM Preferences'\]\['communityMessagesUrl'\] = FALSE;

# Answer
> 1 votes
To test whether the checks are causing the problem, open this file in your CiviCRM root: `CRM/Utils/Check.php`. Right at the top (line 35 or so) you'll see this:

```
const CHECK_TIMER = 86400;

```

Change that number to something lower (like `1`) and save. If the problem starts happening on every page load, the problem is the CiviCRM checks, and you can try disabling certain checks. Note that setting the number low WILL cause some performance issues generally - but not 4 minutes per page load.

# Answer
> 0 votes
A similar issue I've seen manifests when your CMS doesn't have a proper cron set up. I can't speak to Joomla, but WordPress and Drupal can both run their scheduled jobs on a page load. It's worth considering if your slowness is possibly related to the CMS and not CiviCRM.

This one is tricky, because sometimes it seems like it's host-specific - but the truth is that they're test sites that don't get traffic. The live site doesn't manifest this issue because the scheduled jobs are spread out over more page loads.

---
Tags: 4.7, performance
---


# Question
Title: How do you display custom Contact fields in Membership reports?
I have created some custom fields for Contacts and want to display these fields in a membership report that we call member mailing list. However I am unable to see the custom fields for Contacts as display columns in the report even though they are marked as searchable

# Answer
> 2 votes
If you can open the report file from your codebase, you can add the entity name to the `_customGroupExtends` variable array initialized at the top of the file of almost every report in CiviCRM.

```
protected $_customGroupExtends = array('Contact');

```

The above line will include all contact custom set in your report. You can add `Individual`, `Membership` to display custom group extending these entities too.

To see which file is used for the report, you can refresh the result to get a `Developer` tab which contains the class name used to display the result.

So the file which is used in above report is -

`/path_to_civicrm/CRM/Report/Form/Member/Detail.php`

# Answer
> 2 votes
Look for custom fields in a fieldset below the ‘standard’ report fields - here’s an example for another type of report - but clearly shows the custom data sets (if they have been marked searchable in the custom data set configuration) as fieldsets in the report - click them open and you’ll see the custom fileds

Second thought: Extended Report extension: https://civicrm.org/extensions/extended-reports \- you can download/install it from your Manage Extensions screen. It introduces a number of report templates - some of which will have many customfields extended (in fieldsets) so no core code edit required.

---
Tags: civireport
---


# Question
Title: How to add "Family Member Information" Columns to Event Attendee List report?
Is it possible to add Family Member Information columns to this screen? I run a youth program and it would be helpful to be able to pull emergency contact information when running the report. Very new to Civi.

# Answer
All the checkboxes in the screenshot you posted refer to built-in CiviCRM fields. "Family Member Information" doesn't refer to any built-in CiviCRM field, so it's a bit hard to know exactly what you're asking to do. Here are some options:

* If "Family Member Information" is the name of a *custom field group*, then you can add those checkboxes to the report by going to **Administer menu » Customize Data and Screens » Custom Fields**. Find the *Family Member Information* custom group and click **View and Edit Custom Fields**. Change any field you'd like to appear on this report such that **Searchable** is set to **Yes**.
* If "Family Member Information" is set via a relationship, you have a few options. I won't detail them here unless you update the question to indicate this is the case, but:
    + Add folks to a group, use the Relationship Report.
    + The Extended Reports extension has an Event Attendee List report with relationships.
    + If you're using Drupal, this is easy to implement using Views.
> 2 votes

---
Tags: civievent, civireport, column
---


title: Mailing_send_test error

text:
# Question
Title: Mailing_send_test error
I'm getting the following error when I'm trying to send a test email.

> Error in call to Mailing\_send\_test : Error in call to MailingJob\_create : DB Constraint Violation - possibly mailing\_id should possibly be marked as mandatory for this API. If so, please raise a bug report

Civi was working yesterday. Some reports have been run since then but nothing else. I'm on 4.6.22 for Drupal. Any thoughts on how I can fix this bug?

# Answer
I needed toL

> drush cc civicrm.

* clearing Civi cash via ui did not work
* drush cc all did not work

many thanks to Christia: https://civicrm.stackexchange.com/a/19237
> 2 votes

---
Tags: civimail, error
---


# Question
Title: Crons are running but System Status is No cron runs have been recorded
Hosted (Linux) website on SiteGround + Joomla + CiviCRM

## Versions

PHP 7.0.29; Joomla! 3.8.6; CiviCRM 4.7.31

Scheduled jobs are administered as documented Calling cron.php with curl

Cron jobs are running. One example:

CiviCRM System Status page reports Cron not running,

Why this post?

There are several similar questions being posted without clear answers. Support from hosting company is limited at this time on this issue. No hints in the CiviCRM documentation. I hope to get support from CiviCRM community.

My question: Why cron runs "are not being recorded"?

# Answer
> 1 votes
Did you check if the cron run is recorded if you call that url manually? That way you eliminate the possibility of having a typo in the url or an invalid site key.

Some steps you could follow:

1. is 'curl' installed on the server that executes the cron run?
2. in the access log of your webserver, do you see the url being called?https://example.org/administrator/components/com\_civicrm/civicrm/bin/cron.php
3. when executing the command from a terminal, do you see an error, for example about an incorrect site-key?
4. do you see an error message in the website log? (I don't know where Joomla stores messages, in Drupal there is the Watchdog log)

---
Tags: joomla, cron-job, cron, scheduled-job, status
---


# Question
Title: Primary Emails not Being seen as primary
I have an a bunch of organizations we imported via csv. The email addresses are checked under the contacts summary as 'primary'. However they are not receiving emails and reminders and in search results no email is showing. If I go into the record and click on the email section and then click 'save' the email is then seen as primary.

I am wondering if there is a way to fix this in bulk. It's not that many records (approximately 200-300). Any suggestions would be great.

CiviCRM 4.7.27 with WordPress 4.9.5

Thanks

# Answer
> 3 votes
I found a solution to this using the 'Update Multiple Contacts' feature. Here are the details:

* I created a profile to be used for search views that contained the Org name and Email (main).
* From search results I selected the Org that the primary email was not showing and selected 'Update Multiple Contacts' from the action menu.
* I selected my newly created profile for updating email.
* When the update screen loaded I just hit the update button and this updated the main emails to be primary.

Since this was a relatively small amount of records this solution was manageable. Probably not the best solution for a larger amount of records.

---
Tags: contacts, email, import
---


title: Civi Updating, 5.0

text:
# Question
Title: Civi Updating, 5.0
I tried to work on my database when I got a DB Error: no such field. I can't access my contacts at all. I can search for them, they appear and everything else works. I looked up the error and I found out that I should update civi. I followed the instructions from https://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Wordpress#UpgradingCiviCRMforWordPress-4.RuntheUpgradescript .

But after following all the steps and putting in the update URL I still get an error saying that I have already upgraded to version 4.7.17. I don't understand what is going on. Can anyone help? I know that the guide is for 4.7+ but I am not sure if that applies for 5.0 too.

# Answer
Apparently the people before me who was using the website had the files on another server and gave me a different server credentials. Thank you all who took the time to try and help I am sorry for the weird question.
> 5 votes

---
Tags: wordpress, upgrade
---


# Question
Title: https://docs.civicrm.org/dev/en/latest/framework/ajax/
I would like to open a modal with options editor inside (please see the screenshot below). I would like to call a custom JavaScript function whenever an option has been changed via that modal. By "changed" I mean added, renamed, deleted, disabled, reordered etc.

As per https://docs.civicrm.org/dev/en/latest/framework/ajax/ there are a couple of events related to dialogue forms that you can track, including `crmFormSuccess`. This event will fire on the label change, or new element addition, but not on the enabling/disabling or reordering.

The code snippet:

```
CRM.loadForm('/civicrm/admin/options/individual_suffix?reset=1')
  .on('crmFormSuccess', () => {
    // will not trigger on reordering or enabling/disabling
    console.log('Updated...');
  });

```

Is there a similar event to handle these events as well?

# Answer
> 2 votes
`crmLoad` is triggered on every action. Try:

```
CRM.$(document).on('crmLoad', function(e, data) {
    console.log(data);
})

```

# Answer
> 1 votes
I'm new here so I'm not sure what protocol to follow to explain 1) how to receive notifications from CiviCRM for the events shown in your screenshot of the CiviCRM Admin panel and 2) what you mean when, in terms of code, when you ask if there is a 'neat' way. In both Drupal, and by extension, CiviCRM there is More Than One Way to Do It.

Next, it's not clear from your questions whether you are looking for a "client-side" way to steer the page events to a handler you have written or you are trying to do something on the server side of things. I presume you already know how to capture and steer page events on the client side from jQuery.

Be advised, if you follow the link in your question, it states very clearly that *"Normally, (aka nothing) on the server side needs to be done... to make a standard CiviCRM quickform/smarty page work with these helpers."*

And the page continues to read as follows: *" If the client-side script requires more information, simply add to $this-\>ajaxReponse(array (automatically available to all classes that extend CRM\_Core\_Page or CRM\_Core\_Form). "*

That said, the best way anyone can really help you is to know what you are attempting to do that is not explained on that web page.

Could you please write back and tell everyone what you are attempting to do and we can try to help you with a specific answer?

> > > > A bit more of a reply to your question

I dug a bit deeper into the links in your posted question. While I think I understand a bit better what you are asking, here is a summary of what I understand which you can reply as being "correct" or not.

1. You want to capture the page change event (personal contributions campaign page) for the object highlighted in green
2. You want to add a client-side event handler to the CiviCRM page generated element for the green highlighted event.
3. Your client-side event handler want to know which "selector" on the personal contributions campaign page it should use to attach the event handler to. Is that the answer you are looking for?

As a start on finding the right selector to hook your "onChange" event to, I suggest you:

1. Open the page in your Chrome web browser.
2. Open Dev Tools once you have the Personal Contribution page open in the browser
3. Position your cursor (Hover) on the page element in the PCC page Look at the Dev Tools panel and it should display the HTML selector for that element.

# Answer
> -1 votes
Ok, Just so I am clear on what you want. Your new question is:

You want to:

1). "Filter" using JavaScipt "ALL" the events on the CiviCRM Personal Contributions Page and

2) Set "handlers" to respond to "Onchange" events only when the users toggle the "Enable" and "Disable" elements on the PCC page?

Is that correct?

---
Tags: civievent, ajax, option
---


# Question
Title: Membership Details Report doubt about Grouping
In the Membership Detail Report there is the tab 'Grouping'. Is this tab really necessary?

Every membership has an unique id so it doesn't seems logic to group by this field.

I did some test in my civicrm and in dmaster and in both sites the results were the same whether or not the grouping field was selected.

So, it is useful? Or I'm mistaking something?

# Answer
> 1 votes
I think it would only make a difference if you have multi-value custom fields attached to your contact & included in the report

---
Tags: civimember, civireport
---


# Question
Title: Search view profile to show only the primary phone number
Is there a way to set up a search view profile so that it shows the primary phone number for a contact regardless of what type of phone it is? When setting up this profile, I am required to indicate a type of phone. I want to be able to see results that show the primary phone regardless of type. Thanks.

We are using version 4.7.24

# Answer
> 2 votes
Ideally, there should be an option with the label `-any-` in the above select input. But as it is not present, I don't think there is any UI setting to accept all phone type values for the profile field.

Maybe, you can try API to trigger this (`Support -> Developer -> API Explorer`) OR `http://domainname/civicrm/api#explorer`.

Select Entity as `UFField` and action as `create` and form the API something like -

```
$result = civicrm_api3('UFField', 'create', array(
  'id' => <uf_field_id>,
  'field_name' => "phone",
  'phone_type_id' => 0,
));

```

The first param is the `uf_field_id` which is the id of the profile field created in your screenshot.

If you don't find the id, you can check by placing your cursor on the `Edit` link on the field row displayed for your profile. The URL will be shown on the bottom left of your browser. For eg: in the screenshot below 75 is the value of the field id.

---
Tags: contact-view, phone, primary
---


title: Multi-value custom fields for events

text:
# Question
Title: Multi-value custom fields for events
I have events that often include downloadable materials. Whether or not there are downloads, what exactly they are, and the number of downloads related to a particular event is variable and unique to each event. Right now I have to add download links to the body of the event description.

This is a situation that would be perfectly handled by a multi-value custom dataset attached to the event, but alas, as far as I can tell you can't yet add multi-value datasets to events. Anyone know of a plugin, work-around, patch, or even a plan to change the functionality in the near future?

# Answer
> 2 votes
Multi-Value custom dataset is only available for Contacts and Contact Type custom fields. But i believe it is possible to make it available for Events by creating an extension and adding code using hooks to hack the current behaviour in CiviCRM. I am not sure if anyone has a plan or willing to add this functionality in future version of CiviCRM.

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


title: Internal links in a Mosaico template?

text:
# Question
Title: Internal links in a Mosaico template?
Using CiviCRM 4.7.22.

My customer wants to have internal links in the newsletter template. They could do this in the 'old' CiviMail editor using the flag symbol.

It is not obvious to me if the same functionality is available in Mosaico and if so, how to achieve this?

# Answer
By "internal links" do you mean anchor links? A link that would go to another spot in the email? If this is the case, it might be answered here: How can I set up anchors in Mosaico mailing?
> 1 votes

---
Tags: mosaico
---


# Question
Title: Why are my simple donate pages throwing an error?
I am using latest Simple Donate on D7 with Civicrm 4.7.29. I get this error when I go to the contribution page configured for Simple Donate:

Warning: implode(): Invalid arguments passed in CRM\_SimpleDonate\_Page\_SimpleDonationPage-\>browse() (line 71 of /home/lifechallengesem/public\_html/data/sites/default/files/civicrm/ext/com.webaccessglobal.simpledonate-2.0/CRM/SimpleDonate/Page/SimpleDonationPage.php).

any help troublshooting would be greatly appreciated!

# Answer
Looking at the extension code it seems to me that the Simple Donate pages are not set properly in settings table. Can you please re-save the Simple donate page setting by navigating to Administer \>\> CiviContribute \>\> Simple Donate Configuration ?
> 3 votes

---
Tags: civicontribute, simple-donate-form
---


title: opt-in to receive updates

text:
# Question
Title: opt-in to receive updates
We all know GDPR is coming. I currently use drupal webforms with civicrm processing enabled. I use the privacy option to allow people to tick a box to opt out of receiving email update eg the person fills out a survey but doesn't want to be contacted, they can tick the box and it fills out the user opted out box on their record.

With GDPR this will be the wrong way round. I have to ask the user to tick a box to stay in. Obviously I can do this by creating a custom field and then unsubscibing those that don't, however I'm keen to do this automatically. I am aware there is a new extension being developed by Veda Consulting ( :) ) however it doesn't look like this deals with this? For clarity I am looking for general opt in rather than group opt in.

How are other people planning to deal with this? Am I missing something obvious in drupal webform?

Thank you!

Caroline

# Answer
> 3 votes
Sounds like you have an unusual use-case where you are in the habit of sending emails to every contact in your database. More typical uses of CiviCRM involve sending mailings to one or more *groups* of contacts. The Webform-CiviCRM module accommodates this nicely - add the Groups field to your webform (e.g. user-select) and then edit that webform field to only show the group(s) that are relevant to receiving mailings. Each group will appear as a checkbox on the form. After submitting the form, if the user selects a mailing group they will receive an email confirmation; they will not be considered as part of the group until they confirm by email. This is called "double opt-in" and is consistent with most anti-spam laws.

There is no setting in Webforms to control this behavior, the settings are in CiviCRM. To ensure your group subscriptions get double-opt-in, do the following:

1. Make sure it is considered a mailing group by CiviCRM (go to *Manage Groups* screen to confirm this).
2. Go to *Administer -\> CiviMail -\> CiviMail* Component Settings and make sure the first option on that screen "Enable Double Opt-in for Profile Group(s) field" is enabled.

# Answer
> 3 votes
The latest version of the GDPR extension takes care of this. It has its own communication preferences page which presents the options the right way around whilst updating the existing CiviCRM fields. You could probably use that to better effect as it also includes group subscriptions, data policy and possible profile updates on the same page.

---
Tags: privacy, gdpr
---


# Question
Title: Finding the status of a recurring contribution
I am setting up a website using CiviContribute whereby recurring donations can be set up. Everything seems to be working - I can see the contributions when I go to Contributions -\> Find Contribution:

and in the report:

However, when I cancel the subscription in PayPal that information isn't reflected when viewing the Contribution. The only way I can see this information is by going to Contributions -\> Contribution Reports -\> Recurring Contributions.

but the contribution screen doesn't change

This doesn't seem to be very intuative, so I was wondering if I had missed something?

Thanks

# Answer
> 2 votes
If you look at someones Contribution Tab (rather the Contribution itself) then down at the bottom, below the list of any Contributions, there should be rows showing any Recurring Contribution. This should show you the status of the Recurring payment.

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


title: Contact field, DB Error: no such field

text:
# Question
Title: Contact field, DB Error: no such field
So I just updated CiviCRM to 5.0 and I keep getting the error DB Error: no such field when I try and view/edit a contact. It doesn't allow me to view any contact but I can search and find my contacts. I am not sure what is going on but this happened even before I upgraded Civi and it was 4.7.

# Answer
I found out that it was a bad custom field in my data set, when I disabled the set I can view my contacts. Thank you everyone who helped me with this.
> 4 votes

---
Tags: wordpress, contacts
---


title: how to import extension to civicrm

text:
# Question
Title: how to import extension to civicrm
I would like to create an extension with civicrm. But I have a problem, although I could install civicrm and civix, I can not have where is the source code of the civicrm platform. I go to the directory/var/www/ and I see no repertory civic, for when I run localhost:8080/ in my browser it displays the platform. For both the documentation we ask to put the directory of the extension to the root of the civic project for this to be taken into account. I create an extension with civix with the following command: civix generate: module com.example.myextension --license = AGPL-3.0. I did a hello world but I do not know how to see the hello appears on the platform. in fact I am going in: administration\> system setting\> extension but I do not see how to import my extension into the platform

# Answer
> 2 votes
> in fact I am going in: administration\> system setting\> extension

With the above, I think you are able to access CiviCRM on the site. To see the extension in the `administration> system setting> extension` path, make sure you run the civix command in the extension directory, i.e -

1. Navigate to `Administer -> System Setting -> Directories`. Check the value of `Extensions Directory` input. This is where all your extension should be placed in.
2. Run the `civix` command from the terminal in the extension directory.
3. After the command runs successfully - you should be able to see your extension listed in `Administer -> System Setting -> Extensions` path.

> I did a hello world but I do not know how to see the hello appears on the platform

You need to check how we can use extensions to extend the functionalities provided by CiviCRM. Check different hooks that can be used in `extension_name.php` file to add/modify results on the screen.

---
Tags: civix
---


# Question
Title: payment-processor for multiple (bulk) memberships
I am trying to create a form to renew dues for multiple members at once. We do dues by member organization and not the individual.

I have a form working to do that, but need a way to bulk pay. I can't seem to figure out a API call to create a payment using a processor that doesn't create a contribution for the whole payment, since that is already being recorded at a individual level.

Does any one know if there is a CiviCRM native way to do this, or am I going to to have to write custom paypal code for this?

# Answer
A couple of thoughts:

1. The data model where Payment is recorded from a Different Contact in CiviCRM (for Membership payments) does indeed exist natively in CiviCRM. You can use this to record a Payment From the Organization.

2. The data model where if an Membership Organization has acquired a Membership -\> Memberships can filter down to a specific number of Individuals who have a current/specific relationship with that Organization also exists natively in CiviCRM.

3. The data model where the Contribution is recorded at an Individual level and subsequently the Organization is also invoiced for it - that's highly unusual as it will lead to double financial records. If the Organization is paying for the Membership but the Individual is paying/perhaps this would be a reimbursement from the Organization to the Individual?
4. (preface - love Webform CiviCRM module) - if you're on Drupal - you can have a single Organization purchase memberships for any number of Individuals on one page; The monies will be recorded in that Organization's Contact Record - all Individuals will get Memberships; Add in Soft-Credits for bonus points.
> 0 votes

---
Tags: civimember, webform-civicrm, payment-processor
---


# Question
Title: Error trying to upload an image in civimail on wordpress
We are getting a "Failed to write file" error popup when attempting to upload an image in civimail using KCfinder. This worked until about a month ago, and I don't what has changed. The files in the ~/wordpress/wp-content/plugins/files/civicrm/persist/contribute/images folder are visible in KCfinder, and can be inserted into the email. When I manually copy new image files into that directory, they appear in KCfinder and can be used. The permissions on the directory are 775, the images have 644, and the file ownership is correct. So I don't see anything wrong with any of that. Any ideas? This is on PHP 7.0.28, WP 4.9.5, Civicrm 4.7.30.

# Answer
Found the answer so I will post it here to help others. The server /tmp space filled up due to a rogue imagemagick process, so Civimail could not upload new images. This is a known issue with imagemagick - see for example this post. Deleting /tmp/magick-\* files solved the problem.
> 2 votes

---
Tags: wordpress, civimail, kcfinder
---


# Question
Title: DataTables warning on Find and Merge page - Upgraded to 5.0 from 4.7.17
I'm Running Civi 5.0.0 with Wordpress 4.9.5

I'm looking to troubleshoot the following warning. It comes up on the *Find and Merge* page after select any of my Find and Merge rules - no results are shown despite duplicate contacts existing,

> DataTables warning: table id=dupePairs - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

ajax "response" in Chrome's tab shows what looks like the page's html file - I have no idea where to search for the actual ajax:

No error is recorded in Civi's log.

It looks and sounds a lot like this bug. Which is odd because I assume it would have fixed when upgrading to Civi 5.0

This staging site was running 4.7.17 until I updated to 5.0 (I had to manually create the columns card\_type, and pan\_truncation in the civicrm\_financial\_trxn table to complete the update).

Looking at the github patch, my dedupefind.tpl *appears* to contain the patched lines. Is there a part of the patch I'm missing via the WP copy or something else?

# Answer
I've taken a look at this & a patch should be out next week (I'm expecting that to mean we will release 5.0.1 - the flexibility to do that being the main motivation for the renumbering)
> 2 votes

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


# Question
Title: Wordpress Multisite and CiviCRM with multiple databases
I know that it's possible to have CiviCRM shared across multisite Wordpress, and for a single database to operate in a way that keeps different site's data separately.

I'd like to do something superficially simpler, but which I can't find any mention of anywhere.

I'd like two sites in a multisite install to use the same CiviCRM codebase, but completely separate databases. To my mind, I just don't want to the two website's data mixed together, even if they are kept separate from a user perspective.

Could this be as simple as a PHP switch in the config file which says (psuedocode) ...?

```
 If Website A:
      Use Database A
 Else:
      Use Database B

```

But I realise that with logs and Smarty cache files it might be more complicated than that ...

# Answer
> 2 votes
Well, the answer appears to be 'Yes, it is (almost) that simple'.

The one wrinkle is that you first need to trick CiviCRM into thinking it has not already been installed on another Wordpress network site by moving civicrm.settings.php to an out of the way location.

So, do this:

1. Move your old civicrm.settings.php file somewhere safe.
2. Create a new empty MySQL database.
3. Go to the Wordpress site where you intend to create the new CiviCRM instance and activate the CiviCRM plugin.
4. CiviCRM will go through the process of installing CiviCRM to the blank database.
5. A new civicrm.settings.php file will have been created probably in a path like: /path/to/wordpress/wp-content/uploads/sites/2/civicrm/civicrm.settings.php
6. Restore your old civicrm.settings.php to its original location (in my case this was in /path/to/wordpress/wp-content/plugins/civicrm/ because it's an older install).

The 'old' settings file was edited something like this:

```
<?php

$site = $_SERVER['SERVER_NAME'] == 'newsite.com' ? 'new' : 'default';

if ($site != 'default'):
    include_once('/path/to/wordpress/wp-content/uploads/sites/2/civicrm/civicrm.settings.php');
else:
    /*The contents of the old original settings file goes here.*/
endif;

?>

```

---
Tags: wordpress, configuration, multisite
---


# Question
Title: Check Payment processor is not working for CIVIEVENT
I am having an issue with my Check Payment Processor. I am trying to setup the Check Payment method as a default payment processor for the registration of my events.

I have set only check as a payment processor. There is no other payment processor added yet. But when I try to register myself for the event, it asks me to add the credit/debit card option for the billing.

I have also set check payment as a default payment option.

Thanks in advance.

# Answer
If you need the payment through "Cheque" you don't need to enable payment processor -

All you need is to enable "is pay later" option in your event config page - Payment processor are used only when you do online payment using credit or debit cards.

So, disable your payment processor and select "is pay later" option and then give a try - that should work correctly

Refer: https://docs.civicrm.org/user/en/latest/events/creating-an-event/

I guess this helps !!!
> 3 votes

---
Tags: civievent, payment-processor, registration, payment
---


# Question
Title: Credit card fields do not show after updating
I upgraded to CiviCRM 5.0.0 on Friday and our contribution pages do not show the credit card fields any more. I have attempted to re-save the contribution pages and payment processor information. When I try to edit the payment processor, I get the following page. I am not sure what else to try, thank you.

# Answer
I needed to delete everything inside the `sites/default/files/civicrm/templates_c/` directory;

`rm -R sites/default/files/civicrm/templates_c/*`
> 7 votes

---
Tags: drupal, payment-processor, contribution-page
---


title: How to get CiviCRM root via PHP?

text:
# Question
Title: How to get CiviCRM root via PHP?
I'm working on an extension and I need to include a PHP file that is in the civicrm module root dir. Is there a way to get this directory through PHP? I need it to work for all CMS, not just Drupal.

Thanks!

# Answer
I found the answer in the docs here: https://docs.civicrm.org/dev/en/latest/framework/filesystem/#tip-programmatic-lookup\_1

You can use the following:

```
Civi::paths()->getPath("[civicrm.root]/.")

```

or

```
global $civicrm_root;

```
> 4 votes

---
Tags: php
---


title: Integrating Civicrm in Laravel Package

text:
# Question
Title: Integrating Civicrm in Laravel Package
I have been learning Civicrm for something now. Now that I am familiar with the whole idea, I would like to integrate Civicrm in Laravel package.

I understand its not going to be an easy task, that's why I need your input, suggestions and a point to the right direction.

What should I really focus on? Should I simply create an API wrapper that interacts with the database with a fancy theme?

What steps should I take?

# Answer
I don't know much at all about Laravel, but from this:

> one conclusion I would draw from that is that Laravel is probably best to use as a front-end framework, which does not require complex data store functionality. It is perfectly suited to be a service layer with its integration to Iron.io and other popular SaaS providers (AWS, S3, sendgrid, etc.), Laravel provides a simple way to build and consume API’s THE GREAT PHP MVC FRAMEWORK SHOWDOWN OF 2016

I would suggest starting by creating a wrapper for CiviCRM's extensive API. Version 3 is quite mature, version 4 is a new initiative that will eliminate some of the cruft that has developed in v3 but isn't yet covering as much as v3. FWIW, CiviCRM 5.0 is going to more thoroughly integrate various parts of Symfony 2, and we're aspiring to support progressive decoupling / headless sites that are implemented using a browser based MVC like Angular.
> 2 votes

# Answer
I have published a quick Laravel package that can help building the API3 integration... it also has a lot of documentation that is not easy to find in the Civi world...

Take a look... contribute...

https://github.com/leanwebstart/civi-api3

Also on pakagist... leanwebstart/civi-api3

Hope this helps someone...
> 2 votes

---
Tags: api, integration
---


# Question
Title: Assigning multiple participant roles in civi event, through imports
I would like to assign multiple roles to event participants through imports. I can upload a csv to assign a user role, but if I import a second data source with a different role, it is set aside as a duplicate and not imported. I would like the second role to be added to the existing record (not to be overwritten).

For instance I have a list of auction event participants who are attendees, donors and/or buyers. My lists have overlapping contacts. I would like to keep these all associated with the event, rather than creating groups or tags. Handling the overlaps manually is not practical.

# Answer
The value for all Role data is stored in a single field so I think however you tackle this you are at risk of overwriting existing Roles. Here is one process that at least makes existing Role values visible so you won't overwrite them accidentally.

Create a Profile for updating Participants that includes the Import your Contact IDs and add them to a Group

Use Adv Search to find those Contacts but set the search "Display Results As" to be Participants.

Select the records you want to update - under Actions choose Update multiple participants - select the Profile you created above - this should then give you a batch updates screen where each Role is shown as a checkbox
> 0 votes

---
Tags: civievent, roles, data-import
---


title: Remove Prefix from Addressee

text:
# Question
Title: Remove Prefix from Addressee
We are on Civi 4.7.29 and Wordpress 4.9.5

We are making badges for the upcoming conference. We need just the First and Last name to show up on the same line, such as: John Doe. However, when we select to use the Addressee short code, it shows up as Mr. John Doe. We really don't want the Mr. part in there as many of our members did not choose a prefix when they signed up and that will look wrong.
If we choose to use the First and Last name shortcodes separately , we get:

John

Doe

That won't work either. Is there a way we can remove the Prefix from the Addressee shortcode?

Thank you

# Answer
You might try the display\_name short code (assuming it exists as I do not use WP mysqlf)? You can control the way the display name is built in Administer\>Customize Data and Screens\>Display Preferences.

Alternatively you can set customized addressees for your contacts? That is a lot of work if you have to do it manually but you could also create a scheduleld job to do this with the API if you have any development skills available?

If you want to make sure the prefix is not in the display name you change the settings for display name. Standard they will probably be:

```
{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}

```

Change into

```
{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}

```
> 4 votes

---
Tags: civievent, addresses
---


title: Laravel package to access CiviCRM API3

text:
# Question
Title: Laravel package to access CiviCRM API3
How do you integrate CiviCRM API3 with Laravel?

I put this question here to link the package I created for this as I wished I would have found more info on the API while searching here.

See my answer below

# Answer
> 1 votes
2 down vote I have published a quick Laravel package that can help building the API3 integration... it also has a lot of documentation that is not easy to find in the Civi world...

Take a look... contribute...

https://github.com/leanwebstart/civi-api3

Also on pakagist... leanwebstart/civi-api3

Hope this helps someone...

---
Tags: api, integration
---


title: Unhandled Error when adding new Case

text:
# Question
Title: Unhandled Error when adding new Case
Using Joomla 3.8.6, CiviCRM 5.0.0, php 7.0.29, mysql 5.6.39

The following error has occurred since upgrading to 5.0.0.

When adding a new case, I enter the minimum field data and click Save, and the window hangs, with the rotating CiviCRM symbol gif. There is an entry in the CiviCRM log, but it is so huge that I have not been able to make any sense of it. The log entry is about 3Mb big.

There is also an error in the Apache log:
File does not exist: .../media/fef/js/tabs.min.map

And this is what I'm seeing in the browser console:

POST https://...../administrator/?option=com\_civicrm&task=civicrm/case/add&action=add&context=case&cid=30&snippet=json
500 (Internal Server Error)
send @ jquery.js?r=2i4CQ:10254
ajax @ jquery.js?r=2i4CQ:9738
fileUploadXhr @ jquery.form.js?r=2i4CQ:346
$.fn.ajaxSubmit @ jquery.form.js?r=2i4CQ:254
doAjaxSubmit @ jquery.form.js?r=2i4CQ:890
dispatch @ jquery.js?r=2i4CQ:5226
elemData.handle @ jquery.js?r=2i4CQ:4878
click @ crm.ajax.js?r=2i4CQ:466
(anonymous) @ jquery-ui.js?r=2i4CQ:12443
dispatch @ jquery.js?r=2i4CQ:5226
elemData.handle @ jquery.js?r=2i4CQ:4878

# Answer
> 3 votes
This isn't a direct answer to the problem but definitely helps with accessing the log errors to help further diagnosis.

The excellent Log Viewer extension gives UI access to your logs.

---
Tags: civicase
---


# Question
Title: How to resolve "Call to undefined function" after upgrade to 4.7.27 CRM_Core_SelectValues::datePluginToPHPFormats()
We have just upgraded WP to 4.8.3 and Civi to 4.7.27, now getting the following error from one of our extensions:-

> Call to undefined method CRM\_Core\_SelectValues::datePluginToPHPFormats()

The offending code snippet is below:-

```
protected function getFormattedFieldValue($value, $field) {
if ($field['data_type'] == 'Date' && !empty($value)) {

```

> ```
> $actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
>
> ```

```
  $dateFormat = (array) CRM_Utils_Array::value($field['date_format'], $actualPHPFormats);
  $value = CRM_Utils_Date::processDate($value, NULL, FALSE, implode(" ", $dateFormat));
} elseif (!empty($field['option_group_id']) && $value) {
  try {
    $value = civicrm_api3('OptionValue', 'getvalue', array(
      'return' => 'label',
      'option_group_id' => $field['option_group_id'],
      'value' => $value,
    ));
  } catch (Exception $e) {
    throw $e;
  }
}
return $value;

```

}

Any ideas how I can correct this code? I can't find the function in the docs: https://doc.symbiotic.coop/dev/civicrm/v47/phpdoc/CRM\_Core\_SelectValues.html

Thank you!

# Answer
After searching on Jira for the funciton, nothing came up, so searched the codebase from our backup and found the function was in the file: civicrm/civicrm/CRM/Utils/Date.php:1788

It's now gone, along with a lot of other ones!

So I've added the array of date formats to the code to workaround the issue.

```
//$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
  $actualPHPFormats = array(
    "mm/dd/yy" => 'm/d/Y',
    "dd/mm/yy" => 'd/m/Y',
    "yy-mm-dd" => 'Y-m-d',
    "dd-mm-yy" => 'd-m-Y',
    "dd.mm.yy" => 'd.m.Y',
    "M d" => 'M j',
    "M d, yy" => 'M j, Y',
    "d M yy" => 'j M Y',
    "MM d, yy" => 'F j, Y',
    "d MM yy" => 'j F Y',
    "DD, d MM yy" => 'l, j F Y',
    "mm/dd" => 'm/d',
    "dd-mm" => 'd-m',
    "yy-mm" => 'Y-m',
    "M yy" => 'M Y',
    "M Y" => 'M Y',
    "yy" => 'Y',
  );

```
> 1 votes

# Answer
I can't find that function in the latest release so it seems to be fixed since 4.7.27 (latest is 5.0.0)
> 0 votes

---
Tags: extension, 4.7.27
---


# Question
Title: Address field order on Contact's "edit" page
How can I change the order of the address' fields on the page where I can edit the conatct's details?

Now I see the fields city, than postal code, than country, but I'd like to have postal code first, than city, and than country.

In the Address.tpl file is only so much:

```
{foreach item=addressElement from=$addressSequence}
     {include file=CRM/Contact/Form/Edit/Address/$addressElement.tpl}

```

How can I edit `$addressSequence`?

Thanks.

# Answer
I think you will have a significantly easier time just reordering the fields with a little jQuery in a custom version of the template you referenced above.

For completeness... You can see the sequence function here: https://github.com/civicrm/civicrm-core/blob/5dde2c09c10513a22464e8c4abcb6b4ca17fc1cb/CRM/Utils/Address.php#L288
> 1 votes

# Answer
\[This doesn't answer your question, but may be useful anyway\]

You can change the order of address fields used for *displaying* the address at `Administer > Localization > Address Settings` and change the `Address Display` section.

If you want to change which address fields are available for *editing* then see the `Address Editing` section of the same page. But that does not let you determine the order of fields when editing.
> 0 votes

---
Tags: addresses
---


# Question
Title: How can I setup a Manage Magazine Subscriptions in CiviMember
I'm new to this CiviCRM and it looks great so far. We are looking to using it in out Magazines. But we need the functions as per blog below. How can we do this? thanks.

https://civicrm.org/blog/johnd/civicrm-manage-magazine-subscriptions

Sorry guys, I did not explain it clearly. Basically We have a lot of magazines published every two months. The way we determine what magazine our subscribers can get is by issue number. For example if a subscriber is entitled 1 year of magazine, we will tag him as issue 110-115 (via custom fields). Now, the problem is these issue numbers are associated with a month and year of publish.

Wow! I'm impress to this community!. Thanks for the help!

# Answer
we (Fuzion) worked with John Derry when getting The Monthly going as a Sub on CiviCRM. There was a lot of nuances they needed particularly involving ensuring that Gift Sub reminders went to the original Giftor etc, etc. I think that since that time they have had internal resources to further finesse their subs process in ways that I cannot explain, but potentially someone at The Monthly could.

But in essence yes you can treat a Subscription as a Membership.

If you detail out really clearly what the exact specs are you need then folk may be able to volunarily help you assess how to achieve this in CiviCRM or you can reach out to one of the Partners for professional advise and support (and customisations/extensions if required).

NOTE: The OP referred to Joomla, for readers who are using Drupal CMS, there are also significant workarounds that can be achieved with either Drupal Webforms or with CiviCRM Entity in terms of finessing the subscription process for the user.

Hope that helps
> 1 votes

---
Tags: civimember, joomla, developer
---


# Question
Title: Custom date field formatting with smarty
I'm trying to format a custom date field using smarty to send emails. What I want is to have the day of the week included, as "Wednesday, April 18, 2018". It seems that this should work:

```
{contact.custom_105|date_format:"%A, %B %e, %Y"}

```

But the mail send hangs. Also hangs if I just use

```
{contact.custom_105|date_format}

```

I can use {contact.custom\_105} to send the preformatted date "03/01/2018 3:15AM", so I know I'm working with the correct field.

How can I get this formatted as I want?

# Answer
> 5 votes
Found the answer. The civi field token must be captured to a Smarty variable first:

```
{capture assign=arr}{contact.custom_105}{/capture}{$arr|date_format:"%A, %B %e, %Y"}

```

---
Tags: custom-fields, smarty, dates
---


# Question
Title: Need to redirect when permission issue happened on CiviCRM Page
I have enabled and configured access for Contribution financial type. When an anonymous user open the a contribute page, it returns the error.

I need to redirect to login page in this case. I don't want to show error page to the user.

Please Help!

# Answer
> 2 votes
You can do this by specifying your custom Fatal Error Handler at `Administer -> System Settings -> Debugging and Error Handling`.

* Enter the name of the function eg `myCustomErrorHandler` for `Fatal Error Handler` input field.
* Define this function in one of the extension `.php` file. The param should hold the message of the error and if it matches the permission text msg, you can use redirect function to navigate to the login page. Eg.

```
function myCustomErrorHandler($params) {
  if ($params['message'] == 'error message') {
    CRM_Utils_System::redirect($urlyouwant);
  }
  return FALSE;
}

```
* Note the return statement in this function. `FALSE` is required to call the default error handler in case your function wasn't able to do the needful.
* `return TRUE;` will not call the default Error handler in CiviCRM.

# Answer
> 0 votes
In addition to jitendra's answer, check Drupal's CiviCRM permissions. Look for "CiviContribute: make online contributions" and make sure all roles, such as anonymous, are checked..

---
Tags: civicontribute, drupal, permissions
---


title: Setting up cron jobs on cPanel

text:
# Question
Title: Setting up cron jobs on cPanel
Need your help....I'm trying to setup cron jobs using the cli.php command given in the documentation....I'm able to run it directly through the terminal...but when I schedule it via cPanel its gives me an error 'cli.php can only be run from command line.'

# Answer
if your user has cron access, you can always create a file, call it cron for simplicity sake, in the file add the command you wish to run, for example mine is a bit interesting cause I have to export my civicrm settings at the same time:

```
export CIVICRM_SETTINGS="/home/domain/public_html/administrator/components/com_civicrm/civicrm.settings.php"
cv api --user=cron job.execute

```

mind you, thats using the CV command, however, this can still be implemented via the cli.php. Example:

```
 /path/to/php /path/to/civcrm/bin/cli.php \
  -s example.org \
  -u myusername \
  -p mypassword \
  -e Job \
  -a execute

```

save that in the file you created earlier (with your changes of course), then with cpanels cron, just set the command/job to execute:

```
sh cron > /dev/null

```

or

```
sh cron > /home/domain/logs/cron.log

```

just make sure the file is outside of the web folder and is executable.
> 1 votes

---
Tags: cron, cli
---