PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.83
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.83
51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 51.1.46 All 39 releases
← All changes | includes/extensions/Maintenance_Mode/Maintenance_Mode.php +29 -0 51.1.6451.1.83 View file →
@@ -1259,8 +1259,20 @@
1259 1259
1260 1260 return '<div class="' . esc_attr(implode(' ', $classes)) . '">' . $content . '</div>';
1261 1261 }
1262 1262
1263 + /**
1264 + * Whether the current user may see this post's body, including status and password.
1265 + */
1266 + private function user_can_view_post_content(\WP_Post $post): bool
1267 + {
1268 + if (!current_user_can('read_post', $post->ID)) {
1269 + return false;
1270 + }
1271 +
1272 + return !post_password_required($post);
1273 + }
1274 +
1263 1275 private function get_page_content(int $page_id): string
1264 1276 {
1265 1277 $page = get_post($page_id);
1266 1278 if (!$page) {
@@ -1266,8 +1278,16 @@
1266 1278 if (!$page) {
1267 1279 return $this->render_builtin_template('minimal');
1268 1280 }
1269 1281
1282 + if (!$this->user_can_view_post_content($page)) {
1283 + if (post_password_required($page) && current_user_can('read_post', $page_id)) {
1284 + return get_the_password_form($page);
1285 + }
1286 +
1287 + return $this->render_builtin_template('minimal');
1288 + }
1289 +
1270 1290 $old_post = $GLOBALS['post'] ?? null;
1271 1291 $GLOBALS['post'] = $page;
1272 1292 setup_postdata($page);
1273 1293
@@ -1280,8 +1300,17 @@
1280 1300 }
1281 1301
1282 1302 private function get_elementor_content(int $template_id): string
1283 1303 {
1304 + $template = get_post($template_id);
1305 + if (!$template || !$this->user_can_view_post_content($template)) {
1306 + if ($template && post_password_required($template) && current_user_can('read_post', $template_id)) {
1307 + return get_the_password_form($template);
1308 + }
1309 +
1310 + return $this->render_builtin_template('minimal');
1311 + }
1312 +
1284 1313 if (!class_exists('\\Elementor\\Plugin')) {
1285 1314 return $this->render_builtin_template('minimal');
1286 1315 }
1287 1316