开发者

Drupal Register user upon node create

How can I add user register form to node create form in Drupal? There is a module http://drupal.org/project/inli开发者_Go百科ne_registration , but it has some bugs. I think I saw alternative one, but I cant find it now.


Beware the many security problems possible when giving essentially anonymous users access to node creation. That said, here are some thoughts.

If you can live without having the form registration on the same page, a much easier solution would be to redirect the user to the node create form after successful login. This amounts to perhaps just one line of code (more if you only want to redirect on certain conditions - e.g. the user registers for a certain type of account). That way you can use the built-in validation and submit handlers of the user module.

If you must have both on the same page, you could use hook_form_FORM_ID_alter, and output the user registration form fields if $form['#node']->nid isn't set. Be sure to validate the input as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜