Expose a view's filters both in a block, and in the actual view
The accepted answer did not work with Drupal 7 for me. 
I followed http://www.drup-all.com/blog/exposed-filters-form-your-custom-block-drupal-7 with success. Code below:

/** implements hook_block_info() **/
function test_block_info(){
  $blocks = array();
  $blocks['custom_exposed_filter_form'] = array(
    'info' =&gt; t('Exposed filter form'),
    'cache' =&gt; DRUPAL_NO_CACHE,
  );
  return $blocks;
}

/** implements hook_block_view() **/
function test_block_view($delta = ''){
  $block = array();
  switch($delta){
    case 'custom_exposed_filter_form':
      $block['subject'] = t('Exposed filter form');
      $block['content'] = _test_get_exposed_filter_form();   
    break;
  }
  return $block;
}

/** Function to get the Exposed filter form **/
function _test_get_exposed_filter_form(){
  // Get a view from the database or from default views . "test" is the view name.
  $view = views_get_view('test');
  // Set the display as current.
  $view-&gt;set_display('page');
  // Acquire and attach all of the handlers to the view.
  $view-&gt;init_handlers();
  $exposed_form = $view-&gt;display_handler-&gt;get_plugin('exposed_form');
  return $exposed_form-&gt;render_exposed_form();
}