Version Description
Download this release
Release Info
Developer | itthinx |
Plugin | Groups |
Version | 2.7.2 |
Comparing to | |
See all releases |
Code changes from version 2.7.1 to 2.7.2
- changelog.txt +6 -0
- groups.php +2 -2
- lib/access/class-groups-access-meta-boxes.php +43 -17
- lib/views/class-groups-uie.php +2 -2
- readme.txt +1 -1
changelog.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
== Groups by itthinx - changelog.txt ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 2.7.1 =
|
4 |
* Improved UIE rendering for group choices and made it more resilient to load dependencies, Javascript execution order and pages where it is used.
|
5 |
* Fixed UIE rendering for group choices with the block editor which would unduly cap the list visually providing an awkward UX.
|
1 |
== Groups by itthinx - changelog.txt ==
|
2 |
|
3 |
+
= 2.7.2 =
|
4 |
+
* Fixes an issue with page builders and front-end editing.
|
5 |
+
* Fixed CSS typo in UIE.
|
6 |
+
* Formatting improvements.
|
7 |
+
* Added missing escaping.
|
8 |
+
|
9 |
= 2.7.1 =
|
10 |
* Improved UIE rendering for group choices and made it more resilient to load dependencies, Javascript execution order and pages where it is used.
|
11 |
* Fixed UIE rendering for group choices with the block editor which would unduly cap the list visually providing an awkward UX.
|
groups.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* Plugin Name: Groups
|
22 |
* Plugin URI: http://www.itthinx.com/plugins/groups
|
23 |
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
|
24 |
-
* Version: 2.7.
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
@@ -32,7 +32,7 @@
|
|
32 |
if ( !defined( 'ABSPATH' ) ) {
|
33 |
exit;
|
34 |
}
|
35 |
-
define( 'GROUPS_CORE_VERSION', '2.7.
|
36 |
define( 'GROUPS_FILE', __FILE__ );
|
37 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
38 |
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
21 |
* Plugin Name: Groups
|
22 |
* Plugin URI: http://www.itthinx.com/plugins/groups
|
23 |
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
|
24 |
+
* Version: 2.7.2
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
32 |
if ( !defined( 'ABSPATH' ) ) {
|
33 |
exit;
|
34 |
}
|
35 |
+
define( 'GROUPS_CORE_VERSION', '2.7.2' );
|
36 |
define( 'GROUPS_FILE', __FILE__ );
|
37 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
38 |
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
lib/access/class-groups-access-meta-boxes.php
CHANGED
@@ -25,7 +25,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
25 |
|
26 |
/**
|
27 |
* Adds meta boxes to edit screens.
|
28 |
-
*
|
29 |
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
|
30 |
*/
|
31 |
class Groups_Access_Meta_Boxes {
|
@@ -62,6 +62,8 @@ class Groups_Access_Meta_Boxes {
|
|
62 |
|
63 |
add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'attachment_fields_to_edit' ), 10, 2 );
|
64 |
add_filter( 'attachment_fields_to_save', array( __CLASS__, 'attachment_fields_to_save' ), 10, 2 );
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
|
@@ -123,29 +125,38 @@ class Groups_Access_Meta_Boxes {
|
|
123 |
'<strong>' . _x( 'Groups', 'Help heading', 'groups' ) . '</strong>' .
|
124 |
'</p>' .
|
125 |
'<p>' .
|
126 |
-
|
|
|
|
|
|
|
127 |
'</p>' .
|
128 |
'<p>' .
|
129 |
-
|
130 |
( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ?
|
131 |
' ' .
|
132 |
-
|
133 |
:
|
134 |
''
|
135 |
) .
|
136 |
'</p>' .
|
137 |
'<p>' .
|
138 |
-
'<strong>' .
|
139 |
'</p>' .
|
140 |
-
|
|
|
|
|
|
|
141 |
'<p>' .
|
142 |
' ' .
|
143 |
'</p>' .
|
144 |
-
|
|
|
|
|
|
|
145 |
'<p>' .
|
146 |
( current_user_can( GROUPS_ADMINISTER_GROUPS ) ?
|
147 |
'<p>' .
|
148 |
-
|
149 |
'</p>'
|
150 |
:
|
151 |
''
|
@@ -270,7 +281,7 @@ class Groups_Access_Meta_Boxes {
|
|
270 |
* At WordPress 3.6.1, this is the only way we can achieve that, because
|
271 |
* the save_post action is not invoked if the post content is considered
|
272 |
* empty.
|
273 |
-
*
|
274 |
* @param boolean $maybe_empty
|
275 |
* @param array $postarr
|
276 |
* @return boolean
|
@@ -292,7 +303,7 @@ class Groups_Access_Meta_Boxes {
|
|
292 |
|
293 |
/**
|
294 |
* Save the group access restriction.
|
295 |
-
*
|
296 |
* @param int $post_id
|
297 |
* @param mixed $post post data (not used here)
|
298 |
*/
|
@@ -396,7 +407,7 @@ class Groups_Access_Meta_Boxes {
|
|
396 |
|
397 |
/**
|
398 |
* Render groups box for attachment post type (Media).
|
399 |
-
*
|
400 |
* @param array $form_fields
|
401 |
* @param object $post
|
402 |
* @return array
|
@@ -488,7 +499,7 @@ class Groups_Access_Meta_Boxes {
|
|
488 |
/**
|
489 |
* Save groups for attachment post type (Media).
|
490 |
* When multiple attachments are saved, this is called once for each.
|
491 |
-
*
|
492 |
* @param array $post post data
|
493 |
* @param array $attachment attachment field data
|
494 |
* @return array
|
@@ -525,10 +536,25 @@ class Groups_Access_Meta_Boxes {
|
|
525 |
return $post;
|
526 |
}
|
527 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
/**
|
529 |
* Returns true if the user can restrict access to posts. The current user is
|
530 |
* assumed by default unless a user ID is provided.
|
531 |
-
*
|
532 |
* @param int $user_id indicates the desired user, otherwise for the current user
|
533 |
* @return boolean
|
534 |
*/
|
@@ -542,14 +568,14 @@ class Groups_Access_Meta_Boxes {
|
|
542 |
|
543 |
/**
|
544 |
* Returns the group IDs of the groups that the user can use to restrict access.
|
545 |
-
*
|
546 |
* If the user can GROUPS_RESTRICT_ACCESS, the following group IDs are returned:
|
547 |
* - If the user can GROUPS_ADMINISTER_GROUPS, this will return the IDs of all groups.
|
548 |
* - Otherwise it will return the IDs of all groups that the user belongs to, directly
|
549 |
* or indirectly by group inheritance.
|
550 |
-
*
|
551 |
* If the user can not GROUPS_RESTRICT_ACCESS, an empty array is returned.
|
552 |
-
*
|
553 |
* @param int $user_id if provided, retrieve results for the user indicated by user ID, otherwise for the current user
|
554 |
* @return array of int with the group IDs
|
555 |
*/
|
@@ -580,5 +606,5 @@ class Groups_Access_Meta_Boxes {
|
|
580 |
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-access-meta-boxes-legacy.php' );
|
581 |
return Groups_Access_Meta_Boxes_Legacy::get_valid_read_caps_for_user( $user_id );
|
582 |
}
|
583 |
-
}
|
584 |
Groups_Access_Meta_Boxes::init();
|
25 |
|
26 |
/**
|
27 |
* Adds meta boxes to edit screens.
|
28 |
+
*
|
29 |
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
|
30 |
*/
|
31 |
class Groups_Access_Meta_Boxes {
|
62 |
|
63 |
add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'attachment_fields_to_edit' ), 10, 2 );
|
64 |
add_filter( 'attachment_fields_to_save', array( __CLASS__, 'attachment_fields_to_save' ), 10, 2 );
|
65 |
+
|
66 |
+
add_action( 'wp_enqueue_editor', array( __CLASS__, 'wp_enqueue_editor' ) ); // @since 2.7.2
|
67 |
}
|
68 |
}
|
69 |
|
125 |
'<strong>' . _x( 'Groups', 'Help heading', 'groups' ) . '</strong>' .
|
126 |
'</p>' .
|
127 |
'<p>' .
|
128 |
+
wp_kses(
|
129 |
+
__( 'Use the <em>Groups</em> box to limit the visibility of posts, pages and other post types.', 'groups' ),
|
130 |
+
array( 'em' => array() )
|
131 |
+
) .
|
132 |
'</p>' .
|
133 |
'<p>' .
|
134 |
+
esc_html__( 'You can select one or more groups to restrict access to its members.', 'groups' ) .
|
135 |
( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ?
|
136 |
' ' .
|
137 |
+
esc_html__( 'Note that you must be a member of a group to use it to restrict access.', 'groups' )
|
138 |
:
|
139 |
''
|
140 |
) .
|
141 |
'</p>' .
|
142 |
'<p>' .
|
143 |
+
'<strong>' . esc_html__( 'Example:', 'groups' ) . '</strong>' .
|
144 |
'</p>' .
|
145 |
+
wp_kses(
|
146 |
+
__( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.', 'groups' ),
|
147 |
+
array( 'em' => array() )
|
148 |
+
) .
|
149 |
'<p>' .
|
150 |
' ' .
|
151 |
'</p>' .
|
152 |
+
wp_kses(
|
153 |
+
__( 'Choose or enter <em>Premium</em> in the <em>Read</em> field located in the <em>Groups</em> box and save or update the post (or hit Enter).', 'groups' ),
|
154 |
+
array( 'em' => array() )
|
155 |
+
) .
|
156 |
'<p>' .
|
157 |
( current_user_can( GROUPS_ADMINISTER_GROUPS ) ?
|
158 |
'<p>' .
|
159 |
+
esc_html__( 'In the same field, you can create a new group and restrict access. Group names are case-sensitive. In order to be able to use the new group, your user account will be assigned to it.', 'groups' ) .
|
160 |
'</p>'
|
161 |
:
|
162 |
''
|
281 |
* At WordPress 3.6.1, this is the only way we can achieve that, because
|
282 |
* the save_post action is not invoked if the post content is considered
|
283 |
* empty.
|
284 |
+
*
|
285 |
* @param boolean $maybe_empty
|
286 |
* @param array $postarr
|
287 |
* @return boolean
|
303 |
|
304 |
/**
|
305 |
* Save the group access restriction.
|
306 |
+
*
|
307 |
* @param int $post_id
|
308 |
* @param mixed $post post data (not used here)
|
309 |
*/
|
407 |
|
408 |
/**
|
409 |
* Render groups box for attachment post type (Media).
|
410 |
+
*
|
411 |
* @param array $form_fields
|
412 |
* @param object $post
|
413 |
* @return array
|
499 |
/**
|
500 |
* Save groups for attachment post type (Media).
|
501 |
* When multiple attachments are saved, this is called once for each.
|
502 |
+
*
|
503 |
* @param array $post post data
|
504 |
* @param array $attachment attachment field data
|
505 |
* @return array
|
536 |
return $post;
|
537 |
}
|
538 |
|
539 |
+
/**
|
540 |
+
* Hooked on wp_enqueue_editor to enqueue our UIE scripts if access for attachments is enabled.
|
541 |
+
*
|
542 |
+
* @param array $to_load
|
543 |
+
*/
|
544 |
+
public static function wp_enqueue_editor( $to_load ) {
|
545 |
+
$media_upload = wp_script_is( 'media-upload' );
|
546 |
+
if ( $media_upload ) {
|
547 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
548 |
+
if ( !isset( $post_types_option['attachment']['add_meta_box'] ) || $post_types_option['attachment']['add_meta_box'] ) {
|
549 |
+
Groups_UIE::enqueue( 'select' );
|
550 |
+
}
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
/**
|
555 |
* Returns true if the user can restrict access to posts. The current user is
|
556 |
* assumed by default unless a user ID is provided.
|
557 |
+
*
|
558 |
* @param int $user_id indicates the desired user, otherwise for the current user
|
559 |
* @return boolean
|
560 |
*/
|
568 |
|
569 |
/**
|
570 |
* Returns the group IDs of the groups that the user can use to restrict access.
|
571 |
+
*
|
572 |
* If the user can GROUPS_RESTRICT_ACCESS, the following group IDs are returned:
|
573 |
* - If the user can GROUPS_ADMINISTER_GROUPS, this will return the IDs of all groups.
|
574 |
* - Otherwise it will return the IDs of all groups that the user belongs to, directly
|
575 |
* or indirectly by group inheritance.
|
576 |
+
*
|
577 |
* If the user can not GROUPS_RESTRICT_ACCESS, an empty array is returned.
|
578 |
+
*
|
579 |
* @param int $user_id if provided, retrieve results for the user indicated by user ID, otherwise for the current user
|
580 |
* @return array of int with the group IDs
|
581 |
*/
|
606 |
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-access-meta-boxes-legacy.php' );
|
607 |
return Groups_Access_Meta_Boxes_Legacy::get_valid_read_caps_for_user( $user_id );
|
608 |
}
|
609 |
+
}
|
610 |
Groups_Access_Meta_Boxes::init();
|
lib/views/class-groups-uie.php
CHANGED
@@ -97,7 +97,7 @@ class Groups_UIE {
|
|
97 |
|
98 |
$call_output = '';
|
99 |
if ( self::$select === 'selectize' ) {
|
100 |
-
$call_output .= 'if ( typeof jQuery !== "undefined" ) {';
|
101 |
$call_output .= sprintf(
|
102 |
'jQuery("%s").selectize({%splugins: ["remove_button"]});',
|
103 |
$selector,
|
@@ -108,7 +108,7 @@ class Groups_UIE {
|
|
108 |
|
109 |
// Our selectize options will be hidden unless the block editor's components panel allows to overflow.
|
110 |
$output .= '<style type="text/css">';
|
111 |
-
$output .= '.components-panel { overflow: visible!important; }';
|
112 |
$output .= '</style>';
|
113 |
// Act immediately if DOMContentLoaded was already dispatched, otherwise defer to handler.
|
114 |
$output .= '<script type="text/javascript">';
|
97 |
|
98 |
$call_output = '';
|
99 |
if ( self::$select === 'selectize' ) {
|
100 |
+
$call_output .= 'if ( typeof jQuery !== "undefined" && typeof jQuery.fn.selectize === "function" ) {';
|
101 |
$call_output .= sprintf(
|
102 |
'jQuery("%s").selectize({%splugins: ["remove_button"]});',
|
103 |
$selector,
|
108 |
|
109 |
// Our selectize options will be hidden unless the block editor's components panel allows to overflow.
|
110 |
$output .= '<style type="text/css">';
|
111 |
+
$output .= '.components-panel { overflow: visible !important; }';
|
112 |
$output .= '</style>';
|
113 |
// Act immediately if DOMContentLoaded was already dispatched, otherwise defer to handler.
|
114 |
$output .= '<script type="text/javascript">';
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: groups, access, access control, membership, memberships, member, members,
|
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6.0
|
8 |
-
Stable tag: 2.7.
|
9 |
License: GPLv3
|
10 |
|
11 |
Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
|
5 |
Requires at least: 4.6
|
6 |
Tested up to: 5.2
|
7 |
Requires PHP: 5.6.0
|
8 |
+
Stable tag: 2.7.2
|
9 |
License: GPLv3
|
10 |
|
11 |
Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
|