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
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().

AttachmentSize
weight-5.x-1.x.patch657 bytes

#1

quicksketch - January 28, 2007 - 03:29

Thanks, works for me!

#2

elv - January 30, 2007 - 20:03

Great, works for me too. Just in time for a site I'm working on! Thanks.

#3

stella - March 14, 2007 - 12:28

This works for me too. Is there anyone actively working on this project?

#4

Mojah - March 15, 2007 - 23:43

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

pearcec - March 21, 2007 - 19:09

Patch works. Crucial. I updated the database for previous nodes to -100.

#6

yhager - May 10, 2007 - 05:20
Status:active» needs review

#7

irstudio - May 17, 2007 - 01:26

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

andyschm - May 18, 2007 - 01:39
Priority:normal» critical

This patch for a critical bug has been in queue for 4 months. Does this module have an active maintainer?

#9

Harry Slaughter - May 24, 2007 - 00:52

sounds like you didn't do the initial conversion of sticky field to weight conversion in admin/settings/weight/setup

#10

Harry Slaughter - May 24, 2007 - 03:45
Status:needs review» closed

fixed in weight 5.x-1.0

http://drupal.org/node/146436

#11

rmpel - December 14, 2007 - 15:47

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.

 
 

Drupal is a registered trademark of Dries Buytaert.