Skip to content

Commit

Permalink
Add an initial template for a view user page and modify code to link …
Browse files Browse the repository at this point in the history
…to this. This will be extended to include additional profile information and user custom fields in the future. As well as some view of a user's activities/role within project(s) etc. Currently, we only show realname and email address.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@5235 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
mantis committed May 3, 2008
1 parent c257019 commit 7492a25
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 7 deletions.
3 changes: 3 additions & 0 deletions config_defaults_inc.php
Expand Up @@ -324,6 +324,9 @@
# This specifies the access level that is needed to get the mailto: links.
$g_show_user_email_threshold = NOBODY;

# This specifies the access level that is needed to see realnames on user view page
$g_show_user_realname_threshold = NOBODY;

# If use_x_priority is set to ON, what should the value be?
# Urgent = 1, Not Urgent = 5, Disable = 0
# Note: some MTAs interpret X-Priority = 0 to mean 'Very Urgent'
Expand Down
8 changes: 2 additions & 6 deletions core/prepare_api.php
Expand Up @@ -55,12 +55,8 @@ function prepare_user_name( $p_user_id ) {

$t_username = user_get_name( $p_user_id );
if ( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) {
$t_email = user_get_email( $p_user_id );
if ( !is_blank( $t_email ) ) {
return prepare_email_link( $t_email, $t_username );
} else {
return string_display_line( $t_username );
}
$t_username = string_display_line( $t_username );
return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
} else {
$t_result = '<font STYLE="text-decoration: line-through">';
$t_result .= string_display_line( $t_username );
Expand Down
6 changes: 5 additions & 1 deletion lang/strings_english.txt
Expand Up @@ -1521,4 +1521,8 @@ $s_overdue = "Overdue";
# mind mapping
$s_mindmap = 'Mindmap';
$s_freemind_export = 'Freemind Export';
?>

#account_view_page.php
$s_view_account_title = 'User Information';

?>
116 changes: 116 additions & 0 deletions view_user_page.php
@@ -0,0 +1,116 @@
<?php
# Mantis - a php based bugtracking system

# Copyright (C) 2002 - 2008 Mantis Team - mantisbt-dev@lists.sourceforge.net

# Mantis is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Mantis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.

# --------------------------------------------------------
# $Id: view_user_page.php 5219 2008-05-01 18:37:16Z prichards $
# --------------------------------------------------------

require_once( 'core.php' );

$t_core_path = config_get( 'core_path' );

require_once( $t_core_path.'current_user_api.php' );

#============ Parameters ============
# (none)

#============ Permissions ============
auth_ensure_user_authenticated();

?>
<?php

# extracts the user information for the currently logged in user
# and prefixes it with u_
$f_user_id = gpc_get_int( 'id', auth_get_current_user_id() );
$row = user_get_row( $f_user_id );

extract( $row, EXTR_PREFIX_ALL, 'u' );

# 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 );

html_page_top1();
html_page_top2();
?>

<br />
<div align="center">
<table class="width75" cellspacing="1">

<!-- Headings -->
<tr>
<td class="form-title">
<?php echo lang_get( 'view_account_title' ) ?>
</td>
</tr>

<!-- Username -->
<tr class="row-1">
<td class="category" width="25%">
<?php echo lang_get( 'username' ) ?>
</td>
<td width="75%">
<?php echo $u_username ?>
</td>
</tr>

<!-- Email -->
<tr class="row-1">
<td class="category">
<?php echo lang_get( 'email' ) ?>
</td>
<td>
<?php
if ( !access_has_project_level( config_get( 'show_user_email_threshold' ) ) ) {
print error_string(ERROR_ACCESS_DENIED);
} else {
if ( !is_blank( $u_email ) ) {
print_email_link( $u_email, $u_email );
} else {
echo " - ";
}
}
?>
</td>
</tr>

<!-- Realname -->
<tr class="row-1" valign="top">
<td class="category">
<?php echo lang_get( 'realname' ) ?>
</td>
<td>
<?php
if ( !access_has_project_level( config_get( 'show_user_realname_threshold' ) ) ) {
print error_string(ERROR_ACCESS_DENIED);
} else {
echo $u_realname;
}
?>
</td>
</tr>


</table>
</div>

<br />

<?php html_page_bottom1( __FILE__ ) ?>

0 comments on commit 7492a25

Please sign in to comment.