View Issue Details

IDProjectCategoryView StatusLast Update
0003876mantisbtbugtrackerpublic2004-07-07 20:11
Reporterchristianh Assigned Toint2str  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0003876: Allow users to update their real name field
Description

Patch attached

Additional Information

Against 0.18.3

TagsNo tags attached.
Attached Files
user_edit_realname.diff (3,959 bytes)   
diff -urb mantis-0.18.3/account_page.php mantis/account_page.php
--- mantis-0.18.3/account_page.php	Sun Jan 11 17:16:04 2004
+++ mantis/account_page.php	Wed May 26 11:52:32 2004
@@ -156,6 +156,16 @@
 	</tr>
 
 <?php } ?> <!-- End LDAP Email conditional -->
+
+	<!-- Realname -->
+	<tr class="row-1" valign="top">
+		<td class="category">
+			<?php echo lang_get( 'realname' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="64" name="realname" value="<?php echo $u_realname ?>" />
+		</td>
+	</tr>
 
 	<!-- Access level -->
 	<tr class="row-2">
diff -urb mantis-0.18.3/account_update.php mantis/account_update.php
--- mantis-0.18.3/account_update.php	Sat Feb  7 22:53:40 2004
+++ mantis/account_update.php	Wed May 26 11:41:56 2004
@@ -30,6 +30,7 @@
 	$f_email			= gpc_get_string( 'email', '' );
 	$f_password			= gpc_get_string( 'password', '' );
 	$f_password_confirm	= gpc_get_string( 'password_confirm', '' );
+	$f_realname			= gpc_get_string( 'realname', '' );
 
 	$f_email = email_append_domain( $f_email );
 
@@ -52,6 +53,11 @@
 	if ( $f_email != user_get_email( $t_user_id ) ) {
 		user_set_email( $t_user_id, $f_email );
 		echo lang_get( 'email_updated' ) . '<br />';
+	}
+
+	if ( $f_realname != user_get_name( $t_user_id ) ) {
+		user_set_realname( $t_user_id, $f_realname );
+		echo lang_get( 'realname_updated' ) . '<br />';
 	}
 
 	# Update password if the two match and are not empty
diff -urb mantis-0.18.3/core/user_api.php mantis/core/user_api.php
--- mantis-0.18.3/core/user_api.php	Sun Jan 11 17:16:10 2004
+++ mantis/core/user_api.php	Wed May 26 11:56:10 2004
@@ -465,6 +466,14 @@
 	}
 
 	# --------------------
+	# lookup the user's realname
+	function user_get_realname( $p_user_id ) {
+		$row = user_cache_row( $p_user_id, false );
+
+		return $row['realname'];
+	}
+
+	# --------------------
 	# return the username or a string saying "user no longer exists"
 	#  if the user does not exist
 	function user_get_name( $p_user_id ) {
@@ -722,6 +731,14 @@
 	}
 
 	# --------------------
+	# Set the user's realname to the given string after checking validity
+	function user_set_realname( $p_user_id, $p_realname ) {
+		ensure_name_valid( $p_realname );
+
+		return user_set_field( $p_user_id, 'realname', $p_realname );
+	}
+
+	# --------------------
 	# Set the user's username to the given string after checking that it is valid
 	function user_set_name( $p_user_id, $p_username ) {
 		user_ensure_name_valid( $p_username );
diff -urb mantis-0.18.3/lang/strings_english.txt mantis/lang/strings_english.txt
--- mantis-0.18.3/lang/strings_english.txt	Sun Feb 22 14:26:48 2004
+++ mantis/lang/strings_english.txt	Wed May 26 11:48:53 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';
@@ -354,6 +355,7 @@
 # account_update.php
 $s_account_updated_msg = 'Your account has been successfully updated...';
 $s_email_updated = 'Email address successfully updated';
+$s_realname_updated = 'Real name successfully updated';
 $s_password_updated = 'Password successfully updated';
 
 # bug_assign.php
diff -urb mantis-0.18.3/manage_user_edit_page.php mantis/manage_user_edit_page.php
--- mantis-0.18.3/manage_user_edit_page.php	Sun Jan 11 17:16:06 2004
+++ mantis/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">
user_edit_realname.diff (3,959 bytes)   

Activities

int2str

int2str

2004-05-25 21:27

reporter   ~0005586

Patch applied with some modifications. For example ensure_name_valid() doesn't exist. I commented it out for now. Also changet the user_get_realname() function a bit.

Thanks for the patch!

Related Changesets

MantisBT: master 85c26fde

2004-05-25 22:28

int2str


Details Diff
Applied Cristian Hack's patch to allow users to edit their real name (Bug 3876).

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2572 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9
Affected Issues
0003876
mod - manage_user_edit_page.php Diff File
mod - account_page.php Diff File
mod - core/user_api.php Diff File
mod - account_update.php Diff File
mod - lang/strings_english.txt Diff File