百度已收录 子比主题-给用户中心增加一个我的投诉页面寒江1个月前更新关注私信0445 我们平常在使用子比主题的时候,举报了某个用户只有点击该用户的主页才可以看到举报的信息,那么如何可以把所有举报的信息保存在用户中心呢?那么今天带来的这个教程就可以帮助到您! 效果预览: 使用方法: 修改文件:zibll>inc>functions>user>page.php 此处内容已隐藏,请评论后刷新页面查看. 说明: 下面3个代码任选其一在zibll>inc>functions>user>page.php任意地方添加 (推荐第一个) ①选项卡代码《 带有分页功能+处理进度的功能+正在处理的投诉根据提交时间依次前面》(推荐) // 我的投诉页面 function zib_main_user_tab_content_complaint() { $current_user_id = get_current_user_id(); $my_complaint_style = '<div style="margin-bottom: 10px;padding: 15px;color: #0986f5;background: #337ab71c;">加入网络监督员维护社区网络环境,举报不良信息,共建和谐绿色社区</div>'; $my_complaint_div ='style="background: #eeeeee57;padding: 15px;"'; $my_complaint_time ='style="background: rgba(255, 111, 6, 0.1);padding: 5px;color: #ff6c00;"'; global $wpdb; $table_name = $wpdb->prefix . 'zib_message'; $query = $wpdb->prepare( "SELECT * FROM $table_name WHERE send_user = %d AND type = %s ORDER BY status ASC, content ASC", $current_user_id, 'user_report' ); $results = $wpdb->get_results($query); //如果查询记录为空则显示 if (empty($results)) { $html = '<form class="zib-widget">' . $my_complaint_style . '<div ' . $my_complaint_div . '>您当前没有举报记录</div></form>'; } else { $page = isset($_GET['page']) ? absint($_GET['page']) : 1; // 获取当前页数,默认为第一页 $per_page = 3; // 每页显示的举报信息数量 $total_items = count($results); // 总的举报信息数量 $total_pages = ceil($total_items / $per_page); // 计算总页数 // 确保当前页数不超过总页数 if ($page > $total_pages) { $page = $total_pages; } // 计算起始索引和结束索引 $start_index = ($page - 1) * $per_page; $end_index = min($start_index + $per_page, $total_items); $html = '<div>'; for ($i = $start_index; $i < $end_index; $i++) { $result = $results[$i]; // 提取提交举报的时间 preg_match('/提交时间:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/', $result->content, $matches); if (isset($matches[1])) { $submission_time = $matches[1]; $html .= "<p $my_complaint_time>提交时间:$submission_time</p>"; } // 提取被举报用户到提交时间之间举报信息 $start_pos = strpos($result->content, '被举报用户:'); $end_pos = strpos($result->content, '提交时间:'); $filtered_content = substr($result->content, $start_pos, $end_pos - $start_pos); $html .= "<p $my_complaint_div>" . $filtered_content; // 判断处理进度并添加相应的样式和文字 if ($result->status == 1) { // 处理完成 $html .= '<span style="display: inline-block; width: 100%; height: 2px; background-color: #4abd15bd;"></span>'; $html .= '<span style="color: #4abd15bd;">处理完成</span>'; } else { // 正在处理 $html .= '<span style="display: inline-block; width: 50%; height: 2px; background-color: #ffe8a4;"></span>'; $html .= '<span style="color: #ffd353;">正在处理</span>'; } $html .= '</p>'; } $html .= '</div>'; // 分页按钮 if ($total_pages > 1) { $pagination_html = '<div style="margin-top: 10px;">'; $pagination_html .= '<span style="padding: 5px;">共 ' . $total_items . ' 条举报信息</span>'; if ($page > 1) { $prev_page = $page - 1; $pagination_html .= '<a href="?page=' . $prev_page . '" style="padding: 5px;margin-right: 5px;">上一页</a>'; } if ($page < $total_pages) { $next_page = $page + 1; $pagination_html .= '<a href="?page=' . $next_page . '" style="padding: 5px;margin-right: 5px;">下一页</a>'; } $pagination_html .= '</div>'; $html .= $pagination_html; } $html = '<form class="zib-widget">' . $my_complaint_style . $html . '</form>'; } return zib_get_ajax_ajaxpager_one_centent($html); } add_filter('main_user_tab_content_complaint', 'zib_main_user_tab_content_complaint'); ②带有处理进度的选项卡页面代码《 有处理进度的功能+正在处理的投诉根据提交时间依次前面》 // 我的投诉页面 function zib_main_user_tab_content_complaint() { $current_user_id = get_current_user_id(); $my_complaint_style = '<div style="margin-bottom: 10px;padding: 15px;color: #0986f5;background: #337ab71c;">加入网络监督员维护社区网络环境,举报不良信息,共建和谐绿色社区</div>'; $my_complaint_div ='style="background: #eeeeee57;padding: 15px;margin-bottom: 15px;"'; $my_complaint_time ='style="background: rgb(239, 243, 245);padding: 10px;color: #55798a;margin-bottom: auto;"'; global $wpdb; $table_name = $wpdb->prefix . 'zib_message'; $query = $wpdb->prepare( "SELECT * FROM $table_name WHERE send_user = %d AND type = %s ORDER BY status ASC, content ASC", $current_user_id, 'user_report' ); $results = $wpdb->get_results($query); //如果查询记录为空则显示 if (empty($results)) { $html = '<form class="zib-widget">' . $my_complaint_style . '<div ' . $my_complaint_div . '>您当前没有举报记录</div></form>'; } else { $html = '<form class="zib-widget">' . $my_complaint_style; foreach ($results as $result) { // 提取提交举报的时间 preg_match('/提交时间:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/', $result->content, $matches); if (isset($matches[1])) { $submission_time = $matches[1]; $html .= "<p $my_complaint_time>提交时间:$submission_time</p>"; } // 提取被举报用户到提交时间之间举报信息 $start_pos = strpos($result->content, '被举报用户:'); $end_pos = strpos($result->content, '提交时间:'); $filtered_content = substr($result->content, $start_pos, $end_pos - $start_pos); $filtered_content = str_replace('<br>', '<br class="complaint-br">', $filtered_content); $html .= "<div $my_complaint_div>" . $filtered_content; // 判断处理进度并添加相应的样式和文字 if ($result->status == 1) { // 处理完成 $html .= '<div class="progress-bar">'; $html .= '<div class="progress-bg progress-completed"></div>'; $html .= '</div>'; $html .= '<p style="margin-bottom: 5px;">投诉已经处理</p>'; } else { // 正在处理 $html .= '<div class="progress-bar">'; $html .= '<div class="progress-bg progress-processing"></div>'; $html .= '</div>'; $html .= '<p style="margin-bottom: 5px;">正在处理中...</p>'; } $html .= '</div>'; } $html .= '</form>'; } return zib_get_ajax_ajaxpager_one_centent($html); } add_filter('main_user_tab_content_complaint', 'zib_main_user_tab_content_complaint'); // 添加CSS样式 function add_custom_styles() { echo ' <style> .progress-bar{ width: 100%; height: 10px; overflow: hidden; box-sizing: border-box; border-radius: 24px; background-color: rgba(180, 160, 120, .2); position: relative; box-shadow: unset; margin-bottom: 5px; } .progress-bg{ width: 10%; height: 100%; overflow: hidden; box-sizing: border-box; background-image: linear-gradient(135deg, #00BFFF 25%,#FA8072 0,#FA8072 50%,#00BFFF 0,#00BFFF 75%, #FA8072 0); border-radius: 24px; animation: panoramic 20s linear infinite; background-size: 32px 100%; } @keyframes panoramic{ to { background-position: 200% 0; } } .progress-completed { width: 100%; background-image: linear-gradient(135deg, #4abd15bd 25%,#4abd15bd 0,#4abd15bd 50%,#4abd15bd 0,#4abd15bd 75%, #4abd15bd 0); animation: none; } .progress-processing { width: 50%; background-image: linear-gradient(135deg, #ffe8a4 25%,#ffd353 0,#ffd353 50%,#ffe8a4 0,#ffe8a4 75%, #ffd353 0); animation: none; } .complaint-br { display: block; margin-bottom: 5px; } </style> '; } add_action('wp_head', 'add_custom_styles'); ③《 无处理进度的功能》: // 我的投诉页面 function zib_main_user_tab_content_complaint() { $current_user_id = get_current_user_id(); $my_complaint_style = '<div style="margin-bottom: 10px;padding: 15px;color: #0986f5;background: #337ab71c;">加入网络监督员维护社区网络环境,举报不良信息,共建和谐绿色社区</div>'; $my_complaint_div ='style="background: #eeeeee57;padding: 15px;"'; global $wpdb; $table_name = $wpdb->prefix . 'zib_message'; $query = $wpdb->prepare( "SELECT * FROM $table_name WHERE send_user = %d AND type = %s", $current_user_id, 'user_report' ); $results = $wpdb->get_results($query); //如果查询记录为空则显示 if (empty($results)) { $html = '<form class="zib-widget">' . $my_complaint_style . '<div ' . $my_complaint_div . '>您当前没有举报记录</div></form>'; } else { $html = '<div>'; foreach ($results as $result) { // 提取被举报用户到提交时间之间的文本 $start_pos = strpos($result->content, '被举报用户:'); $end_pos = strpos($result->content, '提交时间:'); $filtered_content = substr($result->content, $start_pos, $end_pos - $start_pos); $html .= "<p $my_complaint_div>" . $filtered_content; // 提取提交时间中的数字部分 preg_match('/提交时间:(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/', $result->content, $matches); if (isset($matches[1])) { $submission_time = $matches[1]; $html .= '提交时间:' . $submission_time; } $html .= '</p>'; } $html .= '</div>'; $html = '<form class="zib-widget">' . $my_complaint_style . $html . '</form>'; } return zib_get_ajax_ajaxpager_one_centent($html); } add_filter('main_user_tab_content_complaint', 'zib_main_user_tab_content_complaint'); 温馨提示:本文最后更新于2024-03-19 21:16:14,某些文章具有时效性,若有错误或已失效,请在下方留言或联系网站客服。 本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负! ------本页内容已结束,喜欢请分享------ 三月 19 本站历史上的今天 "吼吼~~~,往年的今天站长不知道跑哪里偷懒去了~~~" © 版权声明 版权声明 1 本网站名称:寒江资源网 2 本站永久网址:https://www.aiik.cn 3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请发送邮件到:hjyunl@163.com我们将72小时内进行删除处理。 4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。 5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报 6 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。 7 本站所有资源免费,付费资源仅为抵消人工测试和维护服务器日常所带来的消耗成本。 吼吼~~ 我是一条底线哟~技术教程# 代码# 教程# 子比# 子比主题# 投诉页面 喜欢就支持一下吧点赞5赞赏 分享QQ空间微博QQ好友海报分享复制链接收藏 寒江关注 0247813031.1W+ 子比主题美化-网站底部信息统计模块自动获取日期及访问者IP子比主题美化-网站底部信息统计模块自动获取日期及访问者IP5个月前 1802023最新Zibll子比主题最新版-V7.5.1版本源码 免授权 亲测可用2023最新Zibll子比主题最新版-V7.5.1版本源码 免授权 亲测可用6个月前 174子比主题美化-给主题评论区增加自动打卡功能子比主题美化-给主题评论区增加自动打卡功能5个月前 1532023最新Zibll子比主题最新版-V7.4.2版本源码 免授权 亲测可用2023最新Zibll子比主题最新版-V7.4.2版本源码 免授权 亲测可用6个月前 153用php搭建一个属于自己的随机一言API接口用php搭建一个属于自己的随机一言API接口5个月前 145为子比网站添加一个赞助鸡腿页面源码为子比网站添加一个赞助鸡腿页面源码5个月前 141 上一篇 子比主题用户购买会员后自动认证官方铭牌 下一篇 给网站添加一个每日60s新闻页面 相关推荐 子比主题美化-网站底部信息统计模块自动获取日期及访问者IP子比主题美化-网站底部信息统计模块自动获取日期及访问者IP5个月前 1802023最新Zibll子比主题最新版-V7.5.1版本源码 免授权 亲测可用2023最新Zibll子比主题最新版-V7.5.1版本源码 免授权 亲测可用6个月前 1742023最新Zibll子比主题最新版-V7.4.2版本源码 免授权 亲测可用2023最新Zibll子比主题最新版-V7.4.2版本源码 免授权 亲测可用6个月前 153子比主题美化-给主题评论区增加自动打卡功能子比主题美化-给主题评论区增加自动打卡功能5个月前 153用php搭建一个属于自己的随机一言API接口用php搭建一个属于自己的随机一言API接口5个月前 145为子比网站添加一个赞助鸡腿页面源码为子比网站添加一个赞助鸡腿页面源码5个月前 141 评论 抢沙发 请登录后发表评论 登录 注册 社交账号登录QQ登录微信登录微博登录支付宝登录GitHub登录 请登录后查看评论内容