Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/19/2014 01:36:57 AM (12 years ago)
Author:
boonebgorges
Message:

Refactor all uses of like_escape() to use bp_esc_like()

WordPress 4.0 will deprecate like_escape(), due to a history of inconsistent
documentation and usage. Its replacement is a new method, $wpdb->esc_like(),
which will be available only in WP 4.0. For this reason, and because the
return value of $wpdb->esc_like() will not always be identical to that of
like_escape(), BP cannot do a straight swap of the old function for the new
one. Instead, we introduce a wrapper function that uses the core method if
available, and otherwise reproduces the logic of that method (for earlier
versions of WordPress).

Fixes #5701
slightly different syntax in some cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-classes.php

    r8318 r8541  
    151151                        // Search terms
    152152                        if ( ! empty( $r['usersearch'] ) ) {
    153                                 $search_terms_clean = esc_sql( esc_sql( $r['usersearch'] ) );
    154                                 $search_terms_clean = like_escape( $search_terms_clean );
    155                                 $sql['where'][]     = "( user_login LIKE '%" . $search_terms_clean . "%' OR user_email LIKE '%" . $search_terms_clean . "%' OR meta LIKE '%" . $search_terms_clean . "%' )";
     153                                $search_terms_like = '%' . bp_esc_like( $r['usersearch'] ) . '%';
     154                                $sql['where'][]    = $wpdb->prepare( "( user_login LIKE %s OR user_email LIKE %s OR meta LIKE %s )", $search_terms_like, $search_terms_like, $search_terms_like );
    156155                        }
    157156
    … …  
    209208
    210209                        /**
    211                          * add a boolean in case the last time an activation link 
     210                         * add a boolean in case the last time an activation link
    212211                         * has been sent happened less than a day ago
    213212                         */
Note: See TracChangeset for help on using the changeset viewer.