Fix nodeorder to affect only if the order has been set.

#5928 

This PR adds order the nodes by the weight only if the "nodeorder" module is on and the order is previously set.