Fixing plugin for wpdb::prepare

The error you’re facing definitely isn’t coming from your code shown above. This is an error notice that was raised with WP 3.5 (IIRC) that should note that stand alone $wpdb->prepare( STATEMENT ); calls help nothing.

Missing argument 2 for wpdb::prepare()

tells you that you haven’t added any argument to the call. The prepare() method works like sprintf() aside from the fact that it only knows %s for strings and %d for digits.

So use it like this:

global $wpdb;
$wpdb->query( $wpdb->prepare(
    "SELECT * FROM {$wpdb->posts} WHERE ID = %d AND post_type = %s",
    abs_int( $_GET['post_id'] ),
    esc_attr( $_GET['type' )
) );

Keep in mind that is just dummy code showing how to properly secure HTML form data processed in a WP DB call.