操作方法:在主题func.php中添加以下代码
function zib_user_complaint($buttons)
{
$buttons[] = array(
'html' => '',
'icon' => '<svg t="1688968573785" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5245" width="200" height="200"><path d="M232.727273 117.410909m93.090909 0l372.363636 0q93.090909 0 93.090909 93.090909l0 512q0 93.090909-93.090909 93.090909l-372.363636 0q-93.090909 0-93.090909-93.090909l0-512q0-93.090909 93.090909-93.090909Z" fill="#B177ED" opacity=".8" p-id="5246"></path><path d="M337.454545 233.774545m23.272728 0l302.545454 0q23.272727 0 23.272728 23.272728l0 0q0 23.272727-23.272728 23.272727l-302.545454 0q-23.272727 0-23.272728-23.272727l0 0q0-23.272727 23.272728-23.272728Z" fill="#FFFFFF" p-id="5247"></path><path d="M337.454545 373.387636m23.272728 0l186.181818 0q23.272727 0 23.272727 23.272728l0 0q0 23.272727-23.272727 23.272727l-186.181818 0q-23.272727 0-23.272728-23.272727l0 0q0-23.272727 23.272728-23.272728Z" fill="#FFFFFF" p-id="5248"></path><path d="M814.568727 907.636364h-605.090909a93.090909 93.090909 0 0 1-93.090909-93.090909v-334.289455a93.090909 93.090909 0 0 1 130.653091-85.154909l227.397818 100.305454a93.090909 93.090909 0 0 0 75.147637 0l227.397818-100.305454a93.090909 93.090909 0 0 1 130.676363 85.154909v334.289455a93.090909 93.090909 0 0 1-93.090909 93.090909z" fill="#8D1DEF" opacity=".8" p-id="5249"></path></svg>',
'name' => '我的投诉',
'tab' => 'complaint',
);
return $buttons;
}add_filter('zib_user_center_page_sidebar_button_1_args', 'zib_user_complaint');
function zib_user_complaint_page($tabs_array)
{
$tabs_array['complaint'] = array(
'title' => '我的投诉',
'nav_attr' => 'drawer-title="我的投诉"',
'loader' => '<div class="zib-widget">
<div class="placeholder k1 mb10"></div>
<div class="placeholder k1 mb10"></div>
<div class="placeholder s1"></div>
<div class="placeholder t1 mt20"></div>
<div class="placeholder s2"></div>
<div class="placeholder k1 mb10"></div>
<div class="placeholder k1 mb10"></div>
<div class="placeholder s1"></div>
<div class="placeholder t1 mt20"></div>
<div class="placeholder s2"></div>
</div>',
'content_func' => 'zib_main_user_tab_content_complaint', // 添加此行
);
return $tabs_array;
}
add_filter('user_ctnter_main_tabs_array', 'zib_user_complaint_page');
//我的投诉页面
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');
文章源自小武站https://1z345.cn/小武站-https://bbs.50-0.cn/768.html 文章源自小武站https://1z345.cn/小武站-https://bbs.50-0.cn/768.html
继续阅读
美团众包服务分低被封怎么办?全面解决方案助你解封
美团众包服务分较低被封后,可尝试以下方法解决。首先,要分析服务分低的原因,可能是在任务完成过程中有不当行为,如在任务完成前取消订单、同时处理多个任务等。遵守平台规定有助于提高服务得分,所以应避免此类行...
河蚌养殖需要办理哪些证件
河蚌养殖通常需要办理以下证件:1. 水域滩涂养殖证:如果养殖河蚌的水域是国有或者集体所有,需要办理此证,以获得合法的养殖使用权。2. 水产养殖许可证:证明具备从事水产养殖的资格和条件。3. 营业执照:...