$mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80));
$mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'),
false, true, false, get_string("keyiprestrictionhelp", 'userkey')));
+ $mform->setDefault('iprestriction', getremoteaddr()); // own IP - just in case somebody does not know what user key is
$mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true));
$mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'),
false, true, false, get_string("keyvaliduntilhelp", 'userkey')));
+ $mform->setDefault('validuntil', time()+3600*24*7); // only 1 week default duration - just in case somebody does not know what user key is
+
$mform->disabledIf('iprestriction', 'key', 'noteq', 1);
$mform->disabledIf('validuntil', 'key', 'noteq', 1);
}
$mform->addElement('text', 'iprestriction', get_string('keyiprestriction', 'userkey'), array('size'=>80));
$mform->setHelpButton('iprestriction', array(false, get_string('keyiprestriction', 'userkey'),
false, true, false, get_string("keyiprestrictionhelp", 'userkey')));
+ $mform->setDefault('iprestriction', getremoteaddr()); // own IP - just in case somebody does not know what user key is
$mform->addElement('date_time_selector', 'validuntil', get_string('keyvaliduntil', 'userkey'), array('optional'=>true));
$mform->setHelpButton('validuntil', array(false, get_string('keyvaliduntil', 'userkey'),
false, true, false, get_string("keyvaliduntilhelp", 'userkey')));
+ $mform->setDefault('validuntil', time()+3600*24*7); // only 1 week default duration - just in case somebody does not know what user key is
$mform->disabledIf('iprestriction', 'key', 'noteq', 1);
$mform->disabledIf('validuntil', 'key', 'noteq', 1);