Changeset 13790
- Timestamp:
- 06/07/2024 05:29:29 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/user.php
r13788 r13790 11 11 12 12 /** 13 * Maximum number of pending/concurrent submissions .13 * Maximum number of pending/concurrent submissions for infrequent contributors. 14 14 * 15 15 * Once this threshold is met, a user will be unable to make another … … 24 24 25 25 /** 26 * The number of published posts before a given user is permitted to toggle 27 * all of the confirmation checkboxes when submitting a photo. 28 * 26 * Maximum number of pending/concurrent submissions for frequent contributors. 27 * 28 * Once this threshold is met, a user will be unable to make another 29 * submission until a current submission is approved or rejected. 30 * 31 * @see `get_concurrent_submission_limit()` for actually retrieving the maximum 32 * pending submissions for a user, since it can vary based on the user and may 33 * be filtered. 29 34 * @var int 30 35 */ 36 const MAX_PENDING_SUBMISSIONS_FREQUENT = 10; 37 38 /** 39 * The number of published photos before a given user is granted additional 40 * privileges. 41 * 42 * Includes, but not necessarily limited to: 43 * - Increased pending submissions limit. 44 * - Ability to toggle all of the confirmation checkboxes when submitting a photo. 45 * 46 * @var int 47 */ 31 48 const TOGGLE_ALL_THRESHOLD = 30; 32 49 50 /** 51 * Initializes class. 52 */ 33 53 public static function init() { 34 54 } … … 344 364 345 365 /** 366 * Determines if a user is considered a frequent contributor. 367 * 368 * @param int $user_id Optional. The user ID. If not defined, assumes current 369 * user. Default false. 370 * @return bool True if user is considered a frequent contributor, else false. 371 */ 372 public static function is_frequent_contributor( $user_id = false ) { 373 $is_frequent = false; 374 375 if ( ! $user_id ) { 376 $user_id = get_current_user_id(); 377 } 378 379 if ( $user_id && self::count_published_photos( $user_id ) >= self::TOGGLE_ALL_THRESHOLD ) { 380 $is_frequent = true; 381 } 382 383 return $is_frequent; 384 } 385 386 /** 346 387 * Determines if a user is eligible to toggle all confirmation checkboxes on 347 388 * the photo upload form. … … 362 403 */ 363 404 public static function can_toggle_confirmation_checkboxes( $user_id = false ) { 364 $can = false; 365 366 if ( ! $user_id ) { 367 $user_id = get_current_user_id(); 368 } 369 370 if ( $user_id && self::count_published_photos( $user_id ) >= self::TOGGLE_ALL_THRESHOLD ) { 371 $can = true; 372 } 373 374 return $can; 405 return self::is_frequent_contributor( $user_id ); 375 406 } 376 407 … … 391 422 } 392 423 393 return apply_filters( 'wporg_photos_max_concurrent_submissions', self::MAX_PENDING_SUBMISSIONS, $user_id ); 424 $limit = self::is_frequent_contributor( $user_id ) 425 ? self::MAX_PENDING_SUBMISSIONS_FREQUENT 426 : self::MAX_PENDING_SUBMISSIONS; 427 428 return apply_filters( 'wporg_photos_max_concurrent_submissions', $limit, $user_id ); 394 429 } 395 430
Note: See TracChangeset
for help on using the changeset viewer.