diff --git a/sites/all/modules/contrib/features_extra/fe_block.module b/sites/all/modules/contrib/features_extra/fe_block.module
index 91826b9..165d2ac 100644
--- a/sites/all/modules/contrib/features_extra/fe_block.module
+++ b/sites/all/modules/contrib/features_extra/fe_block.module
@@ -1,6 +1,16 @@
 <?php
 
 /**
+ * @file
+ * Provide features components for exporting core blocks and settings.
+ */
+
+/**
+ * Version number for the current fe_block export definition.
+ */
+define('FE_BLOCK_VERSION', '1.1');
+
+/**
  * Implements hook_features_api().
  */
 function fe_block_features_api() {
@@ -81,192 +91,396 @@ function fe_block_settings_features_export($data, &$export, $module_name = '') {
  * Implements hook_features_export_render().
  */
 function fe_block_settings_features_export_render($module_name = '', $data) {
-  global $custom_theme, $theme_key;
-  drupal_theme_initialize();
-  $backup = array($custom_theme, $theme_key);
 
   $component = 'fe_block_settings';
   $default_hook = 'default_' . $component;
-  $theme_default = variable_get('theme_default', 'garland');
-  $themes = list_themes();
+  $theme_default = variable_get('theme_default', 'bartik');
 
   $code = array();
   $code[] = '  $export = array();';
   $code[] = '';
 
   // Provide backwards compatibility.
-  $code[] = '  $export[\'version\'] = \'1.0\';';
+  // We can add "version" as block ids got at least a '-' within the string.
+  $code[] = '  $export[\'version\'] = \'' . FE_BLOCK_VERSION . '\';';
   $code[] = '';
 
-  // Retrieve node type visibility settings.
-  $block_node_types = array();
-  $result = db_query('SELECT module, delta, type FROM {block_node_type}');
-  foreach ($result as $record) {
-    $block_node_types[$record->module][$record->delta][$record->type] = TRUE;
-  }
-
-  // Filter all blocks, keeping only the ones that will be exported.
-  $blocks = _block_rehash();
-  usort($blocks, '_fe_block_compare');
-  foreach ($blocks as $key => $block) {
-    $block_id = _fe_block_build_id($block);
-    if (empty($block_id) || !in_array($block_id, $data)) {
-      unset($blocks[$key]);
+  // We get the default theme's block settings as master, and process theme
+  // specific parts later in the loop.
+  // The block settings are keyed by the FE block id.
+  $blocks = _fe_block_info_by_theme($theme_default);
+
+  // Active themes to cycle through.
+  $active_themes = _fe_block_active_themes();
+
+  // We try to build an export for each defined data element.
+  foreach ($data as $name) {
+    // Check if the block still exists in the block definitions.
+    if (!empty($blocks[$name])) {
+      $block = $blocks[$name];
+
+      // We start to build the export object for this block.
+      // First we retrieve data that is valid for any theme.
+      $export_block = _fe_block_get_global_vars_from_block($block);
+      // Add node type settings.
+      $export_block['node_types'] = _fe_block_get_block_node_types($block);
+      // Add role visibility settings.
+      $export_block['roles'] = _fe_block_get_block_roles($block);
+      // Add theme specific settings for every active theme.
+      $export_block['themes'] = array();
+      foreach ($active_themes as $theme) {
+        $export_block['themes'][$theme] = _fe_block_get_theme_specifics_from_block($block);
+      }
+      // Export to code.
+      $code[] = '  $export[\'' . $name . '\'] = ' . features_var_export($export_block, '  ') . ';';
+      // Add an empty line.
+      $code[] = '';
     }
   }
 
-  // Export theme independent visibility settings.
-  $code[] = '  // Theme independent visibility settings.';
+  $code[] = '  return $export;';
+  $code = implode("\n", $code);
 
-  $visibility = array();
-  foreach ($blocks as $block) {
-    $block_id = _fe_block_build_id($block);
-    $visibility[$block_id]['module'] = $block['module'];
-    // Use machine name with boxes.
-    if ($block['module'] == 'block') {
-      $visibility[$block_id]['machine_name'] = fe_block_get_machine_name($block['delta']);
-    }
-    else {
-      $visibility[$block_id]['delta'] = $block['delta'];
-    }
+  return array($default_hook => $code);
+}
 
-    // Export node type visibility.
-    $visibility[$block_id]['node_type'] = !empty($block_node_types[$block['module']][$block['delta']]) ? $block_node_types[$block['module']][$block['delta']] : array();
+/**
+ * Returns the drupal block defintion for a specific theme.
+ *
+ * Preserves the current theme key, as it will backup befor
+ *
+ * @param string $theme
+ *   machine name of the theme
+ *
+ * @return array
+ *   array of block informations
+ */
+function _fe_block_info_by_theme($theme) {
+  // Static block cash, so we do not have to rehash several times.
+  static $blocks = array();
 
-    // @todo export role visibility.
+  // Backup theme settings, so we do not change them during processing.
+  global $custom_theme, $theme_key;
+  drupal_theme_initialize();
+  $backup = array($custom_theme, $theme_key);
+
+  if (!isset($blocks[$theme])) {
+    $info = _block_rehash($theme);
+    foreach ($info as $block) {
+      $id = _fe_block_build_id($block);
+      // Blocks are only valid for export if we got a fe_block id for them.
+      if ($id) {
+        $blocks[$theme][$id] = $block;
+      }
+    }
+    // Sort blocks by keys to get a consistent order.
+    ksort($blocks[$theme]);
   }
 
-  // Sort the array and remove empty values.
-  _features_sanitize($visibility);
+  // Restore the backup.
+  list($custom_theme, $theme_key) = $backup;
+  return $blocks[$theme];
+}
 
-  $code[] = '  $export[\'visibility\'] = ' . features_var_export($visibility, '  ') . ';';
-  $code[] = '';
+/**
+ * Retrieve the global part of the block definition.
+ *
+ * @param array $block
+ *   a single block's definition
+ *
+ * @return array
+ *   a filtered block definition, on none-theme-specific settings
+ */
+function _fe_block_get_global_vars_from_block($block) {
+  $theme_spec_defaults = _fe_block_theme_specific_defaults();
+  // Filter on any keys other than the theme specific ones.
+  $return = array_diff_key($block, $theme_spec_defaults);
+  // Core's custom blocks do not hold a delta but a machine_name, so we can
+  // handle them in our own import/export code.
+  if ($return['module'] == 'block') {
+    $return['machine_name'] = _fe_block_get_machine_name($block['delta']);
+    unset($return['delta']);
+  }
+  // Removed the serial.
+  if (isset($return['bid'])) {
+    unset($return['bid']);
+  }
+  // Remove the info from hook_block_info().
+  if (isset($return['info'])) {
+    unset($return['info']);
+  }
+
+  return $return;
+}
 
-  // Export theme specific settings.
-  foreach ($themes as $_theme_key => $theme) {
-    if ($_theme_key == $theme_default || !empty($theme->status)) {
-      $code[] = '  // Exported block settings for ' . $theme->info['name'] . '.';
-      $code[] = '  $theme = array();';
-      $code[] = '';
+/**
+ * Helper function to get the global settings for a block.
+ *
+ * @param array $block
+ *   a single block's definition
+ *
+ * @return array
+ *   a filtered block definition with only theme-specific settings
+ */
+function _fe_block_get_theme_specifics_from_block($block) {
+  $defaults = _fe_block_theme_specific_defaults();
+  $return = array_intersect_key($block, $defaults);
+  // Region.
+  if ($return['region'] == BLOCK_REGION_NONE) {
+    $return['status'] = 0;
+    $return['region'] = '';
+  }
+  return $return;
+}
 
-      // Get the block list for the current theme.
-      $custom_theme = $theme_key = $_theme_key;
-      $blocks = _block_rehash();
-      usort($blocks, '_fe_block_compare');
+/**
+ * Helper to get theme specific default array.
+ *
+ * This is used to filter on the block array.
+ *
+ * @return array
+ *   array of block columns and their default values.
+ */
+function _fe_block_theme_specific_defaults() {
+  return array(
+    'theme' => '',
+    'status' => '',
+    'weight' => 0,
+    'region' => '',
+  );
+}
 
-      foreach ($blocks as $block) {
-        unset($block['bid'], $block['info']);
-        $block_id = _fe_block_build_id($block);
-        if (empty($block_id)) {
-          continue;
-        }
-        if (in_array($block_id, $data)) {
-          // Use machine name with boxes.
-          if ($block['module'] == 'block') {
-            $block['machine_name'] = fe_block_get_machine_name($block['delta']);
-            unset($block['delta']);
-          }
-          // Region.
-          if ($block['region'] == BLOCK_REGION_NONE) {
-            $block['status'] = 0;
-            $block['region'] = '';
-          }
-
-          $code[] = '  $theme[\'' . $block_id . '\'] = ' . features_var_export($block, '  ') . ';';
-          $code[] = '';
-        }
-      }
+/**
+ * Helper function to get the block roles visibility settings.
+ *
+ * @param array $block
+ *   the block defintion array
+ *
+ * @return array
+ *   associated role settings for the block
+ *   - key: role name
+ *   - value: role id
+ */
+function _fe_block_get_block_roles($block) {
+  $query = db_select('block_role', 'br')
+    ->condition('br.module', $block['module'])
+    ->condition('br.delta', $block['delta']);
+  $query->innerJoin('role', 'r', 'r.rid = br.rid');
+  $query->fields('r', array('name', 'rid'))
+    ->orderBy('r.name', 'ASC');
+  $roles = $query->execute()->fetchAllKeyed(0, 1);
+  return $roles;
+}
 
-      $code[] = '  $export[\'theme\'][\'' . $_theme_key . '\'] = $theme;';
-      $code[] = '';
-    }
-  }
+/**
+ * Get node type visibility settings for the specified block.
+ *
+ * @param array $block
+ *   block definition array
+ *
+ * @return array
+ *   array of node types associated to the block
+ */
+function _fe_block_get_block_node_types($block) {
+  $query = db_select('block_node_type', 'bnt')
+    ->condition('module', $block['module'])
+    ->condition('delta', $block['delta'])
+    ->fields('bnt', array('type'))
+    ->orderBy('bnt.type', ASC);
+  return $query->execute()->fetchCol();
+}
 
-  // Only return for enabled themes and the default theme.
-  $code[] = '  $theme_default = variable_get(\'theme_default\', \'bartik\');';
-  $code[] = '  $themes = list_themes();';
-  $code[] = '  foreach ($export[\'theme\'] as $theme_key => $settings) {';
-  $code[] = '    if ($theme_key != $theme_default && empty($themes[$theme_key]->status)) {';
-  $code[] = '      unset($export[\'theme\'][$theme_key]);';
-  $code[] = '    }';
-  $code[] = '  }';
-  $code[] = '  return $export;';
-  $code = implode("\n", $code);
+/**
+ * Helper to get active themes as keys.
+ */
+function _fe_block_active_themes() {
+  $themes = list_themes();
 
-  list($custom_theme, $theme_key) = $backup;
-  return array($default_hook => $code);
+  $theme_keys = array();
+  foreach ($themes as $key => $theme) {
+    // Add the theme keys to an array, for latter processing.
+    // Default theme will be put in front.
+    if (!empty($theme->status)) {
+      $theme_keys[] = $key;
+    }
+  }
+  sort($theme_keys);
+  return $theme_keys;
 }
 
 /**
  * Implements hook_features_revert().
  */
 function fe_block_settings_features_revert($module_name = NULL) {
-  global $custom_theme, $theme_key;
+
   $component = 'fe_block_settings';
   $defaults = features_get_default($component, $module_name);
   if (empty($defaults)) {
     return;
   }
 
-  // Provide backwards compatibility with the old export format that only
-  // supported theme specific settings.
-  if ($new_format = (isset($defaults['version']) && $defaults['version'] == '1.0')) {
-    $themes = $defaults['theme'];
-  }
-  else {
-    $themes = $defaults;
-  }
+  // Convert the settings in the newest format.
+  $defaults = _fe_block_settings_convert($defaults);
 
-  // Revert theme specific settings.
-  foreach ($themes as $_theme_key => $theme) {
-    $custom_theme = $theme_key = $_theme_key;
-    _block_rehash();
 
-    foreach ($theme as $block) {
-      // Convert machine name back to bid.
-      if ($block['module'] == 'block') {
-        $block['delta'] = fe_block_get_bid($block['machine_name'], TRUE);
-      }
+  $themes_rehashed = array();
+  $active_themes = _fe_block_active_themes();
+  // The fallback theme for theme specific settings.
+  $theme_default = variable_get('theme_default', 'bartik');
 
-      drupal_write_record('block', $block, array('module', 'delta', 'theme'));
+  foreach ($defaults as $block) {
+    if ($block['module'] == 'block') {
+      $block['delta'] = fe_block_get_bid($block['machine_name'], TRUE);
     }
-  }
 
-  // Revert node type visibility settings. These have been introduced with the
-  // new export format.
-  if ($new_format) {
-    foreach ($defaults['visibility'] as $block) {
-      // Convert machine name back to bid.
-      if ($block['module'] == 'block') {
-        $block['delta'] = fe_block_get_bid($block['machine_name']);
+    // Remove the additional settings from the block array, to process them
+    // later. We explicitely set NULL, if no setting was given in the defaults.
+    $block_themes = $block['themes'];
+    $block_roles = isset($block['roles']) ? $block['roles'] : NULL;
+    $block_node_types = isset($block['node_types']) ? $block['node_types'] : NULL;
+    unset($block['themes']);
+    unset($block['roles']);
+    unset($block['node_types']);
+
+    // Restore theme specific settings for every active theme.
+    foreach ($active_themes as $theme) {
+
+      // Rehash if we did not yet.
+      if (empty($themes_rehashed[$theme])) {
+        _block_rehash($theme);
+        $themes_rehashed[$theme] = TRUE;
       }
 
-      db_delete('block_node_type')
-        ->condition('module', $block['module'])
-        ->condition('delta', $block['delta'])
-        ->execute();
-      if (!empty($block['node_type'])) {
-        $query = db_insert('block_node_type')->fields(array('type', 'module', 'delta'));
-        foreach ($block['node_type'] as $type => $value) {
-          if ($value) {
-            $query->values(array(
-              'type' => $type,
-              'module' => $block['module'],
-              'delta' => isset($block['delta']) ? $block['delta'] : 0,
-            ));
-          }
-        }
-        $query->execute();
+      // Get the theme specific setting for the active theme.
+      if (isset($block_themes[$theme])) {
+        $key = $theme;
+      }
+      // Or fallback on the defaut theme.
+      elseif (isset($block_themes[$theme_default])) {
+        $key = $theme_default;
       }
+      // Or fallback on the first available theme spec.
+      else {
+        $key = key($block_themes);
+      }
+
+      // Write block settings.
+      $write = array_merge($block, $block_themes[$key]);
+      drupal_write_record('block', $write, array('module', 'delta', 'theme'));
+    }
+    // Ensure global settings.
+    _fe_block_settings_update_global_settings($block);
+
+    // Set node type settings
+    // (only if there were some defined, to avoid overwriting not yet exported
+    // data).
+    if (isset($block_node_types)) {
+      _fe_block_settings_update_block_node_type_settings($block, $block_node_types);
+    }
+
+    // Set roles.
+    if (isset($block_roles)) {
+      _fe_block_settings_update_block_roles($block, $block_roles);
     }
   }
-  // Clear block cache
+
+  // Clear block cache.
   cache_clear_all(NULL, 'cache_block');
 
   return TRUE;
 }
 
 /**
+ * Helper to update global block settings for a specific block.
+ *
+ * @param array $block
+ *   block definition
+ */
+function _fe_block_settings_update_global_settings($block) {
+  $globals = _fe_block_get_global_vars_from_block($block);
+  db_update('block')
+    ->fields($globals)
+    ->condition('module', $block['module'])
+    ->condition('delta', $block['delta'])
+    ->execute();
+}
+
+/**
+ * Helper to update node type settings for a given block.
+ *
+ * @param array $block
+ *   block definition
+ * @param array $node_types
+ *   array of node types
+ */
+function _fe_block_settings_update_block_node_type_settings($block, $node_types) {
+
+  // First delete the old node type settings.
+  db_delete('block_node_type')
+    ->condition('module', $block['module'])
+    ->condition('delta', $block['delta'])
+    ->execute();
+
+  if (!empty($node_types)) {
+    $insert = db_insert('block_node_type')
+      ->fields(array('module', 'delta', 'type'));
+    foreach ($node_types as $type) {
+      $insert->values(array(
+        'module' => $block['module'],
+        'delta' => $block['delta'],
+        'type' => $type,
+      ));
+    }
+    $insert->execute();
+  }
+}
+
+/**
+ * Helper to update the block role settings for a specific block.
+ *
+ * @param array $block
+ *   block definiton
+ *
+ * @param array $roles
+ *   array of roles
+ *   - key: role name
+ *   - value: (foreign) role id
+ */
+function _fe_block_settings_update_block_roles($block, $block_roles) {
+  static $roles;
+
+  // First get the current set of roles, so we can match role names to rids.
+  if (!isset($roles)) {
+    $roles = db_select('role', 'r')
+      ->fields('r', array('rid', 'name'))
+      ->execute()
+      ->fetchAllKeyed(1, 0);
+  }
+
+  // First delete the old block role settings.
+  db_delete('block_role')
+    ->condition('module', $block['module'])
+    ->condition('delta', $block['delta'])
+    ->execute();
+
+  if (!empty($block_roles)) {
+    $insert = db_insert('block_role')
+      ->fields(array('module', 'delta', 'rid'));
+    foreach ($block_roles as $name => $rid) {
+      if (isset($roles[$name])) {
+        $insert->values(array(
+          'module' => $block['module'],
+          'delta' => $block['delta'],
+          'rid' => $roles[$name],
+        ));
+      }
+    }
+    $insert->execute();
+  }
+}
+
+
+/**
  * Implements hook_features_disable_feature().
  *
  * @param $module
@@ -614,7 +828,7 @@ function fe_block_get_bid($machine_name, $reset = FALSE) {
  * Generate block ID.
  */
 function _fe_block_build_id($block) {
-  if (empty($block['module']) || (empty($block['delta']) && !is_numeric($block['delta'])) ) {
+  if (empty($block['module']) || (empty($block['delta']) && !is_numeric($block['delta']))) {
     return NULL;
   }
   if ($block['module'] == 'block') {
@@ -670,3 +884,93 @@ function _fe_block_save_box($settings = array()) {
 
   return $settings;
 }
+
+/**
+ * Helper function to convert an older export into the new format.
+ *
+ * @param array $defaults
+ *   array of fe_block_settings definition.
+ *
+ * @return array
+ *   array of current fe_block_settings definition
+ */
+function _fe_block_settings_convert($defaults) {
+
+  $version = (isset($defaults['version'])) ? $defaults['version'] : 0;
+
+  // Directly return if the version is the current one.
+  if ($version == FE_BLOCK_VERSION) {
+    unset($defaults['version']);
+    return $defaults;
+  }
+  elseif ($version == '1.0') {
+
+    // We try to get the default theme for the global definitions, else we take
+    // the first.
+    $theme_default = variable_get('theme_default', 'bartik');
+    if (!isset($defaults['theme'][$theme_default])) {
+      $theme_default = key($defaults['theme']);
+    }
+
+    $blocks = array();
+    // We get the basic blocks from the visibility array.
+    foreach ($defaults['visibility'] as $block_id => $base) {
+      $node_types = array();
+      if (isset($base['node_type'])) {
+        // Node types were specified in node_type => TRUE/FALSE. Now we simply
+        // list the selected node types.
+        $node_types = array_keys(array_filter($base));
+        unset($base['node_type']);
+      }
+
+      $block = $base;
+      $block['node_types'] = $node_types;
+
+      // Global settings.
+      $globals = _fe_block_get_global_vars_from_block($defaults['theme'][$theme_default][$block_id]);
+      $block = array_merge($globals, $block);
+
+      // Build theme specific array.
+      $block['themes'] = array();
+      foreach ($defaults['theme'] as $theme => $items) {
+        $block['themes'][$theme] = _fe_block_get_theme_specifics_from_block($items[$block_id]);
+      }
+      $blocks[$block_id] = $block;
+    }
+    return $blocks;
+  }
+  // The oldest version.
+  // There we got an array of themes that holded the block settings.
+  elseif ($version == 0) {
+
+    // We try to get the default theme for the global definitions, else we take
+    // the first.
+    $theme_default = variable_get('theme_default', 'bartik');
+    if (!isset($defaults[$theme_default])) {
+      $theme_default = key($defaults);
+    }
+
+    $blocks = array();
+    foreach ($defaults as $theme => $items) {
+      foreach ($items as $block_id => $item) {
+
+        // Avoid php notices.
+        if (!isset($blocks[$block_id])) {
+          $blocks[$block_id] = array(
+            'themes' => array(),
+          );
+        }
+
+        // Set theme specific settings.
+        $blocks[$block_id]['themes'][$theme] = _fe_block_get_theme_specifics_from_block($item);
+
+        // We add the global settings for the default theme.
+        if ($theme == $theme_default) {
+          $globals = _fe_block_get_global_vars_from_block($item);
+          $blocks[$block_id] = array_merge($blocks[$block_id], $globals);
+        }
+      }
+    }
+    return $blocks;
+  }
+}
