Problem/Motivation

When activate "me" module get error on blog/% page:

Trying to get property of non-object in blog_menu_local_tasks_alter() (line 155 of ... /modules/blog/blog.module)

Proposed resolution

Solution described in the issue:

  1. Go to the file blog.module and find the line (154 or 155) in the function blog_menu_local_tasks_alter().
  2. The line should be:
    elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0]->uid == $user->uid) {
  3. Change it to:
    elseif ($root_path == 'blog/%' && isset($router_item['page_arguments'][0]->uid) && $router_item['page_arguments'][0]->uid == $user->uid) {
  4. The warning is now fixed.
CommentFileSizeAuthor
#4 blog.patch746 bytesakoepke

Comments

pingers’s picture

Status: Active » Closed (works as designed)

Easily fixed by doing this, but I think me.module is to blame...

It's adding page arguments... wouldn't the solution be to merge the arrays differently in me.module (in hook_menu_alter())?

chirhotec’s picture

Status: Closed (works as designed) » Active

The ME module isn't the only one having problems with this issue:

https://drupal.org/node/1160926 (Menu token)
http://www.drupaldeveloper.es/en/trying-to-get-property-of-non-object-in... (Token?)

In my case, I'm encountering this problem when I try to override the built in blog page with one created from views.

akoepke’s picture

Issue summary: View changes

I just encountered this issue doing the same task as chirhotec above. I have create a View to override the default blog page and when using the user UID as a contextual filter, it displays this error message.

akoepke’s picture

StatusFileSize
new746 bytes

Patch file attached

akoepke’s picture

Status: Active » Needs review
seren10pity13’s picture

Hi,
I found the same patch in Menu Token issue queue : https://www.drupal.org/node/1160926#comment-9486777
It's a 3 years old issue, but the bug is still there, and the patch is still working.

klokie’s picture

Status: Needs review » Reviewed & tested by the community
fabianx’s picture

Issue tags: +Pending Drupal 7 commit

Thought about it for a moment, but this is fine. If something alters something it needs to check that its assumptions are correct.

Marked for commit.

David_Rothstein’s picture

Title: Incompatibility with "menu_token", "me" and suchlike modules » Blog module conflicts with other URL routes beginning with "blog/"

The issue marked duplicate of this one (#1160926: Blog module conflicts with other URL routes beginning with "blog/") had a better title :)

Also adjusting issue credits so some people from that issue get credited here too.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Committed to 7.x - thanks!

  • David_Rothstein committed 90cff29 on 7.x
    Issue #1388664 by akoepke, chirhotec, klokie, lOggOl: Blog module...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.