修复RiPro主题 后台用户下载记录查询无法显示BUG

20200424修复RiPro主题  后台用户下载记录查询无法显示BUG

文件路径:/themes/ripro/inc/admin/page/downlog.php

说明:下载文件直接覆盖源文件 或者 打开downlog.php替换以下代码

<?php
date_default_timezone_set('Asia/Shanghai');
global $wpdb, $down_log_table_name;
?>
<?php
// 主页面PHP 20200421修复RiPro主题 后台用户下载记录查询无法显示BUG QQ:9861262
$perpage = 20; // 每页数量
$paged=isset($_GET['paged']) ?intval($_GET['paged']) :1; //当前页
$offset = $perpage*($paged-1); //偏移页
//////// 构造SQL START ////////
$sql = "SELECT * FROM {$down_log_table_name}";
$where = ' WHERE 1=1';
if ( !empty( $_GET['note'] ) ) {
$where .= ' AND note='.esc_sql($_GET['note']);
}
if ( !empty( $_GET['create_time'] ) ) {
$where .= ' AND create_time='.esc_sql($_GET['create_time']);
}
if ( !empty( $_GET['ip'] ) ) {
$where .= ' AND ip='.esc_sql($_GET['ip']);
}
if ( !empty( $_GET['down_id'] ) ) {
$where .= ' AND down_id='.esc_sql($_GET['down_id']);
}
if ( !empty( $_GET['user_id'] ) ) {
$author_obj = get_user_by('login', $_GET['user_id']);
if (!empty($author_obj) && $author_obj->ID > 0) {
$where .= ' AND user_id='.esc_sql($author_obj->ID);
}
}
$orderlimti = ' ORDER BY create_time DESC';
$orderlimti .= ' LIMIT '.esc_sql($offset.','.$perpage);
$result = $wpdb->get_results($sql.$where.$orderlimti);
$total = $wpdb->get_var("SELECT COUNT(id) FROM $down_log_table_name {$where}");
?>
<!-- 主页面 -->
<div class="wrap">
<h1 class="wp-heading-inline">用户下载记录查询</h1>
<hr class="wp-header-end">

<form id="order-filter" method="get">
<!-- 初始化页面input -->
<input type="hidden" name="page" value="<?php echo $_GET['page']?>">
<!-- 筛选 -->
<div class="wp-filter">
<div class="filter-items">
<div class="view-switch">
<a class="view-list current"></a>
</div>
</div>
<div class="search-form">
<span class="">根据用户的ID搜索例如(admin) ,共<?php echo $total?>个项目 </span>
<input class="search" id="media-search-input" name="user_id" placeholder="根据用户搜索,回车确定…" type="search" value=""/>
</div>
<br class="clear">
</div>
<!-- 筛选END -->

<table class="wp-list-table widefat fixed striped posts">
<thead>
<tr>
<th class="column-primary">用户ID</th>
<th>用户级别</th>
<th>所下资源</th>
<th>下载IP</th>
<th>下载时间</th>
<th>今日可下载</th>
<th>今日已下载</th>
<th>今日剩余下载</th>
</tr>
</thead>
<tbody id="the-list">

<?php

if($result) {

foreach($result as $item){
$CaoUser = new CaoUser($item->user_id);
$cao_vip_downum = $CaoUser->cao_vip_downum($item->user_id,$CaoUser->vip_status());
echo '<tr id="order-info">';
$user_loginName = ($item->user_id > 0) ? get_user_by('id',$item->user_id)->user_login : '游客' ;
echo '<td class="has-row-actions column-primary">'.$user_loginName.'<button type="button" class="toggle-row"><span class="screen-reader-text">显示详情</span></button></td>';
echo '<td data-colname="用户级别">'.$CaoUser->vip_name().'</td>';
echo '<td data-colname="所下资源"><a target="_blank" href='.get_permalink($item->down_id).'>'.get_the_title($item->down_id).'</a></td>';
echo '<td data-colname="下载IP地址">'.$item->ip.'</td>';
echo '<td data-colname="下载时间">'.date('Y-m-d H:i:s',$item->create_time).'</td>';
echo '<td data-colname="今日可下载"><span class="badge badge-blue">'.$cao_vip_downum['today_count_num'].'次</span></td>';
echo '<td data-colname="今日已下载"><span class="badge">'.$cao_vip_downum['today_down_num'].'次</span></td>';
echo '<td data-colname="今日剩余下载"><span class="badge badge-primary">'.$cao_vip_downum['over_down_num'].'次</span></td>';

echo "</tr>";
}
}
else{
echo '<tr><td colspan="12" align="center"><strong>没有数据</strong></td></tr>';
}
?>
</tbody>
</table>
</form>
<?php echo cao_admin_pagenavi($total,$perpage);?>
<script>
jQuery(document).ready(function($){

});
</script>
</div>

具体效果如下:

修复RiPro主题 后台用户下载记录查询无法显示BUG-奇客云

奇客云 – 免费源码模版分享 | www.aiboom.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 本站站长QQ:188118848,官网:https://www.aiboom.com
3. 本站资源仅作为学习及测试用,商用请支持正版授权!

奇客云 » 修复RiPro主题 后台用户下载记录查询无法显示BUG
加入VIP