Problem importing Civi Volunteer Needs We are working importing Volunteer Needs for various Volunteer Projects via the API csv Extension. When we load the interface, select the entity 'VolunteerNeed' and select file. When we hit continue we get the following:

  Uncaught Error: Call to undefined method
  CRM_Volunteer_DAO_Project::indices() in
  /home/<>/public_html/wp-content/plugins/civicrm/civicrm/api/v3/Generic/Getunique.php
  on line 44 civicrm_api3_generic_getunique()
  wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php:97
  invoke() wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php:168
  runRequest() wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php:99
  runSafe() wp-content/plugins/civicrm/civicrm/api/api.php:43
  civicrm_api3()
  wp-content/uploads/civicrm/ext/nz.co.fuzion.csvimport/CRM/Csvimport/Import/Form/MapFieldBaseClass.php:126
  preProcess() wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:585
  buildForm()
  wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php:92
  perform()
  wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203
  handle()
  wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103
  handle()
  wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:349 run()
  wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:311 runItem()
  wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:85
  _invoke() wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:52 invoke() wp-content/plugins/civicrm/civicrm.php:1392 invoke()
  wp-includes/class-wp-hook.php:286 apply_filters()
  wp-includes/class-wp-hook.php:310 do_action()
  wp-includes/plugin.php:465 do_action() wp-admin/admin.php:253

We have used the extension to import other entities with no issues. The site is running WP 5.2.4, CiviCRM 5.13.4, CiviVolunteer v4.7.31-2.3.1 & CSV GUI Import to api  v 1.5.

That error suggests that the entity (volunteer project) defined in the civivolunteer extension is "incomplete", i.e that it's missing an indices method.


What is the best way to avoid cartesian product on specific SELECT attributes? I faced similar issue in some CiviReports where some of the Select attributes applied with Group function like SUM(), got affected due to LEFT JOINs. Let me provide further clarification on basis of two resolved/current CiviCRM issues -

https://issues.civicrm.org/jira/browse/CRM-16338 where contribution sum(total_amount) got tripled if the contribution is linked with three soft-credits. Although resolved it via splitting the query onto contribution and soft-credit queries respectively, which might not be the right way to do it :/
[civicrm_contribution one-to-many civicrm_contribution_soft]
https://issues.civicrm.org/jira/browse/CRM-16719 where SUM(duration) got doubled if the activity got two target contacts.
[civicrm_activity one-to-many civicrm_activity_contact]

CiviReport has a tradeoff between having a lot of functionality and nice widgets already done for you, but you have less control over the final SQL. When I run into this problem I usually do it as a custom search instead. See http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Custom-Search+Extension .
Then you have more control over the SQL and can join with a subquery on the "many" table that reduces it to "one".

You might still be able to do it in a civireport, I just find it harder.

If you're asking instead for general SQL help, then if I bing for "select join mysql sum duplicate" I get answers like this one:
https://stackoverflow.com/questions/3345657/mysql-how-do-i-sum-non-duplicates-values-when-doing-multiples-joins


How cleanup civicrm database I've got a civicrm database of 1.4 Go (information available in PhpMyAdmin)
1Go is used by civicrm_activity table
I would like to know if have to clean, purge the database to reduce its size, cache or others maintenance actions.

I find some actions on documentation for cache files but nothing about database

Thanks for advices

civicrm_activity is a legitimate table with legitimate data.  You can use the API to mass-delete activities - but only you (and/or your users) can determine what represents data that is reasonable to delete.

If it's that large, I suspect it's quite likely that you're sending frequent mailings to large groups of people - the mailing history might be reasonable thing to delete.


Scheduled Reminders generates faulty SQL CiviCRM 4.7.27
Usually, our CiviCRM guru handles these, but I figured I would ask a wider audience.

When choosing date instead of an interval, the scheduled reminder fails with a DB syntax error. The error is in the " DATE_SUB(, INTERVAL hour))" part of the SQL.

The first argument to the function is missing and the time component for the interval is missing: (see below in bold). I would imagine this is a bug.. The SQL from the logfile:

Here's the SQL that is created by CiviCRM and fails:

SELECT e.contact_id as contact_id, e.id as entity_id, "civicrm_membership" as entity_table, 3 as action_schedule_id, MAX as latest_log_time
FROM civicrm_membership e
INNER JOIN civicrm_contact c ON c.id = e.contact_id AND c.is_deleted = 0 AND c.is_deceased = 0
INNER JOIN civicrm_action_log reminder ON reminder.contact_id = e.contact_id AND
reminder.entity_id = e.id AND
reminder.entity_table = 'civicrm_membership' AND
reminder.action_schedule_id = 3
WHERE (e.membership_type_id IN ("21")) AND (( e.is_override IS NULL OR e.is_override = 0 )) AND (e.status_id IN (5, 2, 9, 10, 4, 8))
AND ("20171108110009" <= DATE_SUB(, INTERVAL hour))
GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table
HAVING (TIMESTAMPDIFF) >= TIMESTAMPDIFF))

NOTE: There are missing parameters in the DATE_SUB function, the SQL fails and the scheduled reminder does not go out.

My friendly neighborhood Civi expert solved this problem.
The issue is with the "repeat" option in the scheduled reminder form.

If you specify, when to repeat without the "Until" piece, it generates faulty SQL.
Our expert modified the form so you can't leave that value blank if you click the repeat radio box.


Case ID in e-mails from case When sending e-mails from a case in CiviCRM the subject line contains a hashed case id between square brackets.
It looks something like [case #a234db] Subject of the e-mail which is not really user friendly.

I have traced this behaviour back to the originating issue on https://issues.civicrm.org/jira/browse/CRM-5916 and the last comment is from Coleman in 2010:

  Perhaps this has already crossed your minds, but for orgs that are trying to offer friendly and personal services, adding a person's case number (or hash thereof) to message subjects is, well, kind of tactless. I know my org won't want to use this feature for this reason.

  Has anyone explored more unobtrusive options such as hashing the reply-to address or other message metadata?

My question is the same as in line with Coleman. Are there any options to solve the inbound e-mail processing and filing e-mails on cases whilst being user friendly in the subject.

Has anyone thought of a technique to do so? If so I might have time and funding to work on this.

References header

My first thought is to use the references header in the incoming e-mail to scan whether this is a reply to an e-mail send from within CiviCRM and then link it to the originating e-mail activity. More info on the reference header is given here: https://stackoverflow.com/a/7591704/3853493

What do you think?

UPDATE: I know this doesn't fully answer the question but noting the ability to change the code to an id or remove the subject code is now an extension: https://lab.civicrm.org/extensions/caseidinsubject
I originally had some doubts, but in 7 years have never had a problem, but for one org we removed the hash and just use the actual case id by editing the civimail template, and see code below for the processing side. It also accepts just [1234] without the # symbol. This was more for staff ease of use than for the recipient - this way they can send from their email program and bcc the email processor.
I don't have a scientific study to reference, but anecdotally many non-technical people don't "read" emails the same way people who stare at code all day do. Your experience may be different.
Here's the block from CRM/Activity/BAO/Activity.php that has the modification:
$matches = array();
$subj_to_match = CRM_Utils_Array::value('subject', $params);
if (preg_match('/\[case #([0-9a-h]{7})\]/', $subj_to_match, $matches)) {
  $key        = CRM_Core_DAO::escapeString(CIVICRM_SITE_KEY);
  $hash       = $matches[1];
  $query      = "SELECT id FROM civicrm_case WHERE SUBSTR(SHA1(CONCAT('$key', id)), 1, 7) = '$hash'";
} elseif (preg_match('/\[case #(\d+)\]/', $subj_to_match, $matches)) {
  $hash       = $matches[1];
  // this seems like an odd query but we are checking the id actually exists
  $query      = "SELECT id FROM civicrm_case WHERE id = '$hash'";
} elseif (preg_match('/\[#(\d+)\]/', $subj_to_match, $matches)) {
  // technically this is a subset of the one below, but keeping it allows a subject that had both and prioritize this one
  $hash       = $matches[1];
  // this seems like an odd query but we are checking the id actually exists
  $query      = "SELECT id FROM civicrm_case WHERE id = '$hash'";
} elseif (preg_match('/\[(\d+)\]/', $subj_to_match, $matches)) {
  $hash       = $matches[1];
  // this seems like an odd query but we are checking the id actually exists
  $query      = "SELECT id FROM civicrm_case WHERE id = '$hash'";
}
if (!empty($matches)) {
  $caseParams = array(
    'activity_id' => $activity->id,
    'case_id' => CRM_Core_DAO::singleValueQuery($query),
  );
  if ($caseParams['case_id']) {
    $merge_info = CRM_Mergetrack_BAO_Mergetrack::getLatest(array('type' => 'civicrm_case', 'id' => $caseParams['case_id']));
    if (!empty($merge_info)) {
        $caseParams['case_id'] = $merge_info['new_id'];
    }
    CRM_Case_BAO_Case::processCaseActivity($caseParams);
  }
  else {
    self::logActivityAction($activity, "unknown case hash encountered: $hash");
  }
}

The "mergetrack" part is a separate extension (I'd call it unstable and it has some core hacks). Recently the same org has started sending out emails automatically on case creation, and then often the case has been merged in between the time the email goes out and the reply comes back, and so it was getting filed on the deleted case. You can remove those 4 lines.


Show CiviEvent registration details via dashboard or view? How would one approach letting a user login and see their registration details for an event? We find that many users lose their initial email and we'd like to streamline the process. Looking for any good ideas/support! The contact dashboard seems to show the event one has signed up for, but I did not see it display the actual price set/registration details of the event. Did I just miss something? I'm thinking about making a View of some sort to do this, so we can attach to their user page or something.

CiviMobile seems like a cool way to do this: https://civicrm.org/blog/skornien/event-participants-management-in-the-new-version-of-civimobile  we'll consider it for 2020, but it's too late for our current event.

Most recent Civi / Drupal

You can use for it CiviMobile if a user who registered has a CiviCRM account.
Only CiviCRM users can login in CiviMobile. So they will see the list of events where he is registered and their tickets on these events with all information (role, price, name, status).


How to programmatically open the option modal and listen to changes? I would like to open such a modal programmatically and then listen to events related to this modal (such as "option created", "option updated", "modal closed" etc). I tried to look at the CiviCRM source code but could not find API for that. Is there such a possibility?

It turned out to be possible:

CRM.loadForm('/some/url')
  .on('crmFormSuccess', function (event, data) {
    // do smth
});

Ref: https://docs.civicrm.org/dev/en/latest/framework/ajax/


Does Payflow Link support recurring billing with CiviCRM? I want to know if it's possible to use Payflow Link's recurring billing option with CiviCRM.

There is some information in the forum about how it needs to be implemented yet.. but it's unclear to me whether it's about using Recurring with Paypal Pro or with Payflow Pro. It looks like it's talking about using Payflow recurring with Website Payments Pro, which I didn't know was an option. Could someone please clarify? Thanks. https://forum.civicrm.org/index.php?topic=29346.0

Last I looked into it PayflowLink supported it - but the code integration was not written for CiviCRM.

However, that code was written quite a while ago and I believe that paypal has moved on & now prefers a different interaction with them is used. That might mean adding recurring would create more work. However, I would note that it only changes the nature of the 'development gap' - the short answer is that extra work is required to get recurring payments to work with Payflow Link. If you want to do that work, or commission it then I can help give development advice on it - but you might want to look at whether you are better off using a processor with existing recurring support (e.g. IATS, Stripe, Authorize.net, eway etc).

Note that if you do look into IATS you should use this link http://home.iatspayments.com/civicrm-referral - if  you are referring yourself you can put the referrer $ to CiviCRM core team I believe


How can I include a non-participant's details in the receipts? I have setup an event on a webform with 2 contacts.
Parent: Contact1 -
Child: contact2

Contact1 is there only to create a relationship with CONATCT2 and not a participant of the event.
Contact2 is the actual participant.

When the receipt is triggered after successful payment, obviously Details of Contact1 does not show in the receipt because he is not a participant.

How can I include the details of Contact1 in the receipt template please?
Can anyone help please?
Thanks

It's a slightly different question but you should be able to use the same technique as described here, i.e. use the api in your message template to look up the info:
https://civicrm.stackexchange.com/a/29232/181


How to enable ACH payment option Stripe I am using CiviCRM 4.6 with Stripe extension 4.7.3. I am able to do payment by Credit Card, but unable to find option to enable ACH payment.

Has anyone know how to enable ACH payment option in CiviCRM Stripe.

I am not sure if CiviCRM Stripe pp extension supports ACH(https://github.com/drastik/com.drastikbydesign.stripe/issues/124). They might have beta version which is not released yet.


Unable to list groups with CiviCRM API When I run the API command (via CiviCRM API Explorer) to list all the "Mailing Lists" i.e.

$result = civicrm_api3('Group', 'get', ['group_type' => "Mailing List"]);

I get the full list of mailing list groups. However if I run the with "LIKE" filtering option instead of "=", i.e:

$result = civicrm_api3('Group', 'get', ['group_type' => ['LIKE' => "Mailing List"],]);

I don't get any results and the console suggests that i hit a 403 error, which indicates this is a permission problem. I am running this as an administrator so I should have full access to  the system.

Any suggestions on how to address this issue are welcome.I am running CiviCRM 5.18.4 on Wordpress 5.2.4.

Turns out this was caused by some server settings by my hosting provider (apparently they did some changes to the firewall). They managed to fix it and it seems to be working fine.


Conditional statements in 'manual' emails or thank you letters Do conditional statements with tokens not work when you manually send an email or 'print' a thank you letter? I have a bunch set up inside the auto generated emails for contribution receipts or event registrations but when I add a statement to a message template - and send it out using 'actions - send email to contacts' or 'actions - thank you letters for contributions' the if statement is ignored.

(I'm in Wordpress 4.3.2 and Civi 4.6.4)

Yes, what you are describing is the default setting for CiviCRM.

Only Message Templates and Automated Messages make use of the so called smarty template engine. The smarty template engines makes "if"-statements possible.
The reason for this is that these Templates and Automated Messages are for more experienced users and administrators.

Normal mails, mailings and pdf reports can be used by regular CiviCRM users. And it might make their daily work much more difficult if they suddenly run into smarty template coding.

But, this is only the default setting.
In your civicrm.settings.php is an option to override this and expose the smarty template engine to normal email too:

/**
 * Enable this constant, if you want to send your email through the smarty
 * templating engine(allows you to do conditional and more complex logic)
 *
 */
define( 'CIVICRM_MAIL_SMARTY', 0 );

Set this to 1 and you can use "if"-statements in normal email.


What settings are required to display detailed change logging? I've got a site using CiviCRM 4.5.8

I've tried to enable detailed change logging in Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)

But the change log tab still shows the basic changed by person x on date y details.

On other sites I've worked with (4.5 and 4.6) enabling detailed logging changes the log view automatically.

Is there a related setting I've overlooked?

Should I just bite the bullet and upgrade the site?

Cheers

Craig

I had the same problem - we run four different civi instances.
Two had detailed change logs, two did not.

Across all instances users had same privileges and all four instances had logging enabled.  The difference other than civi versions was that two had change log report. So the change log tab runs off reports.  Steps to fix:

1) check logging enabled in Misc (Undelete, PDFs, Limits, Logging, Captcha, etc)

2) in Admin > CiviReport > Manage Templates.. check the summary and detailed contact logging templates are enabled (as default they were disabled on ours)

3) The MISSING bit... create an actual Contact Logging Report (Summary) from the template.

and that did the trick.

Note: when creating the report clicking 'refresh results' the report failed to load the results - i guess its too large. But save the report anyway and the detailed changes are displayed on the contact record.

Also it does not seem to need the detailed contact change report created only the summary.

Here the documentation that pointed us in the direction of reports to fix the problem  https://docs.civicrm.org/sysadmin/en/latest/setup/logging/

The above worked against: v4.6.22  v4.6.4  v4.6.8  v4.7.20


Is it possible for a non-logged in user to check the status of their membership? We had a request for some functionality where a not-logged-in user could check the status of their membership easily by entering their member number (internal ID) or email address into a field. After submitting the form, they'd be taken to a page that would show them their current membership status, if one exists. I can see this having some additional functionality as well:

They'd be shown if there are multiple contact records that match if an email address was used
A "renew now" button could be shown beside each returned result, would be tokenized / checksummed for them

Have any of you heard of anything like this? Does this already exist? Seems like it could be a cool thing for users of sites that don't require logging in to join (like ours) to be able to check their status, and potentially help reduce duplicates in the database.

In a slightly different way this is possible with checksum tokens.
You can create a profile or a contribution page with membership data.
Then you send a Mailing to all people who need a renewal (soon). That Mailing contains a link to the profile or contribution page with their contact ID and an individual checksum token as parameters.
When people click that link they see their data in the profile or contribution page and have the option to change it or to get a membership renewal.
For more info see http://wiki.civicrm.org/confluence/display/CRMDOC/Tokens
From this page:

There is a very powerful feature to allow you to send an email with CiviMail to your constituents with a link to the contribution form, profile, or event registration form with all of their contact information already filled in! This saves them the hassle of filling it out and increasing the chances they would ultimately donate.  Or it can be a simple way to periodically allow people to review their contact info and update it if applicable.
The way it works is you create a "special" link in the CiviMail message that includes the checksum token {contact.checksum}. When people click on the special link, it looks them up in the database and prefills any information on the contribution form or profile with any data that exists in their record. The special link lasts for seven days from the time it was sent out.
Checksum for Contribution Pages: To send people to a contribution page use this path where N is the ID of your contribution page:
Drupal: http://www.myorganization.org/civicrm/contribute/transact?reset=1&id=N&{contact.checksum}&cid={contact.contact_id}

Joomla!: http://www.myorganization.org/index.php?option=com_civicrm&task=civicrm/contribute/transact&reset=1&id=N&{contact.checksum}&cid={contact.contact_id}

WordPress: http://www.myorganization.org/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=N&{contact.checksum}&cid={contact.contact_id}

Checksum for standard Profiles (edit mode): To send people to a profile use this path where N is the ID of the Profile you want to send them to:
Drupal: http://www.myorganization.org/civicrm/profile/edit?reset=1&gid=N&{contact.checksum}&id={contact.contact_id}

Joomla!: http://www.myorganization.org/index.php?option=com_civicrm&task=civicrm/profile/edit&reset=1&gid=N&{contact.checksum}&id={contact.contact_id}

WordPress: http://www.myorganization.org/?page=CiviCRM&q=civicrm/profile/edit&reset=1&gid=N&{contact.checksum}&id={contact.contact_id}


Change the displayed name of languages We are using CiviCRM in multi language mode (CiviCRM 4.6 on Drupal 7).

For public CiviCRM pages (like event registration), we are offering the CiviCRM language selector, which offers the users to change between "German" and "English (United States)".

Now, I would like to change "English (United States)" to simply "English".
How can I accomplish that?

Just navigate to

Administer -> system settings -> option Groups

This will give you a list of all the Languages - so just edit and save the name which you wanted to.

I guess this helps !!!


Why is this Activity Search failing? Activity Search is failing every time for this install (Search/Find Activities) no matter what search parameters are used. The problem is the following SQL error:

SELECT count( DISTINCT ( civicrm_activity.id ) ) as rowCount  FROM civicrm_contact contact_a   LEFT JOIN civicrm_activity_contact
ON ( civicrm_activity_contact.contact_id = contact_a.id )  LEFT JOIN civicrm_activity
ON ( civicrm_activity.id = civicrm_activity_contact.activity_id
AND civicrm_activity.is_deleted = 0 AND civicrm_activity.is_current_revision = 1 ) INNER JOIN civicrm_contact
ON ( civicrm_activity_contact.contact_id = civicrm_contact.id and civicrm_contact.is_deleted != 1 )  LEFT JOIN civicrm_activity_contact source_activity
ON (source_activity.activity_id = civicrm_activity_contact.activity_id
AND source_activity.record_type_id = 2)
LEFT JOIN civicrm_contact source_contact ON (source_activity.contact_id = source_contact.id)  WHERE  ( civicrm_activity.activity_type_id IN ("110") AND civicrm_activity.status_id IN ("1", "2") AND civicrm_activity.is_test = 0 )  AND  (  ( civicrm_activity.activity_type_id IN (110,135,136,120,1,2,3,116,4,9,12,5,6,19,22,34,40,44,37,38,39,45,41,42,43,52,49,50,46,47,48,51,64,114,115,68,73,74,75,76,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,96,97,99,100,101,102,103,104,105,106,107,108,109,111,113,117,118,119,121,122,123,124,125,126,127,128,130,131,133,134,137,138,139,140,141,142,143) )  )  AND (contact_a.is_deleted = 0) AND (civicrm_activity.activity_type_id Array)

the error message is 'check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Array)' at line 8]'

As you can see this install has a lot of activity types - could this be the reason? The last 'AND' statement seems to be the problem.  This is on 5.28.3 and activity search is working fine on other 5.28.3 systems. Also there seems to be no limit on the number of items in the 'IN' clause in MySQL.

I think this is the same problem as https://github.com/JMAConsulting/biz.jmaconsulting.activitytypeacl/pull/14


Inconsistencies in the Contribution Detail report I'm trying to chase down an inconsistency someone reported in the Contribution Detail report. It doesn't happen with all contacts (in fact I've only seen it in the one they reported, so far).

There are two donations in this person's history that don't show up correctly:

A $15 donation shows up as $30
A $25 donation shows up as $125

The summary at the bottom of report for a date range correctly counts 10 rows, but then indicates 15 contributions instead of 10.

If I pull the same contributions in a Bookkeeping Report, they come out correctly.

I can't find anything different about the contributions in question. Has anyone seen anything like this or have any idea where to go next in troubleshooting? I don't think it matters but this is a Drupal 7 site.

You could try Extended Reports extension ;-)


Access denied errors by server itself on uploaded files? I'm noticing a lot in the logs whereby the server itself is trying to request a resource that CiviCRM denies access to by .htaccess.

Specifically it seems the CiviCRM server is trying to fetch files of this pattern:

/sites/default/files/civicrm/upload/delete-this-d3542fs2sP
/sites/default/files/civicrm/custom/delete-this-D44i89qZNP

Yet both of those directories contain .htaccess files with Deny all statements.

Anyone shed any light on this? [4.4.20 LTS, Drupal 7]

I have discovered that the delete-this files are temporary files created by CiviCRM for the sole purpose of generating this error! This error is good, it means that these directories are not browseable, and they shouldn't be browseable.

CiviCRM's CRM_Utils_Check_Security class does these checks in order to report what would-be security errors.

It creates a file, then tries to access that file via http. This should fail.


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

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

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

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

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

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

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

According to the API Security page, this is expected behaviour - only the Contact API applies ACLs and such.

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


Disable select2 in drupal I have some forms in drupal 7 using native civicrm, and some using webform integration. The webforms use normal select dropdowns for state and country, but when i create a contribution page in civi, it uses styled select2 dropdowns. I would like to disable this and just have plan selects. Is it possible?

The easiest way to do this would probably be to add a teeny script to the page footer of your webform that does:

CRM.$.fn.crmSelect2 = function(){};


Connecting Civi to a previous install's database During my update from Civi 4.2 to 4.7 I let it fill in database information that was not correct it connected to the cms database and not the Civi database from the previous install. Is there a file I can edit to have it connect to the old database?

You should edit the civicrm.settings.php file.  The location of this file depends on your content management system.

Drupal: sites/default/civicrm.settings.php

WordPress: wp-content/uploads/civicrm/civicrm.settings.php

Joomla: administrator/components/com_civicrm/civicrm.settings.php

You may find this related post helpful: How do I change the CiviCRM Database name


When upgrading from 4.7.7 to 4.7.8 I get error "Specified key was too long" I tried to upgrade my Joomla CiviCRM 4.7.7 to 4.7.8 and got the following error in the database upgrade:

ALTER TABLE `civicrm_contact` CHANGE `image_URL` `image_URL` VARCHAR(512)
CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL
COMMENT 'optional URL for preferred image (photo, logo, etc.) to display for this contact.'
[nativecode=1071 ** Specified key was too long; max key length is 767 bytes]

This old MySQL bug tells part of the story, I think. I run MySQL 5.6.24 so the limit should be higher, but when I try to do the ALTER TABLE directly I get the same error.

The statement seems to lengthen the image_URL column from 255 to 512 VARCHAR in UTF8. Turns out I can not even lengthen it to 256...

Is there some setting on the database that limits the key length 'globally' that I could have inherited from earlier (site has been up and upgraded for 5 years) versions?

Fortunately I did this on a restored backup, as I do with all upgrades before applying them on the live site. But this is a MacOSX and the live site an Ubuntu 15.10 so there might be some differences there too...

UPDATE: Here's a blog post indicating that innodb_large_prefix can be used to fix this. And it might be default from MySQL 5.7.

Question is just how to do that. Can I change my existing MySQL to run with innodb_large_prefix and then do the upgrade? Will a change in the MySQL setting interfere with my existing data or other tables/databases on the same MySQL server?

This issue is CRM-18983: DB error on upgrade to 4.7.8. I ran into it on OSX also while testing an upgrade.

There is a PR at https://github.com/civicrm/civicrm-core/pull/8605 currently which addresses this by reducing the size of the key before increasing the column size. Not all sites will have the option of reconfiguring MySQL server settings to accommodate the DB change in 4.7.8, so it makes sense to me that we do this in the schema.

Applying the patch before running the upgrade works for me - please post feedback on the JIRA issue or PR if you find it helps.


"Membership can not be used as a Result Column for profile searches" - why not? What can be done to make Membership - Membership Status in particular - a Result Column for profile searches? I want to be able to show Status in a Search View.

Can't you go to Advanced Search & select the memberships you want - you can select which statuses you want, too - the results show status and date of membership if you select to Display Results As Membership - unless I don't understand your question.

Note: For v4.5 and below, Display Results As is in the top right of the Basic Criteria frame in an Advanced Search.

In 4.6 Display Results As is in the "Search Settings" grouping at the bottom of the Basic Criteria frame in an Advanced Search.


Crypto key has unrecognized type? After CiviCRM upgrading v5.29 to v5.36, when I run the database update get the following error. I googled "CiviCRM Crypto key has unrecognized type" but did not find anything. Any suggestions what to do next?

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.
Crypto key has unrecognized type
Return to home page.

This is what I get with Debugging on:
Civi\Crypto\Exception\CryptoException: Crypto key has unrecognized type in /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/Civi/Crypto/CryptoRegistry.php on line 76

Exception trace
#    Function    Location
0    Civi\Crypto\CryptoRegistry->parseKey('%%%%%%%%%%%%%%%…')    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/Civi/Crypto/CryptoRegistry.php:76
1    Civi\Crypto\CryptoRegistry::createDefaultRegistry()    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Incremental/php/FiveThirtyFour.php:39
2    CRM_Upgrade_Incremental_php_FiveThirtyFour->setPreUpgradeMessage('
The defaul…', '5.34.alpha1', '5.29.0')    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Form.php:823
3    CRM_Upgrade_Form->setPreUpgradeMessage('
The defaul…', '5.29.0', '5.36.0')    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Page/Upgrade.php:108
4    CRM_Upgrade_Page_Upgrade->runIntro()    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Page/Upgrade.php:57
5    CRM_Upgrade_Page_Upgrade->run(Array, null)    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:313
6    CRM_Core_Invoke::runItem(Array)    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:69
7    CRM_Core_Invoke::_invoke(Array)    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:36
8    CRM_Core_Invoke::invoke(Array)    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm.php:121
9    civicrm_invoke()    /home/customer/www/%%%%%%.org/public_html/administrator/components/com_civicrm/civicrm.php:40
10    require_once('/home/customer/w…')    /home/customer/www/%%%%%%.org/public_html/libraries/src/Component/ComponentHelper.php:402
11    Joomla\CMS\Component\ComponentHelper::executeComponent('/home/customer/w…')    /home/customer/www/%%%%%%.org/public_html/libraries/src/Component/ComponentHelper.php:377
12    Joomla\CMS\Component\ComponentHelper::renderComponent('com_civicrm')    /home/customer/www/%%%%%%.org/public_html/libraries/src/Application/AdministratorApplication.php:101
13    Joomla\CMS\Application\AdministratorApplication->dispatch()    /home/customer/www/%%%%%%.org/public_html/libraries/src/Application/AdministratorApplication.php:159
14    Joomla\CMS\Application\AdministratorApplication->doExecute()    /home/customer/www/%%%%%%.org/public_html/libraries/src/Application/CMSApplication.php:203
15    Joomla\CMS\Application\CMSApplication->execute()    /home/customer/www/%%%%%%.org/public_html/administrator/index.php:51
16    {main}

Did you already set CIVICRM_CRED_KEYS in civicrm.settings.php? If so it probably has the wrong "type". https://docs.civicrm.org/sysadmin/en/latest/setup/secret-keys/#civicrm_cred_keys


How to transfer ownership of an extension Say we have an extension with short-name "fancywidget" which is managed by Company A. The full name of the extension is com.a.fancywidget.

Now say Company A drops maintenance of it, and Company B steps up to take over. It's still the "fancywidget" extension, but under new ownership.

Is it safe to rename the extension to com.b.fancywidget? What are the implications (e.g. for the extension directory, pingback stats, etc.) of doing so?

There are several places which rely on the full name of the extension:

Extension directory: One must create a new record for the new extension key. Ownership, release-history, etc, will be different.
Pingback stats: The old and new name will have separate stats.
Upgrades (downloading new code): Upgrades issued in the new name won't be displayed as upgrades on existing installations (which expect the old name).
Upgrades (tracking/updating DB schema): The schema versions of the extensions are separate.
Managed entities: If the old and new extensions insert managed entities, there could be uniqueness conflicts. (The ManagedEntities manager does not impose a global uniqueness constraint, but some specific entities do enforce uniqueness -- eg you can't simultaneously register two payment-processor-types with the same name.)

My recommendation: Don't think of it as renaming an extension; think of it as publishing a new extension (and reusing code from the old extension). The new extension should be designed around the old one (eg using different names throughout and/or migrating data).

Speaking in the abstract without a specific extension, it's not simple to rename or replace a extension. However, for specific extensions, there may be mitigating factors:

(No) DB content: If the extension only adds runtime functionality (via hooks) and does not insert anything into the DB, then it will be easier to rename/replace. If the extension does insert into the DB (eg via hook_install, via Upgrader, or via managed-entities), then expect some tasks or complications.
Private vs public extension: If the extension wasn't released to the public, then you may be able to hack through conflicts (eg manually changing over DB references), and you probably won't care about the extensions directory, the pingback stats, or distributing upgrades.


Confused About API Results Right now I am using the API Explorer (in 4.7.21) just to get the pieces I need for some custom code in Drupal.  I am just very confused about what the API Explorer is returning.  I am guessing this me not a bug.

If I execute the following with the Case ID of 223 then I should get back the contact assigned to that case.

$result = civicrm_api3('CaseContact', 'get', array(
  'sequential' => 1,
  'return' => array("contact_id"),
  'id' => 223,
));

When I execute this I get the contact for case 224.

If I use the API to query for the Subject of the case for ID 223 I get the expected results and the same for 224.

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

If anyone sees my error here I would appreciate it. If this is a bug I am glad to put it only issues.civicrm.org.

Thanks!

It should be 'case_id' => 223 instead of 'id' => 223 for the CaseContact one. It seems to work with either on the public demo, but that might be coincidence - in the civicrm_case_contact table the 'id' field is an autoincrement technically unrelated to case_id, but may or may not match the case_id depending on creation order, multiple clients, and other happenings.

I would use 'case_id', like so

$result = civicrm_api3('CaseContact', 'get', array(
  'sequential' => 1,
  'return' => array("contact_id"),
  'case_id' => 223,
));


Creating a donor letter We are trying to find out if we enter a contribution in a donor record, are you able to create a donor letter from a constituent record in CiviCRM?

welcome to civicrm stackexchange.

You can generate receipts as PDF files to then print and post. You can do this via the Contact's 'contribution' record or via Find Contributions eg at

http://dmaster.demo.civicrm.org/civicrm/contribute/search?reset=1

if you tick a Contribution, then under Actions you can see both

Receipts - Print or Email
Thank you letters - Print or Email.

Pls add comments below, or embellish your question with more details if this doesn't answer your question.

You can read more about this in the Documentation

Also, in terms of StackExchange protocol, if an Answer is helpful, give it a +1, and if it gives you the Answer you need (ie you might get several answers) then 'accept' it.


CiviRules update interfering with another plugin? Yesterday, I updated the CiviRules extension to version 2.8, then did the database update. Immediately afterward, I began getting error emails each time the cron job runs.

I have in place a hack to civicrm/CRM/Mailing/Event/BAO/Unsubscribe.php, to load a language-appropriate template for the unsubscribe email sent out. I don't think the details are important here, but the hack calls a function get_multilingual_template(), which is defined in a custom extension.

The error emails I receive read:

PHP Fatal error:  Uncaught Error: Call to undefined function get_multilingual_template() in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Mailing/Event/BAO/Unsubscribe.php:379
Stack trace:
#0 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/v3/MailingEventUnsubscribe.php(52): CRM_Mailing_Event_BAO_Unsubscribe::send_unsub_response('5051', Array, false, '336')
#1 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(101): civicrm_api3_mailing_event_unsubscribe_create(Array)
#2 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(168): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#3 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(99): Civi\API\Kernel->runRequest(Array)
#4 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\API\Kernel->runSafe('mailing_event_u...', 'create', Array, NULL)
#5 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/v3/MailingGroup.php(62): civicrm_api('ma in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Mailing/Event/BAO/Unsubscribe.php on line 379
Fatal error: Uncaught Error: Call to undefined function get_multilingual_template() in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Mailing/Event/BAO/Unsubscribe.php:379
Stack trace:
#0 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/v3/MailingEventUnsubscribe.php(52): CRM_Mailing_Event_BAO_Unsubscribe::send_unsub_response('5051', Array, false, '336')
#1 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(101): civicrm_api3_mailing_event_unsubscribe_create(Array)
#2 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(168): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#3 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(99): Civi\API\Kernel->runRequest(Array)
#4 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\API\Kernel->runSafe('mailing_event_u...', 'create', Array, NULL)
#5 /var/www/wordpress/wp-content/plugins/civicrm/civicrm/api/v3/MailingGroup.php(62): civicrm_api('ma in /var/www/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Mailing/Event/BAO/Unsubscribe.php on line 379
Error: The site is experiencing technical difficulties.

The cron command is:

/usr/local/bin/wp --user=civicron --url=https://oursite.org/ --require=/var/www/wordpress/wp-content/plugins/civicrm/wp-cli/civicrm.php --path=/var/www/wordpress civicrm api job.execute > /dev/null

So it seems that somehow the CiviRules update made the cron run fail to load our custom extension? I don't know why it's even trying to call get_multilingual_template(), since as far as I can tell, nothing should be triggering an Unsubscribe attempt. (And unsubscribe by email still worked anyway, when I tested it and the cron job ran, generating the same error but correctly unsubscribing my test account.)

I don't know to what the 5051 or 336 numbers in the send_unsub_response refer.

Looking at the scheduled jobs admin page, each task is run as expected, and each job shows a Finished status of "success."

I tried disabling and reenabling both CiviRules and our custom extension. I don't know what else to look at, or to try from here. Thanks for any suggestions!

Found the problem. This is a multisite setup, and only one site has the custom plugin installed. So my hacking the Mailing/Event/BAO/Unsubscribe.php made one of the sites fail when it reached the call to the function defined in the custom plugin—but it couldn't find the function.

I didn't realize that the cron error emails I was receiving were for a different site than the one I tested manually. Hence my confusion about success manually running the Fetch Bounces job, but errors when it ran via cron.

Regarding the proximate trigger/cause: since I was logged in and saw the prompt to do so, I upgraded CiviRules at the same time I sent a new mailing. The new mailing bounced to two addresses, which caused the Fetch Bounces job to attempt to process them. I mistakenly thought there were no emails awaiting bounce processing, because, again, I was looking at the bounce email account for the wrong site. That seemed to point to the CiviRules update having done something strange.

So CiviRules probably had nothing to do with it... But I am still slightly confused, because I'm pretty sure there were bounce emails needing processing even before my simultaneous CiviRules upgrade/sending a new mailing. Before that change, the Scheduled Jobs log for Fetch Bounces shows:

  Finished execution of Fetch Bounces with result: Failure, Error message: A fatal error was triggered: Could not connect to MailStore for return@ourdomain.org@mail.ourdomain.orgError message: An error occured while sending or recei (...)

And I wasn't receiving cron error emails to let me know it was failing. After the update/mailing send, the job log shows Start, but never any Finish entries. So it seems my core hack broke it a while ago, but that either the CiviRules update, or my sending a new mailing, changed the way in which it failed.

Anyway, I'm glad it's not bombarding me with error emails now, and that it's actually processing bounces. People who find this issue can enjoy my classic PEBKAC (Problem Exists Between Keyboard And Chair)!


Search Builder is broken (Civi 5.4.0 / Drupal 7.59) Search Builder is broken : I don't have any "Select field", but only "Select Record Type" and "Operator" (sorry for the image in french) :

You can reproduce this bug on the demo configuration (civicrm.demo.civihosting.com, in 5.0.0), this way : Search Builder > Select "Individual", then go to Support > About CiviCRM, and then back : "Select Field" has disappeared : on my configuration, I have the same situation, but directly, without this forth and back operation.

best to compare with dmaster.demo.civicrm.org/civicrm/contact/search/builder?reset=1 i think as that will be running on latest code for certain (to avoid reporting a bug that has already been fixed)


Social Media: In receipts, {$url} incorrect from SocialNetwork.tpl, SEF URL, missing buttons I have done a search here, bug reporting and general web search to no avail.

Platform: CiviCRM 4.6.8 on J!3.4.4

Problem: In CiviContribute, seems in both the receipts, webpage and email confirmation, the token {$url} is not being appended correctly for both the Twitter and Facebook buttons contained in /administrator/components/com_civicrm/civicrm/templates/CRM/common/SocialNetwork.tpl. Here are the results for both:

Twitter:

  Donate to Domain Name
  https://domain.org/index.php?option=com_civicrm

Facebook:

  https://domain.org/component/civicrm/?amp%3Btask=civicrm%2Fcontribute%2Ftransact&amp%3Breset=1&amp%3Bid=1&fb_action_ids=10206214067365432&fb_action_types=og.likes

Also, is there a token for grabbing whichever (SEF) URL is being used for the landing contribution form page? Or, if desired to just hand code the absolute URL, what is the format in that line?

From the Twitter dev page the above doesn't look correct. Please confirm: https://dev.twitter.com/web/tweet-button/parameters
Also, on the webpage receipt confirmation, Twitter, G+, Facebook and LinkedIn are listed but in the email receipt only Twitter and Facebook buttons appear.

Please advise. Thank you in advance.

@BruceW

I have created an issue and included a patch.

look at here. Hopefully this resolve it.

https://issues.civicrm.org/jira/browse/CRM-17725

Regards
Kajan


Calendar of Activities for CiviCRM 4.7.3 on Wordpress 3.8.5? Is there a way to get a calendar view of Activities for CiviCRM on Wordpress? I can easily get all of them in a sequential list using Find Activities or the dashboard widget, showing all the information I require (type, date and time, "with", and "assigned to"), but I want a week or month planner/calendar view to make it easier for users to see at-a-glance when meetings are.

The Contact Calendar extension does not work, giving an error message about being unable to connect to the site. In any case I don't think it's what I need, because I want more than just one person's calendar. There are extensions for CiviEvent and some discussion of calendars in Drupal here on StackExchange, but I've not found a way to get what I want in a CiviCRM/WP installation.

I use a Wordpress plugin called EveryCal+1 - it has a built in hook to civiEvents and works/looks really nice.


Can not add soft credit to an organization Has anyone seen an instance where a contribution can not be edited to add a soft credit to an organization?

I can add individuals, and it's only happening on the contributions from some contribution (donation) pages but not others. I've not been able to replicate on demo, but since it's only happening on some contribution pages I'm not sure exactly how to replicate.

Environment: Drupal 7.32 CiviCRM 4.6.15

I just came across this as well. I'm running Wordpress 4.4.4 and Civi 4.6.4. I can add soft credits to individuals all I want but I cannot mix individuals and organizations soft credits in the same donation. Or so I thought, after messing around for a bit I found that if I removed the campaign that was set and the contribution page that was set (and saved the record). Then went back in I could add the organization soft credit.

I could then go back into the donation and add back in the campaign or the online fundraising page. This part was wonky and most successful when I added the campaign first, saved then went back and added the online page.

I was also successful mixing soft credits on a fresh donation when I only had the campaign set and no online fundraising page.

My take away, online fundraising pages in the set in the donation have something to do with it.


CiviCRM REST API query doesn't return all fields of a 'Report' I have been trying to retrieve reports based on default report templates through REST API calls. But the fields returned for each report instance is not same as what it is supposed to according to a report instance's description.

Here is an example query in the API explorer,

Query to retrieve Constituent Summary report:

Here is the result of the query:

The default description of the Constituent Summary report is:

  Provides a list of address and telephone information for constituent records in your system.

But as you see the result of the query, all the returned rows have only name, and there is no other option in the API explorer to specify fields to be returned.

Things I did to analyse/rectify my query's result it further:

Made sure that the report instance created in the UI has more than one column selected (that is, not only name but other fields like address, email etc.)
Deleted the default report instance and created by own in the UI based on the default report templates. But still, the API query returns only these specific fields (in image.)

The above behavior is true for all query against report: It returns only specific fields/columns irrespective of the column selected in the UI.

Please let me know how can I retrieve a report with all columns (as specified for a particular report in Reports tab)

If you choose a particular report id rather than a general template it should get the config from that report. I'm not sure if it picks up stuff from anywhere from the default templates (e.g first configured instance of that template).

You can pass in other parameters somewhat in line with the POST vars I believe


Coding Custom Report I'm having some trouble coding a custom report. I found the following tutorial which was helpful, but I'm having trouble with the actual coding as I am still new to civiCRM developing, and I haven't figured out all of the civiCRM classes.
https://alastaira.wordpress.com/2011/03/17/civicrm-creating-a-custom-report/

Essentially, I want a report that does exactly what the Bookkeeping report does, except at the bottom I want a summation of the amount grouped by the financial account code.

I have copied the Bookkeeping.tpl and Bookkeping.php to new files. Yet, I'm having some troubles on how exactly to change the statistics section of the php file to reflect my desired changes.

public function statistics(&$rows) {
$statistics = parent::statistics($rows);
$tempTableName = CRM_Core_DAO::createTempTableName('civicrm_contribution');
$select = "SELECT {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_entity_financial_trxn']}.id as trxnID, {$this->_aliases['civicrm_contribution']}.currency,
           CASE
             WHEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.entity_id IS NOT NULL
             THEN {$this->_aliases['civicrm_entity_financial_trxn']}_item.amount
             ELSE {$this->_aliases['civicrm_entity_financial_trxn']}.amount
           END as amount
";

$tempQuery = "CREATE TEMPORARY TABLE {$tempTableName} CHARACTER SET utf8 COLLATE utf8_unicode_ci AS
              {$select} {$this->_from} {$this->_where} {$this->_groupBy} ";
CRM_Core_DAO::executeQuery($tempQuery);

$sql = "SELECT COUNT(trxnID) as count, SUM(amount) as amount, currency
        FROM {$tempTableName}
        GROUP BY currency";
$dao = CRM_Core_DAO::executeQuery($sql);
$amount = $avg = array();
while ($dao->fetch()) {
  $amount[] = CRM_Utils_Money::format($dao->amount, $dao->currency);
  $avg[] = CRM_Utils_Money::format(round(($dao->amount /
    $dao->count), 2), $dao->currency);
}

$statistics['counts']['amount'] = array(
  'value' => implode(', ', $amount),
  'title' => 'Total Amount',
  'type' => CRM_Utils_Type::T_STRING,
);
$statistics['counts']['avg'] = array(
  'value' => implode(', ', $avg),
  'title' => 'Average',
  'type' => CRM_Utils_Type::T_STRING,
);
return $statistics;
}

I see in the code that the $sql is grouped by currency, so I essentially just need to change it so the $sql instead is grouped by financial code. However, I don't know the class name for the financial code to place in the following line of code to replace currency:

$select = "SELECT {$this->_aliases['civicrm_contribution']}.id, {$this->_aliases['civicrm_entity_financial_trxn']}.id as trxnID, {$this->_aliases['civicrm_contribution']}.currency,

I suggest you install the extended reports extension and see if one of those reports does what you want. The extension provides many reports and is well maintained.

If it doesn't provide what you want, perhaps reviewing the code of extended reports that do group by financial account code will help you find the answer to your problem. (Sorry I am not a coder, so can't provide any help with that.)

Also are you sure you need the information on the individual transactions and the account code totals in the same report. My understanding is that often it easier to do one or the other on a given report, rather than both. That is why there are summary and detail pairs of reports. (eg for Donor Details and Event Income).


"on hold" - what happens with mailings Given that a contact may have a number of email addresses, what happens if one of them are on hold (bounce) when that contact is to receive a mailing?

There may be a number of scenarios here, I suppose, depending on if one of them is marked specifically for use for mass mailings.

Does another address get used? If so, even if a special mass mailing address was indicated?

CiviCRM will not try and send to an email address that is marked on hold (regardless of any other characteristics of that email (primary, bulk mailings).

If a contact has multiple email addresses and one or more of them is on hold, then CiviMail chooses the 'next' available email address and tries to sent to that.

More background here: https://docs.civicrm.org/user/en/stable/email/maintaining-healthy-email-lists/#what-do-i-do-if-an-address-is-put-on-hold


Getting into the inbox with Sparkpost During testing of sparkpost we are getting into the inbox with gmail, yahoo and aol, but not with microsoft. We are getting an 8 on microsoft's bulk complaint level which AFAIK is associated with the IP used.

We are evaluating either switching to a dedicated IP or switching to another service provider on a shared IP.

One thing that puts us off a dedicated IP is the extra admin that would be involved in keeping the IP off blacklists. Some blogs also mention that you need a certain amount of traffic to maintain sender reputation (though they are vague on how much that might be - I guess because there are no hard and fast rules). Since a lot of the stuff on the web is not impartial and is based on different use cases and potentially out of date, I would appreciate some thoughts based on experience from people in a similar boat.

If you are on a dedicated IP, how many emails per month are you sending? Has monitoring your dedicated IP for blacklisting been an issue?

If you are on a shared IP (either on sparkpost or other servers) have you had trouble getting into microsoft inboxes or with the BCL? Thanks in advance for all your thoughts.

"One thing that puts us off a dedicated IP is the extra admin that would be involved in keeping the IP off blacklists. "

That's one of Sparkpost's responsibilities (although you should also monitor, just in case, I particularly like http://multirbl.valli.org/lookup/).

  "If you are on a dedicated IP, how many emails per month are you sending? Has monitoring your dedicated IP for blacklisting been an issue?"

We send around 200k emails per month from ~ 25 domains, all on the same IP. We haven't had issues being blacklisted, but some clients have had issues with their domain appearing on some blacklists, especially if it was their first mailing (with invalid addresses).


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

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');


CiviCRM 4.5.8 - Bounce Fetcher - Max Line Length Exceeded I have recently been getting this error message from the bounce fetcher but the error message is not notating which message is the culprit:

  Parameters parsed (and passed to API method):
  a:1:{s:7:"version";i:3;}

  Full message:
  Finished execution of Bounces fetcher with result: Failure, Error message: An error occured while sending or receiving mail. The IMAP server could not list messages: * BAD maximum line length exceeded.

Please advise.

This issue has been fixed by Zimbra, the email application we use. Can CiviCRM be adjusted to deal with this issue or is it purely on the IMAP server side? Would using POP3 have a different effect?

Their solution is with a caveat that has a drastic effect at the enterprise level:

  The issue stems from the bug reported at -
  https://bugzilla.zimbra.com/show_bug.cgi?id=73266

  Pasting an internal comment from the bug, which help explains the
  issue  --- This goes back to the fix for bug 63644. There are two
  limits at play zimbraImapMaxRequestSize and zimbraMtaMaxMessageSize.
  The latter is used for all literals, regardless of command. Due to the
  way literals are processed there isn't a really clean way to use
  zimbraImapMaxRequestSize for some literals and allow larger literals
  commands such as APPEND where we really want to allow huge literals;
  at least without a big rewrite that is too much for 8.0 at this stage.

  Staff, for the purposes of the test can you also set
  zimbraMtaMaxMessageSize to a really small value (say 5). I think the
  main purpose of those two limits is to protect against buffer
  overflow; so as long as we have some limitations for all commands that
  should be safe enough for now.

  The downside of disabling NIO is that you loose out on the performance
  improvement that NIO offer - http://wiki.zimbra.com/wiki/IMAP_NIO :
  > NIO implementation helps reduce the mailboxd memory footprint with a
  small CPU overhead. NIO eliminates the need of 1 (IMAP
  connection)-to-1 (server thread) mapping and helps reduce the memory
  footprint of the ZCS server. It is useful when there are many
  concurrent IMAP users. The exact benefit depends on the number of IMAP
  users/server and number of live connections/users.

  > The saving is linear to the number of active IMAP connections that are
  in a single mailbox server.

  > Example for 10,000 concurrent IMAP accounts:

  > With NIO: If there are 10,000 IMAP accounts, each of the IMAP accounts
  has an IMAP client which maintains 3 to 4 connections. There are at
  most 100 to 200 Java threads required in the mailboxd process to
  handle requests from those clients. If one thread uses 256k memory, it
  uses 25 to 50MB Java memory.

  > Regarding the CPU and depending on the load, the overhead usage can
  range from 0 to 20%. Since ZCS is not CPU bounded, the CPU increase
  should not be a significant factor to impact the client side response
  time.
  *>
  Without NIO: If there are 10,000 IMAP accounts, each of the IMAP
  accounts has an IMAP client which maintains 3 to 4 connections. There
  are 10,000*3 or 10,000*4 Java threads required in the mailboxd process
  to handle requests from those clients. If one thread uses 256k memory,
  it uses 7,500MB to 10,000MB of Java memory.*


How to target a specific event type in a system workflow message We'd like to separate the receipt for signing up for events by the event type - an email for one specific type and another one for all the other events. However, I haven't figured out how to specifically target it yet.

Right now we have something that looks like this:

{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}

     some text...

{else}

     some more text

     {$event.confirm_email_text|htmlize}

{/if}

Thanks!

I think you can use the event_type_id token inside the event templates. Something like -

{if $event.event_type_id == <id of the event type>}

  text for the specific event type

{else}

  common text for all other events

{/if}


How to make personal data fields non editable I received a survey titled 'civiCRM survey 2016' with my first name, last name and email fields pre-filled and not editable.
How did you achieve this? Are you using the no-overwrite extension or webforms disabled fields also work when using the civiCRM checksum?

That survey uses a Webform-civicrm form. The 'existing contact' field has had 'Field Locking' applied to the Name and Email fields (first time i saw this feature - nice addition!).

if you want to achieve the same directly in civicrm profile when you add a field to the profile you have the option to set it to read-only.

ADDENDUM: Nathan below comments that "I believe this is available in Webform CiviCRM 7.x-4.15 based on the notes and code in the change comparison listed here: github.com/colemanw/webform_civicrm/compare/7.x-4.14...7.x-4.15"


How is CiviCRM different in Drupal, Joomla, Backdrop, and WordPress? I understand that CiviCRM is the same app regardless of which CMS it runs under. But I've been told that there are important differences in the way it integrates with the four. What are the main differences? Are there downsides to choosing WordPress, Backdrop or Joomla instead of Drupal?

Availablity of extensions

The biggest difference is the availability of extensions/add-ons/extra-integrations -- there are more addons for Civi+Drupal, but the differences are shrinking over time.

Civi 1.x didn't originally support its own extension mechanism - the only option was to write a Drupal module. Consequently, Civi-Drupal modules grew first/fastest. The platform now supports plugins on Joomla (Civi v3.3+?) and WordPress (Civi v4.6+) the same way.

There are a few big-ticket addons that can make a difference for site-builders:

CiviCRM comes with many out-of-the-box forms for event registration, donations, etc. but if you'll be making a lot of customized forms, then the Drupal module webform_civicrm is pretty cool. There are no published solutions which provide as much flexibility on Joomla/WordPress.
Drupal and WordPress have CLI frameworks (drush, wp-cli) which are quite handy for developers and sysadmins. Joomla CLI is still immature.
Drupal Views and Rules are substantial systems which have Civi integrations.
WP BuddyPress is a substantial system which has an upcoming Civi integration.

However, the importance of these differences has diminished since ~v4.2 -- when Civi introduced a flexible, cross-CMS extension system.

Integration features

There are some differences which arise because of distinctive features/norms in each CMS community, e.g.

In WordPress, it's pretty common to embed content in your web-pages using short-codes. Civi has several short-codes in WP.
In Drupal, it's pretty common to embed content in your web-pages using blocks. Civi has several blocks in Drupal.
In Drupal, the core CMS has decent support for "roles" and "permissions", so Civi uses this. In Joomla/WordPress, these are regarded more as "hidden/advanced" functionality, so Civi has to fill in some gaps.

Installation process

The installers are a bit different -- web-based installation is easier in Joomla (because there are fewer forms to fill out), but it's more flexible in Drupal/WP. CLI-based installation is easier in Drupal/WP.

Testing

The core system is the same across all CMSs, but occasionally there are bugs in the CMS integration code. Most of the testing is performed on Drupal/CiviCRM, and it may take a bit longer to identify/resolve bugs in the WordPress and Joomla integrations.


Can't Include Profiles for Contribution Page after migration We just underwent a migration from one server to another. For some reason, I don't have the same options to include Profiles I have previously created when I "manage" a contribution page I am configuring. The ebook says "select a CiviCRM profile from the dropdown menu..."

But when I try to do that, there are no real options. The "Include Profile (top of page)" is greyed out and the "Include Profile (bottom of page)" has a blank white text box but no options to select previously created profile or make new ones on the fly.  Yes I have the profiles "activated" in the system but they still don't show up.  What do I do?

Try going to the include profile section and hit 'save', see if the profiles become available.
I had a similar issue, and that fixed it.


Is it possible to modify content in the invoice template based on contribution currency? We have a client who has membership bases in two countries (e.g. Australia and New Zealand). I understand that we can have two membership organisations to manage the two membership bases.

The issue seems to be that the invoice template, for contributions, shows the Name, Address, Currency etc for the primary domain.

Due to legal requirements as to what should appear on an invoice we need to be able to change the invoice content a little to reflect the address of the member organisation, rather than the primary organisation.

Is it possible to have the content of the Invoice change to reflect the membership organisation? Maybe by detecting the Contribution Currency and adjusting the invoice template markup to suit?

The API explorer is throwing an error for me, when trying to search for Contributions, so it's hard to know where to start on this one.

Yes, you can change the invoice value based the currency

To start with please create an extension using

hook_civicrm_tokens and hook_civicrm_tokenValues

Make the necessary changes in Message Templates -> System Workflow Message -> Contribution Invoice Receipt

This will allow you to make the changes in Invoice


Laravel package to access CiviCRM API3 How do you integrate CiviCRM API3 with Laravel?

I put this question here to link the package I created for this as I wished I would have found more info on the API while searching here.

See my answer below

2
down vote
I have published a quick Laravel package that can help building the API3 integration... it also has a lot of documentation that is not easy to find in the Civi world...

Take a look... contribute...

https://github.com/leanwebstart/civi-api3

Also on pakagist... leanwebstart/civi-api3

Hope this helps someone...


Report with access "everyone (includes anonymous)" not displaying correctly Civicrm 5.2.2 Wordpress 4.9

I have created a report and given access to "everyone (includes anonymous)" and also given view reports permission to anonymous user.
This is the URL https://leep.ngo/civicrm/?page=CiviCRM&q=civicrm/report/instance/170&reset=1

Only part of the report appears - image below
I have tried reverting to standard twenty sixteen theme with same result.

If you don't want ANONYMOUS USER to view the report then you need to set the permission in your ACL

Administer -> Userss and Permissions -> Permissions (Access Control)

where you will find "CiviReport: access CiviReport" remove for ANONYMOUS USER

Also for the display you need to make changes in your Theme

I Guess this helps !!! Please feel free to contact me if you need more help

Thanks


Network Error - Unable To Reach The Server - Change Payment Details on Recurring Contributions I am having a problem on CiviCRM 4.6.7 - I get Network Error - Unable to Reach the Server when attempting to "Change Payment Details". Additionally the email sent out, "Recurring Contribution Notification" contains a link,

https://www.mydomain.com/index.php?q=civicrm/contribute/unsubscribe&reset=1&crid=35&cs=2cca06426fd09762c341ef901c4c54d0_1440702135_inf

And it goes to a blank page

After enabling back-trace/debugging and I right-click and open Change Payment Details in a New Tab, a blank page loads, the error on console says

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Using Paypal Website Payment Pro.

Could this be a permissions issue? Or what?

The links in the email sent out to update / cancel contribution work fine.

Update:

Apache error log entry

[Thu Aug 27 15:25:35 2015] [error] [client 67.189.24.160] PHP Fatal error:  Cannot use object of type CRM_Core_Payment_PayPalImpl as array in /srv/www/www.mysite.com/public_html/sites/all/modules/civicrm/CRM/Core/Payment/Form.php on line 220, referer: https://www.mysite.com/civicrm/contact/view?reset=1&cid=4687

Code referenced:

  /**
   * @param array $paymentProcessor
   * @todo it will be necessary to set details that affect it - mostly likely take Country as a param. Should we add generic
   * setParams on processor class or just setCountry which we know we need?
   *
   * @return array
   */
  public static function getPaymentFields($paymentProcessor) {
    $paymentProcessorObject = CRM_Core_Payment::singleton(($paymentProcessor['is_test'] ? 'test' : 'live'), $paymentProcessor);
    return $paymentProcessorObject->getPaymentFormFields();
  }

Update two: this is related issue it looks like: Error when updating billing details for admins and contributers

I haven't re-created on demo, because its not set up for recurring contributions AFAIK.

This is from a bug introduced in 4.6.x series, fixed in 4.6.9, as per

https://issues.civicrm.org/jira/browse/CRM-17108

Solution: update CiviCRM to the most recent 4.6.x


Add custom field with multiple values to Contact Form 7 and Form Processor I can't seem to make a custom field that allows multiple values work if more than one value is selected in Contact Form 7 via Form Processor. If one value is selected, everything works fine. If more than one value is selected, Form Processor fails and no contact is created.
This error is logged: Notice: Undefined index: title in Civi\FormProcessor\Type\OptionGroupType->getConfigurationSpecification() (line 40 of /var/www/html/sites/default/civicrm/extensions/form-processor/Civi/FormProcessor/Type/OptionGroupType.php).
Here is my contact form (it uses checkboxes). In Form Processor, I have a Custom Options input, with multiple selected and I have the same options set up there.
If I use Try out in Form Processor, it works fine, so I wonder if Form Processor is expecting the data in a different form than Contact Form 7 is sending it in.

Potentially you could also develop a new type of input in the Form Processor that deals with the comma separated list.


Submit Credit Card payment missing after update our non-profit uses civiCRM. Recently we updated from version 4.5.5 to 4.7.16

The update caused the an important option to disappear. On the contributions category the option "Submit Credit Card contribution" was available before our update next to the line "Click Record Contribution to record a new contribution received from this contact."

Currently, we are not able to charge CC of a donor without having to go and do that via paypal. I do not think this has anything to do with "paypal pro" as the option was available to us before the civiCRM update.

I was having this issue also in Drupal, after upgrading from 4.7.15 to 4.7.27 and what I found was that it was a caching issue. I needed to delete everything inside the sites/default/files/civicrm/templates_c directory.


Activity date for automated mailings For an automated emailing,  eg for event registration, why is the Activity date shown as the date the email was set up ('Scheduled'), not the date the automated emailing took place.   For example, we have event participants who registered for an event on 23 April receiving a set of post registration emails, with Activities all dated April 4th, long before they had even registered.  Can this be changed as part of configuration.
Thanks

I think this is down to the fact that your using the mailing jobs as part of your scheduled reminders and this is the reason the wrong date shows up. The mailing job will have the date of the 4th of april and thefore the activities all show that date. p.s. This is Parvez @ Veda hence I know the setup!


Best practices for "lookup" variables I am getting ready to move our organization to CiviCRM.  We have many values that are "codes" that show in our current system via lookup tables.

For instance, the value in the database for a chapter might be "SC" whereas what is displayed is "Some Chapter"

We anticipate that this would be the "Some Chapter" group in CiviCMS but that it would also be used as grouping in reports.

So, as I move our info, is it better to retain the "SC" code, or should I convert them to "Some Chapter" as I do the export?

This is an opinion-based question, but for a better experience for your users, I would use the "Some Chapter" version for your group name, rather than the code. In the back end, groups are all stored as numbers anyway. And using a human-readable version means that you don't have to deal with extra training or documentation to translate your codes for new users.


Restrict users to viewing only data in their state? We are using Civi 5.14 on WordPress 5.1
My client has giving me this request.  Can this even be done with Civi?  She wants to restrict our volunteers to viewing only contacts within their own state, or reports based on contacts in their own state.  Her request is below.

"create log-ins for almost everyone on the affiliates list (Contact/Advocate/Affiliate leader anyway.) Then, arrange so that their access gives them the ability to view ONLY contacts from their state, and have a simple way to download contact info (perhaps several pre-created reports like email/phone only, full mailing info, and "full info" which would hit a few other things like Y/N donor, member, event participation."

Seems like CiviCRM ACL might be your answer.

https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control/

Native CiviCRM ACLs give more fine grained control, so, for example, you can limit access to view, edit, create, delete and search to :

groups of contacts
a profile (this is a collection of existing and/or custom fields, see "Profiles")
a set of custom fields
events (e.g. a user may access one event, but not others)


Why do some From addresses work and others get rejected I'm having some strange problems with sending out emails.

I've run a number of tests using different From addresses, and some of them work fine, but others are rejected by the recipient mail server. Here are the results of 9 different From addresses:

Fail:

xxx_xxxxxxx@hotmail.co.uk

xxx_xx@hotmail.com

xxxx_xxxxx@yahoo.co.uk

xxxxxxxxxxxxx@yahoo.co.uk

Succeeds:

xxxxxxxxxxxxxxxx@gmail.com

xxx.xxxxxx.xxxxxx@me.com

xxxxx.xxxxxxxxx@talk21.com

xxxxx@xxxxxx.org.uk (same domain as site)

xxxxxxxxxxxx@xxxxxx.org.uk (same domain as site)

xxxxxxxxxxxx@djinter.net

They don't fail for all recipients - there are clear patterns about which succeed and which get rejected. Most of the main webmail services: gmail, yahoo, hotmail, etc are rejecting them. Lesser know mail servers (presumably with less stringent criteria) are accepting them.

Outbound Mail is set to mail().

Any one else had problems like this, or able to offer advice?

In general: you should NOT use a from address of a domain you do not control.

the smtp protocol does not care and you can send an email pretending to be whomever sender you want, but given how it has been abused by spamers, other protection layers were put in place (DKIM, SPF).

These basically white-list which servers are allowed to send emails on the behalf of a specific sender (domain). Each other server in the world can then look at these lists, and decide to accept or reject your email based on that.

So it's not a hard rule, and depending on what from email you put and to whom you send it and how the various email servers are setup, it will work... or won't.

And no matter what, it's likely that more and more domains will white-list what are the servers allowed to send on their behalf, and more and more mail servers will look at these list and reject "unauthorised" senders.

So consider an anomaly that you can still send as @me.com for instance, and that it will soon fail.

Use your own domain(s) for the from and do set up the needed dns records to white-list your civicrm server (and the other servers you use to send emails).

And yes, it's a bit of a pain to set up, I'd suggest you to use an external provider (sendgrid, mailjet...) to deal with that. they all have clear instructions on how to set it up.


When does a '3 month' period in a membership status actually roll over Wondering how civi calculates 3 months, given that month lengths vary, eg they could be between 89 to 92 days (I think).

I am asking because we have End Date March 31, and then Grace for 3 months. Here, in NZ, it is July 1, but Grace members are still showing Grace, and not clear if something has failed (yes scheduled job is enabled and running and no log errors), or if the 'calculation' of 3 months might be a bit stretchy.

The calculation of next or past 3 months was decidedly dodgy for relative dates in searches (which is why these have been replaced with 90-day intervals in v4.7). The same method may apply for the membership status update.

If I remember correctly, it calulates the number of days in three calendar months starting with the current month.

So I think you may find that for an end date of March 31, CiviCRM will change the status after 31(March) + 30 (April) + 31(May) = 92 days, which should be 2 July.


When saved to activities, tokens inside emails are not evaluated Is it normal that when a reminder email goes out and is saved as an activity that tokens are not evaluated and saved in the activity?

If that is normal, where is the best place to make a feature request? The value of the activities feature is significantly reduced when tokens are not evaluated when stored in activities.

If that is not normal behavior, any ideas on how I can troubleshoot this?

yes, that is normal behavior. Feature requests can be made on the forums or if there is funding, via the paid issue queue.


Re-install Buildkit on Ubuntu for Windows I have just installed BuildKit on Ubuntu for Windows as root by mistake. Is there a way I can uninstall and start again? Can I just delete the buildkit folder?

Also, I don't need to install Apache, PHP and MySQL, as these are already installed. Is there a particular command for installing the build kit without these? I was following the instructions at https://docs.civicrm.org/dev/en/latest/tools/buildkit/.

If you've run amp, you should also delete the hidden folder $HOME/.amp.  Leaving --full out of the install command will skip installing apps.  Hoewver, There is no side effect to reinstalling the apps, and it includes ancillary programs like zip and curl, so you're most likely best off running with --full.  It will also restart Apache for you, which might be necessary.


How to get CiviCRM root via PHP? I'm working on an extension and I need to include a PHP file that is in the civicrm module root dir. Is there a way to get this directory through PHP? I need it to work for all CMS, not just Drupal.

Thanks!

I found the answer in the docs here: https://docs.civicrm.org/dev/en/latest/framework/filesystem/#tip-programmatic-lookup_1

You can use the following:

Civi::paths()->getPath("[civicrm.root]/.")

or

global $civicrm_root;


How can I display the members of a group? I would like to go into a group to see who is listed in it, please advise how I can view a group. Thank you

There's more than one way to view the contacts added to a group, here are a few, all of them will list the contacts belonging to the searched group.

Option 1) Navigate to Search -> Find Contacts, select your group filling the field in any group, leave the rest of the fields blank and hit search.

Option 2) Navigate to Search -> Advanced Search, select your group from the Groups field and hit search.

Option 3) Navigate to Contacts -> Manage Groups, here you can search/create/delete groups, on the right hand side of the screen there's a Contacts button for each created group, click it.


How to make a membership renewal form pre-filled with last year's values? I'm looking for some implementation advice (using Joomla 3.4 and CiviCRM 4.6.9).

A client has a price set in place for membership that includes several standard membership levels, plus a few extra optional add-on services members can select. That works well for signups. But for renewals we'd like to be able to remind them what they paid the previous year, which they could then update or accept as given.

My first thoughts on how to do this:

Have a membership renewal page that pre-fills and pre-selects values based on the selections they made the previous year? I don't see a way to set up a membership contribution page in such a way that would do this (can't call up contribution info in a profile for the contribution page?). Could I do this with a hook (which one?)? Or would I need to use the API?
I know 4.6.9 has new invoicing capabilities, could that be used in some way to pre-set the contribution form selection? Or could I set up a process flow whereby we manually create the invoice based on values from last year, and send them an invoice that has a link to a contribution page where they can pay the amount due shown on the invoice?

Any advice would be appreciated -- anyone implemented anything like this before?

I am not commenting on the key part of your question (too late at night) but just want to be sure that you are aware of ability to send out 'checksum' in your reminder emails, so when the link is clicked by the renewing member they arrive at a Contribution/membership page and the user is temporarily logged in so the form pre-fills. That way the system knows who they are and will treat them as an existing member who is trying to renew. It won't, afaik, show how much they paid last time, but it will default to their existing Membership Type - which might be the same thing depending on how you set up your Price Set and Membership Types. Good luck


How to change the date format for the receipt date in a template I'm using the "Thank-you letters - print or email" functionality to generate a receipt for contributions. I created a new template with all the information needed. However we have a problem to display the receipt date at the correct format. Actually, when I chose the token "Receipt date" in the combobox, Civi inserts {contribution.receipt_date} in my template, and when I generate a PDF, it displays the date with the hours : for example, "2019-02-25 16:01:00". We would just like to display the date (without the hours) at this format : dd/mm/YYYY (for example : "25/02/2019"). I tried to add code like "date_format" in the source of the template to change the date format, but it didn't work. Is there an easy way to change it ?

Thanks !

If you want 28 February 2019
{foreach from=$contributions item=contribution} {assign
    var="date" value=$contribution.receive_date|date_format:"%d %B %Y"}

If you want 28 02 2019
{foreach from=$contributions item=contribution} {assign
    var="date" value=$contribution.receive_date|date_format:"%d %m %Y"}

If you want it to look better (28/02/2019) you can add slashes value=$contribution.receive_date|date_format:"%d/%m/%Y"}


Searching by 'Contribution Source' gives no results CiviCRM 5.21.1 I currently cannot search using the 'Contribution Source' field within advanced search. I can however use the field successfully within the 'Find contributions' search.

Is this a bug?

It seems to work ok on https://dmaster.demo.civicrm.org and 5.23. I know there were a lot of search form changes around 5.21/5.22. If you're able to upgrade it seems to be working.


InnoDB is default, but can't install Innodb IS default engine, but can't install.  Error message is Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server.

I've checked my.conf and made sure that InnoDB is the default engine.  The drupal database is in Innodb.  I've gone through memory allocations and settings.  I've been trying to install civicrm on drupal6 for three days!   I've used drupal6 and civicrm for another client for more than a decade!  But, now, on this new install, I can't get it to work.

I have tried MANY different versions of CivicRM and they all hang at this same error message.  What do I troubleshoot next?  Anyone else have this problem?

As it turns out,  this appeared to be a file ownership problem (at least for me) and after changing the ownership to the appropriate account, I was able to continue.  I'm not sure why the error message was like that ... everything else was set correctly ... and I wish the error message was more clear.  But if anyone else is searching on this topic, it's worth a shot to make sure that every file in the civicrm directory has the same user.  If not, chown with recursion.

I had some files with the account username and some with root.  My bad.

Thanks to the commenter above for your willingness to help!


I have an uncorrect css path in the front-end html code I am using CiviCRM 5.18.3.with Joomla! 3.9.12 and I can not solved a path problem within the html page where "/components/" should be replaced by "/administrator/components/" (see below). It works OK for the back-end but not for the front-end ??
Please, your help would be well appreciated. Tks.

      ...

Are the paths in the civicrm.settings.php files each pointing to the right place?

There's one for each of front and backend:
 - /components/com_civicrm/civicrm.settings.php
 - /administrator/com_civicrm/civicrm.settings.php

If you just copy and past the paths that are set those two files (e.g. after a server migration) then you might get the error you currently have. But the paths in one file need to point to front-end Civi, and in the other point to back-end Civi (ie with /administrator appended).


Contact Report Filter: How to include Street Address? I'm trying to create a contact report (summary) and Street Address is not among the filters. Is there a way to include it?

What version of Civi are you on? Look for Constituent Summary in Reports. And install Eileen's Extended Report extension here and take a look at the Constituent Report (Summary).


How to Override System Workflow message template variables, single and batch My client has advanced invoice requirements. In the past we had a custom Drupal module and a custom template file. Added a link "Print Invoice" to the individual contributions Form.tpl and then did a custom template file in Drupal using CiviCRM API to get the relevant data. For Batch, we added a new custom task and called our custom function in a loop.

But now, of course, CiviCRM has invoicing capability baked in, which is awesome! We edited the System Workflow Message but we had a lot of trouble using crmapi calls, and using Smarty. We also see that {php} is deprecated in Smarty 3.

So then I had the thought to just override the callback for civicrm/contribute/invoice. I did that by implementing hook_civicrm_xmlMenu() and providing a custom Menu.xml that uses my own class. My class just extends CRM_Contribute_Form_Task_Invoice and then I just pull in the full objects whose data I need in my own printPDF(). (Specifically, if it's an event, I want to show event start dates, etc - and if it's a membership I want to show them their membership expiration date, etc).

The problem is that the batch invoice processor seems to be hardcoded to use CRM_Contribute_Form_Task_Invoice, and I can't find a way to override it. I've tried the same approach (overriding civicrm/contribute/search in Menu.xml) but that barfs in so many places. I've looked at hook_preProcess and changing the _attributes, etc. I've tried adding my own custom task to the dropdown on the contribute search page, but then it barks about a missing Invoice.tpl for my custom implementation.

Long story short, I'm just not 100% sure on the best way to proceed, and of course I'd rather not just hack the core code, but would rather extend it somehow. We've had a past history of nervousness to upgrade CiviCRM, and I want to not feel like we're in that same boat after this upgrade (to Drupal 7 / CiviCRM 4.7). :)

The short answer is that you can't change that from an extension, but you can change it by patching core. Unfortunately, this requires a change in coding-convention which isn't a trivial one-line patch -- it requires understanding some other layers/concepts and changing multiple files.

The root issue here is that the coding convention has relied too heavily on static functions. For example, if you grep the codebase for CRM_Contribute_Form_Task_Invoice, you'll find snippets like this one (from CRM/Contribute/Form/Task/Invoice.php):

CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs, $params, $contactId, CRM_Core_DAO::$_nullObject);

If you could change that line to point to your own version of printPDF(), you'd be ready to go. But it's hard-coded -- there's no way for an extension to change it. The good news: there are better patterns which are more flexible, e.g.

// Example: Use a service container
Civi::service('invoice_printer')->print($contributionIDs, $params, $contactId, CRM_Core_DAO::$_nullObject);

// Example: Use a hook
CRM_Utils_Hook::printInvoicePdf($contributionIDs, $params, $contactId, CRM_Core_DAO::$_nullObject);

Either of those formulations would make it possible for extensions to change the implementation of printPDF(). The bad news: either way, you'd to have to refactor the existing implementation to match a different coding convention.

A few links that might be interesting on the general topic of statics, services, and dependency-injection:

https://www.imarc.com/blog/dependency-injection
http://fabien.potencier.org/what-is-dependency-injection.html
https://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_container
https://civicrm.org/blog/totten/the-static-is-dead-long-live-the-static


Should I use CiviCRM 4.x or 5.x is this like D7 and D8? I want to use the most stable version with the most extensions as possible, with Drupal, 7 is still better than 8 for most projects.

Is it the same with civi?

I already installed and configured 5.x can I downgrade to 4.x ?

Support for CiviCRM 4.6 is nearly at an end. It is slated to end at the end of this year.

5.x is the supported stable release. 4.6 is pretty much a security only branch now.