Changeset 12734
- Timestamp:
- 07/10/2023 11:16:04 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/user.php
r12732 r12734 370 370 } 371 371 372 /** 373 * Returns the photo post most recently moderated by the user. 374 * 375 * @param int $user_id Optional. The user ID. If not defined, 376 * assumes global author. Default false. 377 * @param int $include_rejections Optional. Should photos rejected by the 378 * user be considered? Default false. 379 * @return WP_Post|false The post, or false if no posts found. 380 */ 381 public static function get_last_moderated( $user_id = false, $include_rejections = false ) { 382 if ( ! $user_id ) { 383 global $authordata; 384 385 $user_id = $authordata->ID; 386 } 387 388 if ( ! $user_id ) { 389 return false; 390 } 391 392 $post_statuses = ['publish']; 393 if ( $include_rejections ) { 394 $post_statuses[] = Rejection::get_post_status(); 395 } 396 397 $args = [ 398 'post_type' => Registrations::get_post_type(), 399 'post_status' => $post_statuses, 400 'meta_query' => self::get_moderator_meta_query( $user_id, $include_rejections ), 401 'posts_per_page' => 1, 402 ]; 403 404 $query = new \WP_Query( $args ); 405 406 if ( $query->have_posts() ) { 407 return $query->posts[0]; 408 } 409 410 return false; 411 } 412 372 413 } 373 414
Note: See TracChangeset
for help on using the changeset viewer.