After upgrading from Drupal 6.4 to Drupal 6.6, I notice a strange behavior with the blocks module that I cannot resolve. My site has 50+ blocks. When I try to shuffle their order of display and hit "Save blocks", they automatically reorient themselves in alphabetical order.

CommentFileSizeAuthor
#19 content-alpha-sort-error.jpg75.85 KBBDS

Comments

mattbk’s picture

I am having this problem as well, whether I have Javascript enabled or not. Drupal 6.10.

Anonymous’s picture

It's probably a caching issue. Goto the admin/settings/performance and click the Clear Cache button at the bottom of the form.

mattbk’s picture

I've cleared the cache multiple times (Drupal and browser) and have gone so far as to turn off all the Drupal caching features.

I'm very confused. All the blocks are weighted the same, but they show up in a different order on the sidebar than they do in the block list.

mattbk’s picture

Okay, it seems to have fixed itself somehow. I have no idea what happened, maybe caches had to expire somewhere?

Anonymous’s picture

Status: Active » Fixed

It may be a browser related cache as well. I've recently discovered that I must wait some period of time before things appear correct after clearing the cache.

mattbk’s picture

Never mind, Drupal block rearranging is an epic fail.

Status: Fixed » Closed (fixed)

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

mattbk’s picture

Status: Closed (fixed) » Active

No, it's still a problem.

milagrow’s picture

Version: 6.6 » 6.10

Can someone tell me the solution to the problem, whenever i change the order as per my requirements and save the changes the blocks get re-ordered back to the alphabetical order.

Please help me resolve the issue.

Anonymous’s picture

Category: bug » support

Are we discussion admin/build/block? Shuffle the order and click save? If you ``configure'' the block before saving the order changes, the changes for the order will revert to the previous order.

Other than that, it works for me. Do you have a module enabled causing the issue? Is your theme at fault? Try switching back to the default garland theme.

Since the block ordering works with stock Drupal I'm moving this to a ``support request'' for now.

gpk’s picture

Do the replies at the bottom of this thread http://drupal.org/node/258856 help at all? suhosin security extension could be interfering with the submission of the form on the blocks admin screen.

BradM’s picture

Version: 6.10 » 6.16

I was having a similar situation: the block listing would save positions with respect to regions, however, the order within each region would not save. Sometimes a group of blocks would be listed alphabetically, but this wasn't the case for each region. The tip off was that I noticed the message * The changes to these blocks will not be saved until the Save blocks button is clicked would no longer appear at the bottom of the block admin whenever I shuffled around the blocks. Also, drag and drop was very buggy -- sometimes I couldn't drop the block, or would have to right-click in order to release it.

Turns out, I had a block that loaded an external .js file, which was the source of the problem. In my case I was loading a javascript widget from Shelfari (http://www.shelfari.com) which completely messed up the ability of the Drupal admin to properly save the order of the blocks. Once I disabled this block, everything in the admin worked properly.

So basically, if you have an issue with block order not saving correctly, disable any blocks that load external javascript files, and you should be OK.

a6hiji7’s picture

Title: Blocks cannot be rearranged if there are more than 128 in a given region (they get automatically arranged in alphabetical order) » Blocks gets automatically arranged in alphabetical order
Category: bug » support

There is a problem with the data-type of the "weight" column of "blocks" table. The type is "tinyint" which is too small and can create a problem if there are more than 128 blocks. The type should be changed to "int". I had the same problem as discussed in this thread and I could solve the problem by changing the "weight" column's type to "int". (EDIT - The problem should NOT come up with 128 blocks. It will only come up if there are more than 256 blocks in total.)

gpk’s picture

Title: Blocks gets automatically arranged in alphabetical order » Blocks cannot be rearranged if there are more than 128 in a given region (they get automatically arranged in alphabetical order)
Category: support » bug

It's a bug then...

a6hiji7’s picture

I think the issue is not about having "more than 128 blocks in a region" (which will be a very rare case) but about having "more than 256 blocks in total".

gpk’s picture

Title: Blocks gets automatically arranged in alphabetical order » Blocks cannot be rearranged if there are more than 256 in a given region (they get automatically arranged in alphabetical order)
Category: support » bug

2 blocks in different regions can have the same weight... so it's probably when there are more than 256 in a region that we hit the buffers, i.e. the weight goes outside the range +/- 128

gpk’s picture

Title: Blocks cannot be rearranged if there are more than 256 in a given region (they get automatically arranged in alphabetical order) » Blocks cannot be rearranged if there are more than 128 in a given region (they get automatically arranged in alphabetical order)

On second thoughts it looks like the weights are always negative or 0, which means you can't use the full 256. Whether having > 128 disabled blocks causes the problem I'm not sure.

a6hiji7’s picture

If your theme has 300 blocks in total then the weights can be from -150 to +150. Problem is that -150 will become the default weight. So any new blocks added to a region will have the weight -150. That's why rearranging these blocks will not work, unless you bring them below a block which already had a weight in the valid range (-128 to +127). I hope that makes it clear. (EDIT - "So any new blocks added to a region will have the weight -150" - by this I mean Drupal will try to assign the weight -150 to the block; but database value will still be -128).

BDS’s picture

StatusFileSize
new75.85 KB

My blocks for the Content region gets alphabetize while others doesn't; and I only have 12 blocks for that region, the other working blocks contain much more; overall, I don't know how many I have--is there a way for the system to count? Cleared / Flush Drupal's cache, tried on different browsers (IE, Chrome and Firefox)... I now can't order the content for one of my page.

Drupal 6.14

gpk’s picture

@19: might be worth having a look at the block weights for the relevant theme in the {block} table in your DB to try and spot anything odd. Might help in the understanding of this issue also...

xjm’s picture

drupalusering’s picture

confirming: changing Tinyint to int fixed this issue for me.

susanmccormick’s picture

also confirming that changing tinyint to int solved the problem for me. thank you!

terbs’s picture

Confirmed: changing tinyint to int solved the problem for me too.

mile23’s picture

Status: Active » Closed (duplicate)

Looks like a duplicate to me, since it's solved by this other issue: #612870: Weight fields should be int, not tinyint

devd’s picture

Assigned: Unassigned » devd
Priority: Normal » Major
Status: Closed (duplicate) » Fixed

This bug is reported due to blocks table field type. Suppose your theme has 300 blocks in total then the weights can be from -150 to +150. Block weight field is type of tinyint which length between -128 to 127. Drupal will try to assign the weight -150 to the block; but database value will still be -128, So we need to change weight field type form tinyint to int.

Alter your database block table look like this.
ALTER TABLE `blocks` CHANGE `weight` `weight` INT( 10 ) NOT NULL DEFAULT '0'

Anonymous’s picture

Stop changing the status fields. As already indicated this is a duplicate issue.

xjm’s picture

Assigned: Unassigned » devd
Priority: Normal » Major

Again, the patch for this issue is in #612870: Weight fields should be int, not tinyint.

xjm’s picture

Assigned: devd » Unassigned
Priority: Major » Normal

Hm crosspost :P

Status: Fixed » Closed (fixed)

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