# Question
Title: How to access the APIv3 from wordpress plugin files
I'm developing a little wordpress plugin which creates a custom post type with a custom field where I **would like to store an ID of one of the active contribution page of CiviCRM** in order to associate this content with the contribution page information.

This very same code works in theme files but fails when is used in plugin files, breaking the site.

```
   function get_contribution_info($f_type){
   $params = array(
       'version'    =>  3,
        'financial_type_id' => $f_type,
        'is_active' => '1'
    );
    try{
       $result = civicrm_api3('contribution_page', 'get', $params);
    } catch (CiviCRM_API3_Exception $e) {
        // handle error here
        $errorMessage = $e->getMessage();
        $errorCode = $e->getErrorCode();
        $errorData = $e->getExtraParams();
        return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
    }
    return $result[values];
    }

    $get_contrib = get_contribution_data( '1' );
    $contributions = array();
    $i = 0;
    foreach($get_contrib as $c) {
        $contributions[$i]['label'] = $c['title'];
        $contributions[$i]['value'] = $c['id'];
        $i++;
    }

```

I've tried to add a `require_once` the `class.api.php` without positive results.

Thanks in advance for your help!

# Answer
Try prefixing your API call with:

```
civicrm_initialize();

```

The "class.api.php" is for when you want to use the REST API from an external site.
> 4 votes

# Answer
Solved!!!

```
   function get_contribution_info($f_type){

   $params = array(
       'version'    =>  3,
       'financial_type_id' => $f_type,
       'is_active' => '1'
   );
   try{
       if ( ! function_exists( 'civicrm_initialize' ) ) { return; }
       civicrm_initialize();
       $result = civicrm_api3('contribution_page', 'get', $params);
   } catch (CiviCRM_API3_Exception $e) {
       // handle error here
       $errorMessage = $e->getMessage();
       $errorCode = $e->getErrorCode();
       $errorData = $e->getExtraParams();
       return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
    }
   return $result[values];
}

```

**The key was on adding `civicrm_initialize();`**. Thanks to *@bgm* for the advice!
> 2 votes

---
Tags: civicontribute, wordpress, api
---


# Question
Title: Since Drupal 7.4x I am unable to upload/browse images in civicrm
kcfinder is not allowing me to browse or upload images. I get this error:

Sorry but we are not able to provide this at the moment. You must be logged in with proper permissions to edit, add, or delete uploaded images.

I am logged in as User 1. It seems that kcfinder does not know that I am logged in.

# Answer
It turned out that our was a permission issue. I'm on Pantheon so I want able to change the permissions on the directory I was using, so I changed directories for uploads and it worked
> 2 votes

# Answer
you need to create a settings.localtion.php file in your civicrm directory

then have

define('CIVICRM\_CONFDIR', 'directory where civicrm.settings.php is');
> 1 votes

---
Tags: kcfinder
---


title: Contribution view / edit error

text:
# Question
Title: Contribution view / edit error
When I go to Contributions and click "View", I always got an error "*Erreur réseau. Impossible de joindre le serveur*" ("*Network error. Cannot join the server*" - in english).

I can't find any error in logs...

I run CiviCRM 4.6.6 under Wordpress 4.3.1. But got the same error with updated versions of both on another server.

Any idea ?

Thanks !

# Answer
> 0 votes
OK found. In my case an extension was causing trouble : CDNTaxReceipt. Disabling it solved the problem.

Thanks for you help

# Answer
> 2 votes
I suggest that you check that the Base URL in the CiviCRM settings file.

Look for CIVICRM\_UF\_BASEURL in civicrm.settings.php file.

See this similar question for more details: \**Network Error - Unable to reach the server

# Answer
> 2 votes
The root cause of this error is wrong civicrm base url. (Most of the time it's happen due to www in base url. If your url does not contain www the don't use it in civicrm base url.)

---
Tags: contributions, admin
---


# Question
Title: Pledge payment link does not point to a publicly accessible page
The reminder email for pledge payments includes a link that points to a page on the admin side of wordpress that requires a login. How can I change this setting in CiviPledge to point to a publicly accessible page?

Here's a sample of the link

In response to comments below:

1 - I am using the default message template for Payment Reminders.

2 - The Old/New Base URL in Settings - Cleanup Caches and Paths shows "https://lofcenter.org/"

3 - The civicrm.settings.php shows the following: if (!defined('CIVICRM\_UF\_BASEURL')) { define( 'CIVICRM\_UF\_BASEURL' , 'https://lofcenter.org/' );

# Answer
> 1 votes
*This answer is for how to change the template issuing the email in question. However, I don't know that the issue you're facing is due to the template. See other answer.*

The template for Pledge Payment Reminders is found in Communications or CiviMail's settings.

From the black menu bar:

> Administer \> Communications \> Message Templates

OR

> Administer \> CiviMail \> Message Templates

**On the Message Templates screen, click on the tab at the top for "System Workflow Messages." Scroll down and you should see an edit link for "Pledges - Payment Reminder."**

On that edit screen, you can make any changes you need including changing the link. Don't forget to make your changes in both the HTML Format and Plain-Text Format.

Before making your changes, I'd recommend copying and pasting the default template to a text document just to have it saved in case you need to revert back in the near future.

# Answer
> 1 votes
To summarize the issue to make sure I understand it:

Your example checksum link is as follows:

```
https://lofcenter.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1&cid=3305&pledgeId=5&cs=da386e473e8c85e6d2f948217cc28625_1451424231_168

```

The example Wordpress checksum link per Tokens on the CiviCRM wiki appears as:

```
http://www.myorganization.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=N&{contact.checksum}&cid={contact.contact_id}

```

If you are using the default message template for Payment Reminders (*please let us know as an Edit in your answer if it is somehow different*), here is the relevant template code with tokens:

```
{if $contribution_page_id}
     {capture assign=contributionUrl}{crmURL p='civicrm/contribute/transact' q="reset=1&id=`$contribution_page_id`&cid=`$contact.contact_id`&pledgeId=`$pledge_id`&cs=`$checksumValue`" a=true h=0}{/capture}
     <p><a href="{$contributionUrl}">{ts}Go to a web page where you can make your payment online{/ts}</a></p>
{else}
     <p>{ts}Please mail your payment to{/ts}: {$domain.address}</p>
{/if}

```

**So, the extra bit getting inserted into your `crmURL` token is: `wp-admin/admin.php`** The remainder of your checksum link seems to line up as it should.

Could you please verify (and report back as an Edit in your question):

1. What is listed for your Old and New Base URL on Administer \> System Settings \> Cleanup Caches and Update Paths?\
2. What your Base URL is listed as in your civicrm.settings.php file?

Per the Wordpress install instructions, Step 6, the civicrm.settings.php file is located here: `<wordpress>/wp-content/plugins/civicrm/civicrm.settings.php`

The relevant line will have something akin to: `define( 'CIVICRM_UF_BASEURL' , 'https://lofcenter.org/');`

# Answer
> 1 votes
I'm going to mark this as answered/fix because the latest batch of reminders did work. The link sent with the Pledge Payment reminder works as of today, here's a copy of the link that the crmURL shows, for an unknown reason it does not have the extra wp-admin/admin.php bit.

https://lofcenter.org/CiviCRM/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1&cid=3305&pledgeId=5&cs=c8321de782a6e8fb19ce9305f9a2ffe4\_1452834091\_336

---
Tags: wordpress, message-templates, civipledge
---


# Question
Title: 1 hour discrepancy between created_date field in MySQL and CiviCRM report output
I hope I have a strange, but straight forward issue -- there's a 1 hour offset SOMETIMES in the created\_date field in civicrm\_contact table, and what gets outputted in a CiviCRM report (see the attached images).

MySQL is set to use SYSTEM time as well as PHP - ie, and no timezone conflict.

Any suggestions would be greatly appreciated. We are using Drupal 7 + CiviCRM 4.6.

# Answer
In case anyone has the same version (4.6.7), this was the fix for our issue - Drupal timezone code does not handle UTC correctly - https://github.com/civicrm/civicrm-core/pull/6576
> 0 votes

# Answer
It's a timezone issue. Your database and drupal timezone must be same. Sometime it's happen due to Daylight saving time.
> 1 votes

---
Tags: drupal, civireport, mysql, timezone
---


# Question
Title: Scheduled job mail_report fails [500 error] when adding instanceId paramter
Our scheduled job for sending a report fails when adding an instanceId. It works when removing that parameter.

We are on the latest version of joomla and latest civicrm.

Thanks

# Answer
What format are you using for the parameter? It should be instanceId=12, for example. Any additional characters like quotation marks or brackets will cause it not to run. See: https://civicrm.stackexchange.com/a/8584/105
> 1 votes

---
Tags: joomla, scheduled-job
---


# Question
Title: Registrant and Contribution status remains "Partially Paid" even though amount owed was paid off
**STEPS:** 1. User buys tickets for an event (e.g. 2) - this is set up as a Price Set w/ a Text / Numeric Quantity price field
2. Later wants to buy more - CiviCRM admin goes to the contact record, locates the event and using Change Selections adjusts the number of tickets (e.g. 5)
3. This creates a Balance owed on the event registration and the status of the Registration and the Contribution changes to "Partially Paid"
4. The admin then processes an additional payment for the amount equal to the balance owed using the Record Payment link/function

**RESULT:**
Both the Event and the Contribution statuses remain "Partially Paid"

**EXPECTED:**
The Event Registration status should change to "Registered" and Contribution Status to "Completed"

*QUESTION:*
Do I have this right/wrong?

System: Joomla 3.4.8; CiviCRM 4.6.11
Reproduced on the Joomla demo site

Thanks a lot, P

# Answer
I think this may be resolved in 4.7 based on what I read in JIRA (there's a variety of tickets on payments topic so it's hard to tell whether one of them will solve this per se but it seems so). I'll test 4.7 and will come back to this topic if it's not solved. For now, I'll mark this as the answer.
> 0 votes

---
Tags: civievent, civicontribute, contributions
---


# Question
Title: Ignore Word Replacement on certain pages?
Is there any way to ignore word replacement for a particular page or event a particular label?

The replacement we're using applies to 99% of places so we'd like to keep using it.

# Answer
There are probably several ways to do it with an extension.

As an alternative, my guess is the following would be the simplest:
> 2 votes

---
Tags: civicrm-home
---


# Question
Title: Home page redirecting to event page on Wordpress
I'm running Wordpress 4.4.1 and CiviCRM 4.6.11

The main page of our site http://www.mltawa.asn.au is redirecting to an old event's page (http://mltawa.asn.au/2015-agm-registration/?page=CiviCRM&q=civicrm/event/info&reset=1&id=7). When I disable the event, it goes into a loop or, if logged in as admin, I get the pop-up message in the back-end:

> The event you requested is currently unavailable (contact the site administrator for assistance).

Ideas of where to start looking to fix this? :)

# Answer
Create an empty Wordpress page, name it what you want, for example "civi". Add that name to the "WordPress Base Page" in Administer - System Settings - CMS Database Integration.

For more info see: http://wiki.civicrm.org/confluence/display/CRMDOC/Displaying+Public+Forms+in+WordPress+Frontend+Sites

Does that work?
> 1 votes

---
Tags: wordpress
---


# Question
Title: contribute page for membership admin use only
I am using Civicrm 4.6 with Joomla! 2.5 I am looking to port our existing manual membership to civicrm. I have set up the membership categories and creating new memberships through the civicrm backend seems to work fine.

The charity will have two or three people who will administer memberships. I have created a Joomla user group and ACL for membership admin and added these users to the group. I have created a menu item which this ACL can access which is linked to a civicrm contribute page for individual membership renewal.

The issue that i have is that when one of the membership admin users logs into Joomla!, follows the link to the contribute page they appear to only be able to add a membership to their own contact record and not to be able to select the contact for which they will administer the membership add.

Any ideas on which i should look at to enable these administrators to process membership on any contact (or to add a new contact to process a membership).

I don't want the membership administrators to have access to the full civicrm, just to give them what they need to carry out their role.

Many thanks Dave

# Answer
If you set your link to the contribution page so that it has the following at the end of the url - &cid=0 - then you should see the page load with no contact linked to it. And if you set the cid to an existing contact id, then people with permission would see the form loaded with that contacts data in place. EG

http://d46.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=1&cid=0 should load with no contact

http://d46.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=1&cid=203 should load with contact 203

Does that help you when combined with the right permissions?
> 2 votes

---
Tags: civicontribute, civimember, joomla
---


title: Stripe Checkout integration

text:
# Question
Title: Stripe Checkout integration
I see that Stripe can be used with CiviCRM but is Stripe Checkout ( https://stripe.com/checkout) an option with CiviCRM?

# Answer
> 9 votes
Stripe Checkout is not implemented at this time, but I would love to add it in the future.

Source: I am the maintainer of CiviCRM Stripe integration.

# Answer
> 2 votes
You can not use the checkout option for stripe if you are using it with CiviCRM.

As far as I'm concerned, you can use only direct payment option in stripe while making payment in CiviCRM.

Please refer a function **doTransferCheckout()** from link: https://github.com/drastik/com.drastikbydesign.stripe/blob/4.6-dev/CRM/Core/Payment/Stripe.php#L665

it says, 'Use direct billing instead of Transfer method.'

---
Tags: stripe
---


# Question
Title: Installing CiviCRM 4.6.11 on a Joomla 3.4.8
I am trying to install CiviCRM 4.6.11 on a Joomla 3.4.8 website which I downloaded from the Joomla Extensions Directory. When I install it nothing happens. I dont see any error message or a success message. Joomla normally displays an error message when an installation is not successful. The website is on localhost.

I would appreciate your guidance.

# Answer
CiviCRM is likely much heavier then the average Joomla Extension. And because it runs behind more CMS-systems the preferred installation could be different then the usual Joomla Extension.

Please have a look at the "Installing CiviCRM for Joomla" page on the CiviCRM site and follow the instructions there for the best way to install CiviCRM for Joomla:

http://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+Joomla
> 1 votes

---
Tags: joomla, civicrm-home
---


# Question
Title: How can I preview the event info of a non-active event?
To ensure that the event information page looks as I want, I'd like to preview it before I activate the event.

When I do that I get a "no authorization" with a big fat 0 (zero). I'm running Joomla so I don't know if that is a Joomla error or not.

I've looked through the ACL-settings and there seems to be no "view non-active" operation that could affect this.

Is this possible somehow or do I have to activate, preview and deactivate?

# Answer
Currently the event needs to be active to use (preview) it.

If you have an event listing page, you can uncheck Public event. That way users only see the event if you create a link to it. You should be safe in temporarily making it active for testing.

This is the same Question/Answer as: Testing event registration
> 5 votes

---
Tags: civievent, permissions, acl
---


title: Webform CiviCRM country field

text:
# Question
Title: Webform CiviCRM country field
Just wonder if there is a way to show country name in country field while keeping the field readonly/"disabled" on webforms? For example, you want users to see their countries but not editing them. The closest I can get is to change the field type to textfield and "disable" it but it shows the country code instead of country name.

# Answer
> 1 votes
If you're creating a link from elsewhere that pre-populates the information, you could use a Drupal Views block that displays the country field as read-only. (For reference: Displaying a Views block with a CiviCRM-enabled webform)

---
Tags: webform-civicrm
---


# Question
Title: State/Province dropdown is empty since update to 4.6.10
I just discovered that the State/Province dropdown in Address section of create New Individual form is missing the state data. When I click on the dropdown it displays "N/A" and below it "None found.". This seems to be a universal problem in my civicrm instance too - e.g when i go to to manage an Event the dropdown behaves the same.

I have never noticed this problem before in 5+ years of running civicrm. I recently upgraded to 4.6.10 from 4.6.3 - perhaps its related. This is a WordPress 4.3.1 install.

I checked the 'civicrm\_state\_province' table in the db and the data is there, so i'm not sure why it's not getting loaded in the dropdown.

any ideas?

screenshot of broken dropdown: http://imgur.com/3w3G8On

# Answer
> 1 votes
This problem has been resolved.. The civicrm\_state\_province table was empty. dumb of me not to check this, How it got empty is a mystery tho...

# Answer
> 0 votes
If your upgrade failed at some point and you had to restore from backup, then your system might have enough data to make it seem like you restored successfully, but it might be missing the last several tables of CiviCRM.

---
Tags: 4.6.10
---


# Question
Title: How to get max_amount, min_amount from Contribution Page
Issue: Coding wordpress plugin for civicontribute widget, I need to get some variables in order to build the progress bar.

When I use `civicrm_api3('contribution_page', 'getfields');` it returns a lot of information which does not seem to be accessible when using `civicrm_api3('contribution_page', 'get', $params);`.

May some of you put a bot of light on how to get this data?

PS. May it be easier to code an alternative template for the widget?

Thanks!

# Answer
what is that you have in the param?

I would suggest you to use the api explorer, it should guide you and the generated code can be copy/pasted in your plugin

Just to be clear: the min\_amount and max\_amount are the amounts a user CAN enter, it doesn't show how much has been given already. for that, you should look at the contribution api.getcount (and filter it by contribution\_page)
> 1 votes

---
Tags: civicontribute, api
---


# Question
Title: Can tokenValue hooks be used in scheduled reminder emails?
I have the same problem as at http://forum.civicrm.org/index.php/topic,32608

I have created a tokenValues hook to fetch the value of a field from a multi-record custom field set. I have the token hook embedded within a message template. The hook works fine and correctly populates the value if I trigger it from Actions-\>Send an email. But when triggered by a Scheduled Reminder based on x days before end of membership, the value is not filled in within the email that goes out.

I have logging within the token hook which shows that the hook *is* being called and is populating the returned array with the correct value. I tried to debug further, but I can't figure out from where the tokenValues function is being called. So I can't figure out why the behavior is different for Action-\>Send an email vs Scheduled Reminders.

If necessary, I can work around this by running a script to push the value I want into a non multi-record field, as regular custom fields work fine. But obviously that's a bit of a cludge, and this seems like a bug in CiviCRM.

This is a different issue than that described at Token not evaluating in CiviMail \- that's discussing custom field permissions, which aren't a problem here.

# Answer
> 3 votes
I ran into a similar issue of custom tokens not populating for scheduled reminders. The workaround in Brian Shaughnessy's comment on CRM-11153 fixed it for me:

> early in tokenValues put:

```
$single = false;
if (!is_array($contactIDs)) {
    $contactIDs = array( $contactIDs );
    $origValues = $values;
    $single = true;
}

```

> then at the very bottom put:

```
if ($single) {
    $values = $origValues + $values[$id];
}

```

`$id` may be something different in your hook implementation.

Other recent comments on that issue suggest that a fix may find its way into CiviCRM core.

---
Tags: email, tokens, hooks, message-templates
---


# Question
Title: Error: Stripe.js token was not passed! Report this message to the site administrator" for Stripe extension
I have following configuration: CiviCRM version - 4.6.2 Stripe version: 1.9.1

I have configured stripe on site and using it on contribution page and trying to use with "PayPal payment processor" and "Pay-later option".

After submitting the contribution I have getting the error as follows:

"Error: Stripe.js token was not passed! Report this message to the site administrator"

Is above error getting due to compatibility issue? Because on https://civicrm.org/extensions/stripe-payment-processor/ in this page compatibility for stripe with CiviCRM version for 4.4 and 4.5 is mentioned

Please guide!!!

# Answer
I have this problem also. It's a known issue with version 1.9.1 You can view the Github thread here. The developer says his latest commit may have fixed the issue.
> 1 votes

# Answer
This should have been solved back in November 2015 (worked on CiviCRM 4.6.9).

I am trying to bring order to the issue reports scattered across here & GitHub and get appropriate issues closed.

(Note: It was not the PR on 105 that fixed, but a different commit afterwards). Use the 4.6-dev branch from GitHub.
> 0 votes

---
Tags: payment-processor, stripe
---


# Question
Title: Changing group_type to mailinglist fails with unknown db error / deadlock
Hejdo,

Today I just wanted to make some of our groups accessible by CiviMail by checking the mailinglist group type checkbox. But this took long time (more than 10 minutes) no matter if I did this for a group with about 10 or about 2k contacts. I also tried via group api, same same.

The ui ajax call responds with error and the corresponding log entry states:

```
"DB Error: unknown error", -1, 16, (Array:2), "INSERT IGNORE INTO civicrm_group_contact_cache (group_id,contact_id) VALUES (...")
[...]
Deadlock found when trying to get lock; try restarting transaction

```

We have somewhere around 180k contacts and 2k groups. Civi is 4.6.10. CMS is current Drupal 7, DB is Mysql 5.5.46.

Any ideas on how to solve it or investigate on?

# Answer
> 2 votes
This sounds like corrupt tables or a stuck MySQL process.

If you have access to phpMyAdmin, you can select all tables at the bottom and then choose "repair tables".

If you do not have phpMyAdmin, but you have access to ssh then you can use mysqlrepair (or mysqlcheck -r), see more at http://linuxcommand.org/man\_pages/mysqlcheck1.html

If you have neither you should ask your hoster to do a repair for all tables.

Besides that, restarting MySQL makes sense.

If you need further MySQL tweaking, please look at http://mysqltuner.com/ Nothing I have seen beats that script.

---
Tags: groups, error, mailing
---


# Question
Title: Conditional Statement in mailing causes parse error
I'm writing an if statement for a mailing and keep coming across a parse error. My statement is pretty straightforward:

```
{if contribution.non_deductible_amount eq '0'} NA {else} {contribution.non_deductible_amount}{/if}

```

I've tried a few variations equals signs,double quotes, etc. But each time it adds an ampersand which causes the parse error:

```
<?php if ($this->_tpl_vars['contribution']['non_deductible_amount'] == & #39;0'): ?> NA <?php else: ?> Amount Here<?php endif; ?>

```

# Answer
> 1 votes
I fixed this by adding (as @Andrei suggested) `config.entities = false;` to my config.js file in the ckeditor (/your/path/to/civicrm/civicrm/packages/ckeditor/config.js).

Just don't forget: If you are modifying config.js you should first have configured a Custom PHP Path under Administer \> System Settings \> Directories, and place your modified version in the custom path.

---
Tags: message-templates
---


# Question
Title: Manually adding/removing contacts in a Smart Group
If you manually add/remove contacts to a Smart Group will they remain in the group when the group updates?

# Answer
> 3 votes
If you manually add a contact to a Smart Group, the system will maintain that information, similarly if you remove a contact the system will not add the contact back in automatically.

# Answer
> 2 votes
As Sanjay said, yep it'll work. In practice we've found it causes trouble, though. In our experience it confuses non-technical users, who will then merrily start adding/removing people from smart groups directly (rather than changing the underlying criteria that the smart group was built on).

It also causes odd UI issues - I've definitely seen pages where manually-added people aren't included in counts, though this is probably a bug.

# Answer
> 1 votes
There's a good reason that smart groups have this feature - if you use a smart group as a mailing group, then you'll often want to allow recipients to remove themselves from the group (even when they still satisfy the smart group criteria). It'd be nice to be able to be able to track these, and you can in theory since adding and removing contacts leaves a trail.

---
Tags: groups, smartgroups
---


title: Can I stop emails being put on hold?

text:
# Question
Title: Can I stop emails being put on hold?
Can I stop our CiviCRM database from putting emails on hold when they bounce?

While it's useful from one point of view, it takes ages to keep removing the blocks.

# Answer
not a direct answer to your question but I was wondering if you are aware that you can "bulk-unhold" emails:

* use advanced search and select "Email on hold"
* from the action menu select "Unhold Emails"

Regards Fabian
> 3 votes

# Answer
Presumably a great number of the email addresses that you take off hold are good, hence your desire to remove the hold. Because you don't really want to blindly unhold addresses that truly bad especially with bulk email. Sending email to lots of addresses that bounce is more likely to get your mail server marked as generating spam.

Having said that, there is a threshold for each type of bounce before it is marked bounced. For example, if the bounce is because the user's inbox is full, then the default is not to mark it on hold until civi has received three bounces from that address for that reason.

If you have access to the database and knowledge how to update records you can change hold threshold. These values are stored in the civicrm\_mailing\_bounce\_type table.

You can get more info on how civi bounces email here including what the thresholds are set to by default. (I'm not sure the table in this link is up to date, we have additional hold types listed in our version, like vacation, set to 30.)
> 2 votes

# Answer
The simple answer is: sure, just don't enable (or disable) your bounce handling (which depends on your method of sending). But of course, it's usually a bad idea. I just put this answer in to point out that it's actually an important and non-trivial thing to handle bounces.
> 0 votes

---
Tags: email
---


# Question
Title: Recurring contributions not sending emails (Stripe)
I'm setting up a contribution page using the Stripe payment processor. In testing mode, one-off donations work fine in that they show up as expected in the test pane in the Stripe account, donations show up in CiviCRM, and also send the *Thank you* email specified in the Contribution page settings.

When I check the box to recur monthly, however, although everything else works as above, neither the initial email nor followup recurring payment emails are sent.

There is an issue related to this in the Github queue but it's kind of stagnant and was hoping someone here could give me a pointer on where to look to try to solve this.

(*CiviCRM version 4.6.3* with latest dev version of the CiviCRM-Stripe extension)

# Answer
This has been fixed now. If you get the latest version of the Stripe extension's code from Github, you will have email receipts for recurring contributions.
> 2 votes

# Answer
CRM-15629 produces similar symptoms with certain configurations of PayPal. Also, please update your question with a CiviCRM version?
> 2 votes

---
Tags: civicontribute, payment-processor, recurring-contributions, stripe
---


# Question
Title: Are there potential problems with per-subdomain installs?
I'm being forced to break up one CiviCRM (in Drupal) database into several separate ones, and it seems that using subdomains would be the most elegant way to do so. That is to say I would copy website.com to one.website.com, two.website.com, and three.website.com. Then I'd change the base URL and have them exist separately from thereon. They would not share the same Drupal frontends either.

My questions are these: Would I face any unforeseen consequences in doing so? Can these installations exist side-by-side in harmony? Would my SMTP service (CiviSMTP, in my case) throw a fit? Is there a smarter way to go about this?

# Answer
I have done 1 CiviCRM per subdomain in a big project. About 20 separate subdomains with their own CiviCRM.

If settings are all correct then there is no side effect. They all just work. With copying a CiviCRM to another Drupal instance (subdomain or not), you need to think about

* the connection between Drupal users and CiviCRM contacts
* the CiviCRM table settings in settings.php
* the user uploaded files, you probably want to copy all to 2nd CRM

Those subdomain Civis all handle their own SMTP. No issue there either.

I don't know CiviSMTP, maybe you need an account per subdomain, maybe they can share the account.
> 3 votes

# Answer
There are a few different ideas in your questions that mix different approaches. Multiple sites, multiple databases, multiple domains, multiple internet subdomains.

You can create copies of website.com at one.website.com, two.website.com, etc. in a few ways in Drupal. Focussing on the files, you can 1) copy everything under docroot to a new docroot for each site and configure webserver (Apache, nginx) to serve each subdomain from the appropriate docroot, or 2) create a new directory under sites for each subdomain eg sites/one.website.com, sites/two.website.com, etc. with all subdomains being served from same docroot by webserver. If you expect the sites to diverge significantly and/or need upgrading at different times that tends towards approach 1, while staying the same or similar in the future and having simultaneous upgrades tends towards approach 2.

I'm assuming you're going to have separate Drupal databases for each subdomain site.

You have the option of also replicating the existing CiviCRM database for each new subdomain site or using CiviCRM's multi-domain features to manage all of the sites from within the same database. Eileen and Chris at Fuzion are the experts in the latter approach, which they have used successfully for many years. The advantage of this second approach is that you can manage CiviCRM upgrades to all sites simultaneously. Some tables in CiviCRM have a domain field, which would need to be set to different values for each subdomain as you replicate the data in the same database for each subdomain's site. This will be more complicated to convert to than separate CiviCRM databases for each subdomain, as the latter can be simple copies of the existing site.

In either approach, follow the instructions at http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location for each new subdomain, since more things than just the baseurl need to be modified.

An additional essential point when replicating a site is to ensure that the bounce processing and email-to-activity email accounts are different for each site. Certain extensions may also need to be reconfigured on a per subdomain basis; for example, the webhook url for Mandrill callbacks will need to be updated properly. I don't recall CiviSMTP doing callbacks in addition to email routing for bounce processing, so you're likely fine without doing any more work.

Other than rejigging the inbound email accounts and inbound webhook urls, I don't see any problems with running the sites side by side.
> 0 votes

---
Tags: configuration, hosting
---


title: Exact Search Results

text:
# Question
Title: Exact Search Results
Is there a way for e.g. searching by last name, of producing exact search results.

So if I searched for Last Name, Head. I currently get email addresses with head in etc not just people with the surname head.

Thanks.

CIVICRM 4.5.8 Drupal

# Answer
It can be done navigating to **Administer -\> Customize Data and Screens -\> Search Preferences**, the first option is **Automatic Wildcards**, disable it.

> If enabled, wildcards are automatically added to the beginning AND end of the search term when users search for contacts by Name. EXAMPLE: Searching for 'ada' will return any contact whose name includes those letters - e.g. 'Adams, Janet', 'Nadal, Jorge', etc. If disabled, a wildcard is added to the end of the search term only. EXAMPLE: Searching for 'ada' will return any contact whose last name begins with those letters - e.g. 'Adams, Janet' but NOT 'Nadal, Jorge'. Disabling this feature will speed up search significantly for larger databases, but users must manually enter wildcards ('%' or '\_') to the beginning of the search term if they want to find all records which contain those letters. EXAMPLE: '%ada' will return 'Nadal, Jorge'.

**Please note:** forgot to mention that changing this option will change the behaviour for all contact search forms, not sure if that's what you want to achieve, if it's not, @petednz comment is a very good and better answer
> 4 votes

# Answer
For undertaking a single search, which may not be what you are after, you can use Search Builder (under Search in Admin menu) and set Contact Type = Individual AND Last Name = Head
> 2 votes

---
Tags: search, search-results
---


title: Who gets scheduled reminder emails?

text:
# Question
Title: Who gets scheduled reminder emails?
When scheduled email reminders go out for membership for an organization, which of the related individuals does the email go to?

I have searched but cannot find the answer.

# Answer
> 1 votes
I finally got the right combination of words to google and found an answer here: https://forum.civicrm.org/index.php?topic=34203.0

---
Tags: scheduled-reminders
---


# Question
Title: When sending mailing incorrect amount of contacts displayed
I have a mailing list group called "All Contacts". It has about 450 contacts with valid email addresses that we would like to send email to.

When we go to "New Mailing" and select All Contacts it only sends to 270 contacts. I am wondering Why it is not sending to all of the contacts? Only about 7 contacts are opted-out so it should be sending to at least about 350 contacts.

\*After further review, it appears as though it is contacts that have been recently imported that are not being added to the Mailing recipients list. Event though they have been added to the mailing list group.

THanks,

# Answer
I had a similar problem, probably with version 4.3, and found that a recent import had resulted in contacts with "deceased" set to null, while the query that selected e-mail addresses for a mailing excluded contacts where "deceased" was not false, thus excluding all those newly imported contacts with "deceased" set to null.

I re-imported those contacts, explicitly setting "deceased" as False, and then I was able to send e-mail to them.
> 4 votes

# Answer
You might want to also account for contacts whose email is on hold, deceased or unsubscribed from the group.

If this still does not account for all the contacts, you should see if you can find a contact that should be in the recipient list but is not.

One way of debugging this might be to use the mysql query log and see the set of queries used to generate the recipient list
> 1 votes

# Answer
I had the same issue with imported contacts in my mailings. When I edited a contact and ticked, un-ticked the deceased and then saved the record, it was then included in the mailing.I will use the UPDATE command to set deceased to 0.
> 1 votes

---
Tags: civimail
---


# Question
Title: Can I customize the auto email for event registration?
Can I customize the auto response message for event registration? Below is a test event I set up and registered for and what was sent, along with a .PDF attachment.

The message is what I'm wanting to make pretty, but I can't find it. I do see all the other message templates, just not this one. Kind regards.

# Answer
> 3 votes
Registering people manually like in your comment will utilize the "Events - Registration Confirmation and Receipt (off-line)" template.

If people self register online, it will use the "Events - Registration Confirmation and Receipt (on-line)" template.

For reference, the templates are listed and available to edit from this screen:

> Administer \> Communications \> Message Templates \> "System Workflow Messages" tab

---
Tags: civievent, civimail, message-templates
---


# Question
Title: What could be causing slow mailing from CiviCRM (via SMTP)
We're currently investigating why our mailings are sending slowly from CiviCRM. We use an external SMTP server.

Our mailing settings:

* Mailer batch limit: 30000
* Mailer throttle time: 2100
* Mailer job size: 0
* Cron job limit: 1

However, when we look at the delivery table, the times individual emails were delivered are a bit strange:

* 10 emails delivered all on the same second
* A delay of 2-3 seconds
* Another 10 emails delivered on the same second
* A delay of 2-3 seconds
* Rinse, repeat

Has anyone run into a similar issue?

Update: After some testing, this only happens for SMTP (ie, not mail()), and it is happening with two separate SMTP providers. Investigations continue...

Update: Emails also send slowly from a standalone script which uses the PHPMailer library on the same server. That actually sends slower, at 2/3 emails per second but without a delay inbetween. The next step would be for us to try concurrent sending jobs (once this is fixed in 4.6.10).

# Answer
There are a couple of points to this.

1 - SMTP is chatty, it is a fairly slow protocol. To combat this, run several mailing jobs in parallel. This can be achieved by calling the process\_mailing cron job multiple more frequently. Ensure that the 'cron job limit' is equal to the maximum number mailing jobs you would want to be active at any one time. This is useful if you have a sending limit on your SMTP server of x per second.

2 - The issue with 10 emails sent 'on the same second' and then a delay: MailingJob.php processes 10 emails at once, and then writes the transactions to the database all at once. So it looks like the emails were all sent on the same second. The '10' is defined in BULK\_MAIL\_INSERT\_COUNT in CRM\_Mailing\_Config. Ideally the actual time of sending would be recorded in the database, rather than the time of writing.

To speed up mailings we now call the process\_mailing job independently every 5 minutes, and limit the number of emails that are sent on a cron run. This means we have several cron jobs running sending emails at once for large mailings, which greatly improves our send rate.
> 2 votes

# Answer
when civimail uses smtp to deliver, it doesn't create a new connection to the smtp server for every contact, but pipeline them. this might explain the bursts pattern?
> 1 votes

---
Tags: civimail, performance, smtp
---


# Question
Title: unsubscribe via email token gives wrong address
The unsubscribe via email does not use the correct email address. I have "myname"@gmail.com but when I send a test it adds this strange email address u.77.3.61020d9ae6a273d5@gmail.com as the email address.

# Answer
> 2 votes
in order to use civimail, you need to have your own domain name for to manage the bounces, and it's the same address used for the unsubscribe (it adds to the address that weird u.xxx string that you see to be able to distinguish between your contacts who is actually unsubscribing or bouncing, it's called VERP).

It doesn't use any of your "normal" mailboxes, it needs a dedicated one to handle automatically bounces and unsubscribe.

For what I see, you haven't properly set-up your email account in civimail and use a gmail address (and didn't fill the local part)

http://book.civicrm.org/user/advanced-configuration/email-system-configuration/

# Answer
> 0 votes
It sounds like you haven't set up your email system correctly. This is the sub-address part of the email but it is missing the local part.

Go to Administer \> CiviMail \> Mail accounts and set 'local part' to be 'myname+'.

See the manual for more details: Email system configuration

---
Tags: civimail
---


# Question
Title: Paypal Standard not working in embeded civi form
Problems began after I updated from 4.6.7 to 4.6.10. Checking out with Paypal standard doesn't work if the form is embedded in another site.

I get this message in the console:

Refused to display 'https://www.paypal.com/us/cgi-bin/webscr?cmd=\_flow&SESSION=\************' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Any Ideas

# Answer
> 3 votes
Yes, it's a security measure of paypal, you can't use it in an iframe.

I would suggest that instead of embedding the donation form, you simply put a link to your civicrm contribution page.

You might have another payment processor that is willing to work from within a frame (try stripe if you want), but you might get blocked in the future, because trying to "hide" what is the real domain of the form asking for money is something scammers would do when trying to trick victims to send them money when they think they are paying someone else

---
Tags: paypal
---


# Question
Title: How do I add new tab to the Contact Summary Page?
I create a new plugin and I try to use hook for adding extra tab in the contents, my question is how to get $contactID?

```
add_action('civicrm_tabs', ' civitest_civicrm_tabs');

function civitest_civicrm_tabs( &$tabs, $contactID ) {

  // unset the contribition tab, i.e. remove it from the page
  unset( $tabs[1] );

  // let's add a new "contribution" tab with a different name and put it last
  // this is just a demo, in the real world, you would create a url which would
  // return an html snippet etc.
  $url = CRM_Utils_System::url( 'civicrm/contact/view/contribution',
                                "reset=1&snippet=1&force=1&cid=$contactID" );
  $tabs[] = array( 'id'    => 'mySupercoolTab',
                   'url'   => $url,
                   'title' => 'Contribution Tab Renamed',
                   'weight' => 300 );
}

```

Thank you

Nilda

# Answer
hook\_civicrm\_tabs is now deprecated and you should use https://docs.civicrm.org/dev/en/latest/hooks/hook\_civicrm\_tabset.

Also note:

```
// $url should return in 4.4 and prior an HTML snippet e.g. '<div><p>....';
// in 4.5 and higher this needs to be encoded in json. E.g. json_encode(array('content' => <html form snippet as previously provided>));
// or CRM_Core_Page_AJAX::returnJsonResponse($content) where $content is the html code
// in the first cases you need to echo the return and then exit, if you use CRM_Core_Page method you do not need to worry about this.

```

Some example code:

```
function koba_civicrm_tabset($tabsetName, &$tabs, $context) {
  //check if the tab set is Event manage
  if ($tabsetName == 'civicrm/event/manage') {
    // Remove "Mond aan mond reclame" tab
    unset($tabs['friend']);
    // Remove "Location" tab: we use a contact subtype for location because it has better integration
    unset($tabs['location']);
    // Remove "Personal campaign pages": we don't use this
    unset($tabs['pcp']);

    // Add a Beheer Bijscholingen tab, a tab that shows a Drupal view
    if (!empty($context)) {
      $eventID = $context['event_id'];
      $url = CRM_Utils_System::url('admin/sitename/bijscholingen/json');
      $result = views_get_view_result('beheer_sitename_bijscholingen', 'page', $eventID);
      $count = count($result);
      $tabs['beheer'] = array(
          'weight' => 300,
          'count' => $count,
          'title' => ts('Beheer'),
          'link' => $url,
          'valid' => 1,
          'active' => 1,
          'current' => false,
      );
    }
  }
}

```
> 4 votes

# Answer
The hook\_civicrm\_tabs is called by CiviCRM and provide the contactID argument. You don't need to use `add_action(...)` to call the hook.

Your example should work as is if you put it in a CiviCRM extension called civitest.

If you need help getting started with extension development, you can start with CiviCRM Wiki
> 2 votes

---
Tags: wordpress, hooks
---


title: Contribution Note Smarty Variable

text:
# Question
Title: Contribution Note Smarty Variable
So I'm super close to getting a smarty variable working to place the contribution note in a thank you letter.

I used the API explorer and got this far:

```
{crmAPI var='result' entity='Note' action='get' sequential=0 entity_table="civicrm_contribution" entity_id=$contribution.contribution_id}
{foreach from=$result.values item=note}
  {$note.note}
{/foreach}

```

But this prints a list of all contribution notes in the database, it doesn't filter out by the contribution ID. I know that the variable **contribution.contribution\_id** works in the thank you letter as a standalone variable. I also can use the above code and substitute `entity_id=1`and that does print the note attached to contribution 1.

How can I put a smarty variable inside the smarty variable api call??

(Wordpress 4.3.2 and Civi 4.6.4)

# Answer
I might be missing something but, the **contribution.contribution\_id** variable you are referring as a standalone variable I believe is a **token**, I can't figure out what's the smarty variable for it but you can do this (it works):

```
{capture assign='id'} // the variable
   {contribution.contribution_id} // here is the Contribution ID token
{/capture}

```

And then your API call:

```
{crmAPI var='result' entity='Note' action='get' sequential=0 entity_table="civicrm_contribution" entity_id=$id}

```

**Update**: final snippet should look like this, I've just tested it

```
{capture assign='id'}{contribution.contribution_id}{/capture}
{crmAPI var='result' entity='Note' action='get' entity_table="civicrm_contribution" entity_id=$id}
{foreach from=$result.values item=note}
  {$note.note}
{/foreach}

```
> 4 votes

---
Tags: api, receipts, smarty
---


# Question
Title: Installing CiviCRM - best security practices
I am new to CiviCRM and want to use it on a Joomla website.

The question I have is how is the best way to make sure, that the CiviCRM user data is secure?

I am thinking about installing CiviCRM in an second Joomla installation on an separate hosted account so that the main website and the CiviCRM data is completely separated and therefore the attack vector is as small as possible. Is this a too big overhead? How do others do that? Mainly I want to use CiviCRM for global member / participants management.

# Answer
Generally when evaluating security, you need to balance likelihood and severity of threats against the resources available to counter them. A human rights organization that was a client of mine had information on activists in their CiviCRM instance who could be imprisoned or killed by their governments, with sophisticated, well-resourced governments interested in getting that contact information: high threat, high consequences. In that kind of a context it might make sense to avoid exposing your CiviCRM system to the public web. Another client of ours, Nader for President 2008, also used an instance of CiviCRM hosted on a hardened server that was not exposed on the web, using custom software to migrate relevant contact information into CiviCRM.

For the last several years, the supported and generally available releases of CiviCRM require a CMS to be installed on the same server to manage user accounts and permissions.

In your case, I would recommend putting CiviCRM and Joomla! on the same VPS/server, and keeping your Joomla! software up to date with all security upgrades/patches. Follow the Joomla security best practices listed at https://docs.joomla.org/Security\_Checklist. A more in-depth practical guide developed for Drupal but containing many generic sections can be found at http://openconcept.ca/drupal-security-best-practices-practical-guide.
> 6 votes

# Answer
There is an advantage of having Civi on a separate server. The software setup on the main website may not be compatible with Civi. I ran into this problem, and regretted the move. The main website was Drupal 7 so should have been OK, but with hundreds of added modules - at least one of which caused Civi problems. Better to have Civi on a separate server, in my experience.
> 0 votes

---
Tags: joomla, installation, security
---


# Question
Title: Event Registration - Empty Session object when not logged in
I am running Civi 4.6.10 on WP 4.3.2.

I know this sounds like a several other existing questions but I've tried all the suggested solutions and no fix.

When a user is logged in (or even logged out but the system remembers them) the user can register for an event. When I am in an incognito window or a new browser where I have never logged in before, when I press Continue from the first page of the Registration, I get the error "Sorry but we are not able to provide this at the moment. Could not find valid value for id."

I did a bunch of debugging and found the real underlying issue to be that the CRM\_Core\_Session Object is empty. There is an \[entryURL\] but no \[qfPrivateKey\] or \[qfSessionID\]. When I am logged in (or logged out but recognized by the system) then I see that the CRM\_Core\_Session Object has both the \[qfPrivateKey\] and \[qfSessionID\].

I have verified that my base url in my civicrm.settings.php file does have "http://www.mysite.org" and the URL on the pages have www.

There is an anonymous user role in my Wordpress install and I tested giving it full civi permissions and it did not solve the problem.

In CiviCRM -\> System Settings -\> CMS Database Integration I set civicrm as the base page and added it as a parent page to my event registration page - didn't help.

The event registration form that I have been testing with was generated from a Wordpress shortcode. If I go directly to the link for the event registration generated from Civi then when I press continue, I don't get an error but it just refreshes the page and I see that the session object is empty.

PLEASE HELP!

# Answer
After debugging and debugging and searching and searching I called Bluehost. We are on a VPS customized for Wordpress sites that has a "feature" called Varnish Cache. The first thing the guy did was disable this "feature" and voila, my sessions were no longer being destroyed.

Hope this helps someone!
> 1 votes

---
Tags: civievent, registration
---


title: Get CSV via REST?

text:
# Question
Title: Get CSV via REST?
Is there a way to get CSV-formatted output via a REST call?

We have a 3rd-party app that can import data periodically from a URL pointing to a CSV file, so the aim is to provide it with a Civi URL (probably going to a custom api function) that returns selected data as if it were just a plain CSV file.

EDIT: Civi 4.6.10 currently on WP moving to Drupal

# Answer
> 2 votes
Not natively, you would need to write a custom extension to do the relatively simple task of converting array output from the api to csv output.

# Answer
> 1 votes
In Drupal, you can do this using existing plugins and no custom code.

* Build a Drupal View of your CiviCRM data (using Views module for Drupal \+ CiviCRM's Views CiviCRM module, part of the CiviCRM download for Drupal).
* Use filters in the View to correctly show the data you want to export to external service.
* Use Views Data Export to provide a CSV output format of this view.
* Check the View display(s) have appropriate access restrictions (edit settings in View).

---
Tags: api, export, rest
---


# Question
Title: How to enable authenticated user editing their own record in Drupal
Using CiviCRM 4.6.9 and Drupal.

We need to have a form that allows users to update their own contact data. While we could do this by creating a specific profile, it seems this is already supported via a connector to Drupal with the form exposed here:

/user/1/edit/name\_and\_address

This works for administrators, but for regular authenticated users the fields don't show up - although there is a "Save" button down at the bottom.

What do we need to do to enable this for regular authenticated users?

# Answer
> 1 votes
Rob - that tends to work by default on the sites we set up using the 'out of the box' drupal permissions for civi relating to Profiles etc. Is it possible that you have removed some permissions that would have let users submit profiles (don't have them in front of me right now)

# Answer
> 1 votes
You probably do, but just double checking, do you have the Profile marked in its Civi settings as 'Drupal User Registration' and 'View/Edit Drupal User Account'?

---
Tags: contacts, user-account
---


# Question
Title: CiviCRM + Drupal + Office 365 Integration
We are working on the project with CiviCRM with drupal CMS. In some case we need office 365 mail in the dashboard with the inbox,draft, sent items etc. i would like to know the possible option to explore this? Is any plugin / module available for integrating office 365 with civi? Also i would like to know any other better option apart from office 365 for mail/message system in CIVI.

Thanks

# Answer
The usual way of email integration is a bit different.

CiviCRM can read a POP/IMAP account, this can be the full account or a subfolder in it.

Then you have your own mailreader, be it outlook, thunderbird, gmail, office 365 mail or any other system.

What I often do for customers is the subfolder option. When any email is worthy to be stored in the CRM it can be copied to the subfolder. CiviCRM then stores it as an activity. The activity is connected to both the sender and the recievers of the email.

If email address exists in the CRM then activity is connected to that contact. If email address does not exist a new contact is created.

Much more information can be found http://wiki.civicrm.org/confluence/display/CRMDOC/Autofiling+email+activities+via+EmailProcessor

When you see a much better solution with a different kind of integration with Office 365 mail, you can consider helping the whole community with an extension for it.
> 5 votes

---
Tags: civimail, civimember, evaluating-civicrm
---


title: Change Wordpress Title

text:
# Question
Title: Change Wordpress Title
I know there are some issues with how Wordpress sets page title. That being said, how can I change my current site title. All the pages I view have the title

CiviCRM ‹ civiCRM\_test — Wordpress

I've been trying to figure out where this is set. It seems simple but grepping the file directory and searching the database for 'civiCRM\_test' revealed nothing. I'm assuming the problem is that the title concats various strings all of which are too generic to find with a search. This is simple if you know where to look but I'm not sure where that is. Thanks

# Answer
CiviCRM content displays in WordPress in two separate ways. The first is through shortcodes: when you insert a CiviCRM shortcode in a page, CiviCRM renders the corresponding form.

CiviCRM still needs to render pages even if nobody has entered shortcodes for them, so the second method gives long URLs such as http://yoursite.org/civicrm?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1 These URLs actually take the page that's before the question mark and replace all the content. It used to be (4.5.x and earlier) that this would be your site's home page by default, but now it defaults to a page titled "CiviCRM" with the slug `civicrm`.

I think this is what's generating the page title you're seeing: "CiviCRM" is the title of the base page, and "civiCRM\_test — Wordpress" is your site name. Set the site name in your WordPress settings, and set the base page title by visiting the page you get when you edit the URL to remove the question mark and everything after it. Change the page title, and that should change it for all CiviCRM pages with the long URL style.
> 5 votes

---
Tags: wordpress
---


# Question
Title: Can a message template replace tokens with appropriate translations?
I see the option to set a contact's Preferred Language, and I have set up my test system with French and English. If I make French the default for the whole system, when I edit the demographics of a contact, the radio options are in French, but the displayed text after saving is in English.

When I send an email to a contact with French as the Preferred language, and use the token contact.gender, the token replacement is still in English.

Is there a way to have token replacements respect the preferred language for each contact, and use the translated value? Or am I stuck with English values because the system was installed in English?

# Answer
> 1 votes
This is not really an answer but a work around.

You can use smarty's to look for the English and replace it with the French (which I'm guessing at).

```
{if "{contact.gender}" eq "Female"}
    Femme
{elseif "{contact.gender}" eq 'Male'}
    Masculin
{/if}

```

---
Tags: tokens, i18n
---


# Question
Title: Extending default search for name to consult a custom field
How would it be possible to hook into civi's searches to always lookup a custom field when searching for name?

Background: In our setup we handle big departments as distinct contacts. Their name is the base organization name and we provide a custom field "Additional name" in which the department's name is stored.

Example:

```
Contact A: Base Organization named "University of Bielefeld",
Contact B: Department of A named "University of Bielefeld" with
           additional name "Faculty of Physics"
Contact C: Department of A named "University of Bielefeld" with
           additional name "FooBar Institute"

```

We do this for different reasons, for instance because pdf letter addressing is simpler.

Problem: If our users head over to search box, advanced search or simple search and fill the name or name/email field with "foobar", they don't get correct results.

Any ideas?

# Answer
> 1 votes
I can't think of a way to easily alter the search in all cases (quick search, autocomplete, normal search...

What we usually do when we have to store organisational units is to create a new contact type (department) and store together the org+"|"+dep as the organisation name.

if this is a matter of making it easier to input the departments in that format or tweak some reports, you can still keep a separate field for the department and alter the organisation name via the hook, or split the organisation name on the "|" to separate the university from the department.

From a data modelling point of view, it won't win any beauty contest, but does the job. and it's more or less what's happening with the individuals, where first and last names are separate columns that are concatenated into the sort\_name and display\_name.

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


title: Error when importing contacts

text:
# Question
Title: Error when importing contacts
I'm getting the following import error message when trying to import contacts:

Invalid value for field(s): Geo code 1

Can anyone please explain?

thanks

# Answer
> 2 votes
It seems to mean you are trying to import the latitude (or longitude, never remember) of your contact. Do you really have a column that contains that?

Sometimes, the suggestion to map your columns in the csv file and the fields in civi aren't correct, check that you aren't trying to import a completely unrelated "code" column into that "geo code +" field.

Your easiest bet to see what's the expected format of each of the fields is to export a few contacts from civi and include these fields, so you can see how you need to format them on your own file.

---
Tags: contacts, import, error
---


# Question
Title: Can I format a smarty token number to have thousands comma?
Based upon smarty documentation I should be able to do something like this

```
{contribution.total_amount|number_format:2:".":","}

```

and get something like 1,234.56, but it shows blank. In the logs I see:

```
[plugin] (secure mode) modifier 'number_format' is not allowed
(core.load_plugins.php, line 118) in Smarty->trigger_error() (line 1094
of  .../sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).

```

In searching our code tree a bit, I find a plugin modifier.crmNumberFormat.php, which looks like it should be the one. So why isn't it using it?

I do see that there are two Smarty plugin directories. Not sure which one it's using. There is one in sites/all/modules/civicrm/packages/Smarty and another in sites/all/modules/civicrm/CRM/Core/Smarty

We're running 4.5.8 and have 4.6.7 in a dev environment.

# Answer
The civi provided modifier has a different name: crmNumberFormat

moreover as per Paul-Tahoe analysis, smarty seems to be confused, so the trick is to assign the formatted value to a temporary variable:

```
{assign var="ttl" value=$contact.total_amount|crmNumberFormat:2:'.':','}

and then display it:{$ttl}

```
> 5 votes

---
Tags: smarty
---


title: Civicrm manage organizations

text:
# Question
Title: Civicrm manage organizations
Is it possible to use CiviCRM if I am a federation that wants to manage his associations with his members? How do I manage organizations and households in such a case? Thanks.

# Answer
You can create your associations as organisation (or create an organisation sub-type "association") and create relationships between your main organisation (the federation) and the associations.

Another way might be to use civimember, if you have to deal with membership fees, but it depends on how you handle your membership structure, and you should probably read the chapter on civimember in our book and experiment
> 2 votes

---
Tags: drupal, civimember
---


# Question
Title: Best way to make new groups mailinglists by default
I wonder how I may preset the mailinglist group type checkbox in group's edit form for new groups.

From a quick glance to code and db I assume that the is\_default field in the db is not used here (have tried also).

So how could I do if I want to avoid a client side/js hack?

# Answer
I would create a custom extension as explained here or using an existing one and implementing `hook_civicrm_buildForm`

**Updated**

```
function myextension_civicrm_buildForm( $formName, &$form ) {
  if ("CRM_Group_Form_Edit" == $formName) {
    if ($form->getAction() == CRM_Core_Action::ADD) {
      $defaults = array ("group_type[2]" => true);
      $form->setDefaults($defaults);
    }
  }
}

```

That will make the *Mailing list* checkbox checked by default.
> 5 votes

---
Tags: groups, forms, ui
---


# Question
Title: How to implement nested repeating fields?
Please could I have some suggestions on how to meet this requirement:

I need to be able to add a support plan to a contact. The support plan has an indeterminate number of goals. Each goal has a type, a description and also an indeterminate number of objectives, each of which has a type, a description and some dates. The whole support plan must be visible on the screen at one time, not just while viewing but also while editing.

Civicase (mapping cases to goals) was my original thought but it does not fulfil the requirement of having it all on one screen. *EDIT* Also, I am not sure how I would record this data in CiviCase because a goal has to have an indeterminate number of objectives and it is not possible to create a repeating set of custom fields against a case. */EDIT*

Custom fields, as they stand, do not provide what we need because although you can have repeating sets of fields, you cannot have repeating sets of fields within them.

I am an experienced PHP coder and Drupal dev so taking a custom-code approach is within reach, however the project does not have a huge timescale so I would like to keep it to a minimum or avoid if at all possible.

Here's what I've thought of so far:

1. Submit a pull request to core, allowing for nested sets of custom fields (I think this would take a long time, both the coding and the administrative process).
2. Use a Drupal page, so that I can utilise field collections. The problem with this though is that we would not be able to use CiviCRM reporting tools to report on the data. There would also be questions about how to link the drupal page to the contact (logically and visually).

Any ideas? Thanks!

# Answer
Case seems like the good fit for the model, I'd suggest to keep it and create a civicrm extension that provides the UI you need. The integration with angular is fairly complete so loading/saving the activities from your UI should work fine.

If you want to dig into angular for civi, Tim session might help you getting started.
> 1 votes

# Answer
we have done a slightly related solution where each student has to set a goal, then those get reviewed (but a determined number of times). The approach we took relied heavily on Views and Webform, with Activities being the 'holder' of the data. As our situation had a determined number of reviews we created all the fields required eg Review Comments, Rating, Date etc, in a Set of fields on the Activity - ie we had Review Comment 1, Rating 1, Date 1, and then also Review Comment 2, Rating 2, Date 2 etc.

We then used Views to display lists of students with a link to 'Review' which would open webform with relevant cid and the 'open' Activity, so they could then add the next round of data to that Activity.

I know this doesn't answer your core requirement, but if you need a light solution, and 'if' your maximum number of reviews isn't a ridiculous size, this might be worth considering.

EDIT: in a comment below I also suggest using a single Activity per goal and report that to a single screen in Views
> 1 votes

---
Tags: custom-fields, civicase
---


title: Event Registration - Require Payment

text:
# Question
Title: Event Registration - Require Payment
I have a CiviCRM deployment using Pricesets and multiple participants.

Currently, a user is allowed to simply "hit next" without entering any values under the priceset options and register themselves for $0.00.

Would selecting "required" under all the different price-set options address this issue?

# Answer
I see your price set has integer fields for each, presumably so someone can say 'i want 2 of this one and 5 of that one' but that presumably is not collecting you the data about each Participant. If that doesnt matter then yes, set each field to default to 0 (perhaps) and make each required. But if in registering multiple participants you want to know that John's ticket is $500 and Mary's is $2000 then I think you need a price set that is just pure radio buttons (and set as required) then when filling in the form they would enter number of participants, and hence fill in name and price for each one on subsequent windows. hope that is clear. can flesh out if not.
> 1 votes

---
Tags: registration
---


# Question
Title: retrieve amount of male/female participants
I would like to retrieve the amount of male/female participants of an event. So far I am able to retrieve the total amount of registered people. How can I get a number for the amount of male and female participants?

```
$result = civicrm_api3('Participant', 'getcount', array(
  'sequential' => 1,
  'event_id' => 66,
  'status_id' => array("Registered", "Pending from pay later", "Pending from incomplete transaction", "Partially paid", "Pending refund"),
  'options' => array('limit' => 9999),
));

```

# Answer
It's not going to be answering your question, but did you look at civisualize? its latest version contains a visualisation for events, with a filter based on the gender...
> 1 votes

# Answer
If I'm not mistaken, you can do that with an advanced search by simply selecting the correct event and the status being registered and then under demographics choosing the gender that you want
> 1 votes

# Answer
Gender is a field available as a column on http://d46.demo.civicrm.org/civicrm/report/instance/25?reset=1 \- so you could both show it, and filter by it. The later also lets you filter by 'not one of' 'male, female, transgender' in case you have contacts with no gender recorded
> 0 votes

---
Tags: civievent, api
---


title: VPN and LAN connections

text:
# Question
Title: VPN and LAN connections
I have

```
*CiviCRM 4.6.6 on
*Drupal 7.41 running through
*Apache2 on
*Linux Mint 17 in a VirtualBox on Linux Mint 17

```

If I am on the LAN I can access CiviCRM and everything works:

10.141.229.171/?q=civicrm/dashboard *everything works*

I also have a VPN that can connect to the drupal server and when I connect I get to log into CiviCRM but then CiviCRM stalls while it tries to connect to the LAN address so the system fails to work.

If, at that point, I stop the browser from continuing to load I can use the CiviCRM dropdown menus and go to almost any other page, including the Drupal menu. As far as I can tell only the dashboard fails to load.

\_http://10.12.0.23/?q=civicrm/dashboard *-- stalls with the message: "Connecting to \_http://10.141.229.171..."*

Note: I inserted an underscore just to prevent creating a real link in this message.

I know that the CiviCRM addresses are set to the 10.141.229.171 address but I would like my VPN clients to access the site as well.

The best I can come up with is that I need to set my VPN computer so that: Any link for 10.141.229.171/page\_name gets rewritten to be sent as 10.12.0.23/page\_name -- I tried a few FireFox addons to accomplish this but they failed to work, perhaps because of Java Script?

Again, it seems to fail only with the dashboard.

Unfortunately I am struggling to find out how to fix that. Is it even the right way? Can it be done in any way?

Thank you in advance for any help you can provide. John in Oregon, US

# Answer
> 1 votes
The base URL is set in civicrm.settings.php.

I can imagine you create a conditional statement in there.

You should try if $\_SERVER\['SERVER\_ADDR\] or $\_SERVER\['SERVER\_NAME'\] is the right variable for you to differentiate between the 2 situations.

More info: http://php.net/manual/en/reserved.variables.server.php

---
Tags: dashboard, webserver
---


# Question
Title: How can I make a filter to exclude someone who has a certain tag assigned to them? (or custom data field yes/no type)
I'm trying to set up a view (kind of an admin report view) which shows a list of members based on certain filters set up in the view. This is for a large homeschool coop.

* membership type (exposed - user select which type)
* membership status (current, new, grace)
* filtering out those with Do Not Email option checked since this leaves us mostly with those attending our coop days (primary member and kids)
* contact sub type (exposed - user can select adult and/or child)

I have two issues.

The first is that instead of checking for the Do Not Email option, I would much rather be showing Primary Membership Member. But then I have trouble showing the kids as well. I haven't yet learned enough about Views to figure this one out, but I'm getting there slowly but surely. Pretty sure I can figure this out eventually. I can live with current solution for now.

My main problem is that I need one more filter. Some kids in an otherwise active family no longer attend coop (gone off to college, whatever), so I have a Custom Data field to indicate that they are inactive. I have also tried a tag called Inactive Child.

I can't filter on either of these though. I set up a filter and set it to show all records that DON'T have the tag or the custom data field option checked and I get incorrect results for tags (shows people who have any tag at all, not just the one I chose and doesn't show anyone with 0 tags), or NO results (when I use the custom data field). If I set the filter to SHOW those contacts with those option(s) checked, it works. But I can't seem to EXCLUDE them from my results.

Pretty sure I am missing something with how to set this up correctly, but after about 7 hours of trying, I haven't figured it out.

Thank you!

Drupal 7.41 CiviCRM 4.6.11

# Answer
For the filter part: different types of custom data result in different filter operators being shown in the filter configuration screen. You can experiment with adding different custom types to see the effect on the available operators.

For your purposes, you could add an "Inactive" field of type Alphanumeric, Text. In the view configuration for the filter you should then have the "Is empty (NULL)" operator option. Configuring the filter with that will remove from your view any records that have something in the Inactive field (yes, moved, gone to college etc).

(NB 'text' is not necessarily the best choice from a pure Civi perspective but it will do what you need with Views. If the "Is empty" operator becomes available on more types in future you might prefer one of those.)
> 3 votes

---
Tags: drupal-views
---


# Question
Title: Change event participant status by clicking on a link (via civimail)
I created a new participant registration status called "Attending" for participants to let me know that they are actually planning to come to the event.

I currently do this by emailing registered participants a link to a Drupal Webform (that includes: ?cid1={contact.contact\_id}&{contact.checksum})

Once they click the link, I have the form set so that if they click the submit button it changes their registration status from registered to attending without having to fill out any fields.

Is there a way to accomplish this just by having them click on the link in the email, without having to go to the webform and click submit?

# Answer
Well, what you can do is to add in your webform a bit of javascript to automatically click on the submit button, eg in the body of the webform (or anyway you want to add some javascript):

```
<script>
jQuery(function($){
  $(".form-submit").click();
});
</script>

```
> 2 votes

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


title: How do I set up CiviCRM?

text:
# Question
Title: How do I set up CiviCRM?
This is literally the most basic of questions. I am looking for a free donor management software for the nonprofit I work at, and after all my research, CiviCRM looks like the best option! But I have no idea where to begin.

What does it mean when the start up guide refers to "hosting"? We have a Drupal website hosted by someone in Texas. Would he be able to host CiviCRM? Can I host it from my own computer? What does hosting even mean? Am I able to download the program and run it on my computer? Or is it web based and that is why it needs to be hosted? In that case, does it need its own domain name?

I've played around with the demo online and I like what I see, but I'm 100% lost in the world of open source and just looking for a simple step-by-step on how to set this up. Thanks so much!

# Answer
CiviCRM needs to be hosted on a webserver that meets the proper hosting specs. See http://book.civicrm.org/user/getting-prepared/hosting/

Technically you could host it on your own computer, this would not be practical for an organization.

I believe that your CiviCRM installation should be hosted where your website is hosted.

Depending on the size of your database (how many contacts) and which features of CiviCRM you would be using (civimail, civicase, civicontribute etc...) the current hosting for you website might not be adequate. For example, many commodity hosting companies that offer shared hosting cannot really support CiviCRM.

Your best bet for learning about hot to setup civicrm is on the wiki, or in the book http://book.civicrm.org/user/initial-set-up/installation-and-basic-setup/

If you have never installed a web application on a server, though, I would urge you to speak with the vendor who built/supports your website, or the company that hosts it, or find a vendor that specializes in CiviCRM. Installing CiviCRM is not like installing an app on your phone or computer.
> 9 votes

# Answer
I'm pleased to hear that you like CiviCRM. It is a good piece of software that has been used by many non-profits across the world.

However, I think you need to be realistic about the cost of installing a CRM system like this. While CiviCRM is 'free' in the sense that it is open source and you can download the code and alter it as you see fit there are still costs associated with using it.

CiviCRM is a complex piece of software and unless you have the technical skills yourself you will likely need to employ a professional to set up the software for you. You will also need to pay for ongoing hosting costs for the software. I would also recommend that you consider training costs for yourself and your staff/volunteers that will be using it.

I'm afraid that no CRM system is entirely free of cost.

I would suggest that you start by looking at the Getting Started section of the CiviCRM website.

In answer to your specific questions about hosting. Yes, it would need to be hosted on a web server (it is possible to host it on your own computer but this is unlikely to be a useful option in practice). Web hosting means purchasing space on a server (computer) that you can use to host a website. You may be able to host it with your current website, but CiviCRM requires significantly more resources than a standard website so you may need to upgrade your hosting package to accommodate this. Hosting CiviCRM is quite a technical matter so I would recommend that you get advice about this.

If you host CiviCRM with your website it would share the same domain name. If you host it separately it would need its own domain name (or a sub-domain of your domain).

Alternatively there are providers who offer CiviCRM hosting packages and would be able to take care of all these technicalities for you - see Hosting Providers.
> 4 votes

---
Tags: drupal, installation, evaluating-civicrm, hosting
---


# Question
Title: If statement not working if the smarty variable is not set
I've been trying to figure this out for myself but I am super frustrated at this point! I've got smarty variables and conditional statements working in thank you letters. Well kind of working. Basically I'd like to include the contribution note if the note field is filled in, if it's not show the text "None". I can get the note to display but no matter what set up I've used I can't get it to show "None". I have two donations one with a note, one without. Here is what I've tried so far:

```
{if $note.note}I'm a note{/if} // works as expected
{if !$note.note}None{/if} // does NOT show the text none as expected

{if $note.note neq""}I'm a note{/if} // works as expected
{if $note.note eq""}None{/if} // does NOT show the text none as expected

{if $note.note}I'm a note{else}None{/if} // outputs "I'm a note" on contribution receipt with a note but still nothing on the contribution that has no note.

{if !$note.note}None{else}I'm a note{/if} // outputs "I'm a note" on contribution receipt with a note but still nothing on the contribution that has no note.

```

I've also tried capturing a smarty variable and then using it in the if statement.

```
{capture assign='note_text'}None{/capture}
{if !$note.note}{$note_text}{else}I'm a note{/if} // "None" is still not displayed as it should be.

```

Can anyone shed some light? (I'm sure a suggestion will be is to write some hook or custom token with this logic already worked in. But I'd really like to know why the if statement isn't working as straightforward as I'd imagined it would. I'd like to use more if statements for mailing labels etc and if I can't get an "else" to work that's a problem.)

(Wordpress 4.4.1 and Civi 4.6.4)

# Answer
That's a good one, so if the contribution has no Note, no note record is created in the contribution table therefore the result is an empty array, I'm not sure of why none of your code is working, I believe is because the array is already initialized and smarty returns TRUE?

**Workaround**:

```
{assign var='note_count' value=$result.count} // grab the api count result
{if !$note_count}Contribution note: None // Print if there's no note...
{elseif $note_count} // else...
{foreach from=$result.values item=note}
  Contribution note: {$note.note}
{/foreach}
{/if}

```

Let me know how that goes.
> 1 votes

# Answer
Try this:

```
{if "{note.note}" eq ""}None{/if}

```
> 1 votes

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


title: Error on Stripe Payment Processor

text:
# Question
Title: Error on Stripe Payment Processor
Am in the process of switching from Paypal to Stripe. (Joomla 3.4.8 & CiviCRM 4.6.10).

Everything appears to be correctly configured but something must be wrong as on clicking confirm contribution I get a reply:

```
Error Oops! Looks like there was an error. Payment Response:
Type:
Code:
Message:

```

Which is blank. When I check Stripe's log I can see that my info was received and then something returned:

```
Parsed Request POST Body:
key: "pk_live_[trimmed]"
payment_user_agent: "stripe.js/b3b3690"
card:
name: "[trimmed]"
address_zip: "HA3"
number: "***************"
cvc: "***"
exp_month: "11"
exp_year: "2018"

Response body:
id: tok_17SA6RHq4Z0Eyf9xt0WKzQvv
object: "token"
card:
id: card_[trimmed]
object: "card"
address_city: null
address_country: null
address_line1: null
address_line1_check: null
address_line2: null
address_state: null
address_zip: "HA3"
address_zip_check: "unchecked"
brand: "Visa"
country: "GB"
cvc_check: "unchecked"
dynamic_last4: null
exp_month: 11
exp_year: 2018
funding: "debit"
last4: "****"
metadata:
name: "[my name]"
tokenization_method: null
client_ip: "92.10.229.3"
created: 1452535755
livemode: true
type: "card"
used: false

```

The only thing I can think that's wrong is the webhook address for Stripe as this page suggests the path is different to the plugin's instructions: https://forum.civicrm.org/index.php?topic=27531.0

I've tried with the URL specified in the plugin instructions: /index.php/component/civicrm/?task=civicrm/stripe/webhook as well as /media/civicrm/custom\_ext/com.drastikbydesign.stripe-1.9.1/packages/stripe-php/lib/stripe.php /media/civicrm/custom\_ext/com.drastikbydesign.stripe-1.9.1/templates/CRM/Stripe/Page/Webhook.tpl but nothings works. (I'm using full paths but can't paste them into Stackoverflow without more reputation)

Any help really appreciated.

Nic

# Answer
Per our conversation, my current guess is a recent API change on Stripe's end is causing your issue.

My test install still works, but my API version is set to `2014-10-07`.

Here is the CHANGELOG from my working version: https://stripe.com/docs/upgrades?since=2014-10-07#api-changelog
> 1 votes

# Answer
It turned out the server lacked PHP Open SSL. This wasn't being logged immediately as an error, but Andy Walker managed to get the logs to print the following and once installed everything worked as intended (after the Javascript cache was cleared).

```
Could not connect to Stripe (https://api.stripe.com).  Please check your internet connection and try again.  If this problem persists, you should check Stripe's service status at https://twitter.com/stripestatus. Reason was: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?

```
> 1 votes

---
Tags: payment-processor
---


# Question
Title: Getting an error 500 (PHP memory allocation) when adding event participant
We've got a 4.6.10 CiviCRM site which has been running without fuss for a while. Now, when adding an event participant, we get an error 500. The process of adding the participant works fine (they appear in the list of participants) but the receipt does not get sent out and the page never returns. In the Apache error log, I see the following :

Allowed memory size of 536870912 bytes exhausted (tried to allocate 474218496 bytes) in /var/www/html/sites/all/modules/civicrm/CRM/Core/Error.php on line 550

The memory limit was actually 128M but it was increased, just in case. As you might guess, it makes no difference. I decided to set "display\_errors = 1" in my php.ini, but that just gives me a completely white screen without the 500 error displayed.

Any thoughts or ideas on how to figure this one out would be greatly appreciated.

-- Marcel

# Answer
It might be that the pdf receipt format is too complex, try to disable sending them, see if it makes a difference

It's under admin \> setting \> misc

"Attach PDF copy to receipts"

If you need to send the pdf, I recommend you to let civi use a dedicated software to generate the pdf instead of the default (doing it in php, that uses tons of memory), it's a setting in the same page: "Path to wkhtmltopdf executable"

you'll need to install this software on your server.
> 3 votes

---
Tags: civievent, php
---


# Question
Title: Why does the Contribution page amounts appear as a quanity?
The way Contribution Information Page displays The Giving amounts when a contributor can donate any amount is confusing. Please see the attachments for clarity.

# Answer
> 3 votes
It looks like you're using a price set with "Text / Numeric Quantity" price fields. These are designed to give you the option to pay for multiple units of something. For example, you might have a field "number of children to sponsor", where the price is $300. Entering 2 will make the contribution total be $600. People use this for events a lot when someone can buy multiple tickets--it can even increment the attendee total by the number entered.

Now, this type of field is often used as a workaround for the fact that CiviCRM doesn't offer open-ended or "other" amounts in a price set. Implementors will set the price as $1.00, and the number entered is the number of dollars to donate. It looks like this is what is happening on your site.

This works fairly well, but with two caveats. First, you can't do cents: since this is a quantity of $1.00 items, it's restricted to whole dollar amounts.

The second is exactly what you found: the confirmation page, receipt, and so forth display a single $12 line item as actually 12 units of a $1 line item.

There are three reasonable solutions (aside from the obvious but expensive one--building a true open-ended price field type into CiviCRM). The first requires some coding, but nothing too difficult: you can modify the templates to hide the quantity and unit price for these fields, just showing the total.

The second is to not use a price set. Standard contribution pages in CiviCRM allow "other" amounts with no trouble.

The third is to replace them with Select or Radio fields. In most circumstances, donors don't balk at selecting among fixed price options. Sure, you'll have some $12 people paying only $10, but you'll also have some people thinking of giving $22 and selecting $25 because it's closest.

It looks like you have a complex contribution form with lots of fund options for giving, so the second option won't work well for you. Likewise, a ton of radio buttons might be overwhelming if you use the third option. However, with a little creativity and coding, you could design an interface that plays nicely with CiviCRM's limitations here but gives donors a simple workflow.

You could, for example, create select fields with a ton of options (maybe rounded to the $5) but replace each dropdown on the form with a slider. Donors could slide Tithe to $15, Building Fund to $110, and so forth.

---
Tags: civicontribute, price-sets
---


# Question
Title: Drupal's cron job has no access to CiviCRM custom fields (Anon access to custom data?)
We're using a Drupal module (CiviNorth) which hooks into Drupal's cron execution and updates civicrm's records' custom fields.

This has been failing due to the API calls not returning those custom fields.

Enabling the "CiviCRM: access all custom data" for anonymous users appears to make it work, but I'm hesitant to turn it on since I don't know if there's any security implications.

Note: We are not using ACLs in civi though we used to. All have been disabled for a while.

Why would the API return a result for an anonymous user but refuse to show custom fields specifically?

There may be more than one things going on here. I can't tell if this is a bug relating to ACLs or just general confusion with the code.

Can anyone recreate? Any Drupal cron job that fetches custom fields would do.

# Answer
You need to turn on "Access all custom data" for anonymous users for a lot of very popular features (e.g. custom fields for anonymous users in profiles and webform\_civicrm) to work. Someone else can contradict me, but I'm reasonably certain this has no impact on security unless a) anonymous users also have access to contact records, or b) you have custom field sets whose access should be restricted via ACL.

I'm sure there's a way to allow access to custom fields to anonymous users via ACL, but that often strikes me as overkill.
> 4 votes

# Answer
Drupal cron tasks run as the anonymous user per default. Generally the anonymous user won't have much in the way of CiviCRM permissions, so to execute CiviCRM tasks from within Drupal cron, you'll need to switch users in your module's `hook_cron()` method.

Here's Drupal's documentation on safely impersonating another user. If you swap in a `$user` object which has permission, your CiviCRM data access should function. Restore the default `$user` and session data when done to prevent unexpected consequences :)

For Drupal 7, and using user 1 as the user to run CiviCRM tasks as (you might prefer to use a dedicated CiviCRM cron user).

```
global $user;
$original_user = $user;
$old_state = drupal_save_session();
drupal_save_session(FALSE);
$user = user_load(1);

// Take your action here where you pretend to be the user with UID = 1 (typically the admin user on a site)
// If your code fails, it's not a problem because the session will not be saved
$user = $original_user;
drupal_save_session($old_state);

```
> 1 votes

---
Tags: drupal, api, acl, cron
---


title: Search cases - find case by case role

text:
# Question
Title: Search cases - find case by case role
I'm looking for a simple solution to allow staff to search for a case by **Case Role** in addition to **client name**.

currently the search cases screen (civicrm/case/search?reset=1) has only the client name / email or casetype , case status, start/end date.

Allowing to search for contact with a role on the case would have a number of uses. e.g. find all cases supervised by a manager or referred by an external contact (where case supervisor and referrer are case roles)

Any thoughts on the best way to go about this.

thnx

civicrm 4.6.8 drupal 7.39

# Answer
> 2 votes
Try the below steps-

1) Navigate to Search -\> Advanced Search.

2) In Basic Criteria Tab, you can find a dropdown with the label `Display Results as` -\> Select `Cases` in the dropdown input.

3) In Relationship Tab select the relationship type as the role. For eg.- `Case coordinator is`.

4) Optionally type the name in the `Target contact` textbox.

Hit Search -\> Result shows the case list supervised by the contact.

Change the Display Results as to `Contacts` etc as per your requirement for the returned result.

---
Tags: civicase, search
---


title: I don't see any Dashlets

text:
# Question
Title: I don't see any Dashlets
I just installed CiviCRM. Now I wanted to input a Dashlet into the Dashboard.

But when i click on Configure Your Dashboard it shows nothing. I also created a report with the option make available in dashboard. Am I doing something wrong?

# Answer
> 1 votes
Dashlet problems can arise when you have the wrong settings in either

* Cleanup Caches and Update Paths (Administer - System Settings - Cleanup Caches and Update Paths)
* Resource URLs (Administer - System Settings - Resource URLs )

Differences can be as small as http vs https and with or without www.

---
Tags: dashboard, settings, dashlet
---


# Question
Title: PROBLEM>> The Profile Redirect URL is Limited to One Setting for Multilingual Site
I have not found a solution to this as of yet and I scoured through here first with no answers. Anyways, I have a multilingual Wordpress website (www.gcmf.ca) using the WPML plugin to manage between English (default) and French. I am using CiviCRM profile forms to "walk" the logged in members through a renewal process. When they fill out the first page and click the Save button, it redirects them to the next page to fill out. This works beautifully for English!

The problem happens when French is selected and they save the form. Since there can only be one URL entered in that Advanced field, it takes them to the next page, but it's in English. They have to manually select French again. The path for English looks something like… “https://gcmf.ca/some-web-page/” and for French… “https://gcmf.ca/fr/some-web-page/”. So you can see my dilemma.

Does anyone have ANY suggestions? I'm going to ask the users over at WPML to see if a language can be set by other means rather than using a language specifier in the URL. That could solve the problem. Also, from the CiviCRM side, I am wondering if there is a work around even if it involves a little code behind. I am not a PHP programmer though and my skills in that area are very limited.

Ideally for the future, a nice feature would be to allow multiple values for the two redirect fields based on the language just like you can for the individual profile field labels and help text.

Any help would be GREATLY appreciated!

Kindly, Rick Monyer

# Answer
> 1 votes
I am not familiar with WPML, but what I normally do with multilingual sites is that I add one profile per language, that way you can also create the field labels as you want.

That way you can set the redirect URL as you want.

In WordPress you can then use a different shortcode per language to embed the profiles.

---
Tags: profile, urls, redirect
---


# Question
Title: entityRef widget seems to not respecting params
Whatever has been tried, this code doesn't restrict entityRef widget output according to desired parameters:

```
$selection = array(132, 168, 169);
$sa_custom_props = array(
  'api' => array('params' => array(
   'contact_type' => 'Individual',
    'id' => array('IN' => $selection)
  )));
$form->addEntityRef(
   'related_contact_id',
    ts('Contact'),
     $sa_custom_props
 );
}

```

It happens at an attempt to override current contacts select widget at "Add Relationship" (CRM\Contact\Form\Relationship.tpl&.php pair) form, if it matters. Any piece of advice is highly appreciated, thanks!

# Answer
The entityRef widget uses the 'getlist' API action, so you can test it out by going to the API Explorer (in the Help or Support menu under Developer, or if you go to the CiviCRM path "civicrm/api/explorer").

* Select `Contact` as the Entity and `getlist` as the Action.
* Pick the Parameter `API Params`, and set the value to `{'contact_type': 'Individual', 'id': {'IN': [132, 168, 169]}}`.

See what you get--in theory, that should just return those three contacts. If so, your problem isn't the parameters; it must be the way your form is customized.

The code presented here looks good. However, are you sure you removed the field you are replacing? To replace a QuickForm element, you should remove the old one and generate a new one in its place. To remove the old form, add this to the top of your code:

```
$form->removeElement('related_contact_id');

```

and then add the field.

**An alternative method:** since you're just replacing an existing entityRef field, it might be more efficient to just modify the API parameters. The following Javascript might do the trick:

```
// Get rid of the old entityRef:
$('#related_contact_id').crmEntityRef('destroy');

// Generate a new entityRef:
$('#related_contact_id').crmEntityRef({
  api: {
    params: {
      contact_type: 'Individual',
      id: {IN: [132, 168, 169]}
    }
  }
});

```
> 1 votes

---
Tags: api, developer, entityref
---