# Question
Title: How to create a relationship if a contact marked with multiple subtype?
I have 3 contact subtypes.

1. Contributing member
2. Volunteers
3. Patron

some of members have multiple subtypes associated to their record. When I try to create a relationship of a **"Patron"** with a contact marked **"Contributing member & Volunteer"** it does not work, if relationship **A-B** are set to the contact subtypes. It only works if selected relationship **A-B** are both ***Individuals*** and not the **subtypes**. Anyway to fix it, so that I can use the contacts that uses multiple contacts subtypes?

# Answer
I just spotted the problem. It was working all the way through. But the auto search was not showing the result. It would only show the result below when I click search button. It happens if either of the contact marked with multiple subtypes. Now, I have removed other subtypes and kept only the ones related to relationship for both contact. And now it shows the auto search results.. as I am using 4.4.16, I tried with 4.4 demo site and i can reproduce this.
> 0 votes

# Answer
I am not sure if I understand, I have a relationship on my install between subtype 'Suplier' and subtype 'recruiter'? Can you explain what is different?
> 1 votes

# Answer
I have now also added a relationship between two subtypes of Individual? Can you reproduce your situation on the CiviCRM demo site?
> 0 votes

# Answer
The mechanism for creating relationships has changed considerably between 4.4 and the current stable release (4.6). The core team is not fixing issues in 4.4 and I suspect the LTS team will not consider this issues either as they generally limit 4.4 changes to security and data loss problems.
> 0 votes

---
Tags: relationships
---


# Question
Title: How to setup Civicrm for using FPO addresses
I have a client that needs to use FPO addresses for contacts and members. Is there something that needs to be configured in CiviCRM for this capability?

Carl

# Answer
The list of states isn't editable by the end user, so it will require filing a bug to get APO, FPO (and whatever the third one is) added as state. In the meantime, I recommend using APO as the city, and not filling in the state or country (per USPS recommendations).
> 4 votes

# Answer
Although state can not be edited in the User Interface, you will be able to add FPO addresses to the table civicrm\_county using some MySQL database management tool like Phpmyadmin? If adding FPO as state is a solution that is...
> 2 votes

---
Tags: addresses
---


# Question
Title: DB Error: no such field : Assignee Contact Email
We had to restore a database from server crash to a newer version CiviCRM (4.6.3). We have gotten most of the data moved over but this one has us stumped. We have been getting the error "DB Error: no such field" when we have the "Assignee Contact Email" checked in the Activity Report-Template.

I have gone through and compared the tables: **civicrm\_activity** and **civicrm\_activity\_contact** to a fresh install of CiviCRM 4.6.3. All Columns, Indexes and Foreign Keys seem to be identical.

Is there some other place I should be checking?

Thanks again for everyone's help!

# Answer
> 2 votes
Which version did your database come from? I could imagine your report still tries to retrieve the assignee contact id from the table civicrm\_activity\_assignment (prior to CiviCRM version 4.4) rather than from civicrm\_activity\_contact?

# Answer
> 1 votes
Since your codebase has been upgraded, and your question doesn't mention running the upgrader as part of this, make sure you've followed the upgrade instructions (as best as they can apply after a server crash).

* For Drupal, visit `?q=civicrm/upgrade&reset=1` or `civicrm/upgrade?reset=1`
* For WordPress, visit `wp-admin/admin.php?page=CiviCRM&q=civicrm/upgrade&reset=1`
* For Joomla, visit `/administrator/index.php?option=com_civicrm&task=civicrm/upgrade&reset=1`

For upgrade documentation, refer to the upgrade documentation page for your CMS. If your replacement server differs from your previous one, also review documentation for moving an existing installation to a new server or location.

---
Tags: database
---


# Question
Title: How to Hide/Remove "Premium Block" when adding new contribution?
Just wondering is there a way to update the contribution.tpl to hide the premium section please? I was not able to find in this tpl, thus asking...

# Answer
You can not do this from the User Interface as far as I know. You would have to remove the block in a little extension. This is a small job but does require development skills.
> 2 votes

---
Tags: civicontribute
---


title: Embed PCP thermometers

text:
# Question
Title: Embed PCP thermometers
I was wondering if it is possible to embed the thermometer from an individual personal campaign page to another site. I am guessing it is, but don't know where the best place to look for the code is: anyone know?

# Answer
> 1 votes
Perhaps you could start with the widget code from a contribution page as a base?(Widget\>widget.php)

Make a new one that pulls info based on PCP id vs contribution page id...

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


# Question
Title: Can you propagate custom data in New Activity?
Is there a way to propagate the "With Contacts" address and phone number into the activities assignee's copy email?

# Answer
If I'm reading the code correctly, it sends the slightly misnamed "Cases - Send Copy of an Activity" template, found under **Mailings menu \> Message Templates**, "System Workflow Messages" tab.

If you add a Smarty debug tab, like this: `{debug}` to the top of the template, you should be able to send yourself a message and see a list of all available variables, which you can add as Smarty tags. If what you're looking for isn't there (I suspect it's not), you can add it. The core code is here: `CRM/Activity/Form/Activity.php`. You'd be better off using an extension that adds them as part of hook\_buildForm though.
> 1 votes

---
Tags: activities
---


# Question
Title: Redirect with a QUERYSTRING help - migrating site
I'm moving our civi from Joomla to Wordpress and as a part of the process I wanted to set up some redirects for our existing PCP pages. As you all know civi URLs are kind of long: baseurl.com/sub\_dir/index.php/component/civicrm/?task=civicrm/pcp/info&reset=1&id=XX

I've found several posts explaining query string redirects like this one (http://simonecarletti.com/blog/2009/01/apache-query-string-redirects/) but in all of them their variable is right after the "?". I have tried the following to no avail:

```
RewriteEngine on
RewriteCond %{QUERY_STRING} task=civicrm/pcp/info&reset=1&id=20$
RewriteRule ^sub_dir/index\.php/component/civicrm/$ /path-to-new-location/? [L,R=301]

```

Eventually, I do want to write it with variables (as we have several hundred PCPs but I wanted to get something working first.) Any help is greatly appreciated!!!

# Answer
Apparently my above code was correct, save for I was putting it in our main directory's htaccess file. Once placed in the subdirectory's file (and "sub\_dir" removed) all is right!
> 1 votes

# Answer
I'm not a Joomla person, but Drupal has a "URL Aliases" module that lets you do redirects from within Drupal. It looks like Joomla has something similar.
> 0 votes

---
Tags: pcp, urls
---


# Question
Title: How do I add a new table to my extension?
I have added tables to my database by writing SQL commands in a sql folder as specified in the given link. Add a database upgrader / Installer / uninstaller.

What I am exactly looking for is a method to access these tables, do I need to write direct SQL for adding records to the table or I should create corresponding DAO and BAO to access the table.

How to create DAO and BAO for a given table in an extension?

# Answer
What I did for the sepa extension is a bit of a hack, but worked ok:

write the xml schema files, as you have them on the (development version) core and run xml/phpGencode.php to generate the dao, that you then copy into the extension folders and voila, you got the tables ready to use (for a few more lines, you got the api files, worthwhile IMO)

The process is now detailed in our developer book
> 5 votes

# Answer
What you're looking for is `civix generate:entity`. It's marked as "EXPERIMENTAL AND INCOMPLETE" on my copy of civix - though my version might be old. Either way, it should point you in the right direction.

UPDATE: While you should still run `civix generate:entity`, at the time of this writing, it will create a BAO but NOT a DAO file for you. Use Xavier's technique (the accepted answer).
> 2 votes

# Answer
Alternatively, I tend to create the file in sql and then create a DAO in my extension with the few functions that are required. Check https://github.com/CiviCooP/no.maf.oppgavexml/blob/master/CRM/Oppgavexml/DAO/Oppgave.php for an example of a DAO I have copied and pasted into my extension for a table I created in the Upgrade class using

```
$this->executeSqlFile('sql/create_civicrm_oppgave.sql');

```
> 1 votes

---
Tags: custom-fields, database, gsoc
---


title: Event Error - no price set found!

text:
# Question
Title: Event Error - no price set found!
In the middle of entering registrants for an event and suddenly:

**No active price fields found for this event!**

This follows an update to 4.6.3 which has coughed up some DB errors. But up until this morning the event worked fine!

I have already tried flushing the cache to no avail. Any suggestions?

# Answer
**Doh!**

The end date for the Price Set was set to today.
> 2 votes

---
Tags: civievent
---


# Question
Title: I don't have batch entry of contributions - why?
I don't seem to have the "batch entry" feature in our Civi database. When I go to the Contributions drop down where it should appear, it's not there. Does this mean I'm running a downlevel version of Civi and if so, how do I find out what version I have? Thank you.

# Answer
you can find the version of CiviCRM at the bottom of any CiviCRM page

it will say Powered by **CiviCRM 4.6.5.** CiviCRM is openly available under the GNU AGPL License.

Please try to install the latest version of Civicrm which has the feature
> 1 votes

---
Tags: contributions
---


title: Picture size: larger than screen

text:
# Question
Title: Picture size: larger than screen
A contact has a custom file field named : Passport copy Context : I add a picture (jpg file) in this file "passport copy" . And I save the contact. Then when I click on the file, a pop up is opened with the passport copy This is good. But if the jpg is a wide file, the pop up is all over the page and I can't resize it. The picture is larger than my screen... So I would like to specify a size for this pop up like 250px/250px. But I don't know how

Is it clearer ? Regards, hashkey

# Answer
I wasn't able to reproduce the problem of the popup going off the screen for images that are too wide, but I did find that the popup's titlebar got hidden behind the menu if the image was too tall.

I've opened this pull-request to make things work a bit better in that situation.
> 1 votes

---
Tags: contacts
---


# Question
Title: How to add Each Contact Membership fee using webform civicrm in drupal7
I have 2 contacts(Contact1 & contact2) in webform, I Want each contact get membership fee.(like In civicrm while creating new membership with Record payment Registration, it will create membership fee.) Trail: for this problem i created contribution page of financial type is "membership fee" in civicrm. this page is selcted in webform contribution tab, after submitting form it showing membership fee added only in contact1 not added in contact2,3,4.., so i want to add membership fee in each contact.

# Answer
The first problem I see in your screenshot is that you've set up Contact 1 as an organization. Really, contact 1 needs to represent the person who is filling out the webform and paying for the membership. An organization, generally, cannot operate a keyboard & mouse. Fix that and the rest ought to make more sense.
> 1 votes

---
Tags: civicontribute, civimember, webform-civicrm
---


# Question
Title: Multiple Choice Custom Field Not saved on creation of new contribution
I am running CiviCRM 4.4.4 on WP 3.6.1

This is a problem with entering new contributions.

I have a custom field tied to a multiple choice menu. The same menu is used for 4 different custom fields, one of which is required.

If you do not fill in the required field an error is generated upon submit.

If you select one of the options, and submit a valid contribution, then immediately view the contribution, the fields tied to this menu are empty. (including the required one)

The final piece to the puzzle. If I go back in and edit the contribution and re-enter the data, the second time it sticks.

What could be causing something like this?

# Answer
> 1 votes
Could you try to reproduce this bug on the 4.4 Demo Site by creating a similar custom field/contribution setup? If it's a bug there then you could report it to the LTS team (although noncritical bug fixes for older versions don't get high priority).

You could also try to reproduce it on the 4.6 Demp Site which would be a good idea for 2 reasons:

1. If it is still a bug in 4.6 it will get more attention.
2. If it is not still a bug in 4.6 you could solve your problem by upgrading :)

# Answer
> 1 votes
This is a bug in LTS. I upgraded to 4.4.16 on the latest version of WP (4.2.2). It is easy to reproduce. Create a custom field set for Contributions, create a custom field (multiple-choice,autocomplete) create a few choices, make it required. I made it searchable to match my application. Enter a new contribution, view it, not there.

I then upgraded again to 4.6.4. used the same test. This time the data is preserved. This is not a minor bug in LTS from my perspective, because you don't make a field required unless that data is important. So for this particular field we have huge gaping holes in our data.

In case anyone is having a similar problem in 4.4.16, it is fixed in 4.6.4.

---
Tags: custom-fields
---


# Question
Title: Which email address should the printed Case Report present for the Case Manager in the Role Section of the Report?
The Case Report presented when the Print Report link is selected does not present the primary email for the Case Manager when the Case Manager has more than one email. Should it present the primary email as it does in the Client Relationships Section of the report or is there a reason it presents a different email?

# Answer
> 1 votes
This sounds like a bug. If you look in CRM/Case/BAO/Case.php in getCaseRoles() it has this in the SQL:

LEFT JOIN civicrm\_email ON (civicrm\_email.contact\_id = civicrm\_contact.id )

If you change it to

LEFT JOIN civicrm\_email ON (civicrm\_email.contact\_id = civicrm\_contact.id AND civicrm\_email.is\_primary = 1)

does that fix it?

---
Tags: civicase
---


# Question
Title: How to print variable/debug data from your extension.php?
I am trying to add a menu entry in the navigation, but this is causing the navigation menu to disappear, I am trying to debug the code but could not find any particular file.

I have checked the following:

* Browser's Javascript Console
* CiviCRM logs from ConfigAndLog folder
* Apache2 log

Is there anything else I should check? Is there any way I can print the data in the `extension_civicrm_navigationMenu(&$params)` function?

# Answer
> 8 votes
(**Update**) As of v4.7.0, the approaches below still work, but there's a better way to write to the log file using a PSR-3 logger, e.g.:

```
Civi::log()->info('Hello, log!');
Civi::log()->error('I'm sorry, {name}. I'm afraid I can't do that.', array(
  'name' => 'Stanley Kubrick',
));

```

See also: https://civicrm.org/blog/totten/the-static-is-dead-long-live-the-static

---

To write out to CiviCRM's `ConfigAndLog` folder, one can use either:

```
CRM_Core_Error::debug_log_message('hello log');
CRM_Core_Error::debug_var('name', $var);

```

There's also an experimental PSR-3 logger (`CRM_Utils_SystemLogger`) which writes out to the database (table `civicrm_system_log`), e.g.

```
$log = new CRM_Utils_SystemLogger();
$log->info("hello log");
$log->error("I'm sorry, {name}. I'm afraid I can't do that.", array(
  'name' => 'Stanley Kubrick',
));

```

If the debug statement is temporary (won't be committed/redistributed), then you can usually use CMS-specific functions (like Drupal devel's `dpm()` or Joomla's `JLog`).

---
Tags: extension, developer, gsoc, debugging
---


# Question
Title: Webform: Only Open Case if Condition is True
I am just starting to learn the Webform integration with CiviCRM. I know that I am able to open a case via the webform module. However, I *only* want to open a case if a condition is met.

For example, when the status field is equal to "Accepted", I like for the case information to show. Currently, I tried adding all the case information and tried leaving it blank, but it produces an error "Sorry but we are not able to provide this at the moment" as a result of missing information (I believe). Have anyone accomplished something similar to this?

# Answer
> 2 votes
You can achieve this by:

1. Ensure you are using the latest version of webform\_civicrm
2. (CiviCRM tab) Set the Case Type field to "user select"
3. (Webform tab) Edit the Case Type webform component, and change the widget type to "hidden". Set it's value to the case type of your choosing.
4. (Webform tab - Conditionals) Add a conditional rule to show/hide the Case Type element based on the value of another field of your choosing (it's a hidden field already, you say, what's the point of hiding it? Either way it won't appear to the user, but this conditional rule will prevent the case from being created if your condition is not met).

---
Tags: webform-civicrm, civicase
---


# Question
Title: How can we install civicrm extension which is not available for drupal
I want to add civi hr extension to drupal. But is not available in drupal.

# Answer
You need to first get into the extension directory, and download the extension directly. Then you can install the extension from Manage Extension Page.

```
wget https://github.com/civicrm/civihr/archive/1.3.0.zip
unzip 1.3.0.zip
mv civihr-1.3.0 civihr

```

You can now move to `Administer>System Settings>Manage Extensions` Install CiviHR and you are good to go.

This link can help you further.
> 5 votes

---
Tags: civicrm-home
---


# Question
Title: CiviCRM_API3_Exception: "DB Error: no such field" When Editing CiviMail
When I try to continue editing a CiviMail email we get the following error after upgrading to 4.6.4 from 4.5.5.

```
CiviCRM_API3_Exception: "DB Error: no such field"
#0 /home/sitename/public_html/sites/all/modules/civicrm/CRM/Mailing/Info.php(111): civicrm_api3("Mailing", "get", (Array:5))
#1 /home/sitename/public_html/sites/all/modules/civicrm/Civi/Angular/Manager.php(130): CRM_Mailing_Info->getAngularModules()
#2 /home/sitename/public_html/sites/all/modules/civicrm/Civi/Angular/Page/Main.php(66): Civi\Angular\Manager->getModules()
#3 /home/sitename/public_html/sites/all/modules/civicrm/Civi/Angular/Page/Main.php(58): Civi\Angular\Page\Main->registerResources()
#4 /home/ccsdfoundation/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): Civi\Angular\Page\Main->run((Array:2), NULL)
#5 /home/sitename/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:12))
#6 /home/sitename/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:2))
#7 /home/sitename/public_html/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:2))
#8 [internal function](): civicrm_invoke("a")
#9 /home/sitename/public_html/includes/menu.inc(519): call_user_func_array("civicrm_invoke", (Array:1))
#10 /home/sitename/public_html/index.php(21): menu_execute_active_handler()
#11 {main}

```

# Answer
*No such field* errors after an upgrade are most commonly caused by not having run the DB upgrader.

* For Drupal, visit `?q=civicrm/upgrade&reset=1` or `civicrm/upgrade?reset=1`
* For WordPress, visit `wp-admin/admin.php?page=CiviCRM&q=civicrm/upgrade&reset=1`
* For Joomla, visit `/administrator/index.php?option=com_civicrm&task=civicrm/upgrade&reset=1`

For full upgrade advice and various troubleshooting tips, refer to the upgrade documentation page for your CMS.
> 1 votes

# Answer
I was able to use the GitHub project at github.com/progressivetech/civi-schema-harmonizer with some tinkering to make it work. I documented my tinkering in the issues for the git project.
> 1 votes

---
Tags: civimail
---


# Question
Title: Remove Individual's eMail as default when sending eMails
Sending ( not mass-sending ) of eMails: the eMail address of th actual user is put to the send-from field. Alternativley the organizations eMail address can ( and has to be selected manually - this is error-prone ) Question: how can I make only our orgaizations eMail address to be displayed - or at least show this as default instead of the acual user's one?

best regards, Markus

# Answer
> 2 votes
This isn't an option that CiviCRM provides out of the box. If you have some jQuery skills or some PHP skills, it would only be a few lines of code to do what you're describing by writing an extension. If you don't have those skills, you may want to consider hiring someone who does, either a third party or the core team.

---
Tags: email, default-settings
---


# Question
Title: CiviMail - when Track Click Throughs is enabled, links result in a white screen with warnings
We are creating a mailing and trying to track click-throughs. When 'Track Click-Throughs' is enabled, clicking on any of the links results in a URL like this: https://mysite.org/sites/all/modules/contrib/civicrm/extern/url.php?u=55&qid=2261 and does not go to the link itself. This is what shows on screen:

> Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date\_default\_timezone\_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /mysite.org/sites/all/modules/contrib/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php on line 92
>
> Warning: Cannot modify header information - headers already sent by (output started at /mysite.org/sites/all/modules/contrib/civicrm/CRM/Mailing/Event/BAO/TrackableURLOpen.php:92) in /mysite.org/sites/all/modules/contrib/civicrm/CRM/Utils/System.php on line 423

If I do not enable Trackable Click Throughs, then the links work. It appears to be two different issues, but I'm not sure how to resolve either, and if fixing one will take care of the other.

I'm on Drupal 7.38 and Civi 4.5.8.

I've doubled checked civicrm.settings.php (per CiviMail Tracked URLs) and my BaseURL is

> define( 'CIVICRM\_UF\_BASEURL' , 'https://mysite.org/' );

I've looked at the links in civicrm\_mailing\_trackable\_url in my database and at the permissions of civicrm/extern/url.php (per Why do track click through). The links look correct and the permissions of url.php are 644.

Any help or direction on either of the warnings is greatly appreciated!

# Answer
> 4 votes
I had this problem crop up when my web host upgraded their version of PHP and the new site-wide php.ini that they installed did not have the timezone set correctly.

You can correct this in the .htaccess file that is located at the root of your web site. In that file, put these lines:

`<IfModule mod_php5.c>
php_value date.timezone "America/New_York"
</IfModule>`

Your .htaccess file might already have an `<IfModule mod_php5.c>` block, in which case you can just put the `php_value date.timezone "America/New_York"` line in that existing block.

And of course, if you aren't in the eastern time zone, pick the time zone that is appropriate for you.

Hope this helps - it resolved everything for me.

Richard

# Answer
> 5 votes
Richard's answer is correct. While this seems unrelated, look at this answer for an explanation of what's happening here, except instead of a PDF header, it's redirect code. You're getting an unrelated warning, and you can't send a warning and then send a redirect header. In fact, I'm guessing that you can't currently generate PDFs right now either. Fixing the "unrelated" warning will fix this problem, and the problem is that your webhost hasn't defined a timezone for PHP.

Note that Richard's answer is only one way to set a PHP setting, and doesn't work if your webhost disallows it. I would take up with your webhost the best way to resolve this. Another way that works in almost any environment is to use an ini\_set command anywhere in your civicrm.settings.php file.

---
Tags: civimail
---


title: Use activity or event?

text:
# Question
Title: Use activity or event?
my organization would like to let users (anon and auth) be able to submit a request for a workshop via a drupal webform which would then be approved or denied based on various criteria by management.

Would it be better to have the webform submission trigger civi to record a new event, or activity (i.e. email response) from an admin?

# Answer
A drupal webform cannot create an event (it can register a person for an existing event tho... is that what you meant?). It can create an activity, which, even if you don't use it as part of your approval workflow, might be useful just to record the fact that the person submitted a proposal.

It's hard to say what you "should" do because you haven't described exactly what your end goal is. Is a workshop ultimately going to be a CiviCRM event, with participants registering, etc? Or something else? I'm not sure that you necessarily need to be creating *anything* in Civi for your purpose. Maybe all you need is the webform submission. Or activities might work well for you if you create a few extra activity statuses like "Proposed" "Approved" and "Rejected". Or if you wanted to get really detailed in your record keeping, you could have the webform open a case, which would let you record all your back-and-forth (as activities) and the details of exactly when and why the session was approved or rejected.

Seems like the bottom line is that you'll end up creating the actual sessions by hand (as Civi events or whatever else) so that's not really part of the equation here, so you should just do whatever works well for you to record the proposals and manage the acceptances.
> 2 votes

# Answer
Both could work, but it seems closer to the "normal" civi workflow to create an event. If you haven't enabled it already, you should try enabling the satus "awaiting approval", that is linked to an approval workflow that seems to be what you want to use at our org

http://book.civicrm.org/user/current/events/setup/
> 0 votes

---
Tags: webform-civicrm
---


# Question
Title: Reverse sync CiviCRM groups to Drupal organic groups
We have a client who would like to sync their CiviCRM groups to Drupal organic groups.

This is opposite to the CiviCRM Organic Groups module which syncs organic groups TO CiviCRM groups.

Their are some oldish posts on the CiviCRM forum but I can't see anything recent (e.g. http://forum.civicrm.org/index.php/topic,14212.0.html). Any help would be appreciated.

Oliver

# Answer
We use civicrm\_entity module + rules to do things like that. This blog gives a recipe for relationship to OG.

There are a couple of general civicrm+rule blogs

http://www.jackrabbithanna.com/articles/simple-rule-example-using-civicrm-entity

http://www.fuzion.co.nz/blogs/complex-civicrm-relationship-role-synchronisation-recipe

But neither are specifically to OG - I think there is one somewhere though - or else maybe an og rules feature - if I find it I'll paste it in
> 2 votes

---
Tags: groups
---


title: Credit Card Verification Number Fails

text:
# Question
Title: Credit Card Verification Number Fails
Running CiviCRM 4.6.3 with Drupal 7.38. In CiviEvent I am not able to get any 3 digit card verification number to pass the test payment processor in Test-drive or Live. Using 4111 1111 1111 1111 as the test card number. Continue to receive "Please enter a valid Card Verification Number".

# Answer
Bert, based on the error message you report, I think your validation failure is in the three digit **card verification number** (CVV), not the card number (PAN). Normally I use 111 as CVV for the 4111 test card.
> 2 votes

# Answer
And the answer is... It appears the bone head admin forgot to enable any credit cards (Visa, MasterCard, etc). Once the credit cards where enabled card verification (CVV) worked as advertised. Thanks everyone! -Bert (Site Admin)
> 2 votes

# Answer
If the issue really is with the PAN, try that same test card number but without the spaces, and let us know if that works?

The payment forms *ought to* handle stripping those out in `civicrm_billingblock_creditcard_helper()`, but it's possible they don't, or they don't specifically for Stripe (eg if the Stripe processor intercepts the form submit clientside before the aforementioned function has completed).

CiviCRM uses (at least) clientside JS to strip spaces out; if that JS doesn't fire for some reason (perhaps local JS issues, or Stripe gets there first) AND CiviCRM doesn't handle it serverside, then you *might* see behaviour like that with the PAN.

I would expect Stripe's API to cope fine with spaces. Are you seeing the validation error within CiviCRM?
> 1 votes

---
Tags: civievent
---


# Question
Title: Linking events participants and contributions
We are currently batch importing data from our previous homemade event management system.

So far, we've managed to import contaributions and event's registrations for each user but we are stucked in the process of matching those contributions (event fees) with each event and updating the registration (paid status).

How could we proceed ?

We are running CiviCRM 4.6.2 on WP 4.2

# Answer
you have a create participant record in civicrm\_participant table which will have the Event Id in the table, participant and contribution should be linked using civicrm\_participant\_payment which will have contribution\_id and participant\_id. This is how you have to do

One more suggestion: before doing anything data import install a fresh copy of civicrm and delete all the relevant table records and make a test process by creating Event and registering the event for an member and look which are the tables been affect and please update the values based on the test
> 2 votes

---
Tags: civicontribute, civievent
---


# Question
Title: Can I manually add an "Email" activity in the GUI without sending it?
To keep track of communications with contacts, CiviCRM has *Activities* e.g. documenting e-mail conversations. In the `Activities` tab of a contact I can create these from the `New activity` dropdown.

This provides the option `Send an Email`. However, using that I can only make CiviCRM actually send out an email to the contact. We usually send emails from a normal mail client instead.

What I am looking for is a possibility to add an `Email` activity to a contact without actually sending out a mail. (To document an email that has already been sent from outside CiviCRM)

Currently we use a workaround: A custom activity type *documented Email*. But it would avoid confusion, if all mail would be of the same activity type *Email* regardless of how it was send out.

Is there a way for this in Civi or an extension?

# Answer
Have you checked the inbound email processor script. You can forward and/or cc a mailbox, and civi can read from the mailbox and attach it to the relevant contacts.

Details are here:

http://wiki.civicrm.org/confluence/display/CRMDOC/Autofiling+email+activities+via+EmailProcessor
> 2 votes

# Answer
We brought templates/CRM/Activity/Form/ActivityLinks.tpl into the custom templates folder and added some jQuery to it to *hide* certain custom activity types of our own making from being manually created by staff. If you're going for the code route, that and its corresponding PHP class is probably a good place to look.

Alternatively, compare the URL for writing an email:

```
https://ffnew/civicrm/activity/email/add?action=add&reset=1&cid=90948&selectedChild=activity&atype=3

```

and for adding a different activity type:

```
https://ffnew/civicrm/activity/add?action=add&reset=1&cid=90948&selectedChild=activity&atype=64

```

Start by clicking 'Send an Email', then take the 'email/' out of the URL. Does that give you what you wanted?
> 2 votes

# Answer
One option if you are using Drupal as your CMS is to set up a webform for creating email activities. The webform can create the activity for you without sending the email.
> 0 votes

# Answer
You can change the System Setting (menu Administer/System Setting/Outbound Email) to 'redirect to database' you can create an Email activity but it will not be sent.
> -1 votes

---
Tags: email, activities
---


# Question
Title: If "!empty" on custom note field in Drupal Views, Global PHP field
I am using a global php field in drupal views to display a list of names. If the contact record has extra info in a custom note (rich text editor) field, I want to display "name, info". If there is no extra info, I just want to display "name". This is what I am using as the output code of the global php field:

```
<?php
if (!empty($row->id_info_for_display_33)) {
    print $row->display_name . ", " . $row->id_info_for_display_33;
}
else {
    print $row->display_name;
}
?>

```

It seems that the custom field is never really empty unless it is a record that was created before the custom field was added. Even then, if I then edit that record, the custom field is no longer empty and the display ends up as "name,".

Any ideas on what logic will accomplish this?

Civi 4.6.2

Drupal 7.38

Views 7-3.11

Thanks!

# Answer
> 3 votes
Looks like the CiviCRM is adding a space '` `' (may be because of CKEditor) into the custom table column , even though you leave it empty when adding/editing the record.

You can see it if you do var\_dump of the variable. See below screenshot

So the below logic should work in this case.

```
<?php
if ($row->id_info_for_display_33 !== ' '  && !empty($row->id_info_for_display_33)) {
    print $row->display_name . ", " . $row->id_info_for_display_33;
}
else {
    print $row->display_name;
}
?>

```

Give it a try.

---
Tags: drupal-views
---


title: Wordpress Starter Kit

text:
# Question
Title: Wordpress Starter Kit
I'm familiar with Drupal / Drush / Civicrm Starter Kit but is there a Starter Kit or sample theme for Wordpress? I've used WP-CLI and stumbled on civicrm wp-cli but basically looking for a quick start to customize...

# Answer
Try just using the regular installation process--it should be simple enough. You won't find or want to work with a different theme for the backend of CiviCRM, and on the front, you should find that CiviCRM works well in most cases.

Now in 4.6, CiviCRM will set up a base page for you, so it's one step easier, too.
> 1 votes

---
Tags: wordpress, installation
---


# Question
Title: Membership Report (Detail) not showing organizational members
I am using CiviCRM 4.6.2 under Drupal 7. When I run the "Membership Report (Detail)" report, it does not include the organizational members (by relationship). I can't seem to figure out how to include them in the report. Thanks for any help.

# Answer
> 1 votes
This may be because the details report has a default filter that limits results to those with a contribution status of completed. Because memberships by relationship do not have a contribution, they would be excluded. You can click on the Filters tab within the report, and then deleted the Completed value from Contribution status...then re-run the report.

An alternative is to use Find Memberships (directly under the Memberships top level menu), instead of the details report. That gives you the option to select Primary Members (select Yes), Related Members (select No), or both (do not select anything.)

---
Tags: civimember, civireport
---


# Question
Title: Import from CSV and dedupe using Email (match to contact) with PRIMARY email?
Is there a way to use "Email (match to contact)" field mapping against the *Primary* email address? Or are we forced to use a location type?

# Answer
> 2 votes
In my testing, for the deduping, it actual matches against any email address no matter what the location type is. The location type you select for email is for new contacts and what location type their email address will be imported into.

---
Tags: import, location-type
---


# Question
Title: How to send email from CiviCRM and Wordpress
I am trying to send an email from CiviCRM and Wordpress. The test mailings work, but the scheduled mailings never go beyond being scheduled. I done some research online and I think I have to setup a cron job...I'm not exactly sure.

Can someone please show me how to configure the settings, or direct me to a link that will help me in this matter.

Thanks in advance.

# Answer
> 3 votes
Look at the wiki book CiviCRM user and administrator guide for setting up scheduled jobs and cron jobs.

http://book.civicrm.org/user/current/initial-set-up/scheduled-jobs/

---
Tags: wordpress, email, cron-job, php
---


title: Country list in profiles only shows US

text:
# Question
Title: Country list in profiles only shows US
We recently suffered a DoS attack which forced us to recreate our site from a fresh latest Drupal installation, install DoS protection and move the site back to its original location. We did not upgrade CiviCRM (currently using 4.6.0).

The site is back on line and working fairly well, but now only "United States" shows in profiles and contact edit forms. The table civicrm\_country looks ok, with all countries correctly listed. Any ideas?

Thanks

Miguel Peirano

# Answer
> 5 votes
It is fixed. It was as simple as returning to Admin \> Localization and re-enabling the country list. Sorry about asking before thinking :-)

Miguel

---
Tags: drupal, profile
---


# Question
Title: Migration to new server - "The requested page "/" could not be found."
In following the procedure outlined in the Wiki I find that in Step 10 ("log into drupal") I'm seeing the message `Page not found The requested page "/" could not be found.` The drupal menu is not there. The login form is there, and once I log in I get the 404 message `The requested URL /civicrm was not found on this server.`

```
error_log:  File does not exist: /var/www/html/civicrm,

```

When I try drush:

```
drush up --debug  --uri htp://mycivi.site.org
Starting Drush preflight. [0.03 sec, 4.12 MB]                                                                                [preflight]
Cache HIT cid: 7.0.0-commandfiles-0-81cc86c1995ab7206f383ec28ad43baf [0.05 sec, 4.21 MB]                                                                                [debug]
Bootstrap to phase 0. [0.2 sec, 10.22 MB]                                                                                [bootstrap]
Bootstrap to phase 6. [0.2 sec, 10.22 MB]                                                                                [bootstrap]
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [0.2 sec, 10.22 MB]                                                                              [error]
The drush command 'up htp://mycivi.site.org' could not be executed. [0.2 sec, 10.23 MB]                                                                                [error]

```

I'm guessing the drupal restore from the source server did something to the drupal database on the target server that changed a path.

Source server drupal path = `/var/www/vhosts/contacts/httpdocs`

Target server drupal path = `/var/www/html`

Do these paths have to be identical for a migration to work? Or is there something else I'm doing wrong?

# Answer
> 4 votes
Make sure you have migrated Drupal correctly and all of the non-CiviCRM portions of the site function correctly.

* Sometimes the `.htaccess` file doesn't get transferred with FTP and it is an important file.
* Also, migrate the same filesystem/version from one server to the other, and be sure to upgrade as needed to keep things secure (either before or after the migration).

At that point if Drupal is working correctly you can focus on CiviCRM.

# Answer
> 3 votes
If your site has been migrated to a different version of the Drupal codebase, then make sure you've run the database updates (`drush updb` or visit `update.php`)

This will update your Drupal DB to match the new codebase, and clear lots of caches etc as well.

---
Tags: drupal, webserver, migration
---


title: Unable to send mass SMS or Mailing

text:
# Question
Title: Unable to send mass SMS or Mailing
I'm trying to setup Mass SMS and Mailing and seem to be running into some problems. I can send mail and SMS directly to an individual but the scheduled SMS and mail does not work. I know this has to do with Cron being configured incorrectly but I'm not sure where to look. I have CiviCRM 4.6.3 installed on Drupal 7.37. I also have installed the Drupal Cron module from here.

When the job is manually executed I get a success message. Where are some other places I should be checking?

# Answer
Is there a reason you're using the "CiviCRM Cron" module? That's adding an needless level of complexity to your site. Since you are able to get the job to work by manually executing the job, I suspect that there's a problem in the way you've configured the "CiviCRM Cron" module.

Disable the module, and set up cron the normal way. You'll want CiviCRM's cron job to run way more often (every 5-15 minutes) than Drupal's cron should (every 1-3 hours). Doing a real cron job will also bypass problems that may crop up with the "CiviCRM Cron" Drupal module.

Here's how. Visit the Managing Scheduled Jobs page on the CiviCRM wiki for reference.

**If you have Drush installed**, just use the "Drush Method" from that page. Test it out on the command line, and if that works, set the cron job to be something like

```
*/6 * * * * /usr/bin/drush -u 1 -r /path/to/drupal -l www.example.org civicrm-api job.execute auth=0 -y

```

That runs every 6 minutes, which makes a nice even 10 runs per hour.

**If you don't have Drush,** use the following steps (the "PHP CLI method"):

1. Create a user account that has "Access CiviCRM" and "Administer CiviCRM" privileges. (You could theoretically use your own, but you will be putting the password in plain text in the cron job, so it's safer to create a separate one.)
2. Put together what you need in this format:

`php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute`

You can drop the "-s site" if you only have one site running. Replace the word "user" with your new user's Drupal username, and the word "password" with its password.
3. If you have SSH access and are comfortable with the command line, you'll have a leg up. Try running that command. Check your Scheduled Jobs page to see that it ran (making sure that your mailing sender job is enabled and set to run on every cron run--not hourly or daily).
4. Assuming that worked, set up the cron job

`*/6 * * * * php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute`

Again, I like six minutes to make the arithmetic easy by having 10 cron runs per hour.

This should dodge any problems with the "CiviCRM Cron" module, and it should allow you to run your mailings and SMS messages much more promptly.

For reference, "send immediately" *does* depend upon cron to run. It actually isn't literally immediate--it just schedules it for the current time, and cron takes it from there.
> 1 votes

---
Tags: cron-job
---


# Question
Title: CiviEvent Cannot Find Event/Register Page
CiviCRM 4.6.3 and Drupal 7.38. I have gotten past credit card and CVV checks, verified info on Confirmation page, submitted the event registration, but browser comes back with "Page Not Found - The requested page '/civicrm/event/register' could not be found." When I check the CiviEvent Dashboard I see that the individual and any guest have been properly registered. CiviEvent is just not finding/displaying the Thank You page. That address seems strange. As a test I set up a CiviContribution page and ran through a contribution without a hitch. So I don't understand what is happening with CiviEvent. Ideas?

# Answer
> 1 votes
please try to update civicrm to latest version - I did made a quick test and it works correctly displaying the Thank you page

Even after updating, if you are getting the error message then please let me know the payment process which you are using so i will give a quick test

---
Tags: civievent, drupal, registration
---


# Question
Title: Creating a custom (select) field and update option values from php
I use Wordpress with CiviCRM. I would like to create a custom select field and populate the option values with php. After investigating the forum and the documentation I think I should create a hook (or a plugin in wordpress) for that, but not sure.

Could somebody show me a working example or direct me where to continue?

# Answer
> 1 votes
The hook you are looking for is hook\_civicrm\_customFieldOptions. Example from the docs:

```
function civitest_civicrm_customFieldOptions($fieldID, &$options, $detailedFormat = false ) {
    if ( $fieldID == 1 || $fieldID == 2 ) {
        if ( $detailedFormat ) {
            $options['fake_id_1'] = array( 'id'    => 'fake_id_1',
                                           'value' => 'XXX',
                                           'label' => 'XXX' );
            $options['fake_id_2'] = array( 'id'    => 'fake_id_2',
                                           'value' => 'YYY',
                                           'label' => 'YYY' );
        } else {
            $options['XXX'] = 'XXX';
            $options['YYY'] = 'YYY';
        }
    }
}

```

---
Tags: wordpress, php
---


# Question
Title: Pay later for Membership - How does the membership get entered?
Civi v4.6.2 When entering a membership via the online contribution and using the Pay Later option I notice the membership does not get created. Does an admin type person have to manually enter the membership?

# Answer
The membership is created when the payment is (manually) entered.
> 2 votes

# Answer
The Membership record is created at the outset along with the Contribution record, but is set to Pending/Inactive. You should be able to replicate this with the following steps on Demo.

http://d46.demo.civicrm.org/civicrm/admin/contribute/amount?reset=1&action=update&id=2 and tick Pay Later (and add Pay Later instructions) so it is an option on the form.

Go to this contribution form logged out. http://d46.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=2 and enter email and set to 'pay by cheque'. Complete process. Logged in again find your contact that was just created (in my case http://d46.demo.civicrm.org/civicrm/contact/view?reset=1&cid=230) Note that Membership tab says '0' and Contribution tab says '1' BUT click on Membership Tab and you will see the PENDING membership that is connected to the Contribution that is 'pending pay later'.

WHen money is received can then either complete the Contribution via the Contribution record, or via the Membership record (which opens up the Contribution record internally so to speak).

Once the Contribution is COMPLETED, the Pending Membership is then changed to Status = NEW, and Start/End date are created.

Hope that helps

NOTE: both Find Member and Member Dashboard do not show this pending membership at the top of the recent lists as they are sorted by date, and the pending membership has no date until payment is completed.
> 2 votes

# Answer
Find the relevant contact record, edit the contribution that was created by the Pay Later option, and mark the Contribution status as Completed. The membership will then be created.
> 1 votes

---
Tags: civimember
---


# Question
Title: I have installed and unzipped Civi in WordPress plugins directory, CiviCRM installer page is blank?
I have installed and unzipped Civi in wordpress/wp-content/plugins directory via these directions:

http://wiki.civicrm.org/confluence/display/CRMDOC/WordPress+Installation+Guide+for+CiviCRM+4.5.

When I get to step 5, however, and visit the Civi Install page on settings - CiviCRM installer, the page content is blank.

Also, there is nothing in the error logs.

Any thoughts on what could be going wrong?

Thank you!

AK

# Answer
> 1 votes
If you haven't already done so, login to your WordPress site with Administrator level permissions.

In Admin, Go to plugins section and activate the CiviCRM plug-in. After that, open a new browser window and enter and run the following URL "http:///wp-admin/options-general.php?page=civicrm-install

You should then see the Installer screen where you can follow the given instructions. Hope that helps.

# Answer
> 0 votes
I am no expert, but I would check what version of PHP your server is running. CiviCRM recommends PHP 5.4+. More here: http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+PHP+Requirements

---
Tags: wordpress, installation
---


# Question
Title: API call setvalue for is_primary does not make other values 'not primary'
When using the CiviCRM API to make a field primary, other fields in the set do not have the 'is\_primary' flag removed. This results in multiple 'primary' fields.

Eg: Address A is primary. The setvalue API call is used to set is\_primary on Address B. Now addresses A and B both have 'is\_primary'.

Is this the desired behaviour?

I can see that setvalue is intended to be quite a low level function, so you might not expect it to unset is\_primary on other fields in the set. But if this is the desired behaviour we should probably document it.

# Answer
> 3 votes
There are lots of problems with the setvalue api. This is a good example of why everyone should stop using it.

The plan is to deprecate setvalue soon and remove it in a future version. See https://issues.civicrm.org/jira/browse/CRM-16643

---
Tags: api, addresses
---


# Question
Title: User access to own contact record, forwarding upon login
Is there a document that describes how best to setup the security in CiviCRM on WordPress so that a user can login and access their own record? I have read much of the documentation that is in the forum and in the help but nothing that seems consistently in one place from step to step.

The part that seems to be missing is how to forward the person logging in to their own record, rather than to a page where they have to search or find their record. I'm not a programmer so I am assuming this must require some code that I can't find reference to. Any links anyone can share?

# Answer
When a user is logged in their information is auto populated in profile forms. So when they go to event registrations, donation pages, etc. their info is listed in the profile fields. If they make changes this information is updated in CiviCRM.

You can create a profile for editing and insert it into a WordPress page via a short code with the edit option and direct the user there after login. You may want to restrict access to that page to logged in users. The 'Members' plugin in WordPress does a good job of restricting access by user role.
> 5 votes

# Answer
I think what you are mainly interested in is having people sent to their User Dashboard on login. This is something that needs to be done in WordPress by one of a variety of plugins. As it is not a CiviCRM functionality, and there are many ways to do it in WordPress, no one has bothered to create a CiviCRM recipe for doing it.

Step 1: Create the CiviCRM User Dashboard

Create a User Dashboard in WordPress by creating a new post, clicking on the CiviCRM icon, then selecting User Dashboard, Insert Form, then Publish. This creates a page that will have the same URL for everyone, but will display the relevant content to each user about themselves. You should restrict the visibility of this post to users in a certain role by using one of a number of plugins, for example, https://wordpress.org/plugins/restrict-content/

Step 2: Redirect WordPress Users to their Dashboard when they login

Again, this is done using one of number of available redirect plugins in WordPress. A simpler one is https://wordpress.org/plugins/peters-login-redirect/
> 3 votes

---
Tags: wordpress, profile, dashboard, user-account
---


title: Fill Address/Phone enityRef

text:
# Question
Title: Fill Address/Phone enityRef
I'm writing an extension to customize the create new activity page. I need to add the 'With Contact' address and phone number to the page. When editing the /civicrm/CRM/Activity/Form/Activity.php how do you get the address to propagate when the contact is selected? Here is what I'm trying to edit:

```
    ),
   'target_contact_id' => array(
   'type' => 'entityRef',
   'label' => ts('With Contact'),
   'attributes' => array('multiple' => TRUE, 'create' => TRUE),
    ),
   'target_contact_adress' => array(
   'type' => 'entityRef', //I'm guessing I need to change this line to call the address?
   'label' => ts('With Contact Address'),
   'attributes' => array('multiple' => TRUE, 'create' => TRUE),
    ),

```

Edit: To better explain what I'm trying to do. I'm creating a custom extension for an organization that uses the Activity assignment notification to email their volunteers that don't have access to the CiviCRM database contact information (Phone Numbers and Addresses) about their members. In order to do this I need to add two fields that pull this information when a contact is selected.

# Answer
> 2 votes
I'd suggest you create 2 custom fields for this in the activity (pickup location & contact phone number). You can then use a bit of javascript to insert the contact's email & phone into those fields and it will come through in the activity email. As an added bonus, this approach gives the flexibility of allowing the user to override those defaults if the person needs to be picked up elsewhere.

To do this, your buildform hook needs to do 2 things:

1. Request the extra address/phone info from the target\_contact\_id field. You can do:

```
$form->_fields['target_contact_id']['attributes']['api']['extra'] = array(
  'street_address',
  'city',
  'state_province',
  'postal_code',
  'phone',
);

```
2. Add your javascript to the form using CRM\_Core\_Resources (hint: create a js file in your extension, and use `CRM_Core_Resources::singleton()->addScriptFile('myExtension', 'js/myScript.js')`)

Your javascript can then use some basic jQuery like:

```
CRM.$(function($) {
  $('#target_contact_id').change(function() {
    if ($(this).val()) {
      // This contains the extra fields you requested
      var data = $(this).select2('data')[0].extra;
      // For example, populate a custom field with the phone
      $('#custom_42').val(data.phone);
    }
  });
});

```

You can read more about javascript in CiviCRM here.

---
Tags: extension, php
---


# Question
Title: Is there a hook for when a CiviMail is created/scheduled/sent/completed?
I want to call a function whenever a CiviMail is sent from our system, to send a log message to a third party system (Slack in this case).

I've had a look at the CiviCRM documentation, and while I can see hooks for both before/after an *email* is sent, I can't see one for a CiviMailing. I could in theory use these hooks, but even if I de-duplicated it down to a single record, it wouldn't contain information about the mailing (such as mailing name, mailing size, groups, etc).

What's the best option to accomplish this? Is there a relevant hook? Would I need to run a cronjob to check the relevant tables?

# Answer
> 1 votes
to be checked, but creating a mailing should go through the normal hooks like the other entities in civi

so if you go with the pre or post hooks http://wiki.civicrm.org/confluence/display/CRMDOC/Database+hooks

```
hook_civicrm_post( $op, $objectName, $objectId, &$objectRef )

```

you should have one with the objectname mailing you want to handle and do the needed

---
Tags: civimail, email, hooks, logs
---


title: CiviCase dashboard for individuals

text:
# Question
Title: CiviCase dashboard for individuals
In our system, based on imported data, we have the role of Pastor (whose parent is individual), and pastors are the only contacts with Drupal accounts.

When a pastor logs in, they are shown the dashboard for their Household, but this is, of course, empty, as all cases and activities have been assigned to them as an individual.

How can we correct this?

# Answer
> 1 votes
There are multiple things called dashboard, but if I understand right I think the one you're looking for is the "Case" dashboard, which is not the default dashboard unless you change the frontpage under /admin/config/system/site-information. The case dashboard is under the Cases menu.

# Answer
> 1 votes
In this instance what wasn't working was that the Drupal account had been created manually rather than from CiviCRM, and therefore there was no link between the Civi contact and the user account. Interestingly there doesn't seem to be any UI for linking an existing contact to an existing Drupal account. (I'm happy to be corrected on this!) Research gave me the options of directly adding a record to the database or of deleting the Drupal account and recreating it from the contact. Since the account owned no content, I chose the latter.

# Answer
> 0 votes
I don't seem to be able to comment so adding another answer to address the UI for linking. CiviCRM will link automatically upon login, but the rules depend on the email address and the dedupe rules you have configured on your site (under Contacts - Find and Merge Duplicates). See drupal/civicrm\_user.inc where the login hook is and CRM\_Core\_BAO\_UFMatch::synchronize(). See also http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=86213711

---
Tags: civicase, dashboard, households, roles
---


# Question
Title: Are Civicon Session materials aggregated somewhere?
I have seen session slides on slideshare and some youtube videos, and links posted on civicrm.org but wondering if there is a repository for all things civicon somewhere that is publicly available?

# Answer
> 3 votes
Here is a playlist with the videos on Youtube for 2015:

# Answer
> 1 votes
CiviCon materials SHOULD be posted on the sessions page for the session in question. Please keep in mind that CiviCon North America 2014 videos were never released due to quality issues, and CiviCon North America 2015 videos are currently in post-production.

---
Tags: tutorials
---


# Question
Title: Why does the profile field contact subtype only display individual subtypes but not organisation subtypes?
If you visit here on the CiviCRM Demo site http://d46.demo.civicrm.org/civicrm/admin/uf/group/field?reset=1&action=browse&gid=16 *(What I did to create this was create a new profile, for the purpose of batch updating via profile, called Subtype and add the field "Contact" "Contact Subtype". )* Looking at the preview of this field the only options that are available are subtypes of Individual. Subtypes of Organisation do not show.

How I can get the Contact Subtype field to display organisation subtypes?

# Answer
I just tested this & it seems like as soon as you add a field like 'organisation name' to the profile it switches to an org. Civi doesn't really like you doing 2 different contact types off one form - because it doesn't know what to save them as
> 1 votes

# Answer
This looks like you've found a bug. You can submit a ticket to http://issues.Civicrm.org but it seems unlikely, given the frequency with which this affects folk, to get fixed by the core team without funding. I'm sure they'd accept a patch to address it though!
> 0 votes

---
Tags: profile, contact-types
---


# Question
Title: How to display CiviCRM status messages on CMS pages
We have a web page which links users to CiviCRM profiles, to allow them to update their details. After saving, the profile redirects users to the original web page.

Since the original page is not in CiviCRM, the 'Thank you, your details have been updated' message does not appear on the page. However, the next time the user visits a CiviCRM page, that stored message does appear.

We are using Drupal, but I imagine the issue is the same for other CMSes.

TL;DR How do we render the the status message on the non-Civi page?

---

One idea would be to create a custom block in a Drupal with some code along the lines of:

```
civicrm_initialize();
$session = CRM_Core_Session::singleton();
$messages = $session->getStatus(TRUE);
if (count($messages)){
  foreach ($messages as $message) {
    $ds = 'status';
    if ( !empty($message['type']) && $message['type'] == 'error') { $ds = 'error'; }
    drupal_set_message(t('<strong>@title</strong> @message', array('@title' => $message['title'], '@message' => $message['text'])), $ds);
  }
}

```

This accesses the session, gets the messages, and converts them to drupal\_set\_message messages. Is there a better way?

# Answer
I couldn't find a way to do what I wanted, so I've created a small Drupal module that renders CiviCRM status messages from the session on non-CiviCRM pages for logged-in users:

https://www.drupal.org/project/civicrmstatusmessage
> 5 votes

# Answer
CRM\_Utils\_System::setUFMessage($message)

should do the trick. This is implemented for drupal only. I dont think we've figured out how to set messages in WP / Joomla as yet
> 5 votes

# Answer
Your code looks good to me. One note is that the only required field in a civi message is the `text`. Everything else (title and type) are optional so you'll want to account for a possibly missing title.

Also ensure your block excludes all paths starting with civicrm!
> 1 votes

---
Tags: cms-integration
---


# Question
Title: Do I need to backup civicrm_cache table in civicrm 4.0.8
civicrm\_cache table is nearly 3GB... does it matter if we empty it, if not can we just not back it up ?

# Answer
If you TRUNCATE the table, be sure you do so at a time when there are no in-process contributions or other users actively filling out a form or their submission will be lost. Otherwise, it's safe to do so.

Your backups can just skip that table, no need to back it up. Although you do need to get the structure of the table in order to be able to restore a complete db from your backup.
> 4 votes

# Answer
Best to exclude its content from your backups. You can dump a table's structure only with `mysqldump --no-data`

As Coleman points out, form data is persisted there while a multistep form is being used, so using TRUNCATE will invalidate any forms *currently* being processed.

You might want to review why your `civicrm_cache` has grown to this size - check the range of values in `created_date` and `expired_date` there. Odds are your CiviCRM isn't "cleaning up" old cache data, and if this was (not) happening you might experience other effects (eg performance degradation).
> 3 votes

---
Tags: backups
---


title: civicrm login form for individual users

text:
# Question
Title: civicrm login form for individual users
How to create a login for individual users in civicrm using WordPress (like membership login)? Can anyone say how to create it? For this below screenshot i want to create login for users.

# Answer
> 5 votes
1) Create/Edit a profile... In the advance settings:

WordPress user account registration option? = Account Creation required

2) In the profile listing. click More \> User Profile Create Mode

This page (for a non-logged in user) should have account (login) creation.

---
Tags: wordpress, user-account
---


# Question
Title: Updating to civi 4.6 after this can't create new emails no text editor
After upgrading I can't create new emails. Also the menu bar is not showing right. Please look at my screen shots. step 1 and step2. Maybe a problem with javasript?

Help is urgently needed since we can't use the email function. \*Moderator: Please don't put me on hold again.

Thanks

# Answer
Found a solution: The problems is K2. k2.php was not correct coded.

See plugins/system/k2.php - specifically this code section:

if (JString::strpos($response, 'prefix="og: http://ogp.me/ns#"') === false) { $searches\[\] = ''; $replacements\[\] = 'http://ogp.me/ns#" '; $replacements\[\] = 'http://ogp.me/ns#"\>'; }

Change this to:

$app =& JFactory::getApplication(); if ($app-\>isSite()){

```
                if (JString::strpos($response, 'prefix="og: http://ogp.me/ns#"') === false)
                {
                        $searches[] = '<html ';
                                $searches[] = '<html>';
                        $replacements[] = '<html prefix="og: http://ogp.me/ns#" ';
                        $replacements[] = '<html prefix="og: http://ogp.me/ns#">';
                }
        }

```

Thanks to "plethoradesign"

Now the editor appears but somehow all drop down box options are not clickable meaning you can't select a group nor templates and also you can't jump to the next step. Help is still needed. Best P
> 1 votes

# Answer
When you create a new mailing on the demo, you see a url like:

http://joomla.demo.civicrm.org/administrator/?option=com\_civicrm&task=civicrm/a/#/mailing/2

This looks different to the url you are seeing. Try changing the url for your site to see if this helps (the last number is the id for the mailing so you'll need to find the next number for you)

Updated: I see that "new" automatically changes to the next number, for some reason your system is not finding the next number.
> 1 votes

---
Tags: civimail, ckeditor, javascript, upgrade
---


# Question
Title: Strict warning: Non-static method CRM_Core_BAO_UFGroup
This seems to be a carry-over from: http://forum.civicrm.org/index.php/topic,26411.0.html

I'm now receiving this error:

Strict warning: Non-static method CRM\_Core\_BAO\_UFGroup::checkFieldsEmptyValues() should not be called statically, assuming $this from incompatible context in CRM\_Profile\_Form-\>postProcess() (line 1315 of /home//public\_html/sites/all/modules/civicrm/CRM/Profile/Form.php)

I just upgraded from 4.3

now using \- php 5.5 \- drupal 7.38 \- civiCRM 4.6.4 (a fresh install)

Has a fix been found?

---

## EDIT

...should have mentioned the php upgrade ;-)

I was able to control the warnings in the php.ini in php5.4 - with php5.5 they reappeared and nothing I've been able to do in the php.ini or .htaccess has been able to remove them. (Drupal platform and the errors are only in the log...I'm just trying to reduce the numbers of "errors" I see)

# Answer
First of all, this is not really an error that would cause you any damage, so I would not classify it as an important bug. The name is 'strict warning', which means that it is a warning (not an error!) that the programmer has sinned against the PHP rules when a strict check has been done. So it should be fixed at some stage, but these type of warnings will never disappear entirely as they do not break anything.

I assume you are now seeing those warning because you are a site admin? In most live sites 'normal' users will not see these warnings, but that needs to be configured in your CMS (Drupal, Joomla or Wordpress).
> 1 votes

# Answer
A fix can be made in the Drupal settings.php file.

Add to the file:

error\_reporting(E\_ALL & ~E\_STRICT);
> 0 votes

---
Tags: profile
---


# Question
Title: Error importing contacts Wordpress Multisite
I tried to import contacts on a new WordPress Multisite installation, and received the following error:

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

 Site Administrators: This error may indicate that users are accessing
 this page using a domain or URL other than the configured Base URL.
 EXAMPLE: Base URL is http://example.org, but some users are accessing
 the page via http://www.example.org or a domain alias like
 http://myotherexample.org.

 Error type: Could not find a valid session key."

```

In the error log, it has the following errors:

```
    [info] $backTrace = #0 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(363): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(859): CRM_Core_Error::fatal("We can't load the requested web page. This page requires cookies to be enable...")
#2 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(854): CRM_Core_Controller->invalidKeyCommon()
#3 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(314): CRM_Core_Controller->invalidKey()
#4 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(206): CRM_Core_Controller->key("CRM_Contact_Import_Controller", TRUE, FALSE)
#5 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Controller.php(45): CRM_Core_Controller->__construct("Import Contacts", "null")
#6 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(307): CRM_Contact_Import_Controller->__construct("Import Contacts", TRUE, "null", NULL, "false")
#7 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
#8 .../public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#9 .../public_html/wp-content/plugins/civicrm/civicrm.php(1133): CRM_Core_Invoke::invoke((Array:3))
#10 [internal function](): CiviCRM_For_WordPress->invoke("")
#11 .../public_html/wp-includes/plugin.php(496): call_user_func_array((Array:2), (Array:1))
#12 .../public_html/wp-admin/admin.php(226): do_action("toplevel_page_CiviCRM")
#13 {main}

```

(I've removed part of the directory url for security/privacy)

Does anyone have an idea of what I can try to fix this?

WordPress version: 4.2.2

CiviCRM version: 4.6

Other activated plugins:

* BackWPup
* Black Studio TinyMCE Widget
* Brute Protect
* Coming Soon Page & Maintenance Mode by SeedProd
* Disable Comments
* Redirection
* Seamless Sticky Custom Post Types
* Simple Lightbox
* Types - Complete Solution for Custom Fields and Types
* User Admin Simplifier
* WordFence Security
* WordPress MU Domain Mapping

Import file type: CSV (it's just a list of contact information. We went through the data to remove inconsistencies)

Thanks

# Answer
It turns out it was errors in the data. I picked apart the spreadsheet and went from the ground up and it finally gave me a report of what the errors were instead of this vague error message.

The errors were:

* Country name USA instead of US
* Some of the date formats were wrong

I believe there might have also been some strange formatting in the original spreadsheet that affected the upload.
> 1 votes

---
Tags: wordpress, multisite
---


# Question
Title: Custom contact reference field with "New Organization"
I would like to create a custom contact reference field (for CiviGrants) that also has the ability to add a new contact on the fly. It should be like the default Contact field used in (for example) Contributions or Grants. Any help would be appreciated... Thanks.

# Answer
> 2 votes
This feature request would, IMO, be a good match for the paid issue queue. Giving custom contact reference fields the option to have "create new" functionality would be a nice addition to CiviCRM.

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


# Question
Title: How can I hide specific tabs in member view regardless of viewer permissions?
We have two different user permission groups: Finance team who can see the Contributions tab, and Personnel, who can't. We wanted to hide some custom field tabs for both groups, and mimicked the documentation on the civicrm\_tabs hook, simply using

```
unset ($tabs[12]);

```

However, the index 12 corresponds to different tabs for the two types of users, because the count changes depending on whether or not the Contributions tab is visible.

How do we hide tabs in a manner independent of the user group and the other tabs they see?

# Answer
The $tabs variable passed into the tabs hook is an array of arrays, with unique identifying values in the "id" column of each entry. I found a function to scan all elements of the array to check the "id" column for a given value. This returns the correct $tabs index to use with the unset() function.

```
function searchForId($id, $array) {
  foreach ($array as $key => $val) {
    if ($val['id'] === $id) {
      return $key;
    }
  }
  return null;
}

```

Example usage:

```
$duestab = searchForId('custom_15', $tabs); //tab holding dues
unset( $tabs[$duestab] );

```

If my server used PHP 5.5 or greater, I could have skipped the searchForId function and used a one-liner:

```
$duestab = array_search('custom_15', array_column($tabs, 'id'));
unset( $tabs[$duestab] );

```
> 2 votes

# Answer
There is a specific hook to modify the tabs on the Contact Summary. I suggest you use this hook in an extension to make the tabs do what you need them to do? So you could also remove the Contributions tab. Example:

```
function threepeas_civicrm_tabs(&$tabs, $contactID) {
  $threepeasConfig = CRM_Threepeas_Config::singleton();
  /*
   * first check if contact_subtype is country
   */
  if (_threepeasContactIsCountry($contactID) == TRUE) {
    $activeCountryTabs = array('contact_documents', 'rel', 'case', 'activity', 'participant');
    foreach ($tabs as $tabKey => $tab) {
      $projectWeight = $tab['weight']++;
      if (!in_array($tab['id'], $activeCountryTabs)) {
        unset($tabs[$tabKey]);
      }
    }
}

```
> 1 votes

---
Tags: hooks
---


# Question
Title: Contact ID 1 is an organization and causing errors
I did a fresh install of Civi4.6.4 on Drupal 7.38 and ran into something I haven't seen before. An organization was set up as ContactID 1. Now when I logout and then login I receive the following:

* Session opened for "Drupal User 1" (Drupal uid: 1 is now CiviCRM contactID: 2) - then the errors:
* Role Publish Events (11) should be held by user (1) because they are part of group 5 (contactID: 2)
* Role Publish Jobs (13) should be held by user (1) because they are part of group 7 (contactID: 2)
* Initial roles: @roles, roles to add: Array ( ) , roles to remove: Array ( ) , final roles: Array ( \[2\] =\> authenticated user \[3\] =\> administrator user \[11\] =\> Publish Events \[13\] =\> Publish Jobs \[15\] =\> View Maint \[23\] =\> Publish News \[24\] =\> View Connects )

Is there a way to change the organization to an individual (though that doesn't seem be a solution based on other questions)? ...is there another way to fix the problem? ...and how did the "organization (default organization)" create the groups?

# Answer
> 1 votes
The messages about roles are verbose output from the CiviGroup Roles Sync module (civicrm\_group\_roles) which are logged in Drupal watchdog. Are you seeing these on screen? They don't indicate a problem, they just record which roles a user is being sync'd with and why.

I don't think it's problematic in itself that contact id 1 is an organization or that user id 1 is linked to contact id 2. The user id will not in general be the same as the linked contact id. The link is initially established based on email address and is then stored in the civicrm\_uf\_match table in the CiviCRM database.

Re:

> how did the "organization (default organization)" create the groups

The messages from civicrm\_group\_roles are saying that user 1 gets certain roles (Publish Events, Publish Jobs) because the contact that it's linked to, contact id 2 - which I assume is an Individual - is in certain groups (group ids 5, 7).

---
Tags: contacts, groups, roles
---


# Question
Title: how to reinstall civicrm 4.6.4 in wordpress
After dealing with a corrupted wordpress site and **reinstalling wordpress**, i **re-enabled the civicrm plugin** but did not re-install civicrm.

The backend seems to work fine except that **widgets do not work and the Civicrm Page needs to be recreated.** I tried to re-save the Civicrm page in the CMS integration admin form. Also tried to run the installer /wp-admin/options-general.php?page=civicrm-install but get a message: You do not have sufficient permissions to access this page.

**I suppose I could disable the civicrm plugin, wipe the database, install civicrm and overwrite the database but wondering if there is a more practical solution?**

# Answer
I'm not sure if there is a better answer but this is what I resorted to:

1. Clear Cache
2. Disable civicrm plugin
3. Delete /templates\_c/ contents
4. Copy civicrm database to civicrm.sql using mysqldump and delete all tables (or drop / recreate database)
5. Move /civicrm/civicrm.settings.php tocivicrm.settings.tmp
6. Enable Civicrm Plugin
7. Run Civicrm install script http:///wp-admin/options-general.php?page=civicrm-install
8. Page Civicrm is created and I presume other civicrm install magic in wordpress
9. Disable civicrm plugin
10. Replace civicrm.setttings.php with civicrm.settings.tmp
11. Restore civicrm mysql dump (e.g. mysql civicrmdb \< civicrm.sql)
12. Re-enable civicrm plugin
> 2 votes

# Answer
First Delete your civicrm plugin and files folder. Don't keep anything regard to civicrm delete whatever u have.

And then again upload the civicrm plugin into wordpress.

Again create the files folder in plugin folder

Right click the files folder and give permission
> 0 votes

---
Tags: wordpress, installation
---


# Question
Title: Custom activity types do not appear in report filter
When creating a report from a template (specifically the Activity Report) custom case types are not available in the filter list.

# Answer
In our case, we were creating custom Activity Types and selecting used for "Cases Only."

If we change this to "Contacts and Cases," they appear in the filter list.
> 0 votes

---
Tags: civireport, civicase
---


title: User Registration login in profile page

text:
# Question
Title: User Registration login in profile page
I just want to move the user registration login page to contribution page , before the payment processor. Can anyone say how to do tat? i have attached my screenshot below.

---

i'm not using event registration..

I'm using customise Data screen-\> profile

# Answer
> 1 votes
I am not sure whether this correct way – But easy way – I did once for Event registration

Just make sure you have the same file path on your address bar (highlighted one) http://examplesite**/civicrm/contribute/transact**

If yes then you will find a file called main.tpl in the below location **civicrm\templates\CRM\Contribute\Form\Contribution\Main.tpl**

Where you can change the order by just playing around in it – also please use custom tpl folder and copy the file over there

# Answer
> 1 votes
Unless I'm misunderstanding, I think you can just move the profile that has the account creation option to the top of the page in the Profiles tab of the Contribution Page itself (rather than changing a setting within the Profile you created):

---
Tags: profile, registration, user
---


# Question
Title: How can I create a contribution page that allows the user to select the currency they wish to use?
CiviCRM provides the ability to have more than one currency "available". But when I set up a contribution page I have to select the currency that the page will use. If I want to give the user the choice of which currency to use to make their payment, do I have to create a different contribution page for each currency option, or is there a simple way of letting the user select their preferred option on the payment page itself?

# Answer
> 7 votes
You don't have an option of selecting multiple currency in the same page

So, Creating separate page of each currency could be a best option also easier way.

Or

You can create an extension for listing multiple currency in a single page, playing around price set - which is going to take some time

---
Tags: civicontribute, currency
---


# Question
Title: Running out of memory on contact creation
On a site with ~68k contacts, we find that occasionally we get a memory error on a simple contact creation (although we haven't noticed problems elsewhere). We have a fairly large PHP memory allotment to start with, and although I realize I could increase that further I am a little hesitant to go too much further there. I'm assuming the process that runs the dedupe check could be responsible for this.

Can anyone confirm that the duplicate check is most likely the culprit here? If so, is there a setting to disable that?

# Answer
What is the default dedupe rules you are using? is this the standard ones or did you customise?

In general, the performance problems I experienced on civi the same size as yours are

1) badly configured server (eg mysql with wrong variables...). I would recommend you to run mysqltuner, you need to read the doc before blindly following their advices, but it's mostly good 2) modified dedupe rules (this one is a performance killer) 3) smartgroups (easy to kill your server with that one too)

It's probably worthwhile to check the load of your server and mysql configuration in any case, but dedupe rules are usually close next indeed
> 2 votes

---
Tags: contacts, webserver
---


title: How to include a token in a view?

text:
# Question
Title: How to include a token in a view?
The CiviCRM Views integration (Drupal) provides a way to create a View using data from Civi fields. Is there a way to include the output from a Civi token in the View?

The use case is that I have a token for a custom greeting that I want to include in a View.

\[For this particular situation, using the email\_greeting field would be enough but it does not show in the list of fields available to add to a View.\]

# Answer
I am using civicrm\_entity which can pretty much expose everythign in civicrm to drupal views (and more)
> 1 votes

# Answer
You could write a Drupal module to call `hook_views_post_execute()` or `hook_views_pre_render()`, looping through the result set and calling your token's function for each record. However, if your email greeting formula is simple, I would call `hook_views_query_alter()` to add it into your list of select fields, concatenating the name within your SQL.
> 0 votes

---
Tags: tokens, drupal-views
---


# Question
Title: Event white screen of death when user registers for an event
I upgraded to CiviCRM 4.6.4 on Joomla 3.4.2 after a year on older versions. I've cloned a previously working but expired event. Registration from the back-end works fine but from the front-end gives this error:

> Fatal error: Call to undefined method CRM\_Core\_Payment\_Form::setPaymentFieldsByProcessor() in /home/\***/www/www/administrator/components/com\_civicrm/civicrm/CRM/Event/Form/Registration.php on line 388

If I make it an unpaid event (Configure Fees with Paid Event = No), I get a different error:

> Fatal error: Call to undefined method CRM\_Core\_Payment\_Form::buildPaymentForm() in /home/\***/www/www/administrator/components/com\_civicrm/civicrm/CRM/Core/Payment/ProcessorForm.php on line 114

Advice please!

# Answer
I solved it. There seems to be a conflict in this version (Civicrm 4.6.4) with the following extensions:

* GoCardless
* Smart Debit
* UK Direct Debit

When I disabled all three, the problem went away. One of these extensions must be using the same method call.
> 3 votes

---
Tags: civievent
---


# Question
Title: CiviCRM 4.6.3 says no extensions available
I cannot update my Mandrill Transactional Emails extension (v 1.5) to version 2.0, because CiviCRM won't list any extensions.

How can I install the update? Extension documentation says that if I uninstall, all database records are removed for prior mailings. There's no documented "manual install" process, and as noted, it's not offering an update to version 2.0 of the extension.

I posted this on the Mandrill Transaction Email extension github (issue 86), and he said to post the question here because it appears to be a CiviCRM problem (my paraphrasing). https://github.com/JMAConsulting/biz.jmaconsulting.mte/issues/86

CiviCRM 4.6.3 Joomla 3.4.1 PHP 5.5.25 Linux

Although demo site (running 4.6.0) says there are extensions available, my site running 4.6.3 says "No Extensions Available"

Going to the link provided "requested extensions from here": (https://civicrm.org/extdir/ver=4.6.3|cms=Joomla) only leads to a second page with even more extensions. It **NEVER** actually downloads/opens any xml files. Clicking the link on that page just gets a "circular reference to a longer page of all extensions, which then doesn't do anything when clicked.

Thanks in advance for any help.

# Answer
> 1 votes
You can control which extensions are displayed by overriding $civicrm\_setting\['Extension Preferences'\]\['ext\_repo\_url'\]

try something like $civicrm\_setting\['Extension Preferences'\]\['ext\_repo\_url'\] = 'http://civicrm.org/extdir/ver={ver}|cms={uf}|status=';

obviously be careful that you install things that are compatible.

# Answer
> 1 votes
This is a known bug in CiviCRM 4.6.3, you need to upgrade to 4.6.4+: https://issues.civicrm.org/jira/browse/CRM-16590

---
Tags: civimail, 4.6.3, mandrill
---


# Question
Title: Custom Hook causes for a PCP problems on event registration page
I have a custom function written to show the name of the contribution page that a PCP is a part of. After some help from the community, I got it working, hooray! Trying to write a hook to add contribution page name to Main.tpl I'm super close

But on my event registration links (not contribution pages, oddly enough) or PCP creation links - I get the following error 'CiviCRM\_API3\_Exception: "Expected one ContributionPage but found 25"' (I have a total of 25 contribution pages set up so I can see why it says it finds 25 but why it's looking in the first place I'm not sure.

Here is the final code I'm using

```
function wordpress_civicrm_buildForm($formName, &$form) {
    $config = CRM_Core_Config::singleton();
    if ( $config->userFrameworkFrontend ) {

          $page = civicrm_api3('contribution_page', 'getsingle', array(
            'id' => $form->_id,
            'check_permissions' => FALSE,
            'return' => 'title',
          ));
          $form->assign('cPageName', $page['title']);

    }
}

```

Ideas?

# Answer
> 0 votes
The problem is that your hook is executing unconditionally on every form. To target just the contribution form, the first line inside your function should be `if ($formName == 'CRM_Contribute_Form_Contribution_Main') {`.

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


# Question
Title: Issue with permissioned access using state address field
We are using the state field in the address to control access for our State leaders. The people in Florida can only view Florida contacts, Texas can only view Texas, etc.

My guy in Texas is in the process of adding a couple dozen contacts and memberships, and every third or fourth entry he is unable to pull the contact up even though he entered the address and the state field is marked Texas. I have system wide permissions so I can pull the contact up and see that it was entered and saved properly.

I've tried a couple of different things with him checking after each change, and it appears if I delete Texas from the address field and add it back he can then view the record.

We are using smart groups for the contacts - if the contact is marked Texas in the address field it gets added to the Texas contacts smart group. He is the Edit Texas group which gives him edit access to the Texas contacts smart group.

Any ideas as to why this is happening and how to fix it? I've had similar complaints from others after the fact and we end up with duplicate entries because they end up creating a new contact that they are able to view. This is the first time where someone reached out and i was able to trouble shoot it in real time to get an idea of what is happening...

Matt Nye Drupal 7.33/CiviCRM 4.6.4

# Answer
Could it be that the contact is not added to the smart group immediatly? Also a smart group is rebuild in the background with a scheduled job.

The smart group cache timeout is configurable: see http://book.civicrm.org/user/current/organising-your-data/smart-groups under "Smart group caching".
> 2 votes

---
Tags: permissions
---


# Question
Title: Joomla CiviCRM Upgrade 4.3.9 to 4.4.x version
I am unable to upgrade 4.3.9 version into new version ..

I am getting this error : Error: Consolidate activity contacts

```
Type    DB_Error
Code    -2
Message DB Error: syntax error
Mode    16
UserInfo    UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]
DebugInfo   UPDATE civicrm_option_value SET is_reserved = 1 WHERE option_group_id = 62 AND value IN (2, , 3) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 3)' at line 3]

```

# Answer
> 1 votes
It seems that you may have deleted the 'Activity Assignees' option from the 'activity\_contacts' option group. That's what the missing id is supposed to refer to in `IN (2, , 3)`

# Answer
> 0 votes
Did you look in your database to see what value it's referring to? I had a database problem when upgrading (not these specific versions) and I had to remove the apostrophe in my organization's name for the upgrade to run successfully. Also, if you've not already tried, I'd recommend incremental upgrades, see if smaller steps like 4.3.9 to 4.3.10 works.

---
Tags: upgrade, database
---


# Question
Title: Membership not inherited if child added via webform
Civi 4.6.4 / Drupal 7.38

Goal: Allow a constituent to add family members to their membership.

Issue: When a constituent adds family members, via a civi web form, the relationship is created properly, however the child does not inherit the membership. However, if as the admin, I go in and edit the relationship, make no changes, and save, the membership is now inherited properly.

In the webform, I am adding the relationship, but not adding any membership...I'm assuming this is not necessary. The parent has an established, active membership at the time of form submission.

Has anybody experienced this or is using another process to achieve this goal?

Thanks,

--Ken

# Answer
> 4 votes
There is a bug that requires the acting user to have "access CiviMember" permission or the inherited memberships fail to be processed. I've submitted a fix for this which hopefully will be part of the next (4.6.5) release.

# Answer
> 1 votes
Reading the code, this really should be working. The webform creates the relationship via the api, which calls CRM\_Contact\_BAO\_Relationship::create, which in turn calls disableEnableRelationship which handles related memberships. Can you check your drupal error logs for anything from the webform?

# Answer
> 1 votes
The CiviMember: access CiviMember permission was not enabled for the role in question. Adding this permission solved the problem.

---
Tags: civimember, webform-civicrm
---


# Question
Title: Report for user and assigned contacts (ACL)
I have a set of users that have been assigned access to specific contacts (ACL based off a smart group for each user) - for each contact I have added a set of custom fields that a user needs to fill out (example call status) - The workflow is: the user signs in, has access to the contacts that has been assigned to him, calls up the contact and marks the contact custom fields appropriately

I am now looking to generate a report that shows all users and their corresponding contacts - I can't see any option to do so since I am unable to connect the user to assigned contacts

Is this possible to do through civiReports or would it need to be a database query?

# Answer
I can't answer directly, but I can make an alternate suggestion for your structure. Instead of using ACL on Groups, you could use our extension which builds ACLs off a Relationship. This would require a Relationship between your "user" and the contacts they need to call, but it would mean that you can then use this to deliver Reports or Drupal Views to see who is connected to whom, and the status of their calls etc. If it is of interest you can find it here https://civicrm.org/extensions/relationship-permissions-acls
> 1 votes

---
Tags: civireport, acl, user-account, user
---


# Question
Title: Error in CiviCRM for Drupal7 after Migrate from "Backup and Migrate" module on New Contact Form
After I did a Backup and Migrate to a new system, I am getting two errors on any New Contact form. They are as follows:

`Notice: Undefined property: CRM_Core_BAO_Tag::$tree in CRM_Core_BAO_Tag->getTree() (line 75 of /sites/all/modules/civicrm/CRM/Core/BAO/Tag.php).`

`Warning: Invalid argument supplied for foreach() in CRM_Contact_Form_Edit_TagsAndGroups::climbtree() (line 203 of /sites/all/modules/civicrm/CRM/Contact/Form/Edit/TagsAndGroups.php).`

I also noticed that the tag box at the bottom of the page under "Tags and Groups" has gone missing. Is there any way to fix this problem without starting from scratch?

# Answer
I figured out what happened. When I did the backup and migrate, Drupal set civicrm\_tag.used\_for to NULL. I set the field for all my tags to 'civicrm\_contact' and it fixed the problem. No more errors. I just ran this query:
`UPDATE civicrm_tag SET used_for='civicrm_contact';`
> 2 votes

# Answer
I had deleted all my tags so the SQL query didn't help me at first.

I added one tag via civiCRM, then went into phpMyAdmin and just pasted civicrm\_contact into the used\_for field. That worked, though at that point I could have used the SQL query.

I was deleting all my contacts except a few administrators, so I could keep all the settings before importing 20k contacts, and also deleted all my tags when the problem occurred for me.

Thanks for the solution, I would never have figured out my own version without your help.
> 0 votes

---
Tags: drupal, import, contacts
---


# Question
Title: Civisualize can't find JS and CSS resources
I've got Civisualize running very nicely on an installation of CiviCRM 4.5 and Drupal 7 with some custom templates and queries. I then moved a copy of the whole site across to a different server under a different URL. After a bit of fiddling around, everything is now working under the new server/URL, except for Civisualize. I can access the dataviz template pages but no graphs/data are displayed.

The problem stems from the Civisualize extension looking for the d3 javascript and css resources in a place that they're not but I've no idea how to force/trick/coerce Civisualize to look for them elsewhere. Directories and Custom Ext path have been set up correctly and disabling/uninstalling/re-installing the extension hasn't helped.

Any suggestions as to what to try next?

# Answer
You need to change the url where civi looks for extension so it looks at the new url

http://d46.demo.civicrm.org/civicrm/admin/setting/url?reset=1
> 5 votes

---
Tags: civisualize
---


title: Participant getCount is too slow

text:
# Question
Title: Participant getCount is too slow
I want to show how many spots we have left in an event, but it takes like 20 seconds to get the number of participants using the getCount action. What else can I do to get that number?

# Answer
> 2 votes
What is the number of participants you have?

depending of the entity, getCount is just a wrapper around get, so it might be the issue if you have lots of participants.

I haven't looked for participants, but writing (and contributing that back to civicrm core) a custom getCount api with a simplier query that only does select count() would probably makes it way faster

---
Tags: civievent
---


title: PCP list on contact dashboard

text:
# Question
Title: PCP list on contact dashboard
The list of campaign pages under 'create a personal campaign page for another page' list is a little wonky. IT has three basic columns 1. Name of page with hyperlink 2. End date or 'ongoing' 3. Create a PCP hyperlink.

The hyperlink in the first column is incorrect - I checked the demo site, it is wrong there as well. I tracked it down as far as the template Contribution\>Page\>PcpUserDashboard

In that file (line 80 in 4.6.4) it lists

```
{if $row.component eq 'contribute'}
<a href="{crmURL p='civicrm/contribute/transact' q="id=`$row.pageId`&reset=1"}"

{else}
<a href="{crmURL p='civicrm/event/register' q="id=`$row.pageId`&reset=1"}

{/if}

```

Every link listed is the 'else' option (a event link) even when it's a contribution page. I'm not sure what part of the if statement is going wrong. I tried a few variations in this template to no avail. I also tried poking through the php but was unable to figure it out.

# Answer
You may want to try using Smarty debugging.

* Turn on debugging at **Administer menu \> System Settings \> Debugging and Error Handling**.
* Load the same URL, but add "&SmartyDebug=1" to the end.
* You may need to enable pop-ups in your browser to see the window that appears.

Hopefully access to the Smarty debugging will make it clear what the value of $row.component is.

Alternatively, you could just add "$row.component" to the template inside the "if" statement. I'd guess it's not showing either "event" or "contribute", but something else altogether.
> 1 votes

---
Tags: civicontribute, contribution-page, pcp, dashboard
---