Open joseltorres opened 5 months ago
If it is changed to this it works.
$defaults =[];
$admItem = CRM_Core_BAO_Navigation::retrieve([
'name' => 'Administer'
], $defaults);
$administerMenuId = (int) $admItem->id;
$evItem = CRM_Core_BAO_Navigation::retrieve([
'name' => 'CiviEvent'
], $defaults);
$eventMenuId = (int) $evItem->id;
https://github.com/MillerTech-CRM/uk.co.nfpservices.module.memberonlyevent/blob/41be98ee1560789b1cf55115a567ed640e00e691/memberonlyevent.php#L354 $administerMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'Administer', 'id', 'name'); $eventMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Navigation', 'CiviEvent', 'id', 'name');
pulls in the first instance of the navigation items, if the site your are on was added after the initial, or in my instance was part of a migration from drupal 7 to 10 (we had both civicrm instances running at same time) it is likely is not domain ID 1 - then it will grab the wrong IDs and you'll get this error
TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 360 of .../files/civicrm/ext/uk.co.nfpservices.module.memberonlyevent/memberonlyevent.php)