
Joomla 1.0.9 Invalid argument supplied for foreach() in frontend.php on line 85
In order to solve to following issues in #Joomla 1.0.9
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/waltercedric.com/httpdocs/includes/frontend.php on line 85
Edit the file includes/frontend.php , this is the correct code:
/**
* Cache some modules information
* @return array
*/
function &initModules() {
global $database, $my, $Itemid;
if (!isset( $GLOBALS['_MOS_MODULES'] )) {
$query = "SELECT id, title, module, position, content, showtitle, params"
. "\n FROM #__modules AS m"
. "\n INNER JOIN #__modules_menu AS mm ON mm.moduleid = m.id"
. "\n WHERE m.published = 1"
. "\n AND m.access <= '". $my->gid ."'"
. "\n AND m.client_id != 1"
. "\n AND ( mm.menuid = '".$Itemid."' OR mm.menuid = 0 )"
. "\n ORDER BY ordering";
$database->setQuery( $query );
$modules = $database->loadObjectList();
foreach ($modules as $module) {
$GLOBALS['_MOS_MODULES'][$module->position][] = $module;
}
}
return $GLOBALS['_MOS_MODULES'];
}
In yellow what has changed in that method (extract)
. "\n AND m.access <= ‘". $my->gid ."’"
and
. "\n AND ( mm.menuid = ‘".$Itemid."’ OR mm.menuid = 0 )"
All credits goes to user Mathinka (JoomlaPortal.de)