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: '');
| Comment | File | Size | Author |
|---|---|---|---|
| node.pages_.inc_.patch | 2.24 KB | Shiny |
Comments
Comment #1
Shiny commentedComment #2
webchickSeems to be down to just the one error:
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.
Comment #3
patchnewbie commentedA good patch for someone new to Drupal.
Comment #4
catchThis has been fixed somewhere.
Comment #5
catchComment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.