On a content profile admin page I get this error:
warning: Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/iwd/includes/form.inc on line 1211.

This is because the line '#default_value' => content_profile_get_settings($type, 'autoassignrole_use') line 448 autoassignrole.module doesn't have a value as autoassignrole_use is not set on the content_profile_.$type variable yet. On saving the form the value is not updated either.

On the registration page for an autoassignrole path content_profile_get_settings($type, 'autoassignrole_use') on line 461 of the same file also causes this error:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /Applications/MAMP/htdocs/iwd/sites/all/modules/contrib/autoassignrole/autoassignrole.module on line 461.

The patch below fixes both these errors and allows the content_profile admin page to be updated correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

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

cyberswat’s picture

@jethro tyvm for the patch! I think this particular issue is resolved in the 6.x-2.0-beta1 branch though ... we went around with this for a while trying to resolve it #761748: warning: Invalid argument supplied for foreach() and #699888: Auto Assign Role paths is broken

Could you try the 2.0 beta and see if it fixes your problem? If I can get a few more people to confirm 2.0 is working for them I'll make it into an official release. I'm marking this one as postponed until you confirm that this has or has not been fixed already.

Thanks

cyberswat’s picture

Status: Needs work » Postponed (maintainer needs more info)

forgot to switch the status

jethro’s picture

Yes, this appears to be working in the 2.0 branch. The only change I would make is on line 480 when autoassignrole_use is initialized: $autoassignrole['autoassignrole_use'] = array_keys(user_roles((TRUE)));

It would be better if this were set to an empty array:
$autoassignrole['autoassignrole_use'] = array();

As is, all roles are selected for aar on the content profile settings pages initially for aar paths even if the user doesn't visit the content profile settings page. The content profile is automatically used on the aar path page which would be confusing and unexpected. Better just to start with them unchecked.

I'd roll a patch but I don't know why my last one was rejected as I'm new to the simple test thing. I created it with git.

liquidcms’s picture

i agree that the module does not work correctly as discussed here - all content profile nodes are added to every registration form regardless of role.

The 2.0 branch with the change in #4 seems to make this part work..

although i am still having issue that ALL roles get assigned to my new account #769046: auto assign role is assigning too many roles on registration - but maybe unrelated

kmstf’s picture

Status: Postponed (maintainer needs more info) » Needs review

Status: Needs review » Needs work

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

Dave Kopecek’s picture

Tried applying patch against autoassignrole 6.x-2.0-beta1 It fails for me.

Dave Kopecek’s picture

Ok, it fails against beta because as it pretty clearly says at the top of the thread, we're talking about 6.x-1.2 here.

I was able to apply the patch against 6.x-1.2 and it fixed the foreach() error. Note that this patch will conflict with changes made to the October 10 autoassignrole 6.x-2.0-beta1 version at line 462. The beta version looks like it has also fixed the foreach() error, but it has introduced a new error: http://drupal.org/node/986792

cubeinspire’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

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

demonrage’s picture

this patch worked for me perfectly. thx

upupax’s picture

Autoassignrole 6.x-1.2.
Patch seems working for me.

newnewuser’s picture

works for me on 6x-1.2 too

millenniumtree’s picture

Status: Needs work » Needs review

Looks good