Hey Guys, Im trying to build a module that will rewrite the urls for /recipe, /recipe/byname, /recipe/bycat and /recipe/bying.

I keep running into a fatal error:

Fatal error: Unsupported operand types in pressflow\modules\system\system.module on line 626

I narrowed this down to line 22 in recipe.landing.page.inc

$content = system_admin_menu_block($item);

From what I can tell this is what outputs the links to the search categories.

When I comment it out my module redirects fine. But when not commented out I get that fatal error message.

Im not sure if its my modules code thats the issue but I was hoping maybe someone can take a look and point me in the right direction.

Here's what I have in my module:

// I had to add this permission since this recipe mod uses the "access content" permission. I'm baffled as to why on that one.
function recipe_custom_settings_perm() {
  return array('access recipes');
}

// I pretty much just copied the recipe_menu() in recipe.module and made adjustments. So this will create the new pages.
function recipe_custom_settings_menu() {
  $items['nutrition/recipe'] = array(
    'title' => 'Recipes',
		'page callback' => 'recipe_landing_page',
		'access arguments' => array('access recipes'),
    'file' => '../../contrib/recipe/recipe.landing.page.inc',
  );
  $items['nutrition/recipe/byname'] = array(
    'title' => 'By name',
    'description' => 'Find individual recipes by name.',
    'page callback' => 'recipe_name_index_page',
    'access arguments' => array('access recipes'),
    'file' => '../../contrib/recipe/recipe_name_index.inc',
    'weight' => -1
  );
  $items['nutrition/recipe/bycat'] = array(
    'title' => 'By category',
    'description' => 'Find individual recipes by using the category list.',
    'page callback' => 'recipe_category_index_page',
    'access arguments' => array('access recipes'),
    'file' => '../../contrib/recipe/recipe_category_index.inc'
  );
  $items['nutrition/recipe/bying'] = array(
    'title' => 'By ingredient',
    'description' => 'Find individual recipes by their ingredients.',
    'page callback' => 'recipe_ingredient_index_page',
    'access arguments' => array('access recipes'),
    'file' => '../../contrib/recipe/recipe_ingredient_index.inc'
  );
  return $items;
} 

// This will now redirect the original urls to the new ones made above.
function recipe_custom_settings_menu_alter(&$items) {
    $items['recipe']['page callback'] = 'drupal_goto';
    $items['recipe']['page arguments'] = array('nutrition/recipe');
	
    $items['recipe/byname']['page callback'] = 'drupal_goto';
    $items['recipe/byname']['page arguments'] = array('nutrition/recipe/byname');
	
		$items['recipe/bycat']['page callback'] = 'drupal_goto';
    $items['recipe/bycat']['page arguments'] = array('nutrition/recipe/bycat');
	
    $items['recipe/bying']['page callback'] = 'drupal_goto';
    $items['recipe/bying']['page arguments'] = array('nutrition/recipe/bying');	
}

Thanks!

Comments

jvandervort’s picture

Did you try using the Path module and making an alias?

admin/config/search/path
->add alias
Existing system path: recipe/byname
Path alias: recipe/something_else

dcam’s picture

Status: Active » Closed (fixed)

Closing old support requests. Re-open if needed.