Skip to:
Content

bbPress.org

Changeset 7149


Ignore:
Timestamp:
11/05/2020 05:53:59 PM (3 years ago)
Author:
johnjamesjacoby
Message:

Meta: always query meta_value by string, not by integer.

This commit swaps "%d" for "%s" when querying by meta_value, even with numeric values. This allows for custom index alterations to perform as intended, and also more closely follows how WordPress core itself operates.

In branches/2.6, for 2.6.6. See #3408.

Location:
branches/2.6/src/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/src/includes/admin/tools/upgrade.php

    r6991 r7149  
    427427
    428428            // Skip if already exists
    429             if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %d", $post_id, $new_key, $meta->user_id ) ) ) {
     429            if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $new_key, $meta->user_id ) ) ) {
    430430                continue;
    431431            }
     
    487487
    488488            // Skip if already exists
    489             if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %d", $post_id, $new_key, $meta->user_id ) ) ) {
     489            if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $new_key, $meta->user_id ) ) ) {
    490490                continue;
    491491            }
     
    547547
    548548            // Skip if already exists
    549             if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %d", $post_id, $new_key, $meta->user_id ) ) ) {
     549            if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT COUNT(*) FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $new_key, $meta->user_id ) ) ) {
    550550                continue;
    551551            }
  • branches/2.6/src/includes/common/functions.php

    r7097 r7149  
    17391739                            ON p.ID = pm.post_id
    17401740                            AND pm.meta_key = %s
    1741                     WHERE pm.meta_value = %d
     1741                    WHERE pm.meta_value = %s
    17421742                    GROUP BY p.post_status, p.post_type";
    17431743
Note: See TracChangeset for help on using the changeset viewer.