After granting "Administer nodes" to anonymous users, logout, and then create a node. e.g. node/add/forum

result is some errors:

* notice: Undefined property: name in /home/brenda/projects/drupal/HEAD/modules/node/node.pages.inc on line 51.
* notice: Undefined property: date in /home/brenda/projects/drupal/HEAD/modules/node/node.pages.inc on line 172.
* notice: Undefined property: created in /home/brenda/projects/drupal/HEAD/modules/node/node.pages.inc on line 193.

the first happens on any and all node creation when not logged in. In node_add

    $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type, 'language' => '');

easy fix is to set $user->name to '' - but perhaps this should be done in the creation of the $user global? I don't know enough about $user use to be confident here.
I've changed to:

    $node = array('uid' => $user->uid, 'name' => isset($user->name) ? $user->name : '', 'type' => $type, 'language' => '');

line 172 is:

  $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => $node->date)));

patch changes to

  $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#description' => t('Format: %time. Leave blank to use the time of form submission.', array('%time' => isset($node->date) ? $node->date : '')));

line 193:

$form[$key] = array('#type' => 'value', '#value' => $node->$key);

becomes

$form[$key] = array('#type' => 'value', '#value' => isset($node->$key) ? $node->$key: '');
CommentFileSizeAuthor
node.pages_.inc_.patch2.24 KBShiny

Comments

Shiny’s picture

Component: forum.module » node system
webchick’s picture

Status: Active » Needs work

Seems to be down to just the one error:

notice: Undefined property: stdClass::$name in modules/node/node.pages.inc on line 55.

Patch no longer applies. Marking CNW.

You can also reproduce this in a less "won't fix" kind of way ;) by giving anonymous users simply "create $some_content_type" permissions, which I would think is a relatively common use case.

patchnewbie’s picture

Assigned: Unassigned » patchnewbie

A good patch for someone new to Drupal.

catch’s picture

This has been fixed somewhere.

catch’s picture

Status: Needs work » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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