This is actually against alpha6, not alpha3.
When using the site signup form with "Automatically create user accounts for new clients." selected, the clients that are created don't have a UID associated with them when the signup is done by an anonymous user. This is also true for the site node.
IMHO, the desired effect when an anonymous user creates a site+client+user should be that the client and site UID's both get set to the new user UID. It's a bit questionable though, since technically it is the anonymous user who's creating the site I just don't think you'd want anonymous to own the site if you're creating a user account to go along with it.
Comment | File | Size | Author |
---|---|---|---|
#8 | hosting_client_767008_3.patch | 563 bytes | hadsie |
#6 | hosting_client_767008_2.patch | 940 bytes | hadsie |
#3 | hosting_client_767008_1.patch | 816 bytes | hadsie |
#1 | hosting_client_767008.patch | 814 bytes | hadsie |
#1 | hosting_signup_767008.patch | 406 bytes | hadsie |
Comments
Comment #1
hadsie CreditAttribution: hadsie commentedPatches for the signup and client modules that seem to do the trick for me.
Comment #2
hadsie CreditAttribution: hadsie commentedI think this should be in the hosting queue not hostmaster...
Comment #3
hadsie CreditAttribution: hadsie commentedRerolled the client patch against the alpha8 release.
Comment #4
adrian CreditAttribution: adrian commentedi'm worried about an infinite loop in this
the set_title function gets called by node_save, and you are calling node_save from inside it.
what happens when you change the setting for revisions?
Comment #5
hadsie CreditAttribution: hadsie commentedI'm calling node_save from within the hook_insert, not set_title. However, I'm not totally sure of all the implications of doing it this way either. Do you think it would be better if this code manually ran the db query as set_title does? So something like...
Comment #6
hadsie CreditAttribution: hadsie commentedUpdated the patch to do basically what I said in #5. In the most recent version of aegir the signup patch is no longer needed only the patch to hosting_client.module that I've attached here.
Comment #7
adrian CreditAttribution: adrian commentedcommitted. thanks.
[master 7cfda05] New users are associated properly with their respective clients on signup. thanks hadsie #767008
1 files changed, 4 insertions(+), 1 deletions(-)
Comment #8
hadsie CreditAttribution: hadsie commentedI've been looking into this some more, and it seems I really don't understand how PHP's pass by reference works. The problem with my patch was that I only updated the client node, which works, however, the correct UID is still not assigned to the client node object since I forgot to add $node->uid = $client->uid in the patch. Without having the client node uid set properly on the object, the ownership of the site node will not be correctly set in hosting_signup_form_submit().
function hosting_client_insert($node)
does not appear to be passing $node by reference, but in fact it is. This can be seen by the fact that hosting_client_set_title($node) is actually able to alter the $node object (perhaps objects are passed by reference by default in php?).Anyway, the patch attached here adds a one line fix to the function to also set the uid on the $node object as opposed to just the db. This way the signup form will properly set the UID on the site node as well.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedThoroughly lucid explanation (which helps idiots like me) - I tested this and it fixes exactly what it says it does.
P.S, while trying to understand, I did some research and yes, in PHP5 objects are passed as references by default.
The patch isn't clean (not from the top of the repo tree) but this has been sitting around being ignored and it's a fix that works, so I'm committing it.
Thanks very much!
Comment #10
hadsie CreditAttribution: hadsie commentedThanks @mig5! :)