tags:

views:

1452

answers:

3

Is there any command or method that I can use to insert the contents of a form (e.g. the user registration form) into a block?

+3  A: 

drupal_get_form($form_id) - put it in a module's hook_block ($op=='view') or even... shudder... inside a block with PHP filter on.

You need to find the form id first - look for a hidden input with the name form_id within the form. Its value should be the the form id.

Also, you could simply use the Form Block module.

Eli Krupitsky
Thanks. That did the trick. But why the shudder?
RD
Basically, PHP filter is a bad idea. From Drupal's handbook page on the subject: "... it is a significant and dangerous security risk in the hands of a malicious user. Even a trusted user may accidentally compromise the site by entering malformed or incorrect PHP code". You're almost always better off writing a module (just a couple of lines of overhead, really).
Eli Krupitsky
One anecdote, I had a minor syntax error in a node with the PHP filter. It broke search indexing, which broke cron. It's not worth the debugging complexity.
Grayside
I agree with Grayside. With my very first Drupal site I had php redirects in some nodes, which completely broke the search indexing module. So in that sense it is bad.
RD
+1  A: 

One other thing is that it puts some of the PHP code into the database, instead of in the filesystem where the rest is. It's easy to forget and waste a lot of time searching for the code, and grep is a lot more convenient that going through every block and seeing if the PHP is there.

Graham
A: 

please give me the simply event() to my mail

rolin

related questions