You are here

function user_relationships_request_form in User Relationships 5

Same name and namespace in other branches
  1. 5.2 user_relationships_forms.inc \user_relationships_request_form()

Request new user to user relationship

2 calls to user_relationships_request_form()
user_relationships_request in ./user_relationships_forms.inc
Request a new relationship with another user
user_relationship_invites_form_alter in plugins/user_relationship_invites/user_relationship_invites.module
Implements hook_form_alter()

File

./user_relationships_forms.inc, line 172

Code

function user_relationships_request_form(&$requester, &$requestee, $form_values = NULL) {
  $current_relationships = _user_relationships_current_relationships($requester, $requestee);
  $results = db_query("SELECT * FROM {user_relationship_types}" . ($current_relationships ? " WHERE rtid NOT IN (%s) ORDER BY name" : ''), implode(',', array_keys($current_relationships)));
  $relationships = array();
  while ($result = db_fetch_array($results)) {
    $relationships[$result['rtid']] = $result['name'];
  }
  $form['rtid'] = array(
    '#title' => t('My relationship is'),
    '#type' => 'select',
    '#options' => $relationships,
    '#default_value' => $form_values['rtid'],
  );
  $form['requester'] = array(
    '#type' => 'value',
    '#value' => $requester,
  );
  $form['requestee'] = array(
    '#type' => 'value',
    '#value' => $requestee,
  );
  return $form;
}