Changeset 12233 for sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/user.php
- Timestamp:
- 11/10/2022 08:58:25 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
r12141 r12233 59 59 */ 60 60 public static function count_pending_photos( $user_id = false ) { 61 return count( self::get_pending_photos( $user_id ) ); 62 } 63 64 /** 65 * Returns the pending photos for a user. 66 * 67 * @param int $user_id Optional. The user ID. If not defined, assumes global 68 * author. Default false. 69 * @param string $fields Optional. The fields to return from the pending photos. 70 * Default 'ids'. 71 * @return array 72 */ 73 public static function get_pending_photos( $user_id = false, $fields = 'ids' ) { 61 74 if ( ! $user_id ) { 62 75 global $authordata; … … 65 78 } 66 79 67 $pending =get_posts( [68 'fields' => 'ids',80 return get_posts( [ 81 'fields' => $fields, 69 82 'posts_per_page' => -1, 70 83 'author' => $user_id, … … 72 85 'post_type' => Registrations::get_post_type(), 73 86 ] ); 74 75 return count( $pending );76 87 } 77 88 … … 149 160 150 161 return apply_filters( 'wporg_photos_max_concurrent_submissions', self::MAX_PENDING_SUBMISSIONS, $user_id ); 162 } 163 164 /** 165 * Returns the file names for all of a user's pending submissions. 166 * 167 * @param int $user_id The user ID. If false, then assumes current user. Default false. 168 * @return array 169 */ 170 public static function get_pending_file_names( $user_id = false ) { 171 global $wpdb; 172 173 $names = []; 174 175 if ( ! $user_id ) { 176 $user_id = get_current_user_id(); 177 } 178 179 if ( $user_id && $post_ids = self::get_pending_photos( $user_id ) ) { 180 $post_ids = implode( ',', array_map( 'intval', array_values( $post_ids ) ) ); 181 $names = $wpdb->get_col( $wpdb->prepare( 182 "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = %s AND post_id IN ($post_ids)", 183 Registrations::get_meta_key( 'original_filename' ) 184 ) ); 185 } 186 187 return $names; 151 188 } 152 189
Note: See TracChangeset
for help on using the changeset viewer.