I set up views for forum/% paths to replace the core forum pages, and it works fine except I get this error:

Notice: Trying to get property of non-object in forum_menu_local_tasks_alter()
(line 169 of opt/jenkins/blahblah/modules/forum/forum.module).

Line 169 is the last line in this code block:

 * Implements hook_menu_local_tasks_alter().
function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  global $user;

  // Add action link to 'node/add/forum' on 'forum' sub-pages.
  if ($root_path == 'forum' || $root_path == 'forum/%') {
    $tid = (isset($router_item['page_arguments'][0]) ? $router_item['page_arguments'][0]->tid : 0);

This is failing because $router_item['page_arguments'][0] is defined but it's a string, not an object.

So what are my options here?

  • I don't want to hack the forum module to change that line
  • I don't want to change the path of my views to something besides forum/%
  • So I think I need to figure out how to unset $router_item['page_arguments'][0] so that that conditional will short circuit? Or is there another way?

1 Answer 1


I ended up just using a different URL and fixing links to point to that one. Not a real fix to my problem, but whatever.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.