Making WordPress.org


Ignore:
Timestamp:
10/20/2022 05:10:00 PM (4 years ago)
Author:
coffee2code
Message:

Photo Directory, User: Move Uploads::user_reached_concurrent_submission_limit() to User::has_reached_concurrent_submission_limit().

File:
1 edited

Legend:

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

    r12110 r12140  
    1616         */
    1717        const MAX_LENGTH_DESCRIPTION = 250;
    18 
    19         /**
    20          * Maximum number of pending/concurrent submissions.
    21          *
    22          * Once this threshold is met, a user will be unable to make another
    23          * submission until the current submission is approved or rejected.
    24          *
    25          * @var int
    26          */
    27         const MAX_PENDING_SUBMISSIONS = 5;
    2818
    2919        /**
    … …  
    525515                // Check if user has reached submission limit.
    526516                if ( $can ) {
    527                         $can = ! self::user_reached_concurrent_submission_limit();
     517                        $can = ! User::has_reached_concurrent_submission_limit();
    528518                        $reason = 'concurrent-submission-limit';
    529519                }
    … …  
    849839
    850840        /**
    851          * Determines if user has reached concurrent submission limit for pending
    852          * uploads (e.g. max number of photos awaiting moderation).
    853          *
    854          * @return bool True if use has exceeded pending sumission limit, else false.
    855          */
    856         public static function user_reached_concurrent_submission_limit() {
    857                 $limit_reached = true;
    858 
    859                 if ( is_user_logged_in() ) {
    860                         $posts = get_posts( [
    861                                 'fields'         => 'ids',
    862                                 'posts_per_page' => self::MAX_PENDING_SUBMISSIONS,
    863                                 'author'         => get_current_user_id(),
    864                                 'post_status'    => 'pending',
    865                                 'post_type'      => Registrations::get_post_type(),
    866                         ] );
    867 
    868                         if ( count( $posts ) < self::MAX_PENDING_SUBMISSIONS ) {
    869                                 $limit_reached = false;
    870                         }
    871                 }
    872 
    873                 return $limit_reached;
    874         }
    875 
    876 
    877         /**
    878841         * Outputs a notice for users who are prevented from uploading and prevents
    879842         * the upload form from being output.
    … …  
    914877                        );
    915878
    916                         if ( self::user_reached_concurrent_submission_limit() ) {
     879                        if ( User::has_reached_concurrent_submission_limit() ) {
    917880                                $content .= '<p>' . __( 'Thanks for your submissions! Please wait until a photo is approved by moderators before submitting again.', 'wporg-photos' ) . '</p>';
    918881                        } else {
Note: See TracChangeset for help on using the changeset viewer.