Skip to content

Commit

Permalink
Fix invalid HTML, improvements in manage_user_proj_delete.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed Apr 4, 2021
2 parents 1091f08 + 0344f38 commit dbeeb60
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 233 deletions.
2 changes: 1 addition & 1 deletion account_prefs_inc.php
Expand Up @@ -320,7 +320,7 @@ function edit_account_prefs( $p_user_id = null, $p_error_if_protected = true, $p
</td>
</tr>
<tr>
<td class="category">
<td class="category width-30">
<?php echo lang_get( 'email_bugnote_limit' ) ?>
</td>
<td>
Expand Down
24 changes: 0 additions & 24 deletions core/print_api.php
Expand Up @@ -1188,30 +1188,6 @@ function print_project_user_list_option_list2( $p_user_id ) {
}
}

/**
* list of projects that a user is in
* @param integer $p_user_id An user identifier.
* @param boolean $p_include_remove_link Whether to display remove link.
* @return void
*/
function print_project_user_list( $p_user_id, $p_include_remove_link = true ) {
$t_projects = user_get_assigned_projects( $p_user_id );

foreach( $t_projects as $t_project_id=>$t_project ) {
$t_project_name = string_attribute( $t_project['name'] );
$t_view_state = $t_project['view_state'];
$t_access_level = $t_project['access_level'];
$t_access_level = get_enum_element( 'access_levels', $t_access_level );
$t_view_state = get_enum_element( 'project_view_state', $t_view_state );

echo $t_project_name . ' [' . $t_access_level . '] (' . $t_view_state . ')';
if( $p_include_remove_link && access_has_project_level( config_get( 'project_user_threshold' ), $t_project_id ) ) {
html_button( 'manage_user_proj_delete.php', lang_get( 'remove_link' ), array( 'project_id' => $t_project_id, 'user_id' => $p_user_id ) );
}
echo '<br />';
}
}

/**
* List of projects with which the specified field id is linked.
* For every project, the project name is listed and then the list of custom
Expand Down
10 changes: 7 additions & 3 deletions core/user_api.php
Expand Up @@ -928,13 +928,17 @@ function user_get_row( $p_user_id ) {
*/
function user_get_field( $p_user_id, $p_field_name ) {
if( NO_USER == $p_user_id ) {
error_parameters( NO_USER );
$t_row = false;
} else {
$t_row = user_get_row( $p_user_id );
}

if( !$t_row ) {
error_parameters( $p_user_id );
trigger_error( ERROR_USER_BY_ID_NOT_FOUND, WARNING );
return '@null@';
}

$t_row = user_get_row( $p_user_id );

if( isset( $t_row[$p_field_name] ) ) {
switch( $p_field_name ) {
case 'access_level':
Expand Down
1 change: 1 addition & 0 deletions core/user_pref_api.php
Expand Up @@ -563,6 +563,7 @@ function user_pref_clear_invalid_project_default( $p_project_id, array $p_users
$t_users_having_project_as_default = array_column( $t_query->fetch_all(), 'user_id' );

# Users who can't access the project anymore must have the default cleared
user_cache_array_rows( $t_users_having_project_as_default );
$t_users_to_clear = array();
foreach( $t_users_having_project_as_default as $t_id ) {
if( access_get_project_level( $p_project_id, $t_id ) == ANYBODY ) {
Expand Down
2 changes: 1 addition & 1 deletion lang/strings_english.txt
Expand Up @@ -1069,7 +1069,7 @@ $s_project_user_added_msg = 'Successfully added user to project.';
$s_project_removed_user_msg = 'Successfully removed user from project.';

# proj_user_delete_page.php
$s_remove_user_sure_msg = 'Are you sure you wish to remove user "%1$s" from project "%2$s"?';
$s_remove_user_sure_msg = 'Are you sure you wish to remove user "%1$s" from project(s) "%2$s"?';
$s_remove_user_button = 'Remove User';
$s_remove_all_users_sure_msg = 'Are you sure you wish to remove all the users of this project?';
$s_remove_all_users_button = 'Remove All Users';
Expand Down

0 comments on commit dbeeb60

Please sign in to comment.