# Question
Title: Did you know - WordPress plugin SEO Ultimate's open Graph Integrator causes a warning?
This took a while to find so I thought I'd post it here...

If you are using CiviCRM in wordpress, and have the "SEO Ultimate" plugin, and its "Open Graph Integrator" module enabled, you may see the following error:

Warning: Missing argument 2 for CiviCRM\_For\_WordPress::single\_page\_title() in /home/civicthe/public\_html/wp-content/plugins/civicrm/civicrm.php on line 1273

I'm not sure if this causes problems in the backend, but I'm hoping its the cause of some of mine.

Fix: Disable the "Open Graph Integrator" module Install the similar "WordPress SEO by Yoast" plugin instead - it's open graph module does the same functionality but WITHOUT the error.

I hope this helps someone.

# Answer
> 3 votes
This is a bug in the SEO Ultimate plugin. You should report that they are incorrectly calling:

`apply_filters( 'single_post_title', $post->post_title )`

in three places:

* modules/opengraph/opengraph.php (line 116)
* modules/titles/titles.php (line 179)
* modules/titles/titles.php (line 184)

The call should read:

`apply_filters( 'single_post_title', $post->post_title, $post )`.

Their support page is here: https://wordpress.org/support/plugin/seo-ultimate

---
Tags: wordpress
---


# Question
Title: Why does CiviCRM render a validation failure without the Wordpress theme?
I have a wordpress site http://logisticsworkersnetwork.org/

There is a 'profile' sign-up form on the front page. The sign-up form works fine but there is no CSS or theme html when someone makes a mistake on the form. It goes to this page: http://logisticsworkersnetwork.org/?page=CiviCRM&q=civicrm/profile/create&page\_id=2 and just shows the error and the form in pure html. That is, it shows the PRINTER-FRIENDLY version of the page. The console error says:

Uncaught ReferenceError: CRM is not defined (anonymous function) @ ?page=CiviCRM&q=civicrm/profile/create&page\_id=2:100

NB: I have removed the civiCRM CSS file with Jquery. I also have a few hidden fields which are shown when a validation error occurs. This problem only arose after I switched from my localhost environment to my server (bluehost). I upgraded to civiCRM 4.6.2 (from 4.5.8) when I uploaded the site too.

UPDATE (12/May/2015): I have tried deleting the 'templates\_c' folder but it doesn't work. I have tried clearing the cache.

# Answer
I can't add a comment (doh, stupid reputation requirement) so I'm answering when Thomas Jaunism wrote: "Why would CiviCRM be trying to load the page.php and not the front-page.php that the form is on?"

The Civi plugin loads the WordPress theme's page.php template because many (if not most) themes define a homepage template which does not contain `the_content()` but rather collections of widgets and archive views. Loading page.php has proved to be the most reliable way to show Civi content on the front end.

If you want Civi to load a different template, there is a filter for this called `civicrm_basepage_template`. You can therefore load a different template with code such as the following in your functions.php file:

```
add_filter( 'civicrm_basepage_template', 'use_my_own_template_for_civi' );
function use_my_own_template_for_civi( $template ) {
    if ( some condition is met ) {
        return 'your-template-name.php';
    }
    return $template;
}

```
> 5 votes

# Answer
Viewing the PHP error log revealed a PHP parse error -

```
[12-May-2015 04:20:05 UTC] PHP Parse error:
  syntax error, unexpected end of file, expecting function (T_FUNCTION) in
  /path/to/CRM/Profile/Form/Edit.php on line 346

```

We checked that the file in question Edit.php validated, which suggests that perhaps there is a mismatched bracket somewhere else in the site codebase (eg theme files or another plugin).

Recommend -

* validating files which have been recently modified (`php -l *.php`)
* restoring a known good copy of the CiviCRM codebase
> 3 votes

---
Tags: wordpress, profile
---


# Question
Title: Wrong calcuation of event.balance value in reminder email
A client is reporting that the value for the `{event.balance}` token sent via a reminder is incorrect. It's showing a negative balance. The two documented cases (via forwarded emails from the event registrants) were both case where one partial payment had been made.

The replacement for `{event.balance}` should be:

```
Total registration fees minus partial payment(s)

```

Instead the token was replaced with the following value:

```
Event balance minus partial payment

```

Any ideas about what might be causing this or how to troubleshoot it?

Site running CiviCRM 4.5.8 and Drupal 7.36. PHP is 5.4.30. MySQL is 5.5.42

# Answer
> 3 votes
It's possible this is the culprit: net amount sometimes incorrect for events involving partial payments

You could update to 4.6.2 if that's possible, or perhaps review out the commit and roll your own patch.

---
Tags: civievent
---


# Question
Title: How to provide a default sort on a custom search?
There is a function helper

```
function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
  // delegate to $this->sql(), $this->select(), $this->from(), $this->where(), etc.
  return $this->sql($this->select(), $offset, $rowcount, $sort, $includeContactIDs, NULL);
}

```

But I'd like to set a sort order if not set. All the examples I found are writing directly their sql, as opposed to sql() that expect a CRM\_Utils\_Sort class (or that's what I understand based on the error messages)

So what I'd like to do is to add a

```
if (!$justIDs &&!sort)
   //how to initialise sort so it ends up like ORDER BY created_date)?

```

# Answer
Custom searches inherit CRM\_Contact\_Form\_Search\_Custom\_Base; check out the `addSortOffset()` function below (around line 177) to see how the sort is tacked onto the query:

```
public function addSortOffset(&$sql, $offset, $rowcount, $sort) {
    if (!empty($sort)) {
      if (is_string($sort)) {
        $sort = CRM_Utils_Type::escape($sort, 'String');
        $sql .= " ORDER BY $sort ";
      }
      else {
        $sql .= " ORDER BY " . trim($sort->orderBy());
      }
    }
    if ($rowcount > 0 && $offset >= 0) {
      $offset = CRM_Utils_Type::escape($offset, 'Int');
      $rowcount = CRM_Utils_Type::escape($rowcount, 'Int');
      $sql .= " LIMIT $offset, $rowcount ";
    }
  }

```

If you want to use an array it will send it to CRM\_Utils\_Sort::orderby(). I think you can set your $sort like this:

```
if (!$justIDs &&!sort) {
  $sort = array (
    'name' => 'civicrm_created_date',
    'direction' => 1,
  );
}

```

Would that work for you?
> 1 votes

---
Tags: custom-search
---


# Question
Title: How to insert a CiviCRM query link into Drupal main menu with Clean URLs enabled?
How do you add a CiviCRM query link such as:

```
index.php?q=civicrm/member/search&force=1&qfKey=0&reset=1

```

Into a Drupal main menu with Clean URLs enabled?

With Clean URLs enabled, Drupal will strip out the `?q=`, breaking the link.

Desired outcome: Drupal main menu. Menu item "Members". URL to "`civicrm/member/search&force=1&qfKey=0&reset=1`"

# Answer
You can find further info here, but I'd recommend setting up a Redirect (using this module) and using that URL in the menu. For example, the redirect URL could be **member/search** and then it redirects to **civicrm/member/search&force=1&qfKey=0&reset=1**.
> 2 votes

# Answer
You could also use "/civicrm/member/search&force=1&qfKey=0&reset=1" in the link? That should work too.
> 2 votes

---
Tags: drupal, menu, global-menu
---


# Question
Title: Is there a way to automate event feedback using Civi and Drupal webform?
What we are looking to do is find a neat way to create a process for sending out an automated email from Civi with a link to a form of some type for a feedback or evaluation on the event that a person has booked on. We would ideally like this feedback or survey to be attached to the participant record in Civi (i.e. so its easy to see which event they are feeding back on and to find the feedback easily in Civi). I'm not sure if I can see any simple way to do this at the moment.

So I guess the idea would be to send the email as a scheduled reminder with a checksum token to a webform, and also have in the url the event ID. The event id would then allow the user to update their participant record for that event with some custom fields which are the feedback fields (or we could copy a link to the webform submission into a text field).

But to use 1 webform for all events and to pass the event ID to a field of event ID on the form, there is an issue that this will unsubscribe the contact from any other events that they were previously registered for.

Any one got any thoughts on a solution?

# Answer
We could create an option to disable the unregistering from events as this also solves the problem that if multivalue widgets are enabled for multiple sets of event fieldset, they do not work together well. This way we can get a better control towards the behaviour, also makes the solution possible for any widget.

Regarding the loading event form URL, I think it will also be good to become a checkbox under "Event Registration Options" as people might not want to allow users to change some event setups through URL freely.
> 3 votes

# Answer
I think the way you'd want to set this up would be with a hidden, exposed field for the event. This would allow the value to be selected, but not by the user. It seems that to get this fully functional, the webform-civicrm module will need 2 improvements:

* Allow event id to be specified in the url (note this may already be possible with the use of url tokens in the webform).
* Don't un-register participants if event selector is a hidden field. This seems like a good compromise solution to get the feature you want without removing the un-register behavior for non-hidden fields.
> 2 votes

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


# Question
Title: How can I see the number of memberships at a given date in the past?
Is there a way to see how many current members you had on a past date?

For example, how many current members of a specific type on December 31st, 2014?

Thanks :)

# Answer
While there might be more elegant solutions possible with Reports (?), you can get the count using an advanced search:

1. Select `Search | Advanced Search` from the menu
2. In the `Basic Criteria` section select `Display Results As`: `Memberships`
3. In the `Memberships` section of the search form set `Start Date` to `Choose Date Range` and then set `To` to the date you are interested in (for your example 31/12/2014). Leave the `From` field empty.
4. Also in the `Memberships` section set `End Date` to `Choose Date Range` and then set its `From` to the day after the date you are interested in (for your example 01/01/2015). Leave its `To` field empty.
5. In the `Memberships` section you can also check the type(s) of membership you want to be retrieved.

After you run that search, CiviCRM is displaying the number of results - which is the number of active memberships at that point in time.

---

Next to the number of results it is also listing the search parameters used. For double checking, this is what it shows when I run it:

> 993 Results - Memberships
>
> Start Date - less than or equal to "31. December 2014 11:59"
>
> ...AND...
>
> End Date - greater than or equal to "1. January 2015 12:00"

---

# Explanation

This search is filtering memberships that started any time before (`Start Date` `To`) 31/12/2014 and did not end before 01/01/2015 (`End Date` `From`).

If you are using the memberships in a way that is correctly updating the Start and End date of the memberships, this should return the correct results.
> 5 votes

---
Tags: civimember
---


# Question
Title: How to renew membership during event registration?
I've set-up an event with several fee options that include "event fee plus 1 year membership renewal", "event fee plus 2 years membership renewal", etc. How do you suggest implementing the membership changes after the event payment gets processed?

I'm thinking it's possible to add time to their membership through the ThankYou.php page using the membership API. (using CiviCRM 4.1)

Any tips would be greatly appreciated!

# Answer
One way to accomplish this is to programm an extension with a hook reacting on the event registration and then changing the membership based on the event registration.

Another way which might be usefull is to use the drupal Webform module and create an event registration with membership options.
> 3 votes

# Answer
Browsing through SE today I cam on this question/answer which may also offer a solution:

How can I integrate (optional) membership sign-up on a CiviEvent registration form?

Summary: a couple of solutions were suggested...

1. If you were using Drupal then Commerce and Rules could be used to provide for event rego and memberships in same cart, with the membership discount being applied to the event etc.
2. There's an extension from AGH Strategies that handles this: https://github.com/aghstrategies/com.aghstrategies.eventmembershipsignup
> 3 votes

---
Tags: civievent, civimember, api
---


# Question
Title: Select and register multiple people for a pre-selected event
In a Drupal/Civicrm setup, how do I create a page which

1. Lists all members of a group
2. Allows user to select certain members and register them for an pre-selected event to record attendance

This is how I envision it:

```
Please submit attendance for this week's event:

[ ] Bob Smith
[x] Jeff Mason
[x] Susan Collins

[Submit]

```

My thoughts so far:

* I know #1 can be accomplished with a View, but how do I allow group members to be selected and registered for a pre-selected event?
* I know #2 can be partially accomplished with a Webform, but only by typing in group member names – not selecting them from a list.

Is there a way to combine Views/Webform to accomplish this?

The ultimate goal is to automatically email a custom link to this page to group leader to submit attendance after event each week.

Thank you.

# Answer
That's a good question. This ought to get you started, if you get it all working please post your own answer with more details :)

* Create a webform with 1 contact
* Disable all fields except the "existing contact" field
* Edit this field and set it to be "static", and set the default value to be populated from the group of your choice
* Under the "event" settings for the webform, choose "register each participant separately" and set the event field to be "user select"
* Edit this event field to limit the options to only the event of your choosing.
* You should now have a working webform that shows the first member of your group and allows you to register them for the event.
* If the above is working, you can now clone contact 1 as many times as needed to add the other members of the group.

Admittedly this method has a few drawbacks

1. Doesn't allow the end-user to select the group or event.
2. Contact name and event checkbox will be on separate lines (maybe some css could fix this).
3. There is a limit to the number of contacts you can have on a webform. Depending on the size of your groups, this may or may not be a problem.
> 3 votes

# Answer
The other option as you noted, is to use Views, via Views Bulk Operations along with CiviCRM Entities module. Not sure which solution is smoother given it isn't clear to me how many scenarios there are - eg X Groups times Y Events. Or whether there are multiple Groups for same Event, etc. Or how many contacts you might need to be ticking off as attended, so in case it helps.

In VBO you ought to be able to provide a list of 'my events' to the User (based on Contextual Filters), then go to a page loaded with Participants and filter to the required Group, then 'modify entities' for all the contacts you want to attend.

We set up a VBO for a similar situation but without the 'only contacts in my group' - you can read the blog here and grab a Views export to get started with http://www.fuzion.co.nz/blogs/confirming-attendees-door-another-use-entity-and-vbo

Also note that for another scenario we used Activities as the way to record 'attendance' for a school situation, and Eileen cooked up a Civi Report that allows for on screen editing (a bit like a Batch Update, but no saving required). Can flesh that option out too if it is useful.
> 2 votes

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


# Question
Title: Can I use membership information in a mail?
We are using Memberships including some custom fields to save additional information (e.g. the name of a specific beneficiary supported through that individual membership).

Mailings through CiviCRM can include Tokens to insert contact-specific information like name and address. However, there are no tokens available for membership information.

I guess this is technically more challenging because mail is sent to a contact and a contact can have more than one membership. Is there some feature, extension or workaround to send mail "to a membership" or otherwise insert individual membership information in the text?

# Answer
Eileen did an extension that added some membership tokens to deal with contacts having multiple membership and which do work from 'contact'

{latestcurrentmembership.end\_date}

{latestcurrentmembership.allend\_date}

https://civicrm.org/extensions/nzcofuzioncivitoken

please let us know how you get on with it
> 4 votes

---
Tags: civimember, email, tokens
---


# Question
Title: Any way to limit geocoding to city or zip?
For privacy purposes in making a public member map - I'd like to set up the geocoding not by the full address, but by the city or zipcode. Is there a way to do this without creating a custom geocoder?

Thanks! Harold

# Answer
Sorry no, You will need to create a custom geocoder.

Creating a custom geocoder should be as easy as copying the current one you want to imitate, renaming it (to avoid confusion and keeping things clear for your successors) and dropping it in your custom php directory in CRM/Utils/Geocode/ (since u dont want to modify the core directories)
> 3 votes

---
Tags: contacts
---


# Question
Title: Can't get hook_civicrm_contact_get_displayname to work
I want to append a custom field to the display name. To try it, I used the example.

```
function ccas_hooks_civicrm_contact_get_displayname(&$displayname,  $contactId, $objContact) {
$displayname = $displayname . ' - '.$contactId;}

```

No errors but what I see on the View Contact form doesn't change.

I added a watchdog thing after it

```
watchdog('hooks',"callhooks_civicrm_get_(&\$fields, &\$files, &\$form)<pre>\n\$display_name=" . var_export($displayname,1) . "\n\$contactId=" . var_export($contactId,1) . "\n\$objContact=" . var_export($objContact,1) . '</pre>');

```

In the log I can see it appending the contact id after the display name but still it only shows the name. So do I need to do something additionally to actually get it to show it on the form?

Currently using 4.5.5.

# Answer
Can you modify, CRM/Utils/Hook.php

```
  public static function alterDisplayName($displayName, $contactId, $dao) {

```

and change it to

```
  public static function alterDisplayName(&$displayName, $contactId, $dao) {

```

(note the & character before the displayName argument. I suspect this will fix the issue.

If it does, can you please file an issue and if you can create a PR to fix this issue. If not, you can reference this thread
> 2 votes

---
Tags: hooks
---


# Question
Title: Custom form input field missing from &$values when hooking into tokenValues
I am hooking into \_buildForm for CRM\_Contact\_Form\_Task\_Email to add a hidden input called "order\_id" that I will need for some token logic. This part is working great. But when I click Send Email, my \_tokenValues hook fires and the &$values array is missing order\_id.

Does Civi remove things from the $\_POST array before building $values? Is this a bug or by design? I'm currently working around it by setting and getting my own session variables, but that means I have to create a session object in buildForm and again in tokenValues ($this-\>set() doesn't seem to work within an extension).

This code creates my extra input. I have verified that the input is written in the form when I view source in the browser. But doesn't make it to tokenValues:

```
function invoicetoken_civicrm_buildForm($formName, &$form) {
  if($formName == 'CRM_Contact_Form_Task_Email') {
        if (CRM_Utils_Request::retrieve('order_id', 'String')) {
           $order_id = CRM_Utils_Request::retrieve('order_id', 'String');
           $form->addElement('hidden','order_id', $order_id);
        }
  }
}

```

Edit: Based on Lobo's answer, I tried using $form-\>get(), but something still isn't working:

```
function invoicetoken_civicrm_buildForm($formName, &$form) {
  //add order_id to our form
  if($formName == 'CRM_Contact_Form_Task_Email') {
    //buildForm runs on get and post. this line re-adds the input during post
    if ($form->get('order_id')) {
        $order_id = $form->get('order_id');
        $form->addElement('hidden','order_id', $order_id);
    }
    //this line adds the input on initial load of the form
    elseif (CRM_Utils_Request::retrieve('order_id', 'String')) {
      $order_id = CRM_Utils_Request::retrieve('order_id', 'String');
        $form->addElement('hidden','order_id', $order_id);
    }
  }
}

```

No matter what I do, the input doesn't make it over to tokenValues; when I log the $form object, 'order\_id' field appears in \['\_submitValues'\]. I have tried `$form->set()`, `$form->setVar`, and any other combination I could think of. In the end, the only thing that works is to use a session var.

# Answer
There isn't a connection between form elements and tokens, so no matter how you customize the form, it will not be added to the $values array for tokens. The correct way to do this is via PHP session variables.
> 1 votes

# Answer
Most likely you are not adding order\_id when the form is being posted back to the server

the quickform package basically filters out all variables that have not been added to the form. The buildForm hook is called even when the form is posted, so you might want to ensure that order\_id is also added there. In most cases this happens automatically, however if we are using ajax for build parts of the form, it gets a bit trickier

$\_GET\['pid'\] is available only during the first GET request. The POST request sends a very minimal set of GET variables. Try using this variation:\`

```
function invoicetoken_civicrm_buildForm($formName, &$form) {
  //add order_id to our form
  if($formName == 'CRM_Contact_Form_Task_Email') {
    $order_id = CRM_Utils_Request::retrieve('order_id', 'String', $form);
    $form->addElement('hidden','order_id', $order_id);
  }
}`

```
> 1 votes

---
Tags: extension, tokens, forms
---


# Question
Title: Has integration been done for Textify Mobile?
Has anyone seen this new SMS service called Textify Mobile that's geared directly to non-profits and churches. It even has mobile giving with it. Wondering if anyone had done an integration/extension for it?

# Answer
> 6 votes
My name is Mitch Cannon, and I'm the VP of Technology for Textify Mobile. We currently only offer a private API for specific integrations and partnerships. With that said, we are actively developing a RESTful, JSON-based API for our general user base. I would love to talk with anyone interested in an integration about their needs and what we can currently accommodate.

http://www.textifymobile.com/contact-us

# Answer
> 2 votes
I dont think so, but it does seem like Civi should have the ability to handle/interface with mobile giving platforms, since more of giving is happening via phones

# Answer
> 1 votes
Altough they don't have a giving mechanism integrated perhaps you could check this if you are looking to integrate SMS notifications with CiviCRM. They do have discounts (sometimes up to a full discount) for non-profits. And they have an extension for CiviCRM. Hope this helps :D.

# Answer
> 1 votes
I did some looking, but it seems like Textify Mobile doesn't offer an API for this - so integrations aren't possible. I just submitted a question about this via their help form and will update this answer if I receive a response.

# Answer
> -2 votes
There is not an extension for Twilio currently, so that won't work. Only Clickatell.

---
Tags: extension, sms
---


# Question
Title: How do I suppress the local country on address labels?
I tried to apply this solution to allow me to suppress the country field on address labels for my own country, using the 4.6.2 CiviCRM release. I successfully used this on the project when I built it a year or so ago but it does not work any more, even allowing for line number changes in the current version. Can anyone advise what I need to do to get it working again? Go to say I'm not sure which version it got broken in as I'd forgotten to apply it the last couple of times I upgraded but someone else in our organisation pointed it out to me earlier today.

# Answer
> 3 votes
This extension https://github.com/eileenmcnaughton/nz.co.fuzion.civitoken

Has a token called 'Conditional country' - which does that https://github.com/eileenmcnaughton/nz.co.fuzion.civitoken/blob/master/tokens/address.inc#L7

You can use the token in the mailing label http://dmaster.demo.civicrm.org/civicrm/admin/setting/preferences/address?reset=1

---
Tags: 4.6.2, address-labels
---


# Question
Title: Is it possible to allow people to submit their own events to CiviCRM?
I would like to create a website that collates events from several organisations.

The site should allow each organisation to submit their own events. However the submitter should not have full access to CiviCRM. In particular they shouldn't be able to see or modify events submitted by other organisations. (They don't necessarily need to be able to access or modify their own events, though it would be helpful if they could.)

The events need to go through a moderation process so that an administrator must approve each event before it goes live. Once the event is live it would be displayed publicly with events from other organisations. Visitors to the website would be able to view events from all organisations and book a place on any that they wish.

Is it possible to do this using CiviCRM? If so, how would you suggest that I go about this? Could webform be used for this?

Thanks for your help.

# Answer
I don't think Webform CiviCRM can create new events, but one option could be to get creative with the Drupal CiviCRM Entity module, where creating a new Event node would create the Civi event, allowing Drupal-based review queues, Views Bulk Operations for mass approvals, etc. I've noticed that 2.x-dev version of the module contains a patch that that allows you to do point-and-click for creating/editing/deleting CiviCRM records, but I haven't tried it personally so you may need to do some playing around with it.
> 2 votes

# Answer
I am not going to be able to discuss a full recipe here :-) But yes, I would think it is feasible and I would certainly use Webform for this. I could imagine a situation where you have one Drupal frontend feeding into more CiviCRM installs, where each organisation would have its own CiviCRM database? If the organisations do not need to share any contacts that might in fact be the easied solution? You keep track of the organizations in either Drupal or a CiviCRM install, with the settings that their CiviCRM installation requires? Interesting project!
> 2 votes

# Answer
William,

We implemented something very similar for United Methodist Communications (UMCOM) through Drupal and CiviCRM. Rethink events

We used the Drupal form builder module, exported the code and then built the form. Most of the time was spent gathering the requirements, specing, and testing. The dev process is fairly quick. UMCOM are expecting to have several thousand events running through CiviCRM by the fall with hundreds of Church admins creating events. We also created views so that these admins can generate a list of participants (with custom data)

Hope this helps
> 2 votes

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


# Question
Title: Civimail Mailings not saving or "corrupting"
I very recently took over custodianship of a drupal CiviCRM, so I don't really have a clue what I'm doing. Bear with me.

I'm on civi 4.6.2 on drupal, and ever since the upgrade, the mailings have gone completely haywire on me. back when I could upload a .html file, everything worked fine, but now, it's all wonky.

When I first paste the html in, everything looks fine in the WYSIWYG screen, but when I save it, one of several things happens: It simply doesn't save the changes to the HTML email field (though the new subject and plaintext fields save perfectly fine). Once, I got it to save the HTML, but it stripped out large chunks of that, and put in the HTML Special entity codes next to a bunch (but not all) of the spaces and quotation marks, but still preserved the actually spaces and quotation marks.

# Answer
This seems to be an issue wherein ckeditor does not emit a standard change event when using "Source" mode. Using a work-around from StackExchange, we get this proposed fix: https://github.com/civicrm/civicrm-core/pull/5869

We're very close the 4.6.3 release. With some luck, it might get into 4.6.3 -- otherwise, it'll go out with 4.6.4.
> 2 votes

# Answer
I sorted this out:

The CiviCRM won't save changes to an email unless you 1)switch back from the HTML source to the WYSIWYG editor and 2)click somewhere inside the WYSIWYG editor. Then save the draft, and then it works fine.
> 1 votes

---
Tags: civimail
---


# Question
Title: In API Explorer, Add Parameter and Add Option links do not work
I've been looking at the API explorer for a while. It's a great idea: the API is poorly documented, but this would be a perfect sort of live documentation. but I never got it to work.

I can choose an entity and an action. But `add parameter`, `add option` and `chain api call` dont do anything. The labels 'name','operator' and 'value' are hanging there with question marks and helptext. 'operator' says 'Choose an operator from the list', but there is no list.

I can execute, but I get a very generic call without parameters. I get no javascript errors. I have this on multiple Drupal 7 installations - looking at CiviCRM 4.5.3 now.

Everyone seems to be happily using it...

# Answer
This sounds like a javascript problem to me. Try the steps for troubleshooting javascript in CiviCRM.

You can also compare the explorer on your site to the one on the drupal demo and see if you can glean any clues from those differences (ignoring the one unrelated difference that the demo is running 4.6 and you are using 4.5)
> 1 votes

# Answer
We all are happily using it :-) You do not always need a name, value or operator. I guess it will help if you read the API introduction here: http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API I assume it will answer your questions....if not shout again?
> 0 votes

# Answer
You can add the parameters to the API explorer, and the 'name', 'operator', 'value' are the column headings? See screen print attached (I reckon you get the picture even if it is in Dutch)
> 0 votes

---
Tags: api
---


# Question
Title: Can CiviMail send multiple mailing jobs concurrently?
The CiviMail documentation and settings pages indicate that it is possible to have multiple mailer delivery jobs executing simultaneously.

See Settings - CiviMail (/civicrm/admin/mail?reset=1) :

* Mailer Job Size: If you want to utilize multi-threading enter the size you want your sub jobs to be split into. Recommended values are between 1,000 and 10,000. Use a lower value if your server has multiple cron jobs running simultaneously, but do not use values smaller than 1,000. Enter "0" to disable multi-threading and process mail as one single job - batch limits still apply.
* Mailer CRON job limit: The maximum number of mailer delivery jobs executing simultaneously (0 = allow as many processes to execute as started by cron)

I have not been able to get this to work in practice in CiviCRM 4.4.14 . I have tried various settings, e.g.

```
batch limit = 2500
throttle time = 5
job size = 2500
cron job limit = 2
civimail_server_wide_lock = off

```

Civi cron is running every minute. Mailings scheduler is the only scheduled job that runs on every cron run (others are hourly or daily). The mailing is correctly split into sub-jobs of 2500 mails, however these get processed consecutively. Each batch takes about 6 minutes to run. Every time a new instance of the scheduled job tries to start while an existing instance is running, we get an error like this:

```
Finished execution of Mailings scheduler with result:
Failure, Error message: lock aquisition for mydb.1.civimail.job.12415
attempted when mydb.1.civimail.job.12414is not released

```

Hence only one instance runs at a time.

The error message above is generated by CRM\_Core\_Lock::hackyHandleBrokenCode(), which was added for CRM-12856 and is called from CRM\_Core\_Lock::\__construct(). It prevents multiple locks being created with names containing "civimail.job.". If this is attempted, hackyHandleBrokenCode() throws an exception and so the scheduled job exits. This appears to be what is preventing multiple mailer delivery jobs executing simultaneously.

Looking at CRM\_Mailing\_BAO\_Mailing::processQueue(), the code for $config-\>mailerJobsMax \> 1 seems to work on the assumption that a CRM\_Core\_Lock can be created independently for each of the mailerJobsMax cron jobs. But since CRM-12856, this is disallowed. I believe this may not have worked correctly in any case, given that each MySQL connection can only acquire one lock: acquiring a second, even if it has a different name, releases the first: https://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function\_get-lock.

However some users have reported this feature to be working correctly - can anyone confirm that mail jobs are indeed sending in parallel in their post-CRM-12856 Civi?

# Answer
> 2 votes
Just to follow up on this, this was a bug that will be fixed for the 4.6.4 release. More details can be found at issues.civicrm.org/jira/browse/CRM-16387

# Answer
> 1 votes
It seems you have found a bug.

IIRC the design is intended to queue up all the necessary jobs initially, then have runner task threads dequeue a job and execute it.

The function name you cite looks like someone knew they were only doing a poor job, likely intended to address a bigger problem. Try using blame in github to find who added that code and ask them for advice on how to go about fixing your problem without causing other error(s) to recur. Based on the function name, I bet it was Eileen.

In response to your comment, please create an issue including forum link and link to blame along with description.

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


# Question
Title: What is the correct way to import fields with line breaks?
I've noticed that CSV files containing "\n" will import these characters literally. That makes sense for single-line text, but what is the correct way to handle for note fields?

# Answer
I believe if your csv includes a "real" line break (not a backslash and an "n" but the actual line-break character) then it will be imported as such.
> 2 votes

---
Tags: import
---


# Question
Title: In CivilMail for 4.6.2 how do I prevent duplicate emails?
Since 4.6.2 CiviMail is sending every email twice. I'm enclosing an attachment to show. The report also shows the successful delivery at 200% on some emails and 300% on others.

http://forum.civicrm.org/index.php/topic,36345.0.html

# Answer
This was a bug related to smart groups and premature mailings, which is now fixed in version 4.6.3.

See https://issues.civicrm.org/jira/browse/CRM-16251
> 1 votes

---
Tags: civimail
---


# Question
Title: Where / how is the {domain} token formatted?
I am required to use the {domain} token for mass mailing, but it is formatted with line breaks .. can I modify that formatting ?

# Answer
> 2 votes
I believe there are several domain tokens. domain.Name, domain.Address, domain.email, domain.phone.

These are set on the Administer =\> Communications =\> Organization Address and Contact Info page.

The only one that I think is required is domain.address. This has line breaks between the street address and the city, etc. You can blank out address, the city and remove the zip but getting rid of the country and state may not be possible. (Well if you are in a country without states you can get rid of state)

The {domain.address} is a smarty. You can do all sorts of things with smarties. You might be able use regex to replace the line breaks or to remove parts of the address you don't want. http://www.smarty.net/

# Answer
> 2 votes
This is computed in CRM/Utils/Token.php in the function getDomainTokenReplacement (which in turn gets it from the function getLocationValues)

I think you might be able to override this in the tokenValues hook and send in your own value for domain.addresss. Creating your own tokens is described here:

https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit

# Answer
> 0 votes
To my knowledge, you can't really do much with how it prints. But you can use CSS to set display:none on it. There is also a global CiviMail setting that allows you to send mailings without using the token.

---
Tags: civimail, tokens
---


# Question
Title: CiviCRM API and checking if a custom field is empty rather than not null
Is there a way to check if a **custom field** is empty using the API?

The check for 'IS Not Null' appears to work to an extent, but only if a custom field is not part of a set of custom fields, When one of the custom fields get given a value, the others change from Nulls to blanks.

```
e.g.
custom_1 = Null
custom_2 = Null
custom_3 = Null

set custom_1 = "some_string"
custom_2 = (becomes empty string)
custom_3 = (becomes empty string)

```

API is null check fails as they are no longer null..

```
API check for != '' doesn't work
API check for <> '' doesn't work
etc etc

```

Any thoughts or is this a bug?

# Answer
> 2 votes
The answer depends on how you call the API: is this from php or via the ajax or rest interface?

in php, both null and empty string are seen as a boolean false, so

```
if (!$custom_42)
   echo "it's either null or empty string"

```

As for why custom fields behave this way: each custom field belong to a custom group that is stored in a table. if you don't have any of the custom fields in that group, the row isn't created, so all the fields are null, but as soon as you set one of the fields, it creates a row, and the default value of each of the other empty fields depends of their type.

That custom fields that are string become "" instead of null is arguable and it would seem more coherent they stay the same, but as both are seen as false in php (and other languages have the same conversion rules) probably not a big issue.

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


title: SMS not working on 4.6.2

text:
# Question
Title: SMS not working on 4.6.2
Updated to version 2 of the extension. Messages not being delivered. Manually executed. Will clickatell extension work on 4.6.2? Success is reported but message never sent. Here is error from the log:

May 19 04:24:40 \[info\] $Fatal Error Details = Array ( \[message\] =\> Unknown extension: org.civicoop.smsapi \[code\] =\> \[exception\] =\> CRM\_Extension\_Exception\_MissingException Object ( \[errorData:CRM\_Core\_Exception:private\] =\> Array ( \[error\_code\] =\> 0 )

```
        [cause:protected] =>
        [_trace:PEAR_Exception:private] =>
        [message:protected] => Unknown extension: org.civicoop.smsapi
        [string:Exception:private] =>
        [code:protected] => 0
        [file:protected] => /home/depot/public_html/drupal/sites/all/modules/civicrm/CRM/Extension/Container/Collection.php
        [line:protected] => 143
        [trace:Exception:private] => Array
            (

```

# Answer
> 1 votes
have you installed this extension

Could you download and install it manually and report if it works? Its configuration file hasn't been updated to say it's compatible with 4.6, but we will do it once you confirm if works well.

---
Tags: sms
---


# Question
Title: AngularJS issues with Drupal 7 + CiviCRM
I recently installed CiviCRM 4.6.2 in our multisite Drupal 7 environment, running on IIS 8. I have CiviCRM 4.3.2 running on a Drupal 6 base without any issues on the same server; my plan is to migrate the D6 install and most of the data (contacts, etc) to D7.

Installation and configuration of CiviCRM went fine, as did importing contacts. However, I'm currently stuck on an issue that appears to have something to do with AngularJS and Windows/IIS paths, though I can't say that for sure.

When I go to Mailings -\> New Mailing, it hangs - all it says on the page is "Initializing..." In Chrome's console, I see this error:

```
TypeError: a.headers is not a function
  at n (angular.js:9720)
  at angular.js:13248
  at n.$get.n.$eval (angular.js:14466)
  at n.$get.n.$digest (angular.js:14282)
  at n.$get.n.$apply (angular.js:14571)
  at l (angular.js:9698)
  at M (angular.js:9888)
  at XMLHttpRequest.F.onload (angular.js:9829)

```

In Drupal's watchdog log, I get this error (identifying path info changed):

```
LOCATION    https://www.fake.com/civicrm/ajax/angular-modules?l=en_US&r=fE7WM

REFERRER    https://www.fake.com/civicrm/a/

MESSAGE     Warning: file_get_contents(E:\webroot\drupalroot\sites\all\modules\civicrm/ang/crmMailingAB/E:\webroot\drupalroot\sites\all\modules\civicrm/ang/crmMailingAB\EditCtrl/report.html): failed to open stream: Invalid argument in Civi\Angular\Manager->getPartials() (line 203 of E:\webroot\drupalroot\sites\all\modules\civicrm\Civi\Angular\Manager.php).

```

It definitely looks to me like AngularJS is getting confused by Windows paths, but I'm not 100% sure that that's what's going on, nor how to fix it if I'm right.

# Answer
As discussed in CRM-16499, the bug involves processing file relative-paths and absolute-paths on Windows. I reproduced the bug with D7 and XAMPP for Windows. There's a pending fix (.patch).

It *might* get merged before tomorrow's release (4.6.3); otherwise, it'll go out with 4.6.4.

Note: For general advice on how to interpret/evaluate pending patches, see http://wiki.civicrm.org/confluence/display/CRM/Verify+a+patch
> 5 votes

# Answer
Looks like you've found a bug.

It's currently being worked on by the core team, you can follow progress at

https://issues.civicrm.org/jira/browse/CRM-16499
> 4 votes

---
Tags: drupal
---


# Question
Title: How do I delete an option group (civicrm_option_group)
I'm getting frustrated with googl-ing, and can't find out how to delete/remove option groups.

Anyone have a simple answer? Even if I have to go into the DB and remove entries from civicrm\_option\_group - I just want to know that that is safe.

The groups have been created, but there are no fields, and therefore no data in them - but I can't see how to remove them.

*edit*

The option groups were created via **Administer -\> system setting -\> option groups** and creating the fields, but as Ramesh says, below, there is no "delete" option here, so can't see where to remove them.

Background and workflow issue: I added the option groups because doing so through the Also, backing up Ramesh, groups self delete when they're not being used if they were created via the "adding Custom Data Set field" workflow. Although this names the data set as the question and doesn't give flexability to create re-usable names (the option set "name" is not change-able)

i.e.:

* custom field (question)= Do you like fish and chips?
* required option group options (Answer - radio): yes, no, sometimes
* required option group name: sometimes
* actual option group name: Do you use CivCRM?
* actual option group to use: Do you like fish and chips

Should this last section rather be bought up in Jira (sorry if so - I saw it as a "cause" for the situation happening in the first place)

*end edit*

Anyone have some background on how these groups work / interact with the UI?

Thanks, Martin

Civi: 4.4.13 Drupal: 6

# Answer
*If it's safe* (AFAIK if the option group isn't part of an extension or the core, doesn't contain any option values, isn't used by any custom fields) you can delete it using the API explorer or a drush command.

On the 'Option Groups' screen, each group has a link to its page of options, of the form https://www.example.org/civicrm/admin/optionValue?gid=94&reset=1 where the group ID is 94.

While logged in with privileges to the webserver directory, in sites/default, do:

```
drush cvapi OptionGroup.delete id=XX

```

Or go to civicrm/api/explorer, choose OptionGroup / delete, and add &id=XX (where XX is the group ID) to the end of what looks like a URL string below those options, and click Go.
> 3 votes

# Answer
Most of the option groups created by creating a custom field set of type radio / select / checkbox are created automatically.

Deleting the custom field, should also delete the option group IF its not being shared by any other custom fields.

Can you elaborate on how you create "orphaned" option groups
> 2 votes

# Answer
I have tested this - When you go directly to Administer -\> system setting -\> option groups we have an option of creating new option group this is where the problem is because we don't have a option of deleting the option group at this point and this is also not displayed in the list where we try to use this option group in custom field value

But any option group created using (select / ratio) while creating the custom field works alright
> 1 votes

---
Tags: custom-fields
---


title: Missing Input Parameters Error

text:
# Question
Title: Missing Input Parameters Error
I've been seeing a few strange errors on one of my CiviCRM (4.4.4) site recently.

```
***ERROR***
Array
(
    [message] => Missing input parameters
    [code] =>
)
...
REQUEST_METHOD:     GET
QUERY_STRING:       reset%253D1%2526jid%253D69%2526qid%253D1605%2526h%253D077ec51a7e598906
REQUEST_URI:        //civicrm/mailing/optout?reset%253D1%2526jid%253D69%2526qid%253D1605%2526h%253D077ec51a7e598906
SCRIPT_NAME:        /index.php
PHP_SELF:           /index.php
REQUEST_TIME:       1428513094

```

Based on the error message, it looks like the optout request is somehow getting encoded, which yields a CiviCRM "Sorry but we are not able to provide this at the moment" error.

At first, I thought that there was a problem with the request, but I noticed that if I decode the request URI, I get a valid optout address.

It seems that there might be an email client out there incorrectly encoding the optout and unsubscribe tokens, but I haven't been able to reproduce this in testing both HTML and TXT email formats.

Any thoughts about what might be happening here?

# Answer
This sounds like an issue a customer of ours encountered. In the end they resolved it at the device level.

From our issue tracker notes on the subject:

> The issue is to do with character encodings. CiviCRM emails are sent with the following headers:

```
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset=utf-8

```

> Whereas it appears Exchange is re-encoding these as 'quoted-printable' when serving them to the iOS device:

```
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

```

Here was their final feedback to us

> "You were right about this being something to do with legacy mailservers, etc. Sort of. I sorted out how to replicate this behavior on ANY iOS device. Simply create a new mail account on your iOS device using the "Exchange" option as outlined here: http://www.macobserver.com/tmo/article/how-to-set-up-gmail-on-ios-using-exchange-activesync
>
> Although he isn't here today to ask, I believe our ED has his email setup this way on both his iPhone and iPad, and this is causing the issue. I will check in with the member who is experiencing the same issue and see if they are on an Exchange server or a Google mailserver set up in a similar manner.
>
> I'm setting this to resolved, and we'll work internally to get all our people on the correct iOS settings.
>
> Thanks much for your help!"
> 5 votes

# Answer
It's often best when encountering bugs that are difficult to trace to start by upgrading to the most recent version, which in your case would be the lastest LTS version. That way you aren't spending time diagnosing a bug that others have already solved.
> 3 votes

---
Tags: civimail
---


title: System slow on new account creation

text:
# Question
Title: System slow on new account creation
Civi 4.4.3 Drupal 7

When creating a new user account by signing up someone for a membership in CiviMember, the system appears to the user to hang. The processing time is around 80 seconds while the civi account is created, matching drupal account created, card is processed, and other database stuff we are doing to set tags and the like.

Can anyone point me in the direction of any tips or tricks to optimize the process?

Thanks!

# Answer
> 1 votes
Do you have the CiviMember Roles Sync module enabled? The code in this is very similar to the other 'role sync' modules and is currently quite slow. There is an open issue about it here: https://issues.civicrm.org/jira/browse/CRM-14770

Otherwise you could try putting markers in your code at various points to see where the slow-down is happening. Or use a PHP profiling tool.

# Answer
> 1 votes
If the system is that slow perhaps there is a slow mysql query & if you do a show processlist while it is happening you will spot it. My best guess would be a slow de-dupe rule is kicking in.

Be wary about including things with many matches in your dedupe rule - e.g. a city match will have many many pairings who match & will create load. Obviously an email mail is at the opposite end.

---
Tags: drupal, civimember
---


# Question
Title: Where to modify billing information form ≥ 4.6?
One of the first things we're asked to change in any installation is the billing block:

Nothing too fancy, just some changes to layout and labels, usually yielding something along the lines of

This was for a long time a simple matter of copying BillingBlock.tpl to create a custom template (customtemplates/CRM/Core/BillingBlock.tpl), as indicated in the wiki. But the hard-coded billing fields were removed in 4.6, and instead we they are printed out from the `$billingDetailsFields` array.

While I can't fault this from a technical perspective, I do wonder what would be the best practice as far as manipulating the layout and order for this form goes now. In the override template, would we remove the `for` block and output the old fields one by one? Is there a place where these values can be changed in the db or even through the admin UI?

# Answer
Your best option is to do what you were doing previously.

However, you will need to modify your customized template to extract details from the $billingDetailsFields array rather than the hard coded fields. I suspect the names are the same, so the translation should be relatively simple. You can use smarty debug to get more details on the contents of the array.
> 3 votes

# Answer
I would think the previous billingblock.tpl could still be a basis. All the individual fields are still assigned to the template (as required), it's just that an array of fields to show is assigned too ... & this is iterated through to show the fields.

Your layout DOES look better :-)
> 2 votes

---
Tags: forms, custom-templates, contribution-page
---


# Question
Title: How to get the new record ID, when adding a record to a multi-value custom field using the API?
The API calls I know of that add a record to a multi-value custom field, don't return the ID of the added record (which you can then use to access the value for the specific record in the form custom\_XXX\_YY). Is there another way of finding it?

**Observed:**

```
$ drush cvapi CustomValue.create entity_id=154621 custom_368=Test
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [values] => 1
)

$ drush cvapi Contact.setvalue id=154621 field=custom_368 value=test
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 2
    [values] => Array
        (
            [id] => 154621
            [custom_368] => test
        )

)

$ drush cvapi Contact.create custom_368= id=154621
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [id] => 154621
    [values] => Array
        (
            [154621] => Array
                (
                    [id] => 154621
                    [contact_type] => Individual
                    ... snipped ...
                    [modified_date] => 2015-05-14 11:20:56
                )

        )

)

```

**Background:**

In our custom frontend I want to have an 'Add new qualification' link, which creates a record in the appropriate custom field group and then adds the set of fields to the form. The screen size occupied by a set of fields for one qualification is such that I don't want to always have a blank set of fields on the screen for adding a new record, before I've clicked the link. The record's row ID is necessary to add the form fields so they know which record they apply to. Each field is 'inline editable' / sends an update call immediately.

# Answer
I don't think it's possible using the api right now.

So what you could do in the mean time is create a custom function to do it and ideally emulate the api call using the same input params and output so you can replace it with an api call when the api is fixed.

Not tested but should look like :

```
function insertCustomValue($params) {

  // prepare input params
  $dummy = explode('_', $params['field']);
  $cfId = $dummy[1];
  $cfValue = $params['value'];
  $entityId = $params['entity_id'];

  // get table name and column name
  $cf = civicrm_api3('CustomField', 'getsingle', array('id' => $cfId));
  $table_name = civicrm_api3('CustomGroup', 'getvalue', array(
    'id' => $cf['custom_group_id'],
    'return' => 'table_name')
  );
  $column_name = $cf['column_name'];

  // insert the new value in the database
  $sql = "INSERT INTO $table_name (entity_id, $column_name) values (%1, %2)";
  $dao = CRM_Core_DAO::executeQuery($sql, array(
    1 => array($entityId, 'Integer'),
    2 => array($cfValue, 'String')
  ));

  // get and return the id of the new row
  $cfId = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()');
  return array(
    'is_error' => 0,
    'count' => 1,
    'values' => array(
      'id' => $cfId,
    )
  );

}

```

But of course you could also help fix the api which would be better :)
> 4 votes

# Answer
I have expanded upon samuelsov's answer and created a new API function resembling CustomValue.create. It's not as general as the real create/setvalue APIs but it looks like it solves my immediate problem.

https://gist.github.com/futurefirst/9a6b39ddfa34eb01a417

Output:

```
$ drush cvapi CustomValue.insert entity_id=154621 custom_368=thisisatesthello
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [id] => 23
    [values] => Array
        (
            [23] => Array
                (
                    [id] => 23
                    [entity_id] => 154621
                    [custom_368] => thisisatesthello
                    [custom_368_23] => thisisatesthello
                )

        )

)

```
> 2 votes

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


# Question
Title: Error: Database check failed when upgrading from 4.6.0 to 4.6.2
When i try to run the database upgrade script i get the following message:

Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again.

Ive tried a number of times but keep getting the same error message.

# Answer
The upgrade failed the first time for some reason, and all subsequent attempts on the partially upgraded database give this message. Do you have a backup of the original database? Do you know what the original error was?
> 1 votes

# Answer
You say, "Ive tried a number of times but keep getting the same error message". It's not clear whether you're reloading the backup in between attempts.

If you are and you're still getting this message, the next step is do delete and recreate the database before reloading the backup. Reloading a backup will replace the values in existing tables - but will NOT delete tables created when updating to 4.6.2, which is a possible cause for your error.

To delete and recreate the database, and assuming the database name is `myorg_civicrm`...

`DROP DATABASE myorg_civicrm;`

Then create a blank database with:

`CREATE DATABASE myorg_civicrm;`

So long as the new blank database shares the same name as the deleted database, your MySQL user will have the same permissions on the new database - so just reload your dumped tables and try again!
> 0 votes

---
Tags: joomla, 4.6.2, upgrade
---


# Question
Title: Possible cause? CiviMail sent "400%" of queued messages, hit each recipient 4 time
On a well established site that uses CiviMail and Groups for a range of mailing lists, a message was sent out this morning as usual to a list of over 1400 people.

Inexplicably, each recipient received the mail 4 times. I have checked and the message was definitely only queued once, and was sent out by a single cron job. The report for the message makes clear that something very odd happened:

```
Intended Recipients 1411
Successful Deliveries   5644 (400.00%)
Tracked Opens   268
Click-throughs  50
[...]
Scheduled Date  May 20th, 2015 9:48 AM
Status  Complete
Start Date  May 20th, 2015 10:00 AM
End Date    May 20th, 2015 10:11 AM

```

Normally a cron such as this takes about 2 minutes to run. This one took substantially longer.

The CiviCRM installation was upgraded to the latest version on May 4th, however multiple messages have been sent successfully in the interim.

I cannot see any evidence of user error which would have caused this to occur.

Greatly appreciate any thoughts on how this came about, as the site owners are naturally reluctant to use the system again until the cause has been established.

# Answer
It was highly likely due to this issue which has now been fixed in 4.6.3:

https://issues.civicrm.org/jira/browse/CRM-16251
> 3 votes

---
Tags: civimail, email, contacts, groups, cron-job
---


title: Newspaper Action DB integration?

text:
# Question
Title: Newspaper Action DB integration?
Has anyone integrated a newspaper action page (e.g., site visitor puts in zip code and page shows local, regional, statewide options for writing a letter to the editor)? If so, where might one get access to a portion of that database for a specific state? Thanks!

We are using CiviCRM with WordPress.

# Answer
No I haven't done so. But in Drupal this is possible with the views module. CiviCRM has a great integration with the views module and you could create a view which shows all news within the region of the logged in civicrm contact.

What I would do is to create a custom set with all the regions. This could be custom contacts in civi with a relationship, or a custom select list on the contact card and probably with some coding you could set this field automaticly or let the user select in which region he lives. And this select list you also use at your news artivles to link them to regions.
> 1 votes

---
Tags: wordpress, extension
---


# Question
Title: Unsupervised dedupe rules in the background?
It is my understanding that unsupervised dedupe rules take effect when one attempts to create a *new* contact, and they can also be run manually like any other rule. Can unsupervised deduplication be made to happen to *existing* contacts in the *background* (eg from cron)?

Edit: Or indeed, in the foreground but still basically automatic in terms of 'start it and wait for it to finish'?

# Answer
> 2 votes
See the third post here by Deepak.

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

I havn't tried it but it looks like scheduled mass merges are possible

```
Process batch merge (Daily)
API Entity: Job
API Action: process_batch_merge

```

---
Tags: contacts, cron-job, duplicate-contacts
---


# Question
Title: Error when printing PDF letter or mailing label from search results list
Ran a filtered search for all "regular" members and search returned 379 records. I then wanted to create printable letters for all 379 members. I selected our New Member Welcome Letter as the template and pressed "Make PDFs". Result:

```
Notice: Undefined index: metric in /home/sherida1/public_html/rabbit/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/PdfFormat.php on line 309

Notice: Undefined index: metric in /home/sherida1/public_html/rabbit/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/PdfFormat.php on line 309

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /home/sherida1/public_html/rabbit/administrator/components/com_civicrm/civicrm/vendor/dompdf/dompdf/include/frame.cls.php on line 180

```

After seeing the memory size error, I tried something simpler. Selected the first 10 names from the search result and tried "Make Mailing Label" Results:

```
Strict Standards: Non-static method CRM_Contact_Form_Task_Label::buildQuickForm() should not be called statically, assuming $this from incompatible context in /home/sherida1/public_html/rabbit/administrator/components/com_civicrm/civicrm/CRM/Member/Form/Task/Label.php on line 60

TCPDF ERROR: Some data has already been output, can't send PDF file

```

I will examine the lines of code mentioned, but I hope that someone can quickly identify the issues.

Thanks, Kate

# Answer
> 5 votes
With your first error, the issue is with TCPDF, the standard PDF library that CiviCRM ships with. TCPDF isn't very efficient, and takes a lot of memory when you try to generate a large PDF. Unfortunately, the other two PDF options have issues: DomPDF doesn't support all of the features TCPDF does. wkhtmltopdf is great, but is written in C, which means that unlike PHP applications, you need a version specific to your environment. If you install wkhtmltopdf on your server though, you can tell CiviCRM to use that instead. I think this is the best solution for you.

You can either a) install wkhtmltopdf and tell CiviCRM to find it (*Administer menu \> System Settings \> Misc*), or b) increase the amount of memory available to PHP in your php.ini. I recommend the first option!

# Answer
> 3 votes
Regarding your second issue: When a PDF is generated, CiviCRM can NOT put anything else on your screen before sending the PDF header. However, you're getting a "Strict Standards" notice - which comes before the PDF header. The second line of your second message is saying, "Hey, I can't create a PDF because I showed you that notice first."

Now that's not really an error - it's the most innocuous of notices! A production environment should be configured to not show strict notices. There's good advice on fixing this here and here. Suppress the strict notice, and the "can't send PDF file" message will go away.

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


# Question
Title: Why do I get "Access denied; you need (at least one of) the SUPER privilege(s) for this operation" when importing a SQL dump to CiviCRM?
When attempting to import a database dump from CiviCRM on a computer other than the one I dumped it from, I often get an error that looks like:

```
[ERROR in query 7] Access denied; you need (at least one of) the SUPER privilege(s) for this operation

```

How do I fix this?

# Answer
CiviCRM defines MySQL triggers for certain tasks. When you use phpMyAdmin, mysqldump or similar to export your database to a text file, it exports your triggers as well. The format is something like this:

```
/*!50003 CREATE*/ /*!50017 DEFINER=`newpress`@`localhost`*/ /*!50003 TRIGGER civicrm_address_after_insert after insert ON civicrm_address FOR EACH ROW BEGIN

```

The issue is the `DEFINER` clause. This specifies the user whose permissions are used when the trigger runs. When you import a database, it defines your triggers, but you can NOT define a trigger to run as someone other than yourself. So if the MySQL username has changed, you must fix your triggers.

You can either a) change the name of the MySQL user listed as the DEFINER, or b) remove the DEFINER portion of the clause altogether. If you don't specify a user, MySQL will default to `DEFINER = CURRENT_USER`, which in this case is correct.

You can fix this with a search-and-replace in your favorite text editor. If that text editor is `vim`, you can press `:` and paste this command in to remove all the definer clauses:

```
%s:/\*\!50017.*localhost`\*/::

```

**EDIT:** Chris' regex below is good. I improved it slightly here:

```
perl -pi -e 's#\/\*\!5001[7|3].*?`[^\*]*\*\/##g' /path/to/mysqldump.sql

```
> 13 votes

# Answer
Jon G's answer is correct.

However, If you're not in the world of shell editors and perl, you can also open the dump file in a text editor (not a word processor) and do a search and replace. You can just search for DEFINER=`name`name@localhost portion, replace it with nothing, and leave the rest of the line in place.
> 5 votes

# Answer
The simplest route I believe is to generate DB dumps which omit these triggers by using mysqldump's **--skip-triggers** switch

```
mysqldump --skip-triggers NAMEOFDB > NAMEOFDB.sql

```

This outputs a version of the DB dump without triggers, which CiviCRM will regenerate once loaded onto the next site.

If you're using another interface to mysqldump, eg phpmyadmin or sequel pro, these tools may offer a way to achieve the same functionality.

EDIT: Some CiviCRM sites (those using localization?) may additionally have SQL VIEWs which also include `DEFINER` comments. In MySQL 5.7.8+ you can use `--skip-definer` which should remove this additional "feature". If you are on less than MySQL 5.7.8,

```
cat example.sql | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > new.sql

```

EDIT 2: Now I'm just blowing away all the MySQList SQL comments with

```
perl -pi -e 's#\/\*\!5001.*localhost`[^\*]*\*\/##g' example.sql

```
> 5 votes

---
Tags: sql, backups
---


title: Reporting on Premium Fulfillment

text:
# Question
Title: Reporting on Premium Fulfillment
Membership in our organization currently includes a T-Shirt which is implemented as a "Premium" on the contribution page. Members must pick up their T-Shirt in person, so I'm looking for a way to report (create a list) on the fulfillment status of all current members.

There is a field for fulfillment date on the Contribution Detail page, but I can't seem to find this as a field in any of the available reports.

Any suggestions would be appreciated.

# Answer
> 4 votes
UPDATE: As of version 4.6.4, the code below is merged into core. Use the Contribution and Membership Details report.

This was such a good question I decided to dig into the code.

I used `grep` to search the Reports folder for the word "Premium" - and found that the only report that includes premium info right now is the Contribution and Membership Details report (found in the "Membership Reports" section). That report shows the Premium and Premium Option, but not the fulfilled date. However, it's only three lines of code to add if you use this report as your base.

Create a PHP override directory - there's documentation that shows you how - and copy the ContributionDetail.php file into the appropriate place in the folder. Then find the section that reads:

```
  'civicrm_contribution_product' => array(
    'dao' => 'CRM_Contribute_DAO_ContributionProduct',
    'fields' => array(
      'product_id' => array(
        'no_display' => TRUE,
      ),
      'product_option' => array(
        'title' => ts('Premium Option'),
      ),
      'contribution_id' => array(
        'no_display' => TRUE,
      ),
    ),
  ),

```

Change it to read:

```
  'civicrm_contribution_product' => array(
    'dao' => 'CRM_Contribute_DAO_ContributionProduct',
    'fields' => array(
      'product_id' => array(
        'no_display' => TRUE,
      ),
      'product_option' => array(
        'title' => ts('Premium Option'),
      ),
      'fulfilled_date' => array(
        'title' => ts('Premium Fulfilled Date'),
      ),
      'contribution_id' => array(
        'no_display' => TRUE,
      ),
    ),
  ),

```

---
Tags: civicontribute, civireport, premiums
---


title: Best way to extend group functionality

text:
# Question
Title: Best way to extend group functionality
I have a requirement to extend change add/edit screen of static group and add some extra fields there, like default email subject.

For saving extra fields I'm thinking about adding a new table, linked to groups table.

Then to display those fields I will need to create my own version of CRM\_Group\_Form\_Edit.

Now I'm thinking what is better way to do all this, 2 options:

* put required classes and templates in custom folder and change them. Looks like this is standard way.
* instead of editing CRM\_Group\_Form\_Edit I could create my own class then change CRM\_Group\_StateMachine to point to that class which would extend CRM\_Group\_Form\_Edit

2nd option kind of sounds a better way thinking about feature upgrades.

are there same case scenarios when to use what? or any other suggestions for this requirement?

# Answer
> 1 votes
Any reason why you cannot use a custom set that extends groups? This allows you to add various fields to civicrm\_group which appear in the add/edit screen of all groups

You can select "Groups" in the "Used For" selection here:

http://d46.demo.civicrm.org/civicrm/admin/custom/group?action=add&reset=1

---
Tags: extension, groups
---


title: Add non-Primary email address to Group

text:
# Question
Title: Add non-Primary email address to Group
I have contacts with multiple email addresses. I want to assign non-Primary to specific Groups, ie, Billing different than Main (Primary).

Also, when using simple or Advanced Search, it doesn't find any other email address other than Primary for that contact.

Finally, using Full-Text or Search Builder, the former finds the Contact record but offers no additional functions while the latter finds the correct email address but will not allow it to be added to the group and defaults to the Primary tagged email address.

# Answer
In CiviCRM you cannot assign email-adresses to groups but only contacts, including all their related information such as email-adresses.

Could you specify, what you want to do with the contacts in question (e.g. sending an email to a specific address, create a pdf-letter...)? Maybe there is another solution for your task at hand.

I think the non-primary email-addresses are not found by simple or advanced search due to performance reasons - there is an older threat here:

http://forum.civicrm.org/index.php/topic,16221.msg115088/topicseen.html#msg115088
> 4 votes

---
Tags: contacts, search, groups, 4.6.2, search-results
---


# Question
Title: Is there any documentation for 'safe' and 'aggressive' merge modes?
We are investigating the 'Process batch merge' scheduled job in CiviCRM, to automatically batch merge duplicate contacts. This calls api.job.processBatchMerge which seems to take the rule to use as a parameter and also a mode, 'safe' or 'aggressive'.

'Safe' mode skips the merge if there are conflicts (which is probably best for an automated process!)

But how does 'aggressive' mode decide which contact data to overwrite/keep? I couldn't find any documentation about this.

# Answer
> 10 votes
Its generally a contact with lower ID that's preserved.

For aggressive merges, fields in conflict are retained from that of higher contact ID. In other words, for fields in conflict, value from higher ID overwrites on that of lower ID.

Preserving of contact, is due to the way dedupe queries are written.

A. Example: `INSERT INTO dedupe (id1, id2, weight) SELECT t1.id id1, t2.id id2, 10 weight FROM civicrm_contact t1 JOIN civicrm_contact t2 USING (first_name) WHERE t1.id < t2.id AND t1.first_name IS NOT NULL GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight);`

B. Here is the code and comment that makes it clear - https://github.com/civicrm/civicrm-core/blob/4.5/CRM/Dedupe/Merger.php#L636

However with CiviCRM v4.5 and above, you can decide the biasing (which contact to preserve) using merge hook - https://github.com/civicrm/civicrm-core/blob/4.5/CRM/Dedupe/Merger.php#L632

Here is an implementation example where a contact with maximum number of contributions is preserved - https://github.com/civicrm/civicrm-drupal/blob/7.x-4.5/civitest.module.sample#L1279

Same hook could also be used for deciding which value to preserve by playing with $conflicts variable. Here is an example that we did for one of our client - https://github.com/veda-consulting/uk.co.vedaconsulting.module.dedupe/blob/master/dedupe.php#L218

---
Tags: duplicate-contacts, scheduling
---


# Question
Title: How NOT to send email to "Activity Assignee" when assigned an activity
Usually we create different type of activities and assigned to one of our volunteer. Now when "Create separate activity for each contact" is selected, assignee volunteer receive multiple emails for each contact.

Alternative option is not to check that option, but then it creates only one activity for multiple contacts, and when changed the status of activity of 1 contact, it changes status of all contacts.

I know emails can be redirected to database, I guess by doing that all offline contribution email receipt wouldn't be sent right?

So Is there a option or a way NOT to send a email notification to a assignee without compromising any other outbound email service?

# Answer
> 15 votes
In CiviCRM Administration \> Display Preferences you can turn off emails to activity assignees globally

civicrm/admin/setting/preferences/display?reset=1

---
Tags: email, activities, best-practice
---


# Question
Title: How to customize Contact Map popup on clicking on icons?
I'm trying to remove the street address right now from the Google Map that's created from Search Contact -\> Map Contacts when you click on the people icons placed on the map. This is for privacy purposes, but I'm interested in adding some custom contact info there later.

I researched and found the Mapping Providers are at templates/CRM/Contact/Form/Task/Map. When I copied Google.tpl, renamed to GoogleCityOnly.tpl, and edited - it shows up as a selection in the Mapping and Geocoding system menu for Mapping Providers. But when I choose it and search contacts, the "Map Contact" no longer shows up.

What am I missing to have "Map Contact" show up again? Where's the guidance for making an alternate Mapping Provider?

# Answer
1. When you select Google as the map provider, I assume the Map Contact shows up.
2. Ensure that When you select GoogleCityOnly, you also retain the Google Map API Key. The code checks for the presence of both a mapping provider and a mapAPIKey before displaying the Map Contact link
3. If you want to "modify" the code to avoid the Map API key for now, check: CRM/Contact/Selector.php and search for mapAPIKey
> 1 votes

---
Tags: contacts
---


# Question
Title: CiviEvent registration being assigned to the the wrong participant
I have created an event that allows for one person to register multiple participants. I pulled a report two days ago with the list of registrants and one person had paid the event fee plus a donation to total $35, which is unique for this event so far.
Today, someone new registered themselves and another person for the event and paid, which is fine. However, now that $35 registration has been assigned to the new registrant's name and not the correct original registrant. This has also happened in previous events I've created when I enable multiple registrations by one person. Does anyone know how I fix this?
I'm running Civi 4.6.2 and latest version of wordpress.

# Answer
> 1 votes
I guess you are getting bit confused with Event registration When an Event is created to accept multiple participant

The first entered member is considered as the actual member register and he is the one who is charged for all the participant amount too (in respective of the member is new or existing)

I have done the same example against http://d46.demo.civicrm.org against Version 4.6.4 which is working alright - i don't think this is an issue

if you are still getting issue with this let me know with some example - thanks

---
Tags: civievent, wordpress
---


title: Geocoding Addresses

text:
# Question
Title: Geocoding Addresses
I'm using civiCRM 4.6.2.

I've configured the system for the use of geocoding. I'm using google maps and have an API key. When I run geocoding for parsing (ie parse = 1 and geocode = 0) the addresses are parsed correctly.

When I then run for geocoding my addresses (parse = 0 and geocode = 1) I always get back 0 addresses were processed. If I go into a contact and save their address the lat and long is created. I have throttle set to 1.

I've tried with a large set of addresses (start = 1000 and end = 2000) and with smaller sets, down to even just one address. I've dumped my contacts to make sure that the start and end represent valid contact IDs.

Any thoughts on how to get geocoding to work for me?

# Answer
> 5 votes
I've found that if contacts have a geocode even if it's wrong, it won't update it.

You can get this situation if you import updates to addresses (like from NCOA) and don't have the import do the geocoding, which I think is the default. (Really this is a bug and I'll file an issue on it when I have a free min.)

I ended up using sql to zero out the codes.

---
Tags: geocoding
---


# Question
Title: Can I add phone number as a searchable field on Advanced search Page?
We are currently running on civiCRM version 4.1. Can I add phonenumber as a searchable field on Advanced search Page?

# Answer
> 7 votes
Sure thing. Just upgrade to version 4.4 or later and it will be there :)

---
Tags: search
---


# Question
Title: Tokens for Custom Field Set with Multiple Records
I'm looking to print / email groups of contacts with a list of their accreditations which we've stored in a custom field set with multiple records. How do we get that to appear on emails & printouts? There is no option on the tokens dropdown.

We want the list to appear in a table format, showing all the entries.

Similar to this support post: http://forum.civicrm.org/index.php?topic=30029.0 / I found this post hard to find an answer from.

Any specific ideas? Thanks very much in advance!

# Answer
You will need to create a custom token for this. Hook\_civicrm\_tokens is where you assign names to your tokens, and hook\_civicrm\_tokenValues is where you define the business logic. You will use the API to retrieve the custom field values for each contact, and loop through those values to build your HTML table. Below is an example of the basic API call, for contact 465 to return all the entries for Custom Field 12. Using CustomValue API is a bit different from the others as you'll see from the `return.fieldname => 1` bit:

```
$result = civicrm_api3('CustomValue', 'get', array(
  'sequential' => 1,
  'entity_id' => 465,
  'entity_type' => "Contact",
  'return.custom_12' => 1,
));

```

This is a sample of the result:

```
{
    "is_error": 0,
    "version": 3,
    "count": 1,
    "id": 12,
    "values": [
        {
            "entity_id": "465",
            "latest": "Hope",
            "id": "12",
            "1": "Life",
            "2": "Hope"
        }
    ]
}

```
> 3 votes

# Answer
Tokens do not easily lend themselves to printing out multiple records, since this generally requires extra markup in the output to look the way you want (e.g. an ordered list or a table). However, with a little bit of custom code you could do it.

See Create Your Own Tokens for Fun and Profit for a how-to guide.
> 1 votes

---
Tags: custom-fields, tokens
---


# Question
Title: Civimail 4.6.2 on Drupal 7.36 creating multiple drafts while editing
We recently upgraded from CiviCRM 4.5.8 to 4.6.2 and this is our first shot with the new interface. We're just at the compose stage but what we've run into so far:

* Multiple copies of the draft appear to be created as you're editing. In some of those copies it will say "place holder" in the Mailing Name column while others have the correct Mailing Name.
* Once you've backed out of the editor (either from a freeze as we've had with IE or you just intend to come back later to finish it up), the Status column shows "Complete" and the Scheduled/Started/Completed columns now have timestamps. Nothing has been sent and if you click on the Report link it shows all "0" even though while editing there was a number for the estimated recipients.
* Even though the Status shows as Complete versus Not scheduled as it would back in 4.5.8, these draft mailings show up for both Mailing Status of Draft/Unscheduled as well as Complete.

At this point we've seen this from a client using Windows 7 and IE while I'm using Chrome on Linux. Using the same Chrome/Linux combo I was able to get a mailing composed and sent using CiviCRM 4.6.2 on a WordPress site.

I just put in the define('CIVICRM\_CIVIMAIL\_UI\_LEGACY',1); setting into the civicrm.settings.php file to get this mailing out but can revert back for some testing.

# Answer
The answer is to update to 4.6.3.

In CiviCRM 4.6.2 on Joomla 3.4.1, I experienced somewhat the same thing. After sending the mailing, the draft remained in Drafts and was marked as Completed with all the appropriate reports. So, there are two identical listings for the same mailing in each Scheduled/Sent and Drafts areas.

***Can the duplicate in Drafts be deleted or is it a the same entry as what is in the Scheduled/Sent area?***

I updated today with CiviCRM 4.6.3, and performed the same and usual process and this doesn't occur any longer.
> 3 votes

# Answer
This sounds a bit like CRM-16251. Are you, by any chance, using smart groups? Try editing the file `CRM/Contact/BAO/GroupContactCache.php` around line 546 and changing `DROP TABLE` to `DROP TEMPORARY TABLE`, as in 5467c9fbb.
> 1 votes

---
Tags: civimail
---


# Question
Title: How to search all the fields in address as one string
Kindly help us with address search builder please. We wanted to make all the fields in the address as one string and then search for the address using reg expression.

# Answer
This isn't a feature that exists out of the box - but addresses support custom fields, so if you're comfortable writing an extension, you could do this. Create an extension with a `hook_civicrm_pre` that looks something like this:

```
function sharedaddresschanges_civicrm_pre( $op, $objectName, $id, &$params ) {
  if (($op == 'create' || $op == 'edit') && $objectName == 'Address') {
    $result = civicrm_api3('CustomValue', 'create', array(
      'entity_id' => $id,
      'custom_xx' => "street_address supplemental_address_1 city etc etc."
    );
  }

```
> 2 votes

# Answer
Stepping outside civi you could do this in Drupal Views via a Views Block using a Global "Combine Fields Filter", and set the resulting records with a link back to their civi contact.
> 2 votes

# Answer
You could use the Full Text Search feature which offers *some* of what you requested. It supports sql wildcards but not regex, and it does search across multiple tables and columns, although it doesn't concatenate them together first.
> 0 votes

---
Tags: search
---


title: Require non-custom fields?

text:
# Question
Title: Require non-custom fields?
Question: How do I require the first and last names on Individuals?

I need to require some global fields in the CiviCRM backend GUI. Specifically, I need to require the First and Last name for individuals on the standard individual create/edit backend webforms.

I thought there was an admin page to set this, but can't find it right now and I suspect other people will be interested in the answer too.

# Answer
> 5 votes
You can make any fields "required" when they are part of a profile.

Admninister \> Customize data and screens \> Profiles \> Fields \> Edit

# Answer
> 3 votes
You can do that developing a custom extension. As far as I know, there is no way to configure mandatory fields from the UI.

How to create an extension here or you can use use civix. In your extension, in the main extension's .php file, you can use civicrm hooks, in this case:

```
hook_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors )

```

For your example, let's say I create my extension as **org.civicrm.myextension**. In myextension.php add this for making First Name mandatory:

```
function myextension_civicrm_validateForm( $formName, &$fields, &$files, &$form, &$errors ){
    if ( $formName == 'CRM_Contact_Form_Contact' ) {
       // ensure that first name is not empty
       $first_name = CRM_Utils_Array::value( 'first_name', $fields );
       if ( empty($first_name) ) {
          $errors['first_name'] = ts( 'First Name is a required field' );
       }
    }
    return;
}

```

# Answer
> 1 votes
Might be simpler and easier to add this behavior via jQuery / javascript and include it in an extra custom template file.

https://civicrm.org/blogs/dave-greenberg/now-its-easier-add-custom-behaviors-templates

---
Tags: custom-fields
---


# Question
Title: How can I include a custom template file in an email template using smarty?
**Details**

We would like to create a standard header and footer for our email templates. Rather than pasting the custom HTML in the top of each system email template we want to override, it would be better to define a header template, and a footer template, and then use smarty to {include} these templates.

Is this possible with CiviCRM?

Is there a reason CiviCRM doesn't have a single header/footer template by default? If not would this make a reasonable feature request?

# Answer
> 6 votes
1. I dont think CiviCRM does this by default
2. However, I do think this is a good idea and makes sense to include it in core for non-civimail mailings (which already have a header/footer)
3. Might want to modify the core mailing functions:

CRM\_Core\_BAO\_MessageTemplate::sendTemplate

to add a default header / footer

4. Might want to allow this to be overridden both at the system level, function level and via a hook

# Answer
> 1 votes
I just want to clarify the basic functionality provided by CiviMail, since it may provide enough. CiviMail has separate functionality to manage headers and footers and templates. So a standard header and footer can be defined and used for several templates. At the time of configuring a mailing 1) the template if any is specified and then an instance (ie copy) of it can modified in the editor, and 2) the header if any and 3) the footer if any are also specified. If your main interest is in being able to separate managing the header and footer from all the templates that use them, this should be enough.

If you are more interested in pre-assigning for each template a specific header and footer, then a small extension could be developed that would allow the header and footer for a template to be specified when it is edited. Later when a mailing is being configured and a template is selected, those stored selections would be used to set the mailing's header and footer.

# Answer
> 1 votes
one option might be to create a custom token {template.header} and {template.footer} that generates the needed html. the way you implement that function can be to fetch the html from a template. Note that it probably means you can't have token within these templates, that might or might not be an issue for you

# Answer
> 1 votes
We've done this, unless I'm misunderstanding you.

I made an extension and put the required header code (in our case, a formatted address block) into a tpl in the templates/CRM/something directory. This included tokens etc. as it would have in the message template itself. Then in the message template I just used {include file=CRM/something/addressdate.tpl}.

This works fine for us, but I did encounter weird stuff to do with needing/not-needing the $ symbol on tokens. This seemed directly related to the use of an include file, as the same issues didn't arise if you put the same header code into the message template itself. That said we have a bunch of other extensions, and I never figured out the root cause, so ymmv.

---
Tags: email, templates, custom-templates, smarty
---


title: Advance Multi-Select - Obsolete?

text:
# Question
Title: Advance Multi-Select - Obsolete?
When I was editing a custom field I got this pop-up:

'Obsolete widget The old "Advance Multi-Select" widget is being phased out and will be removed in a future version of CiviCRM. "Multi-Select" is the recommended substitute.'

Our user find it quite nice to be able to move items between the two lists rather than remember to hold down the Ctrl key or else they lose all their previous selections.

Can anyone shed any light on why this field type is going obsolete and if there is any way of continuing to use something similar?

Had a search around and couldn't find any info.

Thanks,

Dave

# Answer
You may be thinking of the old multi-select widget, which required Ctrl+click. The new one is much improved (I think it was refreshed in 4.5) using the popular Select2 widget. It does find-as-you-type, and as it narrows down the options you can either click or press enter to add that option, then continue with the next one. You can also click in the field for a drop-down of all options (except the ones you've already chosen). Give it a shot on the Civi demo site; I'm sure you will like it.
> 6 votes

---
Tags: custom-fields
---


# Question
Title: No emails sent automatically when someone joins a group
The documentation says:

> After people subscribe to mailing list groups—via the subscribe link or a profile—CiviCRM will automatically send them an email asking them to confirm their subscription. Until they click the confirmation link in the email, their contact information will appear in CiviCRM with their group subscription set to Pending. When they confirm, CiviCRM will automatically change their group subscription status to Added and they will be sent a welcome message. (Note: When users subscribe to multiple groups at once, a confirmation email is sent for each group separately.)

I cannot get this to work. Civimail works fine. Send mail to individuals or to a list that resulted from a search works fine.

People join a group through a profile. The advanced settings in the profile has the group name ("Volunteers") and a return ddress but **no emails are sent**.

I have checked to see if there is a scheduled job that handles this but could not find one that seemed relevant.

# Answer
> 7 votes
Check your settings in **Administer \> CiviMail \> CiviMail Component Settings**:

---
Tags: civimail, profile
---


title: Is CiviCRM thread safe

text:
# Question
Title: Is CiviCRM thread safe
My system administrator asked me if CiviCRM is thread safe. He could not really explain what he meant by that but he explained me that civicrm should be thread safe because he wants to use Apache Event module as a webserver.

And I don't really know if CiviCRM is thread safe. I have read this topic https://stackoverflow.com/a/5978844/3853493 and it looks like PHP is the problem but not really an application written in PHP.

The question really is, could we use Apache Event module in conjuction with CiviCRM.

# Answer
> 4 votes
I would say no:

1. As you've said PHP is not thread safe
2. CiviCRM does not focus on preventing race conditions in a few cases. Event registration and max participant count was one case (it might be fixed by a contrib in recent versions)

---
Tags: webserver
---


title: How to fake a 'deny' ACL

text:
# Question
Title: How to fake a 'deny' ACL
Has anyone ever tried to deny access to a group of custom fields, for particular roles/users? We have a custom-data tab that we'd like only particular roles to see. I know there's no 'deny' ACL, but I'm wondering if it can be faked through hooks.

I figure I can hide the tab using hook\_civicrm\_tabs, and kill any exports using hook\_civicrm\_export. Would there be much more to it than that? Or is this just entirely impractical, as there'll always be some way around it?

I appreciate we could flip it all around and start with a more restrictive set of permissions. Then create ACLs that *allow* access. But we have a *lot* of custom fields and a lot of different roles - so this would be a pretty big admin burden. And we only rarely need to deny anything.

EDIT: we're on WordPress, which doesn't have a 'deny' ACL available.

# Answer
It should be possible in WordPress also. WP + Civi has the same capabilities as drupal and joomla.

Deny ACLs are not part of the UI. You can implement them via a hook. Check:

https://civicrm.org/blog/lobo/implementing-a-custom-acl-system-in-civicrm

(search for VIP contacts)
> 3 votes

# Answer
Yes, you can deny access for each set of custom field set

just give a read http://book.civicrm.org/user/current/initial-set-up/permissions-and-access-control/ which explain. I guess this helps

if you need some example please let me know will update you in details
> 1 votes

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


# Question
Title: Free memberships are not created after upgrading to 4.6
We just upgraded to 4.6, and are having an issue with our membership sign up contribution page. It is for a free membership, and the page says that it is working, but on the back-end, no membership is being created: just the contact record and Drupal account. Has anyone had a similar issue after upgrading, or have any idea what could be wrong?

I tried to replicate it on the demo site, and could not.

# Answer
The demo site always runs the very latest code, essentially 4.6.3 which will be released tomorrow. Maybe upgrading will solve it?
> 0 votes

# Answer
I had a similar problem with civicrm and wordpress but it is now solved by upgrading to 4.6.3
> 1 votes

---
Tags: civimember, contribution-page
---


# Question
Title: Wordpress plugin configuration will not launch
I have installed CiviCRM on my wordpress site and I am able to activate the plugin. When I go to the configuration page, I get a blank screen and nothing happens. No errors are generated but I can't move forward. Any suggestions?

Edit: I am hosting the site at Arvixe. The server error logs are blank.

# Answer
> 1 votes
After activating CiviCRM, did you run the installer? See instructions here at http://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress

---
Tags: wordpress, configuration
---


# Question
Title: How to add a class to a form element in buildQuickForm?
From a user perspective, the 'How many people are you registering?' input, on the event registration form for multiple participants, is a required field. Therefore, it should have the red asterisk for continuity.

However, we can't just add the 'required' formRule to the element, because behind the scenes a '1' is a value of nothing (ie: no additional participants).

So what's the easiest way of adding the 'required' class to the element, without adding the form rule itself? It would be great to push this back to core, rather than us just overriding it in our CSS, even though it is a *super-trivial* improvement.

# Answer
John - There's an existing pattern for simply add the markup to the template for cases like this, and I think it's fine for this situation. So in Register.tpl, just add this markup after the label:

```
<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>

```

Note that there was evidently some spots where this technique was used / but then removed in that file (see line 47). I think we can remove that {capture} statement at this point and just put the markup where it's needed.
> 3 votes

---
Tags: civievent, forms, usability
---


# Question
Title: Trying to run Civi cron Jobs using Drupal cron?
I'm running Civicrm 4.4.7 on Pantheon.

I added the module called 'Elysa Cron' to my Drupal site which allows the option of running Civi cron whenever Drupal cron is run. The status report in Drupal shows that Civicron is running but nothing happens in Civicrm. Any idea what can be the issue?

# Answer
> 5 votes
Just to summarize all the places to look. If you've chosen to try to run CiviCRM cron from Drupal, you need the civicrm\_cron module. Then in the Elysia Cron settings: admin/config/system/cron/settings take a look at the settings for the civicrm\_cron job and make sure it's enabled. It's probably called: civicrm\_cron\_cron. Though if you're seeing civicrm\_cron in watchdog then it's being called.

The next step is to check that you can manually run cron by executing the cronjob by entering the url for the cronjob in the url (with the site key set in civicrm.settings.php), by using a drush command, or by clicking the Execute Now button next to the scheduled job in Administer \> System Settings \> Scheduled Jobs. Make sure those scheduled jobs are enabled and have a frequent enough schedule. (More info here: http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-Command-lineSyntaxforRunningJobs).

If the scheduled jobs are working but still not being called from Drupal, then you may want to see if you're able to get them to run via third-party cron service such as EasyCron and create a cronjob such as `*/15 * * * * wget -O - -q -t 1 'http://mysite.org/sites/all/modules/civicrm/bin/cron.php?name=username&pass=password&key=site-key'`.

I'm also running CiviCRM 4.4.14 on Pantheon and I'm using an external cronjob to call Elysia Cron and it's triggering CiviCRM cron. So I know that in general it should work.

---
Tags: drupal, cron-job, pantheon
---