protected function validate_userid($value) {
        global $DB;

        // During create.
        if (!$this->get('id')) {

            // Check that the user exists. We do not need to do that on update because
            // the userid of a plan should never change.
            if (!$DB->record_exists('user', array('id' => $value))) {
                return new lang_string('invaliddata', 'error');
            }

        }

        return true;
    }
protected function validate_userid($value) {
        global $DB;

        // During create.
        if (!$this->get('id')) {

            // Check that the user exists. We do not need to do that on update because
            // the userid of a plan should never change.
            if (!$DB->record_exists('user', array('id' => $value))) {
                return new lang_string('invaliddata', 'error');
            }

        }

        return true;
    }
protected function validate_userid ( $ value ) { global $ DB ; // During create. if ( ! $ this -> get ( 'id' ) ) { // Check that the user exists. We do not need to do that on update because // the userid of a plan should never change. if ( ! $ DB -> record_exists ( 'user' , array ( 'id' => $ value ) ) ) { return new lang_string ( 'invaliddata' , 'error' ) ; } } return true ; }
Validate the user ID.

@param  int $value
@return true|lang_string
Validate the user ID .