Following error appears when I'm going to registration page:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in includes\form.inc on line 366.

Probably buggy line in autoassignrole_form_alter():

$node_form = drupal_retrieve_form($type .'_node_form', $form_state, $node);

When I comment it, it's working.

And sometimes there are others error:

warning: Invalid argument supplied for foreach() in autoassignrole\autoassignrole.module on line 417.

Temporary solution is to check if item $node_form['#field_info'] exist before foreach():

	    if (is_array($node_form['#field_info'])) { // check if this key exist and it's array
            foreach($node_form['#field_info'] as $field_name => $info) {
              unset($form[$field_name]);
            }
	    }

Comments

cyberswat’s picture

Assigned: Unassigned » cyberswat
cyberswat’s picture

Status: Active » Postponed (maintainer needs more info)

I need specific steps to reproduce this problem. I also need to know if you are using the content_profile module and registering content types to work with specific paths or if you are simply going to user/register.

kenorb’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I've made a lot of patches of autoassignrole, content_profile, content_profile_registration modules, some changes with permissions, so now I can't reproduce it.
Basically it's a problem related to Drupal 6.x and not included node.pages.inc file properly.
Closing, because I can't reproduce it anymore.

andreiashu’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active

With a fresh D6.6 install + CCK 6.x-2.1 + the dev versions of Autoassignrole (6.x-1.x-dev 2008-Nov-03) and content_profile (6.x-1.x-dev 2008-Nov-18) I can reproduce this bug.
1. create 2 more roles: role1 and role2
2. go to admin/user/autoassignrole -> Assign from Path and add 2 different paths for each role - ie "register/role1" and "register/role2" (also check "Pages with no navigation" option and of course enable them)
3. go to admin/content/node-type/profile and check "Use this content type etc..." and check one of the two roles that you created - ie. "(role1) register/role1"
4. add 1 more field to the content type
5. go to "register/role1" - everything should display oki
6. go to "register/role2" - BANG you get this => " * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in /var/www/test/includes/form.inc on line 366.
* warning: Invalid argument supplied for foreach() in /var/www/test/sites/all/modules/autoassignrole/autoassignrole.module on line 407."
and also you should see your field added at #4 even if it shouldn't be displayed.

andreiashu’s picture

Status: Active » Postponed (maintainer needs more info)

I think i got it.
In content_profile_registration.module at line line 14 you have "require_once drupal_get_path('module', 'node') .'/node.pages.inc';" so kenorb was right.
I just included this line in autoassignrole.module under line 397 ("if($path != '/user/register') {") and the warnings disappeared. But the custom field added at point #4 was still appearing in both paths. Updating the weight of the autoassignrole module to something bigger that cck's weight resolves this issue.

I'm sorry i couldn't provide a patch but i'm not using CVS :( .

azuledu’s picture

I think that, in the line 404, the function "drupal_retrieve_form" should have 2 arguments and, in the code, it has 3.

azuledu’s picture

"Updating the weight of the autoassignrole module to something bigger that cck's weight resolves this issue."

Where do you update the weight?

Thanks.

andreiashu’s picture

@azuledu: well i think autoassignrole should do this during installation. But if you already installed it you can just go to your {system} table and update it manually from there. And about #6: have a look at the api for "drupal_retrieve_form".

andreiashu’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.14 KB

Oki i rolled out a patch. I'm using git so i don't know if it is useful. Please tell me what you think about the patch. For me it worked oki.

azuledu’s picture

Thanks for the patch and the explanation.

The patch fails when the profile fields are inside a group of fields. It fails because the line "unset($form[$field_name]);" only remove fields, not groups of fields.
I haven't found an easy way to solve it.

azuledu’s picture

Only selected profiles appear in registration page. That's OK. But one profile of each type is created when a new user is registered. I think that only the profiles that appear in registration page should be created.

andreiashu’s picture

@azuledu: about #10, I've submitted a patch this morning. Have a look at: #337199: In registration form autoassignrole
About #11, i'll look into that soon.

andreiashu’s picture

@azuledu: I'ew opened a new issue about #11. I've got a patch for it too. Maybe you can look at it and see if it works. Its #337423: Auto profile creation during registration

nadavoid’s picture

the patch in #9 worked great for me. Thanks andreiashu!

kenorb’s picture

Status: Needs review » Needs work

#9
You can't hardcore the module path:

+            //see content_profile_registration module
+            if(!function_exists('node_form')) {
+              include_once('./modules/node/node.pages.inc');
+            }

Try to replace with:
include_once(drupal_get_path('module', 'node') . './node.pages.inc');

UPDATE:
Or:
module_load_include('inc', 'node', 'node.pages');

kenorb’s picture

StatusFileSize
new554 bytes

I can confirm that patch #9 with modification in #15 is working.
Final patch in attachment.
For install file.

kenorb’s picture

Status: Needs work » Needs review
StatusFileSize
new722 bytes

And for module file.

cyberswat’s picture

Status: Needs review » Fixed

I believe this is resolved in the current dev version so tentatively marking fixed. Reopen if it is still an issue.

Status: Fixed » Closed (fixed)

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

devenderdagar’s picture

Hi

I am using latest dev versions of both the modules AAR and content profile. I did all the necessary steps and role is assigned as per the path but problem I am facing that all the fields are displayed for all the role paths. You can see here

http://wecan.fat-net.org/user/register/role/4
and
http://wecan.fat-net.org/user/register/role/5

Roles are assigned as per the role path but I dont want both the fieldsets here. either Alliance information is required (for Role 4) or Change Makers are required (Role 5) on the basis of path.

I did all the necessary steps and I am not able to solve this problem.

thanks in advance

kenorb’s picture

#20 devenderdagar
It's nothing related to this issue.
Please follow these:
#313341: setting up various content types for different roles
#362603: different profile for different roles
#319043: Page is redirected to existing user profile on creating profile for another user
#477910: fix / simplify content profile integration

Basically you have to play with permissions, one role shouldn't have permission to create profile of other role, so it will not appear both at the same time.
If this will not help, look for some patches there and follow this discussion:
#301464: Roles & Profiles - integration of the necessary modules?