File: //proc/self/cwd/accounts-admin/user-details.php
<?php
include_once('header.php');
include_once('../wp-config.php');
$PSY_CITY = $wpdb->prefix . PSY_CITY;
$PSY_STATES = $wpdb->prefix . PSY_STATES;
$PSY_USERS = $wpdb->prefix . PSY_USERS;
$PSY_USERS_DETAILS = $wpdb->prefix . PSY_USERS_DETAILS;
$PSY_TEST_GEN_TEST_TAKEN = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN;
$PSY_EXAMS = $wpdb->prefix . PSY_EXAMS;
$PSY_COUNSELLING_SUBSCRIPTION = $wpdb->prefix . PSY_COUNSELLING_SUBSCRIPTION;
$PSY_COUNSELORS = $wpdb->prefix . PSY_COUNSELORS;
$PSY_SLOT_AVAILABLE = $wpdb->prefix . PSY_SLOT_AVAILABLE;
/****search by user */
if (isset($_REQUEST["submit"]) || @$_REQUEST['user_name_email']) {
unset($_SESSION['USER_ID']);
unset($_SESSION['STUDENT_USER_LOGIN']);
$username = $_REQUEST["user_name_email"];
$user_info = get_userdatabylogin($username);
if ($user_info) {
$_SESSION['USER_ID'] = $user_info->ID;
$_SESSION['STUDENT_USER_LOGIN'] = $user_info->user_login;
}
}
/***if user id in url */
if(isset($_REQUEST['uId'])) {
unset($_SESSION['USER_ID']);
unset($_SESSION['STUDENT_USER_LOGIN']);
$uId = $_REQUEST['uId'];
$_SESSION['USER_ID'] = $uId;
}
?>
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
<style>
.table-hover th,
td {
font-size: 13px;
padding: 9px !important;
}
</style>
<div class="page-inner">
<div class="page-title">
<h3>Search User</h3>
</div>
<div id="main-wrapper">
<?php if (!empty($_SESSION['USER_ID'])) {
$searchuser_id = $_SESSION['USER_ID'];
$getUserRegDet = $wpdb->get_row("select ID, user_login, user_email, user_registered from $PSY_USERS where ID='$searchuser_id'");
if($getUserRegDet->ID != ''){
$getUserDet = $wpdb->get_row("select ud.*, s.state_name, c.city_name from $PSY_USERS_DETAILS as ud LEFT JOIN $PSY_STATES as s ON s.state_id=ud.state_id LEFT JOIN $PSY_CITY as c ON c.city_id=ud.city_id where ud.user_id='$searchuser_id'");
$getTestQuery = "SELECT t.test_taken_id, t.user_id, t.exam_category_id, t.total_questions, t.answer_selected, t.time_taken_in_seconds, t.start_date, t.test_type, e.category_name FROM $PSY_TEST_GEN_TEST_TAKEN as t LEFT JOIN $PSY_EXAMS as e ON e.exam_category_id=t.exam_category_id where t.status='Y' and t.user_id='$searchuser_id' order by t.test_taken_id desc";
$getTestData = $wpdb->get_results($getTestQuery);
$getCounselingData = "SELECT pcs.subs_id, psa.scheduled_date, psa.time_dur,c.counselor_name FROM $PSY_COUNSELLING_SUBSCRIPTION AS pcs LEFT JOIN $PSY_COUNSELORS as c on c.counselor_id=pcs.counselor_id LEFT JOIN $PSY_SLOT_AVAILABLE as psa on psa.id=pcs.slot_table_id WHERE pcs.user_id='$searchuser_id' and psa.slot_status='S'";
$getCData = $wpdb->get_results($getCounselingData);
$source = $getUserDet->source;
if ($source == 'SP' || $source == 'SM') {
$sourceName = 'Selfanalyse';
} else {
$sourceName = $source;
}
?>
<div class="row">
<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">User Registration Details</h4>
</div>
<table class="table table-hover">
<tr>
<th>User Id</th>
<td><?php echo $getUserRegDet->ID; ?></td>
</tr>
<tr>
<th>User Login</th>
<td><?php echo $getUserRegDet->user_login; ?></td>
</tr>
<tr>
<th>User Email</th>
<td><?php echo $getUserRegDet->user_email; ?></td>
</tr>
<tr>
<th>Reg. Date</th>
<td><?php echo $getUserRegDet->user_registered; ?></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;"><button type="button" class="btn btn-success" data-toggle="modal" data-target="#changePassModal">Change User Password</button></td>
</tr>
</table>
<div class="panel-heading clearfix">
<h4 class="panel-title">User Source Detail</h4>
</div>
<table class="table table-hover">
<tr>
<th>Source</th>
<td><?php echo $sourceName; ?></td>
</tr>
</table>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">User Contact Details</h4>
</div>
<table class="table table-hover">
<tr>
<th style="width:10em;">First Name</th>
<td><?php echo $getUserDet->first_name; ?></td>
</tr>
<tr>
<th style="width:10em;">Last Name</th>
<td><?php echo $getUserDet->last_name; ?></td>
</tr>
<tr>
<th style="width:10em;">DOB</th>
<td><?php echo $getUserDet->date_of_birth; ?></td>
</tr>
<tr>
<th style="width:10em;">Mobile Number</th>
<td><?php echo $getUserDet->mobile_number; ?>
</td>
</tr>
<tr>
<th style="width:10em;">Email Id</th>
<td><?php echo $getUserDet->email_address; ?>
</td>
</tr>
<tr>
<th style="width:10em;">Pincode</th>
<td><?php echo $getUserDet->pincode; ?></td>
</tr>
<tr>
<th style="width:10em;">State</th>
<td><?php echo $getUserDet->state_id . " / " . $getUserDet->state_name; ?></td>
</tr>
<tr>
<th style="width:10em;">City</th>
<td><?php echo $getUserDet->city_id . " / " . $getUserDet->city_name; ?></td>
</tr>
<tr>
<th style="width:10em;">Address</th>
<td><?php echo $getUserDet->address; ?></td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Test Details
<i class="fa fa-info-circle" title="User Action"></i>
</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="display " id="userList" style="font-size: 13px;">
<thead>
<tr>
<th>Id</th>
<th>TestId</th>
<th>Test Name</th>
<th>Time(Sec)</th>
<th>Test Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
foreach ($getTestData as $tst) {
if ($tst->test_type == 'APT') {
$link = 'aptitude-test-report';
} else if ($tst->test_type == 'PER') {
$link = 'personality-test-report';
} else if ($tst->test_type == 'INT') {
$link = 'interest-test-report';
} else if ($tst->test_type == 'SS') {
$link = 'selfstr-test-report';
} else if ($tst->test_type == 'SLT') {
$link = '';
}
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $tst->test_taken_id; ?></td>
<td><?php echo $tst->category_name; ?></td>
<td><?php echo $tst->time_taken_in_seconds; ?></td>
<td><?php echo $tst->start_date; ?></td>
<td>
<a href="<?php echo $link; ?>?testId=<?php echo $tst->test_taken_id; ?>" target="_blank">
<i class="fa fa-eye" title="View Test Report" style="cursor:pointer;"></i>
</a>
</td>
</tr>
<?php $i++;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title">Counselling
<i class="fa fa-info-circle" title="User Action"></i>
</h4>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="display " id="cList" style="font-size: 13px;">
<thead>
<tr>
<th>Id</th>
<th>Counselor</th>
<th>OnDate</th>
<th>Time Duration</th>
</tr>
</thead>
<tbody>
<?php
$j = 1;
foreach ($getCData as $c) {
?>
<tr>
<td><?php echo $j; ?></td>
<td><?php echo $c->counselor_name; ?></td>
<td><?php echo $c->scheduled_date; ?></td>
<td><?php echo $c->time_dur; ?></td>
</tr>
<?php $j++;
} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php } else { echo "user id not found"; } } ?>
</div>
<div class="page-footer">
<p class="no-s">selfanalyse.com</p>
</div>
</div>
<script src="assets/plugins/jquery/jquery-2.1.3.min.js"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
<script src="https://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link href="assets/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="assets/css/responsive.dataTables.min.css" rel="stylesheet">
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<script>
jQuery.noConflict();
jQuery(function($) {
jQuery("#user_name_email").keydown(function(event) {
jQuery("#" + event.target.id).autocomplete({
source: '<?php echo get_site_url() . '/counselor/search_user_api.php'; ?>',
minLength: 2,
});
});
$('#userList').dataTable({
"bPaginate": true,
"iDisplayLength": 50,
"lengthMenu": [
[10, 20, 50, 100, 500, 1000],
[10, 20, 50, 100, 500, 1000]
],
"order": [
[1, "desc"]
]
});
$('#cList').dataTable({
"bPaginate": true,
"iDisplayLength": 50,
"lengthMenu": [
[10, 20, 50, 100, 500, 1000],
[10, 20, 50, 100, 500, 1000]
],
"order": [
[1, "desc"]
]
});
});
</script>
<?php include_once('footer.php'); ?>