Making WordPress.org


Ignore:
Timestamp:
06/07/2024 04:46:11 AM (20 months ago)
Author:
coffee2code
Message:

Photo Directory, Moderation: Use User::count_rejected_photos() rather than duplicating its functionality.

File:
1 edited

Legend:

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

    r12959 r13786  
    613613        }
    614614
    615         // Flag if user has past rejections.
    616         $rejections = Rejection::get_user_rejections( $post->post_author );
    617         if ( $rejections ) {
    618             $rejections_count = count( $rejections );
    619 
    620             // Don't count submission errors.
    621             $submission_errors_count = array_reduce( $rejections, function ( $count, $item ) {
    622                 $reason = Rejection::get_rejection_reason( $item );
    623                 if ( 'submission-error' === $reason ) {
    624                     $count++;
    625                 }
    626                 return $count;
    627             }, 0 );
    628             $rejections_count -= $submission_errors_count;
    629 
    630             if ( $rejections_count > 0 ) {
     615        // Flag if user has notable number of past rejections.
     616        $rejections_count = User::count_rejected_photos( $post->post_author );
     617        if ( $rejections_count ) {
    631618                $rejections_level = $message = '';
    632619
     
    657644                    $flags[ sprintf( $message, round( $rejections_percentage * 100 , 0 ) ) ] = $rejections_level;
    658645                }
    659             }
    660646        }
    661647
Note: See TracChangeset for help on using the changeset viewer.