Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using a Views(7.x-3.8) view to override the default output of /blog/% the following error is generated.
Notice: Trying to get property of non-object in blog_menu_local_tasks_alter() (line 155 of /XXX/modules/blog/blog.module).
The error is not generated for the override of /blog with a Views view.
Comments
Comment #1
dcam CreditAttribution: dcam commentedIs this a Views issue or an issue with Drupal core?
Comment #2
Lostboy22 CreditAttribution: Lostboy22 commentedThe notice is from a line in core.....
Comment #3
dcam CreditAttribution: dcam commentedYes. I saw that. It doesn't automatically mean that core is at fault. Also, it's not uncommon for people to post issues they know are caused by contrib modules in the core queue, not realizing they should post it in that module's queue. I had to ask.
I'll see what I can find out about the problem.
Comment #4
maxrys CreditAttribution: maxrys commentedI have this bug too when i override path "blog/%" with Views!
I analyze blog_menu_local_tasks_alter: $router_item['page_arguments'] == Array (VIEW_NAME, VIEW_PAGE_NAME, USER_ID);
Maybe it's bug of Views module.
Right code:
- elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0] == $user->uid) {
+ elseif ($root_path == 'blog/%' && arg(1) == $user->uid) {
Comment #5
Lostboy22 CreditAttribution: Lostboy22 commentedWhere did you make the change?
Comment #6
Juanpgs CreditAttribution: Juanpgs commentedHi, I am getting the same error "Notice: Trying to get property of non-object in blog_menu_local_tasks_alter() (line 155...blog.module)."
any solution?
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedThis issue is present in 7.34 as well when using views and giving the path of the Page Display to blog/%.
I am using the Core blog module
Comment #8
dcam CreditAttribution: dcam commentedComment #9
klokie CreditAttribution: klokie commentedThis issue still persists, though the fix suggested in #1160926-3: Blog module conflicts with other URL routes beginning with "blog/" fixes it.