Make WordPress Core

Ticket #15249: 15249.patch

File 15249.patch, 1.8 KB (added by sc0ttkclark, 14 years ago)

Initial Patch including the new filters for Users / Comments

  • wp-includes/comment.php

     
    321321                        $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent );
    322322                if ( '' !== $user_id )
    323323                        $where .= $wpdb->prepare( ' AND user_id = %d', $user_id );
    324                 if ( '' !== $search )
    325                         $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) );
     324                if ( '' !== $search ) {
     325                        $search_columns = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' );
     326                        $search_sql = $this->get_search_sql( $search, $search_columns );
     327                        $where .= apply_filters_ref_array( 'comment_search_sql', array($search_sql, &$this, $search_columns ) );
     328                }
    326329
    327330                $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
    328331                $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
  • wp-includes/user.php

     
    447447
    448448                $search = trim( $qv['search'] );
    449449                if ( $search ) {
    450                         $this->query_where .= $this->get_search_sql( $search, array( 'user_login', 'user_nicename', 'user_email', 'user_url', 'display_name' ) );
     450                        $search_columns = array( 'user_login', 'user_nicename', 'user_email', 'user_url', 'display_name' );
     451                        $search_sql = $this->get_search_sql( $search, $search_columns );
     452                        $this->query_where .= apply_filters_ref_array( 'user_search_sql', array($search_sql, $search_columns ) );
    451453                }
    452454
    453455                $this->parse_meta_query( $qv );