Skip to content

Commit

Permalink
Merge pull request #98 from itthinx/pre-2.7.1
Browse files Browse the repository at this point in the history
Pre 2.7.1
  • Loading branch information
itthinx authored May 23, 2019
2 parents a39f677 + e4b82d1 commit 6d99e04
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
== Groups by itthinx - changelog.txt ==

= 2.7.1 =
* Improved UIE rendering for group choices and made it more resilient to load dependencies, Javascript execution order and pages where it is used.
* Fixed UIE rendering for group choices with the block editor which would unduly cap the list visually providing an awkward UX.
* Better jQuery dependency resilience on the Users screen.

= 2.7.0 =
* WordPress 5.2 compatible.
* Fixed translation loading to apply the user's locale when set.
Expand Down
4 changes: 2 additions & 2 deletions groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Plugin Name: Groups
* Plugin URI: http://www.itthinx.com/plugins/groups
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
* Version: 2.7.0
* Version: 2.7.1
* Author: itthinx
* Author URI: http://www.itthinx.com
* Donate-Link: http://www.itthinx.com
Expand All @@ -32,7 +32,7 @@
if ( !defined( 'ABSPATH' ) ) {
exit;
}
define( 'GROUPS_CORE_VERSION', '2.7.0' );
define( 'GROUPS_CORE_VERSION', '2.7.1' );
define( 'GROUPS_FILE', __FILE__ );
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
Expand Down
3 changes: 3 additions & 0 deletions lib/access/class-groups-access-meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ public static function admin_enqueue_scripts() {
switch ( $pagenow ) {
case 'upload.php' :
case 'customize.php' :
case 'edit-tags.php' : // @since 2.7.1 [1]
case 'term.php' : // @since 2.7.1 [1]
Groups_UIE::enqueue( 'select' );
break;
}
}
// [1] For cases when attachments can be added to terms, e.g. WC Product Category Thumbnail.
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/admin/class-groups-admin-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ public static function restrict_manage_users() {
$box .= $nonce;

$box .= '<script type="text/javascript">';
$box .= 'document.addEventListener( "DOMContentLoaded", function() {';
$box .= 'if ( typeof jQuery !== "undefined" ) {';
$box .= 'jQuery("document").ready(function(){';
$box .= 'jQuery(".tablenav.top .alignleft.actions:last").after("<div id=\"groups-bulk-actions-block\" class=\"alignleft actions\"></div>");';
$box .= 'jQuery("#group-bulk-actions").appendTo(jQuery("#groups-bulk-actions-block"));';
$box .= '});';
$box .= '}';
$box .= '}'; // jQuery
$box .= '} );'; // document....
$box .= '</script>';

$output .= $box;
Expand Down
40 changes: 25 additions & 15 deletions lib/views/class-groups-uie.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,34 @@ public static function enqueue( $element = null ) {
public static function render_select( $selector = 'select.groups-uie', $script = true, $on_document_ready = true, $create = false ) {
$output = '';
if ( $script ) {
$output .= '<script type="text/javascript">';
$output .= 'if (typeof jQuery !== "undefined"){';
if ( $on_document_ready ) {
$output .= 'jQuery("document").ready(function(){';
}
switch( self::$select ) {
case 'selectize' :
$output .= sprintf(
'jQuery("%s").selectize({%splugins: ["remove_button"]});',
$selector,
$create ? 'create:true,' : ''
);
break;

$call_output = '';
if ( self::$select === 'selectize' ) {
$call_output .= 'if ( typeof jQuery !== "undefined" ) {';
$call_output .= sprintf(
'jQuery("%s").selectize({%splugins: ["remove_button"]});',
$selector,
$create ? 'create:true,' : ''
);
$call_output .= '}';
}

// Our selectize options will be hidden unless the block editor's components panel allows to overflow.
$output .= '<style type="text/css">';
$output .= '.components-panel { overflow: visible!important; }';
$output .= '</style>';
// Act immediately if DOMContentLoaded was already dispatched, otherwise defer to handler.
$output .= '<script type="text/javascript">';
$output .= 'if ( document.readyState === "complete" || document.readyState === "interactive" ) {';
$output .= $call_output;
$output .= '}';
if ( $on_document_ready ) {
$output .= '});';
$output .= ' else {';
$output .= 'document.addEventListener( "DOMContentLoaded", function() {';
$output .= $call_output;
$output .= '} );'; // document....
$output .= '}'; // else
}
$output .= '}'; // typeof jQuery
$output .= '</script>';
}
return $output;
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: groups, access, access control, membership, memberships, member, members,
Requires at least: 4.6
Tested up to: 5.2
Requires PHP: 5.6.0
Stable tag: 2.7.0
Stable tag: 2.7.1
License: GPLv3

Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
Expand Down

0 comments on commit 6d99e04

Please sign in to comment.