Changeset 12200 for sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php
- Timestamp:
- 11/04/2022 06:08:41 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php
r12199 r12200 280 280 * Returns the next post in the queue that the current user can moderate. 281 281 * 282 * By default it chooses a random photo in the queue that wasn't submitted 283 * by the current user. 284 * 285 * @param string $orderby The field to order posts by when determining the 286 * next post in queue. Default 'rand'. 287 * @param string $order The sort order used when determining the next post 288 * in queue. Either 'ASC' or 'DESC'. Default 'ASC'. 282 289 * @return WP_Post|false The next post, or false if there are no other posts 283 290 * available for the user to moderate. 284 291 */ 285 public static function get_next_post_in_queue( ) {292 public static function get_next_post_in_queue( $orderby = 'rand', $order = 'ASC' ) { 286 293 $next = false; 294 295 if ( 'rand' === $orderby ) { 296 $order = ''; 297 } 298 elseif ( ! in_array( $order, [ 'ASC', 'DESC' ] ) ) { 299 $order = 'ASC'; 300 } 287 301 288 302 $posts = get_posts( [ 289 303 'author__not_in' => [ get_current_user_id() ], 290 'order' => 'ASC',291 'orderby' => 'date',304 'order' => $order, 305 'orderby' => $orderby, 292 306 'posts_per_page' => 1, 293 307 'post_status' => 'pending',
Note: See TracChangeset
for help on using the changeset viewer.