Permalink
Browse files

Merge branch 'wip-mdl-37339-m23' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_23_STABLE
  • Loading branch information...
2 parents 38f6881 + b3f92c0 commit e88dfd38bdca70f45dbb2126f05d8d1f40fdb03b @nebgor nebgor committed Jan 22, 2013
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 e88dfd3

Please sign in to comment.