Заказ закрыт
Вордпресс топ комментаторв

Бюджет: 10 $
7.49 € – 826.06 руб
Заказчик выбрал исполнителя:
Анзор Шобеков  
есть готовый код для вордпресс в файл functions.php, нужно убрать с него часть,которая выводит ссылку сайт автора комментария, вот код:

function sp_top_commentator_winners(){
    global $wpdb;
    $length = 0;        // Максимальная длинна имени в символах, если стоит 0, то имя не обрезается
    $month = true;     // true – за текущий месяц, false – за все время
    $comment = true;    // показывать количество комментариев
    $nofollow = true;   // ссылки nofollow
    $count = 3;        // количество комментаторов
    $col = 3;       // количество колонок
    $avatarSize = 40;   // размер аватара
    $exceptionEmail = 'mirmirnv@yandex.ru, mirmirnv@gmail.com'; // мыла-исключения
    $lengthMin = 10;    // минимальное количество символов в учитываемом комментарии

    $showWinners = true;    // показывать победителей
    $countWinners = 3;  // количество победителей
    $showDays = 30;      // количество дней, которое показываются победители
    $separator = '<div class="dewer"></div> <div class="investtitle-3">Лучшие за прошлый месяц</div> '; // разделитель ТОПа и победителей
   
    $results = $wpdb->get_results('
        SELECT
            COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
        FROM
            (select * from '.$wpdb->comments.' where CHAR_LENGTH(comment_content) > '. $lengthMin .' order by comment_ID desc) as pc
        WHERE
            comment_author_email != "" AND
            comment_type = "" AND
            comment_approved = 1 AND
            comment_author_email NOT IN ('.preg_replace('/([wd.-_]+@[wd.-_]+)(,? ?)/','"\1"\2',$exceptionEmail).')'.
            ($month ? 'AND month(comment_date) = month(now()) and year(comment_date) = year(now())' : '').
        'GROUP BY
            comment_author_email
        ORDER BY
            comments_count DESC,
            comment_ID ASC
        LIMIT '.$count
    );

    $firstIteration = true; // отвечает за то чтобы было всего две итерации
    do {
        $output = "<div class='top-comment'><table width='100%'><tr>";
        $i = 0;
        foreach($results as $result){
            if ($i>=$col) {
                $output .= "</tr><tr>";
                $i = 0;
            }
            $i++;
            $output .= "<td><div class='avatar-top'>".get_avatar($result->comment_author_email,$avatarSize)." </div><div class='avatar-comment'>";
            if ($length and $length<mb_strlen($result->comment_author)) $result->comment_author = trim(mb_substr($result->comment_author, 0, $length)).'.';
            if ($result->comment_author_url)
                if ($nofollow)
                    $output .= "<a target='_blank' rel='nofollow' href='".$result->comment_author_url."'>".$result->comment_author." </a>";
                else
                    $output .= "<a target='_blank' href='".$result->comment_author_url."'>".$result->comment_author." </a>";
            else
                $output .= $result->comment_author;

            if ($comment) $output .= "(".$result->comments_count.")";
            $output .= "<div style='clear:both;'></div></div></td>";
        }
        if ($i<=$col) $output .= "</tr>";
        $output .= "</table></div>";
        echo $output;
       
        if ($showWinners and date('j') <= $showDays and $firstIteration) {
            $results = $wpdb->get_results('
                SELECT
                    COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
                FROM
                    (select * from '.$wpdb->comments.' where CHAR_LENGTH(comment_content) > '. $lengthMin .' order by comment_ID desc) as pc
                WHERE
                    comment_author_email != "" AND
                    comment_type = "" AND
                    comment_approved = 1 AND
                    comment_author_email NOT IN ('.preg_replace('/([wd.-_]+@[wd.-_]+)(,? ?)/','"\1"\2',$exceptionEmail).') AND
                    comment_date > LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 2 MONTH)) AND
                    comment_date < DATE_ADD(LAST_DAY(CURDATE() – INTERVAL 1 MONTH), INTERVAL 1 DAY)
                GROUP BY
                    comment_author_email
                ORDER BY
                    comments_count DESC,
                    comment_ID ASC
                LIMIT '.$countWinners
            );
            echo $separator;
            $firstIteration = false;
        } else {
            $showWinners = false;
        }
    } while($showWinners);
}
Опубликован 02.12.2014 в 10:25
Заказ находится в архиве

Выберите способ верификации:

Обновите страницу после прохождения верификации.