View Issue Details

IDProjectCategoryView StatusLast Update
0003841mantisbtfeaturepublic2004-07-07 20:10
Reporterchristianh Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version0.18.3 
Fixed in Version0.19.0a1 
Summary0003841: Add real name ability to mantis
Description

I've been carrying this one for a while and with the release of 0.18.3 I decided I would really like to get it the main stream. Basically I'm sick of porting it in every time.

Basically it adds a "Real Name" field for users which gets displayed in most places. Currently it's not configurable to display either, but I could add that option if required.

One thing I haven't covered is upgrading the DB. Creating a new one will be OK, but for my existing DB, I created the field by hand.

Additional Information

Patch attached

TagsNo tags attached.
Attached Files
realname.diff (8,601 bytes)   
diff -urb mantis-0.18.3/core/html_api.php mantis.custom/core/html_api.php
--- mantis-0.18.3/core/html_api.php	Sun Feb 29 19:07:44 2004
+++ mantis.custom/core/html_api.php	Thu May 13 10:17:57 2004
@@ -231,6 +231,7 @@
 		$t_username = current_user_get_field( 'username' );
 		$t_access_level = get_enum_element( 'access_levels', current_user_get_access_level() );
 		$t_now = date( config_get( 'complete_date_format' ) );
+		$t_realname = current_user_get_field( 'realname' );
 
 		echo '<table class="hide">';
 		echo '<tr>';
@@ -251,7 +252,8 @@
 						echo ' | <a href="signup_page.php">' . lang_get( 'signup_link' ) . '</a>';
 					}
 				} else {
-					echo lang_get( 'logged_in_as' ) . ": <span class=\"italic\">$t_username</span> <span class=\"small\">($t_access_level)</span>";
+					echo lang_get( 'logged_in_as' ) . ": <span class=\"italic\">$t_username</span> <span class=\"small\">($t_realname - $t_access_level)</span>";
 				}
 			echo '</td>';
 			echo '<td class="login-info-middle">';
diff -urb mantis-0.18.3/core/user_api.php mantis.custom/core/user_api.php
--- mantis-0.18.3/core/user_api.php	Sun Jan 11 17:16:10 2004
+++ mantis.custom/core/user_api.php	Wed Feb  4 11:11:48 2004
@@ -227,7 +227,7 @@
 	# --------------------
 	# Create a user.
 	# returns false if error, the generated cookie string if ok
-	function user_create( $p_username, $p_password, $p_email='', $p_access_level=null, $p_protected=false, $p_enabled=true ) {
+	function user_create( $p_username, $p_password, $p_email='', $p_access_level=null, $p_protected=false, $p_enabled=true, $p_realname='' ) {
 		if ( null === $p_access_level ) {
 			$p_access_level = config_get( 'default_new_account_access_level');
 		}
@@ -235,6 +235,7 @@
 		$t_password = auth_process_plain_password( $p_password );
 
 		$c_username		= db_prepare_string( $p_username );
+		$c_realname		= db_prepare_string( $p_realname );
 		$c_password		= db_prepare_string( $t_password );
 		$c_email		= db_prepare_string( $p_email );
 		$c_access_level	= db_prepare_int( $p_access_level );
@@ -252,10 +253,10 @@
 
 		$query = "INSERT INTO $t_user_table
 				    ( id, username, email, password, date_created, last_visit,
-				     enabled, access_level, login_count, cookie_string )
+				     enabled, access_level, login_count, cookie_string, realname )
 				  VALUES
 				    ( null, '$c_username', '$c_email', '$c_password', NOW(), NOW(),
-				     $c_enabled, $c_access_level, 0, '$t_cookie_string')";
+				     $c_enabled, $c_access_level, 0, '$t_cookie_string', '$c_realname')";
 		db_query( $query );
 
 		# Create preferences for the user
@@ -473,7 +474,9 @@
 		if ( false == $row ) {
 			return lang_get( 'prefix_for_deleted_users' ) . (integer)$p_user_id;
 		} else {
-			return $row['username'];
+			return $row['realname'];
 		}
 	}
 
diff -urb mantis-0.18.3/lang/strings_english.txt mantis.custom/lang/strings_english.txt
--- mantis-0.18.3/lang/strings_english.txt	Sun Feb 22 14:26:48 2004
+++ mantis.custom/lang/strings_english.txt	Thu May 13 10:14:18 2004
@@ -289,6 +289,7 @@
 $s_change_preferences_link = 'Preferences';
 $s_edit_account_title = 'Edit Account';
 $s_username = 'Username';
+$s_realname = 'Real Name';
 $s_email = 'Email';
 $s_password = 'Password';
 $s_confirm_password = 'Confirm Password';
diff -urb mantis-0.18.3/manage_user_create.php mantis.custom/manage_user_create.php
--- mantis-0.18.3/manage_user_create.php	Sun Jan 11 17:16:06 2004
+++ mantis.custom/manage_user_create.php	Wed Feb  4 11:16:18 2004
@@ -20,6 +20,7 @@
 	access_ensure_global_level( config_get( 'manage_user_threshold' ) );
 
 	$f_username			= gpc_get_string( 'username' );
+	$f_realname			= gpc_get_string( 'realname' );
 	$f_password			= gpc_get_string( 'password' );
 	$f_password_verify	= gpc_get_string( 'password_verify' );
 	$f_email			= gpc_get_string( 'email' );
@@ -51,7 +52,7 @@
 				 lang_get( 'empty_password_button' ) );
 	}
 
-	user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled );
+	user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $f_realname );
 
 	$t_redirect_url = 'manage_user_page.php';
 
diff -urb mantis-0.18.3/manage_user_create_page.php mantis.custom/manage_user_create_page.php
--- mantis-0.18.3/manage_user_create_page.php	Sun Jan 11 17:16:06 2004
+++ mantis.custom/manage_user_create_page.php	Wed Feb  4 11:16:34 2004
@@ -36,6 +36,14 @@
 	</td>
 </tr>
 <tr <?php echo helper_alternate_class() ?>>
+	<td class="category" width="25%">
+		<?php echo lang_get( 'realname' ) ?>
+	</td>
+	<td width="75%">
+		<input type="text" name="realname" size="32" maxlength="32" />
+	</td>
+</tr>
+<tr <?php echo helper_alternate_class() ?>>
 	<td class="category">
 		<?php echo lang_get( 'email' ) ?>
 	</td>
diff -urb mantis-0.18.3/manage_user_edit_page.php mantis.custom/manage_user_edit_page.php
--- mantis-0.18.3/manage_user_edit_page.php	Sun Jan 11 17:16:06 2004
+++ mantis.custom/manage_user_edit_page.php	Wed Feb  4 11:16:56 2004
@@ -48,6 +48,16 @@
 	</td>
 </tr>
 
+<!-- Realname -->
+<tr <?php echo helper_alternate_class( 1 ) ?>>
+	<td class="category" width="30%">
+		<?php echo lang_get( 'realname' ) ?>:
+	</td>
+	<td width="70%">
+		<input type="text" size="16" maxlength="100" name="realname" value="<?php echo $t_user['realname'] ?>" />
+	</td>
+</tr>
+
 <!-- Email -->
 <tr <?php echo helper_alternate_class() ?>>
 	<td class="category">
diff -urb mantis-0.18.3/manage_user_page.php mantis.custom/manage_user_page.php
--- mantis-0.18.3/manage_user_page.php	Sun Jan 11 17:16:06 2004
+++ mantis.custom/manage_user_page.php	Wed Feb  4 11:17:20 2004
@@ -212,6 +212,10 @@
 		<?php print_sort_icon( $c_dir, $c_sort, 'username' ) ?>
 	</td>
 	<td>
+		<?php print_manage_user_sort_link(  'manage_user_page.php', lang_get( 'realname' ), 'realname', $c_dir, $c_sort, $c_hide ) ?>
+		<?php print_sort_icon( $c_dir, $c_sort, 'realname' ) ?>
+	</td>
+	<td>
 		<?php print_manage_user_sort_link(  'manage_user_page.php', lang_get( 'email' ), 'email', $c_dir, $c_sort, $c_hide ) ?>
 		<?php print_sort_icon( $c_dir, $c_sort, 'email' ) ?>
 	</td>
@@ -249,6 +253,7 @@
 	<td>
 		<a href="manage_user_edit_page.php?user_id=<?php echo $u_id ?>"><?php echo $u_username ?></a>
 	</td>
+	<td><?php echo $u_realname ?></td>
 	<td><?php print_email_link( $u_email, $u_email ) ?></td>
 	<td><?php echo get_enum_element( 'access_levels', $u_access_level ) ?></td>
 	<td><?php echo trans_bool( $u_enabled ) ?></td>
diff -urb mantis-0.18.3/manage_user_update.php mantis.custom/manage_user_update.php
--- mantis-0.18.3/manage_user_update.php	Sun Jan 11 17:16:06 2004
+++ mantis.custom/manage_user_update.php	Wed Feb  4 11:17:50 2004
@@ -23,6 +23,7 @@
 	$f_enabled		= gpc_get_bool( 'enabled' );
 	$f_email		= gpc_get_string( 'email', '' );
 	$f_username		= gpc_get_string( 'username', '' );
+	$f_realname		= gpc_get_string( 'realname', '' );
 	$f_access_level	= gpc_get_int( 'access_level' );
 	$f_user_id		= gpc_get_int( 'user_id' );
 
@@ -42,6 +43,7 @@
 
 	$c_email		= db_prepare_string( $f_email );
 	$c_username		= db_prepare_string( $f_username );
+	$c_realname		= db_prepare_string( $f_realname );
 	$c_protected	= db_prepare_bool( $f_protected );
 	$c_enabled		= db_prepare_bool( $f_enabled );
 	$c_user_id			= db_prepare_int( $f_user_id );
@@ -64,13 +66,13 @@
 	if ( $f_protected && $t_old_protected ) {
 	    $query = "UPDATE $t_user_table
 	    		SET username='$c_username', email='$c_email',
-	    			protected='$c_protected'
+	    			protected='$c_protected', realname='$c_realname'
 	    		WHERE id='$c_user_id'";
 	} else {
 	    $query = "UPDATE $t_user_table
 	    		SET username='$c_username', email='$c_email',
 	    			access_level='$c_access_level', enabled='$c_enabled',
-	    			protected='$c_protected'
+	    			protected='$c_protected', realname='$c_realname'
 	    		WHERE id='$c_user_id'";
 	}
 
diff -urb mantis-0.18.3/proj_doc_page.php mantis.custom/proj_doc_page.php
diff -urb mantis-0.18.3/sql/db_generate.sql mantis.custom/sql/db_generate.sql
--- mantis-0.18.3/sql/db_generate.sql	Sat Feb  7 05:44:24 2004
+++ mantis.custom/sql/db_generate.sql	Thu May 13 10:08:13 2004
@@ -695,6 +696,7 @@
   access_level int(2) NOT NULL default '10',
   login_count int(11) NOT NULL default '0',
   cookie_string varchar(64) NOT NULL default '',
+  realname varchar(128) NOT NULL default '',
   PRIMARY KEY  (id),
   UNIQUE KEY cookie_string (cookie_string),
   UNIQUE KEY username (username)
realname.diff (8,601 bytes)   
realname.zip (2,455 bytes)

Activities

sgrund

sgrund

2004-05-17 05:51

reporter   ~0005514

Just a 'me too'. We would like to distinguish between real name and account name.
So a additional Field would be great.

RJelinek

RJelinek

2004-05-17 06:38

reporter   ~0005516

Jest a 'me too' too...

Especially if you use the LDAP-feature it is a must, because logins are often unreadable.

vboctor

vboctor

2004-05-23 10:37

manager   ~0005567

I had a quick look at the patch, but didn't apply it yet.

From what I can see you added the real name field to the user information, manage user page, logged in user at the top, and that's it. So when showing the bug information, you use login name. Same for the View Bugs page. Is that right?

Should the real name be used in more places? Should it be a title for the login names? (i.e. appears as a bubble or status line message when mouse moves over a user name)?

christianh

christianh

2004-05-23 20:25

reporter   ~0005569

Thanks for looking at the patch.

In core/user_api.php the function user_get_name(user id) provides the real name substitution in almost all places - in fact this made it very easy to add. This is where I should add a config option correct? It probably should also allow for a null real name so that old installations still show the login name if no real name has been provided. Alternately, whatever upgrade process is applied could copy the login name to the real name field.

The only place I have really noticed it that it doesn't substitute is in the bug history section of emails. Otherwise the real name is substituted everywhere else that I have noticed.

Im not sure i understand this part of your query though:
"Should the real name be used in more places? Should it be a title for the login names? (i.e. appears as a bubble or status line message when mouse moves over a user name)"

sgrund

sgrund

2004-05-24 02:10

reporter   ~0005570

I don't know christianh's extension, but here's my opinion:
Use loginname only for login. For everey other purpose use real name.
It's a little security issue: most people uses the same login in mantis and other systems, some use even the same pasword. So, if mantis uname/passwd is compromised, a attacker can do 'nasty things' (he also have the email!)

vboctor

vboctor

2004-05-24 07:15

manager   ~0005571

Christianh, please attach a zip file with the modified file since I was not able to apply the patch.

With regards to my query, I was wondering whether we should use the realname everywhere except for login, or use login name in compact areas with a bubble which includes the real name (eg: View Bugs).

Note that in SourceForge, login names are used everywhere with the exception of one place where real names are used.

I am flexible both ways, but I just want to make sure we have considered such issues.

Also do we need 128 characters for the realname! Won't this be too big to display anyway?

christianh

christianh

2004-05-24 22:57

reporter   ~0005577

Patch attached as a zip. What was wrong exactly? Did it not patch cleanly? It was against 0.18.3 NOT CVS which could be the problem. I can probably redo it against CVS if you really need it. OK re-reading your note, you say attach the file since it didn't patch cleanly. I have attached all my files but be aware there are some other customizations in there (probably strings_english.txt) is the main one.

I have no problem with a shorter name. Perhaps 40 or 50 characters is acceptable. 128 is just what I happened to pick at the time.

You can only put bubbles over links though can't you? i.e. it can't just be over general text.

vboctor

vboctor

2004-05-24 23:43

manager   ~0005578

You can associate bubbles with normal text as well. To see this in action, move the mouse over the Status field in the View Bugs page, the resolution will appear as a bubble. I added the underline to sort of highlight this behaviour, but I guess it is not working very well :)

christianh

christianh

2004-05-25 00:34

reporter   ~0005579

OK Cool. HTML is not my thing. Have I attached what you wanted?

vboctor

vboctor

2004-05-25 08:37

manager   ~0005582

Implemented in CVS. Will be included in 0.19.0.