How do I render the User Login block? I'm trying with this:

$block = module_invoke('user', 'block_view', 'login');


It returns an empty array.
The user_block_view() function has this line in it for the login delta:

if (!$user-&gt;uid &amp;&amp; !(arg(0) == 'user' &amp;&amp; !is_numeric(arg(1)))) {


If you're logged in, the function will return an empty array, which is probably what's happening in your case.

If that's not the reason (and even if it is) you can get around it by calling the form function directly:

$form = drupal_get_form('user_login_block');


There doesn't appear to be any extra access checks done in the form function so it should be rendered regardless of whether you're logged in or not.