Further along on this project: http://drupal.org/node/580526

I'm now going the 3rd route and building a custom module for the task. Unfortunately I seem to have broken drupal already. Here is the error I'm getting:
warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/drupal/includes/menu.inc on line 258.

Which is referring to this function:

/**
 * The menu system uses serialized arrays stored in the database for
 * arguments. However, often these need to change according to the
 * current path. This function unserializes such an array and does the
 * necessary change.
 *
 * Integer values are mapped according to the $map parameter. For
 * example, if unserialize($data) is array('view', 1) and $map is
 * array('node', '12345') then 'view' will not be changed because
 * it is not an integer, but 1 will as it is an integer. As $map[1]
 * is '12345', 1 will be replaced with '12345'. So the result will
 * be array('node_load', '12345').
 *
 * @param @data
 *   A serialized array.
 * @param @map
 *   An array of potential replacements.
 * @return
 *   The $data array unserialized and mapped.
 */
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();
  }
}

And here is my call to hook_menu that I'm guessing is breaking everything... but I can't for the life of me see whats wrong.

/**
* Implementation of hook_menu
*/
function advprofilesearch_menu() {
	$items['find-a-family'] = array(
		'title' => t('Find A Family'),
		'page callback' => 'advprofilesearch_page',
		'type' => MENU_CALLBACK,
		'access arguments' => TRUE,
	);
	
	$items['family-search-results'] = array(
		'title' => t('Search Results'),
		'page callback' => 'advprofilesearch_results',
		'type' => MENU_CALLBACK,
		'access arguments' => TRUE,
	);
	
	return $items;
}

Any ideas?
- Ryan

Comments

Anonymous’s picture

try this:

/**
* Implementation of hook_menu
*/
function advprofilesearch_menu() {
  $items = array();
  $items['find-a-family'] = array(
    'title' => t('Find A Family'),
    'page callback' => 'advprofilesearch_page',
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
  );

  $items['family-search-results'] = array(
    'title' => t('Search Results'),
    'page callback' => 'advprofilesearch_results',
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
  );

  return $items;
}
john morahan’s picture

The problem is this: 'access arguments' => TRUE,
Change it to 'access callback' => TRUE, or 'access arguments' => array('some permission'),

rschwab’s picture

oh pffff how silly of me.

Thank you!

- Ryan