You are here

function user_relationship_defaults_load in User Relationships 7

Same name and namespace in other branches
  1. 5 plugins/user_relationship_defaults/user_relationship_defaults.module \user_relationship_defaults_load()
  2. 5.2 plugins/user_relationship_defaults/user_relationship_defaults.module \user_relationship_defaults_load()
  3. 6 user_relationship_defaults/user_relationship_defaults.module \user_relationship_defaults_load()

Public API to retrieve the full list of default relationships.

Return value

array of default relationship objects

5 calls to user_relationship_defaults_load()
hook_user_relationships_types_list_alter in ./user_relationships.api.php
Alter the relationship types listing page.
user_relationship_defaults_delete_form_submit in user_relationship_defaults/user_relationship_defaults.module
Process default relationship delete form submission.
user_relationship_defaults_user_relationships_types_list_alter in user_relationship_defaults/user_relationship_defaults.module
hook_user_relationships_admin_page_alter()
user_relationship_default_load in user_relationship_defaults/user_relationship_defaults.module
Public API for retrieving a default relationship.
_user_relationship_defaults_create_default_relationships in user_relationship_defaults/user_relationship_defaults.module

File

user_relationship_defaults/user_relationship_defaults.module, line 65
Drupal Module: User Relationship Defaults

Code

function user_relationship_defaults_load($reset = FALSE) {
  static $defaults = array();
  if ($reset || !$defaults) {
    $result = db_query("SELECT * FROM {user_relationship_defaults}");
    foreach ($result as $default) {
      $default->user = user_load($default->uid);
      $default->user_name = $default->user->name;
      $default->relationship_type = user_relationships_type_load($default->rtid);

      // Ignore default if relationship type does not exist.
      if (empty($default->relationship_type)) {
        continue;
      }
      foreach ((array) $default->relationship_type as $column => $value) {
        $default->{$column} = $value;
      }
      $defaults[$default->rdid] = $default;
    }
  }
  return $defaults;
}