Notice: Undefined property: stdClass::$nid in _menu_views_form_alter() (line 216 of /.../sites/all/modules/menu_views/menu_views.admin.inc).
I get that message every time I start to create new content (add -> basic page f.ex). Although everything seems to work.
System - D7.16 & modules up to date. No specific menu modules, worth to mention maybe Zeropoint drop-down menu.

Comments

markhalliwell’s picture

This is probably because it's a new node and there isn't a node ID yet.

veskimees’s picture

Well... is there something I can do? Administrators can survive that box with alarming red cross, but average users... ;-)

motomc’s picture

I have the same notice, have you fixed it?

markhalliwell’s picture

I haven't had the time yet and it's really just an annoying notice. If these are actual production sites, you should probably lower your displayed error log level to "None" (in /admin/config/development/logging).

It is recommended that sites running on production environments do not display any errors.

You will still get watchdog entries.

markhalliwell’s picture

Title: Notice » Notice: Undefined property: stdClass::$nid in _menu_views_form_alter()
robmc’s picture

StatusFileSize
new642 bytes

I ran into a problem with not being able to create webform content as a result of this issue. Here is a patch that seemed to fix the problem.

Hope this helps.

Cheers,

Rob

markhalliwell’s picture

Assigned: Unassigned » markhalliwell
Priority: Minor » Major
Status: Active » Needs work

Yes, this will silence the notice. It does not, however, solve the underlying issue that I've discovered: menu items not getting saved on a new node. Not entirely sure whether it is just when it's a view or if it's a menu item as well. Working on it right now, revised patch to come soon.

robmc’s picture

Thanks Mark! I didn't go in depth on the issue as just clearing the message solved my current problem.

Cheers,

Rob

markhalliwell’s picture

Title: Notice: Undefined property: stdClass::$nid in _menu_views_form_alter() » New nodes not saving menu view items, Undefined $nid in _menu_views_form_alter()
Status: Needs work » Needs review
StatusFileSize
new8.08 KB

Here is a patch that fixes both issues mentioned above. I also went ahead and committed it to the latest dev branch, would like some feedback from people before marking this as fixed (particularly in creating new nodes with menu view items).

http://drupalcode.org/project/menu_views.git/commit/b2768d0

robmc’s picture

Hi Mark,

Looks great so far, I have been running it all day with no problems. I have a big import of nodes in the next few days that will exercise this code. I'll report if I have any issues.

Best Regards,

Rob

markhalliwell’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, glad to hear! Marking as RTBC, will mark this as fixed and probably release 7.x-2.0-rc3 soon after if you don't find any issues.

robmc’s picture

Hi Mark,

I imported a few hundred nodes that directly impacted your code and everything has worked as expected and I haven't encountered any issues.

Cheers,

Rob

markhalliwell’s picture

Status: Reviewed & tested by the community » Fixed

Awesome! Thanks Rob.

ahimsauzi’s picture

Nicely done Mark! Thank you!

veskimees’s picture

TNX, seems to work.

Status: Fixed » Closed (fixed)

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