Building a form and printing in a block I would like to build a form, and print it in a block via hook_block().

How can I do this?
That is what done from user_block(), which contains the following code.

  case 0:
    // For usability's sake, avoid showing two login forms on one page.
    if (!$user-&gt;uid &amp;&amp; !(arg(0) == 'user' &amp;&amp; !is_numeric(arg(1)))) {

      $block['subject'] = t('User login');
      $block['content'] = drupal_get_form('user_login_block');
    }
    return $block;