When editing a node directly, the value for the 'sticky' flag is set to 0 before the weight module takes over, which allows the following code to set it to -100 (line 240):

function _weight_encode(&$node) {
  if ($node->sticky) {
    $node->sticky = 100 - $node->node_weight;
  }
  // Unweighted non-sticky nodes will have a value of -100.
  else {
    $node->sticky = -($node->node_weight + 100);
  }
}

However, when the Rules module is used in conjunction with Workflow to publish the content when the workflow state changes, then the sticky colum is set to '100' instead of '-100' because the if ($node->sticky) { line returns true. My guess is that this is because the node is being programmatically loaded, so $node->sticky value of -100 doesn't get replaced with 0.

It seems like the maintainers might have a better solution for this (and it might exist in dev), but I edited the following like to check for a value of -100 as well:

if ($node->sticky && $node->sticky != -100) {

Cheers!
Chris

Comments

davisben’s picture

Status: Active » Closed (duplicate)

Looks like this is the same issue as #898052: Weight and the Workflow Module.