更改评论列表中显示的IP后面的Wordpress链接 - column_author


change Link at Wordpress behind the shown IP on the comment list - column_author

嗨,裂缝和职业,

在Wordpress的仪表板上,我们有一个所有给定评论的列表,这些评论显示在yourDomain.com/wp-admin/edit-comments.php

我们可以看到有关评论作者的所有信息 第一列 - 作为 $comment_author

作者 IP 后面有一个显示的 URL,我不得不更改 - 我认为是这样,最好有一个功能。

任何提示,想法或解决方案如何更改精算给出URL:

  • yourDomain.com/wp-admin/edit-comments.php?s=127.0.0.1&mode=detail

。进入这样的网址...

  • http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist%3a127.0.0.1

*...其中 127.0.0.1 是来自 comment_author 的 IP!

附言:对不起,我的英语很糟糕,但我希望它足以理解我?!

我非常努力地寻找一种通过使用钩子来做到这一点的纯 PHP 方法,但我认为没有。 注释表中的大部分 HTML 都是通过文件中的 echo 输出的,wp-admin/includes/class-wp-comments-list-table.php可以很容易地扩展,但我没有看到指示 Wordpress 加载扩展类的方法。

无论如何,这里有一个 Wordpress 插件,它在 admin_footer 中注册了一个钩子,如果正在查看的页面edit-comments.php,它会输出一些 Javascript。

您可以将其放在.php文件中,并将其添加到wp-content/plugins文件夹中。 转到WP管理员,然后激活插件。 我称之为Comment IP Address Blacklist Lookup.

这是代码。 我不打算用它做任何事情,所以我把它作为GPL代码发布。 随时寻求帮助或提出任何改进建议。

<?php
/*
Plugin Name: Comment IP Address Blacklist Lookup
Plugin URI: http://example.com
Description: Changes the IP address link in the comment list to MXToolbox.com's blacklist check
Author: Drew Phillips
Version: 0.1
Author URI: https://www.drew.co.il
*/
/*  Copyright (C) 2012 Drew Phillips
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
require_once ABSPATH . '/wp-includes/pluggable.php';
// Admin menu and admin functions below...
add_action('admin_footer', 'replace_admin_footer');
function replace_admin_footer()
{
    if (basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php') {
        echo <<<EOD
<script type="text/javascript">
<!--
    function replace_comments()
    {
        var links = document.getElementsByTagName('a');
        var i, link, match;
        for (i in links) {
            link = links[i];
            if ( null != (match = link.href.match(/edit-comments'.php'?s=('d+'.'d+'.'d+'.'d+)&mode=detail/))) {
                link.href = "http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist:" + match[1];
                link.target = "_blank";
            }
        }
    }
    replace_comments();
-->
EOD;
    }
}