Changeset 12140 for sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php
- Timestamp:
- 10/20/2022 05:10:00 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php
r12110 r12140 16 16 */ 17 17 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 another23 * submission until the current submission is approved or rejected.24 *25 * @var int26 */27 const MAX_PENDING_SUBMISSIONS = 5;28 18 29 19 /** … … 525 515 // Check if user has reached submission limit. 526 516 if ( $can ) { 527 $can = ! self::user_reached_concurrent_submission_limit();517 $can = ! User::has_reached_concurrent_submission_limit(); 528 518 $reason = 'concurrent-submission-limit'; 529 519 } … … 849 839 850 840 /** 851 * Determines if user has reached concurrent submission limit for pending852 * 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 /**878 841 * Outputs a notice for users who are prevented from uploading and prevents 879 842 * the upload form from being output. … … 914 877 ); 915 878 916 if ( self::user_reached_concurrent_submission_limit() ) {879 if ( User::has_reached_concurrent_submission_limit() ) { 917 880 $content .= '<p>' . __( 'Thanks for your submissions! Please wait until a photo is approved by moderators before submitting again.', 'wporg-photos' ) . '</p>'; 918 881 } else {
Note: See TracChangeset
for help on using the changeset viewer.