View Issue Details

IDProjectCategoryView StatusLast Update
0003481mantisbtbugtrackerpublic2017-09-14 11:03
ReporterKick The Donkey Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0003481: Complex Profiles: Add firstname, last name, phone numbers, and other email fields
Description

I noticed one of the long term goals of Mantis was to have more complex profiles. I'm opening this bug to provide tracking to complete this task. This feature would be a definite plus in the corporate enviroment, with multi-vendors/contractors/consultants.

Additional Information

The attached patch adds first name, last name, work phone, home phone, mobile phone, other phone, email2, and email3 to the user profiles in mantis. Also, it asks for a Fname and Lname at login. The account_page.php has also been modified , to allow users to fill in the other emails, and the phone numbers. (I've hacked together some LDAP functions. If someone has access to a LDAP setup, they need to be tested. Thanks).

This is designed to be a first step. The next patch that I'll submit will change the username listed on the bug_view_page.php to be First Name/Last Name (if present...).

Something else I'd like to work on would be viewable profiles, as mentioned in 0000561 (for that to work, a user pref would need to be added about public information.

Tagspatch
Attached Files
complex_profile.diff (22,578 bytes)   
Index: account_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/account_page.php,v
retrieving revision 1.41
diff -u -r1.41 account_page.php
--- account_page.php	27 Feb 2003 07:04:57 -0000	1.41
+++ account_page.php	4 Jan 2004 03:59:26 -0000
@@ -48,7 +48,7 @@
 
 	# extracts the user information for the currently logged in user
 	# and prefixes it with u_
-    $row = user_get_row( auth_get_current_user_id() );
+    	$row = user_get_row( auth_get_current_user_id() );
 	extract( $row, EXTR_PREFIX_ALL, 'u' );
 
 	$t_ldap = ( LDAP == config_get( 'login_method' ) );
@@ -56,6 +56,13 @@
 	# In case we're using LDAP to get the email address... this will pull out
 	#  that version instead of the one in the DB
 	$u_email = user_get_email( $u_id, $u_username );
+	if( $t_ldap ) {
+		# new function to return desired LDAP fields
+		$ldap_user_info = ldap_get_user_info( $u_username );
+		//over-write null values that should have been returned by
+		// db query.
+		extract ($row, EXTR_PREFIX_ALL, 'u' );
+	}
 
 	html_page_top1();
 	html_page_top2();
@@ -76,11 +83,15 @@
 			<?php print_account_menu( 'account_page.php' ) ?>
 		</td>
 	</tr>
+<?php
+//setup tbl row counter.  the table class used will be determined
+//by a if statement in the tr tag.
+$i = 0;
+?>
 
 <?php if ( $t_ldap ) { ?> <!-- With LDAP -->
-
 	<!-- Username -->
-	<tr class="row-1">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category" width="25%">
 			<?php echo lang_get( 'username' ) ?>
 		</td>
@@ -90,17 +101,36 @@
 	</tr>
 
 	<!-- Password -->
-	<tr class="row-2">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td colspan="2">
-			The password settings are controlled by your LDAP entry,<br />
-			hence cannot be edited here.
+			<?php echo lang_get( 'ldap_message' ) ?>
+		</td>
+	</tr>
+
+	<!-- firstname -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'firstname' ) ?>
+		</td>
+		<td>
+			<?php echo $u_firstname ?>
+		</td>
+	</tr>
+
+	<!-- lastname -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'lastname' ) ?>
+		</td>
+		<td>
+			<?php echo $u_lastname ?>
 		</td>
 	</tr>
 
 <?php } else { ?> <!-- Without LDAP -->
 
 	<!-- Username -->
-	<tr class="row-1">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category" width="25%">
 			<?php echo lang_get( 'username' ) ?>
 		</td>
@@ -110,7 +140,7 @@
 	</tr>
 
 	<!-- Password -->
-	<tr class="row-2">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'password' ) ?>
 		</td>
@@ -120,7 +150,7 @@
 	</tr>
 
 	<!-- Password confirmation -->
-	<tr class="row-2">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'confirm_password' ) ?>
 		</td>
@@ -129,36 +159,128 @@
 		</td>
 	</tr>
 
+	<!-- firstname -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'firstname' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="firstname" value="<?php echo $u_firstname; ?>"/>
+		</td>
+	</tr>
+
+	<!-- lastname -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'lastname' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="lastname" value="<?php echo $u_lastname; ?>"/>
+		</td>
+	</tr>
+	
+	
 <?php } ?> <!-- End LDAP conditional -->
 
 <?php if ( $t_ldap && ON == config_get( 'use_ldap_email' ) ) { ?> <!-- With LDAP Email-->
 
 	<!-- Email -->
-	<tr class="row-1">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'email' ) ?>
 		</td>
 		<td>
-			<?php echo $u_email ?>
+			<?php echo $u_email; 
+				   echo "&nbsp;" . lang_get ( 'email_note' );
+			?>
 		</td>
 	</tr>
 
 <?php } else { ?> <!-- Without LDAP Email -->
 
 	<!-- Email -->
-	<tr class="row-1">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'email' ) ?>
 		</td>
 		<td>
-			<?php print_email_input( 'email', $u_email ) ?>
+			<?php print_email_input( 'email', $u_email ); 
+				   echo "&nbsp;" . lang_get ( 'email_note' );
+			?>
 		</td>
 	</tr>
 
 <?php } ?> <!-- End LDAP Email conditional -->
 
+	<!-- Other Emails -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'email2' ) ?>
+		</td>
+		<td>
+			<?php print_email_input( 'email2', $u_email2 ) ?>
+		</td>
+	</tr>
+
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'email3' ) ?>
+		</td>
+		<td>
+			<?php print_email_input( 'email3', $u_email3 ) ?>
+		</td>
+	</tr>
+
+	<!-- Phone Numbers -->
+<?php if ( $t_ldap ) { ?> <!-- With LDAP -->
+
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'workphone' ) ?>
+		</td>
+		<td>
+			<?php echo $u_workphone; ?>
+		</td>
+	</tr>
+
+<?php } else { ?> <!-- Without LDAP -->
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'workphone' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="workphone" value="<?php echo $u_workphone; ?>"/>
+		</td>
+	</tr>
+
+<?php } ?> <!-- End LDAP conditional-->
+
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'homephone' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="homephone" value="<?php echo $u_homephone; ?>"/>
+		</td>
+	</tr>
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'mobilephone' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="mobilephone" value="<?php echo $u_mobilephone; ?>"/>
+		</td>
+	</tr>
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
+		<td class="category">
+			<?php echo lang_get( 'otherphone' ) ?>
+		</td>
+		<td>
+			<input type="text" size="32" maxlength="32" name="otherphone" value="<?php echo $u_otherphone; ?>"/>
+		</td>
+	</tr>
 	<!-- Access level -->
-	<tr class="row-2">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'access_level' ) ?>
 		</td>
@@ -168,7 +290,7 @@
 	</tr>
 
 	<!-- Project access level -->
-	<tr class="row-1">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>">
 		<td class="category">
 			<?php echo lang_get( 'access_level_project' ) ?>
 		</td>
@@ -178,7 +300,7 @@
 	</tr>
 
 	<!-- Assigned project list -->
-	<tr class="row-2" valign="top">
+	<tr class="<?php if ($i%2 == 0) { echo "row-2"; } else { echo "row-1"; } $i++; ?>" valign="top">
 		<td class="category">
 			<?php echo lang_get( 'assigned_projects' ) ?>
 		</td>
Index: account_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/account_update.php,v
retrieving revision 1.32
diff -u -r1.32 account_update.php
--- account_update.php	18 Feb 2003 02:18:00 -0000	1.32
+++ account_update.php	4 Jan 2004 03:59:26 -0000
@@ -16,24 +16,43 @@
 ?>
 <?php
 	require_once( 'core.php' );
-	
+
 	$t_core_path = config_get( 'core_path' );
-	
+
 	require_once( $t_core_path.'email_api.php' );
 ?>
 <?php
 	auth_ensure_user_authenticated();
-	
+
 	current_user_ensure_unprotected();
 ?>
 <?php
-	$f_email			= gpc_get_string( 'email', '' );
-	$f_password			= gpc_get_string( 'password', '' );
+	$f_email		= gpc_get_string( 'email', '' );
+	$f_password		= gpc_get_string( 'password', '' );
 	$f_password_confirm	= gpc_get_string( 'password_confirm', '' );
+	$f_fname		= gpc_get_string( 'firstname', '' );
+	$f_lname		= gpc_get_string( 'lastname', '' );
+	$f_email2		= gpc_get_string( 'email2', '' );
+	$f_email3		= gpc_get_string( 'email3', '' );
+	$f_workphone		= gpc_get_string( 'workphone', '' );
+	$f_homephone		= gpc_get_string( 'homephone', '' );
+	$f_mobilephone		= gpc_get_string( 'mobilephone', '' );
+	$f_otherphone		= gpc_get_string( 'otherphone', '' );
 
 	$f_email = email_append_domain( $f_email );
-
-	user_set_email( auth_get_current_user_id(), $f_email );
+	$current_uid = auth_get_current_user_id();
+	user_set_email( $current_uid, $f_email );
+	user_set_field( $current_uid, 'firstname', $f_fname );
+	user_set_field( $current_uid, 'lastname', $f_lname );
+	user_set_field( $current_uid, 'email2', $f_email2 );
+	user_set_field( $current_uid, 'email3', $f_email3 );
+	if( LDAP != config_get( 'login_method' ) ) {
+		// if using ldap, wphone will be pulled from there.
+		user_set_field( $current_uid, 'workphone', $f_workphone );
+	}
+	user_set_field( $current_uid, 'homephone', $f_homephone );
+	user_set_field( $current_uid, 'mobilephone', $f_mobilephone );
+	user_set_field( $current_uid, 'otherphone', $f_otherphone );
 
 	$t_redirect = 'account_page.php';
 
@@ -45,7 +64,7 @@
 
 	echo lang_get( 'operation_successful' );
 	echo '<br /><ul>';
-	echo '<li>' . lang_get( 'email_updated' ) . '</li>';
+	echo '<li>' . lang_get( 'account_updated_msg' ) . '</li>';
 
 	# Update password if the two match and are not empty
 	if ( !is_blank( $f_password ) ) {
Index: signup.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/signup.php,v
retrieving revision 1.32
diff -u -r1.32 signup.php
--- signup.php	18 Feb 2003 02:18:01 -0000	1.32
+++ signup.php	4 Jan 2004 03:59:26 -0000
@@ -13,11 +13,15 @@
 	require_once( $t_core_path.'email_api.php' );
 ?>
 <?php
-	$f_username		= gpc_get_string( 'username' );
+	$f_username	= gpc_get_string( 'username' );
+	$f_firstname	= gpc_get_string( 'firstname' );
+	$f_lastname	= gpc_get_string( 'lastname' );
 	$f_email		= gpc_get_string( 'email' );
 
-	$f_username = trim( $f_username );
-	$f_email	= trim( $f_email );
+	$f_username	= trim( $f_username );
+	$f_firstname	= trim( $f_firstname );
+	$f_lastname	= trim( $f_lastname );
+	$f_email		= trim( $f_email );
 	
 	# Check to see if signup is allowed
 	if ( OFF == config_get( 'allow_signup' ) ) {
@@ -25,11 +29,11 @@
 		exit;
 	}
 
-	# check for empty username
-	if ( is_blank( $f_username ) ) {
+	# check for empty fields
+	if ( is_blank( $f_username ) || is_blank( $f_firstname ) || is_blank( $f_lastname ) ) {
 		print_mantis_error( ERROR_EMPTY_FIELD );
 	}
-
+	
 	$f_email = email_append_domain( $f_email );
 
 	# Check for a properly formatted email with valid MX record
@@ -38,14 +42,16 @@
 		echo $f_email.' '.lang_get( 'invalid_email' ).'<br />';
 		echo '<a href="signup_page.php">'.lang_get( 'proceed' ).'</a>';
 		exit;
-	}
-
+	}	
+	
 	# Passed our checks.  Insert into DB then send email.
-	if ( !user_signup( $f_username, $f_email ) ) {
+	if ( !user_signup( $f_username, $f_firstname, $f_lastname, $f_email )) {
 		echo lang_get( 'account_create_fail' ).'<br />';
 		echo '<a href="signup_page.php">'.lang_get( 'proceed' ).'</a>';
 		exit;
 	}
+	
+	
 ?>
 <?php html_page_top1() ?>
 <?php html_page_top2a() ?>
Index: signup_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/signup_page.php,v
retrieving revision 1.25
diff -u -r1.25 signup_page.php
--- signup_page.php	27 Feb 2003 08:14:58 -0000	1.25
+++ signup_page.php	4 Jan 2004 03:59:26 -0000
@@ -41,6 +41,23 @@
 		<input type="text" name="username" size="32" maxlength="32" />
 	</td>
 </tr>
+<tr class="row-1">
+	<td class="category" width="30%">
+		<?php echo lang_get( 'firstname' ) ?>:
+	</td>
+	<td width="70%">
+		<input type="text" name="firstname" size="32" maxlength="32" />
+	</td>
+</tr>
+<tr class="row-1">
+	<td class="category" width="30%">
+		<?php echo lang_get( 'lastname' ) ?>:
+	</td>
+	<td width="70%">
+		<input type="text" name="lastname" size="32" maxlength="32" />
+	</td>
+</tr>
+
 <tr class="row-2">
 	<td class="category">
 		<?php echo lang_get( 'email' ) ?>:
Index: core/ldap_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/ldap_api.php,v
retrieving revision 1.12
diff -u -r1.12 ldap_api.php
--- core/ldap_api.php	24 Oct 2003 12:44:26 -0000	1.12
+++ core/ldap_api.php	4 Jan 2004 03:59:27 -0000
@@ -70,6 +70,84 @@
 	}
 
 	# --------------------
+	# Return first name, last name and phone number from ldap to display.
+	#  returns an assoc array.
+	function ldap_get_user_info( $p_username ) {
+		$t_ldap_organization	= config_get( 'ldap_organization' );
+		$t_ldap_root_dn		= config_get( 'ldap_root_dn' );
+
+	    	$t_search_filter	= "(&$t_ldap_organization(uid=$p_username))";
+		$t_search_attrs		= array( 'uid', 'givenName','sn','telephoneNumber', 'dn' );
+	    	$t_ds			= ldap_connect_bind();
+
+		$t_sr	= ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs );
+		$t_info	= ldap_get_entries( $t_ds, $t_sr );
+		ldap_free_result( $t_sr );
+		ldap_unbind( $t_ds );
+
+		$result_array['firstname'] = $t_info[0]['givenName'][0];
+		$result_array['lastname']  = $t_info[0]['sn'][0];
+		//@@@ this assumes the number in ldap is the users workphone...  
+		$result_array['workphone'] = $t_info[0]['telephoneNumber'][0];
+
+		return $result_array;
+	}
+
+	# --------------------
+	# Return a first name from LDAP, given a username
+	function ldap_fname_from_username( $p_username ) {
+		$t_ldap_organization	= config_get( 'ldap_organization' );
+		$t_ldap_root_dn			= config_get( 'ldap_root_dn' );
+
+	    $t_search_filter	= "(&$t_ldap_organization(uid=$p_username))";
+		$t_search_attrs		= array( 'uid', 'givenname', 'dn' );
+	    $t_ds				= ldap_connect_bind();
+
+		$t_sr	= ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs );
+		$t_info	= ldap_get_entries( $t_ds, $t_sr );
+		ldap_free_result( $t_sr );
+		ldap_unbind( $t_ds );
+
+		return $t_info[0]['givenname'][0];
+	}
+
+	# --------------------
+	# Return a telephone number from LDAP, given a username
+	function ldap_tele_from_username( $p_username ) {
+		$t_ldap_organization	= config_get( 'ldap_organization' );
+		$t_ldap_root_dn			= config_get( 'ldap_root_dn' );
+
+	    $t_search_filter	= "(&$t_ldap_organization(uid=$p_username))";
+		$t_search_attrs		= array( 'uid', 'telephoneNumber', 'dn' );
+	    $t_ds				= ldap_connect_bind();
+
+		$t_sr	= ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs );
+		$t_info	= ldap_get_entries( $t_ds, $t_sr );
+		ldap_free_result( $t_sr );
+		ldap_unbind( $t_ds );
+
+		return $t_info[0]['telephoneNumber'][0];
+	}
+	
+	# --------------------
+	# Return an last name from LDAP, given a username
+	function ldap_lname_from_username( $p_username ) {
+		$t_ldap_organization	= config_get( 'ldap_organization' );
+		$t_ldap_root_dn			= config_get( 'ldap_root_dn' );
+
+	    $t_search_filter	= "(&$t_ldap_organization(uid=$p_username))";
+		$t_search_attrs		= array( 'uid', 'sn', 'dn' );
+	    $t_ds				= ldap_connect_bind();
+
+		$t_sr	= ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs );
+		$t_info	= ldap_get_entries( $t_ds, $t_sr );
+		ldap_free_result( $t_sr );
+		ldap_unbind( $t_ds );
+
+		return $t_info[0]['sn'][0];
+	}
+
+	# --------------------
 	# Return true if the $uid has an assigngroup=$p_group tag, false otherwise
 	function ldap_has_group( $p_user_id, $p_group ) {
 		$t_ldap_organization	= config_get( 'ldap_organization' );
Index: core/user_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/user_api.php,v
retrieving revision 1.63
diff -u -r1.63 user_api.php
--- core/user_api.php	17 Dec 2003 22:20:32 -0000	1.63
+++ core/user_api.php	4 Jan 2004 03:59:28 -0000
@@ -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_firstname, $p_lastname, $p_email='', $p_access_level=null, $p_protected=false, $p_enabled=true ) {
 		if ( null === $p_access_level ) {
 			$p_access_level = config_get( 'default_new_account_access_level');
 		}
@@ -236,10 +236,13 @@
 
 		$c_username		= db_prepare_string( $p_username );
 		$c_password		= db_prepare_string( $t_password );
-		$c_email		= db_prepare_string( $p_email );
+		$c_firstname		= db_prepare_string( $p_firstname );
+		$c_lastname		= db_prepare_string( $p_lastname );
+		$c_email			= db_prepare_string( $p_email );
+		
 		$c_access_level	= db_prepare_int( $p_access_level );
-		$c_protected	= db_prepare_bool( $p_protected );
-		$c_enabled		= db_prepare_bool( $p_enabled );
+		$c_protected		= db_prepare_bool( $p_protected );
+		$c_enabled			= db_prepare_bool( $p_enabled );
 
 		user_ensure_name_valid( $p_username );
 		user_ensure_name_unique( $p_username );
@@ -248,16 +251,20 @@
 		$t_seed = $p_email.$p_username;
 		$t_cookie_string	= auth_generate_unique_cookie_string( $t_seed );
 
-		$t_user_table 						= config_get( 'mantis_user_table' );
+		$t_user_table 	= config_get( 'mantis_user_table' );
 
 		$query = "INSERT INTO $t_user_table
-				    ( id, username, email, password, date_created, last_visit,
+				    ( id, username, firstname, lastname, email, password, date_created, last_visit,
 				     enabled, access_level, login_count, cookie_string )
 				  VALUES
-				    ( null, '$c_username', '$c_email', '$c_password', NOW(), NOW(),
+				    ( null, '$c_username', '$c_firstname', '$c_lastname', '$c_email', '$c_password', NOW(), NOW(),
 				     $c_enabled, $c_access_level, 0, '$t_cookie_string')";
+		
+		$fp = fopen("/tmp/debug.txt", 'w');
+		fwrite($fp,"$query");
+		fclose($fp);
 		db_query( $query );
-
+			
 		# Create preferences for the user
 		$t_user_id = db_insert_id();
 		user_pref_set_default( $t_user_id );
@@ -281,7 +288,7 @@
 	# If the use_ldap_email config option is on then tries to find email using
 	# ldap. $p_email may be empty, but the user wont get any emails.
 	# returns false if error, the generated cookie string if ok
-	function user_signup( $p_username, $p_email=null ) {
+	function user_signup( $p_username, $p_firstname, $p_lastname, $p_email=null ) {
 		if ( null === $p_email ) {
 			$p_email = '';
 
@@ -300,21 +307,36 @@
 /*			$t_email = '';
 			if ( ON == config_get( 'use_ldap_email' ) ) {
 				$t_email = ldap_email_from_username( $p_username );
+				$t_firstname = ldap_fname_from_username( $p_username );
+				$t_lastname = ldap_lname_from_username( $p_username );
 			} 
 
 			if ( ! is_blank( $t_email ) ) {
 				$p_email = $t_email;
+				
+			}
+
+			if ( ! is_blank( $t_firstname ) ) {
+				$p_firstname = $t_firstname;
+				
 			}
+
+			if ( ! is_blank( $t_lastname ) ) {
+				$p_lastname = $t_lastname;
+				
+			}			
 */
 		}
 
-		$p_email = trim( $p_email );
-
+		$p_email 		= trim( $p_email );
+		$p_firstname 	= trim( $p_firstname );
+		$p_lastname	= trim( $p_lastname );
+		
 		$t_seed = $p_email.$p_username;
 		# Create random password
 		$t_password	= auth_generate_random_password( $t_seed );
 
-		return user_create( $p_username, $t_password, $p_email );
+		return user_create( $p_username, $t_password, $p_firstname, $p_lastname, $p_email );
 	}
 
 	# --------------------
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.144
diff -u -r1.144 strings_english.txt
--- lang/strings_english.txt	11 Sep 2003 14:14:57 -0000	1.144
+++ lang/strings_english.txt	4 Jan 2004 03:59:29 -0000
@@ -280,11 +280,21 @@
 $s_change_preferences_link = 'Preferences';
 $s_edit_account_title = 'Edit Account';
 $s_username = 'Username';
+$s_firstname = 'First Name';
+$s_lastname = 'Last Name';
 $s_email = 'Email';
+$s_email_note = 'where system mail is sent';
+$s_email2 = 'Email 2';
+$s_email3 = 'Email 3';
+$s_homephone = 'Home Phone';
+$s_workphone = 'Work Phone';
+$s_mobilephone = 'Mobile Phone';
+$s_otherphone = 'Other Phone';
 $s_password = 'Password';
 $s_confirm_password = 'Confirm Password';
 $s_access_level = 'Access Level';
 $s_update_user_button = 'Update User';
+$s_ldap_message = 'The password is controlled by your LDAP entry. It cannot be edited here.';
 
 # account_prefs_page.php
 $s_default_account_preferences_title = 'Account Preferences';
Index: sql/db_generate.sql
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/sql/db_generate.sql,v
retrieving revision 1.14
diff -u -r1.14 db_generate.sql
--- sql/db_generate.sql	22 Mar 2003 10:53:25 -0000	1.14
+++ sql/db_generate.sql	4 Jan 2004 03:59:30 -0000
@@ -684,7 +684,15 @@
 CREATE TABLE mantis_user_table (
   id int(7) unsigned NOT NULL auto_increment,
   username varchar(32) NOT NULL default '',
+  firstname varchar(64) NOT NULL default '',
+  lastname varchar(64) NOT NULL default '',
   email varchar(64) NOT NULL default '',
+  email2 varchar(64) NULL,
+  email3 varchar(64) NULL,
+  workphone varchar(20) NULL,
+  homephone varchar(20) NULL,
+  mobilephone varchar(20) NULL,
+  otherphone varchar(20) NULL,
   password varchar(32) NOT NULL default '',
   date_created datetime NOT NULL default '1970-01-01 00:00:01',
   last_visit datetime NOT NULL default '1970-01-01 00:00:01',
@@ -702,5 +710,5 @@
 # Dumping data for table 'mantis_user_table'
 #
 
-INSERT INTO mantis_user_table VALUES (1,'administrator','admin','63a9f0ea7bb98050796b649e85481845','2003-02-16 02:03:48','2003-02-16 02:36:38',1,1,90,3,'MN91uSF/JIhos8bcda8acc2ead8d60749ad019e56b54fadkPGTyoBgNBQf91563');
+INSERT INTO mantis_user_table VALUES (1,'administrator','Mantis','Admin','admin',NULL,NULL,NULL,NULL,NULL,NULL,'63a9f0ea7bb98050796b649e85481845','2003-02-16 02:03:48','2003-02-16 02:36:38',1,1,90,3,'MN91uSF/JIhos8bcda8acc2ead8d60749ad019e56b54fadkPGTyoBgNBQf91563');
 
complex_profile.diff (22,578 bytes)   

Relationships

related to 0005278 new custom field for user accounts 
has duplicate 0023359 closedatrol I would like to add in the user register telenone number 

Activities

vboctor

vboctor

2004-01-10 03:37

manager   ~0004869

I had a quick look at the patch, and following are my initial comments:

  • Where are email2, and email3 used? Do we ever send email notifications to them.
  • The upgrade scripts need to be modified to include the database changes.

I still need to apply the patch and look at the usability.

Generally, we only do such changes on major release (next one is 0.19.0). So I am not sure how soon we will get it in, but using our new upgrade system, it may be possible to include it soon.

We need to do more work on making sure that this patch is compatible with the planned concept of Mantis complex profiles.

Kick The Donkey

Kick The Donkey

2004-01-10 04:42

reporter   ~0004870

The email2 and email3 fields where used at my work. Most people there have a work email, an interactive pager (which is just an email), as well as make thier home email's available occasionally. When I modified Mantis to add them, I never intended for system email to be sent to them. I suppose that could be made an option, if mantis decides to keep these two fields. No big deal either way.

The idea was, to provide a more complete user profile, then give other users access to information (like a memberlist) ((for a system like mantis, the public information would need to be an option in the profile. like phpbb2)). Hence, the phone numbers and extra informaiton. This works well at my work, where we have multiple vendors, contractors, and employees from different locales working on the same project. I've got a pretty nasty hack at work that adds a member-profile-viewer. I'm cleaning it up, trying to make it more 'mantis-like'.

In hind-sight, I should have added a location field, too.

<i>The upgrade scripts need to be modified to include the database changes. </i>

Doh! Should have thought of that... I'll submit a patch for that, too.

<i>We need to do more work on making sure that this patch is compatible with the planned concept of Mantis complex profiles. </i>

That's cool. What exactly are the planned goals? Is the 'roadmap' still current?

ddante

ddante

2013-05-08 04:24

reporter   ~0036803

Hello, what should I do to implement this patch to version 1.2.15 ??

atrol

atrol

2013-05-08 05:13

developer   ~0036806

ddante, the attached patch works only for a quite old version of MantisBT.
To get it run for 1.2.15 means a nearly complete rewrite.

ddante

ddante

2013-05-08 08:41

reporter   ~0036813

Ok, I understand. Is it planned in the future to do this?

atrol

atrol

2013-05-08 11:43

developer   ~0036815

ddante, it all depends on priority and a developer or community member deciding to spend their time on a specific issue.

Submitting a patch is always a good idea, as it increases the chances of improvement eventually making it into MantisBT core. All contributions are welcome and greatly appreciated.

Patch submissions can be made in several ways. In the order of preference:

  1. Send us a Pull Request on our Github repository [1]
  2. Attach a GIT patch to the issue
  3. Attach a Unified Diff, clearly specifying the patch's base release

Kindly avoid to upload entire modified PHP files.

Please make sure that your submissions adhere to our Coding Guidelines [2], if they don't your patch might be rejected.

[1] https://github.com/mantisbt/mantisbt
[2] http://www.mantisbt.org/wiki/doku.php/mantisbt:coding_guidelines