Answers.Body: <p>I tested this on a new installation and can confirm this issue.<br>
  The problem is in <code>civicrm.php</code>.</p>
  <p>Replace the contents of <code>components/com_civicrm/civicrm.php</code> through:</p>
  <pre><code>&lt;?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) &lt; 0) {
      echo &quot;CiviCRM requires PHP version $minPhpVersion or greater. You are running PHP version &quot; . PHP_VERSION . &quot;&lt;p&gt;&quot;;
      exit();
    }
  
    require_once 'CRM/Core/ClassLoader.php';
    CRM_Core_ClassLoader::singleton()-&gt;register();
  
    require_once 'PEAR.php';
    $config = CRM_Core_Config::singleton();
  
    $joomlaUserTimezone = CRM_Core_Config::singleton()-&gt;userSystem-&gt;getTimeZoneString();
    date_default_timezone_set($joomlaUserTimezone);
    CRM_Core_Config::singleton()-&gt;userSystem-&gt;setMySQLTimeZone();
  
    $config-&gt;userFrameworkFrontend = 1;
  }
  
  function civicrm_invoke() {
    civicrm_initialize();
  
    $app = JFactory::getApplication();
    $input = $app-&gt;input;
    $itemId = $input-&gt;getInt('Itemid', 0);                   
  
    if (!empty($_REQUEST['Itemid'])) {
      $component = JComponentHelper::getComponent('com_civicrm');
      $app = Factory::getApplication();
      $menu = $app-&gt;getMenu();
      $params = $menu-&gt;getParams($app-&gt;input-&gt;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-&gt;get($a, NULL);
        if (($val !== NULL || $valp !== NULL) &amp;&amp; $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()-&gt;addCoreResources();
  
    $user = JFactory::getUser();
    CRM_Core_BAO_UFMatch::synchronize($user, FALSE, 'Joomla', 'Individual', TRUE);
  
    define('CIVICRM_UF_HEAD', TRUE);
    CRM_Core_Invoke::invoke($args);
  }
  </code></pre>
  <p>This solves the issue and registrations can be completed without problems.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-23T16:41:40.983Z
Answers.Text: 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.
Answers.UserDisplayName: Neil Z
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-26T04:46:53.243Z
Answers.Text: 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?
Answers.UserDisplayName: Bryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-30T23:46:14.867Z
Answers.Text: 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.
Answers.UserDisplayName: Bryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-17T09:39:19.227Z
Answers.Text: 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.
Answers.UserDisplayName: thoni56
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-22T08:02:48.370Z
Answers.LastActivityDate: 2024-04-23T02:11:56.553Z
Answers.LastEditDate: 2024-04-23T02:11:56.553Z
Answers.UserDisplayName: Guitarman
Answers.Body: <p>I could bet that the Yootheme Pro Extension from ZOOlanders, which is called <a href="https://zoolanders.com/" rel="nofollow noreferrer">&quot;Essentials for YOOtheme Pro&quot;</a> is installed and activated on your site.</p>
  <p>If yes, please update this extension of the YOOtheme Pro Template/Framework to the newest version.</p>
  <p>Alternatively, deactivate the ZOOlanders-plugin and retest.</p>
  <p>The YOOtheme Pro framework and CiviCRM use some identical libraries in different versions. ZOOlanders &quot;older&quot; plugin versions used to call these libraries, which exactly leads to the inconsistence you described.</p>
  <p>I had the same issue on one of my clients sites.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-17T00:03:08.960Z
Answers.Text: No, not using YOOtheme Pro. Perhaps another extension, although I certainly tried disabling some likely suspects.
Answers.UserDisplayName: Bryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-18T14:33:46.297Z
Answers.Text: Weird... can you share the URL of the installation/website? Most probably, a system plugin causes this issue.
Answers.UserDisplayName: Guitarman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-16T16:25:35.850Z
Answers.LastActivityDate: 2024-04-16T16:25:35.850Z
Answers.UserDisplayName: Guitarman
Body: <p>On a Civi 5.72.1/Joomla 4.4.3 site, event registrations are failing since 5.72.</p>
  <p>I wondered if it was caused by this: <a href="https://github.com/civicrm/civicrm-joomla/pull/73" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-joomla/pull/73</a> which 'fixes' event listings in Joomla (No, I reverted the code to the old &amp; it made no difference).</p>
  <p>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.</p>
  <p>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</p>
  <p>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-&gt;__construct()  /var/www/clients/client3/web4/web/administrator/components/com_civicrm/civicrm/CRM/Event/Controller/Registration.php:27
  2   CRM_Event_Controller_Registration-&gt;__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-&gt;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-&gt;dispatch()  /var/www/clients/client3/web4/web/libraries/src/Application/SiteApplication.php:249
  12  Joomla\CMS\Application\SiteApplication-&gt;doExecute() /var/www/clients/client3/web4/web/libraries/src/Application/CMSApplication.php:293
  13  Joomla\CMS\Application\CMSApplication-&gt;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</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-05-17T07:59:04.963Z
Comments.Text: 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: https://github.com/civicrm/civicrm-joomla/pull/73. I'm trying to understand the exact circumstances this happens.
Comments.UserDisplayName: thoni56
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-05-17T12:29:10.333Z
Comments.Text: Ok, it is probably not the menu. I created a CiviCRM issue here: https://lab.civicrm.org/dev/joomla/-/issues/58. Could you please add details for your setup there so I can recreate it.
Comments.UserDisplayName: thoni56
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-05-19T01:58:47.077Z
Comments.Text: I've posted a little more info to the issue at https://lab.civicrm.org/dev/joomla/-/issues/58
Comments.UserDisplayName: Bryan
Tags: <civievent><joomla><permissions><registration>
Title: Event registrations failing on 5.72.1 in Joomla with 'Could not find valid value for id'
ThreadText: # Event registrations failing on 5.72.1 in Joomla with 'Could not find valid value for id'
  
  (Asked by: username_0 on 2024-04-14)
  
  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
  
  **Tags:** civievent, joomla, permissions, registration
  
  > **Comments:**
  > **username_1**: 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: https://github.com/civicrm/civicrm-joomla/pull/73. I'm trying to understand the exact circumstances this happens.  
  > **username_1**: Ok, it is probably not the menu. I created a CiviCRM issue here: https://lab.civicrm.org/dev/joomla/-/issues/58. Could you please add details for your setup there so I can recreate it.  
  > **username_0**: I've posted a little more info to the issue at https://lab.civicrm.org/dev/joomla/-/issues/58  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2024-04-22. Score: 0 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_3**: 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.  
  > **username_0**: 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?  
  > **username_0**: 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.  
  > **username_1**: 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.  
  
  ---
  
  ### Answer by username_2 on 2024-04-16. Score: 0
  
  I could bet that the Yootheme Pro Extension from ZOOlanders, which is called ["Essentials for YOOtheme Pro"](https://zoolanders.com/) 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.
  
  > **Comments:**
  > **username_0**: No, not using YOOtheme Pro. Perhaps another extension, although I certainly tried disabling some likely suspects.  
  > **username_2**: Weird... can you share the URL of the installation/website? Most probably, a system plugin causes this issue.  
  
  ---
  
  