Permalink
Browse files

Merge branch 'wip-mdl-37339' of git://github.com/rajeshtaneja/moodle

  • Loading branch information...
nebgor committed Jan 22, 2013
2 parents 397ccf1 + 3ac4ad0 commit 072844a158ac02217e02706e4c2131520a1e49c0
Showing with 13 additions and 3 deletions.
  1. +13 −3 user/profile/lib.php
View
@@ -129,9 +129,19 @@ function edit_validate_field($usernew) {
global $DB;
$errors = array();
- /// Check for uniqueness of data if required
- if ($this->is_unique()) {
- $value = (is_array($usernew->{$this->inputname}) and isset($usernew->{$this->inputname}['text'])) ? $usernew->{$this->inputname}['text'] : $usernew->{$this->inputname};
+ // Get input value.
+ if (isset($usernew->{$this->inputname})) {
+ if (is_array($usernew->{$this->inputname}) && isset($usernew->{$this->inputname}['text'])) {
+ $value = $usernew->{$this->inputname}['text'];
+ } else {
+ $value = $usernew->{$this->inputname};
+ }
+ } else {
+ $value = '';
+ }
+
+ // Check for uniqueness of data if required.
+ if ($this->is_unique() && (($value !== '') || $this->is_required())) {
$data = $DB->get_records_sql('
SELECT id, userid
FROM {user_info_data}

0 comments on commit 072844a

Please sign in to comment.