# Question
Title: How can add URL to dropdown items for a profile page
I have been trying to edit the a profile page of my civicrm. I have gone the way of modifying relevant template and php file but no headway yet.

So, how can I add URL/Link (e.g. "Organisation") to the dropdown items on this profile from the UI or template?

---

Donation Options (the three options to unhide in the same page once clicked)

# Answer
> 1 votes
profiles are simply a way to build forms so only a subset of all the gazillion fields that civi have are exposed to the end user.

so the initial question is what is that supporter field you want to add? It has to be already created in civi before you can use it.

that notion of supporter doesn't exist in civi by default, so either you are using an existing field and slightly changing it's meaning, or you need to first create a custom field 'supporter' so it's exactly what you want.

if by link you mean letting the end user putting their website, there is a core field for that- website, that you can simply add to the form

# Answer
> 1 votes
If I understand the question, and if you are on Drupal, then you can use Webform-CiviCRM module to make core and custom fields available to the webform. You can then use Webforms Conditional options to set is so eg if I choose Citrus I then see another set of fields for Orange, Lemon, or if I initially chose StoneFruit, then I would see options for Peach, Apricot etc.

Does that help?

---
Tags: profile
---


# Question
Title: How can I provide mailing receipients an "Unsubscribe All" option?
When recipients click "Unsubscribe" in my mailings, it takes them to a page where they can unsubscribe from every group the mailing was sent to. Is there a way to let them opt-out of one and not the other, and also is there a way to let them opt-out of all future mailings? Sorry if this is listed somewhere. I've searched and looked in the docs but haven't come across this.

# Answer
> 10 votes
There is no built-in "Unsubscribe All" function in CiviCRM, though there is a *User Opt Out* option from CiviMail, as well as a *Do Not Email* setting.

### Unsubscribe

The unsubscribe link is provided by the `{action.unsubscribeUrl}` (URL) or `{action.unsubscribe}` (email) tokens.

The unsubscribe email, even if not provided as a token in the message, is supplied in the email headers as the *List-Unsubscribe* address. Someone who unsubscribes by email is removed from every list used to send the message. For example, if you send a newsletter to two groups, *Donors* and *Volunteers*, and joe@example.net is on both, Joe would no longer receive messages from either *Donors* or *Volunteers*.

More commonly, people would click on the unsubscribe link, and be brought to a confirmation page to be asked

> Are you sure you want to be removed from the mailing list(s) shown below …
>
> You are requesting to unsubscribe this email address

The confirmation is in place to prevent accidental removals when people follow the link from forwards or replies. If confirmed, the contact is not deleted from the Group, but their group status is changed to *Removed*.

As of 4.6.5, there appears to be no way to unsubscribe from *all* groups at once, nor even to pass individual group IDs to the unsubscribe, unlike subscribing where group IDs can be passed to `{action.subscribeUrl}` as `{action.subscribeUrl.gid}`. On Drupal, it might be possible to handle subscriptions using Webform CiviCRM Integration and a bit of jQuery to select/unselect multiple checkboxes.

Because unsubscriptions are on a list-by-list basis, people unsubscribing from all current lists would not prevent them from being added to any newly created lists.

### Opt-out

In contrast to the unsubscribe options, a user *Opt Out* (`{action.optOutUrl}` or `{action.optOut}` tokens) does not affect group membership status; it is an independent field on the contact itself. Contacts which have *NO BULK EMAILS (User Opt Out)* selected will be removed from *all* CiviMail mailings. So if you add the contact to any new mailing lists you create in the future, they will not receive messages from those lists, either.

The confirmation message for an opt-out link is different from that of an unsubscribe link:

> You are requesting to opt out this email address from all mailing lists

There is no way to prevent an opt-out, though that feature has been requested in the past.

### Do Not Email

A third option, which I believe can only be set by an admin or through a custom setup, not only prevents the distribution of CiviMail to a contact, but prevents an admin from sending a direct message as well.

# Answer
> 4 votes
There's four tokens that are relevant to what you're asking. Unsubscribe via e-mail, unsubscribe via web, opt-out via e-mail, opt-out via web.

Opt-out will opt someone out of all future mailings. Unsubscribe via web SHOULD allow someone to pick which group(s) they're unsubscribing from. If that's not your experience, please update the question to explain what it's not allowing you to do.

---
Tags: civimail, email
---


# Question
Title: What should drush cvapi NotificationLog.retry sequential=1 system_log_id=XXX do?
Trying to re-run/retry some 'stuck'/"pending" notifications in the system log using:

drush cvapi NotificationLog.retry sequential=1 system\_log\_id=XXX

but that just produces an array with the JSON data in the log entry.

drush cvapi notification\_log.retry id=748 used to do the trick.

Any ideas? Thanks.

# Answer
> 2 votes
that notification\_retry api isn't core - its an extension :-)

# Answer
> 2 votes
Eileen,thanks, duly noted that it's an extension, not in core. Thanks for writing the extension!

So to answer my own question -

drush cvapi NotificationLog.retry sequential=1 system\_log\_id=XXX

will retry/rerun system\_log entries as the previous

drush cvapi notification\_log.retry id=XXX

did, and I have no reason to believe otherwise.

---
Tags: api, contributions, authorize.net
---


# Question
Title: Add supplemental address field 1 to BillingBlock.tpl
I'm using CiviCRM 4.6 with Drupal 7 and have added the Supplemental Address Field 1 in CiviCRM but I can figure out how to get it to show in my custom BillingBlock.tpl

# Answer
You have created a new template or customized one, right? Do you already have the address data available in your template? You can check this by making sure debugging is switched on in your environment and then access your BillingBlock.tpl but add `&smartyDebug=1` at the end of the url. If not, you can use the API to retrieve the address data, assuming you know the contact id. In Smarty you can do:

```
{crmAPI var='result' entity='Address' action='get' q='civicrm/ajax/rest'}
{foreach from=$result.values item=Address}
  <li>{$Address.some_field}</li>
{/foreach}

```

This will allow you to retrieve the supplemental address.
> 1 votes

# Answer
If you want to add an input field it is important first to establish if this is a form (where stuff can be edited like edit a contact) or a page (showing stuff like the contact summary). I assume you are referring to a form where you can already edit stuff.

There are several ways in which you could put a new input field on a form, this is what I tend to do:

Create a new extension (or use an existing one) with civix as documented here : http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension

Then create a template for the field(s) and include some jQuery that moves the to the appropriate spot, like so:

```
<div id="maf-earmarking" class="crm-summary-row">
  <div class="crm-label">{$form.earmarking.label}</div>
  <div class="crm-content crm-recurring-earmarking">{$form.earmarking.html}
  </div>
</div>
{literal}
  <script type='text/javascript'>
    cj("#whateveridyouhaveseenontheciviform").parent().append(cj("#maf-
      earmarking"));
  </script>
{/literal}

```

Finally add the element to the form using the buildForm hook in .php like so:

```
$earMarkings = array(0 => ts('- select -')) + _recurring_getOptionList('earmarking');
$form->add('select', 'earmarking', ts('Øremerking'), $earMarkings, true);

```

In this example a select box is added, if you want to add an input fields, use $form-\>add('text'....
> 1 votes

---
Tags: drupal, addresses
---


# Question
Title: What are best practices for deploying changes?
I'm looking to set up best practices for a development workflow (i.e. dev \> staging \> production)

In Drupal there is features, which allows you to export your configuration into code and then deploy it.

What are people using when doing this in CiviCRM?

# Answer
In larger projects we tend to put configuration stuff (like setting up contact\_sub\_types, activity\_type, case\_types, groups, tags etc.) in a specific config extension that can then be deployed in each environment.

When doing so we tend to put the configuration into json files. But there is nothing like features as far as I know.
> 1 votes

---
Tags: developer, deployment
---


# Question
Title: Why is my MySql DB Connect failing on New Joomla install
When trying to install Civicrm 4.6.5 onto Joomla 3.4.3 I am getting the following error once the install is started from the install for directory option "Cannot open mysql://root:'rootpassword'@localhost/joomla\_db?new\_link=true: DB Error: connect failed.". This error is display on a white page with nothing else on it. It is using the correct password for root. Any assistance is welcomed.

# Answer
Try removing the apostrophes around the password, they are not required.
> 1 votes

---
Tags: joomla, mysql
---


# Question
Title: Strange consistent log notices. Where do they come from?
I haven't tried asking on stackexchange before (only the old forums), so please excuse me if I do it in the wrong fashion... I did google this, but couldn't find anything that helped me remove these. I may of course have done something stupid again..

I have some cron-triggered notification messages that keeps appearing on every cron run. They are:

> Notice: Constant CIVICRM\_USE\_MEMCACHE already defined in include\_once() (line 314 of /wwwroot/sites/example.org/civicrm.settings.php).
>
> Notice: Constant CIVICRM\_MEMCACHE\_HOST already defined in include\_once() (line 320 of /wwwroot/sites/example.org/civicrm.settings.php).
>
> Notice: Constant CIVICRM\_MEMCACHE\_PORT already defined in include\_once() (line 325 of /wwwroot/sites/example.org/civicrm.settings.php).
>
> Notice: Constant CIVICRM\_MEMCACHE\_TIMEOUT already defined in include\_once() (line 331 of /wwwroot/sites/example.org/civicrm.settings.php).
>
> Notice: Constant CIVICRM\_MEMCACHE\_PREFIX already defined in include\_once() (line 341 of /wwwroot/sites/example.org/civicrm.settings.php).

I'm worried they are more serious than they appear, and they anyway do clog up my log files. What could be the reason for these appearing? I recently did an upgrade to version 4.6.4 (drupal 7.38), but I'm not sure if this was what triggered this.

Appreciate any suggestions!

# Answer
Since it's coming from `include_once` I suspect you have two `civicrm.settings.php` files.

The correct location is `sites/<default or example.org>/civicrm.settings.php`

If there's a file in `sites/civicrm.settings.php`, rename or remove it and see if that ends the errors.

--

EDIT: OK, having reformatted your question I can see the file path isn't actually `sites//civicrm.settings.php` ... StackExchange was hiding your sites directory because of the angle brackets.

SO - either you have two files (eg `sites/default/civicrm.settings.php` AND `sites/example.org/civicrm.settings.php`) OR your site somehow include\_once's it after it's already included (?).

Let's use grep to look for files which define that constant:

```
grep -riE '^define.*CIVICRM_MEMCACHE' /path/to/site/root

```

If that identifies multiple files with this constant defined, then you probably want to eliminate one of those files. If it only locates a single file, then you may need to dig further to identify why that file is being included twice ... especially when the *second* time, it's being included using `include_once` :)
> 2 votes

---
Tags: drupal, cron-job, logs, civicrm.settings.php
---


# Question
Title: Generalizing create/update validation on form and api
Lemme cite an example before explaining the cause.

1. Updated the amount of an contribution id n via Contribution.create api from $100 to $150 and "Execute"d it from API Explorer. (No validation error)
2. Open the edit back-office contribution form of same contribution ID n. The amount is rightfully changed to $150, but problem is when without doing anything simply save the form and it throws a validation error "Net amount and/or Fee amount must be equal to the Total amount"

The question arises "why didn't I got any validation error at step 1?". Answer lies on the native validation rules written under formRules() func which are not meant for corresponding API.actions. Likewise there are other entity attributes which raise the same concern.

So my suggestion/fix would be to introduce a BAO function for such validation(s),

> > Flexible enough to accept input params from both APIs and Forms
> >
> > Provide API Exception(s) and validation error(s) for APIs and Forms respectively
> >
> > Optimize API and Form validations
> >
> > And of course would be a BAO function to get called in both APIs and Forms

Thoughts ?

# Answer
> 1 votes
Monish, I think the problem is that if you use the api to change the total amount & don't pass in other amount values the BAO should assume that net\_amount has now changed similarly. I thought we had done something in the BAO - but maybe only on new contributions.

I think at the BAO level adding this logic makes sense

```
if (contributionTotalAmountHasChanged() && empty($params['net_amount')) {
   $fee_amount = !isset($params['fee_amount'] ?
     getFeeAmountFromDB() : $params['fee_amount'];

  $params['net_amount'] = $params['total_amount'] - $fee_amount;
}

```

Possibly some argy bargy around whether $params\['fee\_amount'\] = '' vs $params\['fee\_amount'\] = 0;

At the form level - if someone changes the total\_amount then probably we should either 1) update the other amounts using js or 2) reset them sensibly on submission (e.g like above) & present them with a notice that this has happened.

It's a bit of a pain having to change net\_amount & for most users the field is not relevant

---
Tags: api, validation
---


# Question
Title: Upgrading from 4.6.4 to 4.6.6 returns following error, how to go pass it?
Although I have followed all the steps listed in the upgrade tutorial, this is the message comes up in the beginning of the upgrading process. I have tried on my demo & production site, both have same error. how to fix this please?

# Answer
See Failed Upgrade 4.6.4 to 4.6.5 Joomla 2.5 & 3.4. Let us know whether the procedure described there solves the problem.
> 1 votes

---
Tags: upgrade
---


# Question
Title: constraint violation during event registration
Getting constraint violation error during event registration. I found that, this error happening when it's saving the custom field value after saving participant info. There is a post hook in my custom module, in that i have code(**civicrm\_api("Relationship", "create",$params)**) to create relationship for contact, if i comment that line it's working fine. Current version am using is CiviCRM 4.6.2. This issue was not there with my previous version 4.3.5.

Can we not use create-api in post hook?

Please suggest.

# Answer
If your hook relies on $objectRef being populated, check whether it actually is - they aren't always. See Should civicrm\_post hook receive populated Relationship object following relationship enable/disable in UI?
> 1 votes

# Answer
You probably need to do some debugging as to why it is happening. If you turn back-trace & debugging on (debugging is an option under administer/system settings) you should be able to see the failing query and the backtrace. If you can't interpret them you should paste them back here
> 0 votes

---
Tags: civievent
---


# Question
Title: A tick box "same as home/primary address" when submitting Event/Contribution from Admin using paypal pro. way to fix it?
Although selected contact has an address in his profile (But No Billing address). It would be useful to have a tick box saying "same as home/primary address", admin doesn't need to type in all the info again. Can anyone suggest how to do it in a quick way?

# Answer
What version are you on - I just checked a 4.6.6 site & a contact with a home address (only) is getting the prefill - although if you change processor that form is not prefilling. (there is an open ticket about that )
> 1 votes

# Answer
You can remove the requirement of those fields using `hook_civicrm_buildForm()` \- see CiviCRM hook reference

Here's an example from a couple of years ago, although this was written for user-facing forms:

```
/**
 * Implements hook_civicrm_buildForm().
 */
function example_civicrm_buildForm($formName, &$form) {
  switch ($formName) {
    case 'CRM_Contribute_Form_Contribution_Main':
      $fields_not_required = array(
        'billing_first_name',
        'billing_middle_name',
        'billing_last_name',
        'billing_street_address-5',
        'billing_city-5',
        'billing_state_province_id-5',
        'billing_postal_code-5',
        'billing_country_id-5',
      );
      foreach ($fields_not_required as $field) {
        $form->_paymentFields[$field]['is_required'] = FALSE;
      }
      break;
  }
}

```
> 1 votes

---
Tags: addresses, paypal
---


# Question
Title: Is there a way to set up PCPs without the user having a login?
As the question suggests we are aiming to use PCPs for an event of ours but would rather not have user logins enabled as we don't need them for anything else. Unfortunately all the text on the PCP set up pages tells users they can change things after and login etc, is there an easy way to change these so the users know when they finish its fixed and they will have to contact us for a change as this seems easier than setting up user account sign up just for this one use?

Alternatively if somebody can give me some quick pointers to set it up so the users can sign up for accounts while creating PCPs I'd be happy with that?

I've already spent a few hours searching on this subject so hope I haven't missed something obvious and I'm not wasting everybody's time, really hope somebody can help and thank you in advance!

Sam

# Answer
I've encountered this issue before - and found it easiest to go with allowing user registration. I agree it'd be better if this wasn't necessary, but haven't found anyone willing to fund that improvement.

You haven't specified your CiviCRM version or CMS, which makes it a little more difficult to answer, but the general approach is to create a profile that you intend to use for PCP signup, go into Advanced Settings for that profile, and enable user registration there. This will enable signup directly on the PCP page.

Note that if you're using Drupal, and you've disabled user registration altogether within Drupal, the user registration block won't appear on the profile. I assume it's the same for Joomla/WP.

However, since you're enabling user registration, that also means that the default user registration page will also be enabled. I like to use theming to break the normal user registration page - that will drastically cut down on the number of spam user registrations you'll see.
> 1 votes

---
Tags: personal-campaign-pages, user-account
---


# Question
Title: SSL enabled CiviCRM with forever loading dashlets?
We had a CiviCRM installation where the dashlets worked fine...until...we configured Apache to forward all requests over 443 (https).

It seems that now an AJAX callback is failing (going directly to the callback leads to a "Sorry but we are not able to provide this at the moment." error. The error details with debugging turned on state:

$Fatal Error Details = Array ( \[callback\] =\> Array ( \[0\] =\> CRM\_Core\_Error \[1\] =\> handle ) \[code\] =\> 0 \[message\] =\> \[mode\] =\> 16 \[debug\_info\] =\> \[type\] =\> PEAR\_Error \[user\_info\] =\> \[to\_string\] =\> \[pear\_error: message="" code=0 mode=callback callback=CRM\_Core\_Error::handle prefix="" info=""\] )

Which is not terribly helpful for us who are not very familiar with the CiviCRM core. Any ideas why this issue is occurring and/or what the fix might be?

Thanks!

# Answer
> 3 votes
Check your CiviCRM base URL - the CMS configuration (`$base_url` in Drupal settings.php), CiviCRM (`CIVICRM_UF_BASEURL` in civicrm.settings.php) and webserver configuration (canonical location you rewrite to) must all match.

For the dashboard to work, the webserver needs to be able to access the website itself.

If you're hosted at https://www.example.org the CiviCRM dashboard needs to be able to retrieve https://www.example.org/civicrm/report/instance/68 and so forth.

A webserver which can't access itself directly (reverse proxy, SSL, DNS may factor in) will fail loading the dashlets.

Same question, longer answer: The dashboard does not render

# Answer
> 1 votes
Chris' suggestion to check your Base URL is a good one - I'd also check **Administer menu \> System Settings \> Resource URLs**, because if they're misconfigured you'll see similar issues.

# Answer
> 0 votes
There was also the issue CRM-16035: Dashlet refresh *can* crash server - replace use of HTTP\_Request recently, but what you describe doesn't sound like that.

---
Tags: dashboard
---


# Question
Title: How to disable datepicker UI for a mobile device
I like the datepicker UI, but many people don't.

We require date of birth on a few forms. Each week I get at least one complaint that someone can't fill out the form on a mobile. Not sure if a bug or user error. I think the easiest thing is to disable it for mobiles. Ideally, have an icon to trigger it.

I was wondering if there is a clever /safe way to use css for this so we can use @media queries to disable for mobile devices.

I was experimenting with

#ui-datepicker-div { z-index: -9999; display: none!important; }

which seems to work, but disables validation. Looking for any other keen ideas.

# Answer
> 2 votes
To use the native datepicker of the mobile device, the field needs to have `type="date"`. So your code to disable the datepicker popup and use the native device's instead might look like:

```
(function($) {
  $.ui.datepicker.prototype.options.focus = "button";

  $(document).on('crmLoad', function($region) {
    $('input.dateplugin', $region).each(function() {
      this.type = 'date';
    });
  });
})(CRM.$);

```

---
Tags: javascript, date-preferences, css
---


# Question
Title: How does CiviCRM make the link between uploaded pdfs and the database table?
I want to import many pdfs into Civi and so need to make the link between the uploaded pdf and the database table. I used the UI to upload a sample pdf (calke\_walk.pdf) and looking at the db table, the field in question contains an int(10) unsigned with a value of 8. The uploaded pdf has a file name of Calke\_walk\_a0e8f5791bb72c5b53c253f4fa66fd2f.pdf In Civi's UI the file has a url that ends with &id=8&eid=28308 The clue there is the &id=8 I guess, but is there more to this that I need to know?

# Answer
Try using the attachment api, it will handle the nitty-gritty for you.
> 2 votes

---
Tags: pdf
---


# Question
Title: How to design ACL for a multi-level organisation
We have an Organisation with cca. 400 local branches and have trying to achieve a following ACL behaviour:

-- Organisation members needs to be able to login and have access to their Organisation members records only.

-- Organisation admins may administer all members in their Organisations and Organisation itself (and in theory could be administering more than one Organisation thus more members).

-- Organisation admins need some kind of dashboard which gives them access to their own societies.

-- Main civiCRM admin(s) need to be able to assign ACLs to a user

We have Relationships in place, so each Organisation has it's members listed in Relationships tab in civiCRM. Now, this is a workaround which seems has to be done:

**1. civiCRM side**

1.1. Create Group (AccessControl) for each Organisation

1.2. Create Group (AccessControl) for each Organisation Admin Users (NB! SmartGroups wi not work since there is no AcessControl for them, there is a thread from 2007 regarding this: http://forum.civicrm.org/index.php?topic=1645.0)

1.3. Create ACL Role for each Organisation Admin

1.4. Assign each ACL Role to corresponded Organisation Admin Group

1.5. Create ACL for each Organisation where Role = Soiety Admin Role and operation = Edit and Type of Data = Group of Contacts and Group = corresponded Organisation Group

**2.Drupal side**

2.1. Create Role for each Organisation Admin

2.2 Grant access:

* Admin Menu
* CiviCRM: profile listings and forms
* CiviCRM: profile listings
* CiviCRM: access CiviCRM
* CiviCRM: access Contact Dashboard

2.3. Create/move DrupalUsers based on Civi Contacts we'd want to be admins and assign each of them to own Role

2.4 Use "CiviMember Roles Sync" http://wiki.civicrm.org/confluence/display/CRMDOC/CiviMember+Roles+Sync to sync Drupal Roles with Civi Groups

---

We've studied some related threads:

1. "Multi-level Organization ACL Permissions" Multi-level Organization ACL Permissions ( where multi-site workaround suggested sounds even more overhelming than current approach,since we have 380+ organisations and all Contacts data currently stored in single CiviCRM database ). Have tried also "local permissions extension we built for the National Democratic Institute" hoping that it would be possible to convert geografic-centered approach to Organisations-centered; may be it's a way to go, although it needs deep code diving.
2. "Allowing group management to users with limited permissions" Allowing group management to users with limited permissions from where we've found out that " users can only view the groups for which they explicitly have an ACL for. " which doubles all work, since now we need a pair (Admins and Members) of Role,ACL,Group for each Organisation.
3. Yet another option found has been a "Related Permissions Module" extention from nz.co.fuzion ( http://github.com/eileenmcnaughton/nz.co.relatedpermissions/zipball/master ) suggested among related threads at stackexchange or forum.civicrm.org, however it doesn't seems to be compatible with most recent version of civicrm. This one sounds like a best "theoretical" approach so far since it tends to use component (Relations) which have been already installed and configured. However it's hard to find out from here if it worth investment of development hours to make it work since it's hard to say if it was working the way we need.

Afraid, not all related links from all sources are listed here (like related pages from book.civicrm.org or wiki.civicrm.org), we've studied a lot.

So, any fresh advice will be highly appreciated; can't believe CRM might have such,well, let's call it "complex" permissioning system.

# Answer
> 0 votes
Well, it has turned that unfortunately it's a feature one would have to pay for.

# Answer
> 4 votes
IMHO it seems like you really need a consultant for this stuff. Hopefully an organization of your size (400 chapters with an unknown # of people per chatper) has budget for help.

But let me offer a few bits of advice:

1. the "corresponded Organisation Group" as you put it CAN be a smart group, thus people (not admins) can self-select their own groups when they signup and/or register if you use a custom data field for "select your chapter".

2. CiviMember Roles Sync doesn't work as you describe, that's Civi Group Role Sync for that functionality
    3. I'm not sure why you feel people need to use CiviGroup Role Sync
    4. Don't understand your point 2.3

So I hope that helps, I've done this on a smaller scale for a group with 12 national chapters and 20-30 people per chapter, it works pretty well. Please remember I do think a consultant with experience on ACL is needed.

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


# Question
Title: Dynamically send scheduled email to a group?
I'd like to schedule an email to be sent next month to a group.

Is there a way for me to schedule the email today, but to still have individuals that are added next week to the group receive that email?

Civicrm 4.6.4 and Drupal 7.38

# Answer
Not sure how I missed this, but this post confirms that email recipients are defined at time of scheduling the mailing for smart groups.

(Since this is true for smart groups, I'm assuming this is also true for normal groups – indeed as my brief testing (above) demonstrates.)
> 3 votes

# Answer
I haven't verified this but you should be able to create your email in civimail and schedule it to send to the group with the send date set for the date next month. It should send to all in the group on that date.

You could test it by setting up a test group and putting a test person in the group setting up the email to run in 15 minutes and then go and add another test person to the group and see if it sends to both contacts in the group.
> 1 votes

# Answer
Another option will be to use a Smart Group with the search criteria set on the Group you want to target.

See Smart Groups for details on how to set it up.
> 1 votes

# Answer
If current and future members of the group have something in common relating to events, contributions, membership or activities then you may be able to create a scheduled reminder based on that common "something" and use **Recipient(s)** \- **Limit to** \- **Select a group** to send to all members of your smart group at the time the email is sent.

I have never actually set up a scheduled reminder to run on a fixed date, but I know that mail recipients are determined at the time of sending the email for relative date sending.
> 1 votes

---
Tags: civimail
---


title: Is it possible to do an IPN replay?

text:
# Question
Title: Is it possible to do an IPN replay?
From CiviCRM 4.5 on, IPNs (recurring payment notifications from the payment processor) are recorded in `civicrm_system_log`. Is there a way to replay these IPNs to CiviCRM?

# Answer
> 4 votes
Jon G, for Authorize, the answer is Yes, using Eileen's extension - see:

What should drush cvapi NotificationLog.retry sequential=1 system\_log\_id=XXX do?

and get the extension at:

https://github.com/eileenmcnaughton/nz.co.fuzion.notificationlog

---
Tags: payment-processor, ipn
---


# Question
Title: Recent 'git' seems to be missing CRM/Event/DAO folder
First noticed on a Virtual Ubuntu system, now on Windows 7 - I used the 4.6 branch (git checkout upstream/4.6) and no folder was created for CRM/Event/DAO (and no Event.php, Participant.php, ParticipantPayment.php). Other folders (BAO, Form, Page, etc.) are created. Anyone else see this?

# Answer
> 3 votes
A git clone of the CiviCRM source tree is not a complete CiviCRM codebase.

Some CiviCRM code is autogenerated, via a script named `GenCode.php`

See Github for CiviCRM for full instructions.

---
Tags: civicrm-buildkit
---


title: How do I bulk delete contacts?

text:
# Question
Title: How do I bulk delete contacts?
Is there a way to bulk delete contacts? I don't see a way out of the box of civicrm to select contacts individually form a report or search result, the way that views bulk operations does in drupal (with the checkboxes in front of contacts.

# Answer
> 4 votes
Yuri. You can do this from ANY search option. Delete Contacts or Delete Permanently are options under ACTIONS. You can verify this on the demo site. If you do not see same options on your system I would start by looking at the Permissions

---
Tags: contacts
---


# Question
Title: What do I do when rebuild Smart Group Cache fails?
(Sorry, was hoping to not have to start a new Question but instead comment on another's but StackExchange doesn't allow it unless you have 50 points of privileges.)

```
CiviCRM 4.6.0
Joomla 3.4.1

```

I am getting errors on both manual use and cronjob:

Manual button in Groups:

> @import url(/administrator/components/com\_civicrm/civicrm/css/civicrm.css); @import url(/administrator/components/com\_civicrm/civicrm/bower\_components/jquery-ui/themes/smoothness/jquery-ui.min.css); Sorry but we are not able to provide this at the moment. is not of the type Int
>
> Return to home page.
>
> function toggle( element ) { var className = element.className; if ( className == 'crm-accordion-wrapper collapsed crm-fatal-error-details-block') { element.className = 'crm-accordion-wrapper crm-fatal-error-details-block'; } else { element.className = 'crm-accordion-wrapper collapsed crm-fatal-error-details-block'; } }

Scheduled Jobs (cronjob):

> Parameters raw (from db settings): limit=Number optional-Limit the number of smart groups rebuild
>
> Parameters parsed (and passed to API method): a:2:{s:7:"version";i:3;s:5:"limit";s:56:"Number optional-Limit the number of smart groups rebuild";}
>
> Full message: Finished execution of Rebuild Smart Group Cache with result: Failure, Error message: A fatal error was triggered: is not of the type Int

# Answer
> 4 votes
could you create a new issue for this on JIRA and link it as related to https://issues.civicrm.org/jira/browse/CRM-15816.

# Answer
> 1 votes
Maybe I'll save someone some time until there is some sort of integrated fix or if these are just flukes (however, I see them on multiple sites).

On one site with only one smart group: I disabled it I created a new smart group Successfully ran rebuild system cache!

It seemed to clear up an error in our dblog about htmlentities (htmlentities() expects parameter 1 to be string, array given in CRM\_Utils\_Type::escape() (line 261 of sites\all\modules\civicrm\CRM\Utils\Type.php)) and also mailing issues to that smart group.

Tonight I'll try to disable all of my smart groups on another site, run the rebuild and see if it clears it up there.

**Update:** On site with multiple smart groups, I went to Manage Groups, clicked on Contacts for each Smart Group and on one group, I got the error message about is not of the type Int.

All other Smart Groups correctly displayed the contacts within that group.

So I disabled that Smart Group and successfully ran Rebuild Smart Group Cache.

If I re-enabled that group and ran the rebuild again, the htmlentities error came back.

# Answer
> 0 votes
Try PR created at this link which fixes some searches leading to DB error. May be, it should be able to fix your issue.

---
Tags: smartgroups
---


# Question
Title: How to create a report of all contact organizations?
Creating a report of constituent individuals appears to be easy, but I can't see how to create a report of all organizations.

# Answer
Okay, I found learned that contacts can be filtered by contact type, so when I create a report I can use that filter. Duh..
> 1 votes

---
Tags: contacts
---


# Question
Title: civiCRM Cron only run one mail_report scheduled jobs?
I'm using CiviCRM 4.4.6 in drupal 7.

In my scheduled jobs list, I had 3 scheduled jobs of membership report: report A, report B, and report C. These reports will send out email with different csv attachment.

When I click "Execute now", these 3 reports send email perfectly.

I'm using Elysia Cron to control both drupal and CiviCRM cron, and use external crontab to run cron in my control panel.

CiviCRM cron runs, but it only trigger report A. Both report B and C is missing.

My question is:

Does CiviCRM cron only allow one mail\_report scheduled job to be run?

If so, does it mean that I have to put in multiple report IDs (instanceId) in one mail\_report scheduled job?

I tested it, and only one instanceId is allowed in one mail\_report scheduled job.

Is there any way I can send out multiple email reports when running cron?

# Answer
You have to create 3 instances of the mail\_report scheduled job.

To do that, use `Add New Scheduled Job` button on the `Settings - Scheduled Jobs` page (`civicrm/admin/job?reset=1`)

On the creation page, set API call to `Job` / `mail_report` (`api.job.mail_report`) and define in `Command parameters` the appropriate `instanceId` and `format` options.
> 8 votes

---
Tags: civireport, cron-job
---


# Question
Title: "find out more..." link for civievents points to a page that does not exists
I'm running civicrm 4.6.5 in WordPress 4.2.4. I'm using civievents to manage multiple events and would like to display these events on a WordPress Page.

I'm using the following short codes on the events page. \[civicrm component="event" id="17" action="info" mode="live" hijack="0"\] \[civicrm component="event" id="18" action="info" mode="live" hijack="0"\]

And they appear like this: https://lofcenter.org/events/  **But when I click on either event to "find out more..."** it points to https://lofcenter.org/civicrm/?page=CiviCRM&q=civicrm/event/info&reset=1&id=17 **and gets the following error:**  Am i missing a configuration option?
btw - I'm not running any Cache on this installation.

Any suggestions?

# Answer
Those paths look correct, but they depend upon a page existing at the path /civicrm. CiviCRM 4.6 creates one upon install, but maybe you renamed or removed it not knowing what it was for.

**The simplest solution is to create a blank page called CiviCRM that has the URL https://lofcenter.org/civicrm**

CiviCRM on WordPress takes a page, wipes the content, and sticks the CiviCRM content there when the "page=CiviCRM" parameter is set. The page it uses is whatever's before the question mark in the URL, and you can set it in Administer \> System Settings \> CMS Database Integration. However, any working page or post will do, so just to demonstrate, the link https://lofcenter.org/aboutus/?page=CiviCRM&q=civicrm/event/info&reset=1&id=17 works just fine. You just need to make sure the page CiviCRM points to exists, so you can either set the base page to an existing page or create a base page where CiviCRM expects one should be.
> 3 votes

---
Tags: civievent, wordpress
---


# Question
Title: How can I mass edit country or city values of many contacts?
In Drupal you've got something like views bulk operations and 'modify entity values' but in CiviCRM that is not available. I have read in the documentation that this be accomplished using 'Profiles', but I find it rather difficult to understand. Can someone please explain in simple steps, how to bulk edit the country field of multiple contacts?

# Answer
> 10 votes
Profiles are used for so many unrelated things that it's kind of ridiculous. Here is the minimum needed to bulk edit country for a bunch of contacts.

1. Create a new profile. Don't worry about any of the settings besides the name, which you might call "Country Update".
2. Once you save it, you'll be shown the New Profile Field screen. For Field Name, select Contacts, then Country, then Primary (or whatever location type you prefer). Don't worry about any other fields, and click Save.

You now have a profile with a single field in it--the field you want to bulk update. You could potentially skip these steps by using an existing profile with Country in it.

3. Search for the contacts you want to update. Check the boxes or select all records (the maximum to batch update at once is 100, and they have to be the same contact type--individuals, households, or organizations), and select Batch Update via Profile in the Actions drop-down.
4. Find your "Country Update" profile in the list, and select Continue.
5. You'll see the list of contacts and a field for each contact's country. To set them all in one go, set the first contact's country, and then click the copy icon in the header. That will copy all the way down the column. Click Update Contacts, and you're done.

Once you get the gist, you can set up more complicated profiles and set multiple fields in one sitting.

---
Tags: contacts, profile
---


# Question
Title: Is it possible to move data from a contact type to a component/extension?
I'm still figuring out how to organize our organization's data before importing it into CiviCRM. One question that came up is whether it would be possible (through the UI or through SQL) to move some custom field set data from a contact type to some CiviCRM component or extension, if such a need arises later on.

To be more specific, I'm thinking of creating a custom field set for the Individual contact type. The field set would store data about an individual's qualifications. This is all well and good, but what if later on it starts making more sense to have the data about individuals' qualifications in some CiviCRM component or extension (e.g. CiviHR)? Then I imagine this data would have to be moved from the custom field set to that component/extension.

I know that in CiviCRM all data across components and extensions is integrated. But who knows, it may turn out that it is much more convenient to have the data about people's qualifications in CiviHR (or other) rather than have it as a custom field set. I don't know how things might develop in the future. And that's the point. I would much rather have the ability to juggle around the data and organize it the way I want to. This kind of flexibility seems important to me, especially since I don't think I'd get the data organizing right the first time.

Or if there are some fundamental flaws in my thinking and my question doesn't make sense, please let me know. Thanks in advance!

# Answer
> 3 votes
It's good to be thinking about where the data is stored, but don't let your thinking ahead get in the way of getting started somewhere. It's not unusual for organizations using CiviCRM heavily to decide they need to remap data somehow, and the fact that the data is in CiviCRM somewhere already makes it one step easier. **The short answer is that you should put your data in the place that makes the most sense right now, and if you have to move it later, it'll take a little bit of work, but nothing overwhelming.**

Since you're worried about just some potential future place to store data, I'll have to be a bit abstract, but the principle should hold.

There are two main tasks you'd face if you were to decide that your data in custom fields really belongs in different custom fields or an extension's ad-hoc tables. The first is moving data, and the second is any transformation that may be necessary.

Using SQL queries, moving data to and from custom fields is relatively easy. You'll end up doing something like

```
INSERT INTO civicrm_value_newtable
SELECT NULL as id, entity_id, oldfield AS newfield
FROM civicrm_value_oldtable

```

to move the data from one custom field to another. Of course, you could also export to CSV and then import from CSV, mapping the old field's column to the new field. Since you have the contact ID, you know who a value belongs to.

The more challenging aspect is if you need to transform the data. Maybe you have three categories, and the new system takes four. Maybe you have two fields where the new system has one, or vice-versa.

Not knowing what situation you might encounter, the only thing you can do is to pick the most useful and accurate ways to store your data now. The better your data now reflects reality, the more reliably you can transform it into something else.

When it does come time to transform, you can do SQL functions; and export, alter within CSV, and import; or a series of SQL insert queries, such as

```
INSERT INTO civicrm_value_newtable
SELECT NULL AS id, entity_id, "option1" AS newfield
FROM civicrm_value_oldtable
WHERE oldfield = "A";

INSERT INTO civicrm_value_newtable
SELECT NULL AS id, entity_id, "option2" AS newfield
FROM civicrm_value_oldtable
WHERE oldfield = "B"
  OR oldfield = "C";

```

and so on for each new possible value.

In sum, don't let the perfect be the enemy of the good, and don't work so hard to prepare for vague possibilities that it's not functional now. "If it's a life of possibilities that you wanna live...."

# Answer
> 1 votes
It's often easiest for extensions to build on top of custom-data, so several CiviHR modules do that. In fact, CiviHR prompted development of a code-generator for custom-data. Take a look at Create a Module Extension and especially the section "Add Custom Fields".

It is possible for an extension to create custom SQL tables. This is discussed a little bit in the section "Add a database upgrader / installer / uninstaller" (which produces skeletal code and a bunch of comments). You can work with the new tables using `CRM_Core_DAO::executeQuery()`. (Also: In a pinch, `CRM_Utils_SQL_Select` and `_Insert` may help.)

Some extensions go a step further and create DAO classes (in the same style as core code), although the technique is generally experimental/unsupported. You'd have to carefully trace some example modules (like CiviVolunteer and CiviHR's job module) and talk with their authors about how they work.

---
Tags: extension, custom-fields, import
---


# Question
Title: How to modify/test Upgrade/Incremental/sql..sql script?
I am following instructions here: https://github.com/civicrm/civicrm-buildkit/blob/master/doc/daily-coding.md#upgrade-tests to add and test a schema update - the upgrade is to add 2 columns to the core event table. A (perhaps stupid) question, do I update the latest version of the versioned (e.g 4.6.\*alpha.sql, 4.6.\*beta) files in ..Incremental/sql? Since this is not a fix/addition to a particular version but part of brand-new functionality, is that a good assumption?

# Answer
> 2 votes
If you're targeting the `4.6` branch, then put the upgrade script in the latest `4.6.X.mysql.tpl`. If you're targeting the `master` branch, then use `4.7.alpha1.mysql.tpl`.

As a rule of thumb, we try to minimize schema changes in stable release branches (e.g. 4.6.x) and instead put them in `master`. But that's not absolute.

The difference between a bugfix and a new feature is a bit academic. When a user installs vX.Y.Z., the upgrader needs to apply all schema changes needed to match vX.Y.Z.

---
Tags: upgrade, civicrm-buildkit
---


# Question
Title: Can Honoree type and name be inserted into the Contribution email receipt?
I feel like this might exist but I can't find it:

What's the best way to insert honoree information in a thank-you letter to a donor? Especially for batch thank you letters.

# Answer
I haven't tried this for honoree info but I have been able to successfully add tokens to the email receipt by pasting the token in the message template in administer - communications - message templates
> 1 votes

---
Tags: tokens, honoree
---


# Question
Title: Cannot edit prefix, suffix, first name or last name of new or existing Individual
After upgrading my CiviCRM to 4.6.4 (& 4.6.6 after that in trying to fix this problem) I cannot see or edit suffix, prefix and first or last name of Individuals on the Contact Screen. Even when creating a webform with the civicrm\_webform module I cannot add these name fields in a new webform, they just don't show up and are missing from webforms which used to have them. Also in the administration section on the display preferences page I cannot longer choose to display these fields on the contact screen.

If I create a profile with the name fields for Individiuals I don't have any problem. I can add those fields to the profile and can use the profile to change the names of Individuals. I can also export the fields. Any help would be much appreciated.

Steps I already took: compare my 4.6.6 database tot a fresh 4.6.6 db intall and adjusted the differences I found, several cache flushes, explored the different debug options but the problem is I cannot seem to find an error within CiviCRM when I try to edit the name of an Individual. It doesn't sem to trigger an error or I am no able to find it.

I will try and add some screen shots of the pages with the problem to make it more clear.

# Answer
SOLVED. The update to 6.4.4 seemes to have deleted some values in the 'civicrm\_option\_value' table. These options reffered to the option group with the name 'contact\_edit\_options' in the table 'civicrm\_option\_group'. The options for 'First Name', 'Last Name' etc. were no longer present and if these aren't present those fields just dissapear from the contact while editing. They also do not longer show on the 'display preferences page'.

It seems the upgrade to CiviCRM 4.6.4 I did didn't take well and deleted those option values, or it could be that the upgrade needed to add these option values in order to make 6.4.6 work but didn't succeed in adding these to the database, I am not sure. I did experience problems with my database before doing the 4.6.4 upgrade and didn't get the message that the upgrade was succesfull, so it is difficult for me to say what actually caused the problem.

The easiest way to check for the possibility of the existence of this kind of problem is to install a seperate new empty installation of the same CiviCRM version and compare these two tables for options that are present in the 'empty' CiviCRM but not in the CiviCRM with the problem. I was ble to get the name of the option group that had the problem by checking the code from the 'display preferences page'.

Hope this helps someone with the same problem. I spend days figuring this on out.
> 3 votes

---
Tags: contacts, upgrade, webform-civicrm, 4.6.4, admin
---


# Question
Title: Trying to integrate Views with CiviCRM but cannot see the code
I am trying to integrate Views with CiviCRM but cannnot see the code in the CMS Datbase section to add to the settings.php file. I am stuck on step 5. Has anyone come across this issue?

The steps are here - http://wiki.civicrm.org/confluence/display/CRMDOC/Views3+Integration

# Answer
> 3 votes
Solved. You need to go to your civicrm.settings file first and then add the drupal base URL in the section where it says add your drupal URL and then you will see the code.

1. Follow the steps in the link for Views.
2. In the civicrm.settings.php file there will a comment around line 58 which asks to enter the Content Management System (CMS) database connection details. Once this is entered the views should show up.

# Answer
> 0 votes
Sohal, see this video from CiviCON Denver 2015 as well - it might help - CiviCON Denver- CiviCRM Drupal Integration Showcase

---
Tags: drupal-views
---


# Question
Title: How can I make every new Group a type Mailing List?
I have a request to enable making every new Group created (using search results -\> Actions -\> Add Contacts to Group) a group type Mailing List by default, thereby saving a user having to check the box next to Mailing List. Can I do that with a new extension, using one of these hooks?

# Answer
> 4 votes
Use hook\_civicrm\_pre to modify the group-to-be prior to saving in the database. Experiment a little with your hook function, adding the debug lines:

```
if ($op == 'create' && $objectName == 'Group') {
  print_r($params);
  die();
}

```

Try creating a group with the Mailing List checked and then creating a group with it not checked to see what it passes. Write your code so that the $params array on a group where Mailing List is not checked ends up looking like the case where it is checked. And obviously delete your debug!

---
Tags: extension, groups, hooks, mailing
---


title: I do not receive bounces

text:
# Question
Title: I do not receive bounces
CiviCRM 4.6.4 With Joomla. I mass mail are successfully sent. But I do not receive neither bounces nor notification of bounces. Some wrong or non existent mail addresses are used as a test. Here following my settings:

The mail server of my provider is able to manage bounces. Could you help me to configure both the mail server and /or CiviCRM? Thank you.

# Answer
> 1 votes
There is some explanation here that you have probably already read http://book.civicrm.org/user/current/advanced-configuration/email-system-configuration/

Note it says: "The local part is optional and only relevant if you were able to set up an account using sub-addressing. It should be the account you created with '+' or '-' appended , e.g., "return+" or "return-"."

I see you have 'bounce' in that field which may be your problem

# Answer
> 0 votes
I think you need to use IMAP as the protocol.

In addition to the doc petednz points to you might also find some useful info here. http://wiki.civicrm.org/confluence/display/CRMDOC/Step-by-step+Return+Channel+on+Drupal+-+Google+Apps+-+CentOS

This refers to using google apps but I think most of this applies to others.

# Answer
> 0 votes
In addition to the answer from @petednz, you should check whether your email server at heldercamara.it supports plus-addressing in the first place. Assuming you edit the local part to `bounces+`, you should send an email to bounces+lotsofgibberish@heldercamara.it and then log into bounces@heldercamara.it and see if it arrived.

If plus-addressing doesn't work on your server, you may be able to set a "default address" such that bounces@heldercamara.it receives all email to addresses on that server that don't exist. Each bounce will go to something like b.14235.132342323@heldercamara.it (or bounces+b.14235.132342323@heldercamara.it with plus-addressing), so you need to scoop them all up and get them into a single mailbox.

---
Tags: civimail, joomla, bounce
---


title: Database Insertion and Deletion

text:
# Question
Title: Database Insertion and Deletion
I am looking for a best practice approach. I am working on a module extension, which involves creation, retrieval and deletion of an entity(object).

I have created the DAO files for them, I am looking to the write place to write insertion and selection queries. Currently I am confused about writing them in a BAO file or the API functions.

Is writing this code directly in API functions a bad approach, and having a BAO is a necessity. Also, if we create a BAO is there a guide I should follow about what to do and what not to do.

# Answer
The BAO is not required, but it is what we always used to do. So the standard approach is: the API uses the BAO/DAO functions to insert and select. You can find a pretty simple example here: https://github.com/CiviCooP/no.maf.oppgavexml/tree/master/CRM/Oppgavexml
> 1 votes

---
Tags: database
---


title: Custom Group and Fields using API v3

text:
# Question
Title: Custom Group and Fields using API v3
I'm trying to query the API on CiviCRM 4.4.6 for a Custom Field (Attachment) on a Case and an Activity.

I've tried the examples here: http://wiki.civicrm.org/confluence/display/CRMDOC/Using+Custom+Data+with+the+API but couldn't get it to work.

I can see the custom fields available here; SELECT * FROM `civicrm_value_attachments_52`

I can also see the entity\_type for the case and file ID here: SELECT * FROM `civicrm_entity_file`

What query do I write to extract the attachment for a case or activity?

# Answer
you could try using the latest version of the API explorer to give you an idea of the API call. In general, if the custom field is attached to that entity you can just get it using the custom field number. The custom field number is the ID of the field, eg:

```
$result = civicrm_api3('Case', 'get', array(
'sequential' => 1,
'return' => "custom_315",
'id' => 1,
));

```

or REST:

```
/sites/all/modules/civicrm/extern/rest.php?entity=Case&action=get&api_key=yourkey&key=sitekey&json={"sequential":1,"return":"custom_13","id":1}

```
> 2 votes

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


# Question
Title: Is it possible to change the Mailing label format?
I would like to change the way the mailing label prints. i.e.. remove the country, bring postcode down to next line etc. Is it possible to do?

# Answer
> 4 votes
Go to **Administer - Localization - Address Settings**, and the mailing label format is there for you to edit. You can move, add, and remove tokes as needed.

(For reference, **Administer - Communications - Label Formats** handles the formatting of label size and arrangement on the sheet.)

---
Tags: address-labels, mailing
---


# Question
Title: Bug or feature? Logged in, can't do event registration. Not logged in, Event Registration loads
CiviCRM 4.6.2 on WordPress 4.2.1 When I'm logged into CiviCRM as an admin user, I cannot register for an event. I get a page with multiple sections, some with Private: *Event Name*, others are just *Event Name* without the Private on the front.

Log out, click the Event Registration and everything loads beautifully with all the fields showing up correctly.

BTW: Upgraded to CiviCRM 4.6.6 and WP 4.6.6 since then, same issue. As an aside note, my dev site doesn't have this issue. So it's something very particular to this one install.

Update: My dev site exhibits the same behavior when a Post is created with CiviCRM embedded and marked as Private, as the the Answer points towards.

# Answer
> 2 votes
Wow! That was painful! I had set up a couple of test posts for Cases, and marked them as private in Wordpress. I deleted those posts and now everything seems to be working once again as expected. (I left the one post that is a Public post. Note: These are posts, not pages.) Creating a new Private Post with a CiviCRM tag embedded resulted in the same behavior. I'll have to do some more testing, but it would seem that you can't have Private Posts with Civi content and see Public content while logged in. Thanks to everyone for your suggestions! I guess I'll try to figure out how to word such a bug now. Wish I knew how to just go fix it.

EVEN BETTER! It's already fixed. Or actually this is a symptom of a misconfiguration. (Potentially due to upgrading over time and missing a change.) By setting the WordPress Base Page variable to a newly created page, the problem disappeared. See the comments on the filed bug linked in the comment below in order to see what Christian Wach correctly surmised, along with how to actually fix it.

# Answer
> 4 votes
Also need permissions for Profile View and Profile Create? That solved a similar problem in my case

# Answer
> 3 votes
You should maybe check your permissions. I work with Drupal but I think that Wordpress has recently updated to be the same.

There are two permissions that allow you to see the event info and registration pages:

CiviEvent: view event info CiviEvent: register for events

They might just be checked for the public by not for administrators.

# Answer
> 1 votes
did you ensure that you are indeed an Admin? When you set up your WP User login, whatever you put in for your email will be the 'key' for your Civi Contact/User record. Find your contact record in Search and ensure that you're a member of Admin group. There's a function to 'sync' WP and Civi user records, Administer/Users and Permissions too. But frankly it sounds like something else is awry, not just permissions. Can you turn on Firebug, compare w/your dev site? Is this install running on the same server as your dev site, and if not, is the setup the same?

---
Tags: wordpress
---


# Question
Title: How can I determine if an extension is compatible with a new Civi version?
What is the best way to determine whether an extension is likely to be compatible with a contemporary Civi version rather than just not updated to reflect as much?

# Answer
> 5 votes
The best practice for upgrading is to upgrade a copy of your site on a "staging" or "development" server. That's a good time to test your extensions to see if they work.

Short of testing the extension, I don't know that there's a good way to ensure an extension works. However, you can:

* Read the code, if you know how. If it's all (or almost all) using API calls rather than BAO calls, you're probably safe.
* If you DO determine it to work well, post an issue on the ticket tracker for the extension (usually on Github) saying you tested it successfully with the latest version.

There's a volunteer extension review team, and their job mainly covers reviewing new extensions, not existing ones - but if there were more people, we could do this sort of testing!

With regard to this particular extension - it's mostly BAO calls, not API calls - but there's so little code, I'd be pretty surprised if it didn't work as-is on version 4.6.

# Answer
> 5 votes
If you go to the Extension page eg https://civicrm.org/extensions/civivolunteer then you should see a RELEASES section near the bottom which states what version of CiviCRM the extension is known to work for. This may be obvious, but your question doesn't explain what you have already done to check.

---
Tags: extension
---


# Question
Title: Smart Group that returns those recently added
I'm attempting to create a smart group that returns a list of people added on the current date without having to edit the criteria each day.

I've been starting with the "Date Added to CiviCRM" custom search, entering a date, then editing the civicrm\_saved\_search entry with no luck. Alternately, I'd settle for something that returns the last few people added using the maximum contact id number.

# Answer
Unless I'm misunderstanding, you should be able to use **Search menu \> Advanced Search**, select the "Change Log" accordion, and select the "Added" radio button. Then you can use relative date filters. I just tried it and it worked OK. I seem to recall that in Civi 4.3 and lower this was slow or broken, but should work in any modern version of Civi.
> 4 votes

# Answer
You could copy the 'Date Added to CiviCRM' custom search and edit it. Had a quick go here and it seemed to work if you change $startDate and $endDate to just be the current day. So altering the block at line 181:

```
$startDate = date('Y-m-d');
$endDateFix = NULL;
if (!empty($this->_formValues['end_date'])) {
  $endDate = date('Y-m-d');
  # tack 11:59pm on to make search inclusive of the end date
  $endDateFix = "AND date_added <= '" . substr($endDate, 0, 10) . " 23:59:00'";
}

```

Not terribly elegant, but I think that works. You'd probably want to remove the date fields from the form too, just to avoid confusion.
> 2 votes

---
Tags: smartgroups
---


# Question
Title: Why some of our smart groups are empty after CiviCRM upgrade?
We upgrade recently from 4.5.8 to 4.6.6 on our CiviCRM instances.

After that we note that some smart groups become empty. An example as proof:

**Smart group has been emptied:**

> Event type = Centre Obert ...and...
>
> Start Date - greater than or equal to "september 12th, 2013 12:00 AM" ...and...
>
> End Date - less than or equal to "juny 20th, 2014 11:59 PM" ...and...
>
> Participant Status ID is Inscrit ...and...
>
> Participant Role is 1

NOTE: Cleaning caches and rebuilding smart groups has not worked.

# Answer
> 1 votes
It is not the ideal solution but so far has worked.

1. Edit the search criteria for the affected/s smart group/s *\- The search result remain empty*
2. Search again - *The search result will be good*
3. Update the smart group

After this the smart/s group/s works correctly again.

---
Tags: smartgroups
---


title: State list for Fiji incomplete

text:
# Question
Title: State list for Fiji incomplete
Fiji is separated into 5 divisions, however civicrm only includes 4 in the dropdown "State" list. Here are what the "State" options should be..

* Northern
* Western
* Central (MISSING)
* Eastern
* Rotuma

I am assuming that it would be ok to do MySQL\> insert into civicrm\_state\_province(name, abbreviation, country\_id) values('Central', 'C', 1074);

Is it OK to do this, and if I do this, what will happen if and when Civicrm updates/upgrades ?

Thanks for your help...

# Answer
In theory you could update this by yourself via SQL. There are two arguments against this thought:

* The ID won't match anyone else's Civi, which could lead to problems with third-party extensions.
* This is a change that the rest of the community can benefit from.

I would file a ticket at issues.civicrm.org. If you have the chops to create a Github pull request, great! If not, no worries. Please be sure to include a reference to sources showing the missing "State", such as https://en.wikipedia.org/wiki/Local\_government\_in\_Fiji.
> 1 votes

---
Tags: contacts
---


# Question
Title: How do I make a Simple SOAP request in CiviCRM?
As I can see there is a get\_contact() function in CRM/Utils/SoapServer.php. I would like to use this function to get the list of contact. How can I do that ? Is it similar to how we make a Rest api call like `http://<site_name>/sites/all/modules/civicrm/extern/soap.php?` ? If it is, what params do I need to pass to get the required result ?

Any help/hints would be appreciated. Thanks.

Update : I'm using the latest version of CiviCRM.

# Answer
I don't have a proper answer to the question of how to use `SoapServer`, but it may be useful to place that in context.

The `extern/soap.php` script is a bit of a relic which is not on par with the RESTy APIv3. I was just a casual user at the time, but I'm pretty sure it predates APIv3 and (probably) APIv2. Its major use-case was facilitating a fast return-channel for CiviMail. (There's some kind of smtpd/perl/soap integration which folks used to use.) IMHO, the only reason to retain it in the codebase is for backward compatibility (on the off-chance that it maybe still works for existing installations).

If you skim the code of `CRM_Utils_SoapServer`, you'll see `get_contact()` and a bunch of mail-related actions (and basically nothing else). The design is generally... shallow.

If you really do need SOAP access, then I'd recommend implementing new bindings between SOAP and APIv3. Ideally:

* The SOAP implementation should be generic, passing along requests to `civicrm_api3()` and getting metadata from `civicrm_api3` (ie `Entity.get` and `*.getfields`).
* The SOAP end-point should ideally go through the menu/router system -- rather than a standalone script (e.g. `http://example.com/civicrm/soap` instead of `http://example.com/sites/something/modules/civicrm/extern/soap.php`).
* The SOAP end-point should ideally go into an extension.
> 2 votes

---
Tags: api, civicrm-home, soap
---


# Question
Title: Search on custom 'Yes or No' fields appears broken in 4.6.6
I've just updated our dev civicrm installation from 4.5.4 to 4.6.6. Now, searches on custom fields of type 'Yes or No' are producing weird results.

Eg, In a custom dataset for some specific membership types we have a variety of Yes or No fields. The database appears to have the correct data in it as compared between our updated dev and our live sites.

However, in the dev site, a search of memberships for 'display on website' produces 93 results for Yes, 93 for No and 93 for 'Yes or No'!! There are 861 results in the db according to phpMyAdmin!!! Yikes!

On the live site, the same search yields 892 for Yes, 91 for No and 983 for 'Yes or No'. There are 901 results in the db table according to phpMYAdmin. (The diff here could be some contacts are deleted, also we don't expect the dev site and live to be exactly the same.)

I've done the same membership search on a variety of custom boolean fields and they all show the same very weird results on the dev site; the same number for yes, for no and for 'yes or no'. In the db the field has many, many more results than the membership search.

Any help on this would be much appreciated!

# Answer
I have replicated this on another site on 4.6.6 & logged https://issues.civicrm.org/jira/browse/CRM-17006
> 3 votes

# Answer
Submitted the fix https://github.com/civicrm/civicrm-core/pull/6470 , also include fix for custom field of other data types (integer, float, money etc.)
> 1 votes

---
Tags: civimember, custom-fields, search-results
---


# Question
Title: Update custom field from other custom data
I'm trying to use a php hook to automatically create a relationship between two contacts. Let me set the stage for you.

Meeting Extender: a custom data set that extends the meeting activity(activity entity). It basically records a few custom fields, two of which are contact references(think pitcher and pitchee). These two fields would be two integers referring to contact A and contact B. Basically, I want to write a hook that creates a relationship, called Pitched to (A to B) and been Pitched(B to A).

The pipeline

A meeting is created, in the custom field set Google is saved as contact A and Apple is saved as contact B. The hook should realize a new activity has been created, check if the Pitched relationship exists between Google --\> Apple and if not create it.

This was my attempt so far(in an extension)

```
function checkActivityMakeRelationship_civicrm_post($op, $objectName, $objectId, &$objectRef) {
/* This file checks if an activity was created and if so
 */

    if(($op == 'create' || $op == 'edit') && $objectName == 'Activity') {
        $result = civicrm_api3('Relationship', 'create', array(
        'sequential' => 1,
        'contact_id_a' => **integer-referring-to-contact-a**,
        'contact_id_b' => **integer-referring-to-contact-b**,
        'relationship_type_id' => 11,//this is the relationship type for pitched
    ));
    }
}

```

Ignoring the 'relationship-already-exists' check for now, how to I find the correct integers for the contact A and contact B i just entered in to my custom data set. I imagine it is a part of $op but I'm not sure how to access it. Any help is appreciated, thanks. V

PS: I'm running wordpress 4.2.4 and civicrm 4.6.6

# Answer
SO I was able to figure this out, turns out I wasn't able to reference the custom data directly from the activity object but had to use the api to grab the custom data related to that activity object.

```
function checkActivityMakeRelationship_civicrm_post($op, $objectName, $objectId, &$objectRef) {
/* This function checks if a specific activity was created and if so makes a related relationship
*/

if(($op == 'create' || $op == 'edit') && $objectName == 'Activity') {
    $params = array(
        'sequential' => 1,
        'id' => $objectId,
        'return' => "custom_50,custom_51",//replace with your specific custom
    );
    $activity = civicrm_api3('Activity', 'get', $params);
    $contact_a_id = (int)$activity[values][0]['custom_50_id'];//note the appended _id
    $contact_b_id = (int)$activity[values][0]['custom_51_id'];// appended _id
    $result = civicrm_api3('Relationship', 'create', array(
    'sequential' => 1,
    'contact_id_a' => $contact_a_id,
    'contact_id_b' => $contact_b_id,
    'relationship_type_id' => 11,//your specific relationship id
    ));
}

```

}
> 1 votes

---
Tags: api, activities, hooks, relationships
---


# Question
Title: after i use api to update the database results not immediately showing
I'm running into an issue with the api. I use the following call to write to the relationships datatable

```
$result = civicrm_api3('Relationship', 'create', array(
    'sequential' => 1,
    'contact_id_a' => $contact_a_id,
    'contact_id_b' => $contact_b_id,
    'relationship_type_id' => 11,//your specific relationship id
));

```

from my solution in https://civicrm.stackexchange.com/a/4619/765

However, when I then go to the relationship tab the new entry is not immediately visible. I usually have to force a refresh by changing the relationships per page from 10 to 25 and then the new entry appears. How can I bypass/avoid this problem?

Thanks, V

# Answer
Sounds like you have to 'force' the summary page to rebuild. You can do this by re-building your userContext (which will be the summary page):

```
$session = CRM_Core_Session::singleton;
CRM_Utils_System::redirect($session->readUserContext());

```
> 4 votes

---
Tags: api, relationships, database
---


# Question
Title: How do I apply a patch supplied in the issue queue via Git?
A link was graciously provided to a PR on GitHub to fix an issue that I am watching in the Jira issue queue. The fix is only one line of code that changes a display, so I am confident applying the fix without upgrading my installation will not have unintended consequences in this particular case.

Obviously, I can change the one line of code by hand, but in the interest of trying to use best practices, I'd like to understand the best way of using Git itself to apply the change. I have Git installed on my server and use a private GitHub repository for our organization's code base.

The "GitHub for CiviCRM" documentation (http://wiki.civicrm.org/confluence/display/CRMDOC/GitHub+for+CiviCRM) is geared towards those contributing to the codebase rather than those who need to apply a supplied fix.

# Answer
> 12 votes
Applying a patch to a standard install doesn't require you to switch it over to Git. You can just apply the patch from a given PR (let's say it is PR #12345) like so from the command line:

```
cd path/to/civicrm
wget https://github.com/civicrm/civicrm-core/pull/12345.diff
patch -p1 < 12345.diff
rm 12345.diff

```

---
Tags: sysadmin
---


title: A list of all available tokens?

text:
# Question
Title: A list of all available tokens?
Is there a way to display a list of all available tokens on the system (other than scrolling through the dropdown)?

Our donor intake person would like to see what's available in a readable way.

# Answer
> 1 votes
Not that I know of, but FYI that dropdown is searchable, so you don't have to scroll if you don't want to.

---
Tags: tokens
---


# Question
Title: "Error: Please set the API URL" when buying a Free Membership
I have a contribution page that has six paid memberships and one free membership. When the free membership is selected, it kept displaying the error that the Payment Type (Processor)was required. After I deselected the required field requirement for Payment Processorm, the payment types disappear and they could make it to the "Continue" page, but then CiviCRM shows the "red banner" error page.

Is there a way to allow them to select a payment processor, even though the amount is zero? Thats what it used to do before version 6.0 (I think).

I am using CiviCRM 4.6.2 on Joomla 3.4.1. All paid memberships work great. However when the free membership ($0.00) is selected, the Payment Types - includeds Paypal, Stripe and pay by check, all disappear, but seem to require one be selected before allowing them to sign up for the free membership.

# Answer
> 2 votes
**UPDATE Aug19/2015: The fix is included in 4.6.7**

This bug as reported at https://issues.civicrm.org/jira/browse/CRM-14536 seems to be fixed and in QA - if folks can test and report finding that would be great.

The fix is available at: https://github.com/civicrm/civicrm-core/pull/6441

Patch: https://patch-diff.githubusercontent.com/raw/civicrm/civicrm-core/pull/6441.patch

How to do a patch?

---
Tags: civicontribute
---


# Question
Title: How can I edit how CiviEvent pricing is displayed?
I have a strange issue when creating a CiviEvent; which did not appear in a pre-launch test event I created but does now. As you will see below, the first fee in the list appears off-set to the rest.

I have checked on the dmaster site and it does not react this way. Of course it may be something that is happening on the Drupal side. I am using D7.38 and Civi4.4.14

# Answer
You may be able to fix this with custom CSS. The following class is what you would need to adjust. Try setting the margin-left rule until the options line up. I have seen this when I am adjusting column widths on front end forms.

.crm-container .crm-section .content { margin-left: 17%; }

Note: my edits are usually in WordPress. There may be interactions with your Drupal theme that override this.
> 2 votes

---
Tags: civievent
---


# Question
Title: Two users completing separate webforms on Drupal that create one activity on CiviCRM
For example: User 1 completes Webform 1 on Drupal to give details of a volunteering project, which when submitted creates an activity on CiviCRM.

An email then gets automatically sent to User 2 with a link to Drupal Webform 2 for them to fill out different details relating to the same volunteering activity, which when submitted, data gets added to the same activity that User 1 created on Civi, rather than creating a whole new activity.

I have read similar questions and answers but we are not working with CiviCase and I'm a Civi newbie so finding it hard to relate these solutions to our problem. Apologies if this is a bit of a basic issue but any help would be much appreciated.

# Answer
> 1 votes
You need a custom or temp table which holds user1\_ID, user2\_iD and activity\_id http://book.civicrm.org/user/current/organising-your-data/custom-fields/

So when you are creating the first activity set the activity status to schedule.

Create a new activity Type for your process if needed -

You need to create an extension and use hook\_civicrm\_post - set the activity to completed http://wiki.civicrm.org/confluence/display/CRMDOC/Create+an+Extension

If you need more help please let me know - thanks

# Answer
> 1 votes
I think you can do this by just supplying the aid in the url - see http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration

"aid=zzz: ID of the activity to autofill and update"

if you want to avoid changing which contacts are linked to the Activity then you need to also include the cid of 'user 1'in the url, so that they get loaded (privately) on the form too.

---
Tags: drupal, custom-fields, activities, webform-civicrm
---


title: Record the purchase of a publication

text:
# Question
Title: Record the purchase of a publication
I am working with an organisation that wants to record the purchase of publications that they sell. What is the best way of doing this?

The publications are purchased through a variety of channels including in cash and via third party websites such as Amazon. The purchase itself would not be processed via CiviCRM but they would like to be able to record the purchases within CiviCRM so that they can report on sales figures.

In terms of reporting they would like to know how many publications have been sold each month and how much income each type of publication has generated.

Would it be best to record these purchases using CiviContribute or as a custom activity type.

Thanks for your help.

# Answer
I would go down the CiviContribute approach first with a PriceSet and a specific 'contribution type'
> 2 votes

---
Tags: civicontribute
---


# Question
Title: How to make a Participant Listing menu link in Joomla
Bit of newbie question since we don't work with J! much. This is J! 3.4.3 in case that makes a difference.

I need to make a Participant Listing link. I have enabled it on the civi event, and the instructions there say

> Then create front-end links to the Participant Listing page using the Menu Manager. Select Participant Listing Page and enter 1 for the Event ID.

So I added a Menu, and added a Menu Item which allowed me to set the Menu Item Type to be Participant Listing (from a select) and that added a path in the Link field index.php?option=com\_civicrm&view=Events&layout=participantlisting

Looking around for where to add '1' for the Event ID, I find under Options a "select event" but it shows no options in the selector and I have no idea if that is referring to civi events or some other 'concept'. Any pointers?

# Answer
Aaagh - got it. I had done everything right - just my only events were in the past, and hence none showed in the selector.
> 1 votes

---
Tags: civievent, joomla
---


# Question
Title: Remove required field in Grant Application
The Grant module requires "Amount Requested" when entering a grant. This information may not be available when the grant is created. Why is this a required field? How can we make it optional? Workaround is to make it 0.

# Answer
I don't think there is a non-coding way to do this. You could try to manipulate the UI with an extension to accept a submission without an amount value. But there may be reasons in the business logic why an amount is required, i.e. you may experience follow-up problems if there are grant records without that value in your database.

So unless this is a serious problem for you, I think your workaround is the best way to go.
> 3 votes

---
Tags: civigrant
---


# Question
Title: Should accessing addresses via the API always require the 'view all contacts' permission?
To get contact data via the API you only need the 'access CiviCRM' permission, as long as you have access to the contact in question somehow (via an ACL or whatever). But to get address data for the same contact you need the 'view all contacts' permission. Is there a reason address data is more locked down? Can I override it?

Our use case is: a third-party website is accessing Civi via the REST API. This website is managed by a third-party, so I don't want to use an API key that gives them full database access. So I've set up a user who only has access to the relevant contacts. I can get the basic contact data fine, but I can't get their addresses without altering this global api permission requirement.

I'm just a bit nervous about changing this in case it's going to open any security holes elsewhere...

Here's the code in question, in CRM/Core/DAO/permissions.php :

```
  // Contact permissions
  $permissions['contact'] = array(
    'create' => array(
      'access CiviCRM',
      'add contacts',
    ),
    'delete' => array(
      'access CiviCRM',
      'delete contacts',
    ),
    // managed by query object
    'get' => array(),
    'update' => array(
      'access CiviCRM',
      'edit all contacts',
    ),
    'getquick' => array(
      array('access CiviCRM', 'access AJAX API'),
    ),
  );

  // Contact-related data permissions.
  // CRM-14094 - Users can edit and delete contact-related objects using inline edit with 'edit all contacts' permission
  $permissions['address'] = array(
    'get' => array(
      'access CiviCRM',
      'view all contacts',
    ),
    'default' => array(
      'access CiviCRM',
      'edit all contacts',
    ),
  );

```

Emails, phone numbers, websites, instant messaging etc. all use the same 'view all contacts' requirement.

# Answer
> 1 votes
According to the API Security page, this is expected behaviour - only the Contact API applies ACLs and such.

Looks like the best solution is to write a custom API that limits available data.

---
Tags: api, permissions
---


title: How to export all children of a family?

text:
# Question
Title: How to export all children of a family?
Our organization has families defined by relationships (but not put into households) and is looking to print a directory with a column of family members:

```
        NAME          FAMILY
        Bob Smith     Susan Smith (spouse)
                      Jimmy Smith (child)
                      Katie Smith (child)

```

I know I can export the spouse display name, but when I export "Individual \> Parent of \> Display Name" this only lists one child.

How can I export all children?

# Answer
> 10 votes
The relationship report will give you all the children of a contact easily for you. Relationship reports are standard with CiviCRM and appear under Contact Reports.

Edit filters to ensure the relationship is filtering on only the type you're interested in reporting on. You can then export to csv which will allow you to sort as required there if you want them to display in a particular way.

You'll see that it can only filter on one relationship at a time, so if you put all the contacts that you want to include into a group, you can filter on that instead to display all the relationships on contact in that group.

If you are using Drupal, you might also want to explore views to display this information for you. However, if you don't use Drupal or aren't familiar with views, this is a steep learning curve! If you use it in conjuction with views data export (https://www.drupal.org/project/views\_data\_export) you can get the information into excel from the view also.

# Answer
> 2 votes
We work with religious congregations and all have this need. In fact, one of the top things on our wish list is to be able to be able to have a printed directory functionality/export from the CRM.

Because of the challenges with the export and relationship report, we made our own custom search called Couples and Household listing that shows both adults in the household, children, ages of children, membership status and all contact information. That way, our clients can just export that search and have all the data for their printed directory.

# Answer
> 1 votes
just to clarify that others have identified this issue. See old threads here: http://forum.civicrm.org/index.php?topic=34656.0 and here: http://forum.civicrm.org/index.php/topic,26611.msg112915.html#msg112915. My organisation could also benefit from being able to export this information through the normal 'Export Contacts' or 'Export Participants' interface rather than having to report on it separately. Looks like lots of folks started down the road of capturing data using relationships only to discover the limitations. In fact, there are lots of gaps in Civi where relationships are concerned.

---
Tags: relationships
---


# Question
Title: Restricting field options in a profile on a contribution page
I have a Contribution page for Membership Registration. In this form users create their Drupal account and made payment off-site, so using the Contribution page is the best option for me - webforms doesn't have everything I need :)

Membership is only open to UK residents and we don't want them to be able to choose another country.

However, database contact are from other countries. So we do need to have additional countries enabled.

Is there a way we can restrict the available option on this profile / contribution without disabling all on the site?

# Answer
You can set a field in a profile to be "View-only". So:

1. (If you haven't done it already) Set your **Default Country** to United Kingdom on **Administer \> Localization \> Languages, Currency, Location**.
2. In the profile on your membership page set the "Country" field to be "View-only".
> 1 votes

# Answer
Not without some coding I think....The only thing I would try is create a Smart Group of everyone in the UK, perhaps you can limit the page for a group?
> 0 votes

---
Tags: profile, contribution-page
---


# Question
Title: CiviCRM Programmer/Developer Job Description
Does anyone have a good job description for a CiviCRM Programmer/Developer for an open position posting?

Thanks so much!

Dina

# Answer
> 2 votes
AGH just posted a job for a junior developer. https://aghstrategies.com/content/civicrm-developer

---
Tags: civicrm-home
---


title: Alternative to modify Core XML

text:
# Question
Title: Alternative to modify Core XML
I need to make a minor change to CRM/Core/xml/Menu/Admin.xml so that people that manage events can also schedule email reminders, exactly like Lobo describes the answer here: https://forum.civicrm.org/index.php?topic=28431.0

I know that we can make custom changes to tpl files without changing core files, is it possible to also make a change to an XML from this particular directory?

# Answer
> 2 votes
You could try creating you own extension with your own xml file that use the same path as the one you want to change.

You should use civix to create the core file of the extension. The new extension needs only 3 files :

* info.xml (to be completed after civix has generated it)
* yourextension.civix.php (you don't have to touch this one)
* yourextension.php (only touch it if you need additionnal customization like hook call)

Then you just have to add a xml file in `yourextensionpath/xml/Menu/` that contains the modified menu entry like :

```
 <?xml version="1.0" encoding="iso-8859-1" ?>
 <menu>
   <item>
     <path>civicrm/admin/scheduleReminders</path>
     <title>Schedule Reminders</title>
     <desc>Schedule Reminders.</desc>
     <access_arguments>administer CiviCRM;access CiviEvent</access_arguments>
     <path_arguments>action=update</path_arguments> (also tried with <path_arguments>group=scheduleReminders</path_arguments>)
     <page_callback>CRM_Admin_Page_ScheduleReminders</page_callback>
     <adminGroup>Communications</adminGroup>
     <icon>admin/small/template.png</icon>
     <weight>40</weight>
   </item>
 </menu>

```

After activating your extension, you may have to go visit `civicrm/menu/rebuild&reset=1` to clean the cache.

---
Tags: civievent, best-practice
---


title: Custom Field Log out Wordpress

text:
# Question
Title: Custom Field Log out Wordpress
When I click to view or edit custom fields; CiviCrm system automatically log out.

# Answer
It seems to be a domain name problem.

Are you using one of the following :

If it is the case, you need to ensure that the main CiviCRM domain (the one that is in `civicrm.settings.php`) is the same that you use during all the civicrm navigation.
> 1 votes

---
Tags: wordpress, custom-fields
---


title: Report on deleted contributions

text:
# Question
Title: Report on deleted contributions
When contacts are soft deleted, their contributions diseappers from the basic contribution reports.

What is the best solution to be able to display reports of contributions both from active and deleted contacts?

# Answer
> 1 votes
The only way i can think of is to create a custom report where you could use the criteria you want in the sql queries. i.e. remove the `civicrm_contact.is_deleted = 0` in the `WHERE` clause.

But as mentionned by JoAnne, you may not use the delete appropriately. The soft delete only exist to avoid an entry error. Deletion (even soft delete) should only be used when the contact is a wrongly created contact (duplicate, error while importing, spam).

Anyone with valid contribution, that you want to keep track of, should not be deleted. If it's a duplicate, the contribution will be attached to the other version of the contact so it won't be lost.

---
Tags: civireport
---


# Question
Title: For an extension, to modify database data, is it better to use SQL or API
Simple question here, From a computing and 'civicrm correctness' point of view, is using SQL (via CRM\_Core\_DAO::executeQuery or similar) or using the API ( civicrm\_api3('Contact', 'create', $params)) better? Thanks, V

# Answer
> 3 votes
Generally, it is wisest to always use the API. Many necessary updates actually touch multiple tables and the API takes care of it nicely. This is especially true with financial updates. The API also encapsulates the database structure so as to effectively hide any database structure changes that may happen over time.

IMHO, pretty much the only time that SQL might be called for is if you are doing a huge bulk update wherein using the API would take excessively long.

# Answer
> 2 votes
Agree, the API is decidedly the best way as it does multiple stuff and should continue to function over upgrades when there are database changes. I only use SQL when either the API does not do what I need, with custom data because it is easier most of the times or when doing bulk stuff.

---
Tags: api, sql
---


# Question
Title: Using iframes to present contribution page on remote site
We've been using iframes on remote sites to embed CiviCRM contributions pages with generally good results. However, we've recently found out that it is failing in Internet Explorer and Safari. It seems that it has to do with browser policies on allowing cookies set via iframes. Anyone else experienced this? Any ideas on how to resolve it?

It's a bit of a struggle since neither browser will install on linux, however, one user reported getting:

```
We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.

```

# Answer
After a lot of desperate digging we have come up with a work-around. I think the right answer is: Don't use iframes. There seems to be thoughtful reasons to restrict the flow of cookies/session information between an iframe and the parent and even though we have figured out a way to work-around it now, I'm not confident these tricks will work in the future.

Having said that...

For Internet Explorer, we got it to work by sending a header declaring our P3P policy. We used the following in settings.php (I'm sure you could put it in civicrm.settings.php too):

```
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

```

That seemed to placate IE (note: you should really lookup what these codes mean before blindly putting this into place - each one of these codes has meaning - more information on meaning is available here).

Safari was much harder. We had to add the javascript provided on a helpful blog post to get things working. It's a crappy solution - since it essentially redirects the user to the CiviCRM page and then back to the iframed page - which is confusing for the user and delays the loading of the page.

Here's the code I added to the Drupal theme's template.php file:

```
function tceiframe_preprocess_html(&$variables) {
  // Call our parent to do most of the work.
  newsflash_preprocess_html($variables);
  $path = drupal_get_path('theme', 'tceiframe');
  drupal_add_js($path . '/safari.iframe.fix.js');
}

```

And here is the javascript:

```
window.onload=function(){
 if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){
  var cookies=document.cookie;

  if(top.location!=document.location){
   if(!cookies){
    href=document.location.href;
    href=(href.indexOf('?')==-1)?href+'?':href+'&';
    top.location.href =href+'reref='+encodeURIComponent(document.referrer);
   }
  } else {

   ts=new Date().getTime();document.cookie='ts='+ts;
   rerefidx=document.location.href.indexOf('reref=');
   if(rerefidx!=-1){
    href=decodeURIComponent(document.location.href.substr(rerefidx+6));
    window.location.replace(href);
   }
  }
 }
}

```
> 4 votes

---
Tags: cookies
---


# Question
Title: Disable geocoding for contacts but not for events
Is it possible to disable geocoding for contacts but still use it for events?

I am working with an organisation that has data protection concerns about sending their beneficiaries contact details to Google or Yahoo for geocoding so they would like this option turned off for contacts. However, it would be useful to have geocoding enabled for events so that the event page can show the location on a map.

Is this possible?

# Answer
Off the top of my head, I think geocoding like this is an all or nothing thing. You can manually add the lat/long to an event location, so assuming that you don't have a whole lot of events, this should be pretty much acceptable (and just leave geocoding turned off).

With that said, no real contact details are shared with Google/Yahoo. A street address is simply sent to the geocoder without any names, or anything, and the lat/long is returned. No personally identifiable info is shared.
> 3 votes

---
Tags: civievent, geocoding
---


# Question
Title: How can I find contacts based on both custom data and address via the API?
For the Electoral API extension, I want to write a scheduled job to look up legislative data for everyone who a) has a geocode, and b) doesn't already have legislative data (which is stored in a multi-record custom field). I need this to be scalable.

So I could look up every contact without legislative data, then check those contacts for geocodes, or vice versa. Either way, I'm checking a huge number of contacts for data. Is there a better way? Maybe using API chaining?

Is it possible to create a smart group that's hidden from the UI that meets these criteria, then use that as the basis for my scheduled job? That seems like the best option.

# Answer
I don't know the answer about hidden smart groups but I took a swipe at the API chaining and was able to pull a contact on the demo server that met one criteria on the contact and another on the geocode on the address:

I don't know if that is helpful at all, but if you can get the first portion of this API call working with your custom field, it seems you should be able to chain the geocode to it.

The code for the above comes out like this (PHP):

```
$result = civicrm_api3('Contact', 'get', array(
'sequential' => 1,
'custom_11' => 1,
'api.Address.get' => "array( 'geo_code_1' => array('IS NOT NULL' => 1), )",
));

```
> 1 votes

---
Tags: api, developer, smartgroups, chaining
---