title: CiviCRM Campaign - Personal Campaigns

text:
# Question
Title: CiviCRM Campaign - Personal Campaigns
We have the Campaign (and Personal Campaign Page) option appearing within Contributions and I believe it is impacting on automatic receipting to supporters. Does anyone know where or how to delete this campaign extension.

# Answer
> 1 votes
CiviCampaign is not an extension but a component (ie it's part of the core), you can enable/disable it from (administer\>system settings\>Components)

and disable it.

This being said, I'd be surprised it's the issue, lots of install have civicampaign enabled and working email receipts

---
Tags: civicampaign
---


# Question
Title: Using Civicrm_api3 in onAjax[Name] plugin function
I created a plugin which provides custom validation for civicrm forms. Part of the jQuery validation on the plugin makes an AJAX call to the plugin. The plugin calls its onAjax\[Name\] method. In the onAjax\[Name\] method, I want to use civicrm\_api3( ... ). However, the system returns a fatal error

Call to undefined function civicrm\_api3()

How do I use civicrm\_api3 in the above context? Do I need to import some class files? The same code works if the validation occurs when the form is submitted with the submit button instead of AJAX.

# Answer
Call `civicrm_initialize()` before using `civicrm_api3()` (or other CiviCRM functions).

This function is defined in the various CMS plugins (eg `civicrm.module`) and will load required files then initialize CiviCRM, after which you can make API calls.

Since booting the CRM adds overhead, it's best to only do when CRM is required - hence the separate function.
> 3 votes

# Answer
I used the following. It is important to note that my current working directory was that of the website not the plugin directory, so when I did the require\_once and conf\_path, I had to take that into account for class.api.php and civicrm.settings.php (i.e. my path was like administrator/.../class.api.php)

```
require_once 'your/civicrm/folder/api/class.api.php';
$api = new civicrm_api3(array(
  // Specify location of "civicrm.settings.php".
  'conf_path' => 'your/sites/default',
));
$apiParams = array(
  'first_name' => 'Alice',
  'last_name' => 'Roberts',
);
if ($api->Contact->Get($apiParams)) {
  //each key of the result array is an attribute of the api
  echo "\n contacts found ".$api->count;
}
else {
  echo $api->errorMsg();
}

```

It really should be documented somewhere that you cannot bootstrap CiviCRM in an onAjax\[Name\] method. In my case, when I tried it, the submit button for the form lost its functionality.
> 0 votes

---
Tags: api, joomla, php, ajax, plugin
---


title: A couple questions

text:
# Question
Title: A couple questions
We are a non profit with very specific needs

1. Does Civi do deposits by batch?
2. Can Civi track attendance?
When our clients come in they have redeemable points and credits that they get monthly and use throughout the month. Is there a way of tracking these balances? On the first of each month these quotas reset. Is that a possibility. Currently we are using Google Sheets for this.
3. Can we set permissions for viewable information?
4. Where is Civi information stored?

# Answer
> 3 votes
just a guess based on your name: Belgian or Dutch? If so, come to CiviCamp Brussels to learn more about CiviCRM: https://civicrm.org/civicamp/brussels-2018

You ask a few questions that are not simply answered in one sentence and this would be a good way to find answers and discuss your needs with other CiviCRM users and partners.

Short and quick answers:

1. not sure what you mean there. I guess an answer could be: yes, CiviCRM allows sending of financial transactions in batch but I am not sure if that is what you want to do.
2. CiviCRM can track all sorts of things, you would have to explain to me what you mean exactly. But I think you would certainly be able to use custom fields for this.
3. Yes, depending on your CMS and the CiviCRM entities you are using.
4. In the MySQL database on the server that you either host yourself or your hosting service provider delivers you.

# Answer
> 1 votes
These screenshots are a bit dated, but here's documentation of the deposits by batch functionality.

---
Tags: evaluating-civicrm
---


# Question
Title: Error returned on newsletter sign-up via profiles in Wordpress
we are collecting email addresses for our newsletter via a profile sign-up on our website, where it is embedded as an iframe (no way around this).

This has worked fine until some recent update either from civi or Wordpress, which I cannot say for sure. However, addresses are still recorded but after submission, this is error message is returned: "Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred. We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site administrator for assistance."

I have played around with the paths while trying to fix the issue but had no success. I made the following findings:

* It used to work before in the same setting.
* If the e-mail address already exist, there is an message stated saying that it is a duplicate and the abovementioned error doesnt show.
* It works correctly if i am a signed-in in the Wordpress backend while signing up.
    + Our event registration works fine with the same setup.

Do you have any ideas or suggestions how to fix this?

Thank you in advance! Dennis

# Answer
> 0 votes
Since this works when you are logged into WordPress it looks like it might be a permissions issue. Is the redirect after submission set in the profile advanced settings? You may want to check the page being redirected to to make sure anonymous users have access to it. Also check the permissions for anonymous users under 'Administer\>Users and Permissions\>Permissions (access control)' click on WordPress Access Control. Particularly the permissions around profiles.

What version of WordPress & CiviCRM are you running? Since it was working OK prior to recent updates when was your last CiviCRM update?

Hope this helps.

---
Tags: newsletter
---


title: One Database or two?

text:
# Question
Title: One Database or two?
Is there a reason to use two separate databases for CiviCRM and Drupal, or can I use the same for both? What would be affected if I used the same for both?

# Answer
Should work fine. Best practice is definitely two databases.

IMHO it is easier to understand where data is stored and deal with update and rolling back changes when the databases are separate, but in some hosting environments you are forced to use a single database for both the Drupal and CiviCRM tables.

Using separate databases requires you to go to CiviCRM \> Administer \> System Settings \> CMS Integration and copy the array generated to your Drupal settings.php file.
> 3 votes

# Answer
Unless absolutely necessary, I never use the same database for both. Both Drupal and CiviCRM can end up with databases of a significant size. I've found that this can sometimes cause lag and slowness with the site. Not to mention that if you need to restore a database, it can be difficult for the average person to do once it gets over a certain size. Often times you'll need to get assistance from tech support at your host or know how to use command line.

I've found typically if I am so locked down that I can only have a limited number of databases, the server also has insufficient resources for running Drupal and CiviCRM well.
> 0 votes

---
Tags: drupal, mysql
---


# Question
Title: Problem with upgrade from 4.5.5 in drupal
I am trying to upgrade from civicrm 4.5.5. I follow instructions of https://docs.civicrm.org/sysadmin/en/latest/upgrade/drupal7/ but any time I do the upgrade I get the screen with skip or retry buttons that doesn't work. I don't know if the ugrade was completed.

Then if I go to the civicrm page I see the new version number (4.6.34) but menu disappeared and I can't continue working with the previous data, contribution pages, mailing, etc.

what could be the problem?

\[

# Answer
> 1 votes
The problem overcomes when deactivated AT Commerce 7.x-3.2 as the enabled theme. Then buttons and menus worked. Upgrade was successful finally.

---
Tags: drupal, upgrade
---


# Question
Title: Tax not applied when performing backend membership renewal
We have a lot of different taxes on our implementation - doing a backend renewal does not apply the tax (however, this works when a NEW membership is created). Anyone have a fix? I tried searching the issue tracker but couldn't find anything about this.

Version: CiviCRM 4.6

# Answer
Nevermind - I was able to track it down - it was reported in version 4.6.5 and there appears to be a fix.

https://issues.civicrm.org/jira/browse/CRM-16950?jql=text%20~%20%22renewal%20taxes%22
> 2 votes

# Answer
It looks like the previous post link was for the wrong issue - this is the correct one, which shown status is Fixed for Civi 4.7.31: https://issues.civicrm.org/jira/browse/CRM-21485?jql=text%20~%20%22renewal%20taxes%22

I got it working - follow the links on the issue, click files to see the required code to be added. Sales Tax was added on a backend renewal after applying the code.
> 0 votes

---
Tags: civicontribute, civimember, taxes
---


# Question
Title: Why would the activity date for a contribution differ from the contribution date?
Using CiviCRM 4.6.33 on Drupal 7.56. I just noticed, while adding a contribution to this person's record, that for a contribution made on December 31 of last year (2016), the contribution date and the activity date for that contribution do not match. The activity date shows as December 31, 2017, which is 10 days from now.

I was going to report this as a bug, but I have checked donations made by other people on December 31, 2016, and they do not seem to have the same problem. I must have done something to make this happen, I suppose, but I see no way to manually change the activity date.

Here are screenshots of the contributions and activities windows.

# Answer
> 1 votes
Is possible that you first entered wrong date while creating contribution and then updated receive date by editing the Contribution?

There is no form to update the Contribution activity. But you do this using api explorer screen.

1. First retrieve the Activity ID using Contribution Id(source record id)  (here 689 is Activity ID and 128 is Contribution Id)
2. Update the Activity date.

HTH

Pradeep

---
Tags: civicontribute
---


# Question
Title: Unable to run a batch update of contribution soft credits
I created a profile with only two fields: Soft Credit Soft Credit Type

I intend to use it to go back into my contributions and assign soft credits to contributions.

First I go to Contributions -\> Find Contributions and execute my search. I select 'Update Multiple Contributions', and I select my Soft Credit profile.

The relevant contributions are displayed. But the Soft Credit and Soft Credit Type fields are blocked/blank. I know some of my contributions already have soft credits assigned but that information doesn't show. And I am not able to assign new soft credits to any contributions.

I thought this functionality was added in 2013: https://wiki.civicrm.org/confluence/display/CRM/Soft+Credit+Enhancements+-+4.4

I have no trouble updating contributions' Thank You dates with another profile. What am I missing? Thanks!

# Answer
Currently updating contribution to add/update soft credits are not supported. I feel Updating soft credit was missed during initial implementation. We will need to submit a core fix to have it working for Contribution Batch update.
> 4 votes

---
Tags: profile, contributions, upgrade
---


# Question
Title: Incomplete (abandoned) event registrations
Is there a way to capture those who fill out the event registration form, hit continue, but then do not hit continue on the confirmation page? I thought it used to do this, but noticed today that either I was remembering wrong or it has stopped doing this.

Essentially the folks I'm working with want people to have the pay later option without ever showing them that option. Too many people pick that rather than just paying now and then they forget to pay. But some government organizations and such need to do an invoice. So they want to capture the ones only partially submitted as being incomplete so they can then update them when the payment comes in.

They have the information on the confirmation page that you should pay via Paypal, but if you can't, here's how to do it. If you click Continue, it then takes you to Paypal.

# Answer
CiviCRM doesn't store data that has been partially submitted. If your form uses paypal standard payment method and user fills in the other details and pay's now then he will be taken to paypal screen where he will need to enter card details or pay using paypal account. Before going to Paypal CiviCRM creates Pending Participant records and then changes status to completed if it receives payment.

So you will need to either have registrants submit 3 step form or build extension that would do one of the following

1. Don't use confirmation page incase for Pay later and/or Pay now.
2. Store Data in CiviCRM when user submits the main form, Truncate if user submits confirmation, Add report to list all the user that submitted partially.

(#1 will be simple and #2 will need more work)

HTH

Pradeep
> 1 votes

---
Tags: civievent
---


# Question
Title: have different events for different user groups
I have users in different groups.depending on the group they are in when they see the events listing, I'd like them to only see events that are relevant to them based on the group(s) they are in. For example, let's say I have users in 3 groups: Board member, Manager, employee. The board member gets to see events for all groups. The manager only gets to see manager events. The employee gets to see events for employee and manager.and also I'd like every group have their own calendar. (CiviCRM 4.7.25 on Wordpress 4.8?)

# Answer
To restrict users to see events of their own group in CiviCRM UI then you will need to write an extension that will restrict this.

You can use CiviCRM hooks to restrict group to see their own events. Similarly in case of listing events on wordpress UI.

HTH

Pradeep
> 1 votes

---
Tags: wordpress, civievent
---


# Question
Title: For a particular event, how to list all the other events that participants have been on?
This may have an embarassingly simple answer - apologies if I've missed it!

When participants come to our events, we want to know what other events they have been on, or are booked on.

I can make a Drupal View of participants and use table aggregator plus to group rows by person - enumerating that grouped row lists all the events a person has been on. But if I then filter the list by the event I'm interested in - of course we are only showing the single participation of each person on the event I filtered for. No more list of all events.

I suppose we could make a group of the event participants and filter the view based on that, but it is all seeming a rather long way round to an issue that must already have come up.

I'll be grateful for any ideas!

Civicrm 4.7.27, Drupal 7.56

# Answer
> 2 votes
You can create a block using view.

Below exported view will list all events the logged in user is being registered.(To test you will need to import the views using below code)

```
$view = new view();
$view->name = 'event_listing';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'civicrm_participant';
$view->human_name = 'Event listing';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Events';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: CiviCRM Events: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'civicrm_event';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['link_to_civicrm_event'] = 'page';
/* Contextual filter: CiviCRM Participants: Participant's Contact ID */
$handler->display->display_options['arguments']['contact_id']['id'] = 'contact_id';
$handler->display->display_options['arguments']['contact_id']['table'] = 'civicrm_participant';
$handler->display->display_options['arguments']['contact_id']['field'] = 'contact_id';
$handler->display->display_options['arguments']['contact_id']['default_action'] = 'default';
$handler->display->display_options['arguments']['contact_id']['default_argument_type'] = 'php';
$handler->display->display_options['arguments']['contact_id']['default_argument_options']['code'] = 'civicrm_initialize();
return CRM_Core_Session::singleton()->get(\'userID\');
';
$handler->display->display_options['arguments']['contact_id']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['contact_id']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['contact_id']['summary_options']['items_per_page'] = '25';

/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');

```

---
Tags: civievent, participants
---


# Question
Title: Set Default View for Views For Display Contacts in Advanced Search Form
I want to change the columns that are shown in the advanced search results.

I have created a Search Views Profile and this shows up in the dropdown list of the Search Views on the Advanced Search Form. This works fine. Is it possible for me to make this Search View Profile the default Search View?

I looked in the admin screen for customising search preferences (civicrm/admin/setting/search?reset=1), and there is a dropdown for the Default Contact Search Profile, but my Search Views Profile does not show up in it.

It would be helpful if I could make my search view the default so that users do not have to select it each time they do a search.

# Answer
> 1 votes
I guess you trying to use a profile which has Contact, Contact Type and Contact Sub Type Fields. The search preference allows you to choose profiles that have fields of contact and contact type. I have logged the issue at CRM-21655. You can apply patch to make it work or wait for 4.7.31.

---
Tags: profile, search, search-results
---


# Question
Title: I hacked core and know I shouldn't (How do I use hook_civicrm_batchItems?)
I need to adjust the CSV accounting batch export format for our accounting software. The CSV needs to be only four columns:

1. Envelope number (a custom field which corresponds to our accounting software)
2. Amount
3. Transaction date (formatted as yyyymmdd)
4. Fund # (Credit Account in Civi terms)

I know that there are two Civi hooks to alter accounting batches. There is an example for batchQuery, and I'm comfortable enough writing mySQL queries, so I'm okay there. But I'm newer at Civi development, so I'm not sure where to go with batchItems. The wiki does not have an example to work off of.

Not knowing where to go next, I found Sarah's blog post from Dec 2014 about changing the accounting batch export. Knowing it is not a long-term solution, more just trying to verify if the data could be retrieved, I setup a Drupal dev environment for 4.6.14 and changed some code in CRM/Finanical/BAO/ExportFormat/CSV.php. (I was going to use 4.7.3, but ran into a bug with the batch export function. It is slated to be fixed in 4.7.4).

I was able to achieve the results I needed. So, I know that the data can be retrieved. Here's the relevant code from CSV.php with my additions surrounded by \** (which are not really in my code); I commented out the lines in the `$financialItems` array for data I do not need.

Now the question is, **how do I transition my temporary solution to a long term one using an extension with hook\_civicrm\_batchQuery and hook\_civicrm\_batchItems?** I've got an extension framework set up with Civix, but don't know how to move from the adjusted code above to a solution that doesn't hack core.

Does anyone have an example of how to use hook\_civicrm\_batchItems?

~line 80

```
  public function generateExportQuery($batchId) {
    $sql = "SELECT
      ft.id as financial_trxn_id,
      ft.trxn_date,
      fa_to.accounting_code AS to_account_code,
      fa_to.name AS to_account_name,
      fa_to.account_type_code AS to_account_type_code,
      ft.total_amount AS debit_total_amount,
      ft.trxn_id AS trxn_id,
      cov.label AS payment_instrument,
      ft.check_number,
      c.source AS source,
      c.id AS contribution_id,
      c.contact_id AS contact_id,
      eb.batch_id AS batch_id,
      ft.currency AS currency,
      cov_status.label AS status,
      CASE
        WHEN efti.entity_id IS NOT NULL
        THEN efti.amount
        ELSE eftc.amount
      END AS amount,
      fa_from.account_type_code AS credit_account_type_code,
      fa_from.accounting_code AS credit_account,
      fa_from.name AS credit_account_name,
      fac.account_type_code AS from_credit_account_type_code,
      fac.accounting_code AS from_credit_account,
      fac.name AS from_credit_account_name,
      fi.description AS item_description,
      **pc.envelope_7 AS envelope_number**
      FROM civicrm_entity_batch eb
      LEFT JOIN civicrm_financial_trxn ft ON (eb.entity_id = ft.id AND eb.entity_table = 'civicrm_financial_trxn')
      LEFT JOIN civicrm_financial_account fa_to ON fa_to.id = ft.to_financial_account_id
      LEFT JOIN civicrm_financial_account fa_from ON fa_from.id = ft.from_financial_account_id
      LEFT JOIN civicrm_option_group cog ON cog.name = 'payment_instrument'
      LEFT JOIN civicrm_option_value cov ON (cov.value = ft.payment_instrument_id AND cov.option_group_id = cog.id)
      LEFT JOIN civicrm_entity_financial_trxn eftc ON (eftc.financial_trxn_id  = ft.id AND eftc.entity_table = 'civicrm_contribution')
      LEFT JOIN civicrm_contribution c ON c.id = eftc.entity_id
      LEFT JOIN civicrm_option_group cog_status ON cog_status.name = 'contribution_status'
      LEFT JOIN civicrm_option_value cov_status ON (cov_status.value = ft.status_id AND cov_status.option_group_id = cog_status.id)
      LEFT JOIN civicrm_entity_financial_trxn efti ON (efti.financial_trxn_id  = ft.id AND efti.entity_table = 'civicrm_financial_item')
      LEFT JOIN civicrm_financial_item fi ON fi.id = efti.entity_id
      LEFT JOIN civicrm_financial_account fac ON fac.id = fi.financial_account_id
      LEFT JOIN civicrm_financial_account fa ON fa.id = fi.financial_account_id
      **LEFT JOIN civicrm_value_power_church_info_4 pc ON pc.entity_id = c.contact_id**
      WHERE eb.batch_id = ( %1 )";

    CRM_Utils_Hook::batchQuery($sql);

    $params = array(1 => array($batchId, 'String'));
    $dao = CRM_Core_DAO::executeQuery($sql, $params);

    return $dao;
  }

```

~line 178

```
  public function makeCSV($export) {
    // getting data from admin page
    $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');

    foreach ($export as $batchId => $dao) {
      $financialItems = array();
      $this->_batchIds = $batchId;

      $batchItems = array();
      $queryResults = array();

      while ($dao->fetch()) {
        $creditAccountName = $creditAccountType = $creditAccount = NULL;
        if ($dao->credit_account) {
          $creditAccountName = $dao->credit_account_name;
          $creditAccountType = $dao->credit_account_type_code;
          $creditAccount = $dao->credit_account;
        }
        else {
          $creditAccountName = $dao->from_credit_account_name;
          $creditAccountType = $dao->from_credit_account_type_code;
          $creditAccount = $dao->from_credit_account;
        }

        $invoiceNo = CRM_Utils_Array::value('invoice_prefix', $prefixValue) . "" . $dao->contribution_id;
        **$tdate = $dao->trxn_date;
        $mytdate = DateTime::createFromFormat('Y-m-d H:i:s', $tdate);
        $pcdate = $mytdate->format('Ymd');**

        $financialItems[] = array(
          //'Batch ID' => $dao->batch_id,
          //'Invoice No' => $invoiceNo,
          //'Contact ID' => $dao->contact_id,
          //'Financial Trxn ID/Internal ID' => $dao->financial_trxn_id,
          // Transaction date was here
          //'Debit Account' => $dao->to_account_code,
          //'Debit Account Name' => $dao->to_account_name,
          //'Debit Account Type' => $dao->to_account_type_code,
          //'Debit Account Amount (Unsplit)' => $dao->debit_total_amount,
          //'Transaction ID (Unsplit)' => $dao->trxn_id,
          //'Debit amount (Split)' => $dao->amount,
          //'Payment Instrument' => $dao->payment_instrument,
          //'Check Number' => $dao->check_number,
          //'Source' => $dao->source,
          //'Currency' => $dao->currency,
          //'Transaction Status' => $dao->status,
          // Amount was here
          // Credit Account was here
          //'Credit Account Name' => $creditAccountName,
          //'Credit Account Type' => $creditAccountType,
          //'Item Description' => $dao->item_description,
          'Envelope Number' => $dao->envelope_number,
          'Amount' => $dao->amount,
          **'Transaction Date' => $pcdate,
          'Credit Account' => $creditAccount,
        );

        end($financialItems);
        $batchItems[] = &$financialItems[key($financialItems)];
        $queryResults[] = get_object_vars($dao);
      }

      CRM_Utils_Hook::batchItems($queryResults, $batchItems);

      $financialItems['headers'] = self::formatHeaders($financialItems);
      self::export($financialItems);
    }
    parent::initiateDownload();
  }

```

Thanks!

# Answer
> 3 votes
You can create an extension that would export in your format. Here is an example of similar requirement.

https://github.com/JMAConsulting/biz.jmaconsulting.greatplains

You can use this extension to create a new export format through UI and copy paste CSV file and edit the columns code that you would not require in export.

# Answer
> 1 votes
I have an example for you. First I override the core query with my own one in the batchQuery hook:

```
function xchangewinbooks_civicrm_batchQuery(&$query) {
  CRM_Xchangewinbooks_Export::batchQuery($query);
}

```

The class method:

```
public static function batchQuery(&$query) {
    $query = "SELECT DISTINCT(d.invoice_id), d.creditnote_id, d.total_amount, d.net_amount, d.financial_type_id, d.receive_date,
d.contact_id, g.name as description, i.accounting_code
FROM civicrm_entity_batch a
JOIN civicrm_financial_trxn b ON a.entity_id = b.id
JOIN civicrm_entity_financial_trxn c ON b.id = c.financial_trxn_id AND c.entity_table = 'civicrm_contribution'
LEFT JOIN civicrm_contribution d ON c.entity_id = d.id AND c.entity_table = 'civicrm_contribution'
LEFT JOIN civicrm_membership_payment e ON d.id = e.contribution_id
LEFT JOIN civicrm_membership f ON e.membership_id = f.id
LEFT JOIN civicrm_membership_type g ON f.membership_type_id = g.id
LEFT JOIN civicrm_entity_financial_account h ON h.entity_id = d.financial_type_id AND h.entity_table = 'civicrm_financial_type'
  AND account_relationship = 1
LEFT JOIN civicrm_financial_account i ON h.financial_account_id = i.id
WHERE a.batch_id = %1 AND a.entity_table = 'civicrm_financial_trxn' AND d.invoice_id IS NOT NULL";
  }

```

And then for the items:

```
function xchangewinbooks_civicrm_batchItems(&$results, &$items) {
  CRM_Xchangewinbooks_Export::batchItems($results, $items);
}

```

with the class method:

```
 /**
   * Method to process the CiviCRM batchItems hook to generate new items
   *
   * @param $results
   * @param $items
   */
  public static function batchItems(&$results, &$items) {
    $items = array();
    foreach ($results as $result) {
      $result['due_date'] = self::calculateDueDate($result['receive_date']);
      // decide if this is a verkoopfactuur or a creditnota
      if (!empty($result['creditnote_id'])) {
        self::generateGrootboekLines('credit', $items, $result);
        self::generateAnalytischLine('credit', $items, $result);
      } else {
        self::generateGrootboekLines('factuur', $items, $result);
        self::generateAnalytischLine('factuur', $items, $result);
      }
    }
  }

```

In that class method I create a completely new area $items.

---
Tags: extension, hooks, accounting, batches
---


# Question
Title: Bad redirection after registration for free event
I struggle a lot with this issue, and couldn't find anything to help me so I hope here could:
I did set up an event, with different fees, and one of them is free. When people check not free, everything is going fine, but when they check free, they are not redirected correctly after "confirm your choice": the page is bugged and they do not receive any confirmation email. They are redirected on an error page (HTTP ERROR 500) So, even though they are registered, they cannot see it and try again and again, registering each time.
The payment method is Paypal.
The CMS I am on is Joomla, and I use version 4.7.25 of CiviCRM.
This is a big problem and I don't see any way out, so thank you for your help.
Some screens :

# Answer
> 1 votes
Its a known bug, and there is a patch to fix it. You can follow the following steps to fix it:

Open file: civicrm/CRM/Core/Payment/PayPalImpl.php Search for:

`$sub = empty( $params['is_recur'] ) ? 'xclick' : 'subscriptions';`

Replace with:

`$sub = empty( $params['is_recur'] ) ? 'cgi-bin/webscr' : 'subscriptions';`

It should be around line number 404

Hope it helps.

---
Tags: civievent, paypal, error-page, online-registration
---


# Question
Title: Use CiviCampaign to send emails to a target?
We are running a campaign and have used SpeakOut! a wordpress plugin that send emails to a target and signs a petition. For example Tell XYZ to do X! then it will send an email to XYZ from that person and have them sign the petition. Can I use CiviCampaign to do something like that?

Many thanks!

Note: Using Latest Wordpress and CiviCRM

# Answer
You can use CiviRules extension to get that is required. You can setup triggers, conditions and actions using this extension.

A detailed documentation has been compiled by them which can be found here.

Hope this helps.
> 1 votes

---
Tags: civicampaign
---


# Question
Title: How to put 'Other Amount' field in price set radio choices?
We want our Civicontribute page to do this, but don't want to use the Simple Donate extension. Is there any way to natively support this in CiviCRM? FYI - the 'Other' field is hidden until you select the option.

Is this another case where Webform CiviCRM comes to the rescue? :)

Even better than what is pictured below would be an 'Other' field that when selected, let you type the amount directly in that box.

Drupal 7 / CiviCRM 4.7

# Answer
> 1 votes
If you use Drupal CiviCRM Webform integration you can achieve this feature with the Select (or other) Drupal module.

See this question for more detail Webform CiviCRM contribution “other amount”

# Answer
> 1 votes
You will need to create an extension that would use JS and CSS to alter the screen as per your requirement.

# Answer
> 1 votes
You can achieve the required without simple donate extension, by default in contribution page settings, in 'Amounts' section there should be a checkbox to allow other amounts, check that selection and save.

Now in contribution page user will have the option to enter any other amount. The field will show up after 'other amount' radio selection will be selected.

Screenshot.

Hope this helps.

---
Tags: civicontribute
---


title: API Contact>DuplicateCheck Not Working?

text:
# Question
Title: API Contact>DuplicateCheck Not Working?
Can someone please verify that the API for contact\>duplicatecheck is actually working?

In my case the UI will return 8 dupes, but the API will not return any.

It seems to be broken as of late. From what I understand, running duplicatecheck without any parameters from the API explorer "should" return all duplicate contacts using the default unsupervised rule (for individuals). I have checked the official sandbox for drupal and it does not appear to work either.

If you can get it working, can you please supply the PHP code that worked?

Thanks!

# Answer
> 2 votes
Here is a piece of code that works :

```
$res = civicrm_api3('Contact', 'duplicatecheck',
  array(
    'match' => array(
      'contact_type' => 'Individual',
      'first_name' => 'Jane',
      'last_name' => 'Doe',
      'email' => 'jane@example.org',
    ),
  )
);

```

Return :

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

        )

)

```

Note that :

* `contact_type` is really important because it help the api choose the proper rule and CiviCRM won't give you any error if you omit it
* I'm not sure if it's possible to test it from the api explorer because match is an array and i have no clue how to put an array in this context...

---
Tags: api, duplicate-contacts
---


# Question
Title: Status message "Thank you. Your information has been saved." is missing on profile submit
I'm currently testing our recent upgrade from 4.7.19 to 4.7.29 on our test server. We have a public email list signup page on our website using a civicrm profile with a re-direct to a new (empty) email list signup page. On our live site under the old release, when someone completes and submits this page, they get the message "Thank you. Your information has been saved." along with the fresh page. But under the new release we don't get that status message displayed. If I take out the re-direct I'll get that message but I don't like that generated page with the inappropriate "\>\>Back to Listings" link.

Is there a (non-programming) way for me to get that message displayed again as it was under the old release, or is this an inadvertant bug? Thanks for your help.

Wordpress 4.9.1

# Answer
There might be JS error which is causing status message not to appear. Please check for any JS error on browser console. i feel some wp plugin might be conflicting with CiviCRM plugin.
> 1 votes

# Answer
There was indeed a javascript error when I had the problem. When I tested this again a day later I did in fact get the expected status message (without my having implemented any fix).
> 0 votes

---
Tags: wordpress, profile, status, missing
---


# Question
Title: Bulk Delete of Spam Contacts and related Drupal Users
I've a list of 8K+ CiviCRM contacts that have been deemed spam/unwanted. I am looking to clear them from CiviCRM, along with their related Drupal users.

I've found and tested this module: https://www.drupal.org/project/userdelete which will allow me to plug in a list of email addresses, arrived at from joining my list of contacts to the civicrm\_uf\_match table.

My question is, what is the path of least resistance to handle a clean removal of the CiviCRM contacts?

The API explorer seems to indicate that the contact delete method will only take a single contact id at a time, which would force me to write a module or a rest client to iterate through my list.

Would simply updating the CiviCRM DB directly with is\_deleted = 1 do the trick?

I imagine this isn't a new situation...

Thanks in advance for your feedback.

# Answer
Since you are using Drupal, you can install the CiviCRM Entity module, and use Views Bulk Operations to create a View that will delete contacts, or any CiviCRM data in a Drupal Batch API process
> 2 votes

---
Tags: contacts, delete
---


# Question
Title: How can I indicate if our donors prefer to receive Charitable/Political Tax Receipts by Email or Postal Mail?
using: CDN Tax Receipts Extension https://github.com/jake-mw/CDNTaxReceipts

# Answer
The CDN Tax Receipts extension contains several hooks - one of them allows you to set the 'method' of delivery (Email vs Print) for a specific Contact. Here's an example implementation:

```
/**
 * Determine Contact's Preferred Communication Method
 * return 'print' -> if Postal Mail is checked
 */
function my_receipts_cdntaxreceipts_method($contactId) {

  // Check if Contact's Preferred Communication Method = Postal Mail -> id = 3
  $result_pcm_id = civicrm_api3('Contact', 'get', array(
    'return' => "preferred_communication_method",
    'id' => $contactId,
  ));

  if ($result_pcm_id['is_error'] != 1) {
    if (count($result_pcm_id['values'][$contactId]['preferred_communication_method']) == 1) {
      if ($result_pcm_id['values'][$contactId]['preferred_communication_method'][0] == 3) {
        return array('print');
      }
    }
  }
}

```
> 2 votes

---
Tags: extension, cdn-tax-receipts
---


title: Smart Groups and 'event dates'

text:
# Question
Title: Smart Groups and 'event dates'
might there still (or again) be an issue with 4.7.27 on wordpress like this?

How to use Smart Groups with relative dates?

i'd need to create a dynamic group based on the 'register date' for any event in the date range 'last week' - but it never seems to get updated, the from/to dates look like they're set statically after saving the dynamic group.

# Answer
This might be related to Smart Group relative date criteria not saving and there is fix for it https://github.com/civicrm/civicrm-core/pull/11486

Please let me know if that works for you.
> 2 votes

---
Tags: civievent, smartgroups, dates
---


# Question
Title: Drupal account creation adds users into a CiviCRM group or tags them
We are trying to create a report that shows our new website members (those who have created an account) who are designated by mandatory CiviCRM profile fields that define a member type which the user selects at registration. These fields are displayed on the Drupal registration and account editing screens.

When users create an account on Drupal, a contact is either created for them in the CiviCRM, or a matching and existing CiviCRM contact record is found and updated. The custom fields already exist and are displayed on the website. What I would like to do is have the contact record be either added into a group or given a tag, which would ultimately make it easier for me to generate accurate reports about our different "members". The tag or group would be the same for all users. Something like "Users who registered for an account". Some of our contact records are created for other reasons so that's why I want to distinguish between the two.

Drupal 7, CiviCRM 4.7.27

# Answer
> 2 votes
If you are using profiles for user registration than you can configure profile to add contact to a Group. This will have contacts who submits the profile added to group and then you can use filter group in in reports or search.

---
Tags: drupal, groups, tags, user
---


# Question
Title: How to hide configuration tabs of a report with the "print to pdf" action remaining active?
I want a category of users can access some reports, view the results on the screen and print them to PDF. And to prevent any modification of the criteria, I want all the report configuration tabs to be hidden.

This is done by this users role having the permission “access CiviReport” enabled but the “access Report Criteria” one disabled.

But when disabling the “access Report Criteria” permission, the "Print report" and "Print to PDF" actions become inactive.

Is there any way to get what I want ?

Thanks for help.

# Answer
> 2 votes
This seems to be a bug in CiviCRM. Below patch will allow anonymous user to Print report or Print PDF.

```
diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index 75a614c836..9acd75c584 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -2580,7 +2571,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     if (empty($this->_params) &&
       $this->_force
     ) {
-      $this->setParams($this->_formValues);
+      $this->setParams($this->_submitValues);
     }

     // hack to fix params when submitted from dashboard, CRM-8532
@@ -2588,7 +2579,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     // in dashboard mode for report
     //@todo - this could be done in the dashboard no we have a setter
     if (empty($this->_params['fields']) && !$this->_noFields) {
-      $this->setParams($this->_formValues);
+      $this->setParams($this->_submitValues);
     }

```

Not sure what is the difference between formvalues and submitvalues even though params are considered from submit values for processing.

HTH

Pradeep

---
Tags: civireport, permissions
---


# Question
Title: How to get a list contacts that have not donated within a certain amount of time?
Hello CiviCRM community,

I've been trying to wrap my head around this and can't seem to figure it out.

I'm looking to get list of contacts that have not donated within a certain amount of time to target them to donate.

Any ideas on how to run this report?

# Answer
> 1 votes
I would use the CiviRules extension to achieve this. With this extension you can check if contacts in a certain group have not donated for a period of time for example.

You can find the extension here: https://civicrm.org/extensions/civirules (or in your extension list)

Documentation on using this extension can be found here:https://docs.civicrm.org/civirules/en/latest/

# Answer
> 0 votes
You can use CiviRules extension to get that is required. You can setup triggers, conditions and actions using this extension.

A detailed documentation has been compiled by them which can be found here.

Hope this helps.

---
Tags: civicontribute, contacts, civireport, contributions
---


# Question
Title: Getting this install error using latest CivicCRM on wordpress
```
Fatal error: Uncaught Error: Call to undefined function set_current_screen() in /var/www/html/wp-admin/admin-header.php:30
Stack trace:
#0 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php(267): require_once()
#1 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(219): CRM_Utils_System_Base->theme('<div id="crm-co...', false, false)
#2 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(233): CRM_Utils_System::theme('<div id="crm-co...')
#3 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
#4 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct('DB Error: alrea...', -5, 16, Array, 'CREATE TABLE ci...')
#5 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-5, 16, Array, 'CREATE TABLE ci...')
#6 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -5, 16, in /var/www/html/wp-admin/admin-header.php on line 30

```

# Answer
> 1 votes
It seems like you have two problems.

As Pradeep mentioned in the comments - it seems like your underlying error is that the install is trying to create a database that already exists. I can't tell for sure, because the error in #4 is cut off.

Additionally, there's the second error (undefined function) which is unfortunately WordPress-specific and I don't know the solution. However, completely removing/creating the CiviCRM database again (assuming that it's separate from WordPress) is likely to solve the first problem, and the second problem won't occur.

# Answer
> 0 votes
Try adding following line in functions.php file of your child theme.

`require_once(ABSPATH . 'wp-admin/includes/screen.php');`

Which wordpress version and civicrm version are you trying?

---
Tags: wordpress, installation
---


# Question
Title: Update to WP 4.3 Broke CiviCRM Dashboard in CiviCRM 4.6.8
I just updated my Wordpress site to WP 4.3 and updated CiviCRM to 4.6.8. Now my CiviCRM Dashboard is being "polluted" with widget content destined for other parts of the main site.(see screen capture) It only happens when a "dashlet" has been dragged into place, but without dashlets, the dashboard is kind of useless. I tried clearing Civi's caches via the Admin menu, with no luck there. I'm hoping I don't have to go hunting for a new WP Theme, but I know that WP 4.3 made big changes in the theme widgets and customization user experience, so I'm worried.

Anybody else experiencing this? Any advice?

# Answer
I wonder if you still need help with this or not. I tried to replicate with WP 4.3 and Civicrm 4.6.8 and dashboard was loading without any issues, i would suggest update your wordpress version to the latest at of now, 4.9.1 and i think problem will be solved.

Thanks
> 1 votes

---
Tags: wordpress, dashboard, dashlet
---


# Question
Title: Fatal error using Paypal in Version 4.7.29
Using the payment processor PayPal\_Standard on a fresh install of CiviCRM Version 4.7.29 (with Wordpress 4.9.1 on Centos 7.4) breaks all contribution pages where PayPal is enabled. The result is a blank page. In the Apache error log there is:

`PHP Fatal error: require_once(): Failed opening required 'CRM/Core/.php' (include_path='.:/somedir/wp-content/plugins/civicrm/civicrm:/somedir/wp-content/plugins/civicrm/civicrm/packages:/somedir/wp-content/plugins/civicrm/civicrm/vendor/tecnickcom:/somedir/wp-content/plugins/civicrm/civicrm/vendor/phpseclib/phpseclib/phpseclib:/somedir/wp-content/plugins/civicrm/civicrm/vendor/pear/pear_exception:/somedir/wp-content/plugins/civicrm/civicrm/vendor/pear/auth_sasl:/somedir/wp-content/plugins/civicrm/civicrm/vendor/pear/net_socket:/somedir/wp-content/plugins/civicrm/civicrm/vendor/pear/net_smtp:/somedir/wp-content/plugins/civicrm/civicrm/ve in /somedir/wp-content/plugins/civicrm/civicrm/Civi/Payment/System.php on line 59, referer: https://someurl/civicrm/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1`

When disabling PayPal (= pay later) the contribution pages work fine.

Any ideas what might be going wrong here?

# Answer
You're experiencing the bug documented at CRM-21595. You will need to apply the patch or wait for CiviCRM 4.7.30.

Most people won't experience this bug if they disable "Pay Later" as an option.
> 3 votes

# Answer
You can install the rc for 4.7.30 which is what I recommend - it's at download.civicrm.org/latest
> 1 votes

---
Tags: payment-processor, contribution-page, paypal
---


# Question
Title: What is the recommended way to upload husband and wife data from csv file
csv file has name of both husband and wife as well as the same address field. Separate cell phone #s but same home #.

# Answer
> 2 votes
This is an excellent question, and it has more to do with how you want to use your data than with the technology.

Most CRM experts will tell you that the "right" way is to make the husband and wife each into their own contact, and create a "spouse" relationship between the two. You could also consider using "address sharing" so that updating one address updates both, if you like - though I don't think there's a way to do that from an import.

Of course, the reality is that if it would be a ton of work to handle them separately (e.g. the spouses' names in the CSV aren't in separate columns) and you only deal with them together, you could "cheat" and upload them as a single contact.

Assuming you want to do it the "right" way, I would do the following:

* Add a new column called "spouse identifier", which is a serial number: 1, 2, 3 etc.
* Import the first spouse, with their name, cell #, address, etc.
* For columns that belong exclusively to the spouse, use the "related contact info" to select "Spouse Of" (see screenshots 1 and 2 below).
* Finally, do the same with "spouse identifier", setting the field to the "Spouse Of" "External Identifier".

When you're done with this import, you're almost there - you'll have both spouses imported, each with their own cell #. The shared contact info will be on the first spouse but not the second spouse.

To add the shared contact info to the second spouse, import a second time. However:

* Only import the "spouse identifier" field and any shared contact info fields. Don't import any other columns.

CiviCRM will use the external identifier to understand that you're adding additional contact info to the second spouse.

---
Tags: upload
---


# Question
Title: Is there a way to find out why an email address is 'on hold'?
I'm currently going through our system and there is a lot of emails that have been put on hold, is there a way to find out or is there a list somewhere on the database as to why each one is specifically on hold (i.e. email is not active or security issues)? I'm currently having to go through one by one which is necessary but time consuming.

Any help would be appreciated.

# Answer
> 4 votes
Yes - you want the "Bounce Report". Click on **Reports menu » Mailing Reports**, select **Bounce Report**. In "Columns", check the "Bounce Reason" checkbox, and ideally "Bounce Type" as well.

---
Tags: bounce
---


# Question
Title: Adding contributions doesn't work for certain currencies
I noticed importing or adding contributions in Serbian dinars (RSD) doesn't work. I tried using API Explorer to create a contribution that way but I get the same error I get when I try to import contributions.

```
{"sequential":1,"financial_type_id":"Donation","total_amount":100,"contact_id":2,"currency":"RSD"}

```

> "error\_message": "Currency not a valid code: "

I then tried to find out are there other currencies that don't work and I tried importing a file with donations in all currencies in the `civicrm_currency` table. It turns out that there three more currencies which don't work.

The currencies affected are:

* Serbian Dinar (RSD)
* Venezuela Bolivar (VEF)
* Azerbaijanian Manat (AZN)
* Mozambique Metical (MZN)

When I try to add a contribution manually through the form using these currencies, CiviCRM disregards my selection and uses the default currency.

There is a workaround. You can set any of these affected currencies as default, and then leave the field for currencies blank for that currency when importing (or leave default when adding a contribution manually). CiviCRM will then assume you are using a default currency and import or add it correctly. Still there's a problem if you want to use other currency for default (USD for example) and add contributions in affected currencies.

What could be causing this?

I'm using the current version of CiviCRM (4.7.29)

# Answer
> 2 votes
This was curious, so I tracked it down.

Apparently the list of valid currencies predates the `civicrm_currency` table. So right now the valid currencies are hardcoded - you can see that in `<civiroot>/CRM/Core/Pseudoconstant.php` around line 1077 - the `currencyCode()` function.

As a quick workaround, you could add your currency to the list. However, the correct solution would be to modify this function to return the result of `SELECT name FROM civicrm_currency`.

# Answer
> 1 votes
I tried to replicate it in Civicrm 4.7.23 and Drupal 7.56 and i also got same error message through API call:

`$result = civicrm_api3('Contribution', 'create', array(
 'financial_type_id' => "Donation",
 'total_amount' => 100,
 'contact_id' => 202,
 'currency' => "RSD",
));`

Looks like its bug (maybe) in civicrm, i have created Jira issue here.

---
Tags: civicontribute, api, core, currency, data-import
---


# Question
Title: After upgrade to 4.7.29, 500 error on payment
WI upgraded to 4.7.29 and get this error when on a contribute page. As far as I can see, the file CRM/Core/.php does not exist. What would/should create it?

Got error 'PHP message: PHP Fatal error: require\_once(): Failed opening required 'CRM/Core/.php' (include\_path='/var/www/slnmembers\_drupal/sites/default/files/civicrm/extensions/uk.co.vedaconsulting.mailchimp/:/var/www/slnmembers\_drupal/sites/default/files/civicrm/extensions/com.drastikbydesign.stripe/packages/:/var/www/slnmembers\_drupal/sites/default/files/civicrm/extensions/com.drastikbydesign.stripe/:.:/var/www/slnmembers\_drupal/sites/all/modules/civicrm:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/packages:.:/var/www/slnmembers\_drupal/sites/all/modules/civicrm:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/packages:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/vendor/tecnickcom:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/vendor/phpseclib/phpseclib/phpseclib:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/vendor/pear/pear\_exception:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/vendor/pear/auth\_sasl:/var/www/slnmembers\_drupal/sites/all/modules/civicrm/vendor/pear/net\_sock...\n'

# Answer
> 1 votes
I'd guess you've got payment processor configured with an empty class name. Check the tables civicrm\_payment\_processor and make sure each one has something in the class\_name field, e.g. using

```
select id,is_active,class_name from civicrm_payment_processor

```

You can probably delete it if this is the problem.

---
Tags: civicontribute
---


# Question
Title: System Status Notice about Timestamps and Timezones
I've update my CiviCRM from 4.7.24 to 4.7.29 (my CiviCRM system on WordPress), everything seems ok but I have System Status Notice:

Timestamps and Timezones

This MySQL database stores certain fields with data-type "DATETIME". To improve timezone support, you may want to change these from "DATETIME" to "TIMESTAMP".

civicrm\_subscription\_history.date (New sites default to TIMESTAMP in v4.7.27+) \[CRM-21157\] (https://issues.civicrm.org/jira/browse/CRM-21157)

Changing should improve data-quality for organizations working in multiple timezones. However, if you do change, then you may need to re-test any customizations or processes that reference these fields. Changing is suggested but not required.

For further discussion, please visit https://github.com/civicrm/org.civicrm.doctorwhen

How can I do to pass this notice?

# Answer
I've found link go to Doctorw Wen in CiviCRM (WordPress version) by go to Administrator Menu and fix the notice "Timestamps and Timezones", Thanks!
> 2 votes

# Answer
Applying the patches mentioned in the commits information here will fix your problem for civicrm\_subscription\_history.date column.
> 0 votes

---
Tags: wordpress, status
---


# Question
Title: Emails sent to an outlook email address are returned with failed fraud detection
for some reason recently all emails we send that go to an outlook email will have

> This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing

What am I able to do about this?

# Answer
Welcome in the world of preventing spam. Your email is rejected by a Microsoft service, so Microsoft sets the rules. According to their documentation, the cause may be spoofing or, more likely in your case an *incorrectly configured Sender Policy Framework (SPF) record*.

You can reproduce this problem by sending a single email to an outlook address by using just the send mail action.

My assumption is that you sent your email directly from the server where CiviCRM is installed by using the *mail()* or the *sendMail* option in *Settings - Outbound Mail* . But your is not registered according to the SPF framework to be a legitimate email sender for your domain.

You can try to send the emails using SMTP server of your ISP (configure *smtp* in Outbound Mail). Another option is to add an SPF record to your DNS. More information at OpenSPF.

However, SPF is not the only countermeasure to discourage spam. The other is DKIM.

If you are sending large volumes of email you can consider using a specialised SMTP provider.
> 5 votes

# Answer
Try sending you mailings to the email address on https://www.mail-tester.com and checking the results (just folw the big instructions on the page) - ain't no good if you get a rainy day - you need bright sunshine and birds singin'.

MSOutlook servers also often require the DMARC record set (it' tell you how).

SPF and DKIM are also good, but check the report.

SPF is easy to set up (just find some docs) - it's just registergint he address of your outgoing server - the report will also give you some details for that.

Good luck!
> 2 votes

# Answer
I have had lots of troubles with mails and mailings ; I finally decided to use CiviSMTP services.
> 0 votes

---
Tags: civimail, smtp
---


# Question
Title: Create Report Showing The Notes Created for Organisations
I want to create a report that shows the most recent note that has been created for each organisation. When I looked at modifying one of the existing reports, I could not find in any of the reports, the option to include the standard notes field. Have I missed it or do I need to create a custom report?

I know I may be able to achieve this through Drupal Views but would rather create a report if necessary.

(I am using version 4.7.28)

# Answer
> 0 votes
I do think you need a custom report for that. I dont know whether you can programm such a report your self, if not you might ask someone from the community to do that for you.

---
Tags: civireport, reports
---


# Question
Title: condition on count from chained api call
I am trying to use the api to get all contacts without an address with locationtype billing. For this I use the contact get api, and do a chained address get call. Is there a way to put a condition on the number of results from the chained call?

This is a non-working example of what I am trying to do.

```
$result = civicrm_api3('Contact', 'get', array(
  'sequential' => 1,
  'api.Address.get' => array('location_type_id' => "billing"),
  'api.Contact.get.count' => 0,
));

```

# Answer
> 1 votes
I don't think that is possible. The chained API works to extend the data on the contacts found.

Could you explain a little more on why and what you want to achieve functional?

# Answer
> 0 votes
I feel it's not possible to do such complicated filtering in api. You will need to add php code with multiple api calls

1. Get all the contacts using address api with location type = billing.
2. Use Contact get api to retrieve all contacts using condition id NOT in contact id's retrieved from #1

HTH

Pradeep

---
Tags: api, php, chaining
---


# Question
Title: Upgrade to 4.7.29 causes Internal Server Error with cron
I upgraded our test site to 4.7.29 (type fixed) yesterday and the cron has been failing since then with a 500 server error.

We are running on Wordpress 4.9.2. The cron has been working successfully until now for years.

We have a cron job running every 30 minutes using the URL to cron.php method. I've checked the cron.php permissions; they haven't changed and have checked that the user and password are still valid and have enough permission (they do). When I run the command directly from the command line I also get a 500 internal server error, same with running it in a browser. The only thing we did was upgrade the version of CiviCRM. Help?

# Answer
So I resolved the issue. Here's what I found. It looks like the permissions for **bin** have changed from **755** to **775** at some point (I looked at one of our backups and it used to be 755, but in 4.7.29 it was set to 775.)

I used this question and response: URL for cron Jobs gives me a 404 error (not the same error, but I was desperately searching!)

Made the same changes (**updated bin permissions to 755**) and it all worked. So that's good (for now) but with every upgrade will we have to remember to update permissions?
> 1 votes

---
Tags: cron, scheduled-job
---


title: How to get relationship changes logged?

text:
# Question
Title: How to get relationship changes logged?
On the 4.7 Drupal 7 Demo site I changed the middle letter of contact Kathleen Adams and it gets logged and becomes visible in the log tab. Then I make a change in the relationship tab, adding a Case Coordinator relationship to Megan Roberts and removing that relationship again. Both these changes to the contact are not logged.

Is there a setting that it will also log these changes? When there isn't such setting available, could this be considered a bug and reported as such?

The same questions for version 4.6.x because that is the LTS version I am using at the moment.

# Answer
If you have enabled the detailed logging it is currently displayed under the target contact of that relationship.

Arguably it would be better if it is shown on both contacts.

You can view all changes in the `Contact Logging Report (Summary)`.
> 2 votes

---
Tags: 4.7, relationships, 4.6, logging
---


# Question
Title: Pay Later status on imported contributions
I am trying to do a bulk import of transactions that are all being invoiced now. By indicating the Contribution Status as "Pending," the transactions all import as "Pending (Incomplete Transaction)" Is there any way to get them to import as "Pending (Pay Later)"? I've tried several different variations of the text in the Contribution Status column, but all seem to fail.

# Answer
> 2 votes
The contribution status text `Pending` seems to be right in your csv.

`Pending(Pay later)` status is displayed based on the `is_pay_later` value in civicrm\_contribution table. So it seems you need to add another column in CSV with value `1` and map it to the field `Is Pay Later` on the `Match Fields` screen. See below Screenshot.

---
Tags: contributions, import, pending
---


title: Marking a contact as closed/inactive

text:
# Question
Title: Marking a contact as closed/inactive
We have a school that is a contact organization and it has now closed how can I mark it as inactive/closed?

# Answer
> 1 votes
What you could do is to use a custom field for that. And make sure when you search for contacts you search for active contacts.

---
Tags: contacts
---


# Question
Title: Dedupe Rules to import contacts without email addresses *UPDATE*
UPDATED 1/16/2018 See screenshot. This is an example of what I am trying to import. This is the same person. The only difference is the notes. How can I import this without creating 4 duplicates?

\****End Update\****

I am still unable to resolve this issue. Is there anyone else who has imported contacts who do not have email addresses?

We are using Civi 4.7.29 on WordPress 4.9.1

We have a whole spread sheet of contacts who do not have email addresses and I am trying to import them into Civi. The names, addresses and postal codes for individual contacts match, but the Notes are different and that is is why I need to import them, so the notes are added to their Civi profiles

I created a new general Dedupe rules with First Name Weight = 10, Last Name weight = 10, Postal Code Weight = 10. The idea is if the First Name, Last Name and Postal Code don't match, create a new profile. If they do match, just update the current profile. However every time I try this, it just continues duplicating every single person for each note they have. For example if they have 3 notes on their profile, there will be 3 duplicates for that person.

I tried adding the street address and other fields to the dedupe rule, and still got the same exact results. It appears that unless they have an email address it will deplicate the record, and will ignore all other dedupe rules. I was able to perform this same task with no problems with our contacts who do have email addresses.

Can anyone suggest a dedupe rule setting I should try for this task of importing people and their notes, when the contact does not have an email address?

Thank you.

UPDATE I visited the demo site at https://demo.circle-interactive.co.uk/ and ran some tests and got the same results as I described above. The screenshot shows my dedupe settings.

# Answer
In my demo I see that there are three reserved rules for individuals. Reserved means that they cannot be deleted.

When I click the question mark I read:

> The 'Unsupervised' rule for each contact type is automatically used when new contacts are created through online registrations including Events, Membership, Contributions and Profile pages. They are also selected by default when you Import contacts.

I tried to set all reserved rules and my own rule too general, but at import it expects at least one Unsupervised rule active. So I changed my custom rule to Unsupervised and also choose it at import.

Then the dudupe seem to work at import. When set import to Update and it did update, but when I tried Fill, it did not do what I expected. My data:  Dedupe rules (all made general except my custom rule):  My custom rule:

With Fill it would import the first but not add the second phone number, with Update it would import the first and update it with the last, leaving it the the last phone number.

When in my project I tried to use the import feature of CiviCRM I concluded that it is too limited to do what you intend to do. I decided to ignore it and make my own import module in Drupal and using the CiviCRM API calls and the Drupal PHPExcel integration module. PHPExcel reads spreadsheets into a PHP variable and then with dedupe check turned off you can apply your own logic and criteria.
> 1 votes

# Answer
\[I know this is more of a comment than answer, but I can't post a screenshot in a comment\]

You describe creating a new dedupe rule, but in the Import Options section of the Import screen, are you selecting your new dedupe rule as the one to use?

You will also want Update or Fill on the line above.
> 0 votes

---
Tags: duplicate-contacts
---


title: How do I upload files in a custom form?

text:
# Question
Title: How do I upload files in a custom form?
`civix generate:form` creates a basic form with a `buildQuickForm()` and `postProcess()` demonstrating a select option.

I want the form to upload a file and save it to a custom field.

If I add: `$this->add('file', 'file_id', "My document")` then I get a normal file upload element on the form, but the problem is what to do with it in the postProcess.

`$this->controller->exportValues()` does not include my `file_id` although it is listed in `$this->getSubmitValues(TRUE)` with the the original file name and tmp\_name.

I understand QuickForm does some filtering of submitted values but how do I stop the file details being filtered out and get it saved as a custom field?

# Answer
> 4 votes
I just created a custom extension that uploads a CSV file and reads it into a table.

I added the file element in `buildQuickForm` as follows

```
  $this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);

```

And the processing of the file was is done with

```
public function preProcess()
{
    if (isset($this->_submitFiles['uploadFile'])) {
        $uploadFile = $this->_submitFiles['uploadFile'];
        $importer = new CRM_Importer();
        $importer ->truncate();
        $importer -> importCVStoTable($uploadFile['tmp_name']);
    }
}

```

I think the key element is `$this->_submitFiles` and you already found about the `tmp_name`

---
Tags: quickform
---


# Question
Title: How to get subsidiary membership to work?
For our purposes, memberships are organization-based, with individuals receiving membership benefits by being designated as an employee. This works great.

However, I have the use case where there is a subsidiary company that is part of the larger member company, but has a different name. This matters because if a person registers for an event under the subsidiary company name, they are not recognized as a member and fall out of the member smart group, which we use for mailing list, access, and other purposes.

I created a new membership type called Subsidiary Members and set the relationship as "Partner of," then applied relationship that to a subsidiary of a member company. My hope was that this organization would gain membership via their parent organization, which would then pass down to employees. However, the subsidiary company is still showing as a non-member.

Is there another way I can make this work?

Running CiviCRM 4.7.29 on Joomla 3.8.3

# Answer
> 1 votes
If I understand you correctly, you have a Main Member type inherited by 'employee' relationship. The primary members are companies. You also have a Subsid Member type inherited by 'employee' where there the primary members are subsid companies connected to the parent company with a 'Partner of' relationship. You have tried changing the Main Member type to be inheritable by both 'employee' and 'partner' but the subdid employees are not inheriting Main Member.

That should result in your subsid companies (the orgs) inheriting Main Member type. ... but that is not related to the Subsid Member type that is inheritable by your subsid company employees.

What I think you would like is for the Main Member type to be inheritable by both 'employees' and 'employees' of 'partners' - but so far as I know Membership is only inheritable by one level of relationship. In other situations you might use a smart group, but that is not applicable to membership inheritance.

So, some possibilities:

1) You could write an extension (or maybe use CiviRules) so that employees of subsid companies are also given a direct relationship (eg 'subsid-employee') to the parent company. You would need to check for changes on the 'employee' and 'partner' relationships to add and remove the 'subsid-employee' relationship. Main Member then becomes inheritable by 'employee' and 'subsid-employee'.

2) You could write a different extension (or CiviRules) to maintain the status of Subsid Member type based on the Main Member status and 'partner' relationship but I don't think the Subsid Member type particularly helps you.

3) Alternatively you could enhance Membership inheritance to be inheritable based on group membership as well as relationship.

4) Taking things further, some kind of 'smart relationship' feature could be useful in other situations. The existing features for second-degree relationships and smart groups could provide starting points - but that might be a larger project than you wanted :-)

# Answer
> 0 votes
This post on Github suggests that what you're trying to do is normally possible but is currently bugged. If applying the patch at that link doesn't solve your problem, you may want to ask the patch author if you're missing a step.

---
Tags: civimember, joomla, relationships
---


title: How can I identify DB error?

text:
# Question
Title: How can I identify DB error?
Suddenly an error appeared out of nowhere when managing groups.

> "Count data for smart groups is not currently calculated. You may click Update \>Smart Groups to generate it. Be aware this can cause significant server load." *(screenshot 1)*

When I try to **Update Smart Group Count** or click on *Contacts* of any group, there is the error:

> Sorry but we are not able to provide this at the moment.
>
> DB Error: unknown error
>
> Return to home page.
>
> *(screenshot 2)*

Meanwhile, the database is NOT down. I can access contacts through search.

What could have happened? Where do I start looking for solutions?

**CiviCRM 4.7.14. on Drupal 7.52**

##

# Answer
`civicrm_group_contact_cache` table for some reason has exceeded auto-increment value limit (2^32).

This is possible because of nature of this table - caching, adding, removing items.

Solution is to drop auto-increment value to beginning:

```
ALTER TABLE civicrm_group_contact_cache AUTO_INCREMENT = 1

```
> 2 votes

# Answer
Detailed instructions are available in the "More detailed errors" section of the troubleshooting guide. In short: Either turn on debugging AND backtrace, which will give you a more detailed error; or view the appropriate errors in your CiviCRM log.

If you need help interpreting those errors, I suggest opening a new question here. It's also a good practice to paste the text of the error instead of (or in addition to) a screenshot of the error - it makes it easier for others to search, and easier for someone to troubleshoot.
> 2 votes

# Answer
You will find more information on the cause of error you are getting in civicrm log files. The location may vary of log files based on the CMS you are using. Typically location of log files for following CMS's are as follows:

**Drupal**: sites/default/files/civicrm/ConfigAndLog

**Wordpress**: Location is based on civicrm version, can be found at one of the following locations:

* wp-content/uploads/civicrm/ConfigAndLog
* wp-content/plugins/files/civicrm/ConfigAndLog
> 0 votes

---
Tags: error, groups, smartgroups
---


# Question
Title: How to get contacts in children of a parent group using the API
I have a child groups C and B, each with 20 different contacts in them. Both child groups are in parent group A. I need to find all contacts in all children of A since C and B might be removed later or new children added to A. But A will not change. However, Group A is not *itself* populated. As a result, the CiviCRM API returns 0 results. Is there handy API method which will help me out?

API Command:

```
 $result = civicrm_api3('GroupContact', 'get', array(
  'sequential' => 1,
  'group_id' => "Donors_74",
));

```

Actual results from the API explorer:

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

    ]
}

```

Expected result: 1676

We are using CiviCRM 4.7.25.

# Answer
You can use the 'group' filter on the Contact api to get members of parent groups.

```
$result = civicrm_api3('Contact', 'get', array(
  'sequential' => 1,
  'group' => XX,
  'options' => array('limit' => 0),
));

```

where XX is the id of the parent group (A).
> 1 votes

# Answer
The query worked fine for me, i am using name of group instead of id. Example:

```
$result = civicrm_api3('Contact', 'get', array(
  'sequential' => 1,
  'group' => "Advisory Board",
  'options' => array('limit' => 0),
));

```
> 0 votes

---
Tags: contacts, api, groups
---


# Question
Title: Using Wordpress for installing Civi got these errors!
Notice: Use of undefined constant **DIR** \- assumed '**DIR**' in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/ClassLoader.php on line 127

Notice: Use of undefined constant **DIR** \- assumed '**DIR**' in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/ClassLoader.php on line 104

Notice: Use of undefined constant **DIR** \- assumed '**DIR**' in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/ClassLoader.php on line 105

Notice: Use of undefined constant **DIR** \- assumed '**DIR**' in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/ClassLoader.php on line 104

Notice: Use of undefined constant **DIR** \- assumed '**DIR**' in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/CRM/Core/ClassLoader.php on line 105

Fatal error: Class 'CRM\_Core\_Config' not found in /home/yonatony/public\_html/wp-content/plugins/civicrm/civicrm/install/index.php on line 138

# Answer
> 0 votes
Please make sure all files of civicrm were uploaded in your site files and file `wp-content/plugins/civicrm/civicrm/CRM/Core/Config.php` is present there.

Also make sure your database credentials are correct and following lines are present in the end of file civicrm.settings.php

`require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();`

---
Tags: wordpress
---


# Question
Title: How do I troubleshoot DB Error: connect failed on a new installation on Wordpress?
I am following the detailed instructions to install Civi under Wordpress. I am running a local development Wordpress site using MariaDB 10. I have downloaded and activated the CiviCRM plugin. The CiviCRM installer is accessible. I have created a new empty database and user for CiviCRM and I can get a full "Green" ("You're ready to install") from the installer. But when I click on "Check requirements and install" I get an error:

"Cannot open mysql://\[user\]:\[password\]@localhost:3307/\[path\_to\_database\]?new\_link=true: DB Error: connect failed."

The server port number is correct for this installation.

Any idea where I can look for more detail on why the connection fails at this stage?

# Answer
The php mysql extension is no longer supported. Need to use mysqli. See https://civicrm.org/blog/totten/psa-please-verify-php-extension-mysqli

The web server log might also indicate the error.
> 1 votes

# Answer
As suggested by demerit, it is not necessary to specify the "unix socket" path in the server details. On the "CiviCRM Installer" page, in the server details, enter only \[servername\] and optional \[:port\] if port is not default.
> 1 votes

---
Tags: wordpress, database, installation
---


# Question
Title: How can I track donations made as a result of a particular email?
I know that I can see who clicked through on the "donate" link on an email - but I don't see a way to check if the donation was made as part of that interaction.

Is there a way to determine this?

# Answer
The easiest way to do this (whilst not 100% foolproof) would be to create a special donation page for the link in the email (i.e. separate from the donation page that presumably appears as link and 'proper' page on your website).

Go to *Contributions \>\> New Contribution Page* or *Administer \>\> CiviContribute \>\> Manage Contribution Pages*.

Then once your new contribution page is complete, simply copy the URL you get from **Links \>\> Live Page** into where you have the donate link in your emails. It will look something like https://your-site.com/civicrm/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=2

As long as you don't link to that URL from anywhere else (like a button on your website), it should only ever be used by someone clicking on an email. You can then use a Contribution Report for that particular donation page.

It looks like you may also be able to do it with custom fields and passing URL parameters, but that's more complicated. See this entry in the wiki, from 2014: https://wiki.civicrm.org/confluence/display/CRMDOC/Update+custom+fields+in+contributions+and+events+by+passing+variables+in+a+URL
> 4 votes

---
Tags: civimail, contribution-page
---


# Question
Title: Can I have a price set option add a registrant to the waitlist if the event isn't full?
I have what may be a tricky situation regarding registration and waitlists.

We have an event where we have two potential types of registrants: residents of a jurisdiction and people who live outside of the jurisdiction. People pick if there's a resident or non-resident in price options when they go through event registration.

Those who pick the Resident price option should go through registration and fee payment normally and end up with a "registered" status when they're done.

We want people who pick the Non-Resident price option to not pay anything and be set to a waitlist status once they're done with registration. We would then manually move them to "registered" if there's enough room after a certain date.

Question 1: Is this a normal part of CiviEvent functionality that I'm just not able to find?

Question 2: We had a developer set up a price set like this that does work. We copied it, changed label names, and tried to use the new price set for another event, and the non-registrants are ending up "registered" instead of "waitlist." Any advice on how to successfully replicate that original price set? I just recently got access to cPanel for our site and I'm not sure what to look for here.

I appreciate any advice you may have. Thanks in advance.

# Answer
One approach would be to ask the resident/non-resident question first and direct them to two separate events: a residents one for immediate registration and a non-residents one with a max participants of 0.

When you want to allow non-residents to book you have two basic options:

1. open up non-resident bookings by changing the max participants on the non-resident event
2. find a way to transfer waitlist registrations from the non-resident event to the resident event.

For 1), you end up with registrations spread across two events which is not ideal but may or may not matter to you. To manage further registrations you probably want to close the residents event at the same time and direct any new registrations to the non-res one so that you can still manage total numbers.

For 2), I don't think there is an easy way to transfer registrations between events without some coding.

You mention cPanel - that's not relevant here. Event configuration is under the Event menu:
> 1 votes

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


title: customize the interface / view

text:
# Question
Title: customize the interface / view
I am starting with CiviCRM this week and a user asked to me: how to customize the contact summary view to add the 'Contributions tag' into the summay

I think I have to go to admin menu: Administer \> Personnaliser les données et écrans \> Préférences d'affichage, but I'm not sure

Thanks in advance for you help Javier

# Answer
> 1 votes
I assume your user does not see the contributions tab in the contact summary?

That can be because on the fact that the CiviContribute component is switched off (Administer\>System Settings\>Components).

It can also be because the tab is switched off for the contact summary (Administer\>Customize Data and Screens\>Display Preferences - then check the if Contributions is ticked in Viewing Contacts)

---
Tags: custom-fields
---


# Question
Title: CiviCRM upgrade `civicrm`.log_civicrm_activity error
Upgrading a CiviCRM DB from 4.7.17 to 4.7.29 after moving from MySQL 5.1 (CentOS 6 install) to CentOS 7 with MariaDB 10.2. After the progress bar completes on the wp-admin/admin.php?page=CiviCRM&q=civicrm/upgrade&reset=1 page, then I get an error:

```
backTrace

#0 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(187): CRM_Core_Error::backtrace()
#1 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB.php(984): PEAR_Error->__construct("DB Error: syntax error", -2, 16, (Array:2), "ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#3 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-2, 16, (Array:2), "ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#4 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -2, 16, (Array:2), "ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...", "DB_Error", TRUE)
#5 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#6 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-2, NULL, NULL, "ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...", "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#9 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2446): DB_common->query("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#10 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#11 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(369): DB_DataObject->query("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...")
#12 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1318): CRM_Core_DAO->query("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...", FALSE)
#13 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Logging/Schema.php(399): CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NU...", (Array:0), TRUE, NULL, FALSE, FALSE)
#14 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Logging/Schema.php(468): CRM_Logging_Schema->fixSchemaDifferencesFor("civicrm_activity", (Array:3), FALSE)
#15 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Logging/Schema.php(286): CRM_Logging_Schema->fixSchemaDifferencesForAll()
#16 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Form.php(770): CRM_Logging_Schema->fixSchemaDifferences()
#17 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Page/Upgrade.php(182): CRM_Upgrade_Form::doFinish()
#18 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Upgrade/Page/Upgrade.php(81): CRM_Upgrade_Page_Upgrade->runFinish()
#19 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(309): CRM_Upgrade_Page_Upgrade->run((Array:2), NULL)
#20 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#21 /var/www/html/wp/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:2))
#22 /var/www/html/wp/wp-content/plugins/civicrm/civicrm.php(1216): CRM_Core_Invoke::invoke((Array:2))
#23 /var/www/html/wp/wp-includes/class-wp-hook.php(286): CiviCRM_For_WordPress->invoke("")
#24 /var/www/html/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
#25 /var/www/html/wp/wp-includes/plugin.php(453): WP_Hook->do_action((Array:1))
#26 /var/www/html/wp/wp-admin/admin.php(224): do_action("toplevel_page_CiviCRM")
#27 {main}

Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely rela' at line 1, 1064
Additional Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NULL () ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely related entity) was created or modified or deleted.' [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely rela' at line 1]
    [type] => DB_Error
    [user_info] => ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NULL () ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely related entity) was created or modified or deleted.' [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely rela' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="ALTER TABLE `civicrm`.log_civicrm_activity ADD   `modified_date` timestamp NULL () ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely related entity) was created or modified or deleted.' [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '() ON UPDATE current_timestamp() COMMENT 'When was the activity (or closely rela' at line 1]"]
)

```

If I remove the () from the middle of the SQL statement: ALTER TABLE `civicrm`.log\_civicrm\_activity ADD `modified_date` timestamp NULL () ON UPDATE current\_timestamp() COMMENT 'When was the activity (or closely related entity) was created or modified or deleted.' And do: ALTER TABLE `civicrm`.log\_civicrm\_activity ADD `modified_date` timestamp NULL ON UPDATE current\_timestamp() COMMENT 'When was the activity (or closely related entity) was created or modified or deleted.' It adds to the DB. However, a subsequent run of the upgrade process then tries to Modify the column and ends in essentially the same error at the same spot. Anyone else run into this? Is this a bug or problem with my install?

CentOS 7, CiviCRM 4.7.17-\>4.7.29, WordPress 4.9.2, MariaDB 10.2 SCL, PHP 7.0 SCL

# Answer
> 1 votes
I have ran into this issue as well. Initially I wasn't sure if it was because I use multi-lingual (which adds some complexity) or because of MariaDB 10.2.

I had initially patched my version of CiviCRM to remove those empty `()`:

```
diff --git a/sites/all/modules/civicrm/CRM/Logging/Schema.php b/sites/all/modules/civicrm/CRM/Logging/Schema.php
index b3480601..e3a5d285 100644
--- a/sites/all/modules/civicrm/CRM/Logging/Schema.php
+++ b/sites/all/modules/civicrm/CRM/Logging/Schema.php
@@ -489,6 +489,7 @@ AND    (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString )
     $query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE  CURRENT_TIMESTAMP", '', $query);
     $query = str_ireplace("DEFAULT CURRENT_TIMESTAMP", '', $query);
     $query = str_ireplace("NOT NULL", '', $query);
+    $query = str_ireplace('()', ' ', $query);
     return $query;
   }

```

However, looking at `civicrm_contact`, for example, I see `default current_timestamp()`, so the above replacements are causing the empty `()`.

It should probably something like this?

```
 $query = preg_replace("/DEFAULT CURRENT_TIMESTAMP(\(\))/", '', $query);

```

---
Tags: wordpress, upgrade, database, mariadb
---


title: Outlook iCal does not work?

text:
# Question
Title: Outlook iCal does not work?
When an activity is assigned to a user and an email is sent to the assignee with the calendar appointment, the ical is attached. However, when I open the file in Outlook 2013, it says "Meeting cannot be found in the calendar." I'm unable to save/add the meeting date into my calendar. Is there a way to resolve this?

I've also tried the activity iCal module, and I haven't been able to find a solution to add activities to Outlook effectively.

# Answer
> 1 votes
I think this is resolved. After researching prior problems with icals, I found this reference: https://stackoverflow.com/questions/15084236/icalendar-does-not-create-an-event-for-organizer

By changing the METHOD: REQUEST to METHOD: PUBLISH in templates/CRM/Activity/Calendar - Outlook users are essentially inviting themselves to their events (and the possibility to including others who are not Civi users).

Note: However, it looks like the notes aren't being pulled into the ical, and I'm not sure if this should occur or not.

# Answer
> 0 votes
The stack exchange thread quoted above also says that if you change METHOD:REQUEST to METHOD:PUBLISH you will get duplicates if you get an update. Also Dave points out in the CiviCRM issue that was opened that this change breaks the ical standard (which specifies that you cannot post attendees if the method is publish).

This seems like an Outlook bug, so trying to fix it in CiviCRM might not be the best option. And, for Outlook 2007 at least, there appears to be a fix.

---
Tags: activities
---


# Question
Title: Mass SMS broken, single SMS kind of works
Ok so this is a strange one. SMS has been working for years on our site without issue however it isn't used very frequently so I'm not quite sure when it 'broke'

Bit of background: Using 4.7.22 on Wordpress 4.8, PHP 5.5.9-1ubuntu4.4 and clickatell (org.civicrm.sms.clickatell) version 3.0.

I can successfully send a single SMS if I go into a contact and select 'Outbound SMS' from the 'Actions' menu. If I add another contact to the list, I get the error:

```
One of parameters (value: "Administrator) is not of the type Positive

```

(PS, the username is Administrator)

If I try to send a single SMS from the 'Contacts' menu, 'Send SMS' and just try a single contact I get the same error:

```
Sorry but we are not able to provide this at the moment.
One of parameters (value: "Administrator) is not of the type Positive

```

Here is some more debug info:

```
tent/plugins/civicrm/civicrm/CRM/Core/Error.php(374): CRM_Core_Error::backtrace()
#1 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Type.php(476): CRM_Core_Error::fatal("One of parameters  (value: "Administrator) is not of the type Positive")
#2 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Type.php(187): CRM_Utils_Type::validate("\"Administrator", "Positive", TRUE)
#3 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(3608): CRM_Utils_Type::validateAll((Array:2), "Positive")
#4 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(2022): CRM_Contact_BAO_Query->includeContactIDs()
#5 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(519): CRM_Contact_BAO_Query->whereClause(NULL)
#6 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(479): CRM_Contact_BAO_Query->initialize(NULL)
#7 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(4435): CRM_Contact_BAO_Query->__construct((Array:2), (Array:5), NULL, TRUE, FALSE, 1, TRUE, TRUE, TRUE, NULL, "AND", NULL)
#8 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Token.php(1240): CRM_Contact_BAO_Query::apiQuery((Array:2), (Array:5), NULL, NULL, 0, 2)
#9 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Form/Task/SMSCommon.php(188): CRM_Utils_Token::getTokenDetails((Array:2), (Array:5), FALSE, FALSE)
#10 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contact/Form/Task/SMS.php(79): CRM_Contact_Form_Task_SMSCommon::buildQuickForm(Object(CRM_Contact_Form_Task_SMS))
#11 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(564): CRM_Contact_Form_Task_SMS->buildQuickForm()
#12 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php(129): CRM_Core_Form->buildForm()
#13 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contact_Form_Task_SMS), "upload")
#14 /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Task_SMS), "upload")
#15 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("upload")
#16 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
#17 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(284): CRM_Utils_Wrapper->run("CRM_Contact_Form_Task_SMS", "Activities", (Array:1))
#18 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:14))
#19 /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#20 /var/www/html/wp-content/plugins/civicrm/civicrm.php(1227): CRM_Core_Invoke::invoke((Array:4))
#21 [internal function](): CiviCRM_For_WordPress->invoke("")
#22 /var/www/html/wp-includes/class-wp-hook.php(298): call_user_func_array((Array:2), (Array:1))
#23 /var/www/html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters("", (Array:1))
#24 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action((Array:1))
#25 /var/www/html/wp-admin/admin.php(222): do_action("toplevel_page_CiviCRM")

```

Because I CAN get it successfully send a single SMS, I know Clickatel is working and I've tried setting up a new provider with bogus credentials and get the same error. I also know I had this same issue using 4.7.19 and the Clickatell version 2.5 API which is the reason I updated CiviCRM and the API.

I'm really hoping somebody can point me in the right direction where to look to get this fixed. I know bulk SMS were working and have no idea what caused he breakage.

Thanks HEAPS!!

# Answer
> 0 votes
Just a longshot...:

Mass SMS is originally built on the same code as mass email.

Have you done any changes for mass email? If you give access permission for administrator mass email, it could mysteriously work...

Good luck!

# Answer
> 0 votes
The Clickatell extension was broken for some time. It has been updated since I last attempted to use it, but many people have switched to Twilio. Contact Veda Consulting if you want it fixed - they didn't respond to the bug I reported but I guess you could try: https://github.com/veda-consulting/org.civicrm.sms.clickatell/issues

---
Tags: sms, clickatell
---


title: Problem with Mass Registration

text:
# Question
Title: Problem with Mass Registration
There is no option to "Add Contacts To Event" once multiple contacts are selected from a specific event. How do I make this option available?

# Answer
Create a temporary group, add the selected contacts first to a group and after that go to search, select the contacts in temporary group and add the contacts to the event
> 1 votes

# Answer
I just had the same issue. Look for "Register participants for event" instead.
> 1 votes

---
Tags: civievent
---


# Question
Title: Is it okay to have simultaneous data import?
Is it okay to have more than one user import data at the same time another user is importing data?

We have a bunch of segmented data to import split amongst multiple employees - is it okay if two employees are uploading at the same time?

# Answer
> 3 votes
Yes it is absolutely fine to import data simultaneously but it might take bit long time to complete it. If you want to perform multiple import simultaneously make sure you imports are not linked to each other.

I usually prefer to do it one by one after taking backup at each stages. You never know when mysql might crash with an error saying mysql has gone away, already exists, invalid data etc.

# Answer
> 3 votes
It should be okay if multiple users are not updating/uploaded same record type's same item at the same time.

Like for example if multiple users are importing a same contact record, that might cause an DB error possibly.

---
Tags: import, data-import
---