Programmatically Save a Block Configuration
It looks like the Block API still leaves something to be desired: The only way to “properly” save the various region, title, and visibility settings of a block is using a form submission. This is a bit of a work-in-progress as far as documentation, but the function works as a simple wrapper of the form submit.
/** * Save a block configuration. * * @param array $block * - module: Required * - delta: Required * - visibility * - pages * - custom * - title * - roles * - regions * - pages * - status * * @return NULL */ function extra_api_block_save($block) { module_load_include('admin.inc', 'block'); $form_state['values'] = $block; drupal_form_submit('block_admin_configure', $form_state, $block['module'], $block['delta']); }