// Use a default params
    $params = $default_params;
}
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'pwdchange'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
// check if reqID exists. If exists it means that this form is displayed because a password change request by email.
$reqID = param('reqID', 'string', '');
$Form = new Form($form_action, 'user_checkchanges');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin = is_admin_page();
if ($is_admin) {
    $form_title = get_usertab_header($edited_User, 'pwdchange', T_('Change password'));
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
} else {
    $form_title = '';
    $form_class = 'bComment';
}
$has_full_access = $current_User->check_perm('users', 'edit');
$Form->begin_form($form_class, $form_title);
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'pwdchange');
$Form->hidden('password_form', '1');
$Form->hidden('reqID', $reqID);
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
if (!$current_User->check_perm('users', 'edit')) {
    // Check permission:
    debug_die(T_('You have no permission to see this tab!'));
}
memorize_param('user_tab', 'string', '', $user_tab);
memorize_param('user_ID', 'integer', 0, $user_ID);
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'activity'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
if (!$user_profile_only) {
    // echo user edit action icons
    $Widget = new Widget();
    echo_user_actions($Widget, $edited_User, 'edit');
    echo '<span class="floatright">' . $Widget->gen_global_icons() . '</span>';
}
echo '<div>' . get_usertab_header($edited_User, $user_tab, $current_User->ID == $edited_User->ID ? T_('My Activity') : T_('User Activity')) . '</div>';
// Display IP address from where this user was created
echo '<div style="margin-top:25px;font-weight:bold;"><span>' . T_('User created from IP') . ': ' . int2ip($UserSettings->get('created_fromIPv4', $edited_User->ID)) . '</span></div>';
/**** Reports from edited user  ****/
user_reports_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Blogs owned by the user ****/
blogs_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Posts created by the user  ****/
items_created_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Posts edited by the user ****/
items_edited_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Comments posted by the user ****/
    $form_title = '';
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
} else {
    global $Blog;
    $form_title = '';
    $form_class = 'bComment';
    $ctrl_param = url_add_param($Blog->gen_blogurl(), 'disp=' . $disp);
}
if ($display_mode != 'js' && is_admin_page()) {
    if (!$user_profile_only) {
        echo_user_actions($Form, $edited_User, $action);
    }
    $form_text_title = T_('Crop profile picture');
    // used for js confirmation message on leave the changed form
    $form_title = get_usertab_header($edited_User, '', $form_text_title);
}
// Display this error when JS is not enabled
echo '<noscript>' . '<p class="error text-danger">' . T_('Please activate Javascript in your browser in order to use this feature.') . '</p>' . '<style type="text/css">form#user_checkchanges { display:none }</style>' . '</noscript>';
$Form->begin_form($form_class, $form_title, array('title' => isset($form_text_title) ? $form_text_title : $form_title));
if (is_admin_page()) {
    $Form->hidden_ctrl();
} else {
    $Form->hidden('disp', $disp);
    $Form->hidden('action', $action);
}
$Form->add_crumb('user');
$Form->hidden('user_tab', param('user_tab_from', 'string', 'avatar'));
$Form->hidden('user_ID', isset($edited_User) ? $edited_User->ID : $current_User->ID);
$Form->hidden('file_ID', $cropped_File->ID);
$Form->hidden('image_crop_data', '');
			jQuery( '#admin_skin_settings_div' ).show();
		}
	}
</script>
<?php 
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'advanced'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form(NULL, 'user_checkchanges');
$Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$Form->begin_form('fform', get_usertab_header($edited_User, 'advanced', T_('Edit advanced preferences')));
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'advanced');
$Form->hidden('advanced_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
/***************  Preferences  **************/
$Form->begin_fieldset(T_('Preferences') . get_manual_link('user_preferences'));
$value_admin_skin = get_param('edited_user_admin_skin');
if (!$value_admin_skin) {
    // no value supplied through POST/GET
    $value_admin_skin = $UserSettings->get('admin_skin', $edited_User->ID);
}
if (!$value_admin_skin) {
    // Nothing set yet for the user, use the default
    // Use a default params
    $params = $default_params;
}
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('user_tab' => 'pwdchange'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form($form_action, 'user_checkchanges');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin = is_admin_page();
if ($is_admin) {
    $form_text_title = T_('Change password') . get_manual_link('user-password-tab');
    // used for js confirmation message on leave the changed form
    $form_title = get_usertab_header($edited_User, 'pwdchange', $form_text_title);
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
} else {
    $form_title = '';
    $form_class = $params['form_class_user_pass'];
}
$has_full_access = $current_User->check_perm('users', 'edit');
$Form->begin_form($form_class, $form_title, array('title' => isset($form_text_title) ? $form_text_title : $form_title));
$Form->add_crumb($params['form_hidden_crumb']);
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'pwdchange');
$Form->hidden('password_form', '1');
$Form->hidden('reqID', $reqID);
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
	}
</script>
<?php 
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('user_tab' => 'advanced'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form(NULL, 'user_checkchanges');
$Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$form_text_title = T_('Edit advanced preferences');
// used for js confirmation message on leave the changed form
$form_title = get_usertab_header($edited_User, 'advanced', T_('Edit advanced preferences') . get_manual_link('user-advanced-tab'));
$Form->begin_form('fform', $form_title, array('title' => isset($form_text_title) ? $form_text_title : $form_title));
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'advanced');
$Form->hidden('advanced_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
/***************  Preferences  **************/
$Form->begin_fieldset(T_('Preferences') . get_manual_link('user_preferences'));
$value_admin_skin = get_param('edited_user_admin_skin');
if (!$value_admin_skin) {
    // no value supplied through POST/GET
    $value_admin_skin = $UserSettings->get('admin_skin', $edited_User->ID);
}
if (!$value_admin_skin) {
global $form_action;
/**
 * @var instance of User class
 */
global $current_User;
if ($display_mode != 'js') {
    // ------------------- PREV/NEXT USER LINKS -------------------
    user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'report'));
    // ------------- END OF PREV/NEXT USER LINKS -------------------
}
$Form = new Form($form_action, 'user_checkchanges');
$form_title = '';
$form_class = 'fform';
$Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
if ($display_mode != 'js') {
    if (!$user_profile_only) {
        echo_user_actions($Form, $edited_User, $action);
    }
    $form_title = get_usertab_header($edited_User, '', T_('Report User'));
}
$Form->begin_form($form_class, $form_title);
$Form->hidden_ctrl();
$Form->hidden('user_tab', $user_tab);
$Form->begin_fieldset(T_('Report User'), array('class' => 'fieldset clear'));
user_report_form(array('Form' => $Form, 'user_ID' => $edited_User->ID, 'crumb_name' => 'user', 'cancel_url' => $admin_url . '?ctrl=user&amp;user_tab=' . $user_tab . '&amp;action=remove_report&amp;user_ID=' . $edited_User->ID . '&amp;' . url_crumb('user')));
if ($display_mode == 'js') {
    // Display a close link for popup window
    echo '<div class="center" style="margin-top:32px">' . action_icon(T_('Close this window'), 'close', '', ' ' . T_('Close this window'), 3, 4, array('id' => 'close_button', 'class' => 'small')) . '</div>';
}
$Form->end_fieldset();
$Form->end_form();
    $params = array_merge($default_params, $params);
} else {
    // Use a default params
    $params = $default_params;
}
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'avatar'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form($form_action, 'user_checkchanges', 'post', NULL, 'multipart/form-data');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin = is_admin_page();
if ($is_admin) {
    $form_title = get_usertab_header($edited_User, 'avatar', T_('Edit profile picture'));
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
    $ctrl_param = '?ctrl=user&amp;user_tab=avatar&amp;user_ID=' . $edited_User->ID;
} else {
    global $Blog;
    $form_title = '';
    $form_class = 'bComment';
    $ctrl_param = url_add_param($Blog->gen_blogurl(), 'disp=' . $disp);
}
$Form->begin_form($form_class, $form_title);
$Form->add_crumb('user');
if ($is_admin) {
    $Form->hidden_ctrl();
} else {
    $Form->hidden('disp', $disp);
}
$SQL->WHERE('user_ID = ' . $user_ID);
$Count_SQL->WHERE('user_ID = ' . $user_ID);
memorize_param('user_tab', 'string', '', $user_tab);
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('user_tab' => 'sessions'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Results = new Results($SQL->get(), 'sess_', 'D', $UserSettings->get('results_per_page'), $Count_SQL->get());
// echo user edit action icons
echo_user_actions($Results, $edited_User, 'edit');
echo '<span class="floatright">' . $Results->gen_global_icons() . '</span>';
$Results->global_icons = array();
// echo user tabs
echo '<div>' . get_usertab_header($edited_User, $user_tab, T_('Sessions') . get_manual_link('user-sessions-tab')) . '</div>';
$Results->title = T_('Recent sessions') . get_manual_link('user-sessions-tab');
/**
 * Callback to add filters on top of the result set
 *
 * @param Form
 */
$Results->cols[] = array('th' => T_('ID'), 'order' => 'sess_ID', 'default_dir' => 'D', 'td_class' => 'right', 'td' => '<a href="?ctrl=stats&amp;tab=hits&amp;blog=0&amp;sess_ID=$sess_ID$">$sess_ID$</a>');
$Results->cols[] = array('th' => T_('Last seen'), 'order' => 'sess_lastseen_ts', 'default_dir' => 'D', 'td_class' => 'timestamp', 'td' => '%mysql2localedatetime_spans( #sess_lastseen_ts# )%');
$Results->cols[] = array('th' => T_('User login'), 'order' => 'user_login', 'td' => '%stat_session_login( #user_login# )%');
$Results->cols[] = array('th' => T_('Remote IP'), 'order' => 'sess_ipaddress', 'td' => '$sess_ipaddress$');
// Get additional columns from the Plugins
$Plugins->trigger_event('GetAdditionalColumnsTable', array('table' => 'sessions', 'column' => 'sess_ipaddress', 'Results' => $Results));
function display_sess_length($sess_ID, $sess_length)
{
    $result = '';
global $current_User;
global $servertimenow, $admin_url;
if (!$current_User->check_perm('users', 'edit')) {
    // Check permission:
    debug_die(T_('You have no permission to see this tab!'));
}
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'admin'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$user_status_icons = get_user_status_icons();
$Form = new Form(NULL, 'user_checkchanges');
$Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
echo_user_actions($Form, $edited_User, 'edit');
$Form->begin_form('fform', get_usertab_header($edited_User, 'admin', T_('User admin settings')));
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'admin');
$Form->hidden('admin_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
/***************  User permissions  **************/
$Form->begin_fieldset(T_('User permissions') . get_manual_link('user-admin-permissions'), array('class' => 'fieldset clear'));
$edited_User->get_Group();
$level_fieldnote = '[0 - 10]';
if ($edited_User->ID == 1) {
    // This is Admin user
    echo '<input type="hidden" name="edited_user_grp_ID" value="' . $edited_User->grp_ID . '" />';
    $Form->info(T_('Account status'), T_('Autoactivated'));
    $Form->info(T_('User group'), $edited_User->Group->dget('name'));
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'profile'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$has_full_access = $current_User->check_perm('users', 'edit');
$edited_user_perms = array('edited-user', 'edited-user-required');
$new_user_creating = $edited_User->ID == 0;
$Form = new Form($form_action, 'user_checkchanges');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin = is_admin_page();
if ($is_admin) {
    if ($new_user_creating) {
        $form_title = T_('Edit user profile');
    } else {
        $form_title = get_usertab_header($edited_User, 'profile', T_('Edit profile'));
        $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
    }
    $form_class = 'fform';
} else {
    $form_title = '';
    $form_class = 'bComment';
}
$Form->begin_form($form_class, $form_title);
// We should print out this submit "update" before all other buttons (because form is submitted by first button)
// It gives to update a form when we press Enter key on the form element
echo '<div style="position:absolute;top:-1000px;left:-1000px">';
$Form->button(array('type' => 'submit', 'name' => 'actionArray[update]'));
echo '</div>';
$Form->add_crumb('user');
$Form->hidden_ctrl();
    $params = array_merge($default_params, $params);
} else {
    // Use a default params
    $params = $default_params;
}
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'userprefs'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form($form_action, 'user_checkchanges');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin = is_admin_page();
if ($is_admin) {
    $form_title = get_usertab_header($edited_User, 'userprefs', T_('Edit preferences'));
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
} else {
    $form_title = '';
    $form_class = 'bComment';
}
$Form->begin_form($form_class, $form_title);
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'userprefs');
$Form->hidden('preferences_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
if (isset($Blog)) {
    $Form->hidden('blog', $Blog->ID);
    $params = array_merge($default_params, $params);
} else {
    // Use a default params
    $params = $default_params;
}
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'subs'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Form = new Form($form_action, 'user_checkchanges');
$Form->switch_template_parts($params['skin_form_params']);
if (!$user_profile_only) {
    echo_user_actions($Form, $edited_User, $action);
}
$is_admin_page = is_admin_page();
if ($is_admin_page) {
    $form_title = get_usertab_header($edited_User, 'subs', T_('Edit notifications'));
    $form_class = 'fform';
    $Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
    $checklist_params = array();
} else {
    $form_title = '';
    $form_class = 'bComment';
    $checklist_params = array('wide' => true);
}
$Form->begin_form($form_class, $form_title);
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'subs');
$Form->hidden('subscriptions_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
if (!$current_User->can_moderate_user($edited_User->ID)) {
    // Check permission:
    debug_die(T_('You have no permission to see this tab!'));
}
memorize_param('user_tab', 'string', '', $user_tab);
memorize_param('user_ID', 'integer', 0, $user_ID);
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('user_tab' => 'activity'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
if (!$user_profile_only) {
    // echo user edit action icons
    $Widget = new Widget();
    echo_user_actions($Widget, $edited_User, 'edit');
    echo '<span class="floatright">' . $Widget->gen_global_icons() . '</span>';
}
echo '<div>' . get_usertab_header($edited_User, $user_tab, ($current_User->ID == $edited_User->ID ? T_('My Activity') : T_('User Activity')) . get_manual_link('user-activity-tab')) . '</div>';
// Display IP address from where this user was created
echo '<div style="margin-top:25px;font-weight:bold;"><span>' . T_('User created from IP') . ': ' . int2ip($UserSettings->get('created_fromIPv4', $edited_User->ID)) . '</span></div>';
/**** Reports from edited user  ****/
user_reports_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Blogs owned by the user ****/
blogs_user_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Posts created by the user  ****/
items_created_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Posts edited by the user ****/
items_edited_results_block(array('edited_User' => $edited_User));
evo_flush();
/**** Comments posted by the user ****/
}
$SQL->WHERE('user_ID = ' . $user_ID);
$Count_SQL->WHERE('user_ID = ' . $user_ID);
memorize_param('user_tab', 'string', '', $user_tab);
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('block_start' => '<table class="prevnext_user"><tr>', 'prev_start' => '<td width="33%">', 'prev_end' => '</td>', 'prev_no_user' => '<td width="33%">&nbsp;</td>', 'back_start' => '<td width="33%" class="back_users_list">', 'back_end' => '</td>', 'next_start' => '<td width="33%" class="right">', 'next_end' => '</td>', 'next_no_user' => '<td width="33%">&nbsp;</td>', 'block_end' => '</tr></table>', 'user_tab' => 'sessions'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$Results = new Results($SQL->get(), 'sess_', 'D', $UserSettings->get('results_per_page'), $Count_SQL->get());
// echo user edit action icons
echo_user_actions($Results, $edited_User, 'edit');
echo '<span class="floatright">' . $Results->gen_global_icons() . '</span>';
$Results->global_icons = array();
// echo user tabs
echo '<div>' . get_usertab_header($edited_User, $user_tab, T_('Sessions')) . '</div>';
$Results->title = T_('Recent sessions');
/**
 * Callback to add filters on top of the result set
 *
 * @param Form
 */
$Results->cols[] = array('th' => T_('ID'), 'order' => 'sess_ID', 'default_dir' => 'D', 'td_class' => 'right', 'td' => '<a href="?ctrl=stats&amp;tab=hits&amp;blog=0&amp;sess_ID=$sess_ID$">$sess_ID$</a>');
$Results->cols[] = array('th' => T_('Last seen'), 'order' => 'sess_lastseen_ts', 'default_dir' => 'D', 'td_class' => 'timestamp', 'td' => '%mysql2localedatetime_spans( #sess_lastseen_ts# )%');
$Results->cols[] = array('th' => T_('User login'), 'order' => 'user_login', 'td' => '%stat_session_login( #user_login# )%');
$Results->cols[] = array('th' => T_('Remote IP'), 'order' => 'sess_ipaddress', 'td' => '$sess_ipaddress$');
// Get additional columns from the Plugins
$Plugins->trigger_event('GetAdditionalColumnsTable', array('table' => 'sessions', 'column' => 'sess_ipaddress', 'Results' => $Results));
function display_sess_length($sess_ID, $sess_length)
{
    $result = '';
if (!$current_User->can_moderate_user($edited_User->ID)) {
    // Check permission:
    debug_die(T_('You have no permission to see this tab!'));
}
// Begin payload block:
$this->disp_payload_begin();
// ------------------- PREV/NEXT USER LINKS -------------------
user_prevnext_links(array('user_tab' => 'admin'));
// ------------- END OF PREV/NEXT USER LINKS -------------------
$user_status_icons = get_user_status_icons();
$Form = new Form(NULL, 'user_checkchanges');
$Form->title_fmt = '<span style="float:right">$global_icons$</span><div>$title$</div>' . "\n";
echo_user_actions($Form, $edited_User, 'edit');
$form_text_title = T_('User admin settings');
// used for js confirmation message on leave the changed form
$form_title = get_usertab_header($edited_User, 'admin', T_('User admin settings') . get_manual_link('user-admin-tab'));
$Form->begin_form('fform', $form_title, array('title' => isset($form_text_title) ? $form_text_title : $form_title));
$Form->add_crumb('user');
$Form->hidden_ctrl();
$Form->hidden('user_tab', 'admin');
$Form->hidden('admin_form', '1');
$Form->hidden('user_ID', $edited_User->ID);
$Form->hidden('edited_user_login', $edited_User->login);
/***************  User permissions  **************/
$Form->begin_fieldset(T_('User permissions') . get_manual_link('user-admin-permissions'), array('class' => 'fieldset clear'));
$edited_User->get_Group();
$level_fieldnote = '[0 - 10]';
if ($edited_User->ID == 1) {
    // This is Admin user
    echo '<input type="hidden" name="edited_user_grp_ID" value="' . $edited_User->grp_ID . '" />';
    $Form->info(T_('Account status'), T_('Autoactivated'));