<?php

/**
 * Set default posts roles upon enable
 */
function commons_posts_enable() {
  $revert = array(
    'commons_posts' => array('og_features_permission'),
  );
  features_revert($revert);

  $groups = og_get_all_group();

  foreach ($groups AS $gid) {
    commons_groups_features_permission_rebuild('commons_posts', $gid);
  }
}

/**
 * Disable summary on Posts nodes.
 */
function commons_posts_update_7000() {
    $revert = array(
      'commons_posts' => array('field_instance'),
  );
  features_revert($revert);
  return array();
}

/**
 * Provide a new "User posted [title]" message type for posts.
 */
function commons_posts_update_7001() {
    $revert = array(
      'commons_posts' => array('message_type', 'field_instance'),
  );
  features_revert($revert);
  return array();
}

/**
 * Remove extra markup from message type for posts.
 */
function commons_posts_update_7002() {
    $revert = array(
      'commons_posts' => array('message_type'),
  );
  features_revert($revert);
  return array();
}

/**
 * Standardize Browsing Widget views.
 */
function commons_posts_update_7003() {
  $revert = array(
    'commons_posts' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Display sticky content at top of lists.
 */
function commons_posts_update_7004() {
  $revert = array(
    'commons_posts' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Add links to node teasers in the browsing widget.
 */
function commons_posts_update_7005() {
  $revert = array(
    'commons_posts' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Improve the browsing widget empty text.
 */
function commons_posts_update_7006() {
  $revert = array(
    'commons_posts' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Replace the title attribute with the title field in view displays.
 */
function commons_posts_update_7007() {
  $revert = array(
    'commons_posts' => array('views_view'),
  );
  features_revert($revert);
  return array();
}

/**
 * Standardize browsing widget field weights.
 */
function commons_posts_update_7008() {
  $revert = array(
    'commons_posts' => array('field_instance'),
  );
  features_revert($revert);
  return array();
}

/**
 * Accommodate changes to message definitions.
 */
function commons_posts_update_7009() {
  $revert = array(
    'commons_posts' => array('message_type'),
  );
  features_revert($revert);
  return array();
}
