Cannot add new user with node profile content type shown on user registration form
brenk28 - January 8, 2008 - 22:23
| Project: | Node Profile |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
Steps:
1. Created a new content type called 'employee'.
2. Checked "Use this content type as a nodeprofile for users".
3. On the Node Profile tab for this content type checked "Show this node profile during user registration".
4. Went to /admin/user/user and clicked Add User tab.
5. Filled out information, click submit, but receive message: The username %username% does not exist.
(If I go back to the content type and uncheck "Show this node profile during user registration" I am able to add a new user without problems.)

#1
Same problem here.
Hans
#2
Yep, Same problem here.
#3
Confirmed, I have the same issue.
Digging a little further, I see that nodeprofile uses hook_nodeapi and subform_element_submit to manage this, which may be causing a timing issue. My site was able to accomplish a similar (if admittedly less complicated) task using usernode, which appears to employ drupal_execute instead. I may tinker with the code and see if I can get this approach working for nodeprofile as well.
#4
OK, I found something that seems to fix the issue. In the code for nodeprofile_get_register_form, on line 526 I changed the declaration for '#data_separation' to true, and now it works.
Anyone have any thoughts on other problems this might create?
#5
subscribing
..... as I have this issue as well
#6
Ok no patch as such... so no 'patch to review'.
That said,
I have made the change as outlined in #4, and it seems to work.
I haven't spotted any drawbacks at the moment, and will report if I find any.
I don't really understand formapi enough to know what 'data_separation' even means..
Regards
Alan
#7
I believe that 'data_separation' in this case means that in the subform (the nodeprofile) it will prepend the fields to ensure there are no collisions (fields in the nodeprofile that end up with the same name as fields in the parent's form). It's actually part of subform_element, which is why it's more obscure.
In this case it allows the nodeprofile name field to stay blank, which allows the node to pass node_validate. My concern was that in its original code nodeprofile specifically set data_separation to false, so it seemed to me that changing it would be more likely to cause problems. Like you, though, so far I haven't seen any.
#8
You can change the value of #data-separation if it works for you. Previously nodeprofile shipped with data_separation == TRUE, but issues with imagefield appeared, so I changed it to FALSE. This lets even imagefield work with nodeprofile, however now there might be a name collision. E.g. if you call a CCK field "name" or "mail" this might conflict with the already existing textfields "name" and "mail" - resulting in validation errors or wrong values.
Probably I should mention that in the README.
#9
There had to be a catch!
While the suggestion solution outlined in #4,
and used by as in #6,
Solves the original problem.
Sod's law prevailed eventually, and it broke another feature.
In my nodetype for nodeprofile, there is a filefield.
With this fix outlined above [ '#data_separation' to true]
the upload function breaks, with a mqsql error.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM content_ WHERE vid = 0 LIMIT 0, 1' at line 1 query: SELECT FROM content_ WHERE vid = 0 LIMIT 0, 1 in C:\workspace\drupal56\includes\database.mysql.inc on line 172.I have documented this bug here
http://drupal.org/node/208864#comment-766552
But it seems more related to this here.
When data_separation set to true, I get that sql error.
When data_separation set to false, No sql error, and the user can register properly.
But the original problem still applies now.
The inability to add a user at the user admin screen...
What to do?
Regards
Alan
#10
Hello,
I did the change but it is causing an issue with the custom registration form.
Do not do the change "The inability to add a user at the user admin screen..."
I am going to try to set the form variable at the user admin screen: [#data_separation] => 1
Maybe this will work.
chris
#11
Same Issue here. Subscribing as well.
#12
Subscribing.
#13
tracking
#14
subscribed
#15
The change fixed the bug for me with the attached patch, so I can now add users. I haven't tested alanburke's filefield issue but am not having an issue with imagefield.
#16
(Try 2 for patch attachment. Not sure if d.o. is having an attachment issue lately.)
#17
I can confirm that Lynn's patch above works to fix node profile creation on the user registration form and at user/user/create.
#18
I just gave this a test and noticed, that there *IS* a name collision in any case - as the author's "user" input field of a node profile conflicts with the "user" name input field of the form.
So I committed a fix, which:
* sets data separation to FALSE on the register page, so imagefield keeps working there
* sets data separation to TRUE for the admin page, so one can add new users, but imagefield's probably won't work there.
Please test the next development snapshot and report back the results.
#19
Subscribing. I'm getting the same behavior, but don't have the leeway to thoroughly test the patch out yet - so just watching the thread.
#20
The same problem you have with imagefield and possibly filefield also applies to date field. So now with the latest dev with data separation FALSE the date field works for the registration page but on the admin page gives massive errors.
#21
hm, thinking again over this, the last fix wasn't 100% ideal. If fields like the imagefield are used and required, then adding users won't work again.
So, I've just removed the nodeprofile form from the user admin adding page - to add a profile for your new users, just manually add the profile node.
#22
@fago: so you've removed this functionality/behaviour from "Add a user" to fix this bug?
Sounds like a change to the kind of behaviour users already expect from this module to resolve a small bug which doesnt feel right.
Gotta be a way we can keep this?
Also - have you comitted the change you just mentioned to the current dev branch/release ?
#23
Subscribing.
#24
I had the same problem as the first poster, brenk28. It was caused by a permissions issue. If I enabled (in this case) "create employee content" and "edit own employee content" for all roles except anonymous the error went away.
#25
+1 for returning integrated node profile to admin's Add a User form.
#26
I'm gonna have to say I prefer it how it is now, ie leaving the node profile fields off the user add form.
There should be a way for admins to add users without having to fill out their node profiles. Hijacking the admin/user/user/create form was never ideal IMHO.
Anyway, I'm sure Fago will come up with something good, as usual...
#27
>There should be a way for admins to add users without having to fill out their node profiles.
agreed!
Thinking about this, I don't think it's a good idea to urge admins to fill out profiles for users. Furthermore there are problems with it (read the issue..), so it will stay like it is now - no form for admins.
#28
Automatically closed -- issue fixed for two weeks with no activity.