You are here

function avatar_selection_user in Avatar Selection 5

Same name and namespace in other branches
  1. 5.2 avatar_selection.module \avatar_selection_user()

File

./avatar_selection.module, line 194

Code

function avatar_selection_user($op, &$edit, &$user, $category = 'account') {
  global $form_values;
  switch ($op) {
    case 'validate':
      $file = file_check_upload('picture_upload');
      if (!$file && $edit['select_avatar']) {
        $form_values['picture'] = $edit['select_avatar'];
      }
      else {
        if (!$file && variable_get('avatar_selection_set_random_default', FALSE)) {
          $form_values['picture'] = avatar_selection_get_random_image($user);
        }
      }
      break;
  }
}