// We NEED to set this, because the form assumes it has a value!
$frm->id = empty($course->id) ? 0 : $course->id;
- if (empty($frm->username)) {
+ if (empty($frm->username) && !isguest()) {
$frm->username = $USER->username;
}
<tr valign="top">\r
<td><?php print_string("username") ?>:</td>\r
<td>\r
- <?php if (isadmin()) { ?>\r
+ <?php if (isadmin() || empty($frm->username)) { ?>\r
<input type="text" name="username" size="25" value="<?php p($frm->username) ?>" alt="<?php print_string("username") ?>" />\r
<?php } else { ?>\r
<input type="hidden" name="username" value="<?php p($frm->username)?>" /> <?php p($frm->username)?>\r