weight value gets reset if node updated by user without "assign node weight" permissions
spiderman - May 28, 2009 - 21:10
| Project: | Weight |
| Version: | 6.x-1.0-beta3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | spiderman |
| Status: | closed |
Description
Found a bug in this module today which happens if a user without "assign node weight" permissions updates a node which had previously had a non-zero weight assigned.
Upon saving the node, the node's weight value gets reset to 0, since the node_form doesn't store the original value anywhere, and the logic of the hook_nodeapi implementation then resets it.

#1
Attached is a simple patch which fixes this by adding an else clause to the second block of the hook_form_alter implementation, which deals with the node_form. This clause happens if users don't have permissions to update the node's weight value, and simply adds a 'value' field to the node_form which stores the original value of the node weight field, so that it will get stored properly when saving.
#2
Thanks for the patch.
Committed to 6.x-1.x-dev.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.