| @@ -217,9 +217,11 @@ | ||
| 217 | 217 | * |
| 218 | 218 | * @return array A filtered array of post display states. |
| 219 | 219 | */ |
| 220 | 220 | public function add_elementor_post_state( $post_states, $post ) { |
| 221 | - if ( User::is_current_user_can_edit( $post->ID ) && Plugin::$instance->db->is_built_with_elementor( $post->ID ) ) { | |
| 221 | + $document = Plugin::$instance->documents->get( $post->ID ); | |
| 222 | + | |
| 223 | + if ( $document && $document->is_built_with_elementor() && $document->is_editable_by_current_user() ) { | |
| 222 | 224 | $post_states['elementor'] = __( 'Elementor', 'elementor' ); |
| 223 | 225 | } |
| 224 | 226 | |
| 225 | 227 | return $post_states; |
| @@ -244,10 +246,12 @@ | ||
| 244 | 246 | |
| 245 | 247 | if ( in_array( $pagenow, [ 'post.php', 'post-new.php' ], true ) && Utils::is_post_support() ) { |
| 246 | 248 | $post = get_post(); |
| 247 | 249 | |
| 248 | - $mode_class = Plugin::$instance->db->is_built_with_elementor( $post->ID ) ? 'elementor-editor-active' : 'elementor-editor-inactive'; | |
| 250 | + $document = Plugin::$instance->documents->get( $post->ID ); | |
| 249 | 251 | |
| 252 | + $mode_class = $document && $document->is_built_with_elementor() ? 'elementor-editor-active' : 'elementor-editor-inactive'; | |
| 253 | + | |
| 250 | 254 | $classes .= ' ' . $mode_class; |
| 251 | 255 | } |
| 252 | 256 | |
| 253 | 257 | return $classes; |
| @@ -372,19 +376,9 @@ | ||
| 372 | 376 | * @access public |
| 373 | 377 | */ |
| 374 | 378 | public function elementor_dashboard_overview_widget() { |
| 375 | 379 | $elementor_feed = Api::get_feed_data(); |
| 376 | - | |
| 377 | - $recently_edited_query_args = [ | |
| 378 | - 'post_type' => 'any', | |
| 379 | - 'post_status' => [ 'publish', 'draft' ], | |
| 380 | - 'posts_per_page' => '3', | |
| 381 | - 'meta_key' => '_elementor_edit_mode', | |
| 382 | - 'meta_value' => 'builder', | |
| 383 | - 'orderby' => 'modified', | |
| 384 | - ]; | |
| 385 | - | |
| 386 | - $recently_edited_query = new \WP_Query( $recently_edited_query_args ); | |
| 380 | + $recently_edited_query = Utils::get_recently_edited_posts_query(); | |
| 387 | 381 | |
| 388 | 382 | if ( User::is_current_user_can_edit_post_type( 'page' ) ) { |
| 389 | 383 | $create_new_label = __( 'Create New Page', 'elementor' ); |
| 390 | 384 | $create_new_post_type = 'page'; |