0

On a Civi 5.72.1/Joomla 4.4.3 site, event registrations are failing since 5.72.

I wondered if it was caused by this: https://github.com/civicrm/civicrm-joomla/pull/73 which 'fixes' event listings in Joomla (No, I reverted the code to the old & it made no difference).

I also have some Joomla permissions problems, involving the appearance of nine 'empty' (ie no label) activities with 'allowed' permissions at the foot of the permissions list.

CRM_Core_Exception: Could not find valid value for id in /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Event/StateMachine/Registration.php on line 27

0 CRM_Utils_Request::retrieve() /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Event/StateMachine/Registration.php:27 1 CRM_Event_StateMachine_Registration->__construct() /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Event/Controller/Registration.php:27 2 CRM_Event_Controller_Registration->__construct() /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:320 3 CRM_Core_Invoke::runItem() /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:69 4 CRM_Core_Invoke::_invoke() /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:36 5 CRM_Core_Invoke::invoke() /var/www/clients/client3/web4/web/components/com_civicrm/civicrm.php:80 6 civicrm_invoke() /var/www/clients/client3/web4/web/components/com_civicrm/civicrm.php:13 7 require_once('/var/www/clients…') /var/www/clients/client3/web4/web/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71 8 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher{closure}() /var/www/clients/client3/web4/web/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73 9 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() /var/www/clients/client3/web4/web/libraries/src/Component/ComponentHelper.php:361 10 Joomla\CMS\Component\ComponentHelper::renderComponent() /var/www/clients/client3/web4/web/libraries/src/Application/SiteApplication.php:208 11 Joomla\CMS\Application\SiteApplication->dispatch() /var/www/clients/client3/web4/web/libraries/src/Application/SiteApplication.php:249 12 Joomla\CMS\Application\SiteApplication->doExecute() /var/www/clients/client3/web4/web/libraries/src/Application/CMSApplication.php:293 13 Joomla\CMS\Application\CMSApplication->execute() /var/www/clients/client3/web4/web/includes/app.php:61 14 require_once('/var/www/clients…') /var/www/clients/client3/web4/web/index.php:32

3
  • Are your registrations linked directly from a menu entry? If so can you please try, in a staging copy, recreating the menu entry and use the updated code? This is required to make the update work and did unfortunately not make it into the release notes: github.com/civicrm/civicrm-joomla/pull/73. I'm trying to understand the exact circumstances this happens.
    – thoni56
    Commented May 17 at 7:59
  • Ok, it is probably not the menu. I created a CiviCRM issue here: lab.civicrm.org/dev/joomla/-/issues/58. Could you please add details for your setup there so I can recreate it.
    – thoni56
    Commented May 17 at 12:29
  • 1
    I've posted a little more info to the issue at lab.civicrm.org/dev/joomla/-/issues/58
    – Bryan
    Commented May 19 at 1:58

2 Answers 2

0

I tested this on a new installation and can confirm this issue.
The problem is in civicrm.php.

Replace the contents of components/com_civicrm/civicrm.php through:

<?php

defined('_JEXEC') or die('No direct access allowed');
                       
use Joomla\CMS\Factory;
                   
define('CIVICRM_SETTINGS_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'civicrm.settings.php');
include_once CIVICRM_SETTINGS_PATH;

civicrm_invoke();

function civicrm_init() {
  return civicrm_initialize();
}

function civicrm_initialize() {
  // Check for php version and ensure its greater than minPhpVersion
  $minPhpVersion = '7.4.0';
  if (version_compare(PHP_VERSION, $minPhpVersion) < 0) {
    echo "CiviCRM requires PHP version $minPhpVersion or greater. You are running PHP version " . PHP_VERSION . "<p>";
    exit();
  }

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

  require_once 'PEAR.php';
  $config = CRM_Core_Config::singleton();

  $joomlaUserTimezone = CRM_Core_Config::singleton()->userSystem->getTimeZoneString();
  date_default_timezone_set($joomlaUserTimezone);
  CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();

  $config->userFrameworkFrontend = 1;
}

function civicrm_invoke() {
  civicrm_initialize();

  $app = JFactory::getApplication();
  $input = $app->input;
  $itemId = $input->getInt('Itemid', 0);                   

  if (!empty($_REQUEST['Itemid'])) {
    $component = JComponentHelper::getComponent('com_civicrm');
    $app = Factory::getApplication();
    $menu = $app->getMenu();
    $params = $menu->getParams($app->input->get('Itemid'));
    $args = array('task', 'id', 'gid', 'pageId', 'action', 'csid', 'component');
    $view = CRM_Utils_Array::value('view', $_REQUEST);
    if ($view) {
      $args[] = 'reset';
    }

    foreach ($args as $a) {
      $val = CRM_Utils_Array::value($a, $_REQUEST, NULL);
      $valp = $params->get($a, NULL);
      if (($val !== NULL || $valp !== NULL) && $view) {
        $val = (!empty($val)) ? $val : $valp;
        $_REQUEST[$a] = $_GET[$a] = $val;
      }
    }
  }

  $task = CRM_Utils_Array::value('task', $_GET, '');
  $args = explode('/', trim($task));

  CRM_Core_Resources::singleton()->addCoreResources();

  $user = JFactory::getUser();
  CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);

  define('CIVICRM_UF_HEAD', TRUE);
  CRM_Core_Invoke::invoke($args);
}

This solves the issue and registrations can be completed without problems.

4
  • FWIW ... I was having an issue with online registrations where if there were multiple attendees being registered, the form did not recognize that there were more people to register. The replacement civicrm.php file above fixed this issue.
    – Neil Z
    Commented Apr 23 at 16:41
  • Thanks. I restored my 5.71 backup to get around this. I've then tried without success to restore the problematic 5.72 version into a docker container, so I can't test your fix atm. These seem like fairly fundamental modifications to components/com_civicrm/civicrm.php. Can they be got into the main codebase soon?
    – Bryan
    Commented Apr 26 at 4:46
  • I can confirm that this solves the issue in a restore database version Civi 5.72.1, Joomla 4.4, running in a docker container. I guess this isn't an complete answer though until it's upgrade-proof.
    – Bryan
    Commented Apr 30 at 23:46
  • The code suggested in this issue is basically a revert to the old code. I think recreating the CiviCRM-related menu items is upgrade-proof.
    – thoni56
    Commented May 17 at 9:39
0

I could bet that the Yootheme Pro Extension from ZOOlanders, which is called "Essentials for YOOtheme Pro" is installed and activated on your site.

If yes, please update this extension of the YOOtheme Pro Template/Framework to the newest version.

Alternatively, deactivate the ZOOlanders-plugin and retest.

The YOOtheme Pro framework and CiviCRM use some identical libraries in different versions. ZOOlanders "older" plugin versions used to call these libraries, which exactly leads to the inconsistence you described.

I had the same issue on one of my clients sites.

2
  • No, not using YOOtheme Pro. Perhaps another extension, although I certainly tried disabling some likely suspects.
    – Bryan
    Commented Apr 17 at 0:03
  • Weird... can you share the URL of the installation/website? Most probably, a system plugin causes this issue.
    – Guitarman
    Commented Apr 18 at 14:33

Your Answer

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

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