You are here

function user_relationship_elaborations_request_submit in User Relationships 7

Same name and namespace in other branches
  1. 6 user_relationship_elaborations/user_relationship_elaborations.module \user_relationship_elaborations_request_submit()

Submit handler to store the elaboration for the relationship

1 string reference to 'user_relationship_elaborations_request_submit'
user_relationship_elaborations_form_alter in user_relationship_elaborations/user_relationship_elaborations.module
hook_form_alter() to catch the approval form

File

user_relationship_elaborations/user_relationship_elaborations.module, line 181
User Relationships Elaborations feature @author Jeff Smick (creator) @author Darren Ferguson http://drupal.org/user/70179

Code

function user_relationship_elaborations_request_submit($form, &$form_state) {

  // If an elaboration has been entered we should retrieve the relationship that has just been
  // Created between the two users and associate the elaboration text with the relationship id
  if (drupal_strlen($form_state['values']['elaboration'])) {
    $requester = $form_state['values']['requester'];
    $requestee = $form_state['values']['requestee'];
    $relationships = user_relationships_load(array(
      'between' => array(
        $requester,
        $requestee,
      ),
      'rtid' => $form_state['values']['rtid'],
    ));
    foreach ($relationships as $relationship) {
      user_relationships_save_elaboration($relationship->rid, $form_state['values']['elaboration']);
    }
  }
}