Node weight is reset to (-20) on every node edit
yhager - January 3, 2007 - 11:10
| Project: | Weight |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
When entering a node that had a weight of 0, it becomes -20 when entering node edit mode.
The attached patch works for me, however, I am not sure about the other call to _real_sticky2weight().
| Attachment | Size |
|---|---|
| weight-5.x-1.x.patch | 657 bytes |

#1
Thanks, works for me!
#2
Great, works for me too. Just in time for a site I'm working on! Thanks.
#3
This works for me too. Is there anyone actively working on this project?
#4
All nodes created prior to installing node_weight will be set to -20 when edited. So this patch works for new nodes. Just remember to set old nodes to 0 or required weight when editing them.
#5
Patch works. Crucial. I updated the database for previous nodes to -100.
#6
#7
hmm i had to use
$node->node_weight = _real_sticky2weight($node->sticky) - 200;also, any word on getting node weights added to core in a non hacky way?
#8
This patch for a critical bug has been in queue for 4 months. Does this module have an active maintainer?
#9
sounds like you didn't do the initial conversion of sticky field to weight conversion in admin/settings/weight/setup
#10
fixed in weight 5.x-1.0
http://drupal.org/node/146436
#11
I had exactly the same problem as the people reporting it above
The solution is the conversion indeed.
Perhaps, for the dummies we are :P, this conversion should be done by an install function?
i have been thinking about this; you can safely convert every sticky 0 or 1 to -100 and 100 respectively providing the weight of nodes do not exceed 98
a non-sticky node with weight 100 would have weight 0
a sticky node with weight -99 would have weight 1
(that is, if I understood the function of the module correctly)
so if we never have stickies > 98 or < -98 the conversion of nodes can be done whenever one wants.
Ah well, just my thoughts on this issue.
Remon.
edit --
It looks I reinvented the wheel; i posted a bugreport 'some small bugs' implementing the same fixes as yhager's patch.
The latest development snapshot (which i downloaded today) did not have these fixes incorporated, so I uploaded the patch.
Also, the package liked to above does NOT fix all the bugs; the _real_sticky2weight function still needs if ($sticky) replaced by if ($sticky > 0) to be bugfree.