@@ -96,6 +96,29 @@ public function check_cloudinary_version( $cloudinary_id, $attachment_id ) {
9696 return $ cloudinary_id ;
9797 }
9898
99+ /**
100+ * Checks the status of the media item.
101+ *
102+ * @param array $status Array of state and note.
103+ * @param int $attachment_id The attachment id.
104+ *
105+ * @return array
106+ */
107+ public function filter_status ( $ status , $ attachment_id ) {
108+
109+ if ( get_post_meta ( $ attachment_id , Sync::META_KEYS ['downloading ' ] ) ) {
110+ $ status ['state ' ] = 'info downloading ' ;
111+ $ status ['note ' ] = __ ( 'Downloading ' , 'cloudinary ' );
112+ }
113+
114+ if ( get_post_meta ( $ attachment_id , Sync::META_KEYS ['syncing ' ] ) ) {
115+ $ status ['state ' ] = 'info syncing ' ;
116+ $ status ['note ' ] = __ ( 'Syncing metadata ' , 'cloudinary ' );
117+ }
118+
119+ return $ status ;
120+ }
121+
99122 /**
100123 * Convert an image post that was created from Cloudinary v1.
101124 *
@@ -152,6 +175,9 @@ function ( $val ) use ( $media ) {
152175 public function setup_hooks () {
153176 add_filter ( 'validate_cloudinary_id ' , array ( $ this , 'check_cloudinary_version ' ), 10 , 2 ); // Priority 10, to allow prep_on_demand_upload.
154177
178+ // Show sync status.
179+ add_filter ( 'cloudinary_media_status ' , array ( $ this , 'filter_status ' ), 20 , 2 );
180+
155181 // Add a redirection to the new plugin settings, from the old plugin.
156182 if ( is_admin () ) {
157183 add_action ( 'admin_menu ' , function () {
0 commit comments