original_string: public static function get_user_by_email($email, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
          global $DB, $CFG;
  
          // Because we use the username as the search criteria, we must also restrict our search based on mnet host.
          if (empty($mnethostid)) {
              // If empty, we restrict to local users.
              $mnethostid = $CFG->mnet_localhost_id;
          }
  
          return $DB->get_record('user', array('email' => $email, 'mnethostid' => $mnethostid), $fields, $strictness);
      }
code: public static function get_user_by_email($email, $fields = '*', $mnethostid = null, $strictness = IGNORE_MISSING) {
          global $DB, $CFG;
  
          // Because we use the username as the search criteria, we must also restrict our search based on mnet host.
          if (empty($mnethostid)) {
              // If empty, we restrict to local users.
              $mnethostid = $CFG->mnet_localhost_id;
          }
  
          return $DB->get_record('user', array('email' => $email, 'mnethostid' => $mnethostid), $fields, $strictness);
      }
code_tokens: public static function get_user_by_email ( $ email , $ fields = '*' , $ mnethostid = null , $ strictness = IGNORE_MISSING ) { global $ DB , $ CFG ; // Because we use the username as the search criteria, we must also restrict our search based on mnet host. if ( empty ( $ mnethostid ) ) { // If empty, we restrict to local users. $ mnethostid = $ CFG -> mnet_localhost_id ; } return $ DB -> get_record ( 'user' , array ( 'email' => $ email , 'mnethostid' => $ mnethostid ) , $ fields , $ strictness ) ; }
docstring: Return user object from db based on their email.
  
  @param string $email The email of the user searched.
  @param string $fields A comma separated list of user fields to be returned, support and noreply user.
  @param int $mnethostid The id of the remote host.
  @param int $strictness IGNORE_MISSING means compatible mode, false returned if user not found, debug message if more found;
  IGNORE_MULTIPLE means return first user, ignore multiple user records found(not recommended);
  MUST_EXIST means throw an exception if no user record or multiple records found.
  @return stdClass|bool user record if found, else false.
  @throws dml_exception if user record not found and respective $strictness is set.
docstring_tokens: Return user object from db based on their email .