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]);
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | autoassignrole.install.patch | 554 bytes | kenorb |
| #17 | autoassignrole.module.patch | 722 bytes | kenorb |
| #9 | 0001-Fix-autoassign-module-n-First-argument-is-expected.patch | 2.14 KB | andreiashu |
Comments
Comment #1
cyberswat commentedComment #2
cyberswat commentedI 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.
Comment #3
kenorb commentedI'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.
Comment #4
andreiashu commentedWith 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.
Comment #5
andreiashu commentedI 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 :( .
Comment #6
azuledu commentedI think that, in the line 404, the function "drupal_retrieve_form" should have 2 arguments and, in the code, it has 3.
Comment #7
azuledu commented"Updating the weight of the autoassignrole module to something bigger that cck's weight resolves this issue."
Where do you update the weight?
Thanks.
Comment #8
andreiashu commented@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".
Comment #9
andreiashu commentedOki 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.
Comment #10
azuledu commentedThanks 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.
Comment #11
azuledu commentedOnly 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.
Comment #12
andreiashu commented@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.
Comment #13
andreiashu commented@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
Comment #14
nadavoid commentedthe patch in #9 worked great for me. Thanks andreiashu!
Comment #15
kenorb commented#9
You can't hardcore the module path:
Try to replace with:
include_once(drupal_get_path('module', 'node') . './node.pages.inc');
UPDATE:
Or:
module_load_include('inc', 'node', 'node.pages');
Comment #16
kenorb commentedI can confirm that patch #9 with modification in #15 is working.
Final patch in attachment.
For install file.
Comment #17
kenorb commentedAnd for module file.
Comment #18
cyberswat commentedI believe this is resolved in the current dev version so tentatively marking fixed. Reopen if it is still an issue.
Comment #20
devenderdagar commentedHi
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
Comment #21
kenorb commented#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?