Version Description
- Adjusted the Groups and Capabilities screens' UI elements.
- Reduced the filters section footprint on the Groups screen.
- Reduced the filters section footprint on the Capabilities screen.
- Fixed use of deprecated constructor in the Groups_Pagination class.
- Fixed sorting by description and the sorting indicator on the Groups screen.
- Fixed sorting by description and the sorting indicator on the Capabilities screen.
- Fixed some code formatting issues including superfluous whitespace.
- Improved the footer rendering and footprint.
Download this release
Release Info
Developer | itthinx |
Plugin | Groups |
Version | 1.10.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.1 to 1.10.0
- css/groups_admin.css +37 -18
- groups.php +2 -2
- lib/admin/groups-admin-add-ons.php +7 -9
- lib/admin/groups-admin-capabilities-add.php +23 -26
- lib/admin/groups-admin-capabilities-edit.php +19 -23
- lib/admin/groups-admin-capabilities-remove.php +7 -15
- lib/admin/groups-admin-capabilities.php +125 -57
- lib/admin/groups-admin-groups-add.php +6 -10
- lib/admin/groups-admin-groups-edit.php +6 -10
- lib/admin/groups-admin-groups-remove.php +19 -27
- lib/admin/groups-admin-groups.php +107 -54
- lib/admin/groups-admin-options.php +8 -10
- lib/admin/groups-admin-tree-view.php +5 -6
- lib/core/class-groups-help.php +32 -6
- lib/core/class-groups-pagination.php +1 -1
- readme.txt +14 -4
css/groups_admin.css
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
/**
|
2 |
* groups_admin.css
|
3 |
-
*
|
4 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
5 |
-
*
|
6 |
* This code is released under the GNU General Public License.
|
7 |
* See COPYRIGHT.txt and LICENSE.txt.
|
8 |
-
*
|
9 |
* This code is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* GNU General Public License for more details.
|
13 |
-
*
|
14 |
* This header and all notices must be kept intact.
|
15 |
-
*
|
16 |
* @author Karim Rahimpur
|
17 |
* @package groups
|
18 |
* @since groups 1.0.0
|
@@ -24,10 +24,22 @@
|
|
24 |
.filters,
|
25 |
.manage {
|
26 |
background-color: #fff;
|
27 |
-
padding:
|
28 |
-
margin-bottom:
|
29 |
border: 1px solid #ddd;
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
.manage a.add {
|
32 |
text-decoration: none;
|
33 |
cursor: pointer;
|
@@ -36,6 +48,16 @@
|
|
36 |
vertical-align: middle;
|
37 |
padding-right: 4px;
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
.manage a.add .label {
|
40 |
height: 20px;
|
41 |
vertical-align: middle;
|
@@ -74,10 +96,7 @@ input.group-id-filter,
|
|
74 |
input.group-name-filter,
|
75 |
input.capability-id-filter,
|
76 |
input.capability-filter {
|
77 |
-
margin-right:
|
78 |
-
}
|
79 |
-
input[name="clear_filters"] {
|
80 |
-
float:right;
|
81 |
}
|
82 |
|
83 |
div.group.new label,
|
@@ -149,16 +168,16 @@ div.capability.edit label {
|
|
149 |
background: url(../images/required.png) transparent no-repeat left center;
|
150 |
padding-left: 16px ! important;
|
151 |
}
|
152 |
-
|
153 |
padding-top: 16px;
|
154 |
color: #999;
|
155 |
}
|
156 |
-
|
157 |
color: #777;
|
158 |
text-decoration: none;
|
159 |
font-weight: bold;
|
160 |
}
|
161 |
-
|
162 |
display: inline;
|
163 |
}
|
164 |
|
@@ -286,23 +305,23 @@ div.groups-footer form {
|
|
286 |
background-color: #fff;
|
287 |
border: 1px solid #ccc;
|
288 |
}
|
289 |
-
.groups-admin-add-ons h3 {
|
290 |
margin: 0;
|
291 |
display: block;
|
292 |
clear: both;
|
293 |
}
|
294 |
-
.groups-admin-add-ons h3 img {
|
295 |
vertical-align: middle;
|
296 |
margin: 0 8px 0 0;
|
297 |
display: block;
|
298 |
float: left;
|
299 |
}
|
300 |
-
.groups-admin-add-ons a {
|
301 |
text-decoration: none;
|
302 |
display: block;
|
303 |
overflow: hidden;
|
304 |
}
|
305 |
-
.groups-admin-add-ons p {
|
306 |
margin: 0;
|
307 |
padding-top: 8px;
|
308 |
clear: both;
|
1 |
/**
|
2 |
* groups_admin.css
|
3 |
+
*
|
4 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
5 |
+
*
|
6 |
* This code is released under the GNU General Public License.
|
7 |
* See COPYRIGHT.txt and LICENSE.txt.
|
8 |
+
*
|
9 |
* This code is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* GNU General Public License for more details.
|
13 |
+
*
|
14 |
* This header and all notices must be kept intact.
|
15 |
+
*
|
16 |
* @author Karim Rahimpur
|
17 |
* @package groups
|
18 |
* @since groups 1.0.0
|
24 |
.filters,
|
25 |
.manage {
|
26 |
background-color: #fff;
|
27 |
+
padding: 0.62em;
|
28 |
+
margin-bottom: 0.62em;
|
29 |
border: 1px solid #ddd;
|
30 |
}
|
31 |
+
.filters fieldset,
|
32 |
+
.manage fieldset {
|
33 |
+
display: inline-block;
|
34 |
+
clear: both;
|
35 |
+
}
|
36 |
+
.filters legend {
|
37 |
+
padding: 0 0 2px 0;
|
38 |
+
}
|
39 |
+
.filters form label {
|
40 |
+
white-space: nowrap;
|
41 |
+
margin-bottom: 0.62em;
|
42 |
+
}
|
43 |
.manage a.add {
|
44 |
text-decoration: none;
|
45 |
cursor: pointer;
|
48 |
vertical-align: middle;
|
49 |
padding-right: 4px;
|
50 |
}
|
51 |
+
.manage-groups a.add.page-title-action img.icon,
|
52 |
+
.manage-groups a.refresh.page-title-action img.icon,
|
53 |
+
.manage-groups .row-actions span.edit img,
|
54 |
+
.manage-groups .row-actions span.remove img,
|
55 |
+
.manage-capabilities a.add.page-title-action img.icon,
|
56 |
+
.manage-capabilities a.refresh.page-title-action img.icon,
|
57 |
+
.manage-capabilities .row-actions span.edit img,
|
58 |
+
.manage-capabilities .row-actions span.remove img {
|
59 |
+
vertical-align: sub;
|
60 |
+
}
|
61 |
.manage a.add .label {
|
62 |
height: 20px;
|
63 |
vertical-align: middle;
|
96 |
input.group-name-filter,
|
97 |
input.capability-id-filter,
|
98 |
input.capability-filter {
|
99 |
+
margin-right: 0.31em;
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
div.group.new label,
|
168 |
background: url(../images/required.png) transparent no-repeat left center;
|
169 |
padding-left: 16px ! important;
|
170 |
}
|
171 |
+
.groups-footer {
|
172 |
padding-top: 16px;
|
173 |
color: #999;
|
174 |
}
|
175 |
+
.groups-footer a {
|
176 |
color: #777;
|
177 |
text-decoration: none;
|
178 |
font-weight: bold;
|
179 |
}
|
180 |
+
.groups-footer form {
|
181 |
display: inline;
|
182 |
}
|
183 |
|
305 |
background-color: #fff;
|
306 |
border: 1px solid #ccc;
|
307 |
}
|
308 |
+
.groups-admin-add-ons .add-ons h3 {
|
309 |
margin: 0;
|
310 |
display: block;
|
311 |
clear: both;
|
312 |
}
|
313 |
+
.groups-admin-add-ons .add-ons h3 img {
|
314 |
vertical-align: middle;
|
315 |
margin: 0 8px 0 0;
|
316 |
display: block;
|
317 |
float: left;
|
318 |
}
|
319 |
+
.groups-admin-add-ons .add-ons a {
|
320 |
text-decoration: none;
|
321 |
display: block;
|
322 |
overflow: hidden;
|
323 |
}
|
324 |
+
.groups-admin-add-ons .add-ons p {
|
325 |
margin: 0;
|
326 |
padding-top: 8px;
|
327 |
clear: both;
|
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: 1.
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
@@ -30,7 +30,7 @@
|
|
30 |
if ( !defined( 'ABSPATH' ) ) {
|
31 |
exit;
|
32 |
}
|
33 |
-
define( 'GROUPS_CORE_VERSION', '1.
|
34 |
define( 'GROUPS_FILE', __FILE__ );
|
35 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
36 |
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: 1.10.0
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
30 |
if ( !defined( 'ABSPATH' ) ) {
|
31 |
exit;
|
32 |
}
|
33 |
+
define( 'GROUPS_CORE_VERSION', '1.10.0' );
|
34 |
define( 'GROUPS_FILE', __FILE__ );
|
35 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
36 |
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
lib/admin/groups-admin-add-ons.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-add-ons.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.8.0
|
@@ -28,7 +28,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
*/
|
29 |
function groups_admin_add_ons() {
|
30 |
|
31 |
-
echo '<div class="groups-admin-add-ons">';
|
32 |
|
33 |
echo '<h1>';
|
34 |
echo __( 'Add-Ons', GROUPS_PLUGIN_DOMAIN );
|
@@ -181,8 +181,6 @@ function groups_admin_add_ons() {
|
|
181 |
echo '</ul>'; // .add-ons
|
182 |
|
183 |
echo '</div>'; // .groups-admin-add-ons
|
184 |
-
|
185 |
-
Groups_Help::footer();
|
186 |
}
|
187 |
|
188 |
function groups_admin_add_ons_sort( $e1, $e2 ) {
|
@@ -190,6 +188,6 @@ function groups_admin_add_ons_sort( $e1, $e2 ) {
|
|
190 |
$i2 = isset( $e2['index'] ) ? $e2['index'] : 0;
|
191 |
$t1 = isset( $e1['title'] ) ? $e1['title'] : '';
|
192 |
$t2 = isset( $e2['title'] ) ? $e2['title'] : '';
|
193 |
-
|
194 |
return $i1 - $i2 + strnatcmp( $t1, $t2 );
|
195 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-add-ons.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.8.0
|
28 |
*/
|
29 |
function groups_admin_add_ons() {
|
30 |
|
31 |
+
echo '<div class="groups-admin-add-ons wrap">';
|
32 |
|
33 |
echo '<h1>';
|
34 |
echo __( 'Add-Ons', GROUPS_PLUGIN_DOMAIN );
|
181 |
echo '</ul>'; // .add-ons
|
182 |
|
183 |
echo '</div>'; // .groups-admin-add-ons
|
|
|
|
|
184 |
}
|
185 |
|
186 |
function groups_admin_add_ons_sort( $e1, $e2 ) {
|
188 |
$i2 = isset( $e2['index'] ) ? $e2['index'] : 0;
|
189 |
$t1 = isset( $e1['title'] ) ? $e1['title'] : '';
|
190 |
$t2 = isset( $e2['title'] ) ? $e2['title'] : '';
|
191 |
+
|
192 |
return $i1 - $i2 + strnatcmp( $t1, $t2 );
|
193 |
}
|
lib/admin/groups-admin-capabilities-add.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities-add.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -27,44 +27,42 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
27 |
* Show add capability form.
|
28 |
*/
|
29 |
function groups_admin_capabilities_add() {
|
30 |
-
|
31 |
global $wpdb;
|
32 |
-
|
33 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
34 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
35 |
}
|
36 |
-
|
37 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
38 |
$current_url = remove_query_arg( 'paged', $current_url );
|
39 |
$current_url = remove_query_arg( 'action', $current_url );
|
40 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
41 |
-
|
42 |
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : '';
|
43 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
44 |
-
|
45 |
$capability_table = _groups_get_tablename( 'capability' );
|
46 |
-
|
47 |
$output =
|
48 |
-
'<div class="manage-capabilities">' .
|
49 |
-
'<div>' .
|
50 |
'<h1>' .
|
51 |
__( 'Add a new capability', GROUPS_PLUGIN_DOMAIN ) .
|
52 |
'</h1>' .
|
53 |
-
'</div>' .
|
54 |
Groups_Admin::render_messages() .
|
55 |
'<form id="add-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
56 |
'<div class="capability new">' .
|
57 |
-
|
58 |
'<div class="field">' .
|
59 |
'<label for="capability-field" class="field-label first required">' .__( 'Capability', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
60 |
'<input id="name-field" name="capability-field" class="capability-field" type="text" value="' . esc_attr( stripslashes( $capability ) ) . '"/>' .
|
61 |
'</div>' .
|
62 |
-
|
63 |
'<div class="field">' .
|
64 |
'<label for="description-field" class="field-label description-field">' .__( 'Description', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
65 |
'<textarea id="description-field" name="description-field" rows="5" cols="45">' . stripslashes( wp_filter_nohtml_kses( $description ) ) . '</textarea>' .
|
66 |
'</div>' .
|
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 ) . '"/>' .
|
@@ -74,10 +72,9 @@ function groups_admin_capabilities_add() {
|
|
74 |
'</div>' . // .capability.new
|
75 |
'</form>' .
|
76 |
'</div>'; // .manage-capabilities
|
77 |
-
|
78 |
echo $output;
|
79 |
-
|
80 |
-
Groups_Help::footer();
|
81 |
} // function groups_admin_capabilities_add
|
82 |
|
83 |
/**
|
@@ -85,20 +82,20 @@ function groups_admin_capabilities_add() {
|
|
85 |
* @return int new capability's id or false if unsuccessful
|
86 |
*/
|
87 |
function groups_admin_capabilities_add_submit() {
|
88 |
-
|
89 |
global $wpdb;
|
90 |
-
|
91 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
92 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
93 |
}
|
94 |
-
|
95 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-add' ) ) {
|
96 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
97 |
}
|
98 |
-
|
99 |
-
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : null;
|
100 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
101 |
-
|
102 |
$capability_id = Groups_Capability::create( compact( "capability", "description" ) );
|
103 |
if ( !$capability_id ) {
|
104 |
if ( empty( $capability ) ) {
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities-add.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
27 |
* Show add capability form.
|
28 |
*/
|
29 |
function groups_admin_capabilities_add() {
|
30 |
+
|
31 |
global $wpdb;
|
32 |
+
|
33 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
34 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
35 |
}
|
36 |
+
|
37 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
38 |
$current_url = remove_query_arg( 'paged', $current_url );
|
39 |
$current_url = remove_query_arg( 'action', $current_url );
|
40 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
41 |
+
|
42 |
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : '';
|
43 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
44 |
+
|
45 |
$capability_table = _groups_get_tablename( 'capability' );
|
46 |
+
|
47 |
$output =
|
48 |
+
'<div class="manage-capabilities wrap">' .
|
|
|
49 |
'<h1>' .
|
50 |
__( 'Add a new capability', GROUPS_PLUGIN_DOMAIN ) .
|
51 |
'</h1>' .
|
|
|
52 |
Groups_Admin::render_messages() .
|
53 |
'<form id="add-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
54 |
'<div class="capability new">' .
|
55 |
+
|
56 |
'<div class="field">' .
|
57 |
'<label for="capability-field" class="field-label first required">' .__( 'Capability', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
58 |
'<input id="name-field" name="capability-field" class="capability-field" type="text" value="' . esc_attr( stripslashes( $capability ) ) . '"/>' .
|
59 |
'</div>' .
|
60 |
+
|
61 |
'<div class="field">' .
|
62 |
'<label for="description-field" class="field-label description-field">' .__( 'Description', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
63 |
'<textarea id="description-field" name="description-field" rows="5" cols="45">' . stripslashes( wp_filter_nohtml_kses( $description ) ) . '</textarea>' .
|
64 |
'</div>' .
|
65 |
+
|
66 |
'<div class="field">' .
|
67 |
wp_nonce_field( 'capabilities-add', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
68 |
'<input class="button button-primary" type="submit" value="' . __( 'Add', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
72 |
'</div>' . // .capability.new
|
73 |
'</form>' .
|
74 |
'</div>'; // .manage-capabilities
|
75 |
+
|
76 |
echo $output;
|
77 |
+
|
|
|
78 |
} // function groups_admin_capabilities_add
|
79 |
|
80 |
/**
|
82 |
* @return int new capability's id or false if unsuccessful
|
83 |
*/
|
84 |
function groups_admin_capabilities_add_submit() {
|
85 |
+
|
86 |
global $wpdb;
|
87 |
+
|
88 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
89 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
90 |
}
|
91 |
+
|
92 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-add' ) ) {
|
93 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
94 |
}
|
95 |
+
|
96 |
+
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : null;
|
97 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
98 |
+
|
99 |
$capability_id = Groups_Capability::create( compact( "capability", "description" ) );
|
100 |
if ( !$capability_id ) {
|
101 |
if ( empty( $capability ) ) {
|
lib/admin/groups-admin-capabilities-edit.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capability-edit.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -28,52 +28,50 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
* @param int $capability_id capability id
|
29 |
*/
|
30 |
function groups_admin_capabilities_edit( $capability_id ) {
|
31 |
-
|
32 |
global $wpdb;
|
33 |
-
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
36 |
}
|
37 |
-
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
-
|
40 |
if ( empty( $capability ) ) {
|
41 |
wp_die( __( 'No such capability.', GROUPS_PLUGIN_DOMAIN ) );
|
42 |
}
|
43 |
-
|
44 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
45 |
$current_url = remove_query_arg( 'action', $current_url );
|
46 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
47 |
-
|
48 |
$capability_capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : $capability->capability;
|
49 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : $capability->description;
|
50 |
-
|
51 |
$capability_readonly = ( $capability->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) ? "" : ' readonly="readonly" ';
|
52 |
-
|
53 |
$output =
|
54 |
-
'<div class="manage-capabilities">' .
|
55 |
-
'<div>' .
|
56 |
'<h1>' .
|
57 |
__( 'Edit a capability', GROUPS_PLUGIN_DOMAIN ) .
|
58 |
'</h1>' .
|
59 |
-
'</div>' .
|
60 |
|
61 |
Groups_Admin::render_messages() .
|
62 |
-
|
63 |
'<form id="edit-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
64 |
'<div class="capability edit">' .
|
65 |
'<input id="capability-id-field" name="capability-id-field" type="hidden" value="' . esc_attr( intval( $capability_id ) ) . '"/>' .
|
66 |
-
|
67 |
'<div class="field">' .
|
68 |
'<label for="capability-field" class="field-label first required">' .__( 'Capability', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
69 |
'<input ' . $capability_readonly . ' id="capability-field" name="capability-field" class="capability-field" type="text" value="' . esc_attr( stripslashes( $capability_capability ) ) . '"/>' .
|
70 |
'</div>' .
|
71 |
-
|
72 |
'<div class="field">' .
|
73 |
'<label for="description-field" class="field-label description-field">' .__( 'Description', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
74 |
'<textarea id="description-field" name="description-field" rows="5" cols="45">' . stripslashes( wp_filter_nohtml_kses( $description ) ) . '</textarea>' .
|
75 |
'</div>' .
|
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 ) . '"/>' .
|
@@ -83,10 +81,8 @@ function groups_admin_capabilities_edit( $capability_id ) {
|
|
83 |
'</div>' . // .capability.edit
|
84 |
'</form>' .
|
85 |
'</div>'; // .manage-capabilities
|
86 |
-
|
87 |
echo $output;
|
88 |
-
|
89 |
-
Groups_Help::footer();
|
90 |
} // function groups_admin_capabilities_edit
|
91 |
|
92 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capability-edit.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
28 |
* @param int $capability_id capability id
|
29 |
*/
|
30 |
function groups_admin_capabilities_edit( $capability_id ) {
|
31 |
+
|
32 |
global $wpdb;
|
33 |
+
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
36 |
}
|
37 |
+
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
+
|
40 |
if ( empty( $capability ) ) {
|
41 |
wp_die( __( 'No such capability.', GROUPS_PLUGIN_DOMAIN ) );
|
42 |
}
|
43 |
+
|
44 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
45 |
$current_url = remove_query_arg( 'action', $current_url );
|
46 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
47 |
+
|
48 |
$capability_capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : $capability->capability;
|
49 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : $capability->description;
|
50 |
+
|
51 |
$capability_readonly = ( $capability->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) ? "" : ' readonly="readonly" ';
|
52 |
+
|
53 |
$output =
|
54 |
+
'<div class="manage-capabilities wrap">' .
|
|
|
55 |
'<h1>' .
|
56 |
__( 'Edit a capability', GROUPS_PLUGIN_DOMAIN ) .
|
57 |
'</h1>' .
|
|
|
58 |
|
59 |
Groups_Admin::render_messages() .
|
60 |
+
|
61 |
'<form id="edit-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
62 |
'<div class="capability edit">' .
|
63 |
'<input id="capability-id-field" name="capability-id-field" type="hidden" value="' . esc_attr( intval( $capability_id ) ) . '"/>' .
|
64 |
+
|
65 |
'<div class="field">' .
|
66 |
'<label for="capability-field" class="field-label first required">' .__( 'Capability', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
67 |
'<input ' . $capability_readonly . ' id="capability-field" name="capability-field" class="capability-field" type="text" value="' . esc_attr( stripslashes( $capability_capability ) ) . '"/>' .
|
68 |
'</div>' .
|
69 |
+
|
70 |
'<div class="field">' .
|
71 |
'<label for="description-field" class="field-label description-field">' .__( 'Description', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
72 |
'<textarea id="description-field" name="description-field" rows="5" cols="45">' . stripslashes( wp_filter_nohtml_kses( $description ) ) . '</textarea>' .
|
73 |
'</div>' .
|
74 |
+
|
75 |
'<div class="field">' .
|
76 |
wp_nonce_field( 'capabilities-edit', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
77 |
'<input class="button button-primary" type="submit" value="' . __( 'Save', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
81 |
'</div>' . // .capability.edit
|
82 |
'</form>' .
|
83 |
'</div>'; // .manage-capabilities
|
84 |
+
|
85 |
echo $output;
|
|
|
|
|
86 |
} // function groups_admin_capabilities_edit
|
87 |
|
88 |
/**
|
lib/admin/groups-admin-capabilities-remove.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities-remove.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -48,12 +48,10 @@ function groups_admin_capabilities_remove( $capability_id ) {
|
|
48 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
49 |
|
50 |
$output =
|
51 |
-
'<div class="manage-capabilities">' .
|
52 |
-
'<div>' .
|
53 |
'<h1>' .
|
54 |
__( 'Remove a capability', GROUPS_PLUGIN_DOMAIN ) .
|
55 |
'</h1>' .
|
56 |
-
'</div>' .
|
57 |
'<form id="remove-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
58 |
'<div class="capability remove">' .
|
59 |
'<input id="capability-id-field" name="capability-id-field" type="hidden" value="' . esc_attr( intval( $capability->capability_id ) ) . '"/>' .
|
@@ -70,8 +68,6 @@ function groups_admin_capabilities_remove( $capability_id ) {
|
|
70 |
'</div>'; // .manage-capabilities
|
71 |
|
72 |
echo $output;
|
73 |
-
|
74 |
-
Groups_Help::footer();
|
75 |
} // function groups_admin_capabilities_remove
|
76 |
|
77 |
/**
|
@@ -132,12 +128,10 @@ function groups_admin_capabilities_bulk_remove() {
|
|
132 |
$current_url = remove_query_arg( 'action', $current_url );
|
133 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
134 |
|
135 |
-
$output .= '<div class="manage-capabilities">';
|
136 |
-
$output .= '<div>';
|
137 |
$output .= '<h1>';
|
138 |
$output .= __( 'Remove capabilities', GROUPS_PLUGIN_DOMAIN );
|
139 |
$output .= '</h1>';
|
140 |
-
$output .= '</div>';
|
141 |
|
142 |
$output .= '<form id="capabilities-action" method="post" action="">';
|
143 |
$output .= '<div class="capability remove">';
|
@@ -165,8 +159,6 @@ function groups_admin_capabilities_bulk_remove() {
|
|
165 |
$output .= '</div>';
|
166 |
|
167 |
echo $output;
|
168 |
-
|
169 |
-
Groups_Help::footer();
|
170 |
} // function groups_admin_capabilities_bulk_remove
|
171 |
|
172 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities-remove.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
48 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
49 |
|
50 |
$output =
|
51 |
+
'<div class="manage-capabilities wrap">' .
|
|
|
52 |
'<h1>' .
|
53 |
__( 'Remove a capability', GROUPS_PLUGIN_DOMAIN ) .
|
54 |
'</h1>' .
|
|
|
55 |
'<form id="remove-capability" action="' . esc_url( $current_url ) . '" method="post">' .
|
56 |
'<div class="capability remove">' .
|
57 |
'<input id="capability-id-field" name="capability-id-field" type="hidden" value="' . esc_attr( intval( $capability->capability_id ) ) . '"/>' .
|
68 |
'</div>'; // .manage-capabilities
|
69 |
|
70 |
echo $output;
|
|
|
|
|
71 |
} // function groups_admin_capabilities_remove
|
72 |
|
73 |
/**
|
128 |
$current_url = remove_query_arg( 'action', $current_url );
|
129 |
$current_url = remove_query_arg( 'capability_id', $current_url );
|
130 |
|
131 |
+
$output .= '<div class="manage-capabilities wrap">';
|
|
|
132 |
$output .= '<h1>';
|
133 |
$output .= __( 'Remove capabilities', GROUPS_PLUGIN_DOMAIN );
|
134 |
$output .= '</h1>';
|
|
|
135 |
|
136 |
$output .= '<form id="capabilities-action" method="post" action="">';
|
137 |
$output .= '<div class="capability remove">';
|
159 |
$output .= '</div>';
|
160 |
|
161 |
echo $output;
|
|
|
|
|
162 |
} // function groups_admin_capabilities_bulk_remove
|
163 |
|
164 |
/**
|
lib/admin/groups-admin-capabilities.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -118,9 +118,9 @@ function groups_admin_capabilities() {
|
|
118 |
if ( check_admin_referer( 'refresh' ) ) {
|
119 |
$n = Groups_WordPress::refresh_capabilities();
|
120 |
if ( $n > 0 ) {
|
121 |
-
$output .= '<div class="
|
122 |
} else {
|
123 |
-
$output .= '<div class="
|
124 |
}
|
125 |
} else {
|
126 |
wp_die( __( 'A Duck!', GROUPS_PLUGIN_DOMAIN ) );
|
@@ -187,20 +187,44 @@ function groups_admin_capabilities() {
|
|
187 |
$capability_table = _groups_get_tablename( 'capability' );
|
188 |
|
189 |
$output .=
|
190 |
-
'<div class="manage-capabilities">' .
|
191 |
-
'<div>' .
|
192 |
'<h1>' .
|
193 |
__( 'Capabilities', GROUPS_PLUGIN_DOMAIN ) .
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
$output .= Groups_Admin::render_messages();
|
198 |
-
|
199 |
-
$output .=
|
200 |
-
'<div class="manage">' .
|
201 |
-
"<a title='" . __( 'Click to add a new capability', GROUPS_PLUGIN_DOMAIN ) . "' class='add button' href='" . esc_url( $current_url ) . "&action=add'><img class='icon' alt='" . __( 'Add', GROUPS_PLUGIN_DOMAIN) . "' src='". GROUPS_PLUGIN_URL . "images/add.png'/><span class='label'>" . __( 'New Capability', GROUPS_PLUGIN_DOMAIN) . "</span></a>" .
|
202 |
-
"<a title='" . __( 'Click to refresh capabilities', GROUPS_PLUGIN_DOMAIN ) . "' class='refresh button' href='" . esc_url( wp_nonce_url( $current_url, 'refresh' ) ) . "&action=refresh'><img class='icon' alt='" . __( 'Refresh', GROUPS_PLUGIN_DOMAIN) . "' src='". GROUPS_PLUGIN_URL . "images/refresh.png'/><span class='label'></span></a>" .
|
203 |
-
'</div>';
|
204 |
|
205 |
$row_count = isset( $_POST['row_count'] ) ? intval( $_POST['row_count'] ) : 0;
|
206 |
|
@@ -222,6 +246,7 @@ function groups_admin_capabilities() {
|
|
222 |
switch ( $orderby ) {
|
223 |
case 'capability_id' :
|
224 |
case 'capability' :
|
|
|
225 |
break;
|
226 |
default:
|
227 |
$orderby = 'name';
|
@@ -285,36 +310,36 @@ function groups_admin_capabilities() {
|
|
285 |
$results = $wpdb->get_results( $query, OBJECT );
|
286 |
|
287 |
$column_display_names = array(
|
288 |
-
'capability_id' => __( '
|
289 |
'capability' => __( 'Capability', GROUPS_PLUGIN_DOMAIN ),
|
290 |
-
'description' => __( 'Description', GROUPS_PLUGIN_DOMAIN )
|
291 |
-
'edit' => __( 'Edit', GROUPS_PLUGIN_DOMAIN ),
|
292 |
-
'remove' => __( 'Remove', GROUPS_PLUGIN_DOMAIN )
|
293 |
);
|
294 |
|
295 |
$output .= '<div class="capabilities-overview">';
|
296 |
|
297 |
$output .=
|
298 |
'<div class="filters">' .
|
299 |
-
'<label class="description" for="setfilters">' . __( 'Filters', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
300 |
'<form id="setfilters" action="" method="post">' .
|
301 |
-
'<
|
302 |
-
'<
|
|
|
|
|
303 |
'<input class="capability-id-filter" name="capability_id" type="text" value="' . esc_attr( $capability_id ) . '"/>' .
|
304 |
-
'
|
|
|
|
|
305 |
'<input class="capability-filter" name="capability" type="text" value="' . $capability . '"/>' .
|
306 |
-
'</
|
307 |
-
'<p>' .
|
308 |
wp_nonce_field( 'admin', GROUPS_ADMIN_CAPABILITIES_FILTER_NONCE, true, false ) .
|
309 |
-
'<input class="button" type="submit" value="' . __( 'Apply', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
310 |
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
311 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
312 |
-
'</
|
313 |
'</form>' .
|
314 |
'</div>';
|
315 |
|
316 |
if ( $paginate ) {
|
317 |
-
|
318 |
$pagination = new Groups_Pagination( $count, null, $row_count );
|
319 |
$output .= '<form id="posts-filter" method="post" action="">';
|
320 |
$output .= '<div>';
|
@@ -343,10 +368,10 @@ function groups_admin_capabilities() {
|
|
343 |
$output .= '<div class="capabilities-bulk-container">';
|
344 |
$output .= '<div class="alignleft actions">';
|
345 |
$output .= '<select name="bulk-action">';
|
346 |
-
$output .= '<option selected="selected" value="-1">' . __(
|
347 |
-
$output .= '<option value="remove">' . __(
|
348 |
$output .= '</select>';
|
349 |
-
$output .= '<input class="button" type="submit" name="bulk" value="' . __( "Apply", GROUPS_PLUGIN_DOMAIN ) . '"/>';
|
350 |
$output .= '</div>';
|
351 |
$output .= '</div>';
|
352 |
$output .= '</div>';
|
@@ -372,47 +397,91 @@ function groups_admin_capabilities() {
|
|
372 |
} else {
|
373 |
$class = "$key manage-column sortable";
|
374 |
}
|
375 |
-
$column_display_name =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
-
$output .=
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
|
380 |
-
$output .= '</tr>
|
381 |
-
|
382 |
-
|
383 |
-
';
|
384 |
|
385 |
if ( count( $results ) > 0 ) {
|
386 |
for ( $i = 0; $i < count( $results ); $i++ ) {
|
387 |
-
|
388 |
$result = $results[$i];
|
389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
$output .= '<tr class="' . ( $i % 2 == 0 ? 'even' : 'odd' ) . '">';
|
391 |
|
392 |
$output .= '<th class="check-column">';
|
393 |
$output .= '<input type="checkbox" value="' . esc_attr( $result->capability_id ) . '" name="capability_ids[]"/>';
|
394 |
$output .= '</th>';
|
395 |
|
396 |
-
$output .=
|
397 |
$output .= $result->capability_id;
|
398 |
-
$output .=
|
399 |
-
$output .=
|
400 |
-
$output .=
|
401 |
-
|
402 |
-
$output .=
|
403 |
-
$output .=
|
404 |
-
$output .=
|
405 |
-
|
406 |
-
$output .= "<td class='remove'>";
|
407 |
-
if ( $result->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) {
|
408 |
-
$output .= "<a href='" . esc_url( $current_url ) . "&action=remove&capability_id=" . $result->capability_id . "' alt='" . __( 'Remove', GROUPS_PLUGIN_DOMAIN) . "'><img src='". GROUPS_PLUGIN_URL ."images/remove.png'/></a>";
|
409 |
-
}
|
410 |
-
$output .= "</td>";
|
411 |
|
412 |
$output .= '</tr>';
|
413 |
}
|
414 |
} else {
|
415 |
-
$output .= '<tr><td colspan="
|
416 |
}
|
417 |
|
418 |
$output .= '</tbody>';
|
@@ -434,5 +503,4 @@ function groups_admin_capabilities() {
|
|
434 |
$output .= '</div>'; // .manage-capabilities
|
435 |
|
436 |
echo $output;
|
437 |
-
Groups_Help::footer();
|
438 |
} // function groups_admin_capabilities()
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-capabilities.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
118 |
if ( check_admin_referer( 'refresh' ) ) {
|
119 |
$n = Groups_WordPress::refresh_capabilities();
|
120 |
if ( $n > 0 ) {
|
121 |
+
$output .= '<div class="updated fade"><p>' . sprintf( _n( 'One capability has been added.', '%d capabilities have been added.', $n, GROUPS_PLUGIN_DOMAIN ), $n ) . '</p></div>';
|
122 |
} else {
|
123 |
+
$output .= '<div class="updated fade"><p>' . __( 'No new capabilities have been found.', GROUPS_PLUGIN_DOMAIN ) . '</p></div>';
|
124 |
}
|
125 |
} else {
|
126 |
wp_die( __( 'A Duck!', GROUPS_PLUGIN_DOMAIN ) );
|
187 |
$capability_table = _groups_get_tablename( 'capability' );
|
188 |
|
189 |
$output .=
|
190 |
+
'<div class="manage-capabilities wrap">' .
|
|
|
191 |
'<h1>' .
|
192 |
__( 'Capabilities', GROUPS_PLUGIN_DOMAIN ) .
|
193 |
+
// add capability
|
194 |
+
sprintf(
|
195 |
+
'<a title="%s" class="add page-title-action" href="%s">',
|
196 |
+
esc_attr( __( 'Click to add a new capability', GROUPS_PLUGIN_DOMAIN ) ),
|
197 |
+
esc_url( $current_url . '&action=add' )
|
198 |
+
) .
|
199 |
+
sprintf(
|
200 |
+
'<img class="icon" alt="%s" src="%s" />',
|
201 |
+
esc_attr( __( 'Add', GROUPS_PLUGIN_DOMAIN ) ),
|
202 |
+
esc_url( GROUPS_PLUGIN_URL . 'images/add.png' )
|
203 |
+
) .
|
204 |
+
sprintf(
|
205 |
+
'<span class="label">%s</span>',
|
206 |
+
stripslashes( wp_filter_nohtml_kses( __( 'New Capability', GROUPS_PLUGIN_DOMAIN ) ) )
|
207 |
+
) .
|
208 |
+
'</a>' .
|
209 |
+
// refresh capabilities
|
210 |
+
sprintf(
|
211 |
+
'<a title="%s" class="refresh page-title-action" href="%s">',
|
212 |
+
esc_attr( __( 'Click to refresh capabilities', GROUPS_PLUGIN_DOMAIN ) ),
|
213 |
+
esc_url( wp_nonce_url( $current_url . '&action=refresh', 'refresh' ) )
|
214 |
+
) .
|
215 |
+
sprintf(
|
216 |
+
'<img class="icon" alt="%s" src="%s" />',
|
217 |
+
esc_attr( __( 'Refresh', GROUPS_PLUGIN_DOMAIN ) ),
|
218 |
+
esc_url( GROUPS_PLUGIN_URL . 'images/refresh.png' )
|
219 |
+
) .
|
220 |
+
sprintf(
|
221 |
+
'<span class="label">%s</span>',
|
222 |
+
stripslashes( wp_filter_nohtml_kses( __( 'Refresh', GROUPS_PLUGIN_DOMAIN ) ) )
|
223 |
+
) .
|
224 |
+
'</a>' .
|
225 |
+
'</h1>';
|
226 |
+
|
227 |
$output .= Groups_Admin::render_messages();
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
$row_count = isset( $_POST['row_count'] ) ? intval( $_POST['row_count'] ) : 0;
|
230 |
|
246 |
switch ( $orderby ) {
|
247 |
case 'capability_id' :
|
248 |
case 'capability' :
|
249 |
+
case 'description' :
|
250 |
break;
|
251 |
default:
|
252 |
$orderby = 'name';
|
310 |
$results = $wpdb->get_results( $query, OBJECT );
|
311 |
|
312 |
$column_display_names = array(
|
313 |
+
'capability_id' => __( 'ID', GROUPS_PLUGIN_DOMAIN ),
|
314 |
'capability' => __( 'Capability', GROUPS_PLUGIN_DOMAIN ),
|
315 |
+
'description' => __( 'Description', GROUPS_PLUGIN_DOMAIN )
|
|
|
|
|
316 |
);
|
317 |
|
318 |
$output .= '<div class="capabilities-overview">';
|
319 |
|
320 |
$output .=
|
321 |
'<div class="filters">' .
|
|
|
322 |
'<form id="setfilters" action="" method="post">' .
|
323 |
+
'<fieldset>' .
|
324 |
+
'<legend>' . __( 'Filters', GROUPS_PLUGIN_DOMAIN ) . '</legend>' .
|
325 |
+
'<label class="capability-id-filter">' .
|
326 |
+
__( 'Capability ID', GROUPS_PLUGIN_DOMAIN ) . ' ' .
|
327 |
'<input class="capability-id-filter" name="capability_id" type="text" value="' . esc_attr( $capability_id ) . '"/>' .
|
328 |
+
'</label>' . ' ' .
|
329 |
+
'<label class="capability-filter">' .
|
330 |
+
__( 'Capability', GROUPS_PLUGIN_DOMAIN ) . ' ' .
|
331 |
'<input class="capability-filter" name="capability" type="text" value="' . $capability . '"/>' .
|
332 |
+
'</label>' . ' ' .
|
|
|
333 |
wp_nonce_field( 'admin', GROUPS_ADMIN_CAPABILITIES_FILTER_NONCE, true, false ) .
|
334 |
+
'<input class="button" type="submit" value="' . __( 'Apply', GROUPS_PLUGIN_DOMAIN ) . '"/>' . ' ' .
|
335 |
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
336 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
337 |
+
'</fieldset>' .
|
338 |
'</form>' .
|
339 |
'</div>';
|
340 |
|
341 |
if ( $paginate ) {
|
342 |
+
require_once( GROUPS_CORE_LIB . '/class-groups-pagination.php' );
|
343 |
$pagination = new Groups_Pagination( $count, null, $row_count );
|
344 |
$output .= '<form id="posts-filter" method="post" action="">';
|
345 |
$output .= '<div>';
|
368 |
$output .= '<div class="capabilities-bulk-container">';
|
369 |
$output .= '<div class="alignleft actions">';
|
370 |
$output .= '<select name="bulk-action">';
|
371 |
+
$output .= '<option selected="selected" value="-1">' . esc_html( __( 'Bulk Actions', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
372 |
+
$output .= '<option value="remove">' . esc_html( __( 'Remove', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
373 |
$output .= '</select>';
|
374 |
+
$output .= '<input class="button" type="submit" name="bulk" value="' . esc_attr( __( "Apply", GROUPS_PLUGIN_DOMAIN ) ) . '"/>';
|
375 |
$output .= '</div>';
|
376 |
$output .= '</div>';
|
377 |
$output .= '</div>';
|
397 |
} else {
|
398 |
$class = "$key manage-column sortable";
|
399 |
}
|
400 |
+
$column_display_name =
|
401 |
+
sprintf(
|
402 |
+
'<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
|
403 |
+
esc_url( add_query_arg( $options, $current_url ) ),
|
404 |
+
esc_html( $column_display_name )
|
405 |
+
);
|
406 |
+
} else {
|
407 |
+
$column_display_name = esc_html( $column_display_name );
|
408 |
}
|
409 |
+
$output .= sprintf(
|
410 |
+
'<th scope="col" class="%s">%s</th>',
|
411 |
+
esc_attr( $class ),
|
412 |
+
$column_display_name
|
413 |
+
);
|
414 |
}
|
415 |
|
416 |
+
$output .= '</tr>';
|
417 |
+
$output .= '</thead>';
|
418 |
+
$output .= '<tbody>';
|
|
|
419 |
|
420 |
if ( count( $results ) > 0 ) {
|
421 |
for ( $i = 0; $i < count( $results ); $i++ ) {
|
|
|
422 |
$result = $results[$i];
|
423 |
|
424 |
+
// Construct the "edit" URL.
|
425 |
+
$edit_url = add_query_arg(
|
426 |
+
array(
|
427 |
+
'capability_id' => intval( $result->capability_id ),
|
428 |
+
'action' => 'edit',
|
429 |
+
'paged' => $paged
|
430 |
+
),
|
431 |
+
$current_url
|
432 |
+
);
|
433 |
+
// Construct the "delete" URL.
|
434 |
+
$delete_url = add_query_arg(
|
435 |
+
array(
|
436 |
+
'capability_id' => intval( $result->capability_id ),
|
437 |
+
'action' => 'remove',
|
438 |
+
'paged' => $paged
|
439 |
+
),
|
440 |
+
$current_url
|
441 |
+
);
|
442 |
+
|
443 |
+
// Construct row actions for this group.
|
444 |
+
$row_actions =
|
445 |
+
'<div class="row-actions">' .
|
446 |
+
'<span class="edit">' .
|
447 |
+
'<a href="' . esc_url( $edit_url ) . '">' .
|
448 |
+
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
449 |
+
__( 'Edit', GROUPS_PLUGIN_DOMAIN ) .
|
450 |
+
'</a>';
|
451 |
+
if ( $result->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) {
|
452 |
+
$row_actions .=
|
453 |
+
' | '.
|
454 |
+
'</span>' .
|
455 |
+
'<span class="remove trash">' .
|
456 |
+
'<a href="' . esc_url( $delete_url ) . '" class="submitdelete">' .
|
457 |
+
'<img src="' . GROUPS_PLUGIN_URL . 'images/remove.png"/>' .
|
458 |
+
__( 'Remove', GROUPS_PLUGIN_DOMAIN ) .
|
459 |
+
'</a>' .
|
460 |
+
'</span>';
|
461 |
+
}
|
462 |
+
$row_actions .= '</div>'; // .row-actions
|
463 |
+
|
464 |
$output .= '<tr class="' . ( $i % 2 == 0 ? 'even' : 'odd' ) . '">';
|
465 |
|
466 |
$output .= '<th class="check-column">';
|
467 |
$output .= '<input type="checkbox" value="' . esc_attr( $result->capability_id ) . '" name="capability_ids[]"/>';
|
468 |
$output .= '</th>';
|
469 |
|
470 |
+
$output .= '<td class="capability-id">';
|
471 |
$output .= $result->capability_id;
|
472 |
+
$output .= '</td>';
|
473 |
+
$output .= '<td class="capability">';
|
474 |
+
$output .= sprintf( '<a href="%s">%s</a>', esc_url( $edit_url ), stripslashes( wp_filter_nohtml_kses( $result->capability ) ) );
|
475 |
+
$output .= $row_actions;
|
476 |
+
$output .= '</td>';
|
477 |
+
$output .= '<td class="description">';
|
478 |
+
$output .= stripslashes( wp_filter_nohtml_kses( $result->description ) );
|
479 |
+
$output .= '</td>';
|
|
|
|
|
|
|
|
|
|
|
480 |
|
481 |
$output .= '</tr>';
|
482 |
}
|
483 |
} else {
|
484 |
+
$output .= '<tr><td colspan="3">' . __( 'There are no results.', GROUPS_PLUGIN_DOMAIN ) . '</td></tr>';
|
485 |
}
|
486 |
|
487 |
$output .= '</tbody>';
|
503 |
$output .= '</div>'; // .manage-capabilities
|
504 |
|
505 |
echo $output;
|
|
|
506 |
} // function groups_admin_capabilities()
|
lib/admin/groups-admin-groups-add.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-add.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
@@ -54,12 +54,10 @@ function groups_admin_groups_add() {
|
|
54 |
}
|
55 |
$parent_select .= '</select>';
|
56 |
|
57 |
-
$output .= '<div class="manage-groups">';
|
58 |
-
$output .= '<div>';
|
59 |
$output .= '<h1>';
|
60 |
$output .= __( 'Add a new group', GROUPS_PLUGIN_DOMAIN );
|
61 |
$output .= '</h1>';
|
62 |
-
$output .= '</div>';
|
63 |
|
64 |
$output .= Groups_Admin::render_messages();
|
65 |
|
@@ -125,8 +123,6 @@ function groups_admin_groups_add() {
|
|
125 |
$output .= '</div>'; // .manage-groups
|
126 |
|
127 |
echo $output;
|
128 |
-
|
129 |
-
Groups_Help::footer();
|
130 |
} // function groups_admin_groups_add
|
131 |
|
132 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-add.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
54 |
}
|
55 |
$parent_select .= '</select>';
|
56 |
|
57 |
+
$output .= '<div class="manage-groups wrap">';
|
|
|
58 |
$output .= '<h1>';
|
59 |
$output .= __( 'Add a new group', GROUPS_PLUGIN_DOMAIN );
|
60 |
$output .= '</h1>';
|
|
|
61 |
|
62 |
$output .= Groups_Admin::render_messages();
|
63 |
|
123 |
$output .= '</div>'; // .manage-groups
|
124 |
|
125 |
echo $output;
|
|
|
|
|
126 |
} // function groups_admin_groups_add
|
127 |
|
128 |
/**
|
lib/admin/groups-admin-groups-edit.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-edit.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
@@ -63,12 +63,10 @@ function groups_admin_groups_edit( $group_id ) {
|
|
63 |
|
64 |
$name_readonly = ( $name !== Groups_Registered::REGISTERED_GROUP_NAME ) ? "" : ' readonly="readonly" ';
|
65 |
|
66 |
-
$output .= '<div class="manage-groups">';
|
67 |
-
$output .= '<div>';
|
68 |
$output .= '<h1>';
|
69 |
$output .= __( 'Edit a group', GROUPS_PLUGIN_DOMAIN );
|
70 |
$output .= '</h1>';
|
71 |
-
$output .= '</div>';
|
72 |
|
73 |
$output .= Groups_Admin::render_messages();
|
74 |
|
@@ -164,8 +162,6 @@ function groups_admin_groups_edit( $group_id ) {
|
|
164 |
$output .= '</div>'; // .manage-groups
|
165 |
|
166 |
echo $output;
|
167 |
-
|
168 |
-
Groups_Help::footer();
|
169 |
} // function groups_admin_groups_edit
|
170 |
|
171 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-edit.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
63 |
|
64 |
$name_readonly = ( $name !== Groups_Registered::REGISTERED_GROUP_NAME ) ? "" : ' readonly="readonly" ';
|
65 |
|
66 |
+
$output .= '<div class="manage-groups wrap">';
|
|
|
67 |
$output .= '<h1>';
|
68 |
$output .= __( 'Edit a group', GROUPS_PLUGIN_DOMAIN );
|
69 |
$output .= '</h1>';
|
|
|
70 |
|
71 |
$output .= Groups_Admin::render_messages();
|
72 |
|
162 |
$output .= '</div>'; // .manage-groups
|
163 |
|
164 |
echo $output;
|
|
|
|
|
165 |
} // function groups_admin_groups_edit
|
166 |
|
167 |
/**
|
lib/admin/groups-admin-groups-remove.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-remove.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
@@ -28,32 +28,30 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
* @param int $group_id group id
|
29 |
*/
|
30 |
function groups_admin_groups_remove( $group_id ) {
|
31 |
-
|
32 |
global $wpdb;
|
33 |
-
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
36 |
}
|
37 |
-
|
38 |
$group = Groups_Group::read( intval( $group_id ) );
|
39 |
-
|
40 |
if ( empty( $group ) ) {
|
41 |
wp_die( __( 'No such group.', GROUPS_PLUGIN_DOMAIN ) );
|
42 |
}
|
43 |
-
|
44 |
$group_table = _groups_get_tablename( 'group' );
|
45 |
|
46 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
47 |
$current_url = remove_query_arg( 'action', $current_url );
|
48 |
$current_url = remove_query_arg( 'group_id', $current_url );
|
49 |
-
|
50 |
$output =
|
51 |
-
'<div class="manage-groups">' .
|
52 |
-
'<div>' .
|
53 |
'<h1>' .
|
54 |
__( 'Remove a group', GROUPS_PLUGIN_DOMAIN ) .
|
55 |
'</h1>' .
|
56 |
-
'</div>' .
|
57 |
'<form id="remove-group" action="' . esc_url( $current_url ) . '" method="post">' .
|
58 |
'<div class="group remove">' .
|
59 |
'<input id="group-id-field" name="group-id-field" type="hidden" value="' . esc_attr( intval( $group->group_id ) ) . '"/>' .
|
@@ -68,29 +66,27 @@ function groups_admin_groups_remove( $group_id ) {
|
|
68 |
'</div>' . // .group.remove
|
69 |
'</form>' .
|
70 |
'</div>'; // .manage-groups
|
71 |
-
|
72 |
echo $output;
|
73 |
-
|
74 |
-
Groups_Help::footer();
|
75 |
} // function groups_admin_groups_remove
|
76 |
|
77 |
/**
|
78 |
* Handle remove form submission.
|
79 |
*/
|
80 |
function groups_admin_groups_remove_submit() {
|
81 |
-
|
82 |
global $wpdb;
|
83 |
-
|
84 |
$result = false;
|
85 |
-
|
86 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
87 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
88 |
}
|
89 |
-
|
90 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-remove' ) ) {
|
91 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
92 |
}
|
93 |
-
|
94 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
95 |
$group = Groups_Group::read( $group_id );
|
96 |
if ( $group ) {
|
@@ -134,12 +130,10 @@ function groups_admin_groups_bulk_remove() {
|
|
134 |
$current_url = remove_query_arg( 'action', $current_url );
|
135 |
$current_url = remove_query_arg( 'group_id', $current_url );
|
136 |
|
137 |
-
$output .= '<div class="manage-groups">';
|
138 |
-
$output .= '<div>';
|
139 |
$output .= '<h1>';
|
140 |
$output .= __( 'Remove groups', GROUPS_PLUGIN_DOMAIN );
|
141 |
$output .= '</h1>';
|
142 |
-
$output .= '</div>';
|
143 |
|
144 |
$output .= '<form id="groups-action" method="post" action="">';
|
145 |
$output .= '<div class="group remove">';
|
@@ -169,8 +163,6 @@ function groups_admin_groups_bulk_remove() {
|
|
169 |
$output .= '</div>';
|
170 |
|
171 |
echo $output;
|
172 |
-
|
173 |
-
Groups_Help::footer();
|
174 |
} // function groups_admin_groups_bulk_remove
|
175 |
|
176 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups-remove.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.1.0
|
28 |
* @param int $group_id group id
|
29 |
*/
|
30 |
function groups_admin_groups_remove( $group_id ) {
|
31 |
+
|
32 |
global $wpdb;
|
33 |
+
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
36 |
}
|
37 |
+
|
38 |
$group = Groups_Group::read( intval( $group_id ) );
|
39 |
+
|
40 |
if ( empty( $group ) ) {
|
41 |
wp_die( __( 'No such group.', GROUPS_PLUGIN_DOMAIN ) );
|
42 |
}
|
43 |
+
|
44 |
$group_table = _groups_get_tablename( 'group' );
|
45 |
|
46 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
47 |
$current_url = remove_query_arg( 'action', $current_url );
|
48 |
$current_url = remove_query_arg( 'group_id', $current_url );
|
49 |
+
|
50 |
$output =
|
51 |
+
'<div class="manage-groups wrap">' .
|
|
|
52 |
'<h1>' .
|
53 |
__( 'Remove a group', GROUPS_PLUGIN_DOMAIN ) .
|
54 |
'</h1>' .
|
|
|
55 |
'<form id="remove-group" action="' . esc_url( $current_url ) . '" method="post">' .
|
56 |
'<div class="group remove">' .
|
57 |
'<input id="group-id-field" name="group-id-field" type="hidden" value="' . esc_attr( intval( $group->group_id ) ) . '"/>' .
|
66 |
'</div>' . // .group.remove
|
67 |
'</form>' .
|
68 |
'</div>'; // .manage-groups
|
69 |
+
|
70 |
echo $output;
|
|
|
|
|
71 |
} // function groups_admin_groups_remove
|
72 |
|
73 |
/**
|
74 |
* Handle remove form submission.
|
75 |
*/
|
76 |
function groups_admin_groups_remove_submit() {
|
77 |
+
|
78 |
global $wpdb;
|
79 |
+
|
80 |
$result = false;
|
81 |
+
|
82 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
83 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
84 |
}
|
85 |
+
|
86 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-remove' ) ) {
|
87 |
wp_die( __( 'Access denied.', GROUPS_PLUGIN_DOMAIN ) );
|
88 |
}
|
89 |
+
|
90 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
91 |
$group = Groups_Group::read( $group_id );
|
92 |
if ( $group ) {
|
130 |
$current_url = remove_query_arg( 'action', $current_url );
|
131 |
$current_url = remove_query_arg( 'group_id', $current_url );
|
132 |
|
133 |
+
$output .= '<div class="manage-groups wrap">';
|
|
|
134 |
$output .= '<h1>';
|
135 |
$output .= __( 'Remove groups', GROUPS_PLUGIN_DOMAIN );
|
136 |
$output .= '</h1>';
|
|
|
137 |
|
138 |
$output .= '<form id="groups-action" method="post" action="">';
|
139 |
$output .= '<div class="group remove">';
|
163 |
$output .= '</div>';
|
164 |
|
165 |
echo $output;
|
|
|
|
|
166 |
} // function groups_admin_groups_bulk_remove
|
167 |
|
168 |
/**
|
lib/admin/groups-admin-groups.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -194,20 +194,28 @@ function groups_admin_groups() {
|
|
194 |
$group_table = _groups_get_tablename( 'group' );
|
195 |
|
196 |
$output .=
|
197 |
-
'<div class="manage-groups">' .
|
198 |
-
'<div>' .
|
199 |
'<h1>' .
|
200 |
_x( 'Groups', 'page-title', GROUPS_PLUGIN_DOMAIN ) .
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
$output .= Groups_Admin::render_messages();
|
205 |
|
206 |
-
$output .=
|
207 |
-
'<div class="manage">' .
|
208 |
-
"<a title='" . __( 'Click to add a new group', GROUPS_PLUGIN_DOMAIN ) . "' class='add button' href='" . esc_url( $current_url ) . "&action=add'><img class='icon' alt='" . __( 'Add', GROUPS_PLUGIN_DOMAIN) . "' src='". GROUPS_PLUGIN_URL ."images/add.png'/><span class='label'>" . __( 'New Group', GROUPS_PLUGIN_DOMAIN) . "</span></a>" .
|
209 |
-
'</div>';
|
210 |
-
|
211 |
$row_count = isset( $_POST['row_count'] ) ? intval( $_POST['row_count'] ) : 0;
|
212 |
|
213 |
if ($row_count <= 0) {
|
@@ -222,12 +230,13 @@ function groups_admin_groups() {
|
|
222 |
$paged = isset( $_REQUEST['paged'] ) ? intval( $_REQUEST['paged'] ) : 0;
|
223 |
if ( $paged < 0 ) {
|
224 |
$paged = 0;
|
225 |
-
}
|
226 |
|
227 |
$orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : null;
|
228 |
switch ( $orderby ) {
|
229 |
case 'group_id' :
|
230 |
case 'name' :
|
|
|
231 |
break;
|
232 |
default:
|
233 |
$orderby = 'name';
|
@@ -291,37 +300,35 @@ function groups_admin_groups() {
|
|
291 |
$results = $wpdb->get_results( $query, OBJECT );
|
292 |
|
293 |
$column_display_names = array(
|
294 |
-
'group_id'
|
295 |
-
'name'
|
296 |
'description' => __( 'Description', GROUPS_PLUGIN_DOMAIN ),
|
297 |
-
'capabilities' => __( 'Capabilities', GROUPS_PLUGIN_DOMAIN )
|
298 |
-
'edit' => __( 'Edit', GROUPS_PLUGIN_DOMAIN ),
|
299 |
-
'remove' => __( 'Remove', GROUPS_PLUGIN_DOMAIN )
|
300 |
);
|
301 |
|
302 |
$output .= '<div class="groups-overview">';
|
303 |
|
304 |
$output .=
|
305 |
'<div class="filters">' .
|
306 |
-
'<label class="description" for="setfilters">' . __( 'Filters', GROUPS_PLUGIN_DOMAIN ) . '</label>' .
|
307 |
'<form id="setfilters" action="" method="post">' .
|
308 |
-
'<
|
309 |
-
'<
|
|
|
310 |
'<input class="group-id-filter" name="group_id" type="text" value="' . esc_attr( $group_id ) . '"/>' .
|
311 |
-
'
|
|
|
312 |
'<input class="group-name-filter" name="group_name" type="text" value="' . $group_name . '"/>' .
|
313 |
-
'</
|
314 |
-
'<p>' .
|
315 |
wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_FILTER_NONCE, true, false ) .
|
316 |
-
'<input class="button" type="submit" value="' . __( 'Apply', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
317 |
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
318 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
319 |
-
'</
|
320 |
'</form>' .
|
321 |
'</div>';
|
322 |
|
323 |
if ( $paginate ) {
|
324 |
-
|
325 |
$pagination = new Groups_Pagination( $count, null, $row_count );
|
326 |
$output .= '<form id="posts-filter" method="post" action="">';
|
327 |
$output .= '<div>';
|
@@ -370,12 +377,12 @@ function groups_admin_groups() {
|
|
370 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_ACTION_NONCE, true, false );
|
371 |
$output .= '</div>';
|
372 |
$output .= '<select class="bulk-action" name="bulk-action">';
|
373 |
-
$output .= '<option selected="selected" value="-1">' . __( 'Bulk Actions', GROUPS_PLUGIN_DOMAIN ) . '</option>';
|
374 |
-
$output .= '<option value="remove-group">' . __( 'Remove group', GROUPS_PLUGIN_DOMAIN ) . '</option>';
|
375 |
-
$output .= '<option value="add-capability">' . __( 'Add capability', GROUPS_PLUGIN_DOMAIN ) . '</option>';
|
376 |
-
$output .= '<option value="remove-capability">' . __( 'Remove capability', GROUPS_PLUGIN_DOMAIN ) . '</option>';
|
377 |
$output .= '</select>';
|
378 |
-
$output .= sprintf( '<input class="button" type="submit" name="bulk" value="%s" />', __( 'Apply', GROUPS_PLUGIN_DOMAIN ) );
|
379 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
380 |
$output .= '</div>';
|
381 |
$output .= '</div>';
|
@@ -389,19 +396,30 @@ function groups_admin_groups() {
|
|
389 |
foreach ( $column_display_names as $key => $column_display_name ) {
|
390 |
$options = array(
|
391 |
'orderby' => $key,
|
392 |
-
'order'
|
393 |
);
|
394 |
$class = $key;
|
395 |
-
if ( !in_array($key, array( 'capabilities'
|
396 |
if ( strcmp( $key, $orderby ) == 0 ) {
|
397 |
$lorder = strtolower( $order );
|
398 |
$class = "$key manage-column sorted $lorder";
|
399 |
} else {
|
400 |
$class = "$key manage-column sortable";
|
401 |
}
|
402 |
-
$column_display_name =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
}
|
404 |
-
$output .=
|
|
|
|
|
|
|
|
|
405 |
}
|
406 |
|
407 |
$output .= '</tr>';
|
@@ -413,17 +431,63 @@ function groups_admin_groups() {
|
|
413 |
|
414 |
$result = $results[$i];
|
415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
$output .= '<tr class="' . ( $i % 2 == 0 ? 'even' : 'odd' ) . '">';
|
417 |
|
418 |
$output .= '<th class="check-column">';
|
419 |
$output .= '<input type="checkbox" value="' . esc_attr( $result->group_id ) . '" name="group_ids[]"/>';
|
420 |
$output .= '</th>';
|
421 |
|
422 |
-
$output .=
|
423 |
$output .= $result->group_id;
|
424 |
-
$output .=
|
425 |
-
$output .=
|
426 |
-
$output .=
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
$output .= '<td class="capabilities">';
|
429 |
|
@@ -453,20 +517,10 @@ function groups_admin_groups() {
|
|
453 |
}
|
454 |
$output .= '</td>';
|
455 |
|
456 |
-
$output .= "<td class='edit'>";
|
457 |
-
$output .= "<a href='" . esc_url( add_query_arg( 'paged', $paged, $current_url ) ) . "&action=edit&group_id=" . $result->group_id . "' alt='" . __( 'Edit', GROUPS_PLUGIN_DOMAIN) . "'><img src='". GROUPS_PLUGIN_URL ."images/edit.png'/></a>";
|
458 |
-
$output .= "</td>";
|
459 |
-
|
460 |
-
$output .= "<td class='remove'>";
|
461 |
-
if ( $result->name !== Groups_Registered::REGISTERED_GROUP_NAME ) {
|
462 |
-
$output .= "<a href='" . esc_url( $current_url ) . "&action=remove&group_id=" . $result->group_id . "' alt='" . __( 'Remove', GROUPS_PLUGIN_DOMAIN) . "'><img src='". GROUPS_PLUGIN_URL ."images/remove.png'/></a>";
|
463 |
-
}
|
464 |
-
$output .= "</td>";
|
465 |
-
|
466 |
$output .= '</tr>';
|
467 |
}
|
468 |
} else {
|
469 |
-
$output .= '<tr><td colspan="
|
470 |
}
|
471 |
|
472 |
$output .= '</tbody>';
|
@@ -488,5 +542,4 @@ function groups_admin_groups() {
|
|
488 |
$output .= '</div>'; // .manage-groups
|
489 |
|
490 |
echo $output;
|
491 |
-
Groups_Help::footer();
|
492 |
} // function groups_admin_groups()
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-groups.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
194 |
$group_table = _groups_get_tablename( 'group' );
|
195 |
|
196 |
$output .=
|
197 |
+
'<div class="manage-groups wrap">' .
|
|
|
198 |
'<h1>' .
|
199 |
_x( 'Groups', 'page-title', GROUPS_PLUGIN_DOMAIN ) .
|
200 |
+
sprintf(
|
201 |
+
'<a title="%s" class="add page-title-action" href="%s">',
|
202 |
+
esc_attr( __( 'Click to add a new group', GROUPS_PLUGIN_DOMAIN ) ),
|
203 |
+
esc_url( $current_url . '&action=add' )
|
204 |
+
) .
|
205 |
+
sprintf(
|
206 |
+
'<img class="icon" alt="%s" src="%s" />',
|
207 |
+
esc_attr( __( 'Add', GROUPS_PLUGIN_DOMAIN ) ),
|
208 |
+
esc_url( GROUPS_PLUGIN_URL . 'images/add.png' )
|
209 |
+
) .
|
210 |
+
sprintf(
|
211 |
+
'<span class="label">%s</span>',
|
212 |
+
stripslashes( wp_filter_nohtml_kses( __( 'New Group', GROUPS_PLUGIN_DOMAIN ) ) )
|
213 |
+
) .
|
214 |
+
'</a>' .
|
215 |
+
'</h1>';
|
216 |
|
217 |
$output .= Groups_Admin::render_messages();
|
218 |
|
|
|
|
|
|
|
|
|
|
|
219 |
$row_count = isset( $_POST['row_count'] ) ? intval( $_POST['row_count'] ) : 0;
|
220 |
|
221 |
if ($row_count <= 0) {
|
230 |
$paged = isset( $_REQUEST['paged'] ) ? intval( $_REQUEST['paged'] ) : 0;
|
231 |
if ( $paged < 0 ) {
|
232 |
$paged = 0;
|
233 |
+
}
|
234 |
|
235 |
$orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : null;
|
236 |
switch ( $orderby ) {
|
237 |
case 'group_id' :
|
238 |
case 'name' :
|
239 |
+
case 'description' :
|
240 |
break;
|
241 |
default:
|
242 |
$orderby = 'name';
|
300 |
$results = $wpdb->get_results( $query, OBJECT );
|
301 |
|
302 |
$column_display_names = array(
|
303 |
+
'group_id' => __( 'ID', GROUPS_PLUGIN_DOMAIN ),
|
304 |
+
'name' => __( 'Group', GROUPS_PLUGIN_DOMAIN ),
|
305 |
'description' => __( 'Description', GROUPS_PLUGIN_DOMAIN ),
|
306 |
+
'capabilities' => __( 'Capabilities', GROUPS_PLUGIN_DOMAIN )
|
|
|
|
|
307 |
);
|
308 |
|
309 |
$output .= '<div class="groups-overview">';
|
310 |
|
311 |
$output .=
|
312 |
'<div class="filters">' .
|
|
|
313 |
'<form id="setfilters" action="" method="post">' .
|
314 |
+
'<fieldset>' .
|
315 |
+
'<legend>' . __( 'Filters', GROUPS_PLUGIN_DOMAIN ) . '</legend>' .
|
316 |
+
'<label class="group-id-filter">' . __( 'Group ID', GROUPS_PLUGIN_DOMAIN ) . ' ' .
|
317 |
'<input class="group-id-filter" name="group_id" type="text" value="' . esc_attr( $group_id ) . '"/>' .
|
318 |
+
'</label>' . ' ' .
|
319 |
+
'<label class="group-name-filter">' . __( 'Group Name', GROUPS_PLUGIN_DOMAIN ) . ' ' .
|
320 |
'<input class="group-name-filter" name="group_name" type="text" value="' . $group_name . '"/>' .
|
321 |
+
'</label>' . ' ' .
|
|
|
322 |
wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_FILTER_NONCE, true, false ) .
|
323 |
+
'<input class="button" type="submit" value="' . __( 'Apply', GROUPS_PLUGIN_DOMAIN ) . '"/>' . ' ' .
|
324 |
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', GROUPS_PLUGIN_DOMAIN ) . '"/>' .
|
325 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
326 |
+
'</fieldset>' .
|
327 |
'</form>' .
|
328 |
'</div>';
|
329 |
|
330 |
if ( $paginate ) {
|
331 |
+
require_once( GROUPS_CORE_LIB . '/class-groups-pagination.php' );
|
332 |
$pagination = new Groups_Pagination( $count, null, $row_count );
|
333 |
$output .= '<form id="posts-filter" method="post" action="">';
|
334 |
$output .= '<div>';
|
377 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_ACTION_NONCE, true, false );
|
378 |
$output .= '</div>';
|
379 |
$output .= '<select class="bulk-action" name="bulk-action">';
|
380 |
+
$output .= '<option selected="selected" value="-1">' . esc_html( __( 'Bulk Actions', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
381 |
+
$output .= '<option value="remove-group">' . esc_html( __( 'Remove group', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
382 |
+
$output .= '<option value="add-capability">' . esc_html( __( 'Add capability', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
383 |
+
$output .= '<option value="remove-capability">' . esc_html( __( 'Remove capability', GROUPS_PLUGIN_DOMAIN ) ) . '</option>';
|
384 |
$output .= '</select>';
|
385 |
+
$output .= sprintf( '<input class="button" type="submit" name="bulk" value="%s" />', esc_attr( __( 'Apply', GROUPS_PLUGIN_DOMAIN ) ) );
|
386 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
387 |
$output .= '</div>';
|
388 |
$output .= '</div>';
|
396 |
foreach ( $column_display_names as $key => $column_display_name ) {
|
397 |
$options = array(
|
398 |
'orderby' => $key,
|
399 |
+
'order' => $switch_order
|
400 |
);
|
401 |
$class = $key;
|
402 |
+
if ( !in_array( $key, array( 'capabilities' ) ) ) {
|
403 |
if ( strcmp( $key, $orderby ) == 0 ) {
|
404 |
$lorder = strtolower( $order );
|
405 |
$class = "$key manage-column sorted $lorder";
|
406 |
} else {
|
407 |
$class = "$key manage-column sortable";
|
408 |
}
|
409 |
+
$column_display_name =
|
410 |
+
sprintf(
|
411 |
+
'<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
|
412 |
+
esc_url( add_query_arg( $options, $current_url ) ),
|
413 |
+
esc_html( $column_display_name )
|
414 |
+
);
|
415 |
+
} else {
|
416 |
+
$column_display_name = esc_html( $column_display_name );
|
417 |
}
|
418 |
+
$output .= sprintf(
|
419 |
+
'<th scope="col" class="%s">%s</th>',
|
420 |
+
esc_attr( $class ),
|
421 |
+
$column_display_name
|
422 |
+
);
|
423 |
}
|
424 |
|
425 |
$output .= '</tr>';
|
431 |
|
432 |
$result = $results[$i];
|
433 |
|
434 |
+
// Construct the "edit" URL.
|
435 |
+
$edit_url = add_query_arg(
|
436 |
+
array(
|
437 |
+
'group_id' => intval( $result->group_id ),
|
438 |
+
'action' => 'edit',
|
439 |
+
'paged' => $paged
|
440 |
+
),
|
441 |
+
$current_url
|
442 |
+
);
|
443 |
+
|
444 |
+
// Construct the "delete" URL.
|
445 |
+
$delete_url = add_query_arg(
|
446 |
+
array(
|
447 |
+
'group_id' => intval( $result->group_id ),
|
448 |
+
'action' => 'remove',
|
449 |
+
'paged' => $paged
|
450 |
+
),
|
451 |
+
$current_url
|
452 |
+
);
|
453 |
+
|
454 |
+
// Construct row actions for this group.
|
455 |
+
$row_actions =
|
456 |
+
'<div class="row-actions">' .
|
457 |
+
'<span class="edit">' .
|
458 |
+
'<a href="' . esc_url( $edit_url ) . '">' .
|
459 |
+
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
460 |
+
__( 'Edit', GROUPS_PLUGIN_DOMAIN ) .
|
461 |
+
'</a>';
|
462 |
+
if ( $result->name !== Groups_Registered::REGISTERED_GROUP_NAME ) {
|
463 |
+
$row_actions .=
|
464 |
+
' | ' .
|
465 |
+
'</span>' .
|
466 |
+
'<span class="remove trash">' .
|
467 |
+
'<a href="' . esc_url( $delete_url ) . '" class="submitdelete">' .
|
468 |
+
'<img src="' . GROUPS_PLUGIN_URL . 'images/remove.png"/>' .
|
469 |
+
__( 'Remove', GROUPS_PLUGIN_DOMAIN ) .
|
470 |
+
'</a>' .
|
471 |
+
'</span>';
|
472 |
+
}
|
473 |
+
$row_actions .= '</div>'; // .row-actions
|
474 |
+
|
475 |
$output .= '<tr class="' . ( $i % 2 == 0 ? 'even' : 'odd' ) . '">';
|
476 |
|
477 |
$output .= '<th class="check-column">';
|
478 |
$output .= '<input type="checkbox" value="' . esc_attr( $result->group_id ) . '" name="group_ids[]"/>';
|
479 |
$output .= '</th>';
|
480 |
|
481 |
+
$output .= '<td class="group-id">';
|
482 |
$output .= $result->group_id;
|
483 |
+
$output .= '</td>';
|
484 |
+
$output .= '<td class="group-name">';
|
485 |
+
$output .= sprintf( '<a href="%s">%s</a>', esc_url( $edit_url ), stripslashes( wp_filter_nohtml_kses( $result->name ) ) );
|
486 |
+
$output .= $row_actions;
|
487 |
+
$output .= '</td>';
|
488 |
+
$output .= '<td class="group-description">';
|
489 |
+
$output .= stripslashes( wp_filter_nohtml_kses( $result->description ) );
|
490 |
+
$output .= '</td>';
|
491 |
|
492 |
$output .= '<td class="capabilities">';
|
493 |
|
517 |
}
|
518 |
$output .= '</td>';
|
519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
$output .= '</tr>';
|
521 |
}
|
522 |
} else {
|
523 |
+
$output .= '<tr><td colspan="4">' . __( 'There are no results.', GROUPS_PLUGIN_DOMAIN ) . '</td></tr>';
|
524 |
}
|
525 |
|
526 |
$output .= '</tbody>';
|
542 |
$output .= '</div>'; // .manage-groups
|
543 |
|
544 |
echo $output;
|
|
|
545 |
} // function groups_admin_groups()
|
lib/admin/groups-admin-options.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-options.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -126,11 +126,11 @@ function groups_admin_options() {
|
|
126 |
}
|
127 |
}
|
128 |
|
129 |
-
echo '<div class="groups-options">';
|
130 |
|
131 |
echo
|
132 |
'<h1>' .
|
133 |
-
__( 'Groups
|
134 |
'</h1>';
|
135 |
|
136 |
echo Groups_Admin::render_messages();
|
@@ -169,7 +169,7 @@ function groups_admin_options() {
|
|
169 |
} else {
|
170 |
$checked = '';
|
171 |
}
|
172 |
-
|
173 |
$caps_table .= '<td class="checkbox">';
|
174 |
$role_cap_id = $rolekey.'-'.$capkey;
|
175 |
$caps_table .= '<input type="checkbox" name="' . $role_cap_id . '" id="' . $role_cap_id . '" ' . $checked . '/>';
|
@@ -320,7 +320,6 @@ function groups_admin_options() {
|
|
320 |
'</form>';
|
321 |
|
322 |
echo '</div>'; // .groups-options
|
323 |
-
Groups_Help::footer();
|
324 |
}
|
325 |
|
326 |
function groups_network_admin_options() {
|
@@ -368,5 +367,4 @@ function groups_network_admin_options() {
|
|
368 |
'</p>' .
|
369 |
'</div>' .
|
370 |
'</form>';
|
371 |
-
Groups_Help::footer();
|
372 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-options.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
126 |
}
|
127 |
}
|
128 |
|
129 |
+
echo '<div class="groups-options wrap">';
|
130 |
|
131 |
echo
|
132 |
'<h1>' .
|
133 |
+
__( 'Groups Options', GROUPS_PLUGIN_DOMAIN ) .
|
134 |
'</h1>';
|
135 |
|
136 |
echo Groups_Admin::render_messages();
|
169 |
} else {
|
170 |
$checked = '';
|
171 |
}
|
172 |
+
|
173 |
$caps_table .= '<td class="checkbox">';
|
174 |
$role_cap_id = $rolekey.'-'.$capkey;
|
175 |
$caps_table .= '<input type="checkbox" name="' . $role_cap_id . '" id="' . $role_cap_id . '" ' . $checked . '/>';
|
320 |
'</form>';
|
321 |
|
322 |
echo '</div>'; // .groups-options
|
|
|
323 |
}
|
324 |
|
325 |
function groups_network_admin_options() {
|
367 |
'</p>' .
|
368 |
'</div>' .
|
369 |
'</form>';
|
|
|
370 |
}
|
lib/admin/groups-admin-tree-view.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-tree-view.php
|
4 |
-
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
-
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
-
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
-
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
-
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
@@ -51,5 +51,4 @@ function groups_admin_tree_view() {
|
|
51 |
$output .= '</div>'; // .groups-tree-view
|
52 |
|
53 |
echo $output;
|
54 |
-
Groups_Help::footer();
|
55 |
} // function groups_admin_tree_view()
|
1 |
<?php
|
2 |
/**
|
3 |
* groups-admin-tree-view.php
|
4 |
+
*
|
5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
|
6 |
+
*
|
7 |
* This code is released under the GNU General Public License.
|
8 |
* See COPYRIGHT.txt and LICENSE.txt.
|
9 |
+
*
|
10 |
* This code is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
+
*
|
15 |
* This header and all notices must be kept intact.
|
16 |
+
*
|
17 |
* @author Karim Rahimpur
|
18 |
* @package groups
|
19 |
* @since groups 1.0.0
|
51 |
$output .= '</div>'; // .groups-tree-view
|
52 |
|
53 |
echo $output;
|
|
|
54 |
} // function groups_admin_tree_view()
|
lib/core/class-groups-help.php
CHANGED
@@ -27,7 +27,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
27 |
* Help renderer.
|
28 |
*/
|
29 |
class Groups_Help {
|
30 |
-
|
31 |
/**
|
32 |
* Help setup.
|
33 |
*/
|
@@ -39,11 +39,13 @@ class Groups_Help {
|
|
39 |
include_once( GFA_VIEWS_LIB . '/class-gfa-help.php' );
|
40 |
}
|
41 |
}
|
|
|
|
|
42 |
}
|
43 |
-
|
44 |
/**
|
45 |
* Adds contextual help to Groups admin screens.
|
46 |
-
*
|
47 |
* @param array $pages admin pages
|
48 |
*/
|
49 |
public static function groups_admin_menu( $pages ) {
|
@@ -51,7 +53,7 @@ class Groups_Help {
|
|
51 |
add_action( 'load-' . $page, array( __CLASS__, 'contextual_help' ) );
|
52 |
}
|
53 |
}
|
54 |
-
|
55 |
/**
|
56 |
* Adds help to an admin screen.
|
57 |
*/
|
@@ -105,20 +107,44 @@ class Groups_Help {
|
|
105 |
}
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Returns or renders the footer.
|
|
|
110 |
* @param boolean $render
|
111 |
*/
|
112 |
public static function footer( $render = true ) {
|
113 |
$footer =
|
114 |
-
'<
|
115 |
__( 'Thank you for using <a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups</a> by <a href="http://www.itthinx.com" target="_blank">itthinx</a>.', GROUPS_PLUGIN_DOMAIN ) .
|
116 |
' ' .
|
117 |
sprintf(
|
118 |
__( 'Please give it a <a href="%s">★★★★★</a> rating.', GROUPS_PLUGIN_DOMAIN ),
|
119 |
esc_attr( 'http://wordpress.org/support/view/plugin-reviews/groups?filter=5#postform' )
|
120 |
) .
|
121 |
-
'</
|
122 |
$footer = apply_filters( 'groups_footer', $footer );
|
123 |
if ( $render ) {
|
124 |
echo $footer;
|
27 |
* Help renderer.
|
28 |
*/
|
29 |
class Groups_Help {
|
30 |
+
|
31 |
/**
|
32 |
* Help setup.
|
33 |
*/
|
39 |
include_once( GFA_VIEWS_LIB . '/class-gfa-help.php' );
|
40 |
}
|
41 |
}
|
42 |
+
|
43 |
+
add_filter( 'admin_footer_text', array( __CLASS__, 'admin_footer_text' ) );
|
44 |
}
|
45 |
+
|
46 |
/**
|
47 |
* Adds contextual help to Groups admin screens.
|
48 |
+
*
|
49 |
* @param array $pages admin pages
|
50 |
*/
|
51 |
public static function groups_admin_menu( $pages ) {
|
53 |
add_action( 'load-' . $page, array( __CLASS__, 'contextual_help' ) );
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
/**
|
58 |
* Adds help to an admin screen.
|
59 |
*/
|
107 |
}
|
108 |
}
|
109 |
|
110 |
+
/**
|
111 |
+
* Provides the footer text for Groups on relevant screens.
|
112 |
+
*
|
113 |
+
* @param string $footer_text
|
114 |
+
* @return mixed
|
115 |
+
*/
|
116 |
+
public static function admin_footer_text( $text ) {
|
117 |
+
if ( function_exists( 'get_current_screen' ) ) {
|
118 |
+
$current_screen = get_current_screen();
|
119 |
+
if (
|
120 |
+
isset( $current_screen->id ) &&
|
121 |
+
(
|
122 |
+
stripos( $current_screen->id, 'groups-' ) === 0 ||
|
123 |
+
stripos( $current_screen->id, 'groups_' ) === 0 ||
|
124 |
+
stripos( $current_screen->id, 'toplevel_page_groups' ) === 0
|
125 |
+
)
|
126 |
+
) {
|
127 |
+
$text = self::footer( false );
|
128 |
+
}
|
129 |
+
}
|
130 |
+
return $text;
|
131 |
+
}
|
132 |
+
|
133 |
/**
|
134 |
* Returns or renders the footer.
|
135 |
+
*
|
136 |
* @param boolean $render
|
137 |
*/
|
138 |
public static function footer( $render = true ) {
|
139 |
$footer =
|
140 |
+
'<span class="groups-footer">' .
|
141 |
__( 'Thank you for using <a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups</a> by <a href="http://www.itthinx.com" target="_blank">itthinx</a>.', GROUPS_PLUGIN_DOMAIN ) .
|
142 |
' ' .
|
143 |
sprintf(
|
144 |
__( 'Please give it a <a href="%s">★★★★★</a> rating.', GROUPS_PLUGIN_DOMAIN ),
|
145 |
esc_attr( 'http://wordpress.org/support/view/plugin-reviews/groups?filter=5#postform' )
|
146 |
) .
|
147 |
+
'</span>';
|
148 |
$footer = apply_filters( 'groups_footer', $footer );
|
149 |
if ( $render ) {
|
150 |
echo $footer;
|
lib/core/class-groups-pagination.php
CHANGED
@@ -34,7 +34,7 @@ class Groups_Pagination {
|
|
34 |
* @param int $total_pages how many pages there are, normally leave set to null
|
35 |
* @param int $per_page how many results to show on each page
|
36 |
*/
|
37 |
-
function
|
38 |
$this->set_pagination_args(
|
39 |
array(
|
40 |
'total_items' => $total_items,
|
34 |
* @param int $total_pages how many pages there are, normally leave set to null
|
35 |
* @param int $per_page how many results to show on each page
|
36 |
*/
|
37 |
+
function __construct( $total_items, $total_pages, $per_page ) {
|
38 |
$this->set_pagination_args(
|
39 |
array(
|
40 |
'total_items' => $total_items,
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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.4
|
7 |
-
Stable tag: 1.
|
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.
|
@@ -181,6 +181,16 @@ See also [Groups](http://www.itthinx.com/plugins/groups/)
|
|
181 |
|
182 |
== Changelog ==
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
= 1.9.1 =
|
185 |
* WordPress 4.4 compatible.
|
186 |
* Updated selectize.js to 0.12.1 (standalone).
|
@@ -505,5 +515,5 @@ Some installations wouldn't work correctly, showing no capabilities and making i
|
|
505 |
|
506 |
== Upgrade Notice ==
|
507 |
|
508 |
-
= 1.
|
509 |
-
This release
|
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.4.1
|
7 |
+
Stable tag: 1.10.0
|
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.
|
181 |
|
182 |
== Changelog ==
|
183 |
|
184 |
+
= 1.10.0 =
|
185 |
+
* Adjusted the Groups and Capabilities screens' UI elements.
|
186 |
+
* Reduced the filters section footprint on the Groups screen.
|
187 |
+
* Reduced the filters section footprint on the Capabilities screen.
|
188 |
+
* Fixed use of deprecated constructor in the Groups_Pagination class.
|
189 |
+
* Fixed sorting by description and the sorting indicator on the Groups screen.
|
190 |
+
* Fixed sorting by description and the sorting indicator on the Capabilities screen.
|
191 |
+
* Fixed some code formatting issues including superfluous whitespace.
|
192 |
+
* Improved the footer rendering and footprint.
|
193 |
+
|
194 |
= 1.9.1 =
|
195 |
* WordPress 4.4 compatible.
|
196 |
* Updated selectize.js to 0.12.1 (standalone).
|
515 |
|
516 |
== Upgrade Notice ==
|
517 |
|
518 |
+
= 1.10.0 =
|
519 |
+
This release brings several improvements to the user interface and some minor fixes.
|