Version Description
- Fixes quicktag button missing in WordPress 6.0 (also fixes "QTags is not defined) javascript error while editing posts).
- Add Simple WP Membership integration (content protected with Simple WP Membership will only be shown to authorized users or admins when inserted).
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.7.4 |
Comparing to | |
See all releases |
Code changes from version 3.7.3 to 3.7.4
- insert-pages.php +22 -5
- readme.txt +4 -0
insert-pages.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
* Requires at least: 3.0.1
|
11 |
-
* Version: 3.7.
|
12 |
*
|
13 |
* @package insert-pages
|
14 |
*/
|
@@ -438,6 +438,17 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
438 |
$inserted_page = null;
|
439 |
}
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
// Loop detection: check if the page we are inserting has already been
|
442 |
// inserted; if so, short circuit here.
|
443 |
if ( ! is_array( $this->inserted_page_ids ) ) {
|
@@ -759,9 +770,11 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
759 |
$can_read = true;
|
760 |
$parent_post_author_id = intval( get_the_author_meta( 'ID' ) );
|
761 |
foreach ( $posts as $post ) {
|
762 |
-
|
763 |
-
|
764 |
-
$
|
|
|
|
|
765 |
}
|
766 |
}
|
767 |
if ( ! $can_read ) {
|
@@ -1513,12 +1526,16 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
1513 |
/**
|
1514 |
* Add Insert Page quicktag button to Text editor.
|
1515 |
*
|
|
|
|
|
1516 |
* @return void
|
1517 |
*/
|
1518 |
public function insert_pages_add_quicktags() {
|
1519 |
if ( wp_script_is( 'quicktags' ) ) : ?>
|
1520 |
<script type="text/javascript">
|
1521 |
-
|
|
|
|
|
1522 |
</script>
|
1523 |
<?php
|
1524 |
endif;
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
* Requires at least: 3.0.1
|
11 |
+
* Version: 3.7.4
|
12 |
*
|
13 |
* @package insert-pages
|
14 |
*/
|
438 |
$inserted_page = null;
|
439 |
}
|
440 |
|
441 |
+
// Integration: if Simple Membership plugin is used, check that the
|
442 |
+
// current user has permission to see the inserted post.
|
443 |
+
// See: https://simple-membership-plugin.com/simple-membership-miscellaneous-php-tweaks/
|
444 |
+
if ( class_exists( 'SwpmAccessControl' ) ) {
|
445 |
+
$access_ctrl = SwpmAccessControl::get_instance();
|
446 |
+
if ( ! $access_ctrl->can_i_read_post( $inserted_page ) && ! current_user_can( 'edit_files' ) ) {
|
447 |
+
$inserted_page = null;
|
448 |
+
$content = wp_kses_post( $access_ctrl->why() );
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
// Loop detection: check if the page we are inserting has already been
|
453 |
// inserted; if so, short circuit here.
|
454 |
if ( ! is_array( $this->inserted_page_ids ) ) {
|
770 |
$can_read = true;
|
771 |
$parent_post_author_id = intval( get_the_author_meta( 'ID' ) );
|
772 |
foreach ( $posts as $post ) {
|
773 |
+
if ( is_object( $post ) && 'publish' !== $post->post_status ) {
|
774 |
+
$post_type = get_post_type_object( $post->post_type );
|
775 |
+
if ( ! user_can( $parent_post_author_id, $post_type->cap->read_post, $post->ID ) ) {
|
776 |
+
$can_read = false;
|
777 |
+
}
|
778 |
}
|
779 |
}
|
780 |
if ( ! $can_read ) {
|
1526 |
/**
|
1527 |
* Add Insert Page quicktag button to Text editor.
|
1528 |
*
|
1529 |
+
* @hook admin_print_footer_scripts
|
1530 |
+
*
|
1531 |
* @return void
|
1532 |
*/
|
1533 |
public function insert_pages_add_quicktags() {
|
1534 |
if ( wp_script_is( 'quicktags' ) ) : ?>
|
1535 |
<script type="text/javascript">
|
1536 |
+
window.onload = function() {
|
1537 |
+
QTags.addButton( 'ed_insert_page', '[insert page]', "[insert page='your-page-slug' display='title|link|excerpt|excerpt-only|content|post-thumbnail|all']\n", '', '', 'Insert Page', 999 );
|
1538 |
+
}
|
1539 |
</script>
|
1540 |
<?php
|
1541 |
endif;
|
readme.txt
CHANGED
@@ -110,6 +110,10 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
110 |
|
111 |
== Changelog ==
|
112 |
|
|
|
|
|
|
|
|
|
113 |
= 3.7.3 =
|
114 |
* Fix missing Visual Composer script/style enqueues.
|
115 |
* Tested up to WordPress 6.0.
|
110 |
|
111 |
== Changelog ==
|
112 |
|
113 |
+
= 3.7.4 =
|
114 |
+
* Fixes quicktag button missing in WordPress 6.0 (also fixes "QTags is not defined) javascript error while editing posts).
|
115 |
+
* Add Simple WP Membership integration (content protected with Simple WP Membership will only be shown to authorized users or admins when inserted).
|
116 |
+
|
117 |
= 3.7.3 =
|
118 |
* Fix missing Visual Composer script/style enqueues.
|
119 |
* Tested up to WordPress 6.0.
|