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.
I have a drupal6 test site where anonymous users have the permission to add/edit nodes.
If an anonymous user visits '?q=node/add/page', (s)he gets a the error message
notice: Undefined property: stdClass::$name in /home/slippens/public_html/drupal-HEAD/modules/node/node.pages.inc on line 55.
The offending line is in this function:
function node_add($type) {
global $user;
$types = node_get_types();
$type = isset($type) ? str_replace('-', '_', $type) : NULL;
// If a node type has been specified, validate its existence.
if (isset($types[$type]) && node_access('create', $type)) {
// Initialize settings:
55: $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type, 'language' => '');
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));
$output = drupal_get_form($type .'_node_form', $node);
}
return $output;
}
attached patch uses $node->name = '' if $user->name is not set.
Comment | File | Size | Author |
---|---|---|---|
anon_node_add_0.patch | 898 bytes | soxofaan | |
Comments
Comment #1
soxofaan CreditAttribution: soxofaan commentedComment #2
yched CreditAttribution: yched commentedshould be filed a 'bug report', I guess ?
Comment #3
alasda CreditAttribution: alasda commentedVerified issue
Applied patch
Submitted page as anonymous user
Error no longer appears
able to retrieve page content
Works as advertised.
Comment #4
Gábor HojtsyThanks, committed.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.