摘要:大挖的后台今天突然发现了一处报错,if($unread_count = $wpjam_topic_messages[‘u…
大挖的后台今天突然发现了一处报错,if($unread_count = $wpjam_topic_messages[‘unread_count’]){刚开始以为是WPJAM BASIC插件的七牛云存储插件的问题,但是通过再次的设置并没有得到有效的解决,通过百度错误提示,发现了问题所在。
大挖安装的是WPJAM BASIC插件比较旧的版本的,只有2.6.2,通过代码的查看是因为一个WP问题的代码函数出现了问题,因为WPJAM BASIC插件的作品提供了一个简单的问答社区功能,但是其它大挖并不需要,所以直接在后台进行了注释隐藏,问题就有效的解决了。
通过插件的问题目标,找到路径所描述的插件”wpjam-basic/include/topic.php“文件,可以插件找到如下代码(大概在第83行到112行):
if(wpjam_topic_get_weixin_user()){
$wpjam_topic_messages = wpjam_get_topic_messages();
if($unread_count = $wpjam_topic_messages[‘unread_count’]){
$menu_title .= ‘<span class=”update-plugins count-‘.$unread_count.'”><span class=”plugin-count”>’.$unread_count.'</span></span>’;
}
$subs[‘wpjam-topics’] = array(‘menu_title’=> ‘所有问答’, ‘function’=>’wpjam_topics_page’, ‘capability’ => ‘read’);
$subs[‘wpjam-topic’] = array(‘menu_title’=> ‘我要提问’, ‘function’=>’wpjam_topic_edit_page’,’capability’ => ‘read’);
$subs[‘wpjam-topic-user’] = array(‘menu_title’=> ‘个人资料’, ‘function’=>’wpjam_topic_user_page’,’capability’ => ‘read’);
if(isset($_GET[‘page’]) && ($_GET[‘page’] == ‘wpjam-topic-messages’)){
$subs[‘wpjam-topic-messages’] = array(‘menu_title’=> ‘消息提醒’, ‘function’=>’wpjam_topic_messages_page’,’capability’ => ‘read’);
}
}
$wpjam_pages[‘wpjam-topics’] = array(
‘menu_title’ => $menu_title,
‘icon’ => ‘dashicons-wordpress’,
‘subs’ => $subs,
‘capability’ => ‘read’
);
return $wpjam_pages;
}
123456789101112131415161718192021222324252627282930 | add_filter(‘wpjam_pages’, ‘wpjam_topic_admin_pages’);add_filter(‘wpjam_network_pages’, ‘wpjam_topic_admin_pages’);function wpjam_topic_admin_pages($wpjam_pages){ $subs = array(); $menu_title = ‘WP问题’; if(wpjam_topic_get_weixin_user()){ $wpjam_topic_messages = wpjam_get_topic_messages(); if($unread_count = $wpjam_topic_messages[‘unread_count’]){ $menu_title .= ‘<span class=”update-plugins count-‘.$unread_count.‘”><span class=”plugin-count”>’.$unread_count.‘</span></span>’; } $subs[‘wpjam-topics’] = array(‘menu_title’=> ‘所有问答’, ‘function’=>‘wpjam_topics_page’, ‘capability’ => ‘read’); $subs[‘wpjam-topic’] = array(‘menu_title’=> ‘我要提问’, ‘function’=>‘wpjam_topic_edit_page’,‘capability’ => ‘read’); $subs[‘wpjam-topic-user’] = array(‘menu_title’=> ‘个人资料’, ‘function’=>‘wpjam_topic_user_page’,‘capability’ => ‘read’); if(isset($_GET[‘page’]) && ($_GET[‘page’] == ‘wpjam-topic-messages’)){ $subs[‘wpjam-topic-messages’] = array(‘menu_title’=> ‘消息提醒’, ‘function’=>‘wpjam_topic_messages_page’,‘capability’ => ‘read’); } } $wpjam_pages[‘wpjam-topics’] = array( ‘menu_title’ => $menu_title, ‘icon’ => ‘dashicons-wordpress’, ‘subs’ => $subs, ‘capability’ => ‘read’ ); return $wpjam_pages;} |
将上面的所有代码注释掉或删除掉即可,上面的代码应该是将“WP问题”这个按钮添加到后台左侧导航的意思,只要将该函数删除即不会在左侧添加按钮了,也不影响插件的其他正常运行。为了插件的安全起见,我没有直接删除代码,而是选择注释。
附:二00二年一月一日《计算机软件保护条例》第十七条规定:为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬!鉴于此,也希望大家按此说明研究软件!
一、本站致力于为软件爱好者提供国内外软件开发技术和软件共享,着力为用户提供优资资源。
二、 本站提供的部分源码下载文件为网络共享资源,请于下载后的24小时内删除。如需体验更多乐趣,还请支持正版。
三、我站提供用户下载的所有内容均转自互联网。如有内容侵犯您的版权或其他利益的,若有侵犯你的权益请: 前往投诉 站长会进行审查之后,情况属实的会在三个工作日内为您删除。
暂无评论内容