You are here

function set_user_values in Patterns 7.2

Wraps the call to drupal_form_submit for 'user_profile_form'. Gathers all the expected values from the form and prepare them for the query.

Parameters

string $form_id String containing the form ID. In the case of custom functions the value is empty.:

array $form_state Set of values after parsing the action.:

1 string reference to 'set_user_values'
user_patterns in patterns_components/components/user.inc
Implements hook_patterns() for the user module.

File

patterns_components/components/user.inc, line 635

Code

function set_user_values($form_id, &$form_state) {

  // The only mandatory attribute is uid, but it should not be re-validate it (we are imitating the behaviour of the form execution)
  $uid = $form_state['values']['uid'];

  //Prepare all the attributes for the query, but uid
  $attributes = array_diff_key($form_state['values'], array(
    'uid' => $uid,
  ));
  patterns_set_user_values($uid, $attributes);
  $msg = t('Information for user %uid successfully updated.', array(
    '%uid' => $uid,
  ));
  return patterns_results(PATTERNS_SUCCESS, $msg);
}