Howto reproduce:
1) create an instance of who's online block. $mb_enabled (even after the last 'mb_enbabled' patch) will be 1 (although it shouldn't).
2) Configure this new multiblock, you're able to alter the user activity.
3) Go to original who's online and you'll see the settings you just saved are here too. Alter the settings and you'll see these settings also appear on the other instance.

Patch attached only fixes one bug for now. We should also check line 230

  $mb_enabled = (int) module_invoke($orig_block->module, 'block', 'mb_enabled') == 'mb_enabled';

I'll try and look into that later, because I tried to add an extra operation in my user module, but so far no luck.

This probably also applies to the D5 version, but didn't test that yet.

CommentFileSizeAuthor
mb_enabled.patch520 bytesswentel

Comments

andrewlevine’s picture

swentel, thanks for the bug report.

Could you try changing the line you referenced (230) to:

  $mb_enabled = (int) (module_invoke($orig_block->module, 'block', 'mb_enabled') == 'mb_enabled');

Let me know if that fixes anything. I haven't had time to apply your patch and take a look and it's a bit hard to understand what it's doing from the patch file alone.

swentel’s picture

Andrew, that did it *after* another small, but important fix:

  // Check whether this module is multiblock enabled.
  $mb_enabled = (int) module_invoke($orig_block->module, 'block', 'mb_enabled') == 'mb_enabled';
  // Create block instance information.
  $orig_block = (object) $orig_block;
  $instance = (object) array('title' => $form_state['values']['title'], 'mb_enabled' => $mb_enabled);

$orig_block->module is always empty, if we do the (object) casting before the module_invoke, $orig_block->module won't be empty.

  // Create block instance information.
  $orig_block = (object) $orig_block;
  // Check whether this module is multiblock enabled.
  $mb_enabled = (int) (module_invoke($orig_block->module, 'block', 'mb_enabled') == 'mb_enabled');
  $instance = (object) array('title' => $form_state['values']['title'], 'mb_enabled' => $mb_enabled);

So, this is now ok to check whether a block is multiblock enabled or not, but still have the problem that I can't set individual settings per block, unless I'm missing something. For now, you can ignore the patch I added, I'll investigate the settings later.

andrewlevine’s picture

Status: Active » Needs review

swentel, thanks for doing all the work of testing and debugging, I am going to test and commit just as soon as I can. I apologize for not looking at this sooner...

andrewlevine’s picture

Status: Needs review » Fixed

this should be fixed now. thanks swentel!

Status: Fixed » Closed (fixed)

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