WordPress.org

Ready to get started?Download WordPress

Forums

Mingle Forum
[resolved] Warning when deleting a post after last update (2 posts)

  1. RR_80
    Member
    Posted 1 year ago #

    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/

  2. cartpauj
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.