Download & Extend

weight value gets reset if node updated by user without "assign node weight" permissions

Project:Weight
Version:6.x-1.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:spiderman
Status:closed (fixed)

Issue Summary

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.

Comments

#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.

AttachmentSize
weight.475824.patch 963 bytes

#2

Status:needs review» fixed

Thanks for the patch.

Committed to 6.x-1.x-dev.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here