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?