WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
[PATCH] wpdb::prepare() requires 2 arguments (2 posts)

  1. flynsarmy
    Member
    Posted 1 year ago #

    In WP3.5.1 I'm getting awpdb->prepare() error. You shouldn't be using prepare when you're not substituting anything. You don't have to worry about sanitizing this particular query because wpdb->prefix is already sanitized and you're not substituting any variables.

    So in /models/group.php function get_for_select()
    replace
    $rows = $wpdb->get_results( $wpdb->prepare( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" ) );
    with
    $rows = $wpdb->get_results( "SELECT {$wpdb->prefix}redirection_modules.name AS module_name,{$wpdb->prefix}redirection_groups.name AS group_name,{$wpdb->prefix}redirection_groups.id FROM {$wpdb->prefix}redirection_groups INNER JOIN {$wpdb->prefix}redirection_modules ON {$wpdb->prefix}redirection_modules.id={$wpdb->prefix}redirection_groups.module_id ORDER BY {$wpdb->prefix}redirection_modules.name,{$wpdb->prefix}redirection_groups.position" );

    http://wordpress.org/extend/plugins/redirection/

  2. ParamasivanPN
    Member
    Posted 1 year ago #

    I was getting the following error msg.

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/alfresco/public_html/wp-content/plugins/redirection/models/group.php on line 70 and defined in /home/alfresco/public_html/wp-includes/wp-db.php on line 990

    Above patch fixed the problem.

    Thank you very much !

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.