Skip to content

Commit

Permalink
Applied Cristian Hack's patch to allow users to edit their real name …
Browse files Browse the repository at this point in the history
…(Bug 3876).

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2572 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
int2str committed May 26, 2004
1 parent e920a96 commit 85c26fd
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 8 deletions.
12 changes: 11 additions & 1 deletion account_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: account_page.php,v 1.44 2004-05-06 13:09:35 vboctor Exp $
# $Id: account_page.php,v 1.45 2004-05-26 02:28:54 int2str Exp $
# --------------------------------------------------------

# CALLERS
Expand Down Expand Up @@ -157,6 +157,16 @@

<?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">
<td class="category">
Expand Down
8 changes: 7 additions & 1 deletion account_update.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: account_update.php,v 1.34 2004-02-07 12:53:41 vboctor Exp $
# $Id: account_update.php,v 1.35 2004-05-26 02:28:55 int2str Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -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 );

Expand All @@ -54,6 +55,11 @@
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
if ( !is_blank( $f_password ) ) {
if ( $f_password != $f_password_confirm ) {
Expand Down
20 changes: 18 additions & 2 deletions core/user_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: user_api.php,v 1.72 2004-05-25 13:38:50 vboctor Exp $
# $Id: user_api.php,v 1.73 2004-05-26 02:28:55 int2str Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -464,6 +464,14 @@ function user_get_email( $p_user_id ) {
return $t_email;
}

# --------------------
# lookup the user's realname
function user_get_realname( $p_user_id ) {
$t_realname = user_get_field( $p_user_id, 'realname' );

return $t_realname;
}

# --------------------
# return the username or a string "user<id>" if the user does not exist
function user_get_name( $p_user_id ) {
Expand Down Expand Up @@ -718,6 +726,14 @@ function user_set_email( $p_user_id, $p_email ) {
return user_set_field( $p_user_id, 'email', $p_email );
}

# --------------------
# Set the user's realname to the given string after checking validity
function user_set_realname( $p_user_id, $p_realname ) {
# @@@ TODO: ensure_realname_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 ) {
Expand Down Expand Up @@ -769,4 +785,4 @@ function user_reset_password( $p_user_id, $p_send_email=true ) {

return true;
}
?>
?>
7 changes: 4 additions & 3 deletions lang/strings_english.txt
Expand Up @@ -9,11 +9,11 @@
###########################################################################
# English strings for Mantis
# -------------------------------------------------
# $Revision: 1.174 $
# $Revision: 1.175 $
# $Author: int2str $
# $Date: 2004-05-25 23:43:48 $
# $Date: 2004-05-26 02:28:55 $
#
# $Id: strings_english.txt,v 1.174 2004-05-25 23:43:48 int2str Exp $
# $Id: strings_english.txt,v 1.175 2004-05-26 02:28:55 int2str Exp $
###########################################################################
?>
<?php
Expand Down Expand Up @@ -369,6 +369,7 @@ $s_profile_updated_msg = 'Profile updated...';
# 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
Expand Down
12 changes: 11 additions & 1 deletion manage_user_edit_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: manage_user_edit_page.php,v 1.9 2004-05-25 13:38:52 vboctor Exp $
# $Id: manage_user_edit_page.php,v 1.10 2004-05-26 02:28:55 int2str Exp $
# --------------------------------------------------------
?>
<?php require_once( 'core.php' ) ?>
Expand Down Expand Up @@ -58,6 +58,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">
Expand Down

0 comments on commit 85c26fd

Please sign in to comment.