Support » Plugin: Mingle Forum » Warning when deleting a post after last update

  • Resolved RR_80

    (@rr_80)


    Warning: Missing argument 2 for wpdb::prepare(), called in .../wp-content/plugins/mingle-forum/wpf.class.php on line 2114 and defined in .../wp-includes/wp-db.php on line 990

    I realized it after the last update.

    old code

    function remove_post(){
    		global $user_ID, $wpdb;
    		$id = $_GET['id'];
    		$author = $wpdb->get_var("SELECT author_id from {$this->t_posts} where id = {$id}");
    
    		$del = "fail";
    		if(current_user_can("administrator") || is_super_admin($user_ID))
    			$del = "ok";
    		if($this->is_moderator($user_ID, $this->current_forum))
    			$del = "ok";
    		if($user_ID ==  $author)
    			$del = "ok";
    
    		if($del == "ok"){
    			$wpdb->query("DELETE FROM {$this->t_posts} WHERE id = {$id}");
    			$this->o .= "<div class='updated'>".__("Post deleted", "mingleforum")."</div>";
    		}else{
    			//@ob_end_clean();
    			wp_die(__("Cheating, are we?", "mingleforum"));
    		}
    	}

    new code

    function remove_post(){
    		global $user_ID, $wpdb;
    		$id = (isset($_GET['id']) && is_numeric($_GET['id']))?$_GET['id']:0;
    		$author = $wpdb->get_var($wpdb->prepare("SELECT author_id from {$this->t_posts} where id = %d"), $id);
    
    		$del = "fail";
    		if(current_user_can("administrator") || is_super_admin($user_ID))
    			$del = "ok";
    		if($this->is_moderator($user_ID, $this->current_forum))
    			$del = "ok";
    		if($user_ID ==  $author)
    			$del = "ok";
    
    		if($del == "ok"){
    			$wpdb->query($wpdb->prepare("DELETE FROM {$this->t_posts} WHERE id = %d", $id));
    			$this->o .= "<div class='updated'>".__("Post deleted", "mingleforum")."</div>";
    		}else{
    			wp_die(__("An unknown error has occured. Please try again.", "mingleforum"));
    		}
    	}

    http://wordpress.org/extend/plugins/mingle-forum/

Viewing 1 replies (of 1 total)
  • Plugin Author cartpauj

    (@cartpauj)

    This was fixed in 1.0.33 and you definitely shouldn’t be getting this in 1.0.34.

Viewing 1 replies (of 1 total)
  • The topic ‘Warning when deleting a post after last update’ is closed to new replies.