From b5eea261bbdd0219a9fe3236427c4584d6d8b185 Mon Sep 17 00:00:00 2001
From: Sascha Grossenbacher <saschagros@gmail.com>
Date: Fri, 25 Mar 2011 12:38:20 +0100
Subject: [PATCH] Issue #1103978 by Berdir: Move admin UI into user_relationships module.

---
 .../user_relationship_implications.module          |    4 +-
 user_relationships.admin.inc                       |  541 ++++++++++++++++++++
 user_relationships.install                         |   39 ++-
 user_relationships.module                          |  195 +++++++
 .../user_relationships_ui.actions.inc              |   28 +-
 .../user_relationships_ui.admin.inc                |  292 -----------
 .../user_relationships_ui.admin_actions.inc        |  170 ------
 .../user_relationships_ui.forms.inc                |   10 +-
 .../user_relationships_ui.install                  |   23 -
 user_relationships_ui/user_relationships_ui.module |  236 +---------
 .../user_relationships_ui.pages.inc                |   48 --
 11 files changed, 793 insertions(+), 793 deletions(-)
 create mode 100644 user_relationships.admin.inc
 delete mode 100644 user_relationships_ui/user_relationships_ui.admin.inc
 delete mode 100644 user_relationships_ui/user_relationships_ui.admin_actions.inc

diff --git a/user_relationship_implications/user_relationship_implications.module b/user_relationship_implications/user_relationship_implications.module
index 9319834..3398c48 100644
--- a/user_relationship_implications/user_relationship_implications.module
+++ b/user_relationship_implications/user_relationship_implications.module
@@ -186,7 +186,7 @@ function user_relationship_implications_user_relationships_delete($relationship,
     // the relationship being deleted (current_type) is implied by this relationship (only matters if "strict" is set)
     if (isset($current_type->implied_by[$rtid]) && $current_type->implied_by[$rtid]->strict || isset($reversed[$rtid]) && $reversed[$rtid]->strict) {
       user_relationships_delete_relationship($relationship, $current_type->deleted_by, $reason);
-      drupal_set_message(user_relationships_ui_get_message('removed', $relationship));
+      drupal_set_message(user_relationships_get_message('removed', $relationship));
     }
   }
 }
@@ -253,7 +253,7 @@ function user_relationship_implications_user_relationships_save($relationship, $
             user_relationships_save_relationship($existing, 'request');
             // Set the message informing the user (use requester and requestee
             // from original relationship).
-            drupal_set_message(user_relationships_ui_get_message('accepted', $existing));
+            drupal_set_message(user_relationships_get_message('accepted', $existing));
           }
         }
       }
diff --git a/user_relationships.admin.inc b/user_relationships.admin.inc
new file mode 100644
index 0000000..eea3682
--- /dev/null
+++ b/user_relationships.admin.inc
@@ -0,0 +1,541 @@
+<?php
+
+/**
+ * @file
+ * User Relationships admin settings and config forms
+ */
+
+/**
+ * Main settings
+ */
+function user_relationships_admin_settings() {
+  $form['settings'] = array(
+    '#type' => 'vertical_tabs',
+  );
+
+  $form['general'] = array(
+    '#type'   => 'fieldset',
+    '#title'  => t('General'),
+    '#weight' => -10,
+    '#group' => 'settings',
+  );
+  $form['general']['user_relationships_allow_multiple'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Allow multiple relationships'),
+    '#description'    => t('If checked, a user may create multiple relationships (each relationship of a different type) with another user.'),
+    '#default_value'  => variable_get('user_relationships_allow_multiple', 1),
+  );
+  $form['general']['user_relationships_show_direct_links'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Show a separate link per relationship type'),
+    '#description'    => t("On a user's page, show a separate link for each available relationship type (instead of the generic 'Create a relationship' link)."),
+    '#default_value'  => variable_get('user_relationships_show_direct_links', 1),
+  );
+  $form['general']['user_relationships_show_user_pictures'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t("Show user pictures on relationship pages"),
+    '#description'    => t("Show a picture next to each user's name on 'My relationships' pages."),
+    '#default_value'  => variable_get('user_relationships_show_user_pictures', 0),
+  );
+  $form['general']['user_relationships_allow_auto_approve'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Allow users to auto approve'),
+    '#description'    => t('Provide users with an option to automatically approve all requested relationships.'),
+    '#default_value'  => variable_get('user_relationships_allow_auto_approve', 0),
+  );
+  $form['general']['user_relationships_relationships_per_page'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Relationships per page'),
+    '#size'           => 4,
+    '#description'    => t('Number of relationships to show per page. If set to 0 all will be shown.'),
+    '#default_value'  => variable_get('user_relationships_relationships_per_page', 16),
+    '#validate'       => array('user_relationships_setting_validation' => array(array(
+      'is_numeric' => array('msg' => t('The relationships per page setting is not an integer'))
+    )))
+  );
+  $form['positioning'] = array(
+    '#type'   => 'fieldset',
+    '#title'  => t('AJAX Popup Positioning'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#description' => t('Some themes may require repositioning of AJAX confirmation dialogs. You may use these controls to set where the popup appears on the page or in relation to the mouse cursor.'),
+    '#group' => 'settings',
+  );
+  $form['positioning']['user_relationships_enable_ajax_popups'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show AJAX confirmation popups'),
+    '#default_value' => variable_get('user_relationships_enable_ajax_popups', 0),
+    '#description' => t('Other popup settings below will only take effect if popups are enabled.')
+  );
+  $form['positioning']['user_relationships_position'] = array(
+    '#type' => 'select',
+    '#title' => t("Elaboration form's css position"),
+    '#default_value' => variable_get('user_relationships_position', 'absolute'),
+    '#options' => array(
+      'absolute' => t('Mouse cursor'),
+      'fixed' => t('Fixed'),
+    ),
+    '#description' => t('Sets the css <em>position</em> property of AJAX confirmation popups.'),
+  );
+  $form['positioning']['user_relationships_left'] = array(
+    '#type' => 'textfield',
+    '#title' => t("Elaboration form's css left value"),
+    '#default_value' => variable_get('user_relationships_left', '0'),
+    '#size' => 4,
+    '#description' => t("Sets the css <em>left</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.5 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
+  );
+  $form['positioning']['user_relationships_top'] = array(
+    '#type' => 'textfield',
+    '#title' => t("Elaboration form's css top value"),
+    '#default_value'  => variable_get('user_relationships_top', '0'),
+    '#size' => 4,
+    '#description' => t("Sets the css <em>top</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.4 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
+  );
+
+  $form['messages'] = array(
+    '#type'         => 'fieldset',
+    '#title'        => t('Custom Screen Messages'),
+    '#weight'       => 0,
+    '#description'  => t('Customize the confirmation messages displayed to users when specific relationship events occur.'),
+    '#group' => 'settings',
+  );
+
+  $form['messages']['user_relationships_requests_link'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Path to relationship requests'),
+    '#default_value'  => variable_get('user_relationships_requests_link', 'relationships/requests'),
+    '#description' => t("Only change this setting if a user's pending relationship requests have a different location than the default path (relationships/requests)"),
+  );
+
+  $form['messages']['messages_settings'] = array(
+    '#type' => 'vertical_tabs',
+  );
+
+  $default_messages = _user_relationships_default_messages(array());
+  _user_relationships_message_settings_form($form['messages'], $default_messages);
+
+  //options for author pane integration
+  if (function_exists('author_pane_api') && author_pane_api() == '2') {
+    $rtypes = user_relationships_types_load();
+    $form['author_pane'] = array(
+      '#type'   => 'fieldset',
+      '#title'  => t('Author Pane'),
+      '#collapsible' => TRUE,
+      '#group' => 'settings',
+    );
+    $form['author_pane']['user_relationships_enable_author_pane'] = array(
+      '#type'           => 'checkbox',
+      '#title'          => t('Show links in Author Pane'),
+      '#description'    => t('Check if you wish to show add/remove relationship links in Author Pane.'),
+      '#default_value'  => variable_get('user_relationships_enable_author_pane', 0),
+    );
+    // Since AP supports only one link per module, need to pick one relationship type
+    if (count($rtypes)) {
+      $options = array();
+      foreach ($rtypes as $rtype) {
+        $options[$rtype->rtid] = $rtype->name;
+      }
+      $form['author_pane']['user_relationships_author_pane_rtids'] = array(
+        '#type' => 'select',
+        '#multiple' => TRUE,
+        '#title' => t('Relationship types to use'),
+        '#default_value' => variable_get('user_relationships_author_pane_rtids', 'absolute'),
+        '#options' => $options,
+        '#description' => t('The chosen relationship types will be used for add/remove links.'),
+      );
+    }
+  }
+  return system_settings_form($form);
+}
+
+
+/**
+ * Relationship type edit page.
+ */
+function user_relationships_admin_type_edit($form, &$form_state, $relationship_type = NULL) {
+  if (!$relationship_type) {
+    drupal_set_title(t('Add relationship type'));
+    $relationship_type = (object) array(
+      'name' => '',
+      'plural_name' => '',
+      'is_oneway' => FALSE,
+      'is_reciprocal' => FALSE,
+    );
+  }
+  else {
+    drupal_set_title(t('Edit @name relationship type', array('@name' => $relationship_type->name)));
+  }
+
+  $form['tabs'] = array(
+    '#type' => 'vertical_tabs',
+  );
+
+  $form['general'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('General'),
+    '#group' => 'tabs',
+  );
+
+  $form['general']['name'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Name'),
+    '#maxlength'      => 255,
+    '#default_value'  => isset($relationship_type) ? $relationship_type->name : NULL,
+    '#description'    => t("Example: buddy, friend, coworker, spouse."),
+    '#required'       => TRUE,
+    '#weight'         => -10,
+  );
+  $form['general']['plural_name'] = array(
+    '#type'           => 'textfield',
+    '#title'          => t('Plural name'),
+    '#maxlength'      => 255,
+    '#default_value'  => isset($relationship_type) ? $relationship_type->plural_name : NULL,
+    '#description'    => t("Example: buddies, friends, coworkers, spouses."),
+    '#required'       => TRUE,
+    '#weight'         => -9,
+  );
+  $form['general']['requires_approval'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Requires Approval'),
+    '#default_value'  => (isset($relationship_type->requires_approval) ? $relationship_type->requires_approval : 1),
+    '#description'    => t('Check this if the requestee must approve the relationship'),
+    '#weight'         => -8,
+  );
+  $form['general']['expires_val'] = array(
+    '#title'          => t('Request expires in'),
+    '#field_suffix'   => t('days'),
+    '#type'           => 'textfield',
+    '#size'           => 4,
+    '#default_value'  => isset($relationship_type->expires_val) ? $relationship_type->expires_val : 0,
+    '#description'    => t('After how many days should a request of this type be removed? (0 for never)'),
+    '#weight'         => -7,
+  );
+  $form['general']['is_oneway'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('This is a one-way relationship'),
+    '#default_value'  => isset($relationship_type) ? $relationship_type->is_oneway : NULL,
+    '#description'    => t('Check this if this relationship should only go one way (ex Manager, Subscriber)'),
+    '#weight'         => -6,
+  );
+  $form['general']['is_reciprocal'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('This one-way relationship can be reciprocated'),
+    '#default_value'  => isset($relationship_type) ? $relationship_type->is_reciprocal : NULL,
+    '#description'    => t('Check if this one-way relationship can go either way'),
+    '#weight'         => -5,
+  );
+
+  $form['roles'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Allowed Roles'),
+    '#group' => 'tabs',
+    '#weight' => 10,
+  );
+
+  $form['roles']['roles'] = array(
+    '#type' => 'checkboxes',
+    '#options' => user_roles(TRUE),
+    '#default_value' => isset($relationship_type->roles) ? $relationship_type->roles : array(),
+    '#title' => t('Role request access'),
+    '#description' => t('You may choose which roles are allowed to request this relationship. If none are selected, all roles are allowed.'),
+  );
+  $form['roles']['roles_receive'] = array(
+    '#type' => 'checkboxes',
+    '#options' => user_roles(TRUE),
+    '#default_value' => isset($relationship_type->roles_receive)  && is_array($relationship_type->roles_receive) ? $relationship_type->roles_receive : array(),
+    '#title' => t('Role receive access'),
+    '#description' => t('You may choose which roles are allowed to receive this relationship. If none are selected, all roles are allowed to receive the relationship.'),
+  );
+  $form['rtid'] = array(
+    '#type'   => 'value',
+    '#value'  => isset($relationship_type->rtid) ? (int)$relationship_type->rtid : NULL,
+  );
+  $form['action'] = array(
+    '#type'   => 'value',
+    '#value'  => (isset($relationship_type->rtid) ? 'edit' : 'add'),
+  );
+
+  $form['submit'] = array(
+    '#type'   => 'submit',
+    '#value'  => t('Submit'),
+    '#weight' => 10,
+  );
+
+  return $form;
+}
+
+
+/**
+ * Relationship type delete page.
+ */
+function user_relationships_admin_type_delete($form, &$form_state, $relationship_type = NULL) {
+  if ($relationship_type) {
+    $form['rtid'] = array(
+      '#type'   => 'value',
+      '#value'  => (int)$relationship_type->rtid,
+    );
+
+    return confirm_form(
+      $form,
+      t('Are you sure you want to delete %name?', array('%name' => ur_tt("user_relationships:rtid:$relationship_type->rtid:name", $relationship_type->name))),
+      'admin/config/people/relationships',
+      t('This action cannot be undone.'),
+      t('Delete'), t('Cancel')
+    );
+  }
+  else {
+    drupal_set_message(user_relationships_get_message('non_existent_type'));
+    drupal_goto('admin/config/people/relationships');
+  }
+}
+
+/**
+ * Validate the submitted relationship type
+ */
+function user_relationships_admin_type_edit_validate($form, &$form_state) {
+  $select = db_select('user_relationship_types', 'urt')
+    ->fields('urt', array('name'))
+    ->where("LOWER(name) = LOWER(:name)", array(':name' => $form_state['values']['name']));
+  if (isset($form_state['values']['rtid'])) {
+    $select->condition('rtid', $form_state['values']['rtid'], '<>');
+  }
+  if ($select->execute()->fetchField()) {
+    form_set_error('name', t('%name has already been used.', array('%name' => $form_state['values']['name'])));
+  }
+
+  $expire = $form_state['values']['expires_val'];
+  if (!is_numeric($expire) || (int)$expire < 0) {
+    form_set_error('expires_val', t('Expiration period must be an integer greater than or equal to 0.'));
+  }
+}
+
+/***
+ * Generic settings validation.
+ */
+function user_relationships_setting_validation($element, $validations) {
+  foreach ($validations as $validation => $info) {
+    $arguments = array($element['#value']);
+    if (isset($info['valid_options'])) {
+      $arguments[] = $info['valid_options'];
+    }
+
+    $valid = function_exists($validation) && call_user_func_array($validation, $arguments);
+    $valid = !$valid ? ($validation == 'is_positive' && is_numeric($arguments) && (int)$arguments > 0) : FALSE;
+    $valid = !$valid ? ($validation == 'is_non_negative' && is_numeric($arguments) && (int)$arguments > -1) : FALSE;
+
+    if (!$valid) {
+      form_set_error($element['#name'], $info['msg']);
+    }
+  }
+}
+
+/**
+ * Process the relationship edit page form submission.
+ */
+function user_relationships_admin_type_edit_submit($form, &$form_state) {
+  $relationship_type = (object)$form_state['values'];
+  if ($form_state['values']['action'] == 'add') {
+    //#348025 when editing a type, make sure that two-way relationships are not left as reciprocal, just in case, as the UI allows it.
+    if (!$relationship_type->is_oneway) {
+      $relationship_type->is_reciprocal = 0;
+    }
+    drupal_write_record('user_relationship_types', $relationship_type);
+
+    // Update strings for translation
+    _user_relationships_update_translations($relationship_type);
+
+    $form_state['values']['rtid'] = $relationship_type->rtid;
+    module_invoke_all('user_relationships_type_insert', $relationship_type);
+
+    drupal_set_message(t('Relationship %name has been added.', array('%name' => $relationship_type->name)));
+    watchdog(
+      'u_relationship',
+      'User Relationships form: relationship %name added.', array('%name' => $relationship_type->name),
+      WATCHDOG_NOTICE,
+      l(t('view'), 'admin/user/user_relationship/types/'. $relationship_type->rtid .'/edit')
+    );
+  }
+  else {
+    //#348025 when editing a type, make sure that two-way relationships are not left as reciprocal, just in case, as the UI allows it.
+    if (!$relationship_type->is_oneway) {
+      $relationship_type->is_reciprocal = 0;
+    }
+    drupal_write_record('user_relationship_types', $relationship_type, 'rtid');
+
+    // Update strings for translation
+    _user_relationships_update_translations($relationship_type);
+    module_invoke_all('user_relationships_type_update', $relationship_type);
+
+    drupal_set_message(t('Relationship %name has been updated.', array('%name' => $relationship_type->name)));
+    watchdog(
+      'u_relationship',
+      'User Relationships form: relationship %name updated.', array('%name' => $relationship_type->name),
+      WATCHDOG_NOTICE,
+      l(t('view'), 'admin/config/people/relationships/'. $relationship_type->rtid .'/edit')
+    );
+  }
+
+  //save role permissions for this rtype
+  db_delete('user_relationship_type_roles')
+    ->condition('rtid', $relationship_type->rtid)
+    ->execute();
+  if ($form_state['values']['roles']) {
+    $role_record = new StdClass;
+    $role_record->rtid = $relationship_type->rtid;
+    foreach ($form_state['values']['roles'] as $rid => $selected) {
+      if ($rid == $selected) {
+        $role_record->rid = $selected;
+        drupal_write_record('user_relationship_type_roles', $role_record);
+      }
+    }
+  }
+
+  //save role receive permissions for this rtype
+  db_delete('user_relationship_type_roles_receive')
+    ->condition('rtid', $relationship_type->rtid)
+    ->execute();
+  if ($form_state['values']['roles_receive']) {
+    $role_receive_record = new StdClass;
+    $role_receive_record->rtid = $relationship_type->rtid;
+    foreach ($form_state['values']['roles_receive'] as $rid => $selected) {
+      if ($rid == $selected) {
+        $role_receive_record->rid = $selected;
+        drupal_write_record('user_relationship_type_roles_receive', $role_receive_record);
+      }
+    }
+  }
+
+  user_relationships_types_load(TRUE);
+  menu_rebuild();
+
+  $form_state['redirect'] = 'admin/config/people/relationships';
+}
+
+
+/**
+ * Process relationship delete form submission.
+ */
+function user_relationships_admin_type_delete_submit($form, &$form_state) {
+  $relationship_type = user_relationships_type_load($form_state['values']['rtid']);
+
+  db_delete('user_relationship_type_roles')
+    ->condition('rtid', $relationship_type->rtid)
+    ->execute();
+  db_delete('user_relationships')
+    ->condition('rtid', $relationship_type->rtid)
+    ->execute();
+  db_delete('user_relationship_types')
+    ->condition('rtid', $relationship_type->rtid)
+    ->execute();
+
+  module_invoke_all('user_relationships_type_delete', $relationship_type);
+
+  // #371311 force menu rebuild
+  user_relationships_types_load(TRUE);
+  menu_rebuild();
+
+  drupal_set_message(t('Relationship %name has been deleted.', array('%name' => $relationship_type->name)));
+  watchdog(
+    'u_relationship',
+    'User Relationships form: relationship %name deleted.', array('%name' => $relationship_type->name),
+    WATCHDOG_NOTICE
+  );
+
+  $form_state['redirect'] = 'admin/config/people/relationships';
+}
+
+/**
+ * Make relationship type available to translation by i18nstrings.module
+ */
+function _user_relationships_update_translations(&$relationship_type) {
+  if (function_exists('i18nstrings_update') && $relationship_type->rtid) {
+    i18nstrings_update("user_relationships:rtid:$relationship_type->rtid:name", $relationship_type->name);
+    i18nstrings_update("user_relationships:rtid:$relationship_type->rtid:plural_name", $relationship_type->plural_name);
+  }
+}
+
+
+/**
+ * Relationship Types List
+ */
+function user_relationships_admin_types_list_page() {
+  $relationship_types = user_relationships_types_load();
+
+  $table['headers'] = array(t('Name'), t('Plural'), t('Type'), t('Requires Approval'), t('Expiration'), t('Operations'));
+  $table['data'] = array();
+  $table['rows'] = array();
+
+  foreach ($relationship_types as $relationship) {
+    $table['data'][] = $relationship;
+    $table['rows'][] = array(
+      $relationship->name,
+      $relationship->plural_name,
+      ($relationship->is_oneway ? ($relationship->is_reciprocal ? t('reciprocal') : t('one way')) : t('mutual')),
+      ($relationship->requires_approval ? t('yes') : t('no')),
+      ($relationship->expires_val ? t('@expires_val', array('@expires_val' => format_plural($relationship->expires_val, '1 day', '@count days'))) : t('Never')),
+      l(t('edit'),    "admin/config/people/relationships/{$relationship->rtid}/edit") .' | '.
+      l(t('delete'),  "admin/config/people/relationships/{$relationship->rtid}/delete")
+    );
+  }
+
+  foreach (module_implements('user_relationships_page_alter') as $module) {
+    $function = "{$module}_user_relationships_page_alter";
+    $function('types list', $page, $table);
+  }
+
+  if (!sizeof($table['rows'])) {
+    $table['rows'][] = array(array('data' => t('No relationships available.'), 'colspan' => sizeof($table['headers'])));
+  }
+
+  $page['relationships'] = array(
+    '#type'   => 'fieldset',
+    '#title'  => t('Relationship Types'),
+    '#weight' => 0,
+    // No automatic fieldset processing to avoid fatal error. Maybe a core bug?
+    '#pre_render' => array(),
+    // Avoid notice/error in seven theme.
+    '#attributes' => array(),
+  );
+  $page['relationships']['list'] = array(
+    '#markup' => theme('table', array('header' => $table['headers'], 'rows' => $table['rows']))
+  );
+
+  return drupal_render($page);
+}
+
+
+/**
+ * Helper function to build the settings form for the notification messages
+ */
+function _user_relationships_message_settings_form(&$form, $defaults = array()) {
+
+  $replaceables = array(
+    '!requester',
+    '!requestee',
+    '%relationship_name',
+    '%relationship_plural_name',
+    '!pending_relationship_requests',
+  );
+
+  $translations = _user_relationships_default_message_key_translations();
+  foreach ($defaults as $key => $value) {
+    if (is_array($value)) {
+      $form[$key] = array(
+        '#type'         => 'fieldset',
+        '#title'        => isset($translations[$key]) ? $translations[$key] : t(ucfirst(str_replace('_', ' ', $key))),
+        '#collapsible'  => TRUE,
+        '#collapsed'    => TRUE,
+        '#description'  => t('The following tokens are available for use in your custom messages: @replaceables.', array('@replaceables' => implode($replaceables, ', '))),
+        '#group'        => 'messages_settings',
+      );
+      _user_relationships_message_settings_form($form[$key], $value);
+    }
+    else {
+      $form["user_relationships_msg_{$key}"] = array(
+        '#type'           => 'textfield',
+        '#title'          => isset($translations[$key]) ? $translations[$key] : t(ucfirst(str_replace('_', ' ', $key))),
+        '#default_value'  => variable_get("user_relationships_msg_{$key}", $value)
+      );
+    }
+  }
+}
diff --git a/user_relationships.install b/user_relationships.install
index c32a7a4..9344d9b 100644
--- a/user_relationships.install
+++ b/user_relationships.install
@@ -70,9 +70,40 @@ function user_relationships_schema() {
   return $schema;
 }
 
+
+/**
+ * Implements hook_uninstall().
+ */
+function user_relationships_uninstall() {
+  $message_defaults = _user_relationships_default_messages(array());
+  $message_keys = array_merge(array_keys($message_defaults['informational']), array_keys($message_defaults['error']));
+  foreach ($message_keys as $key) {
+    variable_del("user_relationships_msg_{$key}");
+  }
+  variable_del('user_relationships_top');
+  variable_del('user_relationships_show_user_pictures');
+  variable_del('user_relationships_show_direct_links');
+  variable_del('user_relationships_requests_link');
+  variable_del('user_relationships_relationships_per_page');
+  variable_del('user_relationships_position');
+  variable_del('user_relationships_left');
+  variable_del('user_relationships_last_expire');
+  variable_del('user_relationships_allow_multiple');
+  variable_del('user_relationships_allow_auto_approve');
+  variable_del('user_relationships_enable_author_pane');
+  variable_del('user_relationships_author_pane_rtids');
+}
+
 /**
- * Implements hook_update_last_removed().
+ * Migrate existing message settings.
  */
-function user_relationships_last_removed() {
-  return 6103;
-}
\ No newline at end of file
+function user_relationships_update_7000() {
+  // Get all variables with the old prefix.
+  $result = db_query("SELECT * FROM {variable} WHERE name LIKE 'user_relationships_ui_msg_%'");
+  foreach ($result as $variable) {
+    // Save as new variable.
+    variable_set(str_replace('_ui', '', $variable->name), $variable->value);
+    // Delete the old variable.
+    variable_del($variable->name);
+  }
+}
diff --git a/user_relationships.module b/user_relationships.module
index 6db0b43..3996731 100644
--- a/user_relationships.module
+++ b/user_relationships.module
@@ -11,6 +11,59 @@
 define('UR_OK', 0x0);
 define('UR_BANNED', 0x1);
 
+function user_relationships_menu() {
+  $items['admin/config/people/relationships'] = array(
+    'title' => 'Relationships',
+    'description' => 'Create relationship types',
+    'access arguments' => array('administer user relationships'),
+    'page callback' => 'user_relationships_admin_types_list_page',
+    'file' => 'user_relationships.admin.inc',
+  );
+  $items['admin/config/people/relationships/list'] = array(
+    'title' => 'List',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'page callback' => 'user_relationships_admin_types_list_page',
+    'access arguments' => array('administer user relationships'),
+    'file' => 'user_relationships.admin.inc',
+  );
+  $items['admin/config/people/relationships/add'] = array(
+    'title' => 'Add relationship type',
+    'type' => MENU_LOCAL_ACTION,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('user_relationships_admin_type_edit'),
+    'access arguments' => array('administer user relationships'),
+    'file' => 'user_relationships.admin.inc',
+  );
+  $items['admin/config/people/relationships/%user_relationships_type/edit'] = array(
+    'title' => 'Edit type',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('user_relationships_admin_type_edit', 4),
+    'access arguments' => array('administer user relationships'),
+    'file' => 'user_relationships.admin.inc',
+    'weight' => 5,
+  );
+  $items['admin/config/people/relationships/%user_relationships_type/delete'] = array(
+    'title' => 'Delete type',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('user_relationships_admin_type_delete', 4),
+    'access arguments' => array('administer user relationships'),
+    'file' => 'user_relationships.admin.inc',
+    'weight' => 10,
+  );
+  $items['admin/config/people/relationships/settings'] = array(
+    'title' => 'Settings',
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('user_relationships_admin_settings'),
+    'access arguments' => array('administer user relationships'),
+    'file' => 'user_relationships.admin.inc',
+    'weight' => 20,
+  );
+  return $items;
+}
+
 /**
  * Helper function to generate the main and count queries from a list of parameters and options
  */
@@ -741,3 +794,145 @@ function user_relationships_can_receive($requestee, $relationship_type) {
   }
   return FALSE;
 }
+
+/**
+ * Public API for getting the set or default message
+ *
+ * Use the relationship message system. This is set up to retrieve the admin's set messages or fall back on the default
+ * if those aren't set. It'll automatically replace specific tokens with information from $relationship. If you need to provide
+ * additional tokens, they can be sent through $replacements.
+ *
+ * @param $key
+ *   Message name, see _user_relationships_ui_default_messages() for the
+ *   keys and default messages attached to those keys.
+ * @param $replacements
+ *    Replaceable tokens to append or replace default tokens.
+ *
+ * @return
+ *   Formatted message.
+ */
+function user_relationships_get_message($key, $relationship = NULL, $replacements = array()) {
+  $msg = variable_get("user_relationships_msg_{$key}", NULL);
+
+  if ($relationship) {
+    if (!isset($relationship->requester)) {
+      $relationship->requester = user_load($relationship->requester_id);
+    }
+    if (!isset($relationship->requestee)) {
+      $relationship->requestee = user_load($relationship->requestee_id);
+    }
+    if (!(isset($relationship->name) || isset($relationship->type))) {
+      $relationship->type = user_relationships_type_load($relationship->rtid);
+    }
+
+    $replaceables = array(
+      '!requester'                => theme('username', array('account' => $relationship->requester)),
+      '!requestee'                => theme('username', array('account' => $relationship->requestee)),
+      '%relationship_name'        => isset($relationship->name)
+                                     ? ur_tt("user_relationships:rtid:$relationship->rtid:name", $relationship->name)
+                                     : ur_tt("user_relationships:rtid:$relationship->rtid:name", $relationship->type->name),
+      '%relationship_plural_name' => isset($relationship->plural_name)
+                                     ? ur_tt("user_relationships:rtid:$relationship->rtid:plural_name", $relationship->plural_name)
+                                     : ur_tt("user_relationships:rtid:$relationship->rtid:plural_name", $relationship->type->plural_name),
+    );
+    $replacements = array_merge($replaceables, $replacements);
+  }
+
+  if (is_null($msg)) {
+    $messages = _user_relationships_default_messages($replacements);
+    $msg      = _user_relationships_get_from_array($key, $messages);
+  }
+  else {
+    $msg = t($msg, $replacements);
+  }
+
+  return $msg;
+}
+
+/**
+ * Returns a nested array of default messages.
+ * When adding any keys, add translations in
+ * _user_relationships_default_message_key_translations().
+ */
+function _user_relationships_default_messages($replacements) {
+  return array(
+    'informational' => array(
+      'submitted'     => t('Your %relationship_name request has been sent to !requestee.', $replacements),
+      'accepted'      => t("!requester's %relationship_name request has been approved.", $replacements),
+      'disapproved'   => t("!requester has declined your %relationship_name request.", $replacements),
+      'disapprove'   => t("!requester's %relationship_name request has been declined.", $replacements),
+      'cancel'        => t('Your %relationship_name request to !requestee has been canceled.', $replacements),
+      'default'       => t('No action has been taken.'),
+      'removed'       => t('The %relationship_name relationship between !requester and !requestee has been deleted.', $replacements),
+      'pending'       => t('!requester has requested to be your %relationship_name.  Please view your !pending_relationship_requests to approve them.', $replacements),
+      'pre_approved'  => t("You are !requestee's newest %relationship_name.", $replacements),
+    ),
+    'error' => array(
+      'too_many_relationships'  => t('You are not permitted to create any more relationships with this user.'),
+      'existing_request'        => t('There is already an earlier %relationship_name request sent to !requestee.', $replacements),
+      'existing_relationship'   => t('There is already an existing %relationship_name relationship with !requestee.', $replacements),
+      'not_accepting_requests'  => t('This user does not accept relationship requests.'),
+      'self_request'            => t('You cannot create a relationship with yourself.'),
+      'non_existent_user'       => t('This user does not exist.'),
+      'non_existent_type'       => t('This relationship type does not exist.'),
+      'unknown_error'           => t('An error has occurred. Please contact the site administrator.'),
+      'relationship_type_not_set' => t('Please choose the type of relationship.'),
+      'relationship_type_not_allowed' => t('You may not create %relationship_name relationships.', $replacements),
+    ),
+  );
+}
+
+/**
+ * Returns translations of message keys, used on the admin settings form. #515338
+ */
+function _user_relationships_default_message_key_translations() {
+  return array(
+    'informational' => t('Informational Messages'),
+    'submitted'     => t('Submitted'),
+    'accepted'      => t('Accepted'),
+    'disapproved'   => t('Declined'),
+    'disapprove'   => t('Decline'),
+    'cancel'        => t('Cancel'),
+    'default'       => t('Default'),
+    'removed'       => t('Removed'),
+    'pending'       => t('Pending'),
+    'pre_approved'  => t('Pre-approved'),
+    'error'         => t('Error Messages'),
+    'too_many_relationships'  => t('Too many relationships'),
+    'existing_request'        => t('Existing request'),
+    'existing_relationship'   => t('Existing relationship'),
+    'not_accepting_requests'  => t('Not accepting requests'),
+    'self_request'            => t('Self request'),
+    'non_existent_user'       => t('Non-existent user'),
+    'non_existent_type'       => t('Non-existent type'),
+    'unknown_error'           => t('Unknown error'),
+    'relationship_type_not_set' => t('Relationship type not set'),
+    'relationship_type_not_allowed' => t('Relationship type not allowed'),
+  );
+}
+
+/**
+ * Recursively search an array for a key and return the value attached to it
+ */
+function _user_relationships_get_from_array($needle, &$haystack) {
+  foreach ($haystack as $key => $value) {
+    if ($key == $needle) {
+      return $value;
+    }
+    elseif (is_array($value)) {
+      if ($msg = _user_relationships_get_from_array($needle, $value)) {
+        return $msg;
+      }
+    }
+  }
+}
+
+/**
+ * Implementation of hook_locale().
+ */
+function user_relationships_ui_locale($op = 'groups') {
+  switch ($op) {
+    case 'groups':
+      return array('user_relationships' => t('User Relationships'));
+  }
+}
diff --git a/user_relationships_ui/user_relationships_ui.actions.inc b/user_relationships_ui/user_relationships_ui.actions.inc
index 9578b5f..5e26966 100644
--- a/user_relationships_ui/user_relationships_ui.actions.inc
+++ b/user_relationships_ui/user_relationships_ui.actions.inc
@@ -17,7 +17,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
   if (user_access('can have relationships', $requestee)) {
     //check that a type has been chosen
     if (!$rtid || !($rtype = user_relationships_type_load($rtid))) {
-      form_set_error('rtid', user_relationships_ui_get_message('relationship_type_not_set'));
+      form_set_error('rtid', user_relationships_get_message('relationship_type_not_set'));
       //need to handle requests from ajax forms separately
       if (isset($_GET['ajax'])) {
         drupal_goto();
@@ -29,7 +29,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
     $current_relationships = user_relationships_load(array('between' => array($requester->uid, $requestee->uid)), array('sort' => 'rtid'));
     //check for multiple relationships
     if (!variable_get('user_relationships_allow_multiple', TRUE) && count($current_relationships)) {
-    form_set_error('rtid', user_relationships_ui_get_message('too_many_relationships'));
+    form_set_error('rtid', user_relationships_get_message('too_many_relationships'));
       if (isset($_GET['ajax'])) {
         drupal_goto();
       }
@@ -41,7 +41,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
     if (!user_relationships_can_request($requester, $rtype)) {
       $rtype->requester = $requester;
       $rtype->requestee = $requestee;
-      form_set_error('rtid', user_relationships_ui_get_message('relationship_type_not_allowed', $rtype));
+      form_set_error('rtid', user_relationships_get_message('relationship_type_not_allowed', $rtype));
       if (isset($_GET['ajax'])) {
         drupal_goto();
       }
@@ -54,7 +54,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
     if (!user_relationships_can_receive($requestee, $rtype)) {
       $rtype->requester = $requester;
       $rtype->requestee = $requestee;
-      form_set_error('rtid', user_relationships_ui_get_message('relationship_type_not_allowed', $rtype));
+      form_set_error('rtid', user_relationships_get_message('relationship_type_not_allowed', $rtype));
       if (isset($_GET['ajax'])) {
         drupal_goto();
       }
@@ -91,13 +91,13 @@ function user_relationships_ui_request_validate($form, &$form_state) {
       $select->condition('rtid', $test_relationships, 'NOT IN');
     }
     if (!$select->execute()->fetchField()) {
-      drupal_set_message(user_relationships_ui_get_message('too_many_relationships'), 'error');
+      drupal_set_message(user_relationships_get_message('too_many_relationships'), 'error');
       drupal_goto();
     }
     //check if desided relationship type is among the unused ones
     elseif (isset($test_relationships[$rtid])) {
       $message_name = $test_relationships[$rtid]->approved ? 'existing_relationship' : 'existing_request';
-      form_set_error('rtid', user_relationships_ui_get_message($message_name, NULL, array(
+      form_set_error('rtid', user_relationships_get_message($message_name, NULL, array(
         '!requester'                => theme('username', array('account' => $requester)),
         '!requestee'                => theme('username', array('account' => $requestee)),
         '%relationship_name'        => $current_relationships[$rtid][0]->name,
@@ -106,7 +106,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
     }
   }
   else {
-    drupal_set_message(user_relationships_ui_get_message('not_accepting_requests'));
+    drupal_set_message(user_relationships_get_message('not_accepting_requests'));
     drupal_goto();
   }
 }
@@ -124,7 +124,7 @@ function user_relationships_ui_request_submit($form, &$form_state) {
   $relationship = user_relationships_request_relationship($relationship);
 
   if ($relationship === FALSE) {
-    drupal_set_message(user_relationships_ui_get_message('unknown_error', $relationship));
+    drupal_set_message(user_relationships_get_message('unknown_error', $relationship));
   }
 
   //Not sure why these were here, they just cause php notices
@@ -132,7 +132,7 @@ function user_relationships_ui_request_submit($form, &$form_state) {
 //  $relationship->requestee = $requestee;
 //  $relationship->type = $relationship_type;
 
-  drupal_set_message(user_relationships_ui_get_message(($relationship->approved ? 'pre_approved' : 'submitted'), $relationship));
+  drupal_set_message(user_relationships_get_message(($relationship->approved ? 'pre_approved' : 'submitted'), $relationship));
 }
 
 
@@ -155,7 +155,7 @@ function user_relationships_ui_pending_requested_submit($form, &$form_state) {
     }
     $relationship->approved = TRUE;
     user_relationships_save_relationship($relationship, $form_state['values']['action']);
-    drupal_set_message(user_relationships_ui_get_message('accepted', $relationship));
+    drupal_set_message(user_relationships_get_message('accepted', $relationship));
     break;
 
   case 'cancel':
@@ -164,7 +164,7 @@ function user_relationships_ui_pending_requested_submit($form, &$form_state) {
       exit();
     }
     user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
-    drupal_set_message(user_relationships_ui_get_message($form_state['values']['action'], $relationship));
+    drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
     break;
 
   case 'disapprove':
@@ -173,11 +173,11 @@ function user_relationships_ui_pending_requested_submit($form, &$form_state) {
       exit();
     }
     user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
-    drupal_set_message(user_relationships_ui_get_message($form_state['values']['action'], $relationship));
+    drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
     break;
 
   default:
-    drupal_set_message(user_relationships_ui_get_message('default'));
+    drupal_set_message(user_relationships_get_message('default'));
   }
 
   $form_state['redirect'] = str_replace('destination=', '', drupal_get_destination());
@@ -198,7 +198,7 @@ function user_relationships_ui_remove_submit($form, &$form_state) {
   }
 
   user_relationships_delete_relationship($relationship, $user);
-  drupal_set_message(user_relationships_ui_get_message('removed', $relationship));
+  drupal_set_message(user_relationships_get_message('removed', $relationship));
 
   return "user/{$form_state['values']['viewed_id']}/relationships";
 }
diff --git a/user_relationships_ui/user_relationships_ui.admin.inc b/user_relationships_ui/user_relationships_ui.admin.inc
deleted file mode 100644
index ee41434..0000000
--- a/user_relationships_ui/user_relationships_ui.admin.inc
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-
-/**
- * @file
- * User Relationships admin settings and config forms
- */
-module_load_include('inc', 'user_relationships_ui', 'user_relationships_ui.admin_actions');
-
-/**
- * Main settings
- */
-function user_relationships_ui_settings() {
-
-  $form['settings'] = array(
-    '#type' => 'vertical_tabs',
-  );
-
-  $form['general'] = array(
-    '#type'   => 'fieldset',
-    '#title'  => t('General'),
-    '#weight' => -10,
-    '#group' => 'settings',
-  );
-  $form['general']['user_relationships_allow_multiple'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Allow multiple relationships'),
-    '#description'    => t('If checked, a user may create multiple relationships (each relationship of a different type) with another user.'),
-    '#default_value'  => variable_get('user_relationships_allow_multiple', 1),
-  );
-  $form['general']['user_relationships_show_direct_links'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Show a separate link per relationship type'),
-    '#description'    => t("On a user's page, show a separate link for each available relationship type (instead of the generic 'Create a relationship' link)."),
-    '#default_value'  => variable_get('user_relationships_show_direct_links', 1),
-  );
-  $form['general']['user_relationships_show_user_pictures'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t("Show user pictures on relationship pages"),
-    '#description'    => t("Show a picture next to each user's name on 'My relationships' pages."),
-    '#default_value'  => variable_get('user_relationships_show_user_pictures', 0),
-  );
-  $form['general']['user_relationships_allow_auto_approve'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Allow users to auto approve'),
-    '#description'    => t('Provide users with an option to automatically approve all requested relationships.'),
-    '#default_value'  => variable_get('user_relationships_allow_auto_approve', 0),
-  );
-  $form['general']['user_relationships_relationships_per_page'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Relationships per page'),
-    '#size'           => 4,
-    '#description'    => t('Number of relationships to show per page. If set to 0 all will be shown.'),
-    '#default_value'  => variable_get('user_relationships_relationships_per_page', 16),
-    '#validate'       => array('user_relationships_setting_validation' => array(array(
-      'is_numeric' => array('msg' => t('The relationships per page setting is not an integer'))
-    )))
-  );
-  $form['positioning'] = array(
-    '#type'   => 'fieldset',
-    '#title'  => t('AJAX Popup Positioning'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#description' => t('Some themes may require repositioning of AJAX confirmation dialogs. You may use these controls to set where the popup appears on the page or in relation to the mouse cursor.'),
-    '#group' => 'settings',
-  );
-  $form['positioning']['user_relationships_enable_ajax_popups'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Show AJAX confirmation popups'),
-    '#default_value' => variable_get('user_relationships_enable_ajax_popups', 0),
-    '#description' => t('Other popup settings below will only take effect if popups are enabled.')
-  );
-  $form['positioning']['user_relationships_position'] = array(
-    '#type' => 'select',
-    '#title' => t("Elaboration form's css position"),
-    '#default_value' => variable_get('user_relationships_position', 'absolute'),
-    '#options' => array(
-      'absolute' => t('Mouse cursor'),
-      'fixed' => t('Fixed'),
-    ),
-    '#description' => t('Sets the css <em>position</em> property of AJAX confirmation popups.'),
-  );
-  $form['positioning']['user_relationships_left'] = array(
-    '#type' => 'textfield',
-    '#title' => t("Elaboration form's css left value"),
-    '#default_value' => variable_get('user_relationships_left', '0'),
-    '#size' => 4,
-    '#description' => t("Sets the css <em>left</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.5 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
-  );
-  $form['positioning']['user_relationships_top'] = array(
-    '#type' => 'textfield',
-    '#title' => t("Elaboration form's css top value"),
-    '#default_value'  => variable_get('user_relationships_top', '0'),
-    '#size' => 4,
-    '#description' => t("Sets the css <em>top</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.4 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
-  );
-
-  $form['messages'] = array(
-    '#type'         => 'fieldset',
-    '#title'        => t('Custom Screen Messages'),
-    '#weight'       => 0,
-    '#description'  => t('Customize the confirmation messages displayed to users when specific relationship events occur.'),
-    '#group' => 'settings',
-  );
-
-  $form['messages']['user_relationships_requests_link'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Path to relationship requests'),
-    '#default_value'  => variable_get('user_relationships_requests_link', 'relationships/requests'),
-    '#description' => t("Only change this setting if a user's pending relationship requests have a different location than the default path (relationships/requests)"),
-  );
-
-  $form['messages']['messages_settings'] = array(
-    '#type' => 'vertical_tabs',
-  );
-
-  $default_messages = _user_relationships_ui_default_messages(array());
-  _user_relationships_ui_message_settings_form($form['messages'], $default_messages);
-
-  //options for author pane integration
-  if (function_exists('author_pane_api') && author_pane_api() == '2') {
-    $rtypes = user_relationships_types_load();
-    $form['author_pane'] = array(
-      '#type'   => 'fieldset',
-      '#title'  => t('Author Pane'),
-      '#collapsible' => TRUE,
-      '#group' => 'settings',
-    );
-    $form['author_pane']['user_relationships_enable_author_pane'] = array(
-      '#type'           => 'checkbox',
-      '#title'          => t('Show links in Author Pane'),
-      '#description'    => t('Check if you wish to show add/remove relationship links in Author Pane.'),
-      '#default_value'  => variable_get('user_relationships_enable_author_pane', 0),
-    );
-    // Since AP supports only one link per module, need to pick one relationship type
-    if (count($rtypes)) {
-      $options = array();
-      foreach ($rtypes as $rtype) {
-        $options[$rtype->rtid] = $rtype->name;
-      }
-      $form['author_pane']['user_relationships_author_pane_rtids'] = array(
-        '#type' => 'select',
-        '#multiple' => TRUE,
-        '#title' => t('Relationship types to use'),
-        '#default_value' => variable_get('user_relationships_author_pane_rtids', 'absolute'),
-        '#options' => $options,
-        '#description' => t('The chosen relationship types will be used for add/remove links.'),
-      );
-    }
-  }
-  return system_settings_form($form);
-}
-
-
-/**
- * Relationship type edit page.
- */
-function user_relationships_ui_type_edit($form, &$form_state, $relationship_type = NULL) {
-  if (!$relationship_type) {
-    drupal_set_title(t('Add relationship type'));
-    $relationship_type = (object) array(
-      'name' => '',
-      'plural_name' => '',
-      'is_oneway' => FALSE,
-      'is_reciprocal' => FALSE,
-    );
-  }
-  else {
-    drupal_set_title(t('Edit @name relationship type', array('@name' => $relationship_type->name)));
-  }
-
-  $form['tabs'] = array(
-    '#type' => 'vertical_tabs',
-  );
-
-  $form['general'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('General'),
-    '#group' => 'tabs',
-  );
-
-  $form['general']['name'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Name'),
-    '#maxlength'      => 255,
-    '#default_value'  => isset($relationship_type) ? $relationship_type->name : NULL,
-    '#description'    => t("Example: buddy, friend, coworker, spouse."),
-    '#required'       => TRUE,
-    '#weight'         => -10,
-  );
-  $form['general']['plural_name'] = array(
-    '#type'           => 'textfield',
-    '#title'          => t('Plural name'),
-    '#maxlength'      => 255,
-    '#default_value'  => isset($relationship_type) ? $relationship_type->plural_name : NULL,
-    '#description'    => t("Example: buddies, friends, coworkers, spouses."),
-    '#required'       => TRUE,
-    '#weight'         => -9,
-  );
-  $form['general']['requires_approval'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('Requires Approval'),
-    '#default_value'  => (isset($relationship_type->requires_approval) ? $relationship_type->requires_approval : 1),
-    '#description'    => t('Check this if the requestee must approve the relationship'),
-    '#weight'         => -8,
-  );
-  $form['general']['expires_val'] = array(
-    '#title'          => t('Request expires in'),
-    '#field_suffix'   => t('days'),
-    '#type'           => 'textfield',
-    '#size'           => 4,
-    '#default_value'  => isset($relationship_type->expires_val) ? $relationship_type->expires_val : 0,
-    '#description'    => t('After how many days should a request of this type be removed? (0 for never)'),
-    '#weight'         => -7,
-  );
-  $form['general']['is_oneway'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('This is a one-way relationship'),
-    '#default_value'  => isset($relationship_type) ? $relationship_type->is_oneway : NULL,
-    '#description'    => t('Check this if this relationship should only go one way (ex Manager, Subscriber)'),
-    '#weight'         => -6,
-  );
-  $form['general']['is_reciprocal'] = array(
-    '#type'           => 'checkbox',
-    '#title'          => t('This one-way relationship can be reciprocated'),
-    '#default_value'  => isset($relationship_type) ? $relationship_type->is_reciprocal : NULL,
-    '#description'    => t('Check if this one-way relationship can go either way'),
-    '#weight'         => -5,
-  );
-
-  $form['roles'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Allowed Roles'),
-    '#group' => 'tabs',
-    '#weight' => 10,
-  );
-
-  $form['roles']['roles'] = array(
-    '#type' => 'checkboxes',
-    '#options' => user_roles(TRUE),
-    '#default_value' => isset($relationship_type->roles) ? $relationship_type->roles : array(),
-    '#title' => t('Role request access'),
-    '#description' => t('You may choose which roles are allowed to request this relationship. If none are selected, all roles are allowed.'),
-  );
-  $form['roles']['roles_receive'] = array(
-    '#type' => 'checkboxes',
-    '#options' => user_roles(TRUE),
-    '#default_value' => isset($relationship_type->roles_receive)  && is_array($relationship_type->roles_receive) ? $relationship_type->roles_receive : array(),
-    '#title' => t('Role receive access'),
-    '#description' => t('You may choose which roles are allowed to receive this relationship. If none are selected, all roles are allowed to receive the relationship.'),
-  );
-  $form['rtid'] = array(
-    '#type'   => 'value',
-    '#value'  => isset($relationship_type->rtid) ? (int)$relationship_type->rtid : NULL,
-  );
-  $form['action'] = array(
-    '#type'   => 'value',
-    '#value'  => (isset($relationship_type->rtid) ? 'edit' : 'add'),
-  );
-
-  $form['submit'] = array(
-    '#type'   => 'submit',
-    '#value'  => t('Submit'),
-    '#weight' => 10,
-  );
-
-  return $form;
-}
-
-
-/**
- * Relationship type delete page.
- */
-function user_relationships_ui_type_delete($form, &$form_state, $relationship_type = NULL) {
-  if ($relationship_type) {
-    $form['rtid'] = array(
-      '#type'   => 'value',
-      '#value'  => (int)$relationship_type->rtid,
-    );
-
-    return confirm_form(
-      $form,
-      t('Are you sure you want to delete %name?', array('%name' => ur_tt("user_relationships:rtid:$relationship_type->rtid:name", $relationship_type->name))),
-      'admin/config/people/relationships',
-      t('This action cannot be undone.'),
-      t('Delete'), t('Cancel')
-    );
-  }
-  else {
-    drupal_set_message(user_relationships_ui_get_message('non_existent_type'));
-    drupal_goto('admin/config/people/relationships');
-  }
-}
diff --git a/user_relationships_ui/user_relationships_ui.admin_actions.inc b/user_relationships_ui/user_relationships_ui.admin_actions.inc
deleted file mode 100644
index 47653a1..0000000
--- a/user_relationships_ui/user_relationships_ui.admin_actions.inc
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/**
- * @file
- * User Relationships admin submit handlers
- */
-
-/**
- * Validate the submitted relationship type
- */
-function user_relationships_ui_type_edit_validate($form, &$form_state) {
-  $select = db_select('user_relationship_types', 'urt')
-    ->fields('urt', array('name'))
-    ->where("LOWER(name) = LOWER(:name)", array(':name' => $form_state['values']['name']));
-  if (isset($form_state['values']['rtid'])) {
-    $select->condition('rtid', $form_state['values']['rtid'], '<>');
-  }
-  if ($select->execute()->fetchField()) {
-    form_set_error('name', t('%name has already been used.', array('%name' => $form_state['values']['name'])));
-  }
-
-  $expire = $form_state['values']['expires_val'];
-  if (!is_numeric($expire) || (int)$expire < 0) {
-    form_set_error('expires_val', t('Expiration period must be an integer greater than or equal to 0.'));
-  }
-}
-
-/***
- * Generic settings validation.
- */
-function user_relationships_ui_setting_validation($element, $validations) {
-  foreach ($validations as $validation => $info) {
-    $arguments = array($element['#value']);
-    if (isset($info['valid_options'])) {
-      $arguments[] = $info['valid_options'];
-    }
-
-    $valid = function_exists($validation) && call_user_func_array($validation, $arguments);
-    $valid = !$valid ? ($validation == 'is_positive' && is_numeric($arguments) && (int)$arguments > 0) : FALSE;
-    $valid = !$valid ? ($validation == 'is_non_negative' && is_numeric($arguments) && (int)$arguments > -1) : FALSE;
-
-    if (!$valid) {
-      form_set_error($element['#name'], $info['msg']);
-    }
-  }
-}
-
-/**
- * Process the relationship edit page form submission.
- */
-function user_relationships_ui_type_edit_submit($form, &$form_state) {
-  $relationship_type = (object)$form_state['values'];
-  if ($form_state['values']['action'] == 'add') {
-    //#348025 when editing a type, make sure that two-way relationships are not left as reciprocal, just in case, as the UI allows it.
-    if (!$relationship_type->is_oneway) {
-      $relationship_type->is_reciprocal = 0;
-    }
-    drupal_write_record('user_relationship_types', $relationship_type);
-
-    // Update strings for translation
-    _user_relationships_ui_update_translations($relationship_type);
-
-    $form_state['values']['rtid'] = $relationship_type->rtid;
-    module_invoke_all('user_relationships_type_insert', $relationship_type);
-
-    drupal_set_message(t('Relationship %name has been added.', array('%name' => $relationship_type->name)));
-    watchdog(
-      'u_relationship',
-      'User Relationships form: relationship %name added.', array('%name' => $relationship_type->name),
-      WATCHDOG_NOTICE,
-      l(t('view'), 'admin/user/user_relationship/types/'. $relationship_type->rtid .'/edit')
-    );
-  }
-  else {
-    //#348025 when editing a type, make sure that two-way relationships are not left as reciprocal, just in case, as the UI allows it.
-    if (!$relationship_type->is_oneway) {
-      $relationship_type->is_reciprocal = 0;
-    }
-    drupal_write_record('user_relationship_types', $relationship_type, 'rtid');
-
-    // Update strings for translation
-    _user_relationships_ui_update_translations($relationship_type);
-    module_invoke_all('user_relationships_type_update', $relationship_type);
-
-    drupal_set_message(t('Relationship %name has been updated.', array('%name' => $relationship_type->name)));
-    watchdog(
-      'u_relationship',
-      'User Relationships form: relationship %name updated.', array('%name' => $relationship_type->name),
-      WATCHDOG_NOTICE,
-      l(t('view'), 'admin/config/people/relationships/'. $relationship_type->rtid .'/edit')
-    );
-  }
-  
-  //save role permissions for this rtype
-  db_delete('user_relationship_type_roles')
-    ->condition('rtid', $relationship_type->rtid)
-    ->execute();
-  if ($form_state['values']['roles']) {
-    $role_record = new StdClass;
-    $role_record->rtid = $relationship_type->rtid;
-    foreach ($form_state['values']['roles'] as $rid => $selected) {
-      if ($rid == $selected) {
-        $role_record->rid = $selected;
-        drupal_write_record('user_relationship_type_roles', $role_record);
-      }
-    }
-  }
-
-  //save role receive permissions for this rtype
-  db_delete('user_relationship_type_roles_receive')
-    ->condition('rtid', $relationship_type->rtid)
-    ->execute();
-  if ($form_state['values']['roles_receive']) {
-    $role_receive_record = new StdClass;
-    $role_receive_record->rtid = $relationship_type->rtid;
-    foreach ($form_state['values']['roles_receive'] as $rid => $selected) {
-      if ($rid == $selected) {
-        $role_receive_record->rid = $selected;
-        drupal_write_record('user_relationship_type_roles_receive', $role_receive_record);
-      }
-    }
-  }
-
-  user_relationships_types_load(TRUE);
-  menu_rebuild();
-
-  $form_state['redirect'] = 'admin/config/people/relationships';
-}
-
-
-/**
- * Process relationship delete form submission.
- */
-function user_relationships_ui_type_delete_submit($form, &$form_state) {
-  $relationship_type = user_relationships_type_load($form_state['values']['rtid']);
-
-  db_delete('user_relationship_type_roles')
-    ->condition('rtid', $relationship_type->rtid)
-    ->execute();
-  db_delete('user_relationships')
-    ->condition('rtid', $relationship_type->rtid)
-    ->execute();
-  db_delete('user_relationship_types')
-    ->condition('rtid', $relationship_type->rtid)
-    ->execute();
-
-  module_invoke_all('user_relationships_type_delete', $relationship_type);
-
-  // #371311 force menu rebuild
-  user_relationships_types_load(TRUE);
-  menu_rebuild();
-
-  drupal_set_message(t('Relationship %name has been deleted.', array('%name' => $relationship_type->name)));
-  watchdog(
-    'u_relationship',
-    'User Relationships form: relationship %name deleted.', array('%name' => $relationship_type->name),
-    WATCHDOG_NOTICE
-  );
-
-  $form_state['redirect'] = 'admin/config/people/relationships';
-}
-
-/**
- * Make relationship type available to translation by i18nstrings.module
- */
-function _user_relationships_ui_update_translations(&$relationship_type) {
-  if (function_exists('i18nstrings_update') && $relationship_type->rtid) {
-    i18nstrings_update("user_relationships:rtid:$relationship_type->rtid:name", $relationship_type->name);
-    i18nstrings_update("user_relationships:rtid:$relationship_type->rtid:plural_name", $relationship_type->plural_name);
-  }
-}
diff --git a/user_relationships_ui/user_relationships_ui.forms.inc b/user_relationships_ui/user_relationships_ui.forms.inc
index a2aad1e..ad5882a 100644
--- a/user_relationships_ui/user_relationships_ui.forms.inc
+++ b/user_relationships_ui/user_relationships_ui.forms.inc
@@ -87,7 +87,7 @@ function user_relationships_ui_request($form, &$form_state, $requestee) {
     $form['error'] = array(
       '#prefix' => '<div>',
       '#suffix' => '</div>',
-      '#markup' => user_relationships_ui_get_message('non_existent_user') . $script
+      '#markup' => user_relationships_get_message('non_existent_user') . $script
     );
     return $form;
   }
@@ -95,7 +95,7 @@ function user_relationships_ui_request($form, &$form_state, $requestee) {
     $form['error'] = array(
       '#prefix' => '<div>',
       '#suffix' => '</div>',
-      '#markup' => user_relationships_ui_get_message('not_accepting_requests') . $script
+      '#markup' => user_relationships_get_message('not_accepting_requests') . $script
     );
     return $form;
   }
@@ -103,7 +103,7 @@ function user_relationships_ui_request($form, &$form_state, $requestee) {
     $form['error'] = array(
       '#prefix' => '<div>',
       '#suffix' => '</div>',
-      '#markup' => user_relationships_ui_get_message('self_request') . $script
+      '#markup' => user_relationships_get_message('self_request') . $script
     );
     return $form;
   }
@@ -112,7 +112,7 @@ function user_relationships_ui_request($form, &$form_state, $requestee) {
     $form['error'] = array(
       '#prefix' => '<div>',
       '#suffix' => '</div>',
-      '#markup' => user_relationships_ui_get_message('too_many_relationships') . $script
+      '#markup' => user_relationships_get_message('too_many_relationships') . $script
     );
     return $form;
   }
@@ -122,7 +122,7 @@ function user_relationships_ui_request($form, &$form_state, $requestee) {
     $data['error'] = array(
       '#prefix' => '<div>',
       '#suffix' => '</div>',
-      '#markup' => user_relationships_ui_get_message('too_many_relationships') . $script
+      '#markup' => user_relationships_get_message('too_many_relationships') . $script
     );
     return $data;
   }
diff --git a/user_relationships_ui/user_relationships_ui.install b/user_relationships_ui/user_relationships_ui.install
index 9e74771..240ff4a 100644
--- a/user_relationships_ui/user_relationships_ui.install
+++ b/user_relationships_ui/user_relationships_ui.install
@@ -4,29 +4,6 @@
  */
 
 /**
- * Implementation of hook_uninstall()
- */
-function user_relationships_ui_uninstall() {
-  $message_defaults = _user_relationships_ui_default_messages(array());
-  $message_keys = array_merge(array_keys($message_defaults['informational']), array_keys($message_defaults['error']));
-  foreach ($message_keys as $key) {
-    variable_del("user_relationships_ui_msg_{$key}");
-  }
-  variable_del('user_relationships_top');
-  variable_del('user_relationships_show_user_pictures');
-  variable_del('user_relationships_show_direct_links');
-  variable_del('user_relationships_requests_link');
-  variable_del('user_relationships_relationships_per_page');
-  variable_del('user_relationships_position');
-  variable_del('user_relationships_left');
-  variable_del('user_relationships_last_expire');
-  variable_del('user_relationships_allow_multiple');
-  variable_del('user_relationships_allow_auto_approve');
-  variable_del('user_relationships_enable_author_pane');
-  variable_del('user_relationships_author_pane_rtids');
-}
-
-/**
  * Enable renamed user_relationships module and update changed variables.
  */
 function user_relationships_ui_update_7001() {
diff --git a/user_relationships_ui/user_relationships_ui.module b/user_relationships_ui/user_relationships_ui.module
index e4c99ed..a4392e9 100644
--- a/user_relationships_ui/user_relationships_ui.module
+++ b/user_relationships_ui/user_relationships_ui.module
@@ -9,144 +9,7 @@
 
 define('USER_RELATIONSHIPS_UI_PATH', drupal_get_path('module', 'user_relationships_ui'));
 
-/**
- * Public API for getting the set or default message
- *
- * Use the relationship message system. This is set up to retrieve the admin's set messages or fall back on the default
- * if those aren't set. It'll automatically replace specific tokens with information from $relationship. If you need to provide
- * additional tokens, they can be sent through $replacements.
- *
- * @param $key
- *    string message name
- *    Check at the top of user_relationships_ui.module in "_user_relationships_ui_default_messages()"
- *    for the keys and default messages attached to those keys.
- * @param $replacements
- *    array replaceable tokens to append or replace default tokens
- *
- * @return
- *    string formatted message
- */
-function user_relationships_ui_get_message($key, $relationship = NULL, $replacements = array()) {
-  $msg = variable_get("user_relationships_ui_msg_{$key}", NULL);
-
-  if ($relationship) {
-    if (!isset($relationship->requester)) {
-      $relationship->requester = user_load($relationship->requester_id);
-    }
-    if (!isset($relationship->requestee)) {
-      $relationship->requestee = user_load($relationship->requestee_id);
-    }
-    if (!(isset($relationship->name) || isset($relationship->type))) {
-      $relationship->type = user_relationships_type_load($relationship->rtid);
-    }
-
-    $replaceables = array(
-      '!requester'                => theme('username', array('account' => $relationship->requester)),
-      '!requestee'                => theme('username', array('account' => $relationship->requestee)),
-      '%relationship_name'        => isset($relationship->name)
-                                     ? ur_tt("user_relationships:rtid:$relationship->rtid:name", $relationship->name)
-                                     : ur_tt("user_relationships:rtid:$relationship->rtid:name", $relationship->type->name),
-      '%relationship_plural_name' => isset($relationship->plural_name)
-                                     ? ur_tt("user_relationships:rtid:$relationship->rtid:plural_name", $relationship->plural_name)
-                                     : ur_tt("user_relationships:rtid:$relationship->rtid:plural_name", $relationship->type->plural_name),
-    );
-    $replacements = array_merge($replaceables, $replacements);
-  }
-
-  if (is_null($msg)) {
-    $messages = _user_relationships_ui_default_messages($replacements);
-    $msg      = _user_relationships_get_from_array($key, $messages);
-  }
-  else {
-    $msg = t($msg, $replacements);
-  }
-
-  return $msg;
-}
-
-
-/**********************************
- *
- *      "PRIVATE" FUNCTIONS
- *
- **********************************/
-
-/**
- * Returns a nested array of default messages.
- * When adding any keys, add translations below in _user_relationships_ui_default_message_key_translations()
- */
-function _user_relationships_ui_default_messages($replacements) {
-  return array(
-    'informational' => array(
-      'submitted'     => t('Your %relationship_name request has been sent to !requestee.', $replacements),
-      'accepted'      => t("!requester's %relationship_name request has been approved.", $replacements),
-      'disapproved'   => t("!requester has declined your %relationship_name request.", $replacements),
-      'disapprove'   => t("!requester's %relationship_name request has been declined.", $replacements),
-      'cancel'        => t('Your %relationship_name request to !requestee has been canceled.', $replacements),
-      'default'       => t('No action has been taken.'),
-      'removed'       => t('The %relationship_name relationship between !requester and !requestee has been deleted.', $replacements),
-      'pending'       => t('!requester has requested to be your %relationship_name.  Please view your !pending_relationship_requests to approve them.', $replacements),
-      'pre_approved'  => t("You are !requestee's newest %relationship_name.", $replacements),
-    ),
-    'error' => array(
-      'too_many_relationships'  => t('You are not permitted to create any more relationships with this user.'),
-      'existing_request'        => t('There is already an earlier %relationship_name request sent to !requestee.', $replacements),
-      'existing_relationship'   => t('There is already an existing %relationship_name relationship with !requestee.', $replacements),
-      'not_accepting_requests'  => t('This user does not accept relationship requests.'),
-      'self_request'            => t('You cannot create a relationship with yourself.'),
-      'non_existent_user'       => t('This user does not exist.'),
-      'non_existent_type'       => t('This relationship type does not exist.'),
-      'unknown_error'           => t('An error has occurred. Please contact the site administrator.'),
-      'relationship_type_not_set' => t('Please choose the type of relationship.'),
-      'relationship_type_not_allowed' => t('You may not create %relationship_name relationships.', $replacements),
-    ),
-  );
-}
 
-/**
- * Returns translations of message keys, used on the admin settings form. #515338
- */
-function _user_relationships_ui_default_message_key_translations() {
-  return array(
-    'informational' => t('Informational Messages'),
-    'submitted'     => t('Submitted'),
-    'accepted'      => t('Accepted'),
-    'disapproved'   => t('Declined'),
-    'disapprove'   => t('Decline'),
-    'cancel'        => t('Cancel'),
-    'default'       => t('Default'),
-    'removed'       => t('Removed'),
-    'pending'       => t('Pending'),
-    'pre_approved'  => t('Pre-approved'),
-    'error'         => t('Error Messages'),
-    'too_many_relationships'  => t('Too many relationships'),
-    'existing_request'        => t('Existing request'),
-    'existing_relationship'   => t('Existing relationship'),
-    'not_accepting_requests'  => t('Not accepting requests'),
-    'self_request'            => t('Self request'),
-    'non_existent_user'       => t('Non-existent user'),
-    'non_existent_type'       => t('Non-existent type'),
-    'unknown_error'           => t('Unknown error'),
-    'relationship_type_not_set' => t('Relationship type not set'),
-    'relationship_type_not_allowed' => t('Relationship type not allowed'),
-  );
-}
-
-/**
- * Recursively search an array for a key and return the value attached to it
- */
-function _user_relationships_get_from_array($needle, &$haystack) {
-  foreach ($haystack as $key => $value) {
-    if ($key == $needle) {
-      return $value;
-    }
-    elseif (is_array($value)) {
-      if ($msg = _user_relationships_get_from_array($needle, $value)) {
-        return $msg;
-      }
-    }
-  }
-}
 
 
 /*
@@ -165,7 +28,7 @@ function _user_relationships_ui_set_notifications(&$account) {
 
   $relationships = user_relationships_load(array('requestee_id' => $account->uid, 'approved' => FALSE));
   foreach ($relationships as $relationship) {
-    $msg = user_relationships_ui_get_message('pending', $relationship, array(
+    $msg = user_relationships_get_message('pending', $relationship, array(
       '!pending_relationship_requests'  => l(t('pending relationship requests'), variable_get('user_relationships_requests_link', 'relationships/requests'))
     ));
 
@@ -275,43 +138,6 @@ function _user_relationships_ui_actions_between(&$viewer, &$viewed, $action_type
   return $list;
 }
 
-
-/**
- * Helper function to build the settings form for the notification messages
- */
-function _user_relationships_ui_message_settings_form(&$form, $defaults = array()) {
-
-  $replaceables = array(
-    '!requester',
-    '!requestee',
-    '%relationship_name',
-    '%relationship_plural_name',
-    '!pending_relationship_requests',
-  );
-
-  $translations = _user_relationships_ui_default_message_key_translations();
-  foreach ($defaults as $key => $value) {
-    if (is_array($value)) {
-      $form[$key] = array(
-        '#type'         => 'fieldset',
-        '#title'        => isset($translations[$key]) ? $translations[$key] : t(ucfirst(str_replace('_', ' ', $key))),
-        '#collapsible'  => TRUE,
-        '#collapsed'    => TRUE,
-        '#description'  => t('The following tokens are available for use in your custom messages: @replaceables.', array('@replaceables' => implode($replaceables, ', '))),
-        '#group'        => 'messages_settings',
-      );
-      _user_relationships_ui_message_settings_form($form[$key], $value);
-    }
-    else {
-      $form["user_relationships_ui_msg_{$key}"] = array(
-        '#type'           => 'textfield',
-        '#title'          => isset($translations[$key]) ? $translations[$key] : t(ucfirst(str_replace('_', ' ', $key))),
-        '#default_value'  => variable_get("user_relationships_ui_msg_{$key}", $value)
-      );
-    }
-  }
-}
-
 /**
  * Get relationship types that a user can request
  * TODO: factor out of .module into an include file
@@ -465,56 +291,6 @@ function user_relationships_ui_page_alter(&$page) {
  * Implements hook_menu().
  */
 function user_relationships_ui_menu() {
-  $items['admin/config/people/relationships'] = array(
-    'title' => 'Relationships',
-    'description' => 'Create relationship types',
-    'access arguments' => array('administer user relationships'),
-    'page callback' => 'user_relationships_ui_types_list_page',
-    'file' => 'user_relationships_ui.pages.inc',
-  );
-  $items['admin/config/people/relationships/list'] = array(
-    'title' => 'List',
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-    'page callback' => 'user_relationships_ui_types_list_page',
-    'access arguments' => array('administer user relationships'),
-    'file' => 'user_relationships_ui.pages.inc',
-  );
-  $items['admin/config/people/relationships/add'] = array(
-    'title' => 'Add relationship type',
-    'type' => MENU_LOCAL_ACTION,
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('user_relationships_ui_type_edit'),
-    'access arguments' => array('administer user relationships'),
-    'file' => 'user_relationships_ui.admin.inc',
-  );
-  $items['admin/config/people/relationships/%user_relationships_type/edit'] = array(
-    'title' => 'Edit type',
-    'type' => MENU_LOCAL_TASK,
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('user_relationships_ui_type_edit', 4),
-    'access arguments' => array('administer user relationships'),
-    'file' => 'user_relationships_ui.admin.inc',
-    'weight' => 5,
-  );
-  $items['admin/config/people/relationships/%user_relationships_type/delete'] = array(
-    'title' => 'Delete type',
-    'type' => MENU_LOCAL_TASK,
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('user_relationships_ui_type_delete', 4),
-    'access arguments' => array('administer user relationships'),
-    'file' => 'user_relationships_ui.admin.inc',
-    'weight' => 10,
-  );
-  $items['admin/config/people/relationships/settings'] = array(
-    'title' => 'Settings',
-    'type' => MENU_LOCAL_TASK,
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('user_relationships_ui_settings'),
-    'access arguments' => array('administer user relationships'),
-    'file' => 'user_relationships_ui.admin.inc',
-    'weight' => 20,
-  );
-
   $items['relationship_types/autocomplete'] = array(
     'title' => 'User Relationships Autocomplete',
     'type' => MENU_CALLBACK,
@@ -769,16 +545,6 @@ function user_relationships_ui_user_presave(&$edit, $account, $category) {
 }
 
 /**
- * Implementation of hook_locale().
- */
-function user_relationships_ui_locale($op = 'groups') {
-  switch ($op) {
-    case 'groups':
-      return array('user_relationships' => t('User Relationships'));
-  }
-}
-
-/**
  * Implementation of hook_theme().
  */
 function user_relationships_ui_theme() {
diff --git a/user_relationships_ui/user_relationships_ui.pages.inc b/user_relationships_ui/user_relationships_ui.pages.inc
index 63eb741..6256b3d 100644
--- a/user_relationships_ui/user_relationships_ui.pages.inc
+++ b/user_relationships_ui/user_relationships_ui.pages.inc
@@ -5,54 +5,6 @@
  */
 
 /**
- * Relationship Types List
- */
-function user_relationships_ui_types_list_page() {
-  $relationship_types = user_relationships_types_load();
-
-  $table['headers'] = array(t('Name'), t('Plural'), t('Type'), t('Requires Approval'), t('Expiration'), t('Operations'));
-  $table['data'] = array();
-  $table['rows'] = array();
-
-  foreach ($relationship_types as $relationship) {
-    $table['data'][] = $relationship;
-    $table['rows'][] = array(
-      $relationship->name,
-      $relationship->plural_name,
-      ($relationship->is_oneway ? ($relationship->is_reciprocal ? t('reciprocal') : t('one way')) : t('mutual')),
-      ($relationship->requires_approval ? t('yes') : t('no')),
-      ($relationship->expires_val ? t('@expires_val', array('@expires_val' => format_plural($relationship->expires_val, '1 day', '@count days'))) : t('Never')),
-      l(t('edit'),    "admin/config/people/relationships/{$relationship->rtid}/edit") .' | '.
-      l(t('delete'),  "admin/config/people/relationships/{$relationship->rtid}/delete")
-    );
-  }
-
-  foreach (module_implements('user_relationships_page_alter') as $module) {
-    $function = "{$module}_user_relationships_page_alter";
-    $function('types list', $page, $table);
-  }
-
-  if (!sizeof($table['rows'])) {
-    $table['rows'][] = array(array('data' => t('No relationships available.'), 'colspan' => sizeof($table['headers'])));
-  }
-
-  $page['relationships'] = array(
-    '#type'   => 'fieldset',
-    '#title'  => t('Relationship Types'),
-    '#weight' => 0,
-    // No automatic fieldset processing to avoid fatal error. Maybe a core bug?
-    '#pre_render' => array(),
-    // Avoid notice/error in seven theme.
-    '#attributes' => array(),
-  );
-  $page['relationships']['list'] = array(
-    '#markup' => theme('table', array('header' => $table['headers'], 'rows' => $table['rows']))
-  );
-
-  return drupal_render($page);
-}
-
-/**
  * Main list of relationships for a specified user
  */
 function user_relationships_page($account = NULL, $rtid = NULL) {
-- 
1.7.4.1

