diff --git a/index.php b/index.php index aad2d46..e77e675 100644 --- a/index.php +++ b/index.php @@ -132,10 +132,16 @@ if ($formdata = $mform->get_data()) { $where_params = $where_params + $param_options; } } + + // Email filter + if (array_key_exists('email', $formdata)) { + $email_like = $DB->sql_like('u.email', "'%{$formdata->email}%'", false); + $whereors[] = "($email_like)"; + } } // Role filter -if (array_key_exists('role', $formdata)) { +if ($formdata and array_key_exists('role', $formdata)) { list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($formdata->role), SQL_PARAMS_NAMED); } else { list($in_roles, $param_roles) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED); diff --git a/report_form.php b/report_form.php index ae68973..f2419b7 100644 --- a/report_form.php +++ b/report_form.php @@ -52,6 +52,9 @@ class filter_form extends moodleform { $filterfields = $this->_filterfields; $roles = $this->_roles; + // User fields filter + $mform->addElement('text', 'email', get_string('email')); + // Role filter $mform->addElement('header', 'filter', get_string('roles')); foreach ($roles as $role) {