# Question
Title: How Can I Attach a PDF Certificate for a Membership Payment?
On Drupal 7.35 / Civi 4.4.14 - is it possible for a membership payment via CiviContribute to e-mail a membership certificate as a PDF as an attachment to a receipt?

What we currently do is print membership certificates and post them, however the intention is to move to e-mailing them. I already have the template certificate stored as a mailing message template which comes out nicely when printed on A4.

# Answer
> 4 votes
I don't think it's possible right now without coding.

If you are not afraid of coding, what you could do is something like :

1. add you membership certificate after the content of the receipt (in templates) and add an arbitrary separator between your receipt and the certificate. In my case `<!--break-->`.
2. use the hook\_civicrm\_alterMailParams with the following content (extract the part after `<!--break-->` and put it in a pdf as a attachment) :

```
$pos = strpos($params['html'], '<!--break-->');
if ($pos !== False) {
  $pdf_content = substr($params['html'], $pos + 12);
  $params['html'] = substr($params['html'], 0, $pos);

  if (empty($params['attachments'])) {
    $params['attachments'] = array();
  }
  $params['attachments'][] = CRM_Utils_Mail::appendPDF(ts('Membership certificate') . '.pdf', $pdf_content);
}

```

I may create a little extension for this.

# Answer
> 1 votes
This would be two steps as far as emailing it, but you could build the certificate as a "PDF Letter" template. You might need to do some HTML and tokens, but no other coding.

Every day, week, or month (whatever your schedule), you can search for new members (Memberships \> Find Memberships). From the results, pick the first, and in the Actions drop-down, select "Print PDF letters for memberships". You can pick the certificate template you made (or you can create it on the spot with the first member), and it'll generate a PDF. Save the PDF and attach it to an email to the member. You can then repeat it member-by-member.

It would be great to have an easy thing like Samuel describes, because that would be one step instead of two, but this would work in a pinch.

# Answer
> 0 votes
If you do the work to produce an email with the certificate as an attachment then you can use a scheduled reminder to send the email a day or so after the member signs up or renews.

---
Tags: civicontribute, pdf, civimember
---


# Question
Title: Why do Personal Campaign Pages stay live after their Contribution Page is closed
I'm working with someone who posed the following question to me:

> Why do personal campaign pages stay live, even following the closing date for the contribution page they are attached to? How do I make it so they automatically turn off when the contribution page does?"

Any ideas?

# Answer
Joe says it's a bug; I say it's a feature! If you have donors fundraising for you, you might not want to have their writeup and list of donors disappear when the campaign is over. Something elegant ought to be done to have the PCP still visible, the contribution page disabled, and not have it seem like the link is broken, however.
> 2 votes

# Answer
If true, it seems like a bug. Try replicating on demo site and then file an issue.
> 0 votes

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


# Question
Title: How to use API chaining to create a contact and a relationship
I've read all the docs I could find, the code examples, the 4.6 explorer, but I'm not grasping one piece. Below is code to create a new adult contact (via profile submit, to get some extra validation for free), and multiple student contacts, each with a relationship to the adult. When chaining the relationship piece, what goes into contact\_id\_a and contact\_id\_b?

Here is the error result, calling code is at the bottom of this post:

```
Array
(
    [error] => Error in call to Profile_submit : Error in call to Relationship_create : contact_id_b is not a valid integer
    [error_code] => 2001
    [error_data] => Array
        (
            [error_field] => contact_id_b
            [type] => integer
            [error_code] => 2001
            [entity] => Profile
            [action] => submit
            [is_error] => 1
            [error_message] => Error in call to Profile_submit : Error in call to Relationship_create : contact_id_b is not a valid integer
        )

)

```

Edit: updated the code to better reflect what I'm trying to do, please see the comments on the innermost calls to create relationships:

```
  //build array of student details
  $student_profiles = array();
  foreach ($_POST['student_details'] AS $student_record){

    $student_profiles[] = array(
          'sequential'  => 1,
          'profile_id'  => 14,
          'first_name'  => $student_record['student_first_name'],
          'last_name'   => $student_record['student_last_name'],
          'gender_id'   =>  $student_record['gender_id'],
          'birth_date'  => $student_record['birth_date'],
          'allergies'   => $student_record['allergies'],
          'api.Relationship.create' => array (
                  'sequential' => 1,
                  'contact_id_a' => '$value.id',  //is this the valid contact ID of the student profile we just submitted?
                  'contact_id_b' => '$value.api.Profile.submit',  //how do i fix this to get the Profile.submit id from the parent's record?
                  'relationship_type_id' => 1,
                  'is_permission_a_b' => 0,
                  'is_permission_b_a' => 1,
                ),
         );
  }

    //build parent details and attach student detail array
    $parent_profile = array(
      'sequential' => 1,
      'profile_id' => 14,
      'first_name' => $'first_name',
      'last_name' => $'last_name',
      'api.Profile.submit' => $student_profiles,
    );

    //submit the main profile with all chained items
    try {
        $parent_result = civicrm_api3('Profile', 'submit', $parent_profile);
    }
    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);
    }

```

# Answer
I believe it would be '$value.id' (ex. https://github.com/civicrm/civicrm-core/blob/master/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php). Basically, '$value' can be used to reference any values added by the parent api call.

Also, to your question about sanitization, the values should be sanitized. However, I would recommend using CRM\_Utils\_Request::retrieve() to get the submitted values from the request rather than $\_POST as it does some extra sanitization work.
> 3 votes

---
Tags: api, chaining
---


title: How do I test a CiviCRM upgrade script?

text:
# Question
Title: How do I test a CiviCRM upgrade script?
I have a PR that adds a file CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl. How should I go about testing this code?

# Answer
If you have installed civicrm-buildkit and configured civibuild, then you can use the tutorial steps at Daily Coding: Upgrade Tests.

If you don't use civibuild, then you can piece-together a similar workflow using civicrm-upgrade-test.

For more discussion about writing upgrade logic, see Upgrade Reference on the wiki.

For a general, high-level overview of automated tests (including upgrade tests), see Testing on the wiki.
> 10 votes

---
Tags: sql, developer, upgrade
---


# Question
Title: What to do when upgrading from 4.3.4 to 4.6.0 is failing?
I loaded a new 4.6.0 database with data dumped from a 4.3.4 database. The update ran okay to a certain point, when I got this message:

```
*[Error: Upgrade DB to 4.6.alpha7]
Error Field Error Value
Type    DB_Error
Code    -1
Message DB Error: unknown error
Mode    16
UserInfo    ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
DebugInfo   ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
PEAR_Exception: DB Error: unknown error in unknown on line unknown
- DB_Error: DB Error: unknown error in unknown on line unknown*

```

# Answer
> 5 votes
If I understand correctly, you first installed 4.6.0 and then loaded a DB dump for 4.3.4 on top of the 4.6.0 system. Doing so would put the database in an inconsistent state — some elements from 4.6.0 (e.g. the table `civicrm_mailing_abtest`) are still present, but other elements are replaced by the 4.3.4 version (e.g. the table `civicrm_domain`).

When loading an old database dump, ensure that you are loading into a pristine database. The easiest way is to drop+recreate the database before loading.

If for some reason that's not possible (eg the database is shared with another app whose data must be preserved), then you might drop all `civicrm_*` tables (and preserve the other tables). The exact steps will depend on your tooling. I can't speak about any GUI tools, but if you're comfortable with scripting, then you could ripoff this snippet from setup.sh.

```
echo; echo "Dropping civicrm_* tables from database $DBNAME"
echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'VIEW'" \
    | $MYSQLCMD \
    | grep '^\(civicrm_\|log_civicrm_\)' \
    | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop view " $1 ";"}' \
    | $MYSQLCMD
echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'BASE TABLE'" \
    | $MYSQLCMD \
    | grep '^\(civicrm_\|log_civicrm_\)' \
    | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop table " $1 ";"}' \
    | $MYSQLCMD

```

# Answer
> 3 votes
Try importing the "drop everything" file from the CiviCRM tarball in `sql/civicrm_drop.mysql` to remove all 4.6.0 tables from your new database. Then re-import your 4.3.4 database. Then try the upgrade.

---
Tags: database, upgrade, 4.6.0
---


# Question
Title: Why am I getting no values when using REST api?
I've mainly used the php apis in the past but I would like to use the REST API. I added an api key to the contact record, and I attempted to use the really simple example in the documentation. Yet I just keep getting

`{"is_error":0,"version":3,"count":0,"values":[]}"`

I'm using really simple examples like

`entity=Contact&action=get` (of course with the base url and rest.php? and then the keys at the end). I'm pretty sure the url is right since it says there is no error (and if I change things I definitely get an error response). If I use the php api I get data, so it's not that there is no data.

Update 2

Actually I think I was wrong about at least where the problem is because clearly the checking for a valid CMS user record is happening. If I use a url like this:

http://example.com/administrator/components/com\_civicrm/civicrm/extern/rest.php?entity=Contact&action=get&group\_id=6&options\[limit\]=25&options\[offset\]=50&json=1&key=4d0b3527f437210aa4479ca8fa4936eb&api\_key=654321'

I get (along with a good apache response) `{"is_error":0,"version":3,"count":0,"values":[]}`

However if I add a `var_dump($apiResponse);` right before the return in run() in Civi\API\kernel.php I definitely get the data and count is not 0. And that array comes through just fine to \api\api.php. So whatever is going wrong is happening somewhere after that.

# Answer
> 5 votes
This is going to be a fuller answer eventually but for right now it is a partial answer that addresses how to get publicly available data via REST.

The REST API works differently than the PHP or other versions of the API. Some of this is documented and some is not.

The most important difference between the rest API and the others is that the REST API does not instantiate an authenticated user as the current user in a Joomla! environment. Therefore it cannot use any of the Joomla access controls when determining what data to provide or what actions to allow. Also because the current user is not an authenticated user, CiviCRM roles (such as the default `Authenticated User` and `Administrator`) are not available. Therefore the only role that is available is `Everyone`.

However this does not literally mean that everyone (in the sense of the unregistered public) can see. This is because there must be a contact record with an api\_key value and a registered Joomla user associated with that contact.

This also does not mean that Everyone can see everything. An ACL record still must be created. That is you must create ACL for each kind of data that you want to have accessible to the REST interface.

For `GET` the basic approach should be to create a group that contains the records you want to return. Call this, for example, MyGroup. To reiterate: *This is not the group of users who have access to the interface, it is the group of users about whom data will be returned.*

In the ACL interface click on Manage ACL.

* For Role: Everyone
* Action:View
* Type of Data: A group of contacts
* Group: MyGroup

These settings will allow you to use the REST interface to return data on one or more users in the MyGroup group, with data based on the URL you craft.

If you have a Joomla front end and you want to access a list of contacts via the rest interface you need to include a number of steps. This includes reading the keys, crafting the URL, and creating the request.

1. If you have a civicrm.settings.php file you can obtain the site key with the following code:

```
require_once JPATH_ROOT . '/administrator/components/com_civicrm/helpers/api.php';
CivicrmHelperApi::civiInit();
echo CIVICRM_SITE_KEY;

```

However, if you don't have access to the helper you can just `require_once` the settings file and that will define the site key constant.

2. You also need to to access the individual user level API key. Most likely it would make the most sense to to store that in a file locally and read it in. Call that `CIVICRM_API_KEY`.
3. Then you can craft a request url, which will have three parts, the base, the api parameters, and the keys.

```
// Of course this should be https if possible.
$restbase  = 'http://example.com/jooomla-cms/administrator/components/com_civicrm/civicrm/extern/rest.php?';
$restkeys = '&key='. CIVICRM_SITE_KEY .  '&api_key=' . CIVICRM_API_KEY;
$restvars = 'entity=contact&action=get&json={"sequential":1,"return":"first_name"}';

// Make the request
$http = new JHttp();
$return = $http->get($restbase2 . $restvars  . $restkeys);

// Do something with the data
$body = $return->body;
$values = json_decode($body)->values;

foreach ($values as $value)
{
    echo '<div>' . htmlspecialchars($value->first_name) . ' </div>';
}

```

Some notes

There are many combinations of actions and entities which cannot be created in the ACL settings.

Depending on what you are envisioning you may want to create a Joomla user to be the one that provides access or you could register a user for each application that will be allowed to access publicly available data via the REST API.

These include most post and delete actions. In these cases there is sometimes checking of specific Joomla permissions such as access Civicrm but it does not work as expected. At least at this point the authorization process always returns false unless you have given the public permission to do these things via Joomla ACL. Not a good idea.

**Update**

I sent a pull request for a fix for this so that now permissions will be checked. You can apply this as a patch and it will work the way the documentation says (or at least it has been for me -- would love a few people to test it).

# Answer
> 0 votes
It sounds like mod\_rewrite is overzealously configured. You can edit your Apache(?) redirect, either in your .htaccess and/or your .conf files. You can add a command like:

```
RewriteCond %{REQUEST_FILENAME} !-f

```

And that says not to do rewrites below it if the exact path you're requesting resolves to a file that exists. That way, your request is never redirected to Joomla. See here for further documentation.

---
Tags: api, joomla
---


# Question
Title: How should I add sign up forms into 3rd party sites?
Our install is on Joomla, but Civi newsletter signup forms are needed also on other sites. They use everything from manual HTML (etc.) to other CMS platforms. How can I add group sign up forms to them?

The Civi book suggests using profiles and they do have a HTML generator. However the code it produces both doesn't work and the generator itself is not maintained (according to the core team), so it appears there is no out-of-the-box solution for integration into other hosts since 4.5.

What have you used, done in such situations? Please be explicit.

# Answer
1. Non-programming approach: Use HTML Snippets for the profile. If it is not working according to documentation in book it might be that a) the documentation needs to be updated, or b) there is a bug in this functionality, or c) there is a bug in the custom page that includes the snippet. I would expect that c), b) and then a) are the likely order of solving this.

NB: when using HTML Snippets, you should ensure that permissions to create all the objects needed for the form (eg custom fields, contacts, etc) are available to an anonymous user.

2. Programming approach: a) If you are doing this to allow one other site to callback into CiviCRM, then I would have it call CiviCRM's API via REST - http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API#UsingtheAPI-REST. b) If you are expecting to reuse the form in multiple other sites, then I would create an iFrame via your CMS and include the iFrame from the other sites. The iFrame itself would still need to use the external services protocol at the above link rather than AJAX since in general it will not have logged in before posting.
> 7 votes

# Answer
We have implemented a newsletter signup form into a static non-drupal page by using profiles. The profile generator actually works quite well (using CiviCRM 4.4) but the resulting form is kind of overloaded. But you can break down the markup to a simple form:

```
                <form method="post" action="https://example.com/civicrm/profile/create?gid=12&reset=1">
                    <div>
                            <input type="hidden" value="" name="postURL"> <input type="hidden" value="https://example.com/civicrm/profile?reset=1&gid=16" name="cancelURL"> <input type="hidden" value="Edit:cancel" name="_qf_default">
                    </div>
                    <ol>
                            <li>
                                    <label for="email-Primary">E-Mail: *</label> <input type="text" class="email required" id="email-Primary" name="email-Primary" size="20" maxlength="64">
                            </li>
                            <li>
                                    <label>Newsletter: *</label>
                                    <div class="input-group">
                                            <input type="hidden" value="" name="group[8]"> <input type="checkbox" value="1" name="group[8]" id="group_8"> Cooking recieps<br>
                                            <input type="hidden" value="" name="group[7]"> <input type="checkbox" value="1" name="group[7]" id="group_7"> Cats<br>
                                            <input type="hidden" value="" name="group[9]"> <input type="checkbox" value="1" name="group[9]" id="group_9"> Dogs<br>
                                    </div>
                            </li>
                    </ol>
                    <div class="actions">
                            <p>
                                    <input type="submit" value="Sign up" name="_qf_Edit_next" class="button">
                            </p>
                            <p>
                                    <small>* required</small>
                            </p>
                    </div>
            </form>

```

The group inputs are part of a checkbox list and the index inside the name array represents the CiviCRM group id (e.g name="group\[8\]"). The form action url and the hidden cancelURL input are containing the profile id "gid", which you have created in CiviCRM before.

The profile itself has to be a "Standalone Form or Directory" and be marked as "active". Of course it is containing active fields for contact groups and primary e-mail. The groups have to be of type "mailing list" and visible for public pages.
> 6 votes

# Answer
I have implemented this as a resource for an IFRAME. My implementation was in Drupal not Joomla and just used the CiviCRM API.

So I built a simple app in Drupal that took a mailing list Id on its URL, checked that this was one that allowed public sign-ups, built and validated the form and then used CiviCRM's API to add the records.

Then other sites simply included that as an IFRAME.

This obviously required coding skills, but if you have those then using the API is a great way to be able to make it work just-so, regardless of the quirks your organisation requires (e.g. different themes for different sites).
> 5 votes

# Answer
You might want to check out the CiviWCI extension. It's still in beta format - and when I tried it on Wordpress, I found a hard-coded URL that assumed Drupal. It's designed for this situation though.
> 5 votes

# Answer
In principle you can use the REST api to get the form and submit it.

Also if you want to do the iFrame idea, make a link to the profile with `&tmpl=component` at the end, which gives you the page with just component and no module. Then you can use that url for the iFrame.
> 2 votes

---
Tags: civimail, profile, forms, 4.5
---


# Question
Title: How to register for event without an email address?
Sorry for such a brain dead question but we have people that want to register for our events that have no email address. Hard to imagine in this day and age but it happens. A lot of our contacts are old and not up with all the newfangled internet stuff. I have set up an event registration form that works very well for most, but requires email address. I have googled "civicrm register event email address" and not found anything specific on this issue.

# Answer
Make email address field not-required on the profile you include on your event online registration form.

If the registering participant does not provide an email address, you could get duplicates in your CiviCRM contacts. See this warning:

> Duplicate Matching Impossible The selected profiles do not contain the fields necessary to match registrations with existing contacts. This means all anonymous registrations will result in a new contact.
> 6 votes

# Answer
Civi requires either a last name OR an email (plus a first name), so make sure the profile on your event registration form doesn't make email required.
> 1 votes

---
Tags: civievent
---


# Question
Title: Has CiviCRM ever undergone formal usability testing?
Drupal 7 was put through formal usability testing at the University of Minnesota's excellent Usability Services Lab.

Has CiviCRM ever been through such a process? If not, I would be interested in facilitating this, as I work at the University of Minnesota and have access to this lab.

# Answer
No, it hasn't.

The National Democratic Institute (NDI) did a bit of less than proper formal usability testing: https://www.nditech.org/blog/2014/08/testing-one-two-three with details of process at https://nditech.org/blog/2014/07/test. Their focus was on their staff using it for their specific purposes, so the results were skewed, and led more to tailoring for their specific needs than general usability improvements (see https://www.nditech.org/demtools/civiparty).

It would be A VERY GOOD THING to get formal usability testing for front end, back end, and admin/configuration workflows and forms. We should conceive of this as an on-going process, rather than a one time initiative if that is possible on your end. We would need to find resources to rework things in response to recommendations. It might be that 5.0 or 5.1 would be a good version to start incorporating feedback.

The Drupal testing was great and was taken very seriously by the core developers, which was essential to getting the resources to really change things for the better. The regret I had was that the testing was limited to what to do with a basic install; reasonable as a start but it didn't end up addressing and thus mobilizing resources to address the problem of staff usability doing daily work with a 'normal' Drupal installation that includes lots of contrib modules. This is a major reason why I am seeing organizations migrating from Drupal to WordPress when they redevelop their websites - the usability for experienced staff during on-going operations.

With CiviCRM the core functionality is much more extensive, and the extension ecosystem not quite as crucial to the daily staff workflows on a typical installation (at least at the moment). So I think it would be more feasible to do testing of representative workflows on core CiviCRM. I don't know enough about usability testing protocols to know how reasonable it is to focus on usability for experienced staff users in addition to the new users and the learning curve they face as either new staff people or as folks just trying to donate or signup or buy a ticket.

THANKS for the offer. Please get in touch with Coleman and Dave about this.
> 5 votes

# Answer
CiviMobile received formal usability testing, but was never really completed as a project. It's referenced in passing here: https://civicrm.org/blogs/petermcandrew/civimobile-where-we-go-here. He gave an overview of the user testing process (which included eye-tracking hardware) at a presentation during the 2011 CiviCon North America sprint.
> 1 votes

---
Tags: ux, usability, ui
---


# Question
Title: How to decide between using a custom Relationship and using a custom Contact Reference field?
This is admittedly open-ended any may just depend too much on use-case. I am looking for advice on when it is preferable to create a custom **Contact Reference** field instead of just creating a custom relationship.

If you have an example of a situation where you chose one over the other, that would be helpful.

# Answer
## Relationships

* Can be used to give permissions between contacts
* Have a start & end date
* Can attach notes & additional custom data
* Can be displayed as advanced search results

## Custom contact reference fields

* Can be added to a profile form
* Can be displayed in its own tab or section of the contact summary page
* Customizable autocomplete filters for limiting which contacts are selectable

## Both

* Can be added to a (drupal) webform
* Are searchable via advanced search
* Could be the basis of a smart group
* Can be used in a report (although custom fields are in all reports whereas relationships are only in certain reports)
> 3 votes

# Answer
In my experience, I default toward relationships, but might use a custom reference field in these situations:

* I need to export multiple people with the same relationship. For instance, if Andy and Beth both have a "Mentor of" relationship to Johnny, you can't export Johnny's record showing both mentors. So I'll make two contact reference fields.
* You need to create a form where a site visitor needs to specify an existing contact. For instance, if new members must be referred by existing members, you may want them to be able to submit a profile that indicates who the referring member is. If you use Webform-CiviCRM Integration, I think you can do this with a relationship, but otherwise, you need a contact reference field.
> 3 votes

---
Tags: custom-fields, relationships, architecture
---


# Question
Title: Can I add non-contact fields (such as membership, contribution, relationship, etc) in bulk emails?
I want to add fields from other modules, such as membership,contributions, relationships etc in bulk emails? I don't know php so I hope I can put the field name inside {}.

Is this possible? If so, how do I know what the full name would be? Thanks

# Answer
The short answer is "not without extensions". It would be difficult, for instance, to say exactly which of a contact's many contributions you want to pull data from.

That said, other users have created extensions that give you many of the most commonly needed tokens. Check out the Summary Fields, Contributions Table, and Eileen's custom tokens, in that order.
> 4 votes

# Answer
You might want to try Find Participants and then send email to contacts, or similarly Find members or Find contributions, then use Smarty variables for the component core and custom fields as I suspect there are no tokens coded yet. If this doesn't yet work it should be fairly easy to add.
> 0 votes

---
Tags: templates, tokens, email
---


# Question
Title: Pull data from Drupal entity reference field into CiviCRM?
I'm using Entity References and CiviCRM Entity to create some limited silent auction functionality.

* In CiviCRM, I have an "In-Kind" contribution type with some custom fields for each donation of an item to be auctioned off.
* In Drupal, I have an "Auction Package" content type for each group of one or more items that will be purchasable at auction.
* I created an entity reference field in the auction package so that you can select which items are part of each package. (So you could combine, say, a hotel's gift of a one-night stay with a restaurant's donated gift certificate.)

So I've figured out how to pull CiviCRM information into Drupal. But is there a way to leverage the entity reference field in reverse to pull info from Drupal back into CiviCRM? I'd like to have a reference field in the contribution, or record the package number from the Drupal entity in the Civi contribution. How can I do this?

Note: This is a new system, and I'm fairly new to CiviCRM, so I'm open to doing things differently if reworking anything about the way I have this set up would make this work better.

# Answer
> 3 votes
One possibility would be to use views module to create a view that displays auction package nodes, with a contextual filter for the contribution reference field. Then you provide a block display and configure the block to show on contribution pages; it should show the package that is referencing that contribution.

This doesn't pull any Drupal entity data into the CiviCRM database, but it should allow you to *display* the entity data for the auction package that is referencing the contribution.

Often times it is ideal to keep the Drupal entities in Drupal and the CiviCRM entities in CiviCRM and connect them using reference fields. You should still be able to display them side by side on the same page (using Views) in virtually any context or use-case.

# Answer
> 3 votes
This is a great question and frankly I've found it challenging to "seamlessly" integrate Drupal and Civicrm. I have successfully used the Drupal Rules module and Civicrm Entity to make Civicrm updates. Alternatively, you can use the rule module and a PHP snippet to invoke the Civi API and make the update.

The civicrm\_entity / rules approach does not let you load multiple entities directly but you can use multiple referenced drupal entities.

Civicrm\_entity can also write fields directly but you would have to write some code to edit the entity.

# Answer
> 3 votes
So my understanding of your use case is that you want to record in the back end in-kind donations related to items to be auctioned off in bundles. I assume that each item has its own valuation, and that you are mainly interested in getting a custom field on the contribution to reference an item. (I would guess the bundles of items are the sales side of the auction, and that multiple in-kind donations can be dealt with through separate contributions for each item.) Setting up contribution pages and price sets to reference the items in order to expose the items for auction would be something else again.

I would make the custom field an integer, then in code on buildForm hook for the relevant form I would create a select widget that looked up the Drupal entity. If there were budget to improve usability in a minimal fashion I would add a link beside the field that creates a popup form to Add the Drupal entity, and on form close I would refresh the select lookup values. On view custom code needs to convert entity id into entity title or something, maybe an image and caption. If the value of the item is stored in Drupal then when it is selected I would use it overwrite the line item value in CiviCRM.

A similar process could be used to link the donations corresponding to winning bids to the bundle entities that were won.

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


# Question
Title: Since upgrade, dompdf.php is presenting a security risk?
Upgraded to 4.5 a few weeks back on Joomla 3.3.6 and everything is working fine, except for a warning that I see when I first access CiviCRM. Reads:

> Security Warning File `/home/[directory]/public_html/administrator/components/com_civicrm/civicrm/packages/dompdf/dompdf.php` presents a security risk and should be deleted.

Any idea what's causing this and what the proper way to address it might be (short of deleting the file)?

# Answer
You can (and should) resolve this by removing that `dompdf.php` file from your system. It sounds like the previous version codebase was not removed during your most recent upgrade.

CIVI-SA-2015-001 was a security release which removed `dompdf.php` from the CiviCRM installation, as it permitted attackers to read arbitrary files from your webserver. This permits an attacker to retrieve the contents of files they would not normally be permitted to view - even system configuration files.

CiviCRM upgrade instructions advise to back up and then delete previous version code files before installing the new CiviCRM codebase, since leaving old code files in place may affect the behaviour of CiviCRM (and in cases like this, the *removal* of a file is the fix required).

A full list of recent CiviCRM security advisories is available at https://civicrm.org/advisory, and CiviCRM site administrators should sign up for security upgrade notifications
> 5 votes

---
Tags: security
---


title: How should one pronounce CiviCRM?

text:
# Question
Title: How should one pronounce CiviCRM?
How do you pronounce civicrm when speaking to others? Is it "civi" or "civik-c-r-m?

# Answer
> 11 votes
CiviCRM: *Sih-Vee See Ar Em*

Civi (for short): *Sih-Vee*

# Answer
> 3 votes
Sih-Vee-See-Are-Em. In a perfect Toronto accent. ;) https://english.stackexchange.com/questions/207687/how-are-you-supposed-to-pronounce-fragile/207688#207688

More seriously, as the CRM is always pronounced See-Are-Em, there is no 'C' left at the end of CiviCRM to justify a hard k sound at the end. So for me, there is no way to make CiviCRM sound like Civic-CRM.

Though come to think of it, Civic Relationship Management does have a nice twist to it. ;)

# Answer
> 2 votes
CIV-ee-see-are-EM

(capitals for emphasis)

# Answer
> 2 votes
Sih Vih See Are Em, but Sivee for short

Nobody looks at you funny for saying Sivee See Are Em, but like lynxlynxlyxn says in the comment on Shawn's answer, it comes from "civic": CiviCRM is a portmanteau of civic and CRM.

# Answer
> 2 votes
Start with **Civi** (however you pronouce that) and then speak the letters **C R M** (however you pronounce those) and you can't go wrong.

And if CiviCRM is too many syllables (or you want to get affectionate) shorten it to **Civi**.

I don't want to get all dogmatic about it but IMO some people mistakenly say "**Civic C R M**" (with an extra C) or "**Civic R M**" (moving the C from the start of CRM to the end of Civi).

Having said all that, we are an easy going and also a very diverse bunch of people from around the world, hence we don't worry too much about pronunciation and are happy for our name to get 'localized'.

Some silly pronunciations that I sometimes use for fun include "**CiviCream**" and "**CiviCrumb**" :)

# Answer
> 0 votes
For local use I also use our locale's way to pronounce abbreviations and initialisms, in this case transliterated to:

TSEEVEE TSuh Ruh Muh (`uh` representing the schwa, Simpsons-style)

---
Tags: best-practice
---


# Question
Title: How to restrict access to only one Contribution Page
Drupal 7 / CiviCRM 4.5.8 Working on a site which has several contribution pages. We want to leave the majority of them accessible to anonymous users, but have just one that we want to restrict to "members-only".

In Drupal the $form variable passed in hook\_form\_alter() will have a '#access' parameter that can be set to false.

What's the best way to accomplish this with a CiviCRM form? Is there something that can be modified in the $form variable using hook\_civicrm\_buildForm()?

Some better way?

# Answer
Here's a quick and dirty drupal-ly way of doing it, but I still wonder about a CiviCRM specific methodology.

```
function civicrm_custom_access_civicrm_buildForm($formName, &$form) {
  global $user;

  $grant_access = 0;
  foreach($user->roles as $key => $role_name) {
    if($key == 3 || $key == 5 || $key == 4 || $key == 6 || $key == 7) {
      $grant_access = 1;
    }
  }

  if($formName == 'CRM_Contribute_Form_Contribution_Main' && $form->_id == 2 && !$grant_access) {
    drupal_access_denied();
    drupal_exit();
  }

}

```
> 3 votes

---
Tags: forms, contribution-page
---


title: Edit address using webform and views

text:
# Question
Title: Edit address using webform and views
Searched diligently before posting this but couldn't find an answer.

I'm working on a webform/view combo to edit contact's addresses.

I'm having trouble figuring out how to pass the location id in the url to the webform.

If I use node/(webform node number)?cid2=\[id\] it opens the webform with the primary address which works fine if contacts only have one address in the system.

Is it possible to pass the location id in the url for the webform?

# Answer
The short answer is "no". Location types are handled in a very simple/dumb way by webform integration. When it looks up a contact it simply pulls all addresses (primary first, otherwise in no particular order) and populates address fields with them in order, and with no respect to location type settings for those fields (so the suggestion of pulling a default from $\_GET wouldn't help you I'm afraid).

There is an open issue for improving this if you'd like to contribute.
> 3 votes

# Answer
You have to set that in the "CiviCRM" tab of the webform, when you add the field to the form (or choose "User select" for the "Address Location") here:

You may be able to allow this to be set via the URL with some combination of "User Select" and the webform component's "Default value" (if you can add a $\_GET variable as the default).

I believe that the first address field is always designated as primary in Webform CiviCRM at the moment (hard-coded/non-configurable).
> 1 votes

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


# Question
Title: Can I use multiple values in an api Get call?
For example, can I use a single api call to get all the contributions from contact a and contact b. My actual need is to get contributions from the contact and any related contacts, but I assume I need to do that as a previous step, which is done.

# Answer
> 6 votes
Yes, I just used the new API explorer in 4.6 and got a sample PHP call:

```
$result = civicrm_api3('Contribution', 'get', array(
  'sequential' => 1,
  'contact_id' => array('IN' => array(58, 25)),
));

```

---
Tags: api
---


# Question
Title: How do I send to Multiple Email Addresses for a contact in CiviMail?
Is there a way to configure CiviCRM so that it will send emails to all email addresses on a contact record?

If not, then how do you best utilize multiple email addresses on a contact (individual, organization or household)?

# Answer
Yes! Go to /civicrm/admin/setting/preferences/mailing and check "Enable multiple bulk email addresses for a contact". Then check the boxes for all of a contact's addresses that should be included in a bulk mailing.

You can also reach this settings page from **Administer menu \> CiviMail \> CiviMail Component Settings**.

It's only available on relatively recent versions of CiviCRM (4.5+ if my memory serves me right)

Note that multiple email addresses for a single contact are still useful, even when the 'Enable multiple bulk email addresses for a contact' box is not checked. In this case, the flow is as follows:

CiviMail will attempt to email the primary email or if no email is set as primary, the first email it encounters. If CiviCRM receives a bounce report from this email, it may decide to put the mail on hold (depending on the type and quantity of bounce reports received). Next time CiviCRM sends an email to this contact, it will ignore the on hold email and attempt to send to the next email address for that contact (if any exists).

Multiple email addresses on one contact are also useful to avoid duplicate contacts, e.g. if a contact sometimes uses a home address and other times a work address.
> 19 votes

---
Tags: civimail, email, configuration
---


# Question
Title: How do I fix error with the new (4.6.0) Drupal views image handler for CiviCRM contact images
Just upgraded to 4.6.0 and now I see that the `CiviCRM Contact Image` field in Drupal views now uses the views image handler! Awesome! Prior to 4.6 it was just a string containing a URL to the image. Thanks to @Shawn Duncan for his efforts and contribution.

However, I can't get it to work. The image URL it produces gives a `404`

Example URL that returns 404:

`http://example.com/sites/example.com/files/example.com/civicrm/contact/imagefile%3Fphoto%3Dmbd_logo_01cf3f5560578c6554b9ba009f6b42b7.png`

But the actual working URL to the file is:

`http://example.com/sites/example.com/files/civicrm/custom/mbd_logo_01cf3f5560578c6554b9ba009f6b42b7.png`

So it's inserting an extra `example.com` after the `/files/` and it's using this `/contact/imagefile%3Fphoto%3D` instead of the actual path to my custom uploads.

---

\[Edit\]

Using Drupal image presets is broken in 4.6 since at least 4.6.6; if you select an image style in Views, it mangles the URL to something like

`<img typeof="foaf:Image" src="http://styles/medium/http/example.org/civicrm/contact/imagefile?photo=bsglogo_49524b829beb4448767ee75a42f2dcc0.jpg&itok=dGLXdcig" width="220" height="220" alt="" title="">`

Is there a suitable workaround?

# Answer
> 3 votes
Your site is affected by CRM-16009 - URL for Contact Image in View incorrectly generating.

That URL should look like this -

```
http://example.com/civicrm/contact/imagefile?photo=mbd_logo_01cf3f5560578c6554b9ba009f6b42b7.png

```

rather than this -

```
http://example.com/sites/example.com/files/example.com/civicrm/contact/imagefile%3Fphoto%3Dmbd_logo_01cf3f5560578c6554b9ba009f6b42b7.png

```

The `civicrm/contact/imagefile` handler permits CiviCRM to provide its permissions checks on whether the image in question should be served up.

Since that code was merged, there's a good chance it worked for someone and this may be fixable in configuration. It looks like the URLs you're getting from Views are confused - possibly by CiviCRM configuration, or by an issue with the views implementation as it currently stands, possibly an incorrect assumption in code about the location of CiviCRM codebase or system files, etc.

---
Tags: drupal, drupal-views, 4.6, contact-image
---


title: Error while saving new contribution

text:
# Question
Title: Error while saving new contribution
I have recently migrated my CiviCRM installation from one server to another server. Now facing an issue in saving new contribution. If I save the contribution without checked "Send Receipt?" it will be saved properly. If I checked this "Send Receipt?" option it will give me an error.

Error : CiviCRM-001 - An error has occurred.

# Answer
> 2 votes
The error message indicates that the utility "wkhtmltopdf" was not found at the expected location. This is configured at Administer -\> System Settings -\> Misc (/civicrm/admin/setting/misc?reset=1), "Path to wkhtmltopdf executable".

You will need to find whether this utility is installed on the new server and if so, enter the full path to the wkhtmltopdf executable. If it's not installed, you can leave this field blank and CiviCRM will use the default PDF generation method instead. However this has performance issues and may cause errors from exceeding PHP memory limit or timeout.

If you don't actually need a PDF copy of receipts, you can disable this with the "Attach PDF copy to receipts" setting on the same form.

---
Tags: contributions, joomla, php
---


# Question
Title: Remove the "-none-" option in Price Set choices?
When using price sets, at least with radio, it adds an automatic - none - option. Why is that and how can I remove or hide it?

Sample screenshot

# Answer
If you set the price set field to REQUIRED, the -none- option should be suppressed automatically.
> 12 votes

# Answer
You can hide the -none- option by customizing the template with a simple jQuery snippet. However you should add a function to give the user a mechanism to clear the selections as mentioned above. Similar to if you use a yes/no field in a profile and it is not required Civi will insert a 'clear' option link.
> 1 votes

---
Tags: civievent, price-sets
---


# Question
Title: Removing empty fields from event registration templates
We have some custom event fields that were set up before our time and are set to apply to all types of events, even though they are rarely used anymore. However, when a registration is entered from the administration end of things, the receipt includes all of these fields so there is a long list of empty (and irrelevant) fields in the email that is sent.

What is the best way to hide those fields (ideally only if they are empty)?

# Answer
> 3 votes
It sounds like you want to edit your Smarty templates for your receipts and use the Smarty "capture" function:

From http://www.smarty.net/docs/en/language.function.capture.tpl: "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute."

You use "capture", then an "if" statement to check if the field is empty before displaying it. There are good examples on the page linked above.

# Answer
> 3 votes
If you want to remove them when they are empty you will have to create a customization using the CiviCRM hooks. If you want to remove them from the email and do not really care about the data in them, you could contemplate disabling the custom fields?

---
Tags: civievent, templates, receipts
---


# Question
Title: How do I import an activity with multiple target contacts?
Has anyone got tips for the best implementation for this that's friendly to a savvy end-user? I can script it in an ETL tool, but that's not an option for them.

* "Import Activities", as best I can tell, will only import a single contact ID.
* You can import more contacts via the ActivityContact API (with API CSV GUI Import extension) but this is hard, because there's no good way to match the imported activity to the CSV you imported from. Activities don't have an "external identifier" field.

The only real choice I see is to hijack an field I'm not using like "Engagement Level" and use that as a temporary "external identifier" - but that's pretty ugly.

Any other approaches short of building a custom import?

# Answer
> 1 votes
I've tried various ways of importing complex entities. At the end of the day, the best tip I have to offer you is to write a small program to create the entities via the api.

You can either run it on the server (php) or run it over REST (php or my current favorite, node.js)

I found it much easier to deal with edge cases, errors, weird matching logic...

If you are on drupal, check Eileen work to integrate with the migration module

If you are prepared to invest a significant amount of time learning kettle, amnesty spain has shared a module to make it easier to pull or push data from civicrm.

---
Tags: import, activities
---


title: How do I add fonts to CiviCRM

text:
# Question
Title: How do I add fonts to CiviCRM
My organisation uses a few fairly standard fonts that aren't available in Civi, for mailing labels and letters and auto-response emails etc. - how can they be added?

# Answer
They are several places where you can use fonts (by order of complexity):

1) web pages (eg contributions) This one is simple, it's a matter of changing the css and possibly loading an extra bit of code (if you use google font for instance) It's easier to do it from the theme of the CMS around your civicrm

2) mails you can request to use a specific font (but you will need to inline the font, as most mail clients ignore stylesheets). If that font is already installed into the computer of the recipient, it will work, if not, you're out of luck

3) pdf you will need to register these fonts (as new files) and so probably have to code My experience with pdf is that it has several limitations (eg it isn't always unicode and you might lost some accentuated characters)

The last one I haven't tried, but can point you to were you might need to change the code: CRM/Utils/PDF/Utils.php CRM/Utils/PDF/Label.php

CiviCRM uses http://www.tcpdf.org as the library to convert to pdf, check there first

If you have full control on your server, you can as well configure civicrm to use wkhtmltopdf, it should be as simple as the case 1 to add custom fonts to your pdf
> 7 votes

---
Tags: custom-templates
---


# Question
Title: How does one stop people who haven't paid (pending from pay later) from filling an event?
We are running CiviCRM 4.5.3 on Joomla! 3.3.3.

As the question says, we want to know how to stop people who haven't paid (pending from pay later or incomplete transaction) from filling an event.

If, for example, an event is set for 16 registrants and 15 have booked and paid and 1 is still pending from pay later, then bookings close. No one can book online; it says the event is full.

We don't want that to happen. We want anyone who is pending from pay later or an incomplete transaction to NOT count towards the total registrants for the course.

In this way, what we want to do is enable someone to come along, book online and pay immediately, and take the place of anyone who hasn't paid yet.

This used to be how it worked in our old version of CiviCRM, so we know it's possible!

# Answer
> 8 votes
Under Administer/CiviEvent/Participant Status, Edit 'Pending Pay Later' and uncheck the 'Counted?' box. The same can be be done for 'Pending From Incomplete Transaction', but by default it doesn't count.

# Answer
> 6 votes
In the admin menu, go to **Administer -\> CiviEvent -\> Participant Statuses**. It looks like this:

Ensure the various "Pending" statuses (the one you asked about is highlighted in the image) have "Counted" set according to your desired workflow.

---
Tags: civievent
---


# Question
Title: How to grant permissions (ACL) when working with nested groups?
I pushed a topic here that has not yet been solved in the forum and that affects our organizations:

http://forum.civicrm.org/index.php?topic=29381

Managing ACLs is really heavy and is very inefficient to have to grant and maintain permissions one to one to a set of groups that in fact hang from a parent group.

Has anyone encountered the same trouble?

# Answer
I've encountered the same problem - and solved it by implementing a multi-site configuration and installing the Multisite Permissioning extension.

This may not be appropriate for your setting, it may create more trouble than it solves, but in our case it was very helpful.
> 2 votes

---
Tags: permissions, acl, groups
---


title: "Is deceased" checkbox and Views

text:
# Question
Title: "Is deceased" checkbox and Views
We have a simple directory built with Views and a few exposed filters for searching. One of the (non-exposed) filters is intended to make sure all listed contacts are not marked as deceased. However, the filter does not have a negate option so instead of `Is Deceased NOT TRUE` we have to do `Is Deceased FALSE`. We may have even had to set the 'Is Deceased' field to 0 in the database directly, I can't recall. That part was working fine.

However, we also have a simple profile set up to allow editing of the contacts, adding a photo, and marking as deceased as necessary. What we've found is that when a contact is edited (to update the address or add a photo for example), the "Is Deceased" field is reset to NULL and this excludes them from the directory (because the field does not equal FALSE anymore).

What is a better way to handle this?

# Answer
> 2 votes
In the end, I removed the "Is Deceased" option from the profile we use to edit the contact's information and created a separate profile which contains only that field. It's a little clunky to present two edit links:

* Edit contact information
* Mark contact as deceased

...but it works for now. I would have tried it in a Webform (with Webform CiviCRM) but I don't think the image handling pushes back into CiviCRM.

# Answer
> 1 votes
Since the end goal is to display data in Views, can you use a small module to alter the views query, rather than customizing Civi? I haven't tried views\_query\_substitutions personally (I've usually hooked into views\_query\_alter), but I think this is a simple fix that could solve the problem:

```
function hook_views_query_substitutions($view) {
  // Example from views_views_query_substitutions().

  return array(
    "civicrm_contact.is_deceased = '0'" => "civicrm_contact.is_deceased = '0' OR civicrm_contact.is_deceased IS NULL",
  );
}

```

---
Tags: drupal, profile, drupal-views
---


# Question
Title: After upgrading to 4.6 CiviMail HTML version is uneditable
I'm doing some testing on 4.6 and after upgrading a site, I don't have the option to click into the HTML section when creating a mailing. The Plain Text section seems fine.

I have cleared caches and even tried changing the WYSIWYG editor to "Text Area" to see if it was something related to the editor, but it's the same:

Does anyone have an idea on how to get the CKEditor to show?

# Answer
> 4 votes
There's an issue+patch filed for 4.6.1 at https://issues.civicrm.org/jira/browse/CRM-16246. You can try disabling Drupal's aggregation as a work-around (by visiting "admin/config/development/performance"). If that work-around doesn't resolve it, let us know (since that would mean it's a different problem).

---
Tags: civimail, ckeditor, wysiwyg
---


# Question
Title: Optional year on Date of Birth demographics field: is it possible?
Some folks would like to enter their birth date but would prefer not to divulge the year they were born as it reveals their age ;)

Looks like the `Date of Birth` field has validation that requires year. What are my options for making year optional?

# Answer
> 3 votes
This question led me to re-investigate a 'feature' that was added quite a few years back to allow sites to set different date formats for categories of date fields. In 4.6, you access this via Administer \> Customize \> Date Preferences. There is a 'category' for Birth Date which "should" allow you to select alternative formats including mm/dd OR yyyy.

Unfortunately, testing in 4.4, 4.5, and 4.6 shows that there's a long-standing regression for this functionality (which I guess was rarely used). The Birth Date input field 'appears' to accept dates in the alternate format, but they aren't saved properly in any of the current versions.

Pretty sure fixing this will involve mods to the schema, processing code and the date input widget - so non-trivial. If someone is interested in working on a fix for 4.7 - patches definitely welcome.

# Answer
> 2 votes
I have the same issues - Unfortunately, there are only workarounds as Alan mentioned in the comment:

* Set as a Custom Field
* Set & Hide the Year portion of the field if age will not be used throughout the system

---
Tags: registration
---


title: Price set for Golf Event

text:
# Question
Title: Price set for Golf Event
Needing to have a single golfer price of $100 OR Foursome at $80 each and collect data on each person. I can turn on Addtl Participants BUT How do a "make" them enter four people and not more or less when choosing Foursome. I'm guessing this would have to be a custom built page? THANKS for any input.

# Answer
> 2 votes
If you are using Drupal, I would guess you can do this with Webform-CiviCRM. For example, you might be able to use Webform Conditionals (which comes built in with Webform) so that if they select the "Single golfer" option on the payment amount it hides the other three contacts, and if they select "Foursome" it shows the additional contacts (and those fields can be marked required in the Webform Components section).

---
Tags: civievent
---


# Question
Title: How do I batch update a standard custom field for event participants?
I have lots of profiles which allow me to batch update records. All of the profiles show as an option when I have used a normal contact search to identify individuals. However, when I search for event participants very few batch update profiles are available. The Civibook says: If you wish to update participant fields, you must do the update from a Find Participants search (and only include participant fields in your profile).

The fields I want to update for event participants are normal custom fields which weren't created for or linked to a specific event. Is it possible to include these fields in a profile which then shows up as an option when I choose Batch Update for event participants? (I tried to add some of these fields to a current profile which showed up for event participants but after I'd added them the profile disappeared from the list!)

My current workaround is to select event participants, create a new smart group and then use that smart group with my multiple batch update profiles. It's fine but adds another layer of work when dealing with tens of different events. Many thanks.

# Answer
From the description of your custom fields as "normal custom fields" and your current workaround, it seems that the fields you want to update are contact custom fields rather than participant custom fields.

If that is so, then do an **Advanced Search** specifying criteria in the **Events** section rather than a **Find Participants** search. On the results page you will have the option to **Batch Update via Profiles**. Select that option and all your profiles should appear in the selection list.
> 2 votes

---
Tags: civievent
---


# Question
Title: How can I manage the drop down field lists in Search Builder?
I upgraded a site from 4.2 to 4.4.

They use Search Builder to run specific searches against custom data, and build quarterly reports.

Previously the field list in search builder was grouped by data set so related fields were listed next to each other. There now seems to be no underlying order to the listing and site users are finding it difficult to build their searches.

Does anyone know what governs the field listing? is there somewhere I can go to re-order the list in a way that makes sense to the end user?

# Answer
> 1 votes
These lists are generated programmatically now, and are basically alphabetical. While I would encourage your users to give it a little more time to adapt, you could reorder the steps with a jQuery script. Consider adding a .extra.tpl file with your script in your custom templates folder in `CRM/Contact/Form/Search/Builder.extra.tpl`.

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


title: Can't update domain.address

text:
# Question
Title: Can't update domain.address
After upgrading to 4.6.0 I can no longer update the value of the domain.address token. I try to update the address in Administer \> Organization Address and Contact, but after saving the new address it reverts to the old address.

# Answer
> 1 votes
Could you replicate on d46.demo.civicrm.org and then file a bug report at issues.civicrm.org? Thanks.

---
Tags: civimail
---


# Question
Title: Where should one look for logs when debugging a new problem?
When a bug or problem arises, one must often seek out the corresponding error-messages or error-logs. Since Civi runs on a large stack, there can be several layers to check, e.g.

* The browser's Javascript console
* The Civi application log
* The PHP error log
* The httpd log

The answers vary a bit (depending on CMS, browser, server platform, etc), but there's also a fairly limited range -- in general usage, there are only a handful of common CMSs (Drupal/Joomla/WordPress), common browsers (Firefox/Chrome/Safari/IE), and common server platforms. For web-designers and moderately-technical site builders, it would help to have a cheatsheet with common places to look.

I found a couple pages about debugging strategies in Civi. The bug-reporting page discusses the high-level business process of using forums and issue trackers. The Debugging for developers page is very developer-centric (eg adding new log statements to the source-code; installing+configuring xdebug). However, I could not find a concrete list of places or instructions for checking logs.

# Answer
> 3 votes
It really depends on the type of error you are getting. If something is wrong with the display or some ajax functionality isn't working I check the JavaScript console. If there is an actual error message I check the php log and then turn on display back-trace to get a better view of where the problem is occurring.

---
Tags: debugging, logs
---


title: How to debug chained API calls

text:
# Question
Title: How to debug chained API calls
How can I get back a dump of the full param array when a chained api call fails, so that I can see what values are coming back from the previous call and going into the chained call (and thus better troubleshoot cause of failure)?

I know that I can add the "debug" param into the array, but I can't seem to read the trace in a way that tells me what $value was returned from the previous call and inserted to the chained call.

# Answer
You can use try/catch and the CiviCRM\_API3\_Exception class to get more information. It would be something like this:

```
try{
  $result = civicrm_api3('contact', '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);
}

```

The getExtraParams method should give you what you are looking for.
> 1 votes

---
Tags: api, chaining
---


# Question
Title: How to prevent Smarty secure_mode activation?
I hope my silly question will get answers from some of you...

I'm just trying to send an email using smarty basics functions such as using {php} tags and playing php in smarty tags {if strstr($email, '@')}.

But each time I try to send the template Smarty activate secure\_mode and everything's ruined...

I found where Smarty put the secure\_mode but I can't understand why... (in CRM/Core/Smarty.php line 202).

If someone ever run into this and solved it pleeeease help me :'(

PS : I defined this in my settings file =\> define( 'CIVICRM\_MAIL\_SMARTY', 1 );

Still working on it !

I hope i'll find the solution ;D

# Answer
Allowing arbitrary php to be executed from an email string can potentially cause security issues from un-trusted users and hence the security mode of smarty is enabled for all string based resources.

I dont think there is an easy work-around for this :(
> 2 votes

---
Tags: email, smarty
---


# Question
Title: Can Civi/WordPress an Civi/Drupal (same versions) share a database?
This would make it a lot easier to manage a transition between an existing Drupal site and a new WordPress site. In my case, all core programs and the existing databases are on the same server. It would sure be nice to just configure the new WP Civi to look at the old Drupal Civi database.

# Answer
Most of the database table can be shared between the two sites. However, there will/might be an issue with the WP user table and the drupal user table with the civicrm\_uf\_match table. One potential option might be to ensure that the user ids across wordpress and drupal dont conflict, i.e. choose a high starting point for the WP user table (which is a manual process in mysql)
> 3 votes

---
Tags: wordpress, drupal, import
---


title: How Do I Import 75+ Groups

text:
# Question
Title: How Do I Import 75+ Groups
What's the best way to batch import a list of groups? The list contains 75+ entries, so having a team member manually enter each group is not the best use of time.

# Answer
> 6 votes
CiviCRM by default does not have an option to import groups. However, there is a third-party extension that provides a user interface to import anything through the more powerful CiviCRM API.

First, install the API CSV GUI extension: https://civicrm.org/extensions/api-csv-import-gui

Then click the new menu item that appears and select Entity to Import: Group.

Version 1.1 includes the wrong alias path, so remember to type "civicrm/" before "csvimporter/import" or else a Page Not Found error will be thrown.

```
mywebsite.com/csvimporter/import

```

should really be...

```
mywebsite.com/civicrm/csvimporter/import

```

Alternatively, install from git: https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport

---
Tags: import, groups
---


# Question
Title: Is it possible to prevent a certain role from changing the activity status in a case activity?
The use case is that every user should see their cases and their activities, but only certain users (based on their Drupal roles and permissions) should be able to change the status of some activities. The build up of the activities in the case summary form/page is not done in advance and does not show up in the buildForm hook. It is a jQuery datatable with a source url that is linked to CRM\_Case\_BAO\_Case::getCaseActivity. What I have done is create a page in my extension and replace the sourceURL in the datatable with one in my extension, and in the callback replace the core method CRM\_Case\_BAO\_Case::getCaseActivity with my own specific one. Any suggestion for another / better method?

# Answer
Perhaps enhance core to provide a 'CiviCRM: edit activities' permission. I don't think it would be that difficult. We're currently adding permissions based on financial types of objects in contributions (like line items, premiums, etc) and it isn't that bad. With an edit permission you don't have to worry about reports, etc.
> 2 votes

---
Tags: extension, civicase
---


title: How can I disable households?

text:
# Question
Title: How can I disable households?
Our organization does not use households. As a training/usability issue for our volunteers, we would like to disable the concept entirely or at least hide them from view. There does not appear to be a mechanism to do so, however.

This feature has been requested for some time; there is a 2008 thread asking essentially the same question, but unfortunately it leads only to other dead-end threads. A feature request for the 3.0 branch was summarily closed for lack of activity.

If there remains no configuration mechanism to remove households, has anyone developed a comprehensive list of places where households are referenced? For instance, we can remove the navigation menu items from the UI, disable the reports, and use CSS to hide mentions on some forms. We would prefer, going this route, to override a template to remove the option, but we haven't been able to locate such a template or templates.

The same question, presumably, could be applied for anyone who does not use individuals or organizations as contact types.

# Answer
> 30 votes
Households can be disabled globally by disabling that contact type. This is not exposed to the UI but is still pretty easy to do:

* From the api explorer (Support -\> Developer -\> Api Explorer) make the following selections:
* With a direct sql query:

`UPDATE civicrm_contact_type SET is_active = 0 WHERE name = 'Household';`

Note: there may be a few places left in the UI that are hard-coded with households still available, but the above will handle the vast majority.

Addendum: You may also want to disable the Household profile. This will remove the "New Household" links from contact autocomplete form elements. Run the following query to do that in MySQL:

update civicrm\_uf\_group set is\_active = 0 where name = 'new\_household';

(thanks to comment from @bgm).

# Answer
> 12 votes
To remove households from the interface completely:

1. Delete any households that may have been created and any relationships involving households (shared addresses, Household members, etc).
2. Update the civicrm\_contact\_type table in the CIVI database to set the active flag for 'Household' to 0 (as per Coleman's answer)
3. Update the civicrm\_relationship\_type table to set the active flags to 0 for all relationship types that relate to households (e.g. "Head of Household for" and "Household Member of")
4. Remove the "New Household" menu item from the CIVI \> Contacts menu dropdown by going to Administer CiviCRM \> Navigation Menu - (Open Contacts and right click on "New Household" and select delete.
5. Check the changes made above are retained/reconfigured when you update CIVI

# Answer
> 2 votes
You can disable contact-types directly in the db or with the api, but a word of caution: I've seen older sites where people have messed with the basic contact types, and they've had real problems.

Based on other answers, this may be safer to do in current versions of CiviCRM, but I recommend thorough testing of any changes you make.

---
Tags: households, custom-templates, configuration
---


# Question
Title: How to do a 'mock up' event or prolfile form without it going 'live' on the website?
I have just started using CiviCRM so I am still finding my way around. Is there a way to create, for example, an event or a newsletter sign-up form and see what it would look like on the website without making it go live on the net? Someone else takes care of our website, I just do CiviCRM, so I don't want to mess up our website while I am still figuring out how to use Civi!

Any advice would be most appreciated.

Thanks!

-Mia

# Answer
> 3 votes
On the first step when creating a new event, down near the bottom of the form, there is a checkbox labelled "Is this Event Active?" Un-check this and the event will be hidden from the public. You can come back later to set to true -- it's on the first tab when configuring the event.

To display the event on a WordPress / CiviCRM site you need to insert a shortcode for the event into a WordPress post. Put your cursor into the body of the post, then click on the CiviCRM triangular icon just above the field. Choose appropriate options like an event and test rather live page. That will let you test purchasing a ticket for the event without having to pay real money. Test tickets purchased also dont show up in standard reports and participant counts. When you are satisfied with the purchase pages and emails sent you should switch the shortcode to the live page and ènable the event.

Good luck.

# Answer
> 1 votes
What Drupal or Wordpress or some other crm?

From the civi side of things, you can make the event & keep it non-active and use the test and live links from the backend to get a general feeling of it, but depending on your configuration, you might not see it full integrated on the front end.

---
Tags: civievent, forms
---


# Question
Title: How can I set up a two part sign up form, where first submit leads to second with more fields?
My client doesn't want to scare potential subscribers off with a long form.

Is there a way to capture, and save, the name, email and phone of a subscriber and then redirect this user to a form that collects more information (like address, employer etc..)?

I could hide half the form with javascript but this means the first half wouldn't be saved.

I was thinking I could use the redirect field to redirect to a new form but then this information wouldn't be added to the same contact.

I'm using civiCRM with wordpress.

Thanks for your help!

Edit: I am looking to do this *without* the user having to create an account (with username, password). Just two profile forms that follow on from each other and are saved to the same contact.

# Answer
To implement this purely in CiviCRM with WordPress:

1. Create a standalone profile form to collect name, email, etc.
2. Create a second profile form to collect other information. If you want it to record an activity, you can set it up as a "Petition" form. If you want it to register the contact for an event, embed it in an event registration page.
3. Back to the first profile, edit and click the "Advanced Settings" tab at the bottom - set the "redirect url" to the public url of the second form.
4. Create a page or post in WP, and click the CiviCRM button to insert a shortcode for the first form.

Note that users must be logged in for Civi to already know who they are on the 2nd form. You have 2 options with this:

1. Users are already logged-in prior to filling the 1st form
2. On the 1st form, (also under "Advanced Settings") you can have Civi create a user account for them.
> 6 votes

# Answer
If you are using Drupal with your CiviCRM install then you can use the Webform CiviCRM Integration module (module; wiki with instructions). You can make it a multiple page form and under Webform \> Form Settings \> Advanced on the form, there is a checkbox for "Automatically save as draft between pages and when there are validation errors: Automatically save partial submissions when users click the "Next" or "Previous" buttons in a multipage form or when validation errors prevent form submission."
> 0 votes

# Answer
Gravity Forms does this. I believe Arete Imagine has built a Gravity Forms integration plugin for CiviCRM, but I don't think it's seen a public release yet. I also believe they are planning on charging for the plugin. The best way to find out may be to contact them.
> 0 votes

---
Tags: forms, civimember, contacts
---


# Question
Title: How do I use CRM_Utils_Request::retrieve when the POSTed field is an array?
In the snippet below, I build api calls by looping through each student, and then each event within that. However, the field data is coming straight from the request with no server-side validation. Is it possible to use the Request class for array variables? If so, how would I implement it in my code below? What's the proper syntax?

```
  foreach ($_POST['student_details'] AS $student_record){

    $student_details = array(
          'sequential'  => 1,
          'debug' => 1,
          'contact_type' => 'Individual',
          'contact_sub_type' => 'Student',
          'first_name'  =>  $student_record['student_first_name'],
          'last_name'   => $student_record['student_last_name'],
          'gender_id'   =>  $student_record['gender_id'],
          'birth_date'  => $student_record['birth_date'],
          'custom_8'   => $student_record['shirt_size'],
          'custom_9'   => $student_record['allergies'],
          'api.Relationship.create' => array (
                  'sequential' => 1,
                  'contact_id_a' => '$value.id',
                  'contact_id_b' => $parent_id,
                  'relationship_type_id' => 1,
                  'is_permission_a_b' => 0,
                  'is_permission_b_a' => 1,
                ),
          );

    $student_event_list = [];

    foreach($student_record['event_id'] AS $student_event) {
      $student_event_list[] = array(
                    'sequential' => 1,
                    'event_id' => $student_event,
                    'contact_id' => '$value.id',
                    'status_id' => "Pending from pay later",
                    'role_id' => "Attendee",
                    'register_date' => date("m/d/Y g:i a"),
                    'is_pay_later' => 1,
                    'fee_level' => "Single",
                    );
    }

    $student_details['api.Participant.create'] = $student_event_list;

    try {
        $student_api_result = civicrm_api3('Contact', 'create', $student_details);
    }
    catch (CiviCRM_API3_Exception $e) {
          $errorMessage = $e->getMessage();
          $errorCode = $e->getErrorCode();
          $errorData = $e->getExtraParams();
      return $errorMessage . ' (Code ' . $errorCode . ')';
        }

  }

```

# Answer
> 3 votes
I suspect u will need to use

CRM\_Utils\_Type::validate (which is what CRM\_Utils\_Request::retrieve actually calls for validation) directly

lobo

---
Tags: api
---


# Question
Title: How to use waitlists with price sets that have registration limits?
I have built an event registration that uses price sets to set limits on the number of people who can register from certain audiences. Once these limits are reached it is currently responding "event is full."

The desired behavior is that either using the price-sets or using participant types, the event would always waitlist when the limits are exceeded, and that the waitlist based on the group, rather than the event as a whole.

Example: Group A has a limit of 50 seats Group B has a limit of 20 seats Group C has a limit of 100 seats

If Group A gets full, they go on the waitlist. Other groups can continue normal registration until they are full, and then they are waitlisted. Spots that open up for waitlisted registrants must come from the group they selected initially.

# Answer
> 2 votes
The only way I see to accomplish this without writing custom code is to create 3 Civi events. You'd then:

* Create a page on your website describing the event, with 3 different registration links.
* Give your 3 events the same date, event type, etc, but different limits and pricing structures.
* All three can be set to roll over to waitlist after the limit is reached.
* Give your events clear names like "Our Gathering (Group A)", "Our Gathering (Group B)" etc.
* Set up an event participant report that lists the participants from all 3.

# Answer
> 1 votes
The waitlist feature applies to the whole event when "Max Participants" is set on the event info & configuration page, not to limits set for individual options in a price field.

The usual behaviour when an price field option is "fully subscribed" is that the option can no longer be selected during the registration process.

So the behaviour you describe is not usual and the behaviour you want is not 'out-of -the box' CiviCRM.

Someone else will have to advise on how to get the behaviour you want.

But a first step would be to upgrade your site to 4.5.8 which is the latest version in the 4.5 series so that the behaviour when an price field option is "fully subscribed" is operating correctly. It would not be sensible to create custom code on a site with a bug.

---
Tags: price-sets, civievent, waitlist
---


# Question
Title: Where in the database is the note field for contributions?
One can enter notes with a new contribution and they show up like this:

> **Campaign** Middleport Pottery, Steam Engine
>
> **Receipt Sent** April 10th, 2015 10:56 AM
>
> **Note** ***Where is the note field?***
>
> **Transaction ID** 101010

And are in the template like this:

```
{if $receipt_date}
  <tr>
            <td class="label">{ts}Receipt Sent{/ts}</td>
            <td>{$receipt_date|crmDate}</td>
    </tr>
  {/if}

{foreach from=$note item="rec"}
  {if $rec }
    <tr>
      <td class="label">{ts}Note{/ts}</td>
      <td>{$rec}</td>             //LINE IN QUESTION!
    </tr>
  {/if}
{/foreach}

  {if $trxn_id}
    <tr>
      <td class="label">{ts}Transaction ID{/ts}</td>
      <td>{$trxn_id}</td>
    </tr>
  {/if}

```

However it seems I can not export the data in this field from the user interface and I can not seem to find it in the database to create a query. Any idea on table and field?

Thank you!

# Answer
> 6 votes
civicrm\_note

entity\_table = 'civicrm\_contribution'

entity\_id = contributionID

# Answer
> 6 votes
You can retrieve contribution notes via the api using:

```
civicrm_api3('Note', 'get', array(
  'entity_table' => 'civicrm_contribution',
  'entity_id' => $contributionID,
));

```

Or see the api explorer to generate this in other formats (you can also do it from within a smarty template, for example).

**Important:** The api returns raw, unsanitized user input. If you are displaying this value, be sure to *sanitize the output* using `htmlspecialchars` or similar.

---
Tags: civicontribute, contributions, database
---


# Question
Title: How do I get a chained restful API call to return xml?
This query string will return a contact record and related phone records for Contact ID 1234 in json format:

```
entity=Contact&action=get&json={"contact_id":"1234","api.Phone.get":{}}

```

How do I construct a query string that will return the results in xml format? It seems as if the API Explorer only returns json.

# Answer
> 3 votes
@samuelsov got me going in the right direction, along with trial and error from the documentation:

This returns all related phone records for the given contact\_id:

```
entity=Contact&action=get&contact_id=1234&api.Phone.get[values]

```

And you can filter the chained API call too, for example all related phone records with a phone\_type\_id of 2:

```
entity=Contact&action=get&contact_id=1234&api.Phone.get[phone_type_id]=2

```

# Answer
> 1 votes
Not 100% sure but I think it's a limitation in the current REST api. If you set the json param, the result is json formatted. Can you try to not set json param by doing :

```
entity=Contact&action=get&contact_id=1234&api.Phone.get=1

```

---
Tags: api, rest
---


# Question
Title: In CiviMail reports, how do I enable "Add these contacts to Group" for user levels other than Admin?
I want to enable other user levels to be able to add contacts to a Group based on a list of results in a CiviMail Report using 'Add these contacts to Group'.

For example, a CiviMail Bounces Report shows 99 "bouncing" (undeliverable) e-mails. I want other user levels besides Admin to be able to add them to a new Group called Bouncing E-mails - 20150410 Outreach Mailing.

As the Admin, I see 'Add these contacts to Group' as an option in the Bounces Report. But other user levels do not see that. I don't see a permission to change under Drupal user permissions.

I have already enabled the available choices for the desired user level already. The choices are: access CiviMail, access CiviMail subscribe/unsubscribe pages, delete in CiviMail and view public CiviMail content.

# Answer
> 3 votes
Joe - Did some snooping in the code, and currently 'administer Reports' is required to expose 'Add Contacts to Group' in any report. Of course 'view all contacts' or some ACL granting permission to a set of contacts is also required or report results will be empty.

I think 'administer Reports' is not the right requirement. 'edit all contacts' or an equivalent ACL allowing editing is required in the rest of the user interface to allow 'add to group' - so I think the same should be true in reports.

https://issues.civicrm.org/jira/browse/CRM-16274

---
Tags: civimail, groups, civireport
---


# Question
Title: What else is needed to create new tab for content in extension?
I am new to writing an extension.

I add a tab in my contact with this example

```
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 );
}

```

What should be the next step to add a content in the tab?

how I have to use the extension and add where I have to create a new file to show all the content.

Please can you provide me an example

Thank You

# Answer
> 1 votes
As the example says, "you would create a url which would return an html snippet".

Since this is in the context of a CiviCRM extension, please see the Civix documentation for how to create a basic page.

The url of your tab should be whatever you decide the url of that page should be.

---
Tags: wordpress, extension
---


# Question
Title: How to send receipt for previous event sign ups?
I set up an event registration form without enabling confirmation emails. We just got a request for a receipt from a registrant. I can't find a way to send a confirmation/receipt email to them a day after they signed up. Or a way for the user to access a receipt on our site. (I have since changed our sign up form to include the auto confirmation email.)

CiviCRM 4.5.6, WordPress 4.1.1

# Answer
You might want to test the following:

1. Navigate to Administer Communications \> Message Templates, select System Messages, then beside Events - Receipt only. Leave this window open and open another to Administer Communications \> Message Templates, and click New template. Copy the subject, html body and text body from system receipt message into you new user one, give it a name and save it.
2. Navigate to Find Participants, select a registration of your own user for testing (you may need to create one first), then for action select Send email to participants. On the next page, select your new template and send the message. If the receipt looks good in your inbox, repeat this step but sending to unreceipted participant.
> 1 votes

---
Tags: civievent, wordpress, 4.5.6
---


# Question
Title: How do I setup Wordpress multi site with CiviCRM mutlisite?
To what degree does CiviCrm play well with Wordpress multi site installations?

More directly - If I have a multi site install, what is the best way for each 'org' website to seemingly have it's own CiviCrm instance?

# Answer
I have a Wordpress multi-site that's working quite well. Note that there are two approaches to Wordpress multi-site: subdomain and subfolder (e.g. "site1.example.org, site2.example.org" vs. "example.org/site1", "example.org/site2".

I posted instructions on the wiki page Lobo mentioned for how to set up civicrm.settings.php for subdomain multi-site. I haven't updated it with subfolder multi-site instructions, but you can find them on my "CiviCRM multi-site checklist" page here: https://hq.palantetech.coop/projects/commons/wiki/CiviCRM\_multi-site\_checklist. If you follow the instructions on that page, each site should be more-or-less independent from one another - especially if you install Eileen's excellent multisite permissioning extension (install from github, not extensions directory!)
> 3 votes

# Answer
Might want to check:

http://wiki.civicrm.org/confluence/display/CRMDOC/Multi+Site+Installation

search for "wordPress multi" on that page
> 0 votes

---
Tags: wordpress, multisite
---


title: CiviVolunteer Error on page

text:
# Question
Title: CiviVolunteer Error on page
In CiviVolunteer, I have two roles (perhaps 'Event Set-up' & 'Event Staffing') needed at different times (say Friday at 7pm for Set-up and Saturday at 9am for Staffing).

**In my installation (** *Civi 4.5.8 on Wordpress 4.1.1* **), someone can register to 'Set-up' on Saturday or to 'Staff' on Friday - The roles are not linked to the times needed.**

Where do I start troubleshooting?

(I'd test on the demo, but you can't!)

---

**Edit:** I was able to test on the 4.6.1 Dupal sandbox and it does work where you must choose a role (time is hidden), then a new box appears to choose a time for that role. On mine, both the roles and times appear at the same time and inappropriate combinations are possible. I couldn't find any way demo for testing on a WP install, so I was confirming first that this is not a bug, and second, then how to fix. You said perhaps a broken script - but this is on multiple machines (& front & back end), so I assume it's my configuration somewhere. Where should I start looking to figure out the problem? Here's my a screenshot of the page:

---

**Edit:** No Errors in browser console with backtrace and debugging turned on.

---

**Edit:** I confirmed that volunteersignup.js is at:

/primary/www/wp-content/plugins/files/civicrm/ **custom** /org.civicrm.volunteer/templates/CRM/Volunteer/Form

It is NOT at **/custom\_exe/**

I double checked Extension Resource Dir:
/webroot/b/g/example/primary/www/wp-content/plugins/files/civicrm/**custom\_ext**

Extension Resource URL: \`http://example.com/wp-content/plugins/files/civicrm/**custom\_ext**'

Changing these to other values broke many other things - These setting all follow the help prompts & book instruction from what I can tell.

Changing these to **custom** made no change. .I didn't find a reference to a .htaccess change - is this a file permissions change, or a file content change?

---

**Edit:**

I moved `custom_exe` to `/wp-content/plugins/civicrm_ext`.

I changed the resource dir (`/webroot/b/g/example/primary/www/wp-content/plugins/civicrm_ext`) & urls (`http://example.org/wp-content/plugins/civicrm_ext`) to the file. File has permission read access (755). I can browse to volunteersignup.js at the new location and view as an anonymous user. The file name is still not found when searching 'view source' on the sign-up page. No custom coding has been done anywhere on the site.

I cleared cache from the admin (system settings \> Cleanup Cache) and from manually deleting files in `template_c` per wiki. (The clearcache url gave an error "You do not have sufficient permissions to access this page.")

I've also disabled all the civi extensions and wp plugins. This completes all the tasks on the troubleshooting hit list Coleman posted.

**But still NO CHANGE on the form!** And no errors on in the console. sigh...

---

**Edit:** I upgraded to 4.5.8 just incase there was an easy fix there. I didn't think there would be reading through the change logs - Of course, still no change...

# Answer
> 2 votes
Based on your updated description, it appears there's a JavaScript error of some sort in play. To begin debugging this, you'll need to open up the JavaScript console in your browser and post back any errors therein.

In Firefox and Chromium (on Ubuntu at least), you can do this by pressing the F12 key. Otherwise, in Chromium, click Tools \> JavaScript Console.

# Answer
> 2 votes
Ben sent me a link to his site privately, so I was able to do a little more digging around. I don't have creds to the site, so my observations are limited.

The file that's responsible for the behavior missing from the site in question lives at *extensions\_directory*/*civivolunteer\_root*/templates/CRM/Volunteer/Form/VolunteerSignUp.js. If things were working as they should be, you could go to the page in the screenshot, view source, and find a reference to this file in the page. As it stands, this file isn't referenced anywhere in the page. This suggests one of two things (assuming no one has modified the source):

* Your extensions resource URL is set incorrectly. To check this:
    + Go to "Administer » System Settings » Resouce URLs".
    + Fill in "Extension Resource URL," and click "Save". Note that this URL corresponds to the same location as the "Extensions Directory" setting found under "Administer » System Settings » Directories."
* Your extension resource URL is set correctly, but some server configuration prevents the resource from loading. I have seen this happen in Drupal sites when the extensions directory is under sites/default/files/civicrm. (If memory serves correctly, it's due to some somewhat recent changes in an .htaccess file.) I haven't tested it on WordPress, but I suspect the same would happen if the extension directory is under wp-content/plugins/files.

---
Tags: civievent, wordpress, extension
---


# Question
Title: How do I suppress showing cents on a contribution page?
I'm offering several prices on a contribution page: () $10.00 Bronze () $100.00 Silver () $1000.00 Gold

I'd want to remove the decimal, because no suggested amount has cents, but can't figure out is there is a setting or if I need to dig into the code (and possibly write an extension?)

# Answer
> 5 votes
In Settings - Localization, try changing Monetary Value Display from:

```
%!i

```

to:

```
%!.0i

```

See: http://forum.civicrm.org/index.php/topic,20941.msg87684.html#msg87684

Please see the comments below by Andrew Hunt and Lobo - the above will get rid of cents/pence across the board, which may not be what you want. See Lobo's answer for alternative approaches. Trust Lobo. :-)

# Answer
> 3 votes
If this is localized to one specific page, then i'd probably do this via a jQuery snippet on that page.

If this is desired for all public facing pages, I suspect a buildForm hook will allow you to modify the labels of the various price set elements

# Answer
> 2 votes
One option If using a priceset you can choose to not display the price and show price in the description in the formatyou want. However the price will show with decimals on subsequent pages (confirmations, etc.)

---
Tags: civicontribute
---


# Question
Title: Is this scheduled cronjob setup correctly?
I set up this cronjob. Does this cover whatever I set in the GUI Scheduled Jobs? Or, do I need to set up a cronjob for each? If for each, what is the purpose of this GUI?

As per Scheduled Jobs:

> CIVI\_ROOT="~/public\_html/administrator/components/com\_civicrm/civicrm"
>
> PHP=nice -n19 /usr/bin/php
>
> PARAMS= -j -s\[domain\] -u\[user\] -p\[password\] -a execute
>
> \*/1 * * * * cd $CIVI\_ROOT; $PHP bin/cli.php $PARAMS

# Answer
> 2 votes
Yes, executing the standard cron job, which is the cron.php file as you have it, executes any and all jobs which are enabled on the **CiviCRM » Administer CiviCRM » Scheduled Jobs** page.

# Answer
> 1 votes
Might want to check the answer here which is a bit detailed:

How Do I Fix Mail Send Stopping at 500 Sends?

---
Tags: civimail, cron-job
---


# Question
Title: Drupal CiviCRM Entity in Rules: How to loop over all members of a group?
I am using civicrm\_entity-7.x-2.x-dev to build a rule using Rules module. I want to use the action "CiviCRM Contact Send Email" to send an email to all members of a CiviCRM group.

So I need to loop over all of the contacts in a group and fire this action. The problem is that I don't see a way to provide a list of group-member contacts as a Rules loop.

I tried "Fetch CiviCRM entity by property" which can fetch a group using the Group ID. That works fine. However once this group entity is fetched, there is no variable like `fetched_group:list-of-member-contacts` \- I only get a chain that leads to the contact who created the group or the contact who last updated the group. No "list of contacts in group"

Any pointers on sending CiviCRM mail with Rules to existing CiviCRM Groups/mailing lists?

# Answer
> 6 votes
You can use the Views Rules module: https://www.drupal.org/project/views\_rules

This will provide a Views Loop: from the project page: "A view loop is similar to a regular Rules loop, but allows looping over rows of view results."

So enable that module, and then create a view that lists contacts that are in the group you desire.

Some basic instructions from the Views Rules project page:

```
Install the module (and make sure Rules UI and Views UI are both enabled)
Configured Views
    Add a view (with some fields)
    Add a "Rules" display
    Configure row variables
    Save
Configure Rules
    Add a rule
    Add the "Collect view result rows" action or add a view loop
    Select the "Rules" display
    Configure the parameters and variable names
    [Do what you want with the newly available variables]

```

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


# Question
Title: How can I set the order of membership organisations in dropdown?
I've added multiple membership types. They are related to several organisations. When adding a membership, in the form, I must first choose for which organisation, and then the type of membership, both in dropdowns.

Can I define the order of the organisations in that dropdown ?

# Answer
While Membership Types can be ordered at `civicrm/admin/member/membershipType` it seems like the Organizations are sorted alphabetically here (CRM-6099).

* You could rename the organisations to rearrange their alphabetical ordering. This is probably not realistic :)
* You could create a CiviCRM extension which implements hook\_civicrm\_buildForm() and rearranges the options in the Organizations list.
* A patch to core could make the form respect the order defined at `civicrm/admin/member/membershipType` for the related Organizations also.
> 2 votes

---
Tags: civimember
---