Changeset 14427
- Timestamp:
- 04/16/2025 08:51:45 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/flagged.php
r13207 r14427 1 1 <?php 2 2 /** 3 * Post handling customizations.3 * Flagged photo (aka potentially sensitive content) functionality. 4 4 * 5 5 * @package WordPressdotorg\Photo_Directory … … 48 48 add_filter( 'display_post_states', [ __CLASS__, 'display_post_states' ], 10, 2 ); 49 49 50 // Add count of user's flagged photos in author column. 51 // Note: Priority after Admin::add_published_photos_count_to_author() 52 add_filter( 'the_author', [ __CLASS__, 'add_flagged_photos_count_to_author' ], 11 ); 50 // Output count of user's flagged photos in author column. 51 add_filter( 'photo_author_column_data_end', [ __CLASS__, 'output_flagged_photos_count_to_author' ] ); 53 52 54 53 // Add support to the post edit page. … … 240 239 ? "<span class=\"update-plugins count-{$flagged_count}\"><span class=\"plugin-count\">{$flagged_count}</span></span>" 241 240 : ''; 242 241 243 242 // Add 'Flagged' link if user can read flagged photos. 244 243 add_submenu_page( … … 265 264 266 265 /** 267 * Appends the count of the published photos to author names in photo post 268 * listings. 269 * 270 * @param string $display_name The author's display name. 271 * @return string 272 */ 273 public static function add_flagged_photos_count_to_author( $display_name ) { 274 global $authordata; 275 276 if ( ! is_admin() || ! Admin::should_include_photo_column() ) { 277 return $display_name; 278 } 279 280 // Close link to contributor's listing of photos. 281 $display_name .= '</a>'; 266 * Outputs the count of the flagged photos for the post's author. 267 * 268 * @param WP_Post $post Post object. 269 */ 270 public static function output_flagged_photos_count_to_author( $post ) { 271 $author_id = (int) get_post_field( 'post_author', $post ); 272 $output = ''; 282 273 283 274 // Show number of flagged photos. 284 $flagged_count = User::count_flagged_photos( $author data->ID);275 $flagged_count = User::count_flagged_photos( $author_id ); 285 276 $flagged_link = ''; 286 277 if ( $flagged_count ) { … … 289 280 'post_type' => Registrations::get_post_type(), 290 281 'post_status' => self::get_post_status(), 291 'author' => $author data->ID,282 'author' => $author_id, 292 283 ], 'edit.php' ); 293 284 } 294 $ display_name.= '<div class="user-flagged-count">'285 $output .= '<div class="user-flagged-count">' 295 286 . sprintf( 296 287 /* translators: %s: Count of user's flagged photos possibly linked to listing of their flagged photos. */ … … 301 292 } 302 293 303 // Prevent unbalanced tag. 304 $display_name .= '<a>'; 305 306 return $display_name; 294 if ( $output ) { 295 echo $output; 296 } 307 297 } 308 298
Note: See TracChangeset
for help on using the changeset viewer.