开发者

Registration during content creation in Drupal?

开发者 https://www.devze.com 2023-01-01 17:01 出处:网络
Is there an easy way to allow a user to register as he creates content type. E.g. Let\'s say there is a content type called \"listing\". When the user clicks to on a link to create it, and he\'s not l

Is there an easy way to allow a user to register as he creates content type. E.g. Let's say there is a content type called "listing". When the user clicks to on a link to create it, and he's not logged in, I want a "register" box to appear ABOVE THE CONTE开发者_StackOverflow中文版NT CREATION area, where the user can enter his normal registration details. Is this possible?


While you could, technically, put something like that together on your own, http://drupal.org/project/inline_registration is a reasonable match. It only has a dev snapshot release, but I've used it on some very small test sites and it didn't destroy anything.


You should be able to do this with hook_form_alter. So you can run a check if the node is being created (no nid set yet) and the user is no logged in, and then just add a fieldset with the info needed to create an account. You need to add a validation and submit handler as well to check the data and create the actual user.

All you need to do then, is to pair the node to the new user, but that should be possible in the submit handler where you create the user.

0

精彩评论

暂无评论...
验证码 换一张
取 消