• Please help me to update this code to use with newer WP versions. It’s from an abandoned plugin that hasn’t support anymore.

    Warning: Missing argument 2 for wpdb::prepare(), called in /home1/revoluts/public_html/mty/wp-content/plugins/photosmash-galleries/admin/bwbps-admin.php on line 3411 and defined in /home1/revoluts/public_html/mty/wp-includes/wp-db.php on line 992

    The line 3411 is: . PSIMAGESTABLE. ‘.image_id’ . $desc . $limitsql);

    The whole thing:

    case "moderation" :
    $sql = $wpdb->prepare('SELECT '.PSIMAGESTABLE
    . '.*, '.$wpdb->users.'.user_nicename,'
    . $wpdb->users.'.display_name, '.$wpdb->users
    . '.user_login, '.PSGALLERIESTABLE.'.gallery_name, '
    . $wpdb->posts . '.post_status '
    . $cfsql . " "
    . ' FROM ' . PSIMAGESTABLE
    . ' LEFT OUTER JOIN '.PSCUSTOMDATATABLE.' ON '.PSCUSTOMDATATABLE
    . '.image_id = '. PSIMAGESTABLE. '.image_id '
    . ' LEFT OUTER JOIN '.$wpdb->users.' ON '.$wpdb->users
    . '.ID = '. PSIMAGESTABLE. '.user_id '
    . ' LEFT OUTER JOIN '.PSGALLERIESTABLE
    . ' ON '.PSGALLERIESTABLE.'.gallery_id = '
    . PSIMAGESTABLE.'.gallery_id '
    . ' LEFT OUTER JOIN ' . $wpdb->posts . ' ON '
    . $wpdb->posts . '.ID = ' . PSIMAGESTABLE . '.post_id '
    . ' WHERE '. PSIMAGESTABLE
    . '.status = -1 OR '. PSIMAGESTABLE
    . '.alerted IN (-1, 0) ORDER BY '
    . PSIMAGESTABLE. '.image_id' . $desc . $limitsql);
    break;
Viewing 1 replies (of 1 total)
  • An old version of the prepare function:
    function prepare($args=NULL) {
    The current version of prepare function:
    public function prepare( $query, $args ) {

    Function prepare currently requires two parameters $query & $args. If the $args (second parameter) is null, the function simply returns. The purpose of the prepare function is to “sanitize” the query, removing any double quoted or single quoted wild cards. You could try to simply add “,NULL” to the prepare call.

    I was unable to load the plugin, so I can’t reproduce your error.

    I did find an alternative to this plugin, which is a paid plugin, and it may resolve your issues. Here is the link to the alternative

Viewing 1 replies (of 1 total)
  • The topic ‘Updating code to work with newer versions of WP’ is closed to new replies.