• Resolved vptcnt

    (@vptcnt)


    Hello,

    I have updated my website (development stage) with WordPress 6.2, and now the plugin says : “Loading…”

    No emails are displayed.

    Do you know why ?

    Thanks

    Vincent

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter vptcnt

    (@vptcnt)

    The plugin was working with one email on the page, but failed with several.

    The problem seems to come from the “prepare” method of the query.

    I succeed making the plugin worked by updating the line

    $query = $wpdb->prepare( "SELECT option_name, option_value FROM {$table} WHERE option_name IN ('{$sqlarray}')");
    

    inside the function cfe_get_all_emails

    Plugin Author webbernaut

    (@webbernaut)

    Sorry for the delay in response, WordPress isn’t sending me notifications I happened to just check the plugin stats and saw your message.

    Your trouble shooting has pointed me in the right direction. Thanks for that. The $wpdb->prepare was behaving different than expected.

    And your solution did fix the problem, but it was putting the variables/emails inside the raw SQL statement instead of retaining the placeholder that prepare is intended. So my modified version is slightly different keeping the placeholder being passed to prepare statement.

    Iv’e just pushed an update version 1.9.3, you should find this working for you.

    And if you are curious the slight changes I made it’s basically these three lines (similar to your approach but retaining the placeholder array):

    $placeholders = array_fill( 0, count( $emails ), '%s' ); //output multiple %s for placeholders for prepare statement
    
    $placeholders = implode( ', ', $placeholders );
    
    $query = $wpdb->prepare( "SELECT option_name, option_value FROM {$table} WHERE option_name IN ({$placeholders})", ...$emails ); // ...$emails unpacks array for placeholder
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Doesn’t work with 6.2’ is closed to new replies.