Site icon Hip-Hop Website Design and Development

Custom post status

I am trying to work out how to add a set of new publish statuses to custom post types in wordpress as I would like to do the following:

User signs in and uses the custom post type to fill in the information fields upon completion the post type should be set to awaiting approval and only viewable but not editable by the user then an admin should be able to set the status of approved (user can then not edit post after this status is set) or set to review required and then the user is able to edit this again once only as it should go back to awaiting approval and lastly rejected that stops the user from editing the post and stays viewable only.

What I need to find out is if its possible to maybe remove or edit the default publish box options to add my own status and how to set the posts to the statuses mentioned above.

Any help or pointing me in the right direction would be great full as i have done a lot of google searching and not found anything that shows me a way to achieve this.

Thanks!

So this is the code below I am trying to get working. I have it set to when a post is changed to publish it should allow me to run the wp_update_post but I’m getting the following error:

Trying to get property of non-object in /Applications/MAMP/htdocs/wordpress/wp-includes/capabilities.php on line 207

 function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) 
 {
    if ( ( 'publish' == $new_status && 'publish' !== $old_status )
        && 'cbre_access_form' == $post->post_type) 
    {  
      $my_post = array(
      'ID'           => $post->post_ID,
      'post_title'   => 'This is the post new title.',
      'post_content' => 'This is the new content.',
      'post_status'  => 'awaiting_review',
      );
      wp_update_post( $my_post );
    }
}
add_action( 'transition_post_status', 'wpdocs_run_on_publish_only', 10, 3 );