如果在wordpress中获得超过3个报告,请将帖子设置为“待定”

I am using wp user frontend, and I have also downloaded a plugin called 'WP-Reportpost'.

What I am trying to do is that I want users to add post with WP User Frontend (which is working), but when a post get more then 3 reports from other users it should change it status from 'Published' too 'Pending'.

I am trying to make a function in functions.php, but I can't get the code to work. So far I got this:

 /* Set posts to pending */
function change_post_status($post_id,$status){
    $current_post = get_post( $post_id, 'ARRAY_A' );
    $current_post['post_status'] = $status;
    wp_update_post($current_post);
}

and in reports.php I have put this code:

if(count($report) >= 3){
    change_post_status($report->postID,'pending');
}

The the post still has status as 'Published' and not 'Pending'.

Any tips?

Thanks for the help with the code. I at least find the way to figur this out.

I placed this code inside the functions.php file

/* Code to change post status */
function change_post_status($post_id,$status){
    $current_post = get_post( $post_id, 'ARRAY_A' );
    $current_post['post_status'] = $status;
    wp_update_post($current_post);
}

to use the function I did this:

change_post_status($report->postID,'pending');

What I did was to use print_r to get what the $report object was saving and get the postID from there.

Thanks for the help guys!