Version Description
- Improved internal definitions to use API function instead of WP_CONTENT_DIR and WP_CONTENT_URL constants.
- Now showing inherited capabilities for groups.
- Added ABSPATH check to plugin main file.
- Improved the UI rendering cancel links as buttons.
- Improved the UI adding some space on capability selector box.
- Fixed a pagination issue when the page number is indicated on the Groups or Capabilities screen.
Download this release
Release Info
Developer | itthinx |
Plugin | Groups |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
- css/groups_admin.css +8 -1
- groups.php +7 -4
- lib/admin/groups-admin-capabilities-add.php +2 -2
- lib/admin/groups-admin-capabilities-edit.php +2 -2
- lib/admin/groups-admin-capabilities-remove.php +4 -4
- lib/admin/groups-admin-capabilities.php +1 -1
- lib/admin/groups-admin-groups-add.php +2 -2
- lib/admin/groups-admin-groups-edit.php +33 -2
- lib/admin/groups-admin-groups-remove.php +4 -4
- lib/admin/groups-admin-groups.php +30 -9
- lib/admin/groups-admin-options.php +2 -2
- lib/core/class-groups-group.php +46 -1
- lib/core/class-groups-pagination.php +8 -9
- lib/views/class-groups-uie.php +2 -1
- readme.txt +14 -6
css/groups_admin.css
CHANGED
@@ -55,6 +55,9 @@
|
|
55 |
div.field {
|
56 |
padding-bottom: 0.62em;
|
57 |
}
|
|
|
|
|
|
|
58 |
div.field input[type="submit"],
|
59 |
div.group.remove input[type="submit"],
|
60 |
div.capability.remove input[type="submit"] {
|
@@ -134,6 +137,10 @@ div.capability.edit label {
|
|
134 |
margin: 0;
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
137 |
.manage-groups .required,
|
138 |
.manage-capabilities .required {
|
139 |
background: url(../images/required.png) transparent no-repeat left center;
|
@@ -213,7 +220,7 @@ div.groups-footer form {
|
|
213 |
.groups-bulk-container .selectize-input {
|
214 |
font-size: inherit;
|
215 |
line-height: 18px;
|
216 |
-
padding: 0;
|
217 |
vertical-align: middle;
|
218 |
}
|
219 |
.groups-bulk-container .selectize-input input[type="text"] {
|
55 |
div.field {
|
56 |
padding-bottom: 0.62em;
|
57 |
}
|
58 |
+
div.field a.cancel {
|
59 |
+
vertical-align: middle;
|
60 |
+
}
|
61 |
div.field input[type="submit"],
|
62 |
div.group.remove input[type="submit"],
|
63 |
div.capability.remove input[type="submit"] {
|
137 |
margin: 0;
|
138 |
}
|
139 |
|
140 |
+
.groups-overview td.capabilities span.inherited {
|
141 |
+
font-style: italic;
|
142 |
+
}
|
143 |
+
|
144 |
.manage-groups .required,
|
145 |
.manage-capabilities .required {
|
146 |
background: url(../images/required.png) transparent no-repeat left center;
|
220 |
.groups-bulk-container .selectize-input {
|
221 |
font-size: inherit;
|
222 |
line-height: 18px;
|
223 |
+
padding: 0 4px;
|
224 |
vertical-align: middle;
|
225 |
}
|
226 |
.groups-bulk-container .selectize-input input[type="text"] {
|
groups.php
CHANGED
@@ -21,16 +21,19 @@
|
|
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: 1.5.
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
28 |
* License: GPLv3
|
29 |
*/
|
30 |
-
|
|
|
|
|
|
|
31 |
define( 'GROUPS_FILE', __FILE__ );
|
32 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
33 |
-
define( 'GROUPS_CORE_DIR',
|
34 |
}
|
35 |
if ( !defined( 'GROUPS_CORE_LIB' ) ) {
|
36 |
define( 'GROUPS_CORE_LIB', GROUPS_CORE_DIR . '/lib/core' );
|
@@ -51,7 +54,7 @@ if ( !defined( 'GROUPS_WP_LIB' ) ) {
|
|
51 |
define( 'GROUPS_WP_LIB', GROUPS_CORE_DIR . '/lib/wp' );
|
52 |
}
|
53 |
if ( !defined( 'GROUPS_CORE_URL' ) ) {
|
54 |
-
define( '
|
55 |
}
|
56 |
require_once( GROUPS_CORE_LIB . '/constants.php' );
|
57 |
require_once( GROUPS_CORE_LIB . '/wp-init.php');
|
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: 1.5.2
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
28 |
* License: GPLv3
|
29 |
*/
|
30 |
+
if ( !defined( 'ABSPATH' ) ) {
|
31 |
+
exit;
|
32 |
+
}
|
33 |
+
define( 'GROUPS_CORE_VERSION', '1.5.2' );
|
34 |
define( 'GROUPS_FILE', __FILE__ );
|
35 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
36 |
+
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
37 |
}
|
38 |
if ( !defined( 'GROUPS_CORE_LIB' ) ) {
|
39 |
define( 'GROUPS_CORE_LIB', GROUPS_CORE_DIR . '/lib/core' );
|
54 |
define( 'GROUPS_WP_LIB', GROUPS_CORE_DIR . '/lib/wp' );
|
55 |
}
|
56 |
if ( !defined( 'GROUPS_CORE_URL' ) ) {
|
57 |
+
define( '_GROUPS_CORE_URL', plugins_url( 'groups' ) );
|
58 |
}
|
59 |
require_once( GROUPS_CORE_LIB . '/constants.php' );
|
60 |
require_once( GROUPS_CORE_LIB . '/wp-init.php');
|
lib/admin/groups-admin-capabilities-add.php
CHANGED
@@ -67,9 +67,9 @@ function groups_admin_capabilities_add() {
|
|
67 |
|
68 |
'<div class="field">' .
|
69 |
wp_nonce_field( 'capabilities-add', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
70 |
-
'<input class="button" type="submit" value="' . __( 'Add', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
71 |
'<input type="hidden" value="add" name="action"/>' .
|
72 |
-
'<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
73 |
'</div>' .
|
74 |
'</div>' . // .capability.new
|
75 |
'</form>' .
|
67 |
|
68 |
'<div class="field">' .
|
69 |
wp_nonce_field( 'capabilities-add', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
70 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Add', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
71 |
'<input type="hidden" value="add" name="action"/>' .
|
72 |
+
'<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
73 |
'</div>' .
|
74 |
'</div>' . // .capability.new
|
75 |
'</form>' .
|
lib/admin/groups-admin-capabilities-edit.php
CHANGED
@@ -76,9 +76,9 @@ function groups_admin_capabilities_edit( $capability_id ) {
|
|
76 |
|
77 |
'<div class="field">' .
|
78 |
wp_nonce_field( 'capabilities-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
79 |
-
'<input class="button" type="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
80 |
'<input type="hidden" value="edit" name="action"/>' .
|
81 |
-
'<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
82 |
'</div>' .
|
83 |
'</div>' . // .capability.edit
|
84 |
'</form>' .
|
76 |
|
77 |
'<div class="field">' .
|
78 |
wp_nonce_field( 'capabilities-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
79 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
80 |
'<input type="hidden" value="edit" name="action"/>' .
|
81 |
+
'<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
82 |
'</div>' .
|
83 |
'</div>' . // .capability.edit
|
84 |
'</form>' .
|
lib/admin/groups-admin-capabilities-remove.php
CHANGED
@@ -61,9 +61,9 @@ function groups_admin_capabilities_remove( $capability_id ) {
|
|
61 |
'<li>' . sprintf( __( 'Capability : %s', GROUPS_PLUGIN_DOMAIN ), stripslashes( wp_filter_nohtml_kses( $capability->capability ) ) ) . '</li>' .
|
62 |
'</ul> ' .
|
63 |
wp_nonce_field( 'capabilities-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
64 |
-
'<input class="button" type="submit" value="' . __( 'Remove', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
65 |
'<input type="hidden" value="remove" name="action"/>' .
|
66 |
-
'<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
67 |
'</div>' .
|
68 |
'</div>' . // .capability.remove
|
69 |
'</form>' .
|
@@ -152,8 +152,8 @@ function groups_admin_capabilities_bulk_remove() {
|
|
152 |
$output .= '</li>';
|
153 |
$output .= '</ul>';
|
154 |
}
|
155 |
-
$output .= '<input class="button" type="submit" name="bulk" value="' . __( "Remove", GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
156 |
-
$output .= '<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
157 |
|
158 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
159 |
$output .= '<input type="hidden" name="bulk-action" value="remove"/>';
|
61 |
'<li>' . sprintf( __( 'Capability : %s', GROUPS_PLUGIN_DOMAIN ), stripslashes( wp_filter_nohtml_kses( $capability->capability ) ) ) . '</li>' .
|
62 |
'</ul> ' .
|
63 |
wp_nonce_field( 'capabilities-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
64 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Remove', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
65 |
'<input type="hidden" value="remove" name="action"/>' .
|
66 |
+
'<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
67 |
'</div>' .
|
68 |
'</div>' . // .capability.remove
|
69 |
'</form>' .
|
152 |
$output .= '</li>';
|
153 |
$output .= '</ul>';
|
154 |
}
|
155 |
+
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove", GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
156 |
+
$output .= '<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
157 |
|
158 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
159 |
$output .= '<input type="hidden" name="bulk-action" value="remove"/>';
|
lib/admin/groups-admin-capabilities.php
CHANGED
@@ -213,7 +213,7 @@ function groups_admin_capabilities() {
|
|
213 |
if ( $offset < 0 ) {
|
214 |
$offset = 0;
|
215 |
}
|
216 |
-
$paged = isset( $
|
217 |
if ( $paged < 0 ) {
|
218 |
$paged = 0;
|
219 |
}
|
213 |
if ( $offset < 0 ) {
|
214 |
$offset = 0;
|
215 |
}
|
216 |
+
$paged = isset( $_REQUEST['paged'] ) ? intval( $_REQUEST['paged'] ) : 0;
|
217 |
if ( $paged < 0 ) {
|
218 |
$paged = 0;
|
219 |
}
|
lib/admin/groups-admin-groups-add.php
CHANGED
@@ -116,9 +116,9 @@ function groups_admin_groups_add() {
|
|
116 |
|
117 |
$output .= '<div class="field">';
|
118 |
$output .= wp_nonce_field( 'groups-add', GROUPS_ADMIN_GROUPS_NONCE, true, false );
|
119 |
-
$output .= '<input class="button" type="submit" value="' . __( 'Add', GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
120 |
$output .= '<input type="hidden" value="add" name="action"/>';
|
121 |
-
$output .= '<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
122 |
$output .= '</div>';
|
123 |
$output .= '</div>'; // .group.new
|
124 |
$output .= '</form>';
|
116 |
|
117 |
$output .= '<div class="field">';
|
118 |
$output .= wp_nonce_field( 'groups-add', GROUPS_ADMIN_GROUPS_NONCE, true, false );
|
119 |
+
$output .= '<input class="button button-primary" type="submit" value="' . __( 'Add', GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
120 |
$output .= '<input type="hidden" value="add" name="action"/>';
|
121 |
+
$output .= '<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
122 |
$output .= '</div>';
|
123 |
$output .= '</div>'; // .group.new
|
124 |
$output .= '</form>';
|
lib/admin/groups-admin-groups-edit.php
CHANGED
@@ -134,11 +134,30 @@ function groups_admin_groups_edit( $group_id ) {
|
|
134 |
$output .= '</div>'; // .field
|
135 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
$output .= '<div class="field">';
|
138 |
$output .= wp_nonce_field( 'groups-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false );
|
139 |
-
$output .= '<input class="button" type="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
140 |
$output .= '<input type="hidden" value="edit" name="action"/>';
|
141 |
-
$output .= '<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
142 |
$output .= '</div>';
|
143 |
$output .= '</div>'; // .group.edit
|
144 |
$output .= '</form>';
|
@@ -229,3 +248,15 @@ function groups_admin_groups_edit_submit() {
|
|
229 |
}
|
230 |
|
231 |
} // function groups_admin_groups_edit_submit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
$output .= '</div>'; // .field
|
135 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
136 |
|
137 |
+
$group_object = new Groups_Group( $group_id );
|
138 |
+
$group_capabilities = $group_object->capabilities;
|
139 |
+
$group_capabilities_deep = $group_object->capabilities_deep;
|
140 |
+
if ( ( count( $group_capabilities_deep ) - count( $group_capabilities ) ) > 0 ) {
|
141 |
+
usort( $group_capabilities_deep, 'groups_admin_sort_capabilities_by_capability' );
|
142 |
+
$output .= '<div class="field">';
|
143 |
+
$output .= __( 'Inherited capabilities:', GROUPS_PLUGIN_DOMAIN );
|
144 |
+
$output .= ' ';
|
145 |
+
$inherited_caps = array();
|
146 |
+
foreach ( $group_capabilities_deep as $group_capability ) {
|
147 |
+
$class = '';
|
148 |
+
if ( empty( $group_capabilities ) || !in_array( $group_capability, $group_capabilities ) ) {
|
149 |
+
$inherited_caps[] = wp_filter_nohtml_kses( $group_capability->capability->capability );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
$output .= implode( ' ', $inherited_caps );
|
153 |
+
$output .= '</div>';
|
154 |
+
}
|
155 |
+
|
156 |
$output .= '<div class="field">';
|
157 |
$output .= wp_nonce_field( 'groups-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false );
|
158 |
+
$output .= '<input class="button button-primary" type="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
159 |
$output .= '<input type="hidden" value="edit" name="action"/>';
|
160 |
+
$output .= '<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
161 |
$output .= '</div>';
|
162 |
$output .= '</div>'; // .group.edit
|
163 |
$output .= '</form>';
|
248 |
}
|
249 |
|
250 |
} // function groups_admin_groups_edit_submit
|
251 |
+
|
252 |
+
if ( !function_exists( 'groups_admin_sort_capabilities_by_capability' ) ) {
|
253 |
+
/**
|
254 |
+
* usort helper
|
255 |
+
* @param Groups_Capability $o1
|
256 |
+
* @param Groups_Capability $o2
|
257 |
+
* @return int strcmp result for group names
|
258 |
+
*/
|
259 |
+
function groups_admin_sort_capabilities_by_capability( $o1, $o2 ) {
|
260 |
+
return strcmp( $o1->capability->capability, $o2->capability->capability );
|
261 |
+
}
|
262 |
+
}
|
lib/admin/groups-admin-groups-remove.php
CHANGED
@@ -61,9 +61,9 @@ function groups_admin_groups_remove( $group_id ) {
|
|
61 |
'<li>' . sprintf( __( 'Group Name : %s', GROUPS_PLUGIN_DOMAIN ), stripslashes( wp_filter_nohtml_kses( $group->name ) ) ) . '</li>' .
|
62 |
'</ul> ' .
|
63 |
wp_nonce_field( 'groups-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
64 |
-
'<input class="button" type="submit" value="' . __( 'Remove', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
65 |
'<input type="hidden" value="remove" name="action"/>' .
|
66 |
-
'<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
67 |
'</div>' .
|
68 |
'</div>' . // .group.remove
|
69 |
'</form>' .
|
@@ -156,8 +156,8 @@ function groups_admin_groups_bulk_remove() {
|
|
156 |
$output .= '</li>';
|
157 |
$output .= '</ul>';
|
158 |
}
|
159 |
-
$output .= '<input class="button" type="submit" name="bulk" value="' . __( "Remove", GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
160 |
-
$output .= '<a class="cancel" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
161 |
|
162 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
163 |
$output .= '<input type="hidden" name="bulk-action" value="remove-group"/>';
|
61 |
'<li>' . sprintf( __( 'Group Name : %s', GROUPS_PLUGIN_DOMAIN ), stripslashes( wp_filter_nohtml_kses( $group->name ) ) ) . '</li>' .
|
62 |
'</ul> ' .
|
63 |
wp_nonce_field( 'groups-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
64 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Remove', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
65 |
'<input type="hidden" value="remove" name="action"/>' .
|
66 |
+
'<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>' .
|
67 |
'</div>' .
|
68 |
'</div>' . // .group.remove
|
69 |
'</form>' .
|
156 |
$output .= '</li>';
|
157 |
$output .= '</ul>';
|
158 |
}
|
159 |
+
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove", GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
160 |
+
$output .= '<a class="cancel button" href="' . $current_url . '">' . __( 'Cancel', GROUPS_PLUGIN_DOMAIN ) . '</a>';
|
161 |
|
162 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
163 |
$output .= '<input type="hidden" name="bulk-action" value="remove-group"/>';
|
lib/admin/groups-admin-groups.php
CHANGED
@@ -219,7 +219,7 @@ function groups_admin_groups() {
|
|
219 |
if ( $offset < 0 ) {
|
220 |
$offset = 0;
|
221 |
}
|
222 |
-
$paged = isset( $
|
223 |
if ( $paged < 0 ) {
|
224 |
$paged = 0;
|
225 |
}
|
@@ -426,14 +426,24 @@ function groups_admin_groups() {
|
|
426 |
$output .= "<td class='group-description'>" . stripslashes( wp_filter_nohtml_kses( $result->description ) ) . "</td>";
|
427 |
|
428 |
$output .= '<td class="capabilities">';
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
|
|
|
|
434 |
$output .= '<ul>';
|
435 |
-
foreach ( $
|
436 |
-
$output .= '<li>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
}
|
438 |
$output .= '</ul>';
|
439 |
} else {
|
@@ -478,4 +488,15 @@ function groups_admin_groups() {
|
|
478 |
echo $output;
|
479 |
Groups_Help::footer();
|
480 |
} // function groups_admin_groups()
|
481 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
if ( $offset < 0 ) {
|
220 |
$offset = 0;
|
221 |
}
|
222 |
+
$paged = isset( $_REQUEST['paged'] ) ? intval( $_REQUEST['paged'] ) : 0;
|
223 |
if ( $paged < 0 ) {
|
224 |
$paged = 0;
|
225 |
}
|
426 |
$output .= "<td class='group-description'>" . stripslashes( wp_filter_nohtml_kses( $result->description ) ) . "</td>";
|
427 |
|
428 |
$output .= '<td class="capabilities">';
|
429 |
+
|
430 |
+
$group = new Groups_Group( $result->group_id );
|
431 |
+
$group_capabilities = $group->capabilities;
|
432 |
+
$group_capabilities_deep = $group->capabilities_deep;
|
433 |
+
usort( $group_capabilities_deep, 'groups_admin_sort_capabilities_by_capability' );
|
434 |
+
|
435 |
+
if ( count( $group_capabilities_deep ) > 0 ) {
|
436 |
$output .= '<ul>';
|
437 |
+
foreach ( $group_capabilities_deep as $group_capability ) {
|
438 |
+
$output .= '<li>';
|
439 |
+
$class = '';
|
440 |
+
if ( empty( $group_capabilities ) || !in_array( $group_capability, $group_capabilities ) ) {
|
441 |
+
$class = 'inherited';
|
442 |
+
}
|
443 |
+
$output .= sprintf( '<span class="%s">', $class );
|
444 |
+
$output .= wp_filter_nohtml_kses( $group_capability->capability->capability );
|
445 |
+
$output .= '</span>';
|
446 |
+
$output .= '</li>';
|
447 |
}
|
448 |
$output .= '</ul>';
|
449 |
} else {
|
488 |
echo $output;
|
489 |
Groups_Help::footer();
|
490 |
} // function groups_admin_groups()
|
491 |
+
|
492 |
+
if ( !function_exists( 'groups_admin_sort_capabilities_by_capability' ) ) {
|
493 |
+
/**
|
494 |
+
* usort helper
|
495 |
+
* @param Groups_Capability $o1
|
496 |
+
* @param Groups_Capability $o2
|
497 |
+
* @return int strcmp result for group names
|
498 |
+
*/
|
499 |
+
function groups_admin_sort_capabilities_by_capability( $o1, $o2 ) {
|
500 |
+
return strcmp( $o1->capability->capability, $o2->capability->capability );
|
501 |
+
}
|
502 |
+
}
|
lib/admin/groups-admin-options.php
CHANGED
@@ -202,7 +202,7 @@ function groups_admin_options() {
|
|
202 |
'<form action="" name="options" method="post">' .
|
203 |
|
204 |
'<p>' .
|
205 |
-
'<input class="button" type="submit" name="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
206 |
$extensions_box .
|
207 |
'</p>' .
|
208 |
|
@@ -314,7 +314,7 @@ function groups_admin_options() {
|
|
314 |
echo
|
315 |
'<p>' .
|
316 |
wp_nonce_field( 'admin', GROUPS_ADMIN_OPTIONS_NONCE, true, false ) .
|
317 |
-
'<input class="button" type="submit" name="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
318 |
'</p>' .
|
319 |
'</div>' .
|
320 |
'</form>';
|
202 |
'<form action="" name="options" method="post">' .
|
203 |
|
204 |
'<p>' .
|
205 |
+
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
206 |
$extensions_box .
|
207 |
'</p>' .
|
208 |
|
314 |
echo
|
315 |
'<p>' .
|
316 |
wp_nonce_field( 'admin', GROUPS_ADMIN_OPTIONS_NONCE, true, false ) .
|
317 |
+
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
318 |
'</p>' .
|
319 |
'</div>' .
|
320 |
'</form>';
|
lib/core/class-groups-group.php
CHANGED
@@ -89,6 +89,51 @@ class Groups_Group implements I_Capable {
|
|
89 |
}
|
90 |
}
|
91 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
case 'users' :
|
93 |
$user_group_table = _groups_get_tablename( "user_group" );
|
94 |
$users = $wpdb->get_results( $wpdb->prepare(
|
@@ -194,7 +239,7 @@ class Groups_Group implements I_Capable {
|
|
194 |
global $wpdb;
|
195 |
extract( $map );
|
196 |
$result = false;
|
197 |
-
$error = false;
|
198 |
|
199 |
if ( !empty( $name ) ) {
|
200 |
|
89 |
}
|
90 |
}
|
91 |
break;
|
92 |
+
case 'capabilities_deep' :
|
93 |
+
$capability_ids = $this->capability_ids_deep;
|
94 |
+
$result = array();
|
95 |
+
foreach( $capability_ids as $capability_id ) {
|
96 |
+
$result[] = new Groups_Capability( $capability_id );
|
97 |
+
}
|
98 |
+
break;
|
99 |
+
case 'capability_ids_deep' :
|
100 |
+
$capability_ids = array();
|
101 |
+
$group_table = _groups_get_tablename( "group" );
|
102 |
+
$group_capability_table = _groups_get_tablename( "group_capability" );
|
103 |
+
// Find this group's and all its parent groups' capabilities.
|
104 |
+
$group_ids = array( Groups_Utility::id( $this->group->group_id ) );
|
105 |
+
$iterations = 0;
|
106 |
+
$old_group_ids_count = 0;
|
107 |
+
$all_groups = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
|
108 |
+
while( ( $iterations < $all_groups ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
|
109 |
+
$iterations++;
|
110 |
+
$old_group_ids_count = count( $group_ids );
|
111 |
+
$id_list = implode( ",", $group_ids );
|
112 |
+
$parent_group_ids = $wpdb->get_results(
|
113 |
+
"SELECT parent_id FROM $group_table WHERE parent_id IS NOT NULL AND group_id IN ($id_list)"
|
114 |
+
);
|
115 |
+
if ( $parent_group_ids ) {
|
116 |
+
foreach( $parent_group_ids as $parent_group_id ) {
|
117 |
+
$parent_group_id = Groups_Utility::id( $parent_group_id->parent_id );
|
118 |
+
if ( !in_array( $parent_group_id, $group_ids ) ) {
|
119 |
+
$group_ids[] = $parent_group_id;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
if ( count( $group_ids ) > 0 ) {
|
125 |
+
$id_list = implode( ",", $group_ids );
|
126 |
+
$rows = $wpdb->get_results(
|
127 |
+
"SELECT DISTINCT capability_id FROM $group_capability_table WHERE group_id IN ($id_list)"
|
128 |
+
);
|
129 |
+
if ( $rows ) {
|
130 |
+
foreach ( $rows as $row ) {
|
131 |
+
$capability_ids[] = $row->capability_id;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
$result = $capability_ids;
|
136 |
+
break;
|
137 |
case 'users' :
|
138 |
$user_group_table = _groups_get_tablename( "user_group" );
|
139 |
$users = $wpdb->get_results( $wpdb->prepare(
|
239 |
global $wpdb;
|
240 |
extract( $map );
|
241 |
$result = false;
|
242 |
+
$error = false;
|
243 |
|
244 |
if ( !empty( $name ) ) {
|
245 |
|
lib/core/class-groups-pagination.php
CHANGED
@@ -27,7 +27,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
27 |
* Pagination based on WP_List_Table.
|
28 |
*/
|
29 |
class Groups_Pagination {
|
30 |
-
|
31 |
/**
|
32 |
*
|
33 |
* @param int $total_items how many items there are to display
|
@@ -43,7 +43,7 @@ class Groups_Pagination {
|
|
43 |
)
|
44 |
);
|
45 |
}
|
46 |
-
|
47 |
/**
|
48 |
* Get the current page number
|
49 |
* @return int the current page number
|
@@ -54,14 +54,14 @@ class Groups_Pagination {
|
|
54 |
if ( preg_match( "/(\/page\/)(\d+)/", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $matches ) ) {
|
55 |
$pagenum = absint( $matches[2] );
|
56 |
}
|
57 |
-
}
|
58 |
|
59 |
-
if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
|
60 |
$pagenum = $this->_pagination_args['total_pages'];
|
61 |
-
|
62 |
return max( 1, $pagenum );
|
63 |
}
|
64 |
-
|
65 |
/**
|
66 |
* An internal method that sets all the necessary pagination arguments
|
67 |
*
|
@@ -87,7 +87,7 @@ class Groups_Pagination {
|
|
87 |
* @param boolean $echo displays if true, otherwise returns
|
88 |
*/
|
89 |
function pagination( $which, $echo = false ) {
|
90 |
-
|
91 |
if ( empty( $this->_pagination_args ) )
|
92 |
return;
|
93 |
|
@@ -103,7 +103,7 @@ class Groups_Pagination {
|
|
103 |
|
104 |
// needs to remove rewritten added page
|
105 |
$current_url = preg_replace( "/\/page\/\d+/", "", $current_url );
|
106 |
-
|
107 |
$page_links = array();
|
108 |
|
109 |
$disable_first = $disable_last = '';
|
@@ -166,4 +166,3 @@ class Groups_Pagination {
|
|
166 |
}
|
167 |
}
|
168 |
}
|
169 |
-
?>
|
27 |
* Pagination based on WP_List_Table.
|
28 |
*/
|
29 |
class Groups_Pagination {
|
30 |
+
|
31 |
/**
|
32 |
*
|
33 |
* @param int $total_items how many items there are to display
|
43 |
)
|
44 |
);
|
45 |
}
|
46 |
+
|
47 |
/**
|
48 |
* Get the current page number
|
49 |
* @return int the current page number
|
54 |
if ( preg_match( "/(\/page\/)(\d+)/", $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], $matches ) ) {
|
55 |
$pagenum = absint( $matches[2] );
|
56 |
}
|
57 |
+
}
|
58 |
|
59 |
+
if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
|
60 |
$pagenum = $this->_pagination_args['total_pages'];
|
61 |
+
}
|
62 |
return max( 1, $pagenum );
|
63 |
}
|
64 |
+
|
65 |
/**
|
66 |
* An internal method that sets all the necessary pagination arguments
|
67 |
*
|
87 |
* @param boolean $echo displays if true, otherwise returns
|
88 |
*/
|
89 |
function pagination( $which, $echo = false ) {
|
90 |
+
|
91 |
if ( empty( $this->_pagination_args ) )
|
92 |
return;
|
93 |
|
103 |
|
104 |
// needs to remove rewritten added page
|
105 |
$current_url = preg_replace( "/\/page\/\d+/", "", $current_url );
|
106 |
+
|
107 |
$page_links = array();
|
108 |
|
109 |
$disable_first = $disable_last = '';
|
166 |
}
|
167 |
}
|
168 |
}
|
|
lib/views/class-groups-uie.php
CHANGED
@@ -125,7 +125,8 @@ class Groups_UIE {
|
|
125 |
$output .= 'if ( typeof jQuery !== "undefined" ) {';
|
126 |
$output .= sprintf( 'jQuery("%s").each(', $selector );
|
127 |
$output .= 'function(){';
|
128 |
-
$output .= 'jQuery(this).
|
|
|
129 |
$output .= '}';
|
130 |
$output .= ');';
|
131 |
$output .= '}';
|
125 |
$output .= 'if ( typeof jQuery !== "undefined" ) {';
|
126 |
$output .= sprintf( 'jQuery("%s").each(', $selector );
|
127 |
$output .= 'function(){';
|
128 |
+
$output .= 'var title = jQuery(this).html().replace( /(<\/[^>]+>)/igm , "$1 ");';
|
129 |
+
$output .= 'jQuery(this).attr("title", this.innerText || jQuery(jQuery.parseHTML(title)).text().replace(/\s+/igm, " ") );';
|
130 |
$output .= '}';
|
131 |
$output .= ');';
|
132 |
$output .= '}';
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: itthinx
|
3 |
Donate link: http://www.itthinx.com/plugins/groups
|
4 |
Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 4.2
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv3
|
9 |
|
10 |
Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
|
@@ -177,6 +177,15 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
|
|
177 |
|
178 |
== Changelog ==
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
= 1.5.1 =
|
181 |
* Please **MAKE A BACKUP** of your site and database PRIOR to updating.
|
182 |
* WordPress 4.2 compatible.
|
@@ -435,6 +444,5 @@ Some installations wouldn't work correctly, showing no capabilities and making i
|
|
435 |
|
436 |
== Upgrade Notice ==
|
437 |
|
438 |
-
= 1.5.
|
439 |
-
|
440 |
-
This release is required for compatibility with WordPress 4.2 and above (uses a reduced index size on a database table).
|
2 |
Contributors: itthinx
|
3 |
Donate link: http://www.itthinx.com/plugins/groups
|
4 |
Tags: access, access control, capability, capabilities, content, download, downloads, file, file access, files, group, groups, member, members, membership, memberships, paypal, permission, permissions, subscription, subscriptions, woocommerce
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 4.2.1
|
7 |
+
Stable tag: 1.5.2
|
8 |
License: GPLv3
|
9 |
|
10 |
Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.
|
177 |
|
178 |
== Changelog ==
|
179 |
|
180 |
+
= 1.5.2 =
|
181 |
+
* Improved internal definitions to use API function instead of WP_CONTENT_DIR
|
182 |
+
and WP_CONTENT_URL constants.
|
183 |
+
* Now showing inherited capabilities for groups.
|
184 |
+
* Added ABSPATH check to plugin main file.
|
185 |
+
* Improved the UI rendering cancel links as buttons.
|
186 |
+
* Improved the UI adding some space on capability selector box.
|
187 |
+
* Fixed a pagination issue when the page number is indicated on the Groups or Capabilities screen.
|
188 |
+
|
189 |
= 1.5.1 =
|
190 |
* Please **MAKE A BACKUP** of your site and database PRIOR to updating.
|
191 |
* WordPress 4.2 compatible.
|
444 |
|
445 |
== Upgrade Notice ==
|
446 |
|
447 |
+
= 1.5.2 =
|
448 |
+
This release improves some user interface elements, some internal definitions and now shows inherited capabilities for groups.
|
|