The above fix works, but throws an 'undefined index error' for users with no albums if you have all error reporting turned on. This is a better fix -
g2helper.inc, mapAllGalleryLinks function, replace thisCode: › list ($ret, $descendentCounts) = GalleryCoreApi::fetchDescendentCounts($itemIds, $entityId->getId());
if ((count($descendentCounts) < 1) || (isset($ret) && $ret->getErrorCode() & ERROR_STORAGE_FAILURE)) {
/*
* User has no items to display!
*/
$this->done();
return NULL;
}
elseif (isset($ret)) {
msg_handler(E_G2_ERROR, sprintf($user->lang['G2_FETCHDESCENDCOUNTS_FAILED'], $entityId->getId()) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
}
With thisCode: › if (sizeof($itemIds) == 0) {
/*
* User has no album items to display!
*/
$this->done();
return array(null, null);
}
else {
list ($ret, $descendentCounts) = GalleryCoreApi::fetchDescendentCounts($itemIds, $entityId->getId());
if (($descendentCounts[$itemIds[0]] < 1) || (isset($ret) && $ret->getErrorCode() & ERROR_STORAGE_FAILURE)) {
/*
* User has no descendent items to display!
*/
$this->done();
return array(null, null);
}
elseif (isset($ret)) {
msg_handler(E_G2_ERROR, sprintf($user->lang['G2_FETCHDESCENDCOUNTS_FAILED'], $entityId->getId()) . $user->lang['G2_ERROR'] . $ret->getAsHtml(), __FILE__, __LINE__);
}
}