How to add a checkbox form to a panel? I have set up user comment email notification on my Drupal 7 site. When a comment is posted the author is notified by email. I did it using rules module as described here.

Now the user has the option to get notified or not. For this, I added a new boolean field checkbox on the user's account form page. So currently the user must go to his user account page to change this setting. I would like to make this setting available in a panel.

How can I add a checkbox to a panel in order to control that "notify me setting"? (The panel currently displays content type fields, comment forms etc).
One way is to define your own form and add it to a block in the panel.

After that, you save the value to the user account in the form submit handler.

Background:

Form generation summary

Relevant hooks:


hook_block_info ( define form in a block )
hook_block_view ( return $block['content'] = drupal_get_form('my_module_user_notify_form'); )


and some custom functions you'll need.


my_module_user_notify_form ( return form array )
my_module_user_notify_form_submit ( save to user )


If you use something like Profile2, you could also just embed the relevant user profile form in the block. It would then handle the form build and processing for you.