Hi,

I got this error message when trying to cancel user with the admin/people page :

Notice : Undefined index: post dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans /home/www/sustainable/sites/all/modules/administerusersbyrole/administerusersbyrole.module).
Warning : array_filter() expects parameter 1 to be array, null given dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans /home/www/sustainable/sites/all/modules/administerusersbyrole/administerusersbyrole.module).
Warning : Invalid argument supplied for foreach() dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans /home/www/sustainable/sites/all/modules/administerusersbyrole/administerusersbyrole.module).

I've made a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, administerusersbyrole.patch, failed testing.

aanjaneyam’s picture

I also have the same problem. Even if one user is selected.

snowmountain’s picture

I also - same problem. Drupal 7.15.

I WAS able to cancel user accounts recently, just a few days or weeks earlier, though - I am not sure if this module was enabled then, but I think it was. So this may be due to a recent new version of this or some other module. If I pin this down, I plan to post the result back here.

snowmountain’s picture

I mentioned being able to cancel accounts - I disabled the administerusersbyrole module and still could not cancel (delete completely). So the inability to cancel accounts seems unrelated to this issue.

But I changed the index 'post' to 'input' as in the patch, and that did eliminate the error messages.

GiorgosK’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
FileSize
946 bytes

same problem with DEV version (from 16 sep)
but disabling the module lets you actually cancel accounts
(which means the errors are caused by the module)

the patch the OP actually takes a way lots of lines (I think with no reason)

here is an updated patch that fixes this issue

GiorgosK’s picture

it seems with drupal 7.17
patch is no longer needed ?!!

zorax’s picture

For me with drupal 7.17 and Administer Users by Role 7.x-1.0-beta1 the bug is still there :

Notice : Undefined index: post dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans .....sites/all/modules/administerusersbyrole/administerusersbyrole.module).
Warning : array_filter() expects parameter 1 to be array, null given dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans ...../sites/all/modules/administerusersbyrole/administerusersbyrole.module).
Warning : Invalid argument supplied for foreach() dans administerusersbyrole_form_user_multiple_cancel_confirm_alter() (ligne 141 dans ..../sites/all/modules/administerusersbyrole/administerusersbyrole.module).

I just verify that the patch is already apply by default with this version 7.x-1.0-beta1

GiorgosK’s picture

FileSize
946 bytes

Sorry I got confused
the previous patch in #5 was reversing the patch from Original post
and therefore the patch is still needed (my previous statement was not correct)

try this one on the latest dev version
its only the necessary changes from original

@Zorax
this patch is not included in any version I believe you have to apply it yourself

zorax’s picture

it works for me,
thank you !

Kourosh’s picture

Status: Needs work » Fixed

The last patch (1680156_8.patch) works for me too.

Execute that patch or edit administerusersbyrole.module file manually as following steps:

1) find administerusersbyrole.module at "../sites/all/modules/administerusersbyrole/"
2) find and replace this line: foreach (array_filter($form_state['post']['accounts']) as $uid => $value) {
with this: foreach (array_filter($form_state['post']['accounts']) as $uid => $value) {

3)& find and replace this line: unset($form_state['post']['accounts'][$uid]);
with this: unset($form_state['input']['accounts'][$uid]);
4)Save the file, and upload this file again if you edit it on your local machine.
finished!

the only change we have to make is replacing 'post' to 'input' inside the "administerusersbyrole_form_user_multiple_cancel_confirm_alter" function. it will solve the problem.

GiorgosK’s picture

Status: Fixed » Reviewed & tested by the community

this is not a support request
fixed on a bug report is for maintainer to assign after the patch has been applied

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1680156_8.patch, failed testing.

fraweg’s picture

Hello,

At #10 I think you mean:

2) find and replace this line: foreach (array_filter($form_state['input']['accounts']) as $uid => $value) {

I think you forget to change "post" to "input" Is it right or do I stupid things?

After that the patch #10 seems to work for me.

Best regards
Frank

henrikenji’s picture

FileSize
1.23 KB

Re-rolling patch against dev.

henrikenji’s picture

Status: Needs work » Needs review
GiorgosK’s picture

Status: Needs review » Reviewed & tested by the community

I will go ahead and put at RTBC
its been tried by many people before

it works with latest dev and latest 7.21 drupal

juanramonperez’s picture

#14 works with the latest dev and drupal 7.15.

Thanks.

dmegatool’s picture

++ for the #14 patch. Works for me too.

fraweg’s picture

Hello,

#14 works for me..thanks a lot!

Best regards
Frank

fraweg’s picture

Hello,

with the latest dev (2013-May-14) I get a new error when I apply the patch:

Notice: Undefined index: status in administerusersbyrole_form_user_profile_form_alter() (line 190 of /.../sites/all/modules/administerusersbyrole/administerusersbyrole.module).

Any ideas in that?

Best regards
Frank

IWasBornToWin’s picture

I assume this patch was not committed to latest dev? Just installed drupal yesterday and installed your latest dev module. Not working.

dbu’s picture

i came up with the same fix and only now found this report when wanting to report it. not sure since when "post" got renamed to "input" but i guess it would be good to merge this patch!

mlee11111’s picture

Recreating patch for #14 as a patch file for use by our Drush make script.

timmarwick’s picture

Re: comment #20:

This is a duplicate of issue: https://drupal.org/node/2059429

I wrote a simple patch for this: https://drupal.org/node/2059429#comment-7999167

__cj’s picture

#23 worked for me.

Thanks.

parasolx’s picture

Issue summary: View changes

patch #23 work for me.

rramos’s picture

Patch #23 work for me. ;-)

tjtj’s picture

Why isn't this patch incorporated into the distributed modules? It is totally frustrating to have to find and apply patches. Modules that break Drupal should not be distributed.

parasolx’s picture

Its already three reviewer tested the patch and it works well. No related issues waiting or block this patch form being commit.

I think is should be committed and in current -dev.

agileadam’s picture

#23 works like a charm. Thank you!

Tomáš Fejfar’s picture

Still nothing. I encountered this issue today and the patch seems simple enough. What's the problem that prevents it from being merged?

AdamPS’s picture

Assigned: Unassigned » AdamPS
Status: Reviewed & tested by the community » Needs review
Issue tags: +beta2

I intend to fix this as part of #2378869: Meta-issue for Beta 2 release. Please sign up as a follower of that issue and see the patch there that I would like feedback on.

It's effectively the same patch but I couldn't take your patch directly because there are so many issues to fix affecting the same lines of code.

AdamPS’s picture

Version: 7.x-1.x-dev » 7.x-2.0-beta1
Status: Needs review » Closed (fixed)

Fix now available in latest release

Tomáš Fejfar’s picture

Issue tags: -

It works for me. Thank you for resolving this so quickly.