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.
From Drupal 4.6 onward node_submit() imports the current $user in its first line, but never makes use of it. I'm new to Drupal, but this doesn't make any sense to me. Furthermore the function (at least in D6>=) fails to use the user variable, when it actually would be feasible. Eg. in this line "$node->uid = 0;" instead of "$node->uid = $user->uid". If no $node->name is supplied, it would be perfectly fine to just rely on the fact that the current user submitted the form/node.
Comment | File | Size | Author |
---|---|---|---|
#15 | 813146-15-node_submit_cruft_d6.patch | 442 bytes | pfrenssen |
#10 | 813146.patch | 520 bytes | bleen |
#7 | 813146-7-node-node_submit.patch | 547 bytes | pfrenssen |
#6 | node-submit-813146-6.patch | 501 bytes | oddbit |
#4 | node-submit-813146-4.patch | 475 bytes | oddbit |
Comments
Comment #1
oddbit CreditAttribution: oddbit commentedThis one has a number of related issues on this topic already. For example:
#659962: Nodes with a $node->uid assigned can not have author changed
#398110: node_submit resets $node->uid
The issue is also present in 7.x so I have added an issue for that (with a suggested patch): #1028000: Clarify the behavior of node_submit()
Comment #3
oddbit CreditAttribution: oddbit commentedNew try with v6.20
Comment #4
oddbit CreditAttribution: oddbit commentedComment #6
oddbit CreditAttribution: oddbit commentedComment #7
pfrenssenPatch looks good, but the problem still exists in 8.x and should be fixed there first. This is the same patch rerolled against 8.x-dev.
Comment #9
marcingy CreditAttribution: marcingy commented$user is used in d8 so it needs to move back to d7.
Comment #10
bleen CreditAttribution: bleen commentedthis is a patch against D7
Comment #11
bleen CreditAttribution: bleen commentednow that I think of it ... tagging
Comment #12
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedAs the summary says: Not even f8526cb5 that added node_submit() initially used $user. It's not used, so whatever happens - it's safe to remove it.
I also re-verified that D8 doesn't have the same issue.
Comment #13
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedAdding coding standards tag.
Comment #14
jhodgdonIgnoring patches in comments #1-8 above, because they seem to be doing something other than the simple patch in #10 (which matches the issue that was actually submitted) and they also seem to be taken care of on other issues... the patch in #10 is a no-brainer cruft removal, and I committed it to Drupal 7.
It appears that $user is not used in 6.x either, so moving to their for backport consideration.
Comment #15
pfrenssenRolled patch for D6.
Comment #16
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedThank you, pfrenssen.
(Obviously http://api.drupal.org/api/drupal/modules%21node%21node.module/function/n... indeed doesn't use that variable.)
Comment #17
star-szrNothing more for a novice to do here…
Comment #19
star-szrComment #20
star-szrnode.module component went away.