summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 753063b50..ffaa3a0f7 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -924,13 +924,15 @@ function node_validate($node, $form = array()) {
}
/**
- * Prepare node for save and allow modules to make changes.
+ * Prepare node for saving by populating author and creation date.
*/
function node_submit($node) {
global $user;
- if (user_access('administer nodes')) {
- // Populate the "authored by" field.
+ // A user with 'administer nodes' permission might assign the node author by
+ // entering a user name in the node form, which we then need to translate to a
+ // user ID, unless we've already been provided a user ID by other means.
+ if (user_access('administer nodes') && !isset($node->uid)) {
if ($account = user_load_by_name($node->name)) {
$node->uid = $account->uid;
}