diff --git wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/class-wp-rest-wordcamps-controller.php wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/class-wp-rest-wordcamps-controller.php
index 4a0eb12f9..206b155fb 100644
|
|
class WordCamp_REST_WordCamps_Controller extends WP_REST_Posts_Controller { |
67 | 67 | |
68 | 68 | return $statuses; |
69 | 69 | } |
70 | | } |
71 | | No newline at end of file |
| 70 | |
| 71 | /** |
| 72 | * Checks if user can read the WordCamp post. |
| 73 | * |
| 74 | * First make our custom check against public WordCamp statuses and |
| 75 | * after that fallback to default WP_REST_Posts_Controller for assurance. |
| 76 | * |
| 77 | * @access public |
| 78 | * |
| 79 | * @param object $post Post object. |
| 80 | * @return bool Whether the post can be read. |
| 81 | */ |
| 82 | public function check_read_permission( $post ) { |
| 83 | $public_statuses = WordCamp_Loader::get_public_post_statuses(); |
| 84 | |
| 85 | // Camps that are scheduled and then cancelled should still be available (though not included by default). |
| 86 | $public_statuses[] = 'wcpt-cancelled'; |
| 87 | |
| 88 | // If post status is not listed as public, it cannot be read |
| 89 | if ( ! in_array( $post->post_status, $public_statuses ) ) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | // Fallback to default read permission check |
| 94 | return WP_REST_Posts_Controller::check_read_permission( $post ); |
| 95 | } |
| 96 | } |