Closed (fixed)
Project:
Automatic Nodetitles
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Feb 2012 at 07:03 UTC
Updated:
3 Apr 2018 at 20:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
chandan.drupalchamp commentedComment #2
chandan.drupalchamp commentedNotice: Undefined property: stdClass::$nid in auto_nodetitle_set_title() (line 81 of C:\xampp\htdocs\coffee\sites\all\modules\auto_nodetitle\auto_nodetitle.module).
function auto_nodetitle_set_title(&$node) {
$types = node_type_get_types();
$pattern = variable_get('ant_pattern_' . $node->type, '');
if (trim($pattern)) {
$node->changed = REQUEST_TIME;
$node->title = _auto_nodetitle_patternprocessor($pattern, $node);
}
--elseif ($node->nid)
++elseif (!empty($node->nid))//Changed code is
{
$node->title = t('@type @node-id', array('@type' => $types[$node->type]->name, '@node-id' => $node->nid));
}
else {
$node->title = t('@type', array('@type' => $types[$node->type]->name));
}
Comment #3
deepakchaudhary commentedI also have the same issue.
Notice: Undefined property: stdClass::$nid in ex_contents() (line 30 of C:\wamp\www\drupal-7.14\sites\default\modules\a\a.module).
Notice: Undefined property: stdClass::$nid in ex_contents() (line 30 of C:\wamp\www\drupal-7.14\sites\default\modules\a\a.module).
Notice: Undefined property: stdClass::$nid in ex_contents() (line 30 of C:\wamp\www\drupal-7.14\sites\default\modules\a\a.module).
Comment #4
Angry Dan commentedThis thread seems to be a bit nuts, but I'm 100% getting that notice in the title. In my case it's caused by creating a node using Rules. When you want to create a new node with rules you must use the "create entity" action which turns out a new node object that (for reasons complicated) doesn't get an nid property until after the save is complete. When ANT runs it's trying to read the nid property and that's producing a notice.
It's a simple fix - line 81, change
elseif ($node->nid) {toelseif (!empty($node->nid)) {Comment #5
randell commentedSolution in #4 worked for me.
Comment #6
alex.bukach commentedProviding a patch implementing #4.
Comment #7
alex.bukach commentedComment #8
alex.bukach commentedComment #9
rossb89 commentedHave just ran into this issue as well, patch in #6 solves the issue and is an appropriate fix.
Comment #10
rossb89 commentedComment #11
anmolgoyal74 commentedThe patch works as designed
Comment #12
anmolgoyal74 commentedComment #14
gaurav.kapoor commented