I am using Backdrop CMS 1.10.1 with CiviCRM 5.2.2 and I am having trouble with the kcfinder, when uploading and inserting images, both into CiviMail and CiviContribute.

The initial problem was a 500 error. Based on this bit of the log,

[Thu Jul 05 16:53:47.624995 2018] [fcgid:warn] [pid 6591] [client ] mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Function name must be a string in [site]/public_html/modules/civicrm/packages/kcfinder/integration/civicrm.php:67

I traced it down to this switch statement in /kcfinder/integration/civicrm.php

switch ($config->userFramework) { case 'Drupal': case 'Drupal6': $auth_function = 'authenticate_drupal'; break; case 'Joomla': $auth_function = 'authenticate_joomla'; break; case 'WordPress': $auth_function = 'authenticate_wordpress'; break; }

This is missing the case for Backdrop, so $authfunction never got assigned to a string. I tried to add a case for Backdrop, as well as the authenticate_backdrop function, but I don't know how to make it work. First, I tried making the authenticate_backdrop function the same as authenticate_drupal, but it gives me the error:

You must be logged in with proper permissions to edit, add, or delete uploaded images.

I removed everything except the permission check from the function, so that it just looks like this:

function authenticate_backdrop($config) { // check if user has access permission... if (CRM_Core_Permission::check('access CiviCRM')) { error_log("There is permission.") return true; } } It gives me permission, and allows me to upload an image and insert it. Here is the original file with the authenticate functions for drupal, joomla and wordpress. https://github.com/civicrm/civicrm-packages/blob/master/kcfinder/integration/civicrm.php

What is the correct way to implement authenticate_backdrop? It is okay to just have the CRM_Core_Permission::check?

  • You might be right, but perhaps there's something we're missing. I don't really understand what's going on there. The drupal function is confusing and seems to have a whole lot of cruft that isn't being used. $base_url isn't being used. You might need to include the boostrap so we're sure to get the logged in user.
    – herb
    Jul 7, 2018 at 5:11
  • I checked and I think now that it has to bootstrap Backdrop otherwise it'll always return true.
    – herb
    Jul 7, 2018 at 14:16
  • Can you test this PR/patch? github.com/civicrm/civicrm-packages/pull/216
    – herb
    Jul 7, 2018 at 15:42
  • @herb The PR/patch works. Thank you! Jul 12, 2018 at 16:20

1 Answer 1


Per comments above, this bug was fixed by @herb in https://github.com/civicrm/civicrm-packages/pull/216

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.