Commit 3c907636 authored by Dries's avatar Dries

- Fixed a bug in node_submit() in that the user name was not always
  correctly updated.
parent c4d228a4
......@@ -63,7 +63,7 @@ function book_save($op, $node) {
** and are not promoted by derault. See also: book_load().
*/
return array("created" => time(), "moderate" => 1, "name" => $user->name, "parent", "promote" => 0, "score" => 0, "status" => 1, "uid" => $user->uid, "users" => "", "revisions", "votes" => 0, "weight");
return array("created" => time(), "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight");
}
else if (user_access("adminster nodes")) {
/*
......@@ -105,8 +105,14 @@ function book_load($node) {
** book page through the admin pages. See also: book_save().
*/
$book->name = $user->name;
$book->uid = $user->uid;
if ($user->uid) {
$book->uid = $user->uid;
$book->name = $user->name;
}
else {
$book->uid = 0;
$book->name = "";
}
}
/*
......@@ -156,10 +162,6 @@ function book_form($node, $help, $error) {
*/
$output .= form_hidden("revision", 1);
$node->uid = $user->uid; // $node is passed by reference
$node->name = $user->name;
}
return $output;
......
......@@ -63,7 +63,7 @@ function book_save($op, $node) {
** and are not promoted by derault. See also: book_load().
*/
return array("created" => time(), "moderate" => 1, "name" => $user->name, "parent", "promote" => 0, "score" => 0, "status" => 1, "uid" => $user->uid, "users" => "", "revisions", "votes" => 0, "weight");
return array("created" => time(), "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight");
}
else if (user_access("adminster nodes")) {
/*
......@@ -105,8 +105,14 @@ function book_load($node) {
** book page through the admin pages. See also: book_save().
*/
$book->name = $user->name;
$book->uid = $user->uid;
if ($user->uid) {
$book->uid = $user->uid;
$book->name = $user->name;
}
else {
$book->uid = 0;
$book->name = "";
}
}
/*
......@@ -156,10 +162,6 @@ function book_form($node, $help, $error) {
*/
$output .= form_hidden("revision", 1);
$node->uid = $user->uid; // $node is passed by reference
$node->name = $user->name;
}
return $output;
......
......@@ -790,7 +790,7 @@ function node_submit($node) {
$fields = array("nid", "uid", "body", "comment", "created", "promote", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
}
else {
$fields = array("nid", "uid" => $user->uid, "body", "teaser", "title", "type" => $node->type);
$fields = array("nid", "uid" => ($user->uid ? $user->uid : 0), "body", "teaser", "title", "type" => $node->type);
}
node_save($node, array_merge($fields, module_invoke($node->type, "save", "update", $node)));
......@@ -822,7 +822,7 @@ function node_submit($node) {
$fields = array("uid", "body", "comment" => 1, "promote", "moderate", "status" => 1, "teaser", "title", "type" => $node->type);
}
else {
$fields = array("uid" => $user->uid, "body", "comment" => 1, "teaser", "title", "type" => $node->type);
$fields = array("uid" => ($user->uid ? $user->uid : 0), "body", "comment" => 1, "teaser", "title", "type" => $node->type);
}
node_save($node, array_merge($fields, module_invoke($node->type, "save", "create", $node)));
......
......@@ -790,7 +790,7 @@ function node_submit($node) {
$fields = array("nid", "uid", "body", "comment", "created", "promote", "moderate", "revisions", "status", "teaser", "title", "type" => $node->type);
}
else {
$fields = array("nid", "uid" => $user->uid, "body", "teaser", "title", "type" => $node->type);
$fields = array("nid", "uid" => ($user->uid ? $user->uid : 0), "body", "teaser", "title", "type" => $node->type);
}
node_save($node, array_merge($fields, module_invoke($node->type, "save", "update", $node)));
......@@ -822,7 +822,7 @@ function node_submit($node) {
$fields = array("uid", "body", "comment" => 1, "promote", "moderate", "status" => 1, "teaser", "title", "type" => $node->type);
}
else {
$fields = array("uid" => $user->uid, "body", "comment" => 1, "teaser", "title", "type" => $node->type);
$fields = array("uid" => ($user->uid ? $user->uid : 0), "body", "comment" => 1, "teaser", "title", "type" => $node->type);
}
node_save($node, array_merge($fields, module_invoke($node->type, "save", "create", $node)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment