Making WordPress.org

Changeset 14181


Ignore:
Timestamp:
11/20/2024 07:34:17 PM (2 years ago)
Author:
coffee2code
Message:

Photo Directory, Search: Prevent table name collisions in searches with an explicit taxonomy.

Props ryelle.
See #7815.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/search.php

    r14180 r14181  
    8282                        $join .= "
    8383                                LEFT JOIN
    84                                   {$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id
     84                                        {$wpdb->term_relationships} AS tr_search ON {$wpdb->posts}.ID = tr_search.object_id
    8585                                LEFT JOIN
    86                                   {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id
     86                                        {$wpdb->term_taxonomy} AS tt_search ON tt_search.term_taxonomy_id = tr_search.term_taxonomy_id
    8787                                LEFT JOIN
    88                                   {$wpdb->terms} ON {$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id
     88                                        {$wpdb->terms} AS t_search ON t_search.term_id = tt_search.term_id
    8989                          ";
    9090                }
    … …  
    132132                                $or_tag = $wpdb->prepare( "OR
    133133                                        (
    134                                                 {$wpdb->term_taxonomy}.taxonomy = %s
     134                                                tt_search.taxonomy = %s
    135135                                                AND
    136                                                 {$wpdb->terms}.name = %s
     136                                                t_search.name = %s
    137137                                        ) ",
    138138                                        Registrations::get_taxonomy( 'tags' ),
Note: See TracChangeset for help on using the changeset viewer.