Changeset 12705
- Timestamp:
- 07/03/2023 07:25:34 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/flagged.php
r12699 r12705 30 30 // Register post statuses. 31 31 add_action( 'init', [ __CLASS__, 'register_post_statuses' ] ); 32 33 // Change submission status to flagged if Vision analysis suggests potential concern. 34 add_action( 'wporg_photos_photo_analysis_complete', [ __CLASS__, 'flag_controversial_photos' ], 20 ); 32 35 33 36 // Restrict access to the listing of flagged photos. … … 121 124 $post_statuses[] = self::get_post_status(); 122 125 return $post_statuses; 126 } 127 128 /** 129 * Flags submission if Vision analysis suggests potential concerns. 130 * 131 * @param int $image_id The ID of the attachment that is the photo. 132 */ 133 public static function flag_controversial_photos( $image_id ) { 134 $post_id = wp_get_post_parent_id( $image_id ); 135 136 if ( ! $post_id ) { 137 return; 138 } 139 140 if ( Photo::get_filtered_moderation_assessment( $post_id ) ) { 141 wp_update_post( [ 142 'ID' => $post_id, 143 'post_status' => self::get_post_status(), 144 ] ); 145 } 123 146 } 124 147
Note: See TracChangeset
for help on using the changeset viewer.