You are here

user_relationships_ui.install in User Relationships 7

Installation functions for User Relationships UI module

File

user_relationships_ui/user_relationships_ui.install
View source
<?php

/**
 * @file
 * Installation functions for User Relationships UI module
 */
function user_relationships_ui_schema() {
  $schema['user_relationships_ui_settings'] = array(
    'fields' => array(
      'rtid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'hide' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'show_tab' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      'rtid' => array(
        'rtid',
      ),
    ),
  );
  return $schema;
}

/**
 * Enable renamed user_relationships module and update changed variables.
 */
function user_relationships_ui_update_7001() {

  // Create a faked entry in {system} to avoid re-installing the schema of the
  // user_relationships module.
  db_update('system')
    ->fields(array(
    'schema_version' => 0,
  ))
    ->condition('name', 'user_relationships')
    ->execute();
  module_enable(array(
    'user_relationships',
  ));

  // Rename variable.
  $rtids = variable_get('user_relationships_api_author_pane_rtids', array());
  if (!empty($rtids)) {
    variable_set('user_relationships_author_pane_rtids', $rtids);
  }
  variable_del('user_relationships_api_author_pane_rtids');
}

/**
 * Install {user_relationships_ui_settings} table.
 */
function user_relationships_ui_update_7002() {
  $schema['user_relationships_ui_settings'] = array(
    'fields' => array(
      'rtid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'hide' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'show_tab' => array(
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      'rtid' => array(
        'rtid',
      ),
    ),
  );
  db_create_table('user_relationships_ui_settings', $schema['user_relationships_ui_settings']);
}

/**
 * Update path and message settings for the new requests link.
 */
function user_relationships_ui_update_7003() {
  if (variable_get('user_relationships_requests_link', FALSE) == 'relationships/requests') {
    variable_set('user_relationships_requests_link', 'relationships/received');
  }
  if (variable_get('user_relationships_msg_pending', FALSE) == t('!requester has requested to be your %relationship_name.  Please view your !pending_relationship_requests to approve them.', array())) {
    variable_set('user_relationships_msg_pending', t('!requester has requested to be your %relationship_name. View your !pending_relationship_requests to approve or decline.', array()));
  }
}

Functions

Namesort descending Description
user_relationships_ui_schema @file Installation functions for User Relationships UI module
user_relationships_ui_update_7001 Enable renamed user_relationships module and update changed variables.
user_relationships_ui_update_7002 Install {user_relationships_ui_settings} table.
user_relationships_ui_update_7003 Update path and message settings for the new requests link.