Making WordPress.org

Changeset 12890


Ignore:
Timestamp:
09/14/2023 10:40:31 PM (22 months ago)
Author:
coffee2code
Message:

Photo Directory, Admin: Group and front-load pending photos in 'Other Recent Photo Submissions by Contributor' metabox.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/admin.php

    r12888 r12890  
    640640        // short or making an additional query.
    641641        $recent_subs = User::get_recent_photos( $post->post_author, $photos_in_grid + 1, true );
     642
     643        // Front-load all pending photos.
     644        usort( $recent_subs, function ( $a, $b ) {
     645            $a_status = $a->post_status ?? '';
     646            $b_status = $b->post_status ?? '';
     647
     648            if ( $a_status === $b_status ) {
     649                return ( ( $a->post_date ?? '' ) > ( $b->post_date ?? '' ) ) ? -1 : 1;
     650            } elseif ( 'publish' === $a_status ) {
     651                return 1;
     652            } else {
     653                return -1;
     654            }
     655        } );
    642656
    643657        echo '<div class="photos-grid">' . "\n";
Note: See TracChangeset for help on using the changeset viewer.