public function is_participant($userid=null) {
        global $USER, $DB;

        if (is_null($userid)) {
            $userid = $USER->id;
        }

        list($sql, $params) = $this->get_participants_sql();

        if (empty($sql)) {
            return false;
        }

        $sql = "SELECT COUNT(*)
                  FROM {user} uxx
                  JOIN ({$sql}) pxx ON uxx.id = pxx.id
                 WHERE uxx.id = :uxxid";
        $params['uxxid'] = $userid;

        if ($DB->count_records_sql($sql, $params)) {
            return true;
        }

        return false;
    }
public function is_participant($userid=null) {
        global $USER, $DB;

        if (is_null($userid)) {
            $userid = $USER->id;
        }

        list($sql, $params) = $this->get_participants_sql();

        if (empty($sql)) {
            return false;
        }

        $sql = "SELECT COUNT(*)
                  FROM {user} uxx
                  JOIN ({$sql}) pxx ON uxx.id = pxx.id
                 WHERE uxx.id = :uxxid";
        $params['uxxid'] = $userid;

        if ($DB->count_records_sql($sql, $params)) {
            return true;
        }

        return false;
    }
public function is_participant ( $ userid = null ) { global $ USER , $ DB ; if ( is_null ( $ userid ) ) { $ userid = $ USER -> id ; } list ( $ sql , $ params ) = $ this -> get_participants_sql ( ) ; if ( empty ( $ sql ) ) { return false ; } $ sql = "SELECT COUNT(*)
                  FROM {user} uxx
                  JOIN ({$sql}) pxx ON uxx.id = pxx.id
                 WHERE uxx.id = :uxxid" ; $ params [ 'uxxid' ] = $ userid ; if ( $ DB -> count_records_sql ( $ sql , $ params ) ) { return true ; } return false ; }
Checks if the given user is an actively enrolled participant in the workshop

@param int $userid, defaults to the current $USER
@return boolean
Checks if the given user is an actively enrolled participant in the workshop