Changeset 12141 for sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/user.php
- Timestamp:
- 10/20/2022 05:15:27 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
r12140 r12141 16 16 * submission until a current submission is approved or rejected. 17 17 * 18 * @see `get_concurrent_submission_limit()` for actually retrieving the maximum 19 * pending submissions for a user, since it can vary based on the user and may 20 * be filtered. 18 21 * @var int 19 22 */ … … 130 133 131 134 /** 135 * Returns the number of concurrent submissions allowed for a user. 136 * 137 * @param int $user_id Optional. The user ID. If not defined, assumes current 138 * user. Default false. 139 * @return int The number of concurrent submissions for a user. 140 */ 141 public static function get_concurrent_submission_limit( $user_id = false ) { 142 if ( ! $user_id ) { 143 $user_id = get_current_user_id(); 144 } 145 146 if ( ! $user_id ) { 147 return 0; 148 } 149 150 return apply_filters( 'wporg_photos_max_concurrent_submissions', self::MAX_PENDING_SUBMISSIONS, $user_id ); 151 } 152 153 /** 132 154 * Determines if user has reached concurrent submission limit for pending 133 155 * uploads (e.g. max number of photos awaiting moderation). … … 145 167 146 168 if ( $user_id ) { 169 $max_pending_submissions = self::get_concurrent_submission_limit( $user_id ); 147 170 $posts = get_posts( [ 148 171 'fields' => 'ids', 149 'posts_per_page' => self::MAX_PENDING_SUBMISSIONS,172 'posts_per_page' => $max_pending_submissions, 150 173 'author' => $user_id, 151 174 'post_status' => 'pending', … … 153 176 ] ); 154 177 155 if ( count( $posts ) < self::MAX_PENDING_SUBMISSIONS) {178 if ( count( $posts ) < $max_pending_submissions ) { 156 179 $limit_reached = false; 157 180 }
Note: See TracChangeset
for help on using the changeset viewer.