# Question
Title: Is there a CiviCRM payment processor extension to support Square?
Is anyone developing the interface needed for using Square as a payment processor?

# Answer
> 3 votes
It might not be too hard to implement the omnipay version, there's a contributed plugin for that here: https://packagist.org/packages/ryanthompson/omnipay-square

If you want to take this route, here's how it might look \[thanks petednz for the prod\].

1. Read my old wiki entry here: https://wiki.civicrm.org/confluence/display/CRMDOC/Omnipay as a general introduction to what omnipay is.
2. Get a copy of the omnipay payment processor extension. The extension home is here: https://civicrm.org/extensions/omnipay-multiprocessor-extension But you'll want to clone it from the repo here: https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor
3. Add the omnipay-square plugin to the omnipay payment processor exentsion. Yes, this is the hard part. There is a simple note here: https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/README.md I found that it was most instructive to look at some examples.

A few things I found helpful were:

a. Learn about composer if you don't already know about it. Don't skip this step or you'll get confused.

b. You have two routes if the omnipay plugin doesn't just work out of the box - either contribute your modifications back to the original project and keep it as the source of the plugin (possibly from your forked repo), or you can fork the original and create it as a separate project. The first one is usually the right answer, particularly if the existing plugin looks like it's going to be maintained. There are some confusing bits in terms of the vendor paths and git sources in the composer file that you'll have to figure out to sort this out.

---
Tags: civicontribute, payment-processor
---


# Question
Title: How to bootstrap CiviCRM with admin permissions in a Wordpress environment?
I'm using `eval cv php:boot` in a script. I need to be able to delete a contact in the script, including the `skip_undelete` flag, but this action is denied - get a "could not delete contact" error.

I learnt that in Drupal this happens when you're bootstrapped but not as the admin user, but I'm unfamiliar with what **Wordpress**'s equivalent would be, and whether it's possible to do this using `cv`?

Thanks.

PS. I'm writing a phpunit test (not a unit test) for a wordpress integration plugin (not a CiviCRM extension) that makes various API calls. I am running this against a real world database, not a buildkit one, so it's not appropriate to use the extension-style phpunit tests which start by tearing out your data :-)

# Answer
I recently pushed b3db22c002a5d16ae3715b97b58f3f64a1526a3a -- which adds the `--user` (`-U`) option and seems to work in WP/D7 (but hasn't been exhaustively tested). Try downloading the latest build of `cv`.
> 4 votes

# Answer
If wp-cli is an option, it takes a `--user` option, similarly to drush.

If that's not an option, looking at the wp-cli source code (here) suggests that `wp_set_current_user()` will do the trick.
> 4 votes

---
Tags: wordpress, testing, cv
---


# Question
Title: Wrong dates and type on membership email receipts
We recently set up a new CiviCRM install (Drupal 7, CiviCRM 4.7.3, hosted on Bluehost). Most everything is fine, but the email receipts *sometimes* show the wrong dates and membership type. The correct membership dates and type are being stored in CiviCRM.

Some contact and membership data has been imported previously. User H C renewed via the membership page, paid via PayPal Standard. Their membership shows correct since/start/stop dates (since July 30th 2008, start February 29th 2016, stop February 28th 2017).

The receipt emailed to the member shows incorrect dates though: membership start date October 1st 2011, membership end date October 1st 2012. It also says the membership type is Registered when it should actually say Senior.

The contact's membership page shows no other memberships. What might do this? How can I resolve it?

The issue seems to affect memberships inconsistently about half the time.

The issue only affects renewing members.

# Answer
> 3 votes
A similar report came up in the IRC channel - this looks a lot like CRM-18247: Contribution receive date is incorrect/misformatted in email sent by API Contribution.sendconfirmation.

The patch from that issue's PR may solve the issue for you?

# Answer
> 1 votes
I don't think CRM-18247 is the culprit here. I believe for that version of CiviCRM, it would have been https://issues.civicrm.org/jira/browse/CRM-19094

This bug was fixed but has re-emerged due to changes in ARB handling(4.7.7\<). The bug only presents when contribution ID's overlap with Membership ID's. The problem is quite serious, as Memberships will be renewed without payment, and the problem can very easily escape detection. In a newer incarnation I encountered, there were multiple memberships associated with one Contribution. This SQL can be used to find memberships in that situation. https://gist.github.com/ginkgomzd/20d1c83fbdf8b698009eedb262b63de1

However, without the recent changes to ARB, I don't know if the contribution would get associated with both the wrong and right membership. Instead, it may have only been associated with the wrong membership... in which case, Gnu help you.

Here is the change needed: https://github.com/ginkgomzd/civicrm-core/commit/d6719eb555d41da1fee034df3ac785ca491e5830 UPDATE: PR submitted: https://github.com/civicrm/civicrm-core/pull/9349 and bug filed: CRM-19594

I'm not 100% certain that this will not cause another bug to show up, but I found that this code has been around since before the migration away from Subversion, so there is some hope that this is outdated logic and this change will be inconsequential (only beneficial).

---
Tags: drupal, email, receipts
---


title: Link CiviCase with CiviAccounts

text:
# Question
Title: Link CiviCase with CiviAccounts
I was wondering how would you configure CiviCase to link with CiviAccounts.

So for instance: you set up a new case to process a member's expense for train tickets. Can you link that from the case management to the accounts? So that you can keep a log of their interactions and processes, including finances.

# Answer
> 1 votes
In this case you'd normally add various activity types to that case. I.e. create an activity type Expenses Claim and add that.

# Answer
> 0 votes
We do something similar to this with Activity types. When a person needs to be reimbursed they submit an Activity type called "Check Request" and assign it to the person that needs to approve it. That person will review it and set the status to Approved and then assign it to the next person to approve. We have detailed logging enabled and each time the activity is approved/denied/assigned a log event is recorded. We had Jon write us an extension that would show the log history for the Activity type at the bottom of the Activity. That way the person who cuts the check could see that all the approvals necessary were given.

I'd like to make some improvements to it so that the Statuses would be "Approve and Route", "Deny and Return", etc. And use Relationships to automatically assign the activity based on who is the supervisor of the person approving it. But that's down the road.

It's got several hard coded items in the code like the activity type id, and specific activity status id's but the code is at https://github.com/PalanteJon/org.saintfranciscocc.checkflow

---
Tags: civicase, financial-accounts
---


title: ON site Box Office

text:
# Question
Title: ON site Box Office
How do you sell tickets on-site/at the door? How is it a box office if I cant sell tickets online and at the door.

I have checked the demo out and can not find where this is done.

# Answer
Click on the event and you will see a register button. Click this and you can register people as attendees, which is the same as selling tickets. You could take cash at that point or if you have payment processors set up you can take their card details and take the money that way (or paypal or whatever you choose - just look in the docs for payment processors). For fancy stuff like USB card swiper support, see this page https://civicrm.org/comment/8092#comment-8092
> 3 votes

---
Tags: civievent
---


# Question
Title: How to get the WordPress Username in a contacts or membership export
Is it possible to include the WordPress username in the export of contact & membership details? We would like to include it in a mailmerge for new members who joined by post.

Thanks

Steve

# Answer
> 1 votes
This isn't possible with the built-in export, no. Do you have sql access to the CiviCRM database? The connection between CiviCRM and the CMS is stored in the table `civicrm_uf_match`.

---
Tags: wordpress, civimember, export
---


# Question
Title: To prevent cron emails do I need to redirect output to /dev/null?
My cron job

```
usr/local/bin/wp --user=cronuser --url=https://mysite.org --path=/srv/www/mysite.org/public_html civicrm api job.execute auth=0

```

outputs:

```
Array
(
    [is_error] => 0
    [version] => 3
    [count] => 1
    [values] => 1
)

```

Is there a way to prevent this output without redirecting to /dev/null ? I'd like to get an email if there is a problem.

clarification: I'm really asking how to stop the output (if there are no errors) from the wp-cli command for scheduling civicrm jobs.

# Answer
> 3 votes
What I've done to fix this is create a bash script that executes the civicrm api command, captures the output to a variable, tests for the string \[is\_error\] =\> 0, if there's no match, then it echos the output of the command.

Here's the script:

```
 #!/bin/bash

output=$(/usr/local/bin/wp --user=cronuser --url=https://mysite.org --path=/srv/www/mysite.org/public_html civicrm api job.execute auth=0)

### only print if error is not 0

if [[ $output != *"[is_error] => 0"* ]]
then
  echo "$output";
fi

```

# Answer
> 1 votes
So what you'd want is a "quiet" option that does only spit out a message if it's an error?

I'm not super sure what's the default on cron if there isn't any text, does it send an empty email?

it doesn't exist, but sounds like a good improvement. Do you have coding skills or resources to make it happen?

---
Tags: cron
---


# Question
Title: Contribution updating the wrong members record
We have CiviCRM 4.7.12 working on Wordpress 4.6.1. having no problems other than described below.

For a few months now, we've noticed that occasionally when an existing member renews using PayPal, their contribution record correctly records their contribution (usually twice!), but their membership record is not being updated. Instead, another contact's expired membership record is being updated to show a new membership, without a contribution. When the confirmation receipt is sent to the contact who has made the contribution, it shows the membership new start and end dates of the other contact. We have to do manual changes to both contacts records to put things right.

We have had no contributions off-line for a while to test whether this problem only affects PayPal users.

Has anyone else experienced this and if so how did you correct things please? I'm totally baffled as to why this is happening. I've delayed reporting this for a while because I was hoping that things would correct themselves following 2 or 3 upgrades.

This is a bit similar to Membership creation is altering unrelated records but there has been no answer to that question.

# Answer
> 1 votes
It seems this problem has been reported as a bug at https://issues.civicrm.org/jira/browse/CRM-19594 "Wrong membership Updated"

---
Tags: wordpress, civimember, contributions
---


# Question
Title: Fatal Error on ClassLoader.php : undefined function stream_resolve_include_path()
Has anyone received the following Fatal Error when installing CiviCRM?

```
Fatal error: Call to undefined function stream_resolve_include_path() in
/var/www/html/devCivi/modules/civicrm/CRM/Core/ClassLoader.php on line 194

```

My configuration is

* OS: Linux
* Drupal: 7.44
* CiviCRM: 4.7.12
* Php: 5.3.1

I am pretty new to all of this.

Thank you,

LAE

# Answer
Your PHP version is not supported. The required PHP version is 5.5 (See CiviCRM PHP Requirements ). The function `stream_resolve_include_path()` was introduced in PHP 5.3.2. See PHP.net .
> 1 votes

---
Tags: error, installation, php, civicrm.settings.php
---


title: Report for Unbatched Contributions

text:
# Question
Title: Report for Unbatched Contributions
We use Civi accounting batches to export our contributions to an external accounting program. The office manager has asked me to create a report (in Drupal or Civi) that will **show all contributions that have not yet been put into an accounting batch**. I've made some attempts, but have been unsuccessful. Any help would be greatly appreciated. (Drupal 7; Civi 4.6)

*Drupal attempt:*

We use CiviCRM Entity in a few different ways, especially in Views. We love the module! However, accounting batch data is not available in the current release, 7.x-2.0-beta3. A number of contribution and financial entities are now available in Views, but as far as I can tell, none of them make data from the Batch table available (either directly through their Fields or indirectly through Relationships).

*CiviReport UI attempts:*

Of the standard reports, it seems the Contribution Detail and Bookkeeping reports have access to Batch info already included. Of those two, only the Contribution Detail report has 'Batch Name' included in the filters. (The Extended Reports extension didn't seem to have any reports with extra/different options related to Batch data). The filter type is `CRM_Report_Form::OP_MULTISELECT` so the only two options are "Is one of" and "Is not one of". If I use "Is not one of" and select all of the Batch options, I can get the unbatched contributions, but that doesn't seem realistic, especially as the number of batches continues to grow. Is there a way to automatically select all of the options? Or do I need to dive into the report's code?

# Answer
I found the solution by changing two lines of PHP for the Contribution Detail report (`CRM\Report\Form\Contribute\Detail.php`) and putting it in our Custom PHP directory.

The filters section for the batch name field reads by default (Civi 4.6.20) as follows:

```
  $this->_columns['civicrm_batch']['filters']['bid'] = array(
    'name' => 'id',
    'title' => ts('Batch Name'),
    'type' => CRM_Utils_Type::T_INT,
    'operatorType' => CRM_Report_Form::OP_MULTISELECT,
    'options' => $this->_allBatches,
  );

```

By changing the operator type and commenting out the options, I was able to get a widget with an "Is empty (Null)" option (thanks to the wiki, I knew to look in CRM\_Report\_Form for the possible values.) My code now reads:

```
  $this->_columns['civicrm_batch']['filters']['bid'] = array(
    'name' => 'id',
    'title' => ts('Batch Name'),
    'type' => CRM_Utils_Type::T_INT,
    'operatorType' => CRM_Report_Form::OP_INT,
    //'options' => $this->_allBatches,
  );

```
> 3 votes

---
Tags: civicontribute, civireport, developer, accounting, batches
---


# Question
Title: Mail system in my install is broken: Missing bundle property on entity of type node
I had an install of CiviCRM which had CiviMail and all email working fine. I was using sendgrid to deliver the email, and ran out of credits. Unsent mail had piled up in the Civi system and I attempted to clear caches and temporarily had the system in debug mode. Now I can not send mail via CiviMail nor via individual emails selected from a search, for example. Both give the same error about missing bundle property on entity of type node. The only email I can send is the test of the SMTP server settings from /civicrm/admin/setting/smtp?reset=1

This problem started while running 4.6.16. I attempted an upgrade to 4.7.12 and get the same error, so that did not fix it.

entire backtrace message with minor edits for privacy:

```
LOCATION  http://esoduplicate.evanstonsymphony.org/civicrm/contact/search/advanced?_qf_Email_display=true&qfKey=df6b23737309806ea2bf2ae9b9b9cbc1_2533
REFERRER  http://esoduplicate.evanstonsymphony.org/civicrm/contact/search/advanced?_qf_Advanced_display=true&qfKey=df6b23737309806ea2bf2ae9b9b9cbc1_2533
MESSAGE  $backTrace =
  #0 /path-to-site/sites/all/modules/civicrm/CRM/Core/Error.php(454): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /path-to-site/sites/all/modules/civicrm/CRM/Core/Invoke.php(57): CRM_Core_Error::handleUnhandledException(Object(EntityMalformedException))
  #2 /path-to-site/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:4))
  #3 [internal function](): civicrm_invoke("contact", "search", "advanced")
  #4 /path-to-site/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
  #5 /path-to-site/index.php(21): menu_execute_active_handler() #6 {main}

$Fatal Error Details = array(3) {
  ["message"]=> string(47) "Missing bundle property on entity of type node."
  ["code"]=> NULL
  ["exception"]=> object(EntityMalformedException)#269 (7) {
    ["message":protected]=> string(47) "Missing bundle property on entity of type node."
    ["string":"Exception":private]=> string(0) ""
    ["code":protected]=> int(0)
    ["file":protected]=> string(52) "/path-to-site/includes/common.inc"
    ["line":protected]=> int(7907)
    ["trace":"Exception":private]=> array(21) {
      [0]=> array(4) {
        ["file"]=> string(69) "/path-to-site/modules/field/field.multilingual.inc"
        ["line"]=> int(268)
        ["function"]=> string(18) "entity_extract_ids"
        ["args"]=> array(2) {
          [0]=> string(4) "node"
          [1]=> bool(false)
        }
      }
      [1]=> array(4) {
        ["file"]=> string(59) "/path-to-site/modules/field/field.module"
        ["line"]=> int(941)
        ["function"]=> string(14) "field_language"
        ["args"]=> array(4) {
          [0]=> string(4) "node"
          [1]=> bool(false)
          [2]=> string(4) "body"
          [3]=> NULL
        }
     }
     [2]=> array(4) {
       ["file"]=> string(81) "/path-to-site/sites/all/modules/esoCiviMail/esoCiviMail.module"
       ["line"]=> int(190)
       ["function"]=> string(15) "field_get_items"
       ["args"]=> array(3) {
         [0]=> string(4) "node"
         [1]=> bool(false)
         [2]=> string(4) "body"
       }
     }
     [3]=> array(4) {
       ["file"]=> string(77) "/path-to-site/sites/all/modules/civicrm/CRM/Utils/Hook.php"
       ["line"]=> int(240)
       ["function"]=> string(31) "esoCiviMail_civicrm_tokenValues"
       ["args"]=> array(5) {
         [0]=> &array(1) {
           [2]=> array(9) {
             ["contact_id"]=> string(1) "2"
             ["sort_name"]=> string(11) "Example, Tim"
             ["display_name"]=> string(10) "Tim Example"
             ["do_not_email"]=> string(1) "0"
             ["preferred_mail_format"]=> string(4) "Both"
             ["is_deceased"]=> string(1) "0"
             ["email_id"]=> string(1) "2"
             ["email"]=> string(19) "tim[at]example.com"
             ["on_hold"]=> string(1) "0"
           }
         }
         [1]=> array(1) {
           [0]=> int(2)
         }
         [2]=> NULL
         [3]=> array(0) { }
         [4]=> NULL
       }
     }
     [4]=> array(6) {
       ["file"]=> string(88) "/path-to-site/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php"
       ["line"]=> int(85)
       ["function"]=> string(8) "runHooks"
       ["class"]=> string(14) "CRM_Utils_Hook"
       ["type"]=> string(2) "->"
       ["args"]=> array(9) {

```

# Answer
This doesn't seem to be a problem with the mail system, as you say it's some custom code which prevented mails being generated or sent.

*I see you've identified this - great! And yes, all tokens are generated for each email sent, even if they aren't used - so token generators need to handle situations like this.*

To help others - I've reformatted the backtrace so it's more readable, and removed some personal details (possibly your own).

The real problem here was that the entity, as provided to `field_get_items()`, was being passed as FALSE - perhaps because the module had failed to look up a matching user account?

SO instead of (pseudocode) -

```
$user = esoCiviMail_get_related_user($contact_id);
$foo = field_get_items('user', $user);
// generate tokens

```

you'd want to do

```
if ($user = esoCiviMail_get_related_user($contact_id) {
  $foo = field_get_items('user', $user);
  // generate tokens
}
// else {
//   ... generate "no-result" default tokens
// }

```

Possibly you want the esoCiviMail module to check if a node was correctly found, and if not then return some default (possibly blank) token value to the CiviCRM hook it's implementing.

If the contact really has an email of `tim[at]example.com` instead of `tim@example.com` I'd expect this to trigger some issues.
> 3 votes

# Answer
A custom module triggered this problem.

```
description =  Define custom tokens CiviMail
dependencies[] = civicrm
files[] = esoCiviMail.module

function esoCiviMail_civicrm_tokenValues() /* */
function esoCiviMail_civicrm_tokens(&$tokens) {
// ...
$nid=$node*1; //node id of next concert promo page //
$input_lines="";
// $node does not resolve--THIS IS BROKEN AFTER CONCERT 1
$node = node_load($nid);
$my_field_items = field_get_items('node', $node, 'body');
  if ($my_field_items) {
    $my_field_first_item = reset($my_field_items);
    $input_lines = $my_field_first_item['value'];
  }
}

```
> 1 votes

---
Tags: civimail, email, error
---


# Question
Title: Different default status for different activity types?
Wondering how to do this, it clearly would need an extension (or, as I have done for other things, a Drupal module) but just looking for any tips really.

I would like to be able to specify a default status when defining an activity type. When case workers are with a client they take the opportunity to do whatever they can at the time, whatever presents itself, e.g. refer the client to another organisation, or make copies of documents they brought in. These activities are normally logged at the same time that they are completed. It is annoying for the worker to have to manually set the activity to completed when they log it, they often don't, which results in "scheduled" activities lying around that are actually completed. But other types of activities are genuinely scheduled for the future, e.g. "review" meetings that are automatically generated for certain lengths of time in the future when a client is taken on.

So it would be good if, when defining an activity type, we could state whether it is default completed or default scheduled.

# Answer
Not an answer but rather a kind of half temporary workaround, posting in case someone finds it useful, and beacuse you metioned you are familiar with creating an extension/module.

You can use hook\_civicrm\_buildForm to alter the form status id based on activity type\_id/name, this soultion is **not user friendly** and it **won't work from `standalone` context**, ie when using **Contacts -\> New Activity**, but it can do the trick if you can live with that and don't have a ton of Activities Types.

Hope it helps, and let me know if there's anything unclear.

```
// Implement myextension_civicrm_buildForm
function myextension_civicrm_buildForm( $formName, &$form ){
    if ( $formName == 'CRM_Activity_Form_Activity' ) {
        // Hook only when adding an Activity and the context is not standalone
        if ( $form->getAction() == CRM_Core_Action::ADD && $form->_context != 'standalone' ) {

            // The array that holds the Status and Activities that should have that status by default
            // and the only bit that you'll have to change/upadte when you add more activities and statuses
            $activities = array(
                'Completed' => array( 'Meeting', 'Phone Call' ),
                'No-Show' => array( 'Custom Activity' ),
                'My Custom Status' => ( 'Another Custom Activity', 'Yet Another Custom Activity' )
            );

            foreach ($activities as $status => $activity_types) {
                if ( in_array( $form->_activityTypeName, $activity_types ) ) {
                    // Get status_id by Label
                    $result = civicrm_api3('OptionValue', 'getsingle', array(
                        'sequential' => 1,
                        'option_group_id' => 'activity_status',
                        'label' => $status,
                    ));
                    // Set the default value in the form
                    $defaults['status_id'] = $result['value'];
                    $form->setDefaults($defaults);
                }
            }
        }
    }
}

```

**EDIT** If you want to do the same thing when in `standalone` context you could add some jQuery/JavaScript to the form, see below updated snippet and JS snippet.

```
// Implement myextension_civicrm_buildForm
function myextension_civicrm_buildForm( $formName, &$form ){
    if ( $formName == 'CRM_Activity_Form_Activity' ) {
        // Hook only when adding an Activity and the context is not standalone
        if ( $form->getAction() == CRM_Core_Action::ADD ) {

            // The array that holds the Status and Activities that should have that status by default
            // and the only bit that you'll have to change/upadte when you add more activities and statuses
            $activities = array(
                'Completed' => array( 'Meeting', 'Phone Call' ),
                'No-Show' => array( 'Custom Activity' ),
                'My Custom Status' => ( 'Another Custom Activity', 'Yet Another Custom Activity' )
            );

            if( $form->_context != 'standalone' ){
                foreach ($activities as $status => $activity_types) {
                    if ( in_array( $form->_activityTypeName, $activity_types ) ) {
                        // Get status_id by Label
                        $result = civicrm_api3('OptionValue', 'getsingle', array(
                            'sequential' => 1,
                            'option_group_id' => 'activity_status',
                            'label' => $status,
                        ));
                        // Set the default value in the form
                        $defaults['status_id'] = $result['value'];
                        $form->setDefaults($defaults);
                    }
                }
            } else {
                // Make $activites available in JS
                CRM_Core_Resources::singleton()->addVars( 'myextension', array( 'defaultedActivites' => $activities ) );
                // Add JS script
                CRM_Core_Resources::singleton()->addScriptFile( 'myextension', 'defaultedActivites.js' );
            }
        }
    }
}

// in your JS script => defaultedActivites.js
// Same principle as above, there might a better way to do this JS-wise but that should do it
CRM.$(function($) {
    $( '#activity_type_id' ).change( function(){
        var defaultedActivites = CRM.vars.myextension.defaultedActivites; // Store defaultedActivites
        var activity = $( this ).select2( 'data' ); // Get the select2 Activity object, ie Activty type
        $.each( defaultedActivites, function( status, activityTypes ){
            activityTypes.map( function( currentActivity ){
                if( currentActivity == activity.text ){
                    // Get status_id by label
                    CRM.api3( 'OptionValue', 'getsingle', {
                        'sequential': 1,
                        'option_group_id': 'activity_status',
                        'label': status
                    }).done( function( statusId ) {
                        // Set default value
                        $("#status_id").val( statusId.value ).trigger("change");
                    });
                }
            })
        })
    });
});

```
> 3 votes

---
Tags: drupal, extension, civicase, activities
---


# Question
Title: Hacked getContactRelationshipSelector in core, how do I implement as an extension?
I'm looking to show additional fields in the relationship tab for contacts (e.g. Job Title) - the fields are part of the relationship object, but aren't defined in getContactRelationshipSelector (CRM\Contact\BAO\Relationship.php) and attempting to use them as columns in the table via editing the template gives an error.

Adding the fields here in getContactRelationshipSelector makes everything work:

```
 $relationship['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
        $relationship['end_date'] = CRM_Utils_Date::customFormat($values['end_date']);
        $relationship['city'] = $values['city'];
        $relationship['state'] = $values['state'];
        $relationship['email'] = $values['email'];
        $relationship['phone'] = $values['phone'];
        $relationship['job_title'] = $values['job_title'];
        $relationship['links'] = $values['action'];

        array_push($contactRelationships, $relationship);

```

I started making an extension to implement hook\_getContactRelationshipSelector - but this doesn't seem to exist, or at least there's no reference to it in the documentation and test code didn't seem to do anything.

Not sure how to proceed with implementing this properly as an extension, any tips would be appreciated.

# Answer
> 1 votes
Since this function is used from an ajax callback, your extension could do 2 things:

1. Override the template, which allows you to specify a different ajax path for the dt.
2. Create your own ajax callback which starts by calling that function, then appends its own data.

# Answer
> 0 votes
You can use custom fields for this. You will need to create a relationship type (Administer-\>Customise Data and Fields-\>Relationship Types) first and then define some custom fields on it (Administer-\>Customise Data and Fields-\>Custom Fields).

When you add a new relationship to a contact, select the relationship type you want and the new fields will be on it.

---
Tags: extension, hooks, core
---


# Question
Title: Has anyone experienced member receipts not being sent out all the time when sending from the back end of a membership record?
We are using 4.7.11 and Drupal 7

Our client is having issues where they try to send out a member receipt/confirmation from the backend of a member record. Sometimes the receipt gets sent but other times it does not. They recently upgraded their version of CiviCRM and it was not happening in the previous version.

Has anyone experienced anything similar and if so what is the solution?

# Answer
> 2 votes
Likely you'll find the answers you need in the CiviCRM debug log. Also check your server's mail logs to confirm what's actually happening, so you can identify whether there's an issue with the email being *generated* or *delivered*.

It's possibly an issue with a customised message template not being valid Smarty - we've seen this affect Smarty templates before, which use `{` / `}` to denote template markup and are not validated when edited through CiviCRM.

As a result it's very easy for admin users to unknowingly include CSS or JS in the message templates, not knowing the template will fail when executed in context of a system email.

---
Tags: civimember
---


# Question
Title: CiviMail links with to many clicks from only two people
In a recent CiviMail out, I had one link with 226 clicks but only 9 unique clicks. Two people made up the majority of those clicks. It hasn't happened again, just wondering if this is a recurring problem for anyone?

# Answer
Seems plausible, especially if you consider scenarios like two influential users who might have forwarded the email to a group of friends, but also through normal use (eg repeatedly clicking from an email while thinking about donating) or something else.

You could review logfiles to see whether the times and remote hosts of the clicks recorded suggest an issue in tracking, whether the visitors all came from the same origin IP, and whether the timing of the visits suggests any further information.
> 2 votes

---
Tags: civimail, tracked-links
---


title: How to remove 'view' link in reports?

text:
# Question
Title: How to remove 'view' link in reports?
Can't seem to find an answer. Exporting PDF and Print reports for event check-in sheet at the front door. Want to either remove the link or the default Last/First name column to stop the 'view' link from appearing.

Howto?

# Answer
To address this in the browser view, you should be able to target those links with a CSS selector.

Eg, for this report on the demo site -

you can hide the View/Edit/Delete links by targetting `.action-item`. You'll need to restrict this CSS to the report in question, so you might want to look at using `.extra.tpl` to achieve this.

You can also directly do this in the browser console before printing.

```
CRM.$('.action-item').remove();

```
> 1 votes

# Answer
I believe the way to do what youre talking about will be to alter your CRM/Report/Form/Event/*report you are using*.php file.

The alterDisplay function is formatting the display name as links by default.
> 0 votes

# Answer
Using the "Find Participants" report, are you aware that the "Print " view will make a print format version for you? Try this via the event "Find Participants" view (eg here on demo).
> 0 votes

---
Tags: civireport, links, column
---


# Question
Title: Add Custom Fields to Send Email Activity
Our development staff are using activities for tracking moves management. We've created a custom set of "moves management action types" and have added those to appropriate civicrm activities. I can't, however, figure out if there is a way to assign custom fields to the "Send an Email" activity type. I'd like to be able to assign the same action types to the "Send an Email" activity type for reporting purposes.

Anyone have any ideas how to do this, or an alternative approach?

Thanks!

-tim

# Answer
Tim, as far as I know, you can't currently add custom fields to the built-in Send an Email activity.

An alternative approach would be to use the scheduled reminder functionality.

1. create a new activity type for this email and create a scheduled reminder for this new activity type when status = completed (or some other suitable status) and time = '0 hours after activity date time'
2. You have access to all activity fields and custom fields as tokens in the scheduled reminder field so the simplest approach would be to include {activity.subject} as the email subject and put {activity.details} in the body.
3. Give it a go. I'd be interested to know if this approach works for you. In theory, it should work but I have not implemented it in practice.
> 4 votes

# Answer
Another option - if you are using Drupal - would be to have the team entering the data through a Webform which then gives you greater finesse in terms of what gets sent to whom by way of emails.

(Note: currently there is a patch (RBTC) required in order to get the Contact ID of an existing Contact rendered as the Display Name - https://www.drupal.org/node/2672482)
> 1 votes

---
Tags: email, activities
---


title: auto-renew required is not enforced

text:
# Question
Title: auto-renew required is not enforced
I have auto-renew required set in my membership types, but users are able to uncheck this and continue to join as non-auto-renew. I've cleared all caches server and client side.

Since it's required, I'd expect to see a red asterisk next to the checkbox, or see that the checkbox checked, and greyed out. Neither of these happen.

Is there something else I need to set other than the setting in membership types?

Thanks

Affects versions:

Civi 4.6.23

Civi 4.7.13

Drupal 7

# Answer
This is a bug affecting versions 4.6.23 and 4.7.13.

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

---
Tags: civimember, recurring-contributions
---


# Question
Title: CiviMail - How to include an Image in a Header
If I want to include an image in a mail, I have the WYSYWYG CKEditor which enables me to do that.

But how can I include an Image in a CiviMail Header ?

# Answer
> 5 votes
In the headers and the footers you don not have the convenience of a WYSYWYG editor. So you have to write HTML. An example of including the logo in the footer is:

```
 <br/>
 <img src='https://<site>/sites/default/files/logosite.png'/>

```

However you can create an example mail in de WYSYWYG editor and then use the *Source* button to examine the generated HTML code. Use this as an example and copy the relevant code bits.

---
Tags: civimail
---


# Question
Title: How to setup cron for updating membership statuses in cPanel
How do I setup cron (via cPanel) to execute, specifically membership statuses? I.e. I know how to get to cPanel's cron management, but not sure how I tell that cron management tool to execute the membership status cron as setup inside of drupal. An example for doing that (and to run all of them) would be nice. :-)

I've read the CiviCRM manual for membership status AND watched the cPanel video, but really need an example for doing specifically the above, and with that information I think I can construct all the others I need.

Using CiviCRM 4.7.13, Drupal 7.51

Thanks,

Carl

# Answer
I've expanded Kainuk's SOLUTION here (thanks Kainuk!): To start executing civicrm jobs without doing them one-time-only as done with Sheduled Jobs List (Civicrm \> Administer \> System Settings \> Scheduled Jobs), then its easiest just to install drupal's module, civicrm\_cron and it will automatically start executing the jobs on your scheduled jobs list. This is much easier than doing this at the command line or inside of cPanel. For even finer grain control of your scheduled jobs, you can use elysia cron.
> 2 votes

# Answer
I get the impression from the cPanel documentation that cPanel is able to run a php script on a scheduled time. Using this you can execute all scheduled jobs from CiviCRM with the php command line interface as documented in PHP cli method. On the same page you can find a lot other scheduling mechanisms like calling an url.

And if you got the drupal cron working you can build on this success by using the Drupal module CiviCRM Cron.
> 1 votes

---
Tags: cron-job
---


title: How to remove "Extended Demographics"?

text:
# Question
Title: How to remove "Extended Demographics"?
Years ago we tried out CiviHR and it added something which looks like a set of custom fields, called "Extended Demographics". We uninstalled the extension but this did not go away. I can't find anywhere in Civi settings how to disable or remove it. I've ignored it till now but we are about to give a lot more people access to Civi and it will confuse people having irrelevant (and very personal!) fiends on there.

I suspect it was a bug in CiviHR that caused it to be left behind. If I want to remove it from the database using MySQL (which I am very familiar with) then is there anything I need to know so I don't break anything? We have backups, but the less blindly I can bash at the live site the better.

Obvs if there is a setting I've missed that would be much better

# Answer
The easiest would be if you can find it in the CiviCRM custom groups? Using Administer/Customize Data and Screens/Custom Fields. If that does not work, check the table civicrm\_custom\_group. You will probably see an entry there with the column name 'is\_reserved' having the value 1. If that is the case, change the value for 'is\_reserved' to 0 and check if you can see the custom group in the Administer menu now?

This would be the best way as you would delete all that you want to delete. If that fails, shout again?
> 5 votes

---
Tags: custom-fields, extension, sql, civihr
---


title: Bulk Import of Membership Dues

text:
# Question
Title: Bulk Import of Membership Dues
Hi this is our first season with CiviCRM. Our data is uploaded and getting to grips with updating processes.

Our process is annual membership collected in cash and banked in tranches.

The user front end is not really appropriate for the bulk process, manually looking up a member, renewing the membership with a contribution - which is slow enough - but then we need to go to the contribution to record a custom field ( banking id ) for later reconciliation.

A lot faster process would be to work off a downloaded spreadsheet, removing non paid members, and then uploading the contributions & membership.

But, as far as I can see, simply uploading the contributions through import process does not renew that membership - and bulk uploading memberships do not link to contributions.

I guess many orgs bulk upload contribution / memberships - how is this best achieved?

# Answer
It sounds like your process of importing memberships via CSV and contributions via CSV works - except that your contributions and memberships aren't linked.

If that's correct, I've resolved this when doing migrations as follows:

* Create a custom field for contributions called "external serial" or similar.
* Create a custom field for memberships also called "external serial".
* Add a serial number column to your CSV (if one doesn't already exist) before importing it as contributions/memberships. The only important part is that each row have a unique identifier.
* After import, you can use the shared identifier to create a new CSV with just two columns - membership\_id and contribution\_id (as CiviCRM assigned them). I typically would do this via SQL. Something like this:

```
SELECT cc.id AS contribution_id, cm.id AS membership_id
FROM civicrm_contribution cc
JOIN civicrm_value_importfieldcc_1 cvi1 ON cc.id = cvi1.entity_id
JOIN civicrm_value_importfieldcm_2 cvi2 ON cvi1.external_serial_1 = cvi2.external_serial_2
JOIN civicrm_membership cm ON cvi2.entity_id = cm.id

```
* Create membership payments using this new CSV to link the memberships/contributions. You can do that with the API CSV Import GUI extension or the command-line tool that ships with CiviCRM.
> 6 votes

# Answer
It seems you could do this by a batch entry of membership payments, the instructions for which are in the documentation at https://docs.civicrm.org/user/en/stable/contributions/manual-entry-of-contributions/

There is quite a bit to read in there but scroll down to "Configuring Profiles for Batch Entry of Contribution, Membership and Pledge Payments" where you should find all the information you may need.

The process uses a reserved profile "Membership Bulk Entry" in Administer\>Customise Data\>Profiles\>Reseved Profiles

Hope this helps.
> 2 votes

---
Tags: import, contributions
---


title: Bulk re assigment of relationships

text:
# Question
Title: Bulk re assigment of relationships
If you have a large number of contacts managed by one 'volunteer rep' as a relationship, when that rep leaves then there is a lot of cumbersome manual data entry.

I have looked and I can't find any built in reassigment function.

All I have worked out is as potential approaches 1. user heavy - run the relationship report - download a csv, change something and import 2. do it in the database directly

both not really satisfactory

Any ideas / approaches / am I missing something?

# Answer
> 1 votes
More of a thought than an answer (and really off the top of my head) - try using the Merge Contacts option, have the person with existing Relationships on the left, newbie on the right, untick all boxes other than Relationships, Merge.

Revisit your 'deleted' contact and undelete them - does it restore the relationships to them (I don't think so). Does this achieve what you need? Pls report back.

---
Tags: import, relationships
---


# Question
Title: Can Drupal Views filter contacts based on Smart Groups
Taking the liberty of creating this new ticket since the previously similarly titled (since retitled by me) post was not really addressing the issue.

Laryn is correct when he said on the above post that

> From what I can tell, this stale issue in JIRA is as far as it went towards integrating Civi Smart Groups into Views.

A lot of the discussion occurred in this forum post.

I am hoping a current project will help/force us to get back to this. But at this point the question is has anyone else either worked on this, or need this and could help fund us to deliver it.

# Answer
There is a module in development here https://github.com/fuzionnz/civicrm\_views\_smartgroup

It comes in two flavours (as separate branches) — a simple and complex variety — that differ only in their implementation. For small databases, the simple version is recommended and is more robust. The complex version speeds up Views and is required for large databases with lots of group contacts, but pays a penalty in being less robust. Unfortunately, mysql's lack of materialised views makes this necessary.
> 3 votes

---
Tags: drupal-views, smartgroups
---


title: Is there a way to customize CiviCRM UI?

text:
# Question
Title: Is there a way to customize CiviCRM UI?
I am running a fresh site CiviCRM with Drupal. I am very new to CiviCRM and Drupal too.. I am in need up building an intranet CRM application that can look like a professional CRM applications. I am very much glad with the functionalities that CiviCRM provides. However as per the look and feel, I wanted to make it more intuitive for the users. My questions are:

1. Can I enhance the look and feel of CiviCRM aesthetically?
2. If yes, what are the means and ways to do it.
3. Please advise the best recommended way.
4. Guide me to some of the videos that can teach how to achieve this.

Thank You.

# Answer
> 3 votes
This is a really broad question, and without some guidance as to what you consider a "professional CRM applications" looks like it is tricky one to answer.

That said, with Drupal we often built out a UI via Views and Webforms that can keep all the but the hardcore admins out of civicrm entirely - depending of course on what the extent of their requirements are.

This may be an easier path for you to explore than rebuilding the civicrm ui directly.

# Answer
> 2 votes
I agree with Pete - try to be as specific as possible and indicate which easily available information (e.g. on the CiviCRM handbook) you have already found & considered.

That being said, CiviCRM's appearance/look & feel can be changed by using another drupal theme. You could use one that you like (we have been using boostrap as well as the AT adaptive theme) and adapt/extend it.

Note that you can set a separate theme for CiviCRM backend, CiviCRM public pages and your CMS' other pages.

---
Tags: drupal, ui, user-interface
---


# Question
Title: Upgrade from 4.6.20 to 4.6.21 fails with fatal error (sqlfile not found)
We're using D7 / Civi 4.6.20, attempted to upgrade to 4.6.21 following the Civi upgrade documentation. The upgrade errors out with this error:

Exception: "A fatal error was triggered: sqlfile - 4.6.21.mysql not found."

I tried reloading my pre-upgrade database and repeating, but got the same error.

Backtrace:

```
#0 SITEROOT/sites/all/modules/civicrm/CRM/Upgrade/Form.php(432): CRM_Core_Error::fatal("sqlfile - 4.6.21.mysql not found.")
#1 SITEROOT/sites/all/modules/civicrm/CRM/Upgrade/Incremental/php/FourSix.php(86): CRM_Upgrade_Form->processSQL("4.6.21")
#2 [internal function](): CRM_Upgrade_Incremental_php_FourSix::task_4_6_x_runSql(Object(CRM_Queue_TaskContext), "4.6.21")
#3 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Task.php(88): call_user_func_array((Array:2), (Array:2))
#4 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Runner.php(214): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
#5 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(52): CRM_Queue_Runner->runNext(TRUE)
#6 SITEROOT/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php(106): {closure}()
#7 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(54): CRM_Queue_ErrorPolicy->call(Object(Closure))
#8 [internal function](): CRM_Queue_Page_AJAX::runNext()
#9 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(278): call_user_func((Array:2))
#10 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
#11 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:5))
#12 SITEROOT/sites/all/modules/civicrm/drupal/civicrm.module(482): CRM_Core_Invoke::invoke((Array:5))
#13 [internal function](): civicrm_invoke("upgrade", "queue", "ajax", "runNext")
#14 SITEROOT/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:4))
#15 SITEROOT/index.php(21): menu_execute_active_handler()
#16 {main}

```

I searched and couldn't find a file called 4.6.21.mysql but I did find /sites/all/modules/civicrm/CRM/Upgrade/Incremental/sql/4.6.21.mysql.tpl.

Any advice? Thanks in advance!

# Answer
I would recommend you grab this file https://github.com/civicrm/civicrm-core/blob/4.6/CRM/Upgrade/Incremental/sql/4.6.21.mysql.tpl and then save it into same path within your civicrm dir i.e. in CRM/Upgrade/Incremental/sql/

Once you have done that re-load your pre-upgrade database and run the upgrade again.

Should be all good then
> 1 votes

# Answer
Looking at the source code for the processSQL function in CRM\_Upgrade\_Form, I can see that it works like this:

* Given a revision (in this case, `4.6.21`), it looks for `Incremental/sql/4.6.21.mysql.tpl`.
* If that file is NOT found, it looks for `Incremental/sql/4.6.21.mysql`.
* If it finds neither, it returns the error you saw.

Here's what you can try: * Please check the file owner/permissions of this file to ensure it can be read by your web server user. * Ensure it's looking for the right file in the right place. Try putting this line into `CRM/Upgrade/Form.php` at line 426:

```
CRM_Core_Error::debug_var("tplFile", $tplFile);

```

Then, on upgrade, watch your debug logs (usually at `<drupalroot>/sites/default/civicrm/ConfigAndLog`) to see the value of `tplFile`. Please update your question if it seems to be looking for the wrong file.
> 0 votes

---
Tags: upgrade, mysql
---


# Question
Title: DB Error: constraint violation when attempting to delete custom field
This is on CiviCRM 4.7.13 and WP 4.6.1.

I can add custom fields and custom data sets, but any attempt to delete a custom field hangs and does not complete. The log then contains this:

```
Nov 05 11:47:00  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_civicrm`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_civicrm`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`yfc_civicrm`.`civicrm_custom_value`, CONSTRAINT `FK_civicrm_custom_value_custom_field_id` FOREIGN KEY (`custom_field_id`) REFERENCES `civicrm_custom_field` (`id`))]"]
)

Nov 05 11:47:00  [info] $backTrace = #0 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(229): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: constraint violation", -3, 16, (Array:2), "DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [n...")
#4 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-3, 16, (Array:2), "DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [n...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -3, NULL, NULL, "DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [n...", "DB_Error", TRUE)
#6 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 )  [n...", "DB_Error", TRUE)
#9 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-3, NULL, NULL, NULL, "1451 ** Cannot delete or update a parent row: a foreign key constraint fails ...")
#10 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 ) ")
#12 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2438): DB_common->query("DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 ) ")
#13 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1449): DB_DataObject->_query("DELETE FROM civicrm_custom_field  WHERE (  civicrm_custom_field.id = 10 ) ")
#14 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(524): DB_DataObject->delete(FALSE)
#15 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/CustomField.php(1128): CRM_Core_DAO->delete()
#16 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Custom/Form/DeleteField.php(104): CRM_Core_BAO_CustomField::deleteField(Object(CRM_Core_DAO_CustomField))
#17 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(431): CRM_Custom_Form_DeleteField->postProcess()
#18 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
#19 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Custom_Form_DeleteField), "next", "Next")
#20 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Custom_Form_DeleteField), "next")
#21 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Custom_Form_DeleteField), "next")
#22 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
#23 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Custom/Page/Field.php(264): CRM_Core_Controller->run()
#24 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Custom_Page_Field->run((Array:5), NULL)
#25 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:14))
#26 /home/user/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:5))
#27 /home/user/wordpress/wp-content/plugins/civicrm/civicrm.php(1227): CRM_Core_Invoke::invoke((Array:5))
#28 [internal function](): CiviCRM_For_WordPress->invoke("")
#29 /home/user/wordpress/wp-includes/plugin.php(524): call_user_func_array((Array:2), (Array:1))
#30 /home/user/wordpress/wp-admin/admin.php(222): do_action("toplevel_page_CiviCRM")
#31 {main}

```

I'm concerned that the DB is mangled somehow. Any suggestions?

Edit: @Sleewok - Yes.

I have been working with the schema harmonizer and finding that it does not check the custom data tables. How does one determine if there are schema errors in custom data?

# Answer
Congratulations on your very long-lived CiviCRM installation! You're seeing a problem that very few will.

`civicrm_custom_value` is a table that hasn't existed in CiviCRM since around version 2.0. If you do a Google search, you'll only find references to it from around 2007-2009. There are no references to it in the 4.7 code base.

Somewhere along the line, this database missed some piece of code that removed this table. Or more likely, someone restored a backup sometime last decade that brought the table in after it should have been gone. And there it stayed until one day its foreign key constraints tripped you up.

I would back up your database, then delete the `civicrm_custom_value` table.
> 1 votes

---
Tags: custom-fields
---


title: Duplicate Contact Problem

text:
# Question
Title: Duplicate Contact Problem
The new individual record is created, written phone number. When registration opened again with a new phone number can be the same individual. Telephone number of systems with the same record, I want to prevent the creation of new personal record. I do not want this to happen Duplicate Contacts How can I make this setting.

Joomla! 3.6.4 CiviCRM Ver: 4.7.12

# Answer
You need to set the deduplication rule to match what you need. Not sure I completely understood your use case, but it seems that you have included the phone number on your default unsupervised dedupe rule?

Check this chapter in the book if the dedupe rules are not clear for you yet, it's powerful, but takes a while to use them properly and a common source of duplicates being created.

https://docs.civicrm.org/user/en/4.6/common-workflows/deduping-and-merging/
> 1 votes

---
Tags: contacts, joomla, duplicate-contacts
---


# Question
Title: Civimail - How to manage Headers, Footers, ... in Message Templates?
My CiviCRM manages several organisations, each having their own Header, Footer, ...

I would like to create at least one Message Template for each of them, each Template having its own Header, Footer, ...

How can I do that ? If I can't, what is the use of Headers, Footers, ... ; how can I choose between different ones ?

# Answer
The header and footers are used for civimail, the usual way is to have templates that don't contain any header or footer but choose them when you compose the email

Another option you might consider is the new mosaico extension, that should make it easier to style your mailings
> 1 votes

---
Tags: civimail
---


# Question
Title: Drupal Webform / CiviEvent showing private events and closed registration events
We are using Drupal Webforms to allow people to register for CiviEvents. We are using the Live Options setting for the Event Selection. Our issue is that we are seeing in the Live Options list events that are PRIVATE (not marked public) and events that have registration closed. The only way to stop them from showing is to make them inactive events. This then causes all schedule reminders to stop being sent.

Question: Other than use Static Options, how to we make events that are private and/or no longer open for registration stop showing?

CiviCRM 4.7.6 and Drupal 7.51

Thanks! Sheila

# Answer
> 1 votes
If your organization can fund an hour or two of development via the paid issue queue we could get that filter added to the webform-civicrm module to prevent unwanted events from showing.

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


title: Making name badges for an event

text:
# Question
Title: Making name badges for an event
I have a few Name Badge Formats entered in admin \> system settings \> option groups \> name badge formats. One is a custom one that I've created and there are a few that were already there.

The Problem I'm having is that when I go to manage events and try to select a name badge format the select list has no options, I have no way of choosing anything. Is there something I need to do to enable these formats? If so, I'm not seeing that option anywhere.

# Answer
> 2 votes
I think you need to define your Name Badge formats at **Administer menu \>\> CiviEvent \>\> Event Name Badge Layouts** and not the "Option Groups" section.

---
Tags: civievent
---


# Question
Title: Logout from your CMS to avoid session conflicts
I'm following this guide. After I did `gitify wordpress --hooks` and followed the instruction to fill up `setup.conf` file. Then I did `./setup.sh -Dg` as prompted and this is when I get error - `NOTE: Logout from your CMS to avoid session conflicts.`

I tried logging out from my wordpress local admin account, but to no avail. Any ideas?

# Answer
> 1 votes
That's not an error message. When the `setup.sh` script outputs "NOTE: Logout from your CMS to avoid session conflicts." then it has successfully completed. You may proceed to log in and begin using CiviCRM.

---
Tags: wordpress
---


# Question
Title: Need help in getting quote for security upgrades
We are a small non-profit using CiviCRM. We are currently being charged a lot for security upgrades and monitoring. We are trying to understand pricing and what we actually need. We want to change companies. Will we have to spend a lot on 'migration'? What elements do we need to get in a quote to compare apples to apples?

# Answer
It can be time consuming and thus expensive to do security upgrades, especially on a site that has custom code. Monitoring requires some setup and sometimes an ability to respond quickly when something goes wrong.

Some providers bundle these services with hosting. Others provide them without the hosting.

I would compare the full cost of migration + hosting + security upgrades + monitoring between providers. You might also find that your site doesn't need every security upgrade - ask about options here since some providers want to upgrade all sites on every security release, while others will evaluate if the security vulnerability applies to your site given its configuration. And you might be willing to risk your site having troubles or being offline for a while before you notice in order to save some money on monitoring.

Migrating a site to a new server can be fairly simple, or sometimes not, depending alot on the server setups and the age of the site. Moving from an old server with an old CMS to a new one might cause issues with version of PHP for some custom or old Drupal 6 modules, etc. However, some hosting providers are willing to do the migration for free on the expectation that the costs can be amortized over the length of your time hosting with them.
> 4 votes

---
Tags: security, hosting
---


title: Mass change of primary email address

text:
# Question
Title: Mass change of primary email address
I've recently imported about 10,000 records into our database, many of them adding an additional work email address to our existing contacts whose home email address we used to contact.

When the new work addresses were imported, it seems that many/most contacts now have their new work email as their primary.

Is there any way to change the users' primary email to their home one, en masse?

# Answer
> 1 votes
Yes, making use of the api you can change more or less any data. Test it by accessing the api explorer under \<your\_installation\>/civicrm/api.

1. First check getting emails in question.
2. Then try out setting parameters like you want.
3. Combine the calls to either a php script or use api chaining in the api explorer.

Keep in mind that get operations are limited to 25 results by default and that update operations may harm your data – even in the api explorer.

If you have questions consider Using the API or ask here.

---
Tags: contacts
---


# Question
Title: CiviCRM Wordpress Cron not running - DB Error connect failed
I've installed CiviCRM in one of my Wordpress site, It installed fine but it is showing me popup window that "No Cron is running", i've tried to setup Cron from my Cpanel with PHP-CLi method, I use this command:

```
/usr/local/bin/php /home/thetia/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php  -s thetia.com.au -u database_user -p database_user_password -e Job -a execute

```

When cron executes it send me Email with following error:

Sorry but we are not able to provide this at the moment.

```
DB Error: connect failed

```

I'm providing right username and password but even then it is showing me this error, i don't know what am i doing wrong, any help will be very appreciable.

# Answer
> 1 votes
The reference for cli is Manage Scheduled Jobs. It tells

> This method requires a valid Username and Password (for a Drupal, Joomla or **WordPress** user who has adequate permissions for the job or jobs being run).

So try to run it with a Wordpress user and password.

---
Tags: wordpress, cron, cli
---


# Question
Title: Bug datepicker field when more than one on contribution page
I have civicrm installed on wordpress I have a issue with datepicker field When i put only one datepicker field it's works well But if i insert more than one datepicker field in a form, the datepicker field are breaked. I have try with a fresh install on new versions of civicrm and wordpress and i have the same problem.

Could you help me to solve this issue

Thanks !

# Answer
Hello you can see here the way my datepicker field are displayed when two are on the same form.

This bug is also present with a fresh install

Thanks for help
> -1 votes

# Answer
I have found This is a civcrm bug when you specify a range of year in custom datefield, the field is broken
> -1 votes

---
Tags: fields, jquery
---


# Question
Title: CiviCRM Webform : Select field used to use autofill
I want to use 3 fields (name, surname, phone number) to search existing contact and then autofill other fields. I don't find how to specify how to map the CiviCRM field to search, nor how to define 3 fields used to search.

Is it possible? And how ?

Thank you for your help.

Regards.

Olivier.

# Answer
> 2 votes
This is not exactly what you describe but may suit your purposes or at least give you something to go on.

1. In the CiviCRM tab of the webform builder, enable CiviCRM processing. For Contact 1, tick Existing Contact and a few other fields (try including some address fields for example).
2. Go to the Webform tab and click Edit next to the Existing Contact component. Set it to Autocomplete and then in the Contact Display Fields box, use Cntrl-Click to add a bunch of fields that match the ones you picked on the CiviCRM tab.

Go to View and now you should find that it works kind of like you describe. Start typing in the box and contacts should appear with First Name, Last name and email all in the box and when you pick one the other fields should populate.

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


# Question
Title: Mail Merge Codes per Price Set Option (Name Badges)
We would like to print name badges for our events using CiviCRM.

However, we use complex price sets, and we use "Codes" printed on our name badges for access to certain events.

Is there a way to use CiviCRM to merge price set options onto name tags?

We ended up using Excel and a lot of complicated formulas.

However, if every price set option could have a "Name Badge Code" field, and we could print those on the CiviCRM Name Badge, or even just export them in a price set report, that would substantially reduce our efforts.

Anyone ever face this issue?

# Answer
I ended up using the Custom Search: Price Set Export, then used Excel Formulas, and then a Microsoft Word Mail Merge. Ew!
> 1 votes

---
Tags: price-sets
---


title: PayPal Standard Not Being Called

text:
# Question
Title: PayPal Standard Not Being Called
I have a CiviCRM test site running on 4.7.12 which requires the Gift Memberships extension https://civicrm.org/extensions/gift-memberships

I realise that Gift Memberships is only compatible up to 4.6 but it matches our requirement perfectly so I thought I would give it a go and see if it worked.

Everything appears to be working correctly apart from one major flaw, when using the contribution page containing the Gift Membership price set the browser isn't redirected to PayPal (PayPal Standard sandbox) and simply skips straight to the Thank You page.

I also notice that the contribution id is set to 0 in the civicrm\_gift\_memberships\_codes table, consequently the email contains all codes rather than just the ones associated with the contribution.

I've only just got under the hood of Civi so I'm a bit out of my depth. Normal membership contributions are working correctly and, using Smarty debug, I can't see anything in the confirm form which looks significantly different.

I assume there is a change between 4.6 & 4.7 which this code isn't coping with so I'm wondering if anyone has had any success with Gift Membership under 4.7 or might be able to point me in the right direction?

Thanks

Steve

# Answer
Are you trying this in your local devbox or system - Is your instance accessible to outside world?

If No, then you need to test the same against a different server

Paypal standard needs a server open to outside world - I did the same test yesterday without any problem against Civicrm 4.7.12 - which worked alright

I guess this helps!!!
> 1 votes

---
Tags: civicontribute, paypal
---


# Question
Title: How can I efficiently dedupe a very large number of records?
I'm working on a database with about 600,000 records, of which approximately 200,000 are believed to be duplicates.

Has anyone got experience/advice for doing dedupe at scale? I imagine that we'll need to export and do some sort of external dedupe. Has anyone successfully used the datamade dedupe with Civi? I know that the "merge" API got some love a couple months ago - will any of that help me?

# Answer
We did a lot of work to the dedupe processes in CiviCRM and in 4.7 its a much easier process to de-dupe large databases then it used to be. It was presented by Eileen in this years London CiviCon, worth a look before you get into trying to do it outside of CiviCRM with all the pitfalls that brings with it!
> 3 votes

---
Tags: duplicate-contacts
---


title: Suscpicious Database Errors

text:
# Question
Title: Suscpicious Database Errors
In my installation I firstly recognized database errors like described in CiviCRM issue CRM-19109: Draft mailings are not saved. In a fresh local installation (Ubuntu 16.04LTS, php 5.6, mysql 5.7.13, Drupal 7.50) even more database errors came up.

Digging into the MySQL database showed error messages like:

```
SELECT  id, component_type
FROM    civicrm_mailing_component
WHERE   is_active = 1
AND     is_default = 1
GROUP BY component_type LIMIT 0, 25

```

MySQL said:

> ***#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database\_civicrm7.civicrm\_mailing\_component.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql\_mode=only\_full\_group\_by***

I found that since MySQL 5.7.5 the default value for "sql\_mode" is "ONLY\_FULL\_GROUP\_BY" and this causes the problems with CiviCRM database and CiviCRM SQL queries.

In my local installation I added in `/etc/mysql/mysql.conf.d/mysqld.cnf/mysqld.cnf`

```
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"

```

… no more problems so far.

The issue is addressed here:

# Answer
This issue was fixed in CiviCRM 4.7.10.

If you are using an earlier version of CiviCRM (e.g. 4.6), one option is to stick to an earlier version of MySQL (e.g. 5.6).

Alternatively, as stated in the question, you can fix this problem by adding a custom config file for MySQL. I used the following file:

```
[mysqld]
# Turn off 'ONLY_FULL_GROUP_BY' option as this breaks CiviCRM < 4.7.10
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

```

Rather than using my settings, I suggest that you check your current SQL mode with the following query:

```
SELECT @@SQL_MODE;

```

Copy the results of this query into the file above without `ONLY_FULL_GROUP_BY`.
> 1 votes

---
Tags: error, installation, mysql
---


# Question
Title: Can we use a Relationship between 2 contacts, once in either direction?
Goal is to let X "favourite" Y and vice versa

But seems that civi won't let us do both between the same two contacts, ie we cannot let X favourite Y and at same time have Y favourites X.

Is it meant to be impossible to have 2 people with same relationship twice, once in either direction?

# Answer
This is now possible and there is a patch to optionally allow bi-directional relationships in JIRA
> 1 votes

# Answer
Doing some research on your find using svn blame and svn log on the old svn repo, this appears to have been implemented as part of https://issues.civicrm.org/jira/browse/CRM-58, and the key comment is

i.e. if there is "Parent" relationship between 2 contacts then you cannot add another relationship "child " between them.

The code for this is also what's stopping adding the second "favourite". So it seems like the checking is too aggressive - makes sense to prevent the parent being a child of their spouse (except in some geographical regions where it might be true (grin)), but not your use-case.
> 3 votes

---
Tags: relationships
---


# Question
Title: Current members in expired membership search results
In our database, if expired members 'renew' (or rejoin) after their grace period, on their contact page, on the memberships tab, it shows both an expired membership and a current one. That is correct, I suppose.

If we then do a search for expired members, the rejoined member shows up. That is also correct. We would have to remember to always search for 'expired members - current members' to find those members that have expired and never rejoined.

People are going to forget this. What is the best way to help my client to not forget this ?

# Answer
You don't say how many membership types you have, so I will assume that you only have one.

You could create one smart group (SG1) with criteria Membership status = expired and another (SG2) with membership status of new or current. (And perhaps Grace depending on whether you want those people excluded from your final smart group or not.)

Then you can use the custom search **Include / Exclude Search** including SG1 and excluding SG2 to define a third smart group that you clearly label as the group to be used when ex-members are required.
> 1 votes

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


title: How to use the REST API with curl

text:
# Question
Title: How to use the REST API with curl
Ok - it's my first time diving into REST API - First of all trying to get it to return me just the data for one specific contact. It works great in the browser but on the command line no matter what I try I keep getting the data for the first 25 contact\_ids in the civicrm\_contact table; it's simply ignoring my very specific attempts to just give me contact\_id: 358383;

I've tried \[and they all return data for the first 25 contact\_ids in either json or xml - that all works fine\]:

CiviCRM 4.6 LTS - and Drupal 7.x

```
curl -i -H "Content-Type: application/json" -X POST -d '{"contact_id":"358383"}' "https://example.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=XXX&key=XXX"

curl -i -H "Content-Type: application/json" -X POST "https://example.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=XXX&key=XXX&json={"contact_id":"358383"}"

```

or

```
curl -i -H "Content-Type: application/json" -X POST "https://example.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=XXX&key=XXX&json={contact_id:358383}"

```

If anyone has any examples/suggestions that would be great! I'm curl-ing on MacOSX - from what I've been reading "/%22' syntax could be important.

# Answer
> 4 votes
I just created a working example for `curl` and tested it on linux. Do also URL encode the curly braces. I used the this website to do that. So `{"contact_id":"358383"}` becomes `%7B%22contact_id%22%3A%22358383%22%7D` .

I used curl with different parameters. My example is

```
curl -X POST "http://localhost/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=XXX&key=XXX&json=%7B%22sequential%22%3A%221%22%2C%22id%22%3A%222%22%7D"

```

Update: I see I am a bit misleaded by the example generated by the api explorer. JSON for parameters is not mandatory. It is possible to use the following format.

```
 curl -X POST "http://localhost/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api_key=XXX&key=XXX&json=1&contact_id=2"

```

See REST API without JSON just key=value .

# Answer
> 1 votes
Try adding: `option.limit=0` to you request?

ex:

https://example.org/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=get&api\_key=XXX&key=XXX&json={"sequential":1,"id":1,"options":{"limit":0}}

---
Tags: api
---


# Question
Title: Missing Activities tab when viewing contacts
When viewing a contact, there is no "Activities" tab in the list of tabs. Is this a configurable setting somewhere?

In other words, is there a way to add this tab to the Contact page?

Running CiviCRM 4.6.17

# Answer
> 4 votes
this is configurable at this path civicrm/admin/setting/preferences/display?reset=1 which is found from Administer \> Customise \> Display Preferences.

The top section is called Viewing Contacts and has a checkbox for eg Activities

---
Tags: contacts, 4.6
---


# Question
Title: Should online renewals generate a Membership Renewal Activity? and how about when a Pay Later renewal is set to completed?
Not sure if this is a regression, but currently (and since august at least) on civi 4.7.x when you renew online there is no Membership Renewal activity created.

I just tested this on d.46 where with a $0 membership the online renewal did create a Membership Renewal Activity.

Same thing on sandbox did not. Bug? Regression? Confused tester?

http://dmaster.demo.civicrm.org/civicrm/contact/view?reset=1&cid=207

A separate issue for both 4.6 and 4.7 seems to be that online Pay Later does not generate the Membership Renewal Activity when the payment is set to Completed.

Both of the above mean that searches based on that Activity Type as a way of figuring who renewed when do not work as far as I can tell

# Answer
Seems there was a regression. Jira ticket here (now FIXED) for the lack of Membership Renewal activity creation when you renew online that was fixed for 4.7.15.

Second ticket for No Membership Renewal Activity is created when a Pay Later is set to Completed not yet fixed
> 0 votes

---
Tags: civimember, activities
---


# Question
Title: Buildkit Site fails to load due to PHP ugrade from 5 to 7
After Upgrading from php 5.6 to php 7, when i try to access the sites created using buildkit, I am unable to access it.

After typing

> Civibuild show dmaster

I get the following

> ERROR: Failed to find required PHP extension "SimpleXML".
>
> TIP: In some systems, the PHP version used in CLI and web are different. \>Extensions should be active in both.

the TIP is a bit clear about the change in the PHP version, where do I trick that to work?, and where exactly is that done?

# Answer
It's on your php.ini config file. where it it depends on your OS, in ubuntu/debian it's under /etc/php5 and you have cli and fpm, check that the cli version enables the extension simplexml

FYI, CiviCRM is not yet super tested with php7 (was classified "experimental" two months ago

https://civicrm.org/blog/totten/civicrm-4712-rc-experimental-support-for-php-7-mysql-57

for the details: https://issues.civicrm.org/jira/browse/CRM-17789

X+
> 3 votes

# Answer
It seems to me you need to install the `php-xml` package.

`sudo apt-get install php-xml` should get you there on Ubuntu.
> 3 votes

---
Tags: drupal, developer, php, civicrm-buildkit, php7
---


title: Upgrading CiviCRM 4.0.1 to 4.1.0

text:
# Question
Title: Upgrading CiviCRM 4.0.1 to 4.1.0
I am having an issue whenever I run the upgrade for 4.0.1 to 4.1.0. The issue is below:

```
Cannot execute CREATE TABLE `civicrm_setting` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`group_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL COMMENT 'group name for setting element, useful in caching setting elements',
`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique name for setting',
`value` text COLLATE utf8_unicode_ci COMMENT 'data associated with this group / name combo',
`domain_id` int(10) unsigned NOT NULL COMMENT 'Which Domain is this menu item for',
`contact_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to Contact ID if the setting is localized to a contact',
`is_domain` tinyint(4) DEFAULT NULL COMMENT 'Is this setting a contact specific or site wide setting?',
`component_id` int(10) unsigned DEFAULT NULL COMMENT 'Component that this menu item belongs to',
`created_date` datetime DEFAULT NULL COMMENT 'When was the setting created',
`created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_contact, who created this setting',
PRIMARY KEY (`id`),
KEY `index_group_name` (`group_name`,`name`),
KEY `FK_civicrm_setting_domain_id` (`domain_id`),
KEY `FK_civicrm_setting_contact_id` (`contact_id`),
KEY `FK_civicrm_setting_component_id` (`component_id`),
KEY `FK_civicrm_setting_created_id` (`created_id`),
CONSTRAINT `FK_civicrm_setting_domain_id` FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_civicrm_setting_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_civicrm_setting_component_id` FOREIGN KEY (`component_id`) REFERENCES `civicrm_component` (`id`),
CONSTRAINT `FK_civicrm_setting_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1:
DB Error: already exists

```

# Answer
The error you posted says, "Hi, I'm trying to create a new table in your database, but that table already exists."

Most commonly, this happens when you do an upgrade, then restore a backup, then attempt the upgrade again. My guess is that you got a similar-looking (but different!) error previously, restored a backup, then got this on a second upgrade.

The reason this happens is that restoring a backup puts OLD tables back the way they were, but doesn't touch any NEW tables that don't exist in the backup. So if you upgrade, you can NOT restore your database to the previous version simply by reloading the backup. You must first `DROP <database_name>` and `CREATE <databasename>` so that you're restoring to a clean slate.

Try doing a DROP and CREATE before restoring your database and mark this question solved if that clears this error! If you have a separate error, please post that as a new question.
> 1 votes

# Answer
First of all please take a backup of your currect version and then try the below against a test server

Please try to upgrade from 4.0.1 to 4.0.8 first and then try upgrading to 4.1.0 If you still get some issue then try upgrading to 4.0.1 to 4.0.4 and to 4.0.8 and finally to 4.1.0

I guess this helps !!!
> 0 votes

---
Tags: upgrade
---


# Question
Title: Fatal Error after upgrading to 4.7.13 from 4.7.11
Just upgraded Civi from 4.7.11 to 4.7.13

The upgraded installed successfully, but rendered Civi functionally unusuable. Attempting to click on any tab within Civi (such as navigating to Contributions, Mailing, Memberships, etc.) results in the following fatal error in the web browser.

Any assistance is appreciated! Thank you!

```
Fatal error: require_once(): Failed opening required 'CRM/Core/Payment/EPayUCM.php'
(include_path='/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/drupal/modules/civicrm_engage/:
/home/WEBSITE/public_html/drupal/sites/default/files/civicrm/extensions/uk.co.vedaconsulting.gotowebinar/:
/home/WEBSITE/public_html/drupal/sites/default/files/civicrm/extensions/org.civicrm.module.cividiscount-2.5/:
/home/WEBSITE/public_html/drupal/sites/default/files/civicrm/extensions/civicrm_stripe-4.5-dev/packages/:
/home/WEBSITE/public_html/drupal/sites/default/files/civicrm/extensions/civicrm_stripe-4.5-dev/:
.:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/packages:
.:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/packages:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/vendor/tecnickcom:
/home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/vendor/phpseclib/phpseclib/
 in /home/WEBSITE/public_html/drupal/sites/all/modules/civicrm/Civi/Payment/System.php on line 59

```

# Answer
This error is saying, "Hi, there's a missing payment processor file." The payment processor file in question isn't part of core CiviCRM; it's probably provided by a plugin. Is this site associated with UC Merced? It seems like maybe there's a custom payment processor plugin written for their e-pay system.

Since this broke on an upgrade, I wonder if it wasn't a plugin, but they inserted the file directly into core CiviCRM? It's hard to troubleshoot without seeing it. For now, check **Administer menu \> System Settings \> Payment Processors** and disable your payment processor to see if that gets your system working. Then track down whomever wrote this custom code for you.
> 3 votes

---
Tags: upgrade
---


# Question
Title: Joomla front end map function gives a narrow map
You can search for contacts using a profile from the Joomla front end, and permit mapping, but the map is very narrow, and you can't search for counties.

Inspecting the page with a debugger shows that the code is expecting to see files under the civicrm folder which is not in the front end components/com\_civicrm folder.

# Answer
This is caused because the system expects to find css and other files under the civicrm folder. This folder does not exist in \[joomla root\]/components/com\_civicrm. You can solve this by creating a symlink as follows: cd \[joomla root\]/components/com\_civicrm

ln -s \[joomla root\]/administrator/components/com\_civicrm/civicrm civicrm

I suppose it is possible the code will be changed so this is unnecessary or the installation process will create the symlink if it is not needed.
> 1 votes

---
Tags: joomla
---


# Question
Title: CRM.$ is not a function after upgrade 4.7.8 > 4.7.13
Running upgrade CiviCRM 4.7.8 to 4.7.13, on Drupal 7, I have a white screen with just "\[\]" message and "Retry" and "Skip" buttons, and js error : CRM.$ is not a function. Tried to change the theme : no effect. js and css files are not compressed.

Do you have any idea ?

# Answer
I recommend doing the upgrade via drush if you are having trouble doing it in your browser.
> 1 votes

---
Tags: upgrade
---


# Question
Title: Problems accessing Activity and Mailings
CiviCRM 4.7.11 WordPress 4.6.1

Having problems accessing Activities and Mailings.

1. From a Contact record, click "Activites" and get an Invalid JSON response. See image.
2. From a Contact record, click "Mailings" and get the Summary of the record.

Can't do "Find Activities" or "Find Mailings" from Search pull-down either. "Find Mailings" goes to the dashboard.

Can use Custom Searches and Activity Search. So doesn't seem to be a database error. Seems to be a code error. Haven't done any upgrades.

Did research on the JSON error and this seems to be the code that is causing the error.

> CRM.$(function($) { // The set of options we can use to initialize jQuery.dashboard(). var options = { widgetsByColumn: \[\[{"id":2,"name":"getting-started","title":"CiviCRM Resources","url":"\\/wp-admin\\/admin.php?page=CiviCRM&q=civicrm\\/dashlet\\/getting-started&reset=1","cacheMinutes":"7200","fullscreenUrl":"\\/wp-admin\\/admin.php?page=CiviCRM&q=civicrm\\/dashlet\\/getting-started&reset=1&context=dashletFullscreen"}\],\[\]\], // These define the urls and data objects used for all of the ajax requests to the server. ajaxCallbacks: { // jQuery.dashboard() POSTs the widget-to-column settings here. // The 'columns' property of data is reserved for the widget-to-columns settings: // An array (keyed by zero-indexed column ID), of arrays (keyed by widget ID) // of ints; 1 if the widget is minimized. 0 if not. saveColumns: { url: '/wp-admin/admin.php?page=CiviCRM&q=civicrm/ajax/dashboard', data: { // columns: array(0 =\> array(widgetId =\> isMinimized, ...), ...), op: 'save\_columns', key: "6318f73741bb1ff8ca4f6bdb6a720062" } }, // jQuery.dashboard() GETs a widget's settings object and POST's a users submitted // settings back to the server. The return, in both cases, is an associative // array with the new settings markup and other info: // // Required properties: // * markup: HTML string. The inner HTML of the settings form. jQuery.dashboard() // provides the Save and Cancel buttons and wrapping element. Can include // s of any standard type and s, nested in s etc. // // Server-side executable script callbacks (See documentation for // ajaxCallbacks.getWidgets): // * initScript: Called when widget settings are initialising. // * script: Called when switching into settings mode. Executed every time // the widget goes into settings-edit mode. // // The 'id' property of data is reserved for the widget ID. // The 'settings' property of data is reserved for the user-submitted settings. // An array (keyed by the name="" attributes of s), of values. widgetSettings: { url: '/wp-admin/admin.php?page=CiviCRM&q=civicrm/ajax/dashboard', data: { // id: widgetId, // settings: array(name =\> value, ...), op: 'widget\_settings', key: "6318f73741bb1ff8ca4f6bdb6a720062" } } } }; var dashboard = $('#civicrm-dashboard') .on('mouseover', '.widget-header', function() { $(this).closest('.widget-wrapper').addClass('db-hover-handle'); }) .on('mouseout', '.widget-header', function() { $(this).closest('.widget-wrapper').removeClass('db-hover-handle'); }) .dashboard(options); $('.crm-hover-button.show-refresh').click(function(e) { e.preventDefault(); $.each(dashboard.widgets, function(id, widget) { widget.reloadContent(); }); }); }); function createSWFObject( chartID, divName, xSize, ySize, loadDataFunction ) { var flashFilePath = "/wp-content/plugins/civicrm/civicrm/packages/OpenFlashChart/open-flash-chart.swf"; //create object. swfobject.embedSWF( flashFilePath, divName, xSize, ySize, "9.0.0", "expressInstall.swf", {"get-data":loadDataFunction, "id":chartID}, null, {"wmode": 'transparent'} ); } OFC = {}; OFC.jquery = { name: "jQuery", image: function(src) { return ""}, popup: function(src) { var img\_win = window.open('', 'Save Chart as Image'); img\_win.document.write('Save Chart as Image' + OFC.jquery.image(src) + ' '); img\_win.document.close(); } } function save\_image( divName ) { var divId = "" ? 'open\_flash\_chart\_'+divName : ""; if( !divId ) { divId = 'open\_flash\_'+divName; } OFC.jquery.popup( divId ); }
>
> Configure Your Dashboard
>
> Refresh Dashboard Data
>
> Welcome to your Home Dashboard Your dashboard provides a one-screen view of the data that's most important to you. Graphical or tabular data is pulled from the reports you select, and is displayed in 'dashlets' (sections of the dashboard).
>
> Javascript must be enabled in your browser in order to use the dashboard features.
>
> CRM.$(function($) { $('#crm-dashboard-configure').click(function(e) { e.preventDefault(); $(this).hide(); if ($("#empty-message").is(':visible')) { $("#empty-message").fadeOut(400); } $("#civicrm-dashboard").fadeOut(400, function() { $(".crm-dashboard-controls").hide(); $("#configure-dashlet").fadeIn(400); }); CRM.loadPage(CRM.url('civicrm/dashlet', 'reset=1'), {target: $("#configure-dashlet")}); }); });

# Answer
I solved this by re-installing CiviCRM. Somehow it got corrupted.
> 1 votes

---
Tags: activities, error, mailing, core
---


# Question
Title: Use custom field in front end of website
We are testing your application CiviCRM and we tried to create a custom field as contact reference for all kind of contacts.

However though in the preview on the back end this field works fine, when you try to use on the front ebd (chrome, IE, Mozilla) the active search does not work (it doesn't allow to search for the contacts in database).

Example:

Front end (Custom Profile Field “Visita à Loja” - It is a Contact Reference Field - It was suppose that when you select the field, active search was functional. But it’s not!)

When you see the back-office profile and you select “Preview all fields” of this profile, everything works properly:

* “Data da Prospecção” - It has a Calendar Icon that when you select, a popup calendar appears so you can select date (in front office the icon doesn’t appear)
* “Visita à Loja” - Active search is functional, allowing you to search for contacts in database. However in front office this doesn’t work (as you may see above)

Can you help best regards JSousa

# Answer
There are instructions on the screen where you create contact reference custom fields:

Do your front-end users have the required permissions?
> 4 votes

---
Tags: custom-fields, profile
---


# Question
Title: Enable multiple event registration for same purchaser/participant
Currently if a participant purchases a ticket online and then returns at a later date to purchase another ticket, CiviCRM won't allow the same individual to purchase the 2nd ticket under their name. The purchase could register another participant and complete the purchase, but for individuals that want to purchase more than one time under their name, it doesn't seem possible. I am not positive, but I believe this is due to the unsupervised dedupe rule used by CiviEvent. Is there a way to allow the same purchaser to purchase more than one ticket at more than one time under their name online?

# Answer
In 'manage event' you may be able to check "register multiple participants" and "same email address" if you have a pretty simple event setup. It's a bit clunky but if the same name is used with the default dedupe rule, civiCRM should create another participant for the same contact record. Note that i've only tested this with free events.

The registrant will be forced to go through a page that says "you're already registered, click register to sign up again", by default.

If you need someone to "edit" the *same* participant record by adding quantity for a paid event, I don't believe that is possible. Doing paid edits to the same participant record is something that even administrators cannot do elegantly at this point (4.6.4 for us) with basically any level of complexity involved, such as changing price sets and/or discount codes.
> 2 votes

---
Tags: civievent, registration, duplicate-contacts
---


title: Presales / Functionality Question

text:
# Question
Title: Presales / Functionality Question
**Presales Question…**

I’m trying to determine which features can be turned on & off with this CRM system, so I have a couple of questions I need to ask based on the scenario that I’m trying to solve for the project I’m working on.

**Scenario:**

I’m designing a website for a business group that I belong to that “refers” each other clients based upon each of our specialties. The goal of the site will be to help each other know how effective each of these referrals actually end up being.

While there will be no monetization towards each of the members within the group, the concept will be to track that Member A referred Client B to Member C. And that Member C made whatever amount of money from Client B. Then subsequently Client B referred Member C to however many people (call this Tier 2 referrals) and they made additional referrals and so on.

The goal is to show (long term that Member A actually should be credited with the total sales volume that Member C made from the down line of that original referral of Client B.

There are no actual commissions to be paid back to Member A since Member C actually is the one that generated the income from that entire referral chain.

**Questions:**

So based upon what I see, CiviCRM is a traditional CRM with some added features that could potentially be utilized to achieve this is sort of a referral tracking. How do I allow Member C to keep track of their sales activities with Client B (and their referrals) while at the same time allowing Member A to show a referral accumulation (number of referrals and the money generated from them all) for all of the members within our group as a single item. In this case there are 36 of us that are members of this group.

Are these features able to be visual shown across the dashboard as well for each of the members?

Is CiviCRM able to track a Many-To-Many relationship? In this case the scenario calls out Member A tracking an associated "credit" for Client B and all of the subordinate tiers of referrals from that original referral to Member C?

And lastly is there a summary report that the admin (me for now) can actually utilize to generate a consolidated report for all of the members to see/have?

Thanks in advance for your response.

# Answer
> 5 votes
from a quick read I would expect you to be able to get most of the way, if not the whole way, but using Activities (or possibly Cases) to store the data for referals, and use Drupal Webforms to capture the data for referrals, and Drupal Views along with the Permissioned Relationships ACL extension which Fuzion created, to manage the job of who can see what at various levels of these daisy chains.

Others might suggest doing this directly via the Civi UI etc but we have found that Views + Webforms + Permissioned Relationships can get you a long way past what 'out of the box' civi can do, and without requiring custom coding.

Alternatively, or if required in addition to the above, I expect a developer could fill in any missing steps with an Extension.

---
Tags: civireport, relationships, smartgroups, evaluating-civicrm
---