Make WordPress Core

Changeset 17052


Ignore:
Timestamp:
12/19/2010 04:55:46 AM (14 years ago)
Author:
dd32
Message:

Fix Pings/Trackback comment table filter. Props greuben. Fixes #15885

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r16999 r17052  
    306306        if ( '' !== $karma )
    307307            $where .= $wpdb->prepare( ' AND comment_karma = %d', $karma );
    308         if ( 'comment' == $type )
     308        if ( 'comment' == $type ) {
    309309            $where .= " AND comment_type = ''";
    310         elseif ( ! empty( $type ) )
     310        } elseif( 'pings' == $type ) {
     311            $where .= ' AND comment_type IN ("pingback", "trackback")';
     312        } elseif ( ! empty( $type ) ) {
    311313            $where .= $wpdb->prepare( ' AND comment_type = %s', $type );
     314        }
    312315        if ( '' !== $parent )
    313316            $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent );
     
    17601763
    17611764    $pung = get_pung($post_ID);
    1762 
     1765var_Dump(compact('pung'));
    17631766    // Variables
    17641767    $ltrs = '\w';
     
    17831786
    17841787    foreach ( (array) $post_links_temp[0] as $link_test ) :
    1785         if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
     1788        if ( !in_array($link_test, $pung) && !in_array($link_test, $post_links) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
    17861789                && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
    17871790            if ( $test = @parse_url($link_test) ) {
     
    17931796        endif;
    17941797    endforeach;
    1795 
     1798var_dump(compact('post_links', 'post_links_temp'));
    17961799    do_action_ref_array('pre_ping', array(&$post_links, &$pung));
    17971800
    17981801    foreach ( (array) $post_links as $pagelinkedto ) {
    17991802        $pingback_server_url = discover_pingback_server_uri( $pagelinkedto );
     1803        var_dump(compact('pagelinkedto', 'pingback_server_url'));
    18001804
    18011805        if ( $pingback_server_url ) {
     
    18061810            // using a timeout of 3 seconds should be enough to cover slow servers
    18071811            $client = new WP_HTTP_IXR_Client($pingback_server_url);
    1808             $client->timeout = 3;
     1812            $client->timeout = 5;
    18091813            $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);
    18101814            // when set to true, this outputs debug messages by itself
    1811             $client->debug = false;
     1815            $client->debug = true;
    18121816
    18131817            if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered
    18141818                add_ping( $post_ID, $pagelinkedto );
     1819            var_Dump($client);
     1820            echo '<hr />';
    18151821        }
    18161822    }
Note: See TracChangeset for help on using the changeset viewer.