By saepl on
Hello,
I am moving a module that was created for D5 over to D6. I am getting the following error that I believe has to do with permissions based on some searched I have done:
Invalid argument supplied for foreach() in /home/samp2633/public_html/sandbox/includes/menu.inc on line 258
Here is my code:
function awardcalc_menu() {
$items = array();
$items['admin/awardcalc'] = array(
'title' => t('Award Calculator'),
'description' => t('Adjust Award Calculator options.'),
'position' => 'right',
'weight' => -5,
'page callback' => 'system_admin_menu_block_page',
'access arguments' => user_access('administer access control')
);
$items['admin/awardcalc/settings'] = array(
'title' => t('AwardCalc settings'),
'description' => t('Change the AwardCalc Variables.'),
'page callback' => 'drupal_get_form',
'page arguments' => array('awardcalc_admin_settings'),
'access arguments' => user_access('administer access control')
);
$items['popup/financial_aid_calculator'] = array(
'title' => t('Financial Aid Calculator'),
'page callback' => 'drupal_get_form',
'page arguments' => array('awardcalc_popup'),
'type' => MENU_CALLBACK,
'access arguments' => user_access('access content'),
);
return $items;
}
and here is the function found on line 258:
function menu_unserialize($data, $map) {
if ($data = unserialize($data)) {
foreach ($data as $k => $v) {
if (is_int($v)) {
$data[$k] = isset($map[$v]) ? $map[$v] : '';
}
}
return $data;
}
else {
return array();
}
}
Comments
I didn't mean to say the
I didn't mean to say the problem was related to permissions but to the menu system...oops! Any ideas as to what you think it wrong would be greatly appreciated.
This: 'access arguments'
This:
'access arguments' => user_access('access content'),should be this:
'access arguments' => array('access content'),Contact me to contract me for D7 -> D10/11 migrations.
that worked like a charm! my
that worked like a charm! my foreach() errors are gone...now to fix the next one that popped up!
Short program to check for bad data.
Good. — Fast. — Cheap.
(Pick any two.)