includes/template.php
changeset 1352 d97cf005f674
parent 1344 dc96d6c5cd1e
child 1361 26e80700ff1d
child 1363 f1ed3e9298ae
--- a/includes/template.php	Fri Jul 22 23:14:06 2011 -0400
+++ b/includes/template.php	Sun Sep 04 02:32:49 2011 -0400
@@ -2118,6 +2118,15 @@
  	
 	function username_field($name, $value = false)
 	{
+		global $db, $session, $paths, $template, $plugins; // Common objects
+		
+		$value = $value ? htmlspecialchars($value) : false;
+		
+		$val = $value ? "value=\"" . $value . "\"" : "";
+		
+		if ( $session->user_id == 1 && getConfig('autofill_username_for_guests', 0) != 1 )
+			return "<input name=\"$name\" type=\"text\" size=\"30\" $val />";
+		
 		$randomid = md5( time() . microtime() . mt_rand() );
 		$text = '<input name="'.$name.'" class="autofill username" onkeyup="new AutofillUsername(this);" type="text" size="30" id="userfield_'.$randomid.'" autocomplete="off"';
 		if($value) $text .= ' value="'.$value.'"';