Version Description
- Changed the access restriction model to group-based access restrictions.
- Provides an optional legacy mode that supports the previous capability-based access restrictions.
- Optimized the approach to restrict read access on posts using groups rather than access restriction capabilities.
- Added the
groups_restrict_access
capability which grants users to impose access restrictions. - Fixed the order_by and order parameters in Groups_Group::get_groups()
- Added the $create parameter in Groups_UIE::render_select()
- Removed the "Chosen" library.
- Improved and reduced the footprint on the Users admin screen, now allowing to filter by one or multiple groups.
- Added a welcome screen.
- Added the option to assign groups to new users directly when creating them from the Dashboard.
- Changed the language domain to string literal instead of constant.
- Improvements on internal coding standards (single/double quotes, EOF, formatting).
=
Download this release
Release Info
Developer | itthinx |
Plugin | Groups |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.13.1 to 2.0.0
- changelog.txt +14 -0
- css/chosen/chosen-sprite.png +0 -0
- css/chosen/chosen-sprite@2x.png +0 -0
- css/chosen/chosen.css +0 -430
- css/chosen/chosen.min.css +0 -3
- css/groups_admin.css +59 -0
- groups.php +7 -2
- images/groups-256x256.png +0 -0
- js/chosen/chosen.jquery.js +0 -1166
- js/chosen/chosen.jquery.min.js +0 -2
- languages/groups-de_DE.mo +0 -0
- languages/groups-de_DE.po +522 -110
- languages/groups-es_ES.mo +0 -0
- languages/groups-es_ES.po +515 -110
- languages/groups.pot +423 -107
- legacy/access/class-groups-access-meta-boxes-legacy.php +677 -0
- legacy/access/class-groups-post-access-legacy.php +429 -0
- legacy/admin/class-groups-admin-post-columns-legacy.php +116 -0
- legacy/admin/class-groups-admin-posts-legacy.php +343 -0
- legacy/admin/groups-admin-options-legacy.php +83 -0
- lib/access/class-groups-access-meta-boxes.php +222 -379
- lib/access/class-groups-access-shortcodes.php +10 -10
- lib/access/class-groups-post-access.php +243 -135
- lib/admin/class-groups-admin-post-columns.php +81 -21
- lib/admin/class-groups-admin-posts.php +313 -75
- lib/admin/class-groups-admin-user-profile.php +72 -5
- lib/admin/class-groups-admin-users.php +72 -34
- lib/admin/class-groups-admin-welcome.php +227 -0
- lib/admin/class-groups-admin.php +14 -14
- lib/admin/groups-admin-add-ons.php +21 -12
- lib/admin/groups-admin-capabilities-add.php +10 -10
- lib/admin/groups-admin-capabilities-edit.php +12 -12
- lib/admin/groups-admin-capabilities-remove.php +17 -17
- lib/admin/groups-admin-capabilities.php +33 -33
- lib/admin/groups-admin-groups-add.php +14 -14
- lib/admin/groups-admin-groups-edit.php +16 -16
- lib/admin/groups-admin-groups-remove.php +17 -17
- lib/admin/groups-admin-groups.php +33 -33
- lib/admin/groups-admin-options.php +61 -72
- lib/admin/groups-admin-tree-view.php +2 -2
- lib/auto/class-groups-registered.php +7 -7
- lib/core/class-groups-capability.php +12 -12
- lib/core/class-groups-controller.php +41 -2
- lib/core/class-groups-group-capability.php +3 -3
- lib/core/class-groups-group.php +29 -29
- lib/core/class-groups-help.php +9 -9
- lib/core/class-groups-pagination.php +7 -7
- lib/core/class-groups-user-capability.php +8 -8
- lib/core/class-groups-user-group.php +11 -11
- lib/core/class-groups-user.php +16 -16
- lib/core/constants.php +19 -0
- lib/core/wp-init.php +15 -1
- lib/test/groups-tests.php +2 -2
- lib/views/class-groups-shortcodes.php +16 -16
- lib/views/class-groups-uie.php +8 -14
- readme.txt +81 -66
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
- screenshot-8.png +0 -0
changelog.txt
CHANGED
@@ -1,5 +1,19 @@
|
|
1 |
== Groups changelog.txt ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 1.13.1 =
|
4 |
* Fixed an issue where the wrong post count would be produced for statuses that do not represent a valid WooCommerce order status.
|
5 |
* Added support for post counts with WooCommerce Subscriptions.
|
1 |
== Groups changelog.txt ==
|
2 |
|
3 |
+
= 2.0.0 =
|
4 |
+
* Changed the access restriction model to group-based access restrictions.
|
5 |
+
* Provides an optional legacy mode that supports the previous capability-based access restrictions.
|
6 |
+
* Optimized the approach to restrict read access on posts using groups rather than access restriction capabilities.
|
7 |
+
* Added the `groups_restrict_access` capability which grants users to impose access restrictions.
|
8 |
+
* Fixed the order_by and order parameters in Groups_Group::get_groups()
|
9 |
+
* Added the $create parameter in Groups_UIE::render_select()
|
10 |
+
* Removed the "Chosen" library.
|
11 |
+
* Improved and reduced the footprint on the Users admin screen, now allowing to filter by one or multiple groups.
|
12 |
+
* Added a welcome screen.
|
13 |
+
* Added the option to assign groups to new users directly when creating them from the Dashboard.
|
14 |
+
* Changed the language domain to string literal instead of constant.
|
15 |
+
* Improvements on internal coding standards (single/double quotes, EOF, formatting).
|
16 |
+
|
17 |
= 1.13.1 =
|
18 |
* Fixed an issue where the wrong post count would be produced for statuses that do not represent a valid WooCommerce order status.
|
19 |
* Added support for post counts with WooCommerce Subscriptions.
|
css/chosen/chosen-sprite.png
DELETED
Binary file
|
css/chosen/chosen-sprite@2x.png
DELETED
Binary file
|
css/chosen/chosen.css
DELETED
@@ -1,430 +0,0 @@
|
|
1 |
-
/* @group Base */
|
2 |
-
.chosen-container {
|
3 |
-
position: relative;
|
4 |
-
display: inline-block;
|
5 |
-
vertical-align: middle;
|
6 |
-
font-size: 13px;
|
7 |
-
zoom: 1;
|
8 |
-
*display: inline;
|
9 |
-
-webkit-user-select: none;
|
10 |
-
-moz-user-select: none;
|
11 |
-
user-select: none;
|
12 |
-
}
|
13 |
-
.chosen-container .chosen-drop {
|
14 |
-
position: absolute;
|
15 |
-
top: 100%;
|
16 |
-
left: -9999px;
|
17 |
-
z-index: 1010;
|
18 |
-
-webkit-box-sizing: border-box;
|
19 |
-
-moz-box-sizing: border-box;
|
20 |
-
box-sizing: border-box;
|
21 |
-
width: 100%;
|
22 |
-
border: 1px solid #aaa;
|
23 |
-
border-top: 0;
|
24 |
-
background: #fff;
|
25 |
-
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
26 |
-
}
|
27 |
-
.chosen-container.chosen-with-drop .chosen-drop {
|
28 |
-
left: 0;
|
29 |
-
}
|
30 |
-
.chosen-container a {
|
31 |
-
cursor: pointer;
|
32 |
-
}
|
33 |
-
|
34 |
-
/* @end */
|
35 |
-
/* @group Single Chosen */
|
36 |
-
.chosen-container-single .chosen-single {
|
37 |
-
position: relative;
|
38 |
-
display: block;
|
39 |
-
overflow: hidden;
|
40 |
-
padding: 0 0 0 8px;
|
41 |
-
height: 23px;
|
42 |
-
border: 1px solid #aaa;
|
43 |
-
border-radius: 5px;
|
44 |
-
background-color: #fff;
|
45 |
-
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
|
46 |
-
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
47 |
-
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
48 |
-
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
49 |
-
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
50 |
-
background-clip: padding-box;
|
51 |
-
box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
52 |
-
color: #444;
|
53 |
-
text-decoration: none;
|
54 |
-
white-space: nowrap;
|
55 |
-
line-height: 24px;
|
56 |
-
}
|
57 |
-
.chosen-container-single .chosen-default {
|
58 |
-
color: #999;
|
59 |
-
}
|
60 |
-
.chosen-container-single .chosen-single span {
|
61 |
-
display: block;
|
62 |
-
overflow: hidden;
|
63 |
-
margin-right: 26px;
|
64 |
-
text-overflow: ellipsis;
|
65 |
-
white-space: nowrap;
|
66 |
-
}
|
67 |
-
.chosen-container-single .chosen-single-with-deselect span {
|
68 |
-
margin-right: 38px;
|
69 |
-
}
|
70 |
-
.chosen-container-single .chosen-single abbr {
|
71 |
-
position: absolute;
|
72 |
-
top: 6px;
|
73 |
-
right: 26px;
|
74 |
-
display: block;
|
75 |
-
width: 12px;
|
76 |
-
height: 12px;
|
77 |
-
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
78 |
-
font-size: 1px;
|
79 |
-
}
|
80 |
-
.chosen-container-single .chosen-single abbr:hover {
|
81 |
-
background-position: -42px -10px;
|
82 |
-
}
|
83 |
-
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
84 |
-
background-position: -42px -10px;
|
85 |
-
}
|
86 |
-
.chosen-container-single .chosen-single div {
|
87 |
-
position: absolute;
|
88 |
-
top: 0;
|
89 |
-
right: 0;
|
90 |
-
display: block;
|
91 |
-
width: 18px;
|
92 |
-
height: 100%;
|
93 |
-
}
|
94 |
-
.chosen-container-single .chosen-single div b {
|
95 |
-
display: block;
|
96 |
-
width: 100%;
|
97 |
-
height: 100%;
|
98 |
-
background: url('chosen-sprite.png') no-repeat 0px 2px;
|
99 |
-
}
|
100 |
-
.chosen-container-single .chosen-search {
|
101 |
-
position: relative;
|
102 |
-
z-index: 1010;
|
103 |
-
margin: 0;
|
104 |
-
padding: 3px 4px;
|
105 |
-
white-space: nowrap;
|
106 |
-
}
|
107 |
-
.chosen-container-single .chosen-search input[type="text"] {
|
108 |
-
-webkit-box-sizing: border-box;
|
109 |
-
-moz-box-sizing: border-box;
|
110 |
-
box-sizing: border-box;
|
111 |
-
margin: 1px 0;
|
112 |
-
padding: 4px 20px 4px 5px;
|
113 |
-
width: 100%;
|
114 |
-
height: auto;
|
115 |
-
outline: 0;
|
116 |
-
border: 1px solid #aaa;
|
117 |
-
background: white url('chosen-sprite.png') no-repeat 100% -20px;
|
118 |
-
background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
119 |
-
background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
120 |
-
background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
121 |
-
background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
122 |
-
background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
|
123 |
-
font-size: 1em;
|
124 |
-
font-family: sans-serif;
|
125 |
-
line-height: normal;
|
126 |
-
border-radius: 0;
|
127 |
-
}
|
128 |
-
.chosen-container-single .chosen-drop {
|
129 |
-
margin-top: -1px;
|
130 |
-
border-radius: 0 0 4px 4px;
|
131 |
-
background-clip: padding-box;
|
132 |
-
}
|
133 |
-
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
134 |
-
position: absolute;
|
135 |
-
left: -9999px;
|
136 |
-
}
|
137 |
-
|
138 |
-
/* @end */
|
139 |
-
/* @group Results */
|
140 |
-
.chosen-container .chosen-results {
|
141 |
-
position: relative;
|
142 |
-
overflow-x: hidden;
|
143 |
-
overflow-y: auto;
|
144 |
-
margin: 0 4px 4px 0;
|
145 |
-
padding: 0 0 0 4px;
|
146 |
-
max-height: 240px;
|
147 |
-
-webkit-overflow-scrolling: touch;
|
148 |
-
}
|
149 |
-
.chosen-container .chosen-results li {
|
150 |
-
display: none;
|
151 |
-
margin: 0;
|
152 |
-
padding: 5px 6px;
|
153 |
-
list-style: none;
|
154 |
-
line-height: 15px;
|
155 |
-
}
|
156 |
-
.chosen-container .chosen-results li.active-result {
|
157 |
-
display: list-item;
|
158 |
-
cursor: pointer;
|
159 |
-
}
|
160 |
-
.chosen-container .chosen-results li.disabled-result {
|
161 |
-
display: list-item;
|
162 |
-
color: #ccc;
|
163 |
-
cursor: default;
|
164 |
-
}
|
165 |
-
.chosen-container .chosen-results li.highlighted {
|
166 |
-
background-color: #3875d7;
|
167 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
168 |
-
background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
169 |
-
background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
170 |
-
background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
171 |
-
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
172 |
-
color: #fff;
|
173 |
-
}
|
174 |
-
.chosen-container .chosen-results li.no-results {
|
175 |
-
display: list-item;
|
176 |
-
background: #f4f4f4;
|
177 |
-
}
|
178 |
-
.chosen-container .chosen-results li.group-result {
|
179 |
-
display: list-item;
|
180 |
-
font-weight: bold;
|
181 |
-
cursor: default;
|
182 |
-
}
|
183 |
-
.chosen-container .chosen-results li.group-option {
|
184 |
-
padding-left: 15px;
|
185 |
-
}
|
186 |
-
.chosen-container .chosen-results li em {
|
187 |
-
font-style: normal;
|
188 |
-
text-decoration: underline;
|
189 |
-
}
|
190 |
-
|
191 |
-
/* @end */
|
192 |
-
/* @group Multi Chosen */
|
193 |
-
.chosen-container-multi .chosen-choices {
|
194 |
-
position: relative;
|
195 |
-
overflow: hidden;
|
196 |
-
-webkit-box-sizing: border-box;
|
197 |
-
-moz-box-sizing: border-box;
|
198 |
-
box-sizing: border-box;
|
199 |
-
margin: 0;
|
200 |
-
padding: 0;
|
201 |
-
width: 100%;
|
202 |
-
height: auto !important;
|
203 |
-
height: 1%;
|
204 |
-
border: 1px solid #aaa;
|
205 |
-
background-color: #fff;
|
206 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
207 |
-
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
208 |
-
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
209 |
-
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
210 |
-
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
|
211 |
-
cursor: text;
|
212 |
-
}
|
213 |
-
.chosen-container-multi .chosen-choices li {
|
214 |
-
float: left;
|
215 |
-
list-style: none;
|
216 |
-
}
|
217 |
-
.chosen-container-multi .chosen-choices li.search-field {
|
218 |
-
margin: 0;
|
219 |
-
padding: 0;
|
220 |
-
white-space: nowrap;
|
221 |
-
}
|
222 |
-
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
223 |
-
margin: 1px 0;
|
224 |
-
padding: 5px;
|
225 |
-
height: 15px;
|
226 |
-
outline: 0;
|
227 |
-
border: 0 !important;
|
228 |
-
background: transparent !important;
|
229 |
-
box-shadow: none;
|
230 |
-
color: #666;
|
231 |
-
font-size: 100%;
|
232 |
-
font-family: sans-serif;
|
233 |
-
line-height: normal;
|
234 |
-
border-radius: 0;
|
235 |
-
}
|
236 |
-
.chosen-container-multi .chosen-choices li.search-field .default {
|
237 |
-
color: #999;
|
238 |
-
}
|
239 |
-
.chosen-container-multi .chosen-choices li.search-choice {
|
240 |
-
position: relative;
|
241 |
-
margin: 3px 0 3px 5px;
|
242 |
-
padding: 3px 20px 3px 5px;
|
243 |
-
border: 1px solid #aaa;
|
244 |
-
border-radius: 3px;
|
245 |
-
background-color: #e4e4e4;
|
246 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
247 |
-
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
248 |
-
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
249 |
-
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
250 |
-
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
251 |
-
background-clip: padding-box;
|
252 |
-
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
253 |
-
color: #333;
|
254 |
-
line-height: 13px;
|
255 |
-
cursor: default;
|
256 |
-
}
|
257 |
-
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
258 |
-
position: absolute;
|
259 |
-
top: 4px;
|
260 |
-
right: 3px;
|
261 |
-
display: block;
|
262 |
-
width: 12px;
|
263 |
-
height: 12px;
|
264 |
-
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
265 |
-
font-size: 1px;
|
266 |
-
}
|
267 |
-
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
268 |
-
background-position: -42px -10px;
|
269 |
-
}
|
270 |
-
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
271 |
-
padding-right: 5px;
|
272 |
-
border: 1px solid #ccc;
|
273 |
-
background-color: #e4e4e4;
|
274 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
275 |
-
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
276 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
277 |
-
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
278 |
-
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
279 |
-
color: #666;
|
280 |
-
}
|
281 |
-
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
282 |
-
background: #d4d4d4;
|
283 |
-
}
|
284 |
-
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
285 |
-
background-position: -42px -10px;
|
286 |
-
}
|
287 |
-
.chosen-container-multi .chosen-results {
|
288 |
-
margin: 0;
|
289 |
-
padding: 0;
|
290 |
-
}
|
291 |
-
.chosen-container-multi .chosen-drop .result-selected {
|
292 |
-
display: list-item;
|
293 |
-
color: #ccc;
|
294 |
-
cursor: default;
|
295 |
-
}
|
296 |
-
|
297 |
-
/* @end */
|
298 |
-
/* @group Active */
|
299 |
-
.chosen-container-active .chosen-single {
|
300 |
-
border: 1px solid #5897fb;
|
301 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
302 |
-
}
|
303 |
-
.chosen-container-active.chosen-with-drop .chosen-single {
|
304 |
-
border: 1px solid #aaa;
|
305 |
-
-moz-border-radius-bottomright: 0;
|
306 |
-
border-bottom-right-radius: 0;
|
307 |
-
-moz-border-radius-bottomleft: 0;
|
308 |
-
border-bottom-left-radius: 0;
|
309 |
-
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
|
310 |
-
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
311 |
-
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
312 |
-
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
313 |
-
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
|
314 |
-
box-shadow: 0 1px 0 #fff inset;
|
315 |
-
}
|
316 |
-
.chosen-container-active.chosen-with-drop .chosen-single div {
|
317 |
-
border-left: none;
|
318 |
-
background: transparent;
|
319 |
-
}
|
320 |
-
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
321 |
-
background-position: -18px 2px;
|
322 |
-
}
|
323 |
-
.chosen-container-active .chosen-choices {
|
324 |
-
border: 1px solid #5897fb;
|
325 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
326 |
-
}
|
327 |
-
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
328 |
-
color: #111 !important;
|
329 |
-
}
|
330 |
-
|
331 |
-
/* @end */
|
332 |
-
/* @group Disabled Support */
|
333 |
-
.chosen-disabled {
|
334 |
-
opacity: 0.5 !important;
|
335 |
-
cursor: default;
|
336 |
-
}
|
337 |
-
.chosen-disabled .chosen-single {
|
338 |
-
cursor: default;
|
339 |
-
}
|
340 |
-
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
341 |
-
cursor: default;
|
342 |
-
}
|
343 |
-
|
344 |
-
/* @end */
|
345 |
-
/* @group Right to Left */
|
346 |
-
.chosen-rtl {
|
347 |
-
text-align: right;
|
348 |
-
}
|
349 |
-
.chosen-rtl .chosen-single {
|
350 |
-
overflow: visible;
|
351 |
-
padding: 0 8px 0 0;
|
352 |
-
}
|
353 |
-
.chosen-rtl .chosen-single span {
|
354 |
-
margin-right: 0;
|
355 |
-
margin-left: 26px;
|
356 |
-
direction: rtl;
|
357 |
-
}
|
358 |
-
.chosen-rtl .chosen-single-with-deselect span {
|
359 |
-
margin-left: 38px;
|
360 |
-
}
|
361 |
-
.chosen-rtl .chosen-single div {
|
362 |
-
right: auto;
|
363 |
-
left: 3px;
|
364 |
-
}
|
365 |
-
.chosen-rtl .chosen-single abbr {
|
366 |
-
right: auto;
|
367 |
-
left: 26px;
|
368 |
-
}
|
369 |
-
.chosen-rtl .chosen-choices li {
|
370 |
-
float: right;
|
371 |
-
}
|
372 |
-
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
373 |
-
direction: rtl;
|
374 |
-
}
|
375 |
-
.chosen-rtl .chosen-choices li.search-choice {
|
376 |
-
margin: 3px 5px 3px 0;
|
377 |
-
padding: 3px 5px 3px 19px;
|
378 |
-
}
|
379 |
-
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
380 |
-
right: auto;
|
381 |
-
left: 4px;
|
382 |
-
}
|
383 |
-
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
384 |
-
.chosen-rtl .chosen-drop {
|
385 |
-
left: 9999px;
|
386 |
-
}
|
387 |
-
.chosen-rtl.chosen-container-single .chosen-results {
|
388 |
-
margin: 0 0 4px 4px;
|
389 |
-
padding: 0 4px 0 0;
|
390 |
-
}
|
391 |
-
.chosen-rtl .chosen-results li.group-option {
|
392 |
-
padding-right: 15px;
|
393 |
-
padding-left: 0;
|
394 |
-
}
|
395 |
-
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
396 |
-
border-right: none;
|
397 |
-
}
|
398 |
-
.chosen-rtl .chosen-search input[type="text"] {
|
399 |
-
padding: 4px 5px 4px 20px;
|
400 |
-
background: white url('chosen-sprite.png') no-repeat -30px -20px;
|
401 |
-
background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
402 |
-
background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
403 |
-
background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
404 |
-
background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
405 |
-
background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
|
406 |
-
direction: rtl;
|
407 |
-
}
|
408 |
-
.chosen-rtl.chosen-container-single .chosen-single div b {
|
409 |
-
background-position: 6px 2px;
|
410 |
-
}
|
411 |
-
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
412 |
-
background-position: -12px 2px;
|
413 |
-
}
|
414 |
-
|
415 |
-
/* @end */
|
416 |
-
/* @group Retina compatibility */
|
417 |
-
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
|
418 |
-
.chosen-rtl .chosen-search input[type="text"],
|
419 |
-
.chosen-container-single .chosen-single abbr,
|
420 |
-
.chosen-container-single .chosen-single div b,
|
421 |
-
.chosen-container-single .chosen-search input[type="text"],
|
422 |
-
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
423 |
-
.chosen-container .chosen-results-scroll-down span,
|
424 |
-
.chosen-container .chosen-results-scroll-up span {
|
425 |
-
background-image: url('chosen-sprite@2x.png') !important;
|
426 |
-
background-size: 52px 37px !important;
|
427 |
-
background-repeat: no-repeat !important;
|
428 |
-
}
|
429 |
-
}
|
430 |
-
/* @end */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/chosen/chosen.min.css
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
/* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
-
|
3 |
-
.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:23px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px,-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background:url(chosen-sprite.png) no-repeat 100% -20px,-webkit-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat 100% -20px,-moz-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat 100% -20px,-o-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat 100% -20px,linear-gradient(#eee 1%,#fff 15%);font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:5px;height:15px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#666;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-field .default{color:#999}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 0 3px 5px;padding:3px 20px 3px 5px;border:1px solid #aaa;border-radius:3px;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#111!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px,-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background:url(chosen-sprite.png) no-repeat -30px -20px,-webkit-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat -30px -20px,-moz-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat -30px -20px,-o-linear-gradient(#eee 1%,#fff 15%);background:url(chosen-sprite.png) no-repeat -30px -20px,linear-gradient(#eee 1%,#fff 15%);direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-resolution:144dpi){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
|
|
|
|
|
|
css/groups_admin.css
CHANGED
@@ -289,6 +289,9 @@ div.capability.edit label {
|
|
289 |
}
|
290 |
}
|
291 |
|
|
|
|
|
|
|
292 |
.groups-admin-add-ons ul {
|
293 |
list-style: none;
|
294 |
display: block;
|
@@ -328,3 +331,59 @@ div.capability.edit label {
|
|
328 |
display: block;
|
329 |
color: #333;
|
330 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
290 |
}
|
291 |
|
292 |
+
.groups-admin-add-ons {
|
293 |
+
margin: 10px 20px 0 2px;
|
294 |
+
}
|
295 |
.groups-admin-add-ons ul {
|
296 |
list-style: none;
|
297 |
display: block;
|
331 |
display: block;
|
332 |
color: #333;
|
333 |
}
|
334 |
+
|
335 |
+
.groups-welcome-panel {
|
336 |
+
position: relative;
|
337 |
+
overflow: auto;
|
338 |
+
margin: 1em;
|
339 |
+
padding: 1em;
|
340 |
+
border: 1px solid #e5e5e5;
|
341 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
|
342 |
+
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
|
343 |
+
background: #fff;
|
344 |
+
font-size: 13px;
|
345 |
+
line-height: 2.1em;
|
346 |
+
}
|
347 |
+
.groups-welcome-panel h2 {
|
348 |
+
margin: 1.62em 0 0 0;
|
349 |
+
font-size: 21px;
|
350 |
+
font-weight: 400;
|
351 |
+
line-height: 1.2;
|
352 |
+
}
|
353 |
+
.groups-welcome-panel h3 {
|
354 |
+
margin: 1.33em 0 0;
|
355 |
+
font-size: 16px;
|
356 |
+
}
|
357 |
+
.groups-welcome-panel li {
|
358 |
+
font-size: 14px;
|
359 |
+
}
|
360 |
+
.groups-welcome-panel p {
|
361 |
+
color: #72777c;
|
362 |
+
}
|
363 |
+
.groups-welcome-panel a {
|
364 |
+
text-decoration: none;
|
365 |
+
}
|
366 |
+
.groups-welcome-panel .headline {
|
367 |
+
font-size: 17px;
|
368 |
+
margin: 1em 0 1.62em 0;
|
369 |
+
}
|
370 |
+
|
371 |
+
.groups-welcome-panel-content {
|
372 |
+
margin-left: 13px;
|
373 |
+
max-width: 1500px;
|
374 |
+
}
|
375 |
+
.groups-welcome-icon {
|
376 |
+
float: right;
|
377 |
+
margin: 0 0.62em 0.62em 0.62em;
|
378 |
+
}
|
379 |
+
.groups-welcome-panel .important {
|
380 |
+
border: 1px solid #e5e5e5;
|
381 |
+
border-left: 2px solid #ffcc00;
|
382 |
+
padding: 1em;
|
383 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
|
384 |
+
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
|
385 |
+
}
|
386 |
+
.groups-welcome-panel .indent {
|
387 |
+
border: 1px solid #e5e5e5;
|
388 |
+
padding: 0 0.62em;
|
389 |
+
}
|
groups.php
CHANGED
@@ -21,16 +21,18 @@
|
|
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:
|
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', '
|
34 |
define( 'GROUPS_FILE', __FILE__ );
|
35 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
36 |
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
@@ -53,6 +55,9 @@ if ( !defined( 'GROUPS_VIEWS_LIB' ) ) {
|
|
53 |
if ( !defined( 'GROUPS_WP_LIB' ) ) {
|
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 |
}
|
21 |
* Plugin Name: Groups
|
22 |
* Plugin URI: http://www.itthinx.com/plugins/groups
|
23 |
* Description: Groups provides group-based user membership management, group-based capabilities and content access control.
|
24 |
+
* Version: 2.0.0
|
25 |
* Author: itthinx
|
26 |
* Author URI: http://www.itthinx.com
|
27 |
* Donate-Link: http://www.itthinx.com
|
28 |
+
* Text Domain: groups
|
29 |
+
* Domain Path: /languages
|
30 |
* License: GPLv3
|
31 |
*/
|
32 |
if ( !defined( 'ABSPATH' ) ) {
|
33 |
exit;
|
34 |
}
|
35 |
+
define( 'GROUPS_CORE_VERSION', '2.0.0' );
|
36 |
define( 'GROUPS_FILE', __FILE__ );
|
37 |
if ( !defined( 'GROUPS_CORE_DIR' ) ) {
|
38 |
define( 'GROUPS_CORE_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
55 |
if ( !defined( 'GROUPS_WP_LIB' ) ) {
|
56 |
define( 'GROUPS_WP_LIB', GROUPS_CORE_DIR . '/lib/wp' );
|
57 |
}
|
58 |
+
if ( !defined( 'GROUPS_LEGACY_LIB' ) ) {
|
59 |
+
define( 'GROUPS_LEGACY_LIB', GROUPS_CORE_DIR . '/legacy' );
|
60 |
+
}
|
61 |
if ( !defined( 'GROUPS_CORE_URL' ) ) {
|
62 |
define( 'GROUPS_CORE_URL', plugins_url( 'groups' ) );
|
63 |
}
|
images/groups-256x256.png
ADDED
Binary file
|
js/chosen/chosen.jquery.js
DELETED
@@ -1,1166 +0,0 @@
|
|
1 |
-
// Chosen, a Select Box Enhancer for jQuery and Prototype
|
2 |
-
// by Patrick Filler for Harvest, http://getharvest.com
|
3 |
-
//
|
4 |
-
// Version 1.0.0
|
5 |
-
// Full source at https://github.com/harvesthq/chosen
|
6 |
-
// Copyright (c) 2011 Harvest http://getharvest.com
|
7 |
-
|
8 |
-
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
9 |
-
// This file is generated by `grunt build`, do not edit it by hand.
|
10 |
-
(function() {
|
11 |
-
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
12 |
-
__hasProp = {}.hasOwnProperty,
|
13 |
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
14 |
-
|
15 |
-
SelectParser = (function() {
|
16 |
-
function SelectParser() {
|
17 |
-
this.options_index = 0;
|
18 |
-
this.parsed = [];
|
19 |
-
}
|
20 |
-
|
21 |
-
SelectParser.prototype.add_node = function(child) {
|
22 |
-
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
23 |
-
return this.add_group(child);
|
24 |
-
} else {
|
25 |
-
return this.add_option(child);
|
26 |
-
}
|
27 |
-
};
|
28 |
-
|
29 |
-
SelectParser.prototype.add_group = function(group) {
|
30 |
-
var group_position, option, _i, _len, _ref, _results;
|
31 |
-
|
32 |
-
group_position = this.parsed.length;
|
33 |
-
this.parsed.push({
|
34 |
-
array_index: group_position,
|
35 |
-
group: true,
|
36 |
-
label: this.escapeExpression(group.label),
|
37 |
-
children: 0,
|
38 |
-
disabled: group.disabled
|
39 |
-
});
|
40 |
-
_ref = group.childNodes;
|
41 |
-
_results = [];
|
42 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
43 |
-
option = _ref[_i];
|
44 |
-
_results.push(this.add_option(option, group_position, group.disabled));
|
45 |
-
}
|
46 |
-
return _results;
|
47 |
-
};
|
48 |
-
|
49 |
-
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
50 |
-
if (option.nodeName.toUpperCase() === "OPTION") {
|
51 |
-
if (option.text !== "") {
|
52 |
-
if (group_position != null) {
|
53 |
-
this.parsed[group_position].children += 1;
|
54 |
-
}
|
55 |
-
this.parsed.push({
|
56 |
-
array_index: this.parsed.length,
|
57 |
-
options_index: this.options_index,
|
58 |
-
value: option.value,
|
59 |
-
text: option.text,
|
60 |
-
html: option.innerHTML,
|
61 |
-
selected: option.selected,
|
62 |
-
disabled: group_disabled === true ? group_disabled : option.disabled,
|
63 |
-
group_array_index: group_position,
|
64 |
-
classes: option.className,
|
65 |
-
style: option.style.cssText
|
66 |
-
});
|
67 |
-
} else {
|
68 |
-
this.parsed.push({
|
69 |
-
array_index: this.parsed.length,
|
70 |
-
options_index: this.options_index,
|
71 |
-
empty: true
|
72 |
-
});
|
73 |
-
}
|
74 |
-
return this.options_index += 1;
|
75 |
-
}
|
76 |
-
};
|
77 |
-
|
78 |
-
SelectParser.prototype.escapeExpression = function(text) {
|
79 |
-
var map, unsafe_chars;
|
80 |
-
|
81 |
-
if ((text == null) || text === false) {
|
82 |
-
return "";
|
83 |
-
}
|
84 |
-
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
85 |
-
return text;
|
86 |
-
}
|
87 |
-
map = {
|
88 |
-
"<": "<",
|
89 |
-
">": ">",
|
90 |
-
'"': """,
|
91 |
-
"'": "'",
|
92 |
-
"`": "`"
|
93 |
-
};
|
94 |
-
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
95 |
-
return text.replace(unsafe_chars, function(chr) {
|
96 |
-
return map[chr] || "&";
|
97 |
-
});
|
98 |
-
};
|
99 |
-
|
100 |
-
return SelectParser;
|
101 |
-
|
102 |
-
})();
|
103 |
-
|
104 |
-
SelectParser.select_to_array = function(select) {
|
105 |
-
var child, parser, _i, _len, _ref;
|
106 |
-
|
107 |
-
parser = new SelectParser();
|
108 |
-
_ref = select.childNodes;
|
109 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
110 |
-
child = _ref[_i];
|
111 |
-
parser.add_node(child);
|
112 |
-
}
|
113 |
-
return parser.parsed;
|
114 |
-
};
|
115 |
-
|
116 |
-
AbstractChosen = (function() {
|
117 |
-
function AbstractChosen(form_field, options) {
|
118 |
-
this.form_field = form_field;
|
119 |
-
this.options = options != null ? options : {};
|
120 |
-
if (!AbstractChosen.browser_is_supported()) {
|
121 |
-
return;
|
122 |
-
}
|
123 |
-
this.is_multiple = this.form_field.multiple;
|
124 |
-
this.set_default_text();
|
125 |
-
this.set_default_values();
|
126 |
-
this.setup();
|
127 |
-
this.set_up_html();
|
128 |
-
this.register_observers();
|
129 |
-
}
|
130 |
-
|
131 |
-
AbstractChosen.prototype.set_default_values = function() {
|
132 |
-
var _this = this;
|
133 |
-
|
134 |
-
this.click_test_action = function(evt) {
|
135 |
-
return _this.test_active_click(evt);
|
136 |
-
};
|
137 |
-
this.activate_action = function(evt) {
|
138 |
-
return _this.activate_field(evt);
|
139 |
-
};
|
140 |
-
this.active_field = false;
|
141 |
-
this.mouse_on_container = false;
|
142 |
-
this.results_showing = false;
|
143 |
-
this.result_highlighted = null;
|
144 |
-
this.result_single_selected = null;
|
145 |
-
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
146 |
-
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
147 |
-
this.disable_search = this.options.disable_search || false;
|
148 |
-
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
149 |
-
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
150 |
-
this.search_contains = this.options.search_contains || false;
|
151 |
-
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
152 |
-
this.max_selected_options = this.options.max_selected_options || Infinity;
|
153 |
-
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
154 |
-
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
155 |
-
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
156 |
-
};
|
157 |
-
|
158 |
-
AbstractChosen.prototype.set_default_text = function() {
|
159 |
-
if (this.form_field.getAttribute("data-placeholder")) {
|
160 |
-
this.default_text = this.form_field.getAttribute("data-placeholder");
|
161 |
-
} else if (this.is_multiple) {
|
162 |
-
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
163 |
-
} else {
|
164 |
-
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
165 |
-
}
|
166 |
-
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
167 |
-
};
|
168 |
-
|
169 |
-
AbstractChosen.prototype.mouse_enter = function() {
|
170 |
-
return this.mouse_on_container = true;
|
171 |
-
};
|
172 |
-
|
173 |
-
AbstractChosen.prototype.mouse_leave = function() {
|
174 |
-
return this.mouse_on_container = false;
|
175 |
-
};
|
176 |
-
|
177 |
-
AbstractChosen.prototype.input_focus = function(evt) {
|
178 |
-
var _this = this;
|
179 |
-
|
180 |
-
if (this.is_multiple) {
|
181 |
-
if (!this.active_field) {
|
182 |
-
return setTimeout((function() {
|
183 |
-
return _this.container_mousedown();
|
184 |
-
}), 50);
|
185 |
-
}
|
186 |
-
} else {
|
187 |
-
if (!this.active_field) {
|
188 |
-
return this.activate_field();
|
189 |
-
}
|
190 |
-
}
|
191 |
-
};
|
192 |
-
|
193 |
-
AbstractChosen.prototype.input_blur = function(evt) {
|
194 |
-
var _this = this;
|
195 |
-
|
196 |
-
if (!this.mouse_on_container) {
|
197 |
-
this.active_field = false;
|
198 |
-
return setTimeout((function() {
|
199 |
-
return _this.blur_test();
|
200 |
-
}), 100);
|
201 |
-
}
|
202 |
-
};
|
203 |
-
|
204 |
-
AbstractChosen.prototype.results_option_build = function(options) {
|
205 |
-
var content, data, _i, _len, _ref;
|
206 |
-
|
207 |
-
content = '';
|
208 |
-
_ref = this.results_data;
|
209 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
210 |
-
data = _ref[_i];
|
211 |
-
if (data.group) {
|
212 |
-
content += this.result_add_group(data);
|
213 |
-
} else {
|
214 |
-
content += this.result_add_option(data);
|
215 |
-
}
|
216 |
-
if (options != null ? options.first : void 0) {
|
217 |
-
if (data.selected && this.is_multiple) {
|
218 |
-
this.choice_build(data);
|
219 |
-
} else if (data.selected && !this.is_multiple) {
|
220 |
-
this.single_set_selected_text(data.text);
|
221 |
-
}
|
222 |
-
}
|
223 |
-
}
|
224 |
-
return content;
|
225 |
-
};
|
226 |
-
|
227 |
-
AbstractChosen.prototype.result_add_option = function(option) {
|
228 |
-
var classes, style;
|
229 |
-
|
230 |
-
if (!option.search_match) {
|
231 |
-
return '';
|
232 |
-
}
|
233 |
-
if (!this.include_option_in_results(option)) {
|
234 |
-
return '';
|
235 |
-
}
|
236 |
-
classes = [];
|
237 |
-
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
238 |
-
classes.push("active-result");
|
239 |
-
}
|
240 |
-
if (option.disabled && !(option.selected && this.is_multiple)) {
|
241 |
-
classes.push("disabled-result");
|
242 |
-
}
|
243 |
-
if (option.selected) {
|
244 |
-
classes.push("result-selected");
|
245 |
-
}
|
246 |
-
if (option.group_array_index != null) {
|
247 |
-
classes.push("group-option");
|
248 |
-
}
|
249 |
-
if (option.classes !== "") {
|
250 |
-
classes.push(option.classes);
|
251 |
-
}
|
252 |
-
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
|
253 |
-
return "<li class=\"" + (classes.join(' ')) + "\"" + style + " data-option-array-index=\"" + option.array_index + "\">" + option.search_text + "</li>";
|
254 |
-
};
|
255 |
-
|
256 |
-
AbstractChosen.prototype.result_add_group = function(group) {
|
257 |
-
if (!(group.search_match || group.group_match)) {
|
258 |
-
return '';
|
259 |
-
}
|
260 |
-
if (!(group.active_options > 0)) {
|
261 |
-
return '';
|
262 |
-
}
|
263 |
-
return "<li class=\"group-result\">" + group.search_text + "</li>";
|
264 |
-
};
|
265 |
-
|
266 |
-
AbstractChosen.prototype.results_update_field = function() {
|
267 |
-
this.set_default_text();
|
268 |
-
if (!this.is_multiple) {
|
269 |
-
this.results_reset_cleanup();
|
270 |
-
}
|
271 |
-
this.result_clear_highlight();
|
272 |
-
this.result_single_selected = null;
|
273 |
-
this.results_build();
|
274 |
-
if (this.results_showing) {
|
275 |
-
return this.winnow_results();
|
276 |
-
}
|
277 |
-
};
|
278 |
-
|
279 |
-
AbstractChosen.prototype.results_toggle = function() {
|
280 |
-
if (this.results_showing) {
|
281 |
-
return this.results_hide();
|
282 |
-
} else {
|
283 |
-
return this.results_show();
|
284 |
-
}
|
285 |
-
};
|
286 |
-
|
287 |
-
AbstractChosen.prototype.results_search = function(evt) {
|
288 |
-
if (this.results_showing) {
|
289 |
-
return this.winnow_results();
|
290 |
-
} else {
|
291 |
-
return this.results_show();
|
292 |
-
}
|
293 |
-
};
|
294 |
-
|
295 |
-
AbstractChosen.prototype.winnow_results = function() {
|
296 |
-
var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
297 |
-
|
298 |
-
this.no_results_clear();
|
299 |
-
results = 0;
|
300 |
-
searchText = this.get_search_text();
|
301 |
-
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
302 |
-
regexAnchor = this.search_contains ? "" : "^";
|
303 |
-
regex = new RegExp(regexAnchor + escapedSearchText, 'i');
|
304 |
-
zregex = new RegExp(escapedSearchText, 'i');
|
305 |
-
_ref = this.results_data;
|
306 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
307 |
-
option = _ref[_i];
|
308 |
-
option.search_match = false;
|
309 |
-
results_group = null;
|
310 |
-
if (this.include_option_in_results(option)) {
|
311 |
-
if (option.group) {
|
312 |
-
option.group_match = false;
|
313 |
-
option.active_options = 0;
|
314 |
-
}
|
315 |
-
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
316 |
-
results_group = this.results_data[option.group_array_index];
|
317 |
-
if (results_group.active_options === 0 && results_group.search_match) {
|
318 |
-
results += 1;
|
319 |
-
}
|
320 |
-
results_group.active_options += 1;
|
321 |
-
}
|
322 |
-
if (!(option.group && !this.group_search)) {
|
323 |
-
option.search_text = option.group ? option.label : option.html;
|
324 |
-
option.search_match = this.search_string_match(option.search_text, regex);
|
325 |
-
if (option.search_match && !option.group) {
|
326 |
-
results += 1;
|
327 |
-
}
|
328 |
-
if (option.search_match) {
|
329 |
-
if (searchText.length) {
|
330 |
-
startpos = option.search_text.search(zregex);
|
331 |
-
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
332 |
-
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
333 |
-
}
|
334 |
-
if (results_group != null) {
|
335 |
-
results_group.group_match = true;
|
336 |
-
}
|
337 |
-
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
338 |
-
option.search_match = true;
|
339 |
-
}
|
340 |
-
}
|
341 |
-
}
|
342 |
-
}
|
343 |
-
this.result_clear_highlight();
|
344 |
-
if (results < 1 && searchText.length) {
|
345 |
-
this.update_results_content("");
|
346 |
-
return this.no_results(searchText);
|
347 |
-
} else {
|
348 |
-
this.update_results_content(this.results_option_build());
|
349 |
-
return this.winnow_results_set_highlight();
|
350 |
-
}
|
351 |
-
};
|
352 |
-
|
353 |
-
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
354 |
-
var part, parts, _i, _len;
|
355 |
-
|
356 |
-
if (regex.test(search_string)) {
|
357 |
-
return true;
|
358 |
-
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
359 |
-
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
360 |
-
if (parts.length) {
|
361 |
-
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
362 |
-
part = parts[_i];
|
363 |
-
if (regex.test(part)) {
|
364 |
-
return true;
|
365 |
-
}
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
};
|
370 |
-
|
371 |
-
AbstractChosen.prototype.choices_count = function() {
|
372 |
-
var option, _i, _len, _ref;
|
373 |
-
|
374 |
-
if (this.selected_option_count != null) {
|
375 |
-
return this.selected_option_count;
|
376 |
-
}
|
377 |
-
this.selected_option_count = 0;
|
378 |
-
_ref = this.form_field.options;
|
379 |
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
380 |
-
option = _ref[_i];
|
381 |
-
if (option.selected) {
|
382 |
-
this.selected_option_count += 1;
|
383 |
-
}
|
384 |
-
}
|
385 |
-
return this.selected_option_count;
|
386 |
-
};
|
387 |
-
|
388 |
-
AbstractChosen.prototype.choices_click = function(evt) {
|
389 |
-
evt.preventDefault();
|
390 |
-
if (!(this.results_showing || this.is_disabled)) {
|
391 |
-
return this.results_show();
|
392 |
-
}
|
393 |
-
};
|
394 |
-
|
395 |
-
AbstractChosen.prototype.keyup_checker = function(evt) {
|
396 |
-
var stroke, _ref;
|
397 |
-
|
398 |
-
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
399 |
-
this.search_field_scale();
|
400 |
-
switch (stroke) {
|
401 |
-
case 8:
|
402 |
-
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
403 |
-
return this.keydown_backstroke();
|
404 |
-
} else if (!this.pending_backstroke) {
|
405 |
-
this.result_clear_highlight();
|
406 |
-
return this.results_search();
|
407 |
-
}
|
408 |
-
break;
|
409 |
-
case 13:
|
410 |
-
evt.preventDefault();
|
411 |
-
if (this.results_showing) {
|
412 |
-
return this.result_select(evt);
|
413 |
-
}
|
414 |
-
break;
|
415 |
-
case 27:
|
416 |
-
if (this.results_showing) {
|
417 |
-
this.results_hide();
|
418 |
-
}
|
419 |
-
return true;
|
420 |
-
case 9:
|
421 |
-
case 38:
|
422 |
-
case 40:
|
423 |
-
case 16:
|
424 |
-
case 91:
|
425 |
-
case 17:
|
426 |
-
break;
|
427 |
-
default:
|
428 |
-
return this.results_search();
|
429 |
-
}
|
430 |
-
};
|
431 |
-
|
432 |
-
AbstractChosen.prototype.container_width = function() {
|
433 |
-
if (this.options.width != null) {
|
434 |
-
return this.options.width;
|
435 |
-
} else {
|
436 |
-
return "" + this.form_field.offsetWidth + "px";
|
437 |
-
}
|
438 |
-
};
|
439 |
-
|
440 |
-
AbstractChosen.prototype.include_option_in_results = function(option) {
|
441 |
-
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
442 |
-
return false;
|
443 |
-
}
|
444 |
-
if (!this.display_disabled_options && option.disabled) {
|
445 |
-
return false;
|
446 |
-
}
|
447 |
-
if (option.empty) {
|
448 |
-
return false;
|
449 |
-
}
|
450 |
-
return true;
|
451 |
-
};
|
452 |
-
|
453 |
-
AbstractChosen.browser_is_supported = function() {
|
454 |
-
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
455 |
-
return document.documentMode >= 8;
|
456 |
-
}
|
457 |
-
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
458 |
-
return false;
|
459 |
-
}
|
460 |
-
if (/Android/i.test(window.navigator.userAgent)) {
|
461 |
-
if (/Mobile/i.test(window.navigator.userAgent)) {
|
462 |
-
return false;
|
463 |
-
}
|
464 |
-
}
|
465 |
-
return true;
|
466 |
-
};
|
467 |
-
|
468 |
-
AbstractChosen.default_multiple_text = "Select Some Options";
|
469 |
-
|
470 |
-
AbstractChosen.default_single_text = "Select an Option";
|
471 |
-
|
472 |
-
AbstractChosen.default_no_result_text = "No results match";
|
473 |
-
|
474 |
-
return AbstractChosen;
|
475 |
-
|
476 |
-
})();
|
477 |
-
|
478 |
-
$ = jQuery;
|
479 |
-
|
480 |
-
$.fn.extend({
|
481 |
-
chosen: function(options) {
|
482 |
-
if (!AbstractChosen.browser_is_supported()) {
|
483 |
-
return this;
|
484 |
-
}
|
485 |
-
return this.each(function(input_field) {
|
486 |
-
var $this, chosen;
|
487 |
-
|
488 |
-
$this = $(this);
|
489 |
-
chosen = $this.data('chosen');
|
490 |
-
if (options === 'destroy' && chosen) {
|
491 |
-
chosen.destroy();
|
492 |
-
} else if (!chosen) {
|
493 |
-
$this.data('chosen', new Chosen(this, options));
|
494 |
-
}
|
495 |
-
});
|
496 |
-
}
|
497 |
-
});
|
498 |
-
|
499 |
-
Chosen = (function(_super) {
|
500 |
-
__extends(Chosen, _super);
|
501 |
-
|
502 |
-
function Chosen() {
|
503 |
-
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
504 |
-
return _ref;
|
505 |
-
}
|
506 |
-
|
507 |
-
Chosen.prototype.setup = function() {
|
508 |
-
this.form_field_jq = $(this.form_field);
|
509 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
510 |
-
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
511 |
-
};
|
512 |
-
|
513 |
-
Chosen.prototype.set_up_html = function() {
|
514 |
-
var container_classes, container_props;
|
515 |
-
|
516 |
-
container_classes = ["chosen-container"];
|
517 |
-
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
518 |
-
if (this.inherit_select_classes && this.form_field.className) {
|
519 |
-
container_classes.push(this.form_field.className);
|
520 |
-
}
|
521 |
-
if (this.is_rtl) {
|
522 |
-
container_classes.push("chosen-rtl");
|
523 |
-
}
|
524 |
-
container_props = {
|
525 |
-
'class': container_classes.join(' '),
|
526 |
-
'style': "width: " + (this.container_width()) + ";",
|
527 |
-
'title': this.form_field.title
|
528 |
-
};
|
529 |
-
if (this.form_field.id.length) {
|
530 |
-
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
531 |
-
}
|
532 |
-
this.container = $("<div />", container_props);
|
533 |
-
if (this.is_multiple) {
|
534 |
-
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
535 |
-
} else {
|
536 |
-
this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
537 |
-
}
|
538 |
-
this.form_field_jq.hide().after(this.container);
|
539 |
-
this.dropdown = this.container.find('div.chosen-drop').first();
|
540 |
-
this.search_field = this.container.find('input').first();
|
541 |
-
this.search_results = this.container.find('ul.chosen-results').first();
|
542 |
-
this.search_field_scale();
|
543 |
-
this.search_no_results = this.container.find('li.no-results').first();
|
544 |
-
if (this.is_multiple) {
|
545 |
-
this.search_choices = this.container.find('ul.chosen-choices').first();
|
546 |
-
this.search_container = this.container.find('li.search-field').first();
|
547 |
-
} else {
|
548 |
-
this.search_container = this.container.find('div.chosen-search').first();
|
549 |
-
this.selected_item = this.container.find('.chosen-single').first();
|
550 |
-
}
|
551 |
-
this.results_build();
|
552 |
-
this.set_tab_index();
|
553 |
-
this.set_label_behavior();
|
554 |
-
return this.form_field_jq.trigger("chosen:ready", {
|
555 |
-
chosen: this
|
556 |
-
});
|
557 |
-
};
|
558 |
-
|
559 |
-
Chosen.prototype.register_observers = function() {
|
560 |
-
var _this = this;
|
561 |
-
|
562 |
-
this.container.bind('mousedown.chosen', function(evt) {
|
563 |
-
_this.container_mousedown(evt);
|
564 |
-
});
|
565 |
-
this.container.bind('mouseup.chosen', function(evt) {
|
566 |
-
_this.container_mouseup(evt);
|
567 |
-
});
|
568 |
-
this.container.bind('mouseenter.chosen', function(evt) {
|
569 |
-
_this.mouse_enter(evt);
|
570 |
-
});
|
571 |
-
this.container.bind('mouseleave.chosen', function(evt) {
|
572 |
-
_this.mouse_leave(evt);
|
573 |
-
});
|
574 |
-
this.search_results.bind('mouseup.chosen', function(evt) {
|
575 |
-
_this.search_results_mouseup(evt);
|
576 |
-
});
|
577 |
-
this.search_results.bind('mouseover.chosen', function(evt) {
|
578 |
-
_this.search_results_mouseover(evt);
|
579 |
-
});
|
580 |
-
this.search_results.bind('mouseout.chosen', function(evt) {
|
581 |
-
_this.search_results_mouseout(evt);
|
582 |
-
});
|
583 |
-
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
584 |
-
_this.search_results_mousewheel(evt);
|
585 |
-
});
|
586 |
-
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
587 |
-
_this.results_update_field(evt);
|
588 |
-
});
|
589 |
-
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
590 |
-
_this.activate_field(evt);
|
591 |
-
});
|
592 |
-
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
593 |
-
_this.container_mousedown(evt);
|
594 |
-
});
|
595 |
-
this.search_field.bind('blur.chosen', function(evt) {
|
596 |
-
_this.input_blur(evt);
|
597 |
-
});
|
598 |
-
this.search_field.bind('keyup.chosen', function(evt) {
|
599 |
-
_this.keyup_checker(evt);
|
600 |
-
});
|
601 |
-
this.search_field.bind('keydown.chosen', function(evt) {
|
602 |
-
_this.keydown_checker(evt);
|
603 |
-
});
|
604 |
-
this.search_field.bind('focus.chosen', function(evt) {
|
605 |
-
_this.input_focus(evt);
|
606 |
-
});
|
607 |
-
if (this.is_multiple) {
|
608 |
-
return this.search_choices.bind('click.chosen', function(evt) {
|
609 |
-
_this.choices_click(evt);
|
610 |
-
});
|
611 |
-
} else {
|
612 |
-
return this.container.bind('click.chosen', function(evt) {
|
613 |
-
evt.preventDefault();
|
614 |
-
});
|
615 |
-
}
|
616 |
-
};
|
617 |
-
|
618 |
-
Chosen.prototype.destroy = function() {
|
619 |
-
$(document).unbind("click.chosen", this.click_test_action);
|
620 |
-
if (this.search_field[0].tabIndex) {
|
621 |
-
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
622 |
-
}
|
623 |
-
this.container.remove();
|
624 |
-
this.form_field_jq.removeData('chosen');
|
625 |
-
return this.form_field_jq.show();
|
626 |
-
};
|
627 |
-
|
628 |
-
Chosen.prototype.search_field_disabled = function() {
|
629 |
-
this.is_disabled = this.form_field_jq[0].disabled;
|
630 |
-
if (this.is_disabled) {
|
631 |
-
this.container.addClass('chosen-disabled');
|
632 |
-
this.search_field[0].disabled = true;
|
633 |
-
if (!this.is_multiple) {
|
634 |
-
this.selected_item.unbind("focus.chosen", this.activate_action);
|
635 |
-
}
|
636 |
-
return this.close_field();
|
637 |
-
} else {
|
638 |
-
this.container.removeClass('chosen-disabled');
|
639 |
-
this.search_field[0].disabled = false;
|
640 |
-
if (!this.is_multiple) {
|
641 |
-
return this.selected_item.bind("focus.chosen", this.activate_action);
|
642 |
-
}
|
643 |
-
}
|
644 |
-
};
|
645 |
-
|
646 |
-
Chosen.prototype.container_mousedown = function(evt) {
|
647 |
-
if (!this.is_disabled) {
|
648 |
-
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
649 |
-
evt.preventDefault();
|
650 |
-
}
|
651 |
-
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
652 |
-
if (!this.active_field) {
|
653 |
-
if (this.is_multiple) {
|
654 |
-
this.search_field.val("");
|
655 |
-
}
|
656 |
-
$(document).bind('click.chosen', this.click_test_action);
|
657 |
-
this.results_show();
|
658 |
-
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
659 |
-
evt.preventDefault();
|
660 |
-
this.results_toggle();
|
661 |
-
}
|
662 |
-
return this.activate_field();
|
663 |
-
}
|
664 |
-
}
|
665 |
-
};
|
666 |
-
|
667 |
-
Chosen.prototype.container_mouseup = function(evt) {
|
668 |
-
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
669 |
-
return this.results_reset(evt);
|
670 |
-
}
|
671 |
-
};
|
672 |
-
|
673 |
-
Chosen.prototype.search_results_mousewheel = function(evt) {
|
674 |
-
var delta, _ref1, _ref2;
|
675 |
-
|
676 |
-
delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0);
|
677 |
-
if (delta != null) {
|
678 |
-
evt.preventDefault();
|
679 |
-
if (evt.type === 'DOMMouseScroll') {
|
680 |
-
delta = delta * 40;
|
681 |
-
}
|
682 |
-
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
683 |
-
}
|
684 |
-
};
|
685 |
-
|
686 |
-
Chosen.prototype.blur_test = function(evt) {
|
687 |
-
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
688 |
-
return this.close_field();
|
689 |
-
}
|
690 |
-
};
|
691 |
-
|
692 |
-
Chosen.prototype.close_field = function() {
|
693 |
-
$(document).unbind("click.chosen", this.click_test_action);
|
694 |
-
this.active_field = false;
|
695 |
-
this.results_hide();
|
696 |
-
this.container.removeClass("chosen-container-active");
|
697 |
-
this.clear_backstroke();
|
698 |
-
this.show_search_field_default();
|
699 |
-
return this.search_field_scale();
|
700 |
-
};
|
701 |
-
|
702 |
-
Chosen.prototype.activate_field = function() {
|
703 |
-
this.container.addClass("chosen-container-active");
|
704 |
-
this.active_field = true;
|
705 |
-
this.search_field.val(this.search_field.val());
|
706 |
-
return this.search_field.focus();
|
707 |
-
};
|
708 |
-
|
709 |
-
Chosen.prototype.test_active_click = function(evt) {
|
710 |
-
if (this.container.is($(evt.target).closest('.chosen-container'))) {
|
711 |
-
return this.active_field = true;
|
712 |
-
} else {
|
713 |
-
return this.close_field();
|
714 |
-
}
|
715 |
-
};
|
716 |
-
|
717 |
-
Chosen.prototype.results_build = function() {
|
718 |
-
this.parsing = true;
|
719 |
-
this.selected_option_count = null;
|
720 |
-
this.results_data = SelectParser.select_to_array(this.form_field);
|
721 |
-
if (this.is_multiple) {
|
722 |
-
this.search_choices.find("li.search-choice").remove();
|
723 |
-
} else if (!this.is_multiple) {
|
724 |
-
this.single_set_selected_text();
|
725 |
-
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
726 |
-
this.search_field[0].readOnly = true;
|
727 |
-
this.container.addClass("chosen-container-single-nosearch");
|
728 |
-
} else {
|
729 |
-
this.search_field[0].readOnly = false;
|
730 |
-
this.container.removeClass("chosen-container-single-nosearch");
|
731 |
-
}
|
732 |
-
}
|
733 |
-
this.update_results_content(this.results_option_build({
|
734 |
-
first: true
|
735 |
-
}));
|
736 |
-
this.search_field_disabled();
|
737 |
-
this.show_search_field_default();
|
738 |
-
this.search_field_scale();
|
739 |
-
return this.parsing = false;
|
740 |
-
};
|
741 |
-
|
742 |
-
Chosen.prototype.result_do_highlight = function(el) {
|
743 |
-
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
744 |
-
|
745 |
-
if (el.length) {
|
746 |
-
this.result_clear_highlight();
|
747 |
-
this.result_highlight = el;
|
748 |
-
this.result_highlight.addClass("highlighted");
|
749 |
-
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
750 |
-
visible_top = this.search_results.scrollTop();
|
751 |
-
visible_bottom = maxHeight + visible_top;
|
752 |
-
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
753 |
-
high_bottom = high_top + this.result_highlight.outerHeight();
|
754 |
-
if (high_bottom >= visible_bottom) {
|
755 |
-
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
756 |
-
} else if (high_top < visible_top) {
|
757 |
-
return this.search_results.scrollTop(high_top);
|
758 |
-
}
|
759 |
-
}
|
760 |
-
};
|
761 |
-
|
762 |
-
Chosen.prototype.result_clear_highlight = function() {
|
763 |
-
if (this.result_highlight) {
|
764 |
-
this.result_highlight.removeClass("highlighted");
|
765 |
-
}
|
766 |
-
return this.result_highlight = null;
|
767 |
-
};
|
768 |
-
|
769 |
-
Chosen.prototype.results_show = function() {
|
770 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
771 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
772 |
-
chosen: this
|
773 |
-
});
|
774 |
-
return false;
|
775 |
-
}
|
776 |
-
this.container.addClass("chosen-with-drop");
|
777 |
-
this.form_field_jq.trigger("chosen:showing_dropdown", {
|
778 |
-
chosen: this
|
779 |
-
});
|
780 |
-
this.results_showing = true;
|
781 |
-
this.search_field.focus();
|
782 |
-
this.search_field.val(this.search_field.val());
|
783 |
-
return this.winnow_results();
|
784 |
-
};
|
785 |
-
|
786 |
-
Chosen.prototype.update_results_content = function(content) {
|
787 |
-
return this.search_results.html(content);
|
788 |
-
};
|
789 |
-
|
790 |
-
Chosen.prototype.results_hide = function() {
|
791 |
-
if (this.results_showing) {
|
792 |
-
this.result_clear_highlight();
|
793 |
-
this.container.removeClass("chosen-with-drop");
|
794 |
-
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
795 |
-
chosen: this
|
796 |
-
});
|
797 |
-
}
|
798 |
-
return this.results_showing = false;
|
799 |
-
};
|
800 |
-
|
801 |
-
Chosen.prototype.set_tab_index = function(el) {
|
802 |
-
var ti;
|
803 |
-
|
804 |
-
if (this.form_field.tabIndex) {
|
805 |
-
ti = this.form_field.tabIndex;
|
806 |
-
this.form_field.tabIndex = -1;
|
807 |
-
return this.search_field[0].tabIndex = ti;
|
808 |
-
}
|
809 |
-
};
|
810 |
-
|
811 |
-
Chosen.prototype.set_label_behavior = function() {
|
812 |
-
var _this = this;
|
813 |
-
|
814 |
-
this.form_field_label = this.form_field_jq.parents("label");
|
815 |
-
if (!this.form_field_label.length && this.form_field.id.length) {
|
816 |
-
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
817 |
-
}
|
818 |
-
if (this.form_field_label.length > 0) {
|
819 |
-
return this.form_field_label.bind('click.chosen', function(evt) {
|
820 |
-
if (_this.is_multiple) {
|
821 |
-
return _this.container_mousedown(evt);
|
822 |
-
} else {
|
823 |
-
return _this.activate_field();
|
824 |
-
}
|
825 |
-
});
|
826 |
-
}
|
827 |
-
};
|
828 |
-
|
829 |
-
Chosen.prototype.show_search_field_default = function() {
|
830 |
-
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
831 |
-
this.search_field.val(this.default_text);
|
832 |
-
return this.search_field.addClass("default");
|
833 |
-
} else {
|
834 |
-
this.search_field.val("");
|
835 |
-
return this.search_field.removeClass("default");
|
836 |
-
}
|
837 |
-
};
|
838 |
-
|
839 |
-
Chosen.prototype.search_results_mouseup = function(evt) {
|
840 |
-
var target;
|
841 |
-
|
842 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
843 |
-
if (target.length) {
|
844 |
-
this.result_highlight = target;
|
845 |
-
this.result_select(evt);
|
846 |
-
return this.search_field.focus();
|
847 |
-
}
|
848 |
-
};
|
849 |
-
|
850 |
-
Chosen.prototype.search_results_mouseover = function(evt) {
|
851 |
-
var target;
|
852 |
-
|
853 |
-
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
854 |
-
if (target) {
|
855 |
-
return this.result_do_highlight(target);
|
856 |
-
}
|
857 |
-
};
|
858 |
-
|
859 |
-
Chosen.prototype.search_results_mouseout = function(evt) {
|
860 |
-
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
861 |
-
return this.result_clear_highlight();
|
862 |
-
}
|
863 |
-
};
|
864 |
-
|
865 |
-
Chosen.prototype.choice_build = function(item) {
|
866 |
-
var choice, close_link,
|
867 |
-
_this = this;
|
868 |
-
|
869 |
-
choice = $('<li />', {
|
870 |
-
"class": "search-choice"
|
871 |
-
}).html("<span>" + item.html + "</span>");
|
872 |
-
if (item.disabled) {
|
873 |
-
choice.addClass('search-choice-disabled');
|
874 |
-
} else {
|
875 |
-
close_link = $('<a />', {
|
876 |
-
"class": 'search-choice-close',
|
877 |
-
'data-option-array-index': item.array_index
|
878 |
-
});
|
879 |
-
close_link.bind('click.chosen', function(evt) {
|
880 |
-
return _this.choice_destroy_link_click(evt);
|
881 |
-
});
|
882 |
-
choice.append(close_link);
|
883 |
-
}
|
884 |
-
return this.search_container.before(choice);
|
885 |
-
};
|
886 |
-
|
887 |
-
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
888 |
-
evt.preventDefault();
|
889 |
-
evt.stopPropagation();
|
890 |
-
if (!this.is_disabled) {
|
891 |
-
return this.choice_destroy($(evt.target));
|
892 |
-
}
|
893 |
-
};
|
894 |
-
|
895 |
-
Chosen.prototype.choice_destroy = function(link) {
|
896 |
-
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
897 |
-
this.show_search_field_default();
|
898 |
-
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
899 |
-
this.results_hide();
|
900 |
-
}
|
901 |
-
link.parents('li').first().remove();
|
902 |
-
return this.search_field_scale();
|
903 |
-
}
|
904 |
-
};
|
905 |
-
|
906 |
-
Chosen.prototype.results_reset = function() {
|
907 |
-
this.form_field.options[0].selected = true;
|
908 |
-
this.selected_option_count = null;
|
909 |
-
this.single_set_selected_text();
|
910 |
-
this.show_search_field_default();
|
911 |
-
this.results_reset_cleanup();
|
912 |
-
this.form_field_jq.trigger("change");
|
913 |
-
if (this.active_field) {
|
914 |
-
return this.results_hide();
|
915 |
-
}
|
916 |
-
};
|
917 |
-
|
918 |
-
Chosen.prototype.results_reset_cleanup = function() {
|
919 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
920 |
-
return this.selected_item.find("abbr").remove();
|
921 |
-
};
|
922 |
-
|
923 |
-
Chosen.prototype.result_select = function(evt) {
|
924 |
-
var high, item, selected_index;
|
925 |
-
|
926 |
-
if (this.result_highlight) {
|
927 |
-
high = this.result_highlight;
|
928 |
-
this.result_clear_highlight();
|
929 |
-
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
930 |
-
this.form_field_jq.trigger("chosen:maxselected", {
|
931 |
-
chosen: this
|
932 |
-
});
|
933 |
-
return false;
|
934 |
-
}
|
935 |
-
if (this.is_multiple) {
|
936 |
-
high.removeClass("active-result");
|
937 |
-
} else {
|
938 |
-
if (this.result_single_selected) {
|
939 |
-
this.result_single_selected.removeClass("result-selected");
|
940 |
-
selected_index = this.result_single_selected[0].getAttribute('data-option-array-index');
|
941 |
-
this.results_data[selected_index].selected = false;
|
942 |
-
}
|
943 |
-
this.result_single_selected = high;
|
944 |
-
}
|
945 |
-
high.addClass("result-selected");
|
946 |
-
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
947 |
-
item.selected = true;
|
948 |
-
this.form_field.options[item.options_index].selected = true;
|
949 |
-
this.selected_option_count = null;
|
950 |
-
if (this.is_multiple) {
|
951 |
-
this.choice_build(item);
|
952 |
-
} else {
|
953 |
-
this.single_set_selected_text(item.text);
|
954 |
-
}
|
955 |
-
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
956 |
-
this.results_hide();
|
957 |
-
}
|
958 |
-
this.search_field.val("");
|
959 |
-
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
960 |
-
this.form_field_jq.trigger("change", {
|
961 |
-
'selected': this.form_field.options[item.options_index].value
|
962 |
-
});
|
963 |
-
}
|
964 |
-
this.current_selectedIndex = this.form_field.selectedIndex;
|
965 |
-
return this.search_field_scale();
|
966 |
-
}
|
967 |
-
};
|
968 |
-
|
969 |
-
Chosen.prototype.single_set_selected_text = function(text) {
|
970 |
-
if (text == null) {
|
971 |
-
text = this.default_text;
|
972 |
-
}
|
973 |
-
if (text === this.default_text) {
|
974 |
-
this.selected_item.addClass("chosen-default");
|
975 |
-
} else {
|
976 |
-
this.single_deselect_control_build();
|
977 |
-
this.selected_item.removeClass("chosen-default");
|
978 |
-
}
|
979 |
-
return this.selected_item.find("span").text(text);
|
980 |
-
};
|
981 |
-
|
982 |
-
Chosen.prototype.result_deselect = function(pos) {
|
983 |
-
var result_data;
|
984 |
-
|
985 |
-
result_data = this.results_data[pos];
|
986 |
-
if (!this.form_field.options[result_data.options_index].disabled) {
|
987 |
-
result_data.selected = false;
|
988 |
-
this.form_field.options[result_data.options_index].selected = false;
|
989 |
-
this.selected_option_count = null;
|
990 |
-
this.result_clear_highlight();
|
991 |
-
if (this.results_showing) {
|
992 |
-
this.winnow_results();
|
993 |
-
}
|
994 |
-
this.form_field_jq.trigger("change", {
|
995 |
-
deselected: this.form_field.options[result_data.options_index].value
|
996 |
-
});
|
997 |
-
this.search_field_scale();
|
998 |
-
return true;
|
999 |
-
} else {
|
1000 |
-
return false;
|
1001 |
-
}
|
1002 |
-
};
|
1003 |
-
|
1004 |
-
Chosen.prototype.single_deselect_control_build = function() {
|
1005 |
-
if (!this.allow_single_deselect) {
|
1006 |
-
return;
|
1007 |
-
}
|
1008 |
-
if (!this.selected_item.find("abbr").length) {
|
1009 |
-
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1010 |
-
}
|
1011 |
-
return this.selected_item.addClass("chosen-single-with-deselect");
|
1012 |
-
};
|
1013 |
-
|
1014 |
-
Chosen.prototype.get_search_text = function() {
|
1015 |
-
if (this.search_field.val() === this.default_text) {
|
1016 |
-
return "";
|
1017 |
-
} else {
|
1018 |
-
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1019 |
-
}
|
1020 |
-
};
|
1021 |
-
|
1022 |
-
Chosen.prototype.winnow_results_set_highlight = function() {
|
1023 |
-
var do_high, selected_results;
|
1024 |
-
|
1025 |
-
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1026 |
-
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1027 |
-
if (do_high != null) {
|
1028 |
-
return this.result_do_highlight(do_high);
|
1029 |
-
}
|
1030 |
-
};
|
1031 |
-
|
1032 |
-
Chosen.prototype.no_results = function(terms) {
|
1033 |
-
var no_results_html;
|
1034 |
-
|
1035 |
-
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1036 |
-
no_results_html.find("span").first().html(terms);
|
1037 |
-
return this.search_results.append(no_results_html);
|
1038 |
-
};
|
1039 |
-
|
1040 |
-
Chosen.prototype.no_results_clear = function() {
|
1041 |
-
return this.search_results.find(".no-results").remove();
|
1042 |
-
};
|
1043 |
-
|
1044 |
-
Chosen.prototype.keydown_arrow = function() {
|
1045 |
-
var next_sib;
|
1046 |
-
|
1047 |
-
if (this.results_showing && this.result_highlight) {
|
1048 |
-
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1049 |
-
if (next_sib) {
|
1050 |
-
return this.result_do_highlight(next_sib);
|
1051 |
-
}
|
1052 |
-
} else {
|
1053 |
-
return this.results_show();
|
1054 |
-
}
|
1055 |
-
};
|
1056 |
-
|
1057 |
-
Chosen.prototype.keyup_arrow = function() {
|
1058 |
-
var prev_sibs;
|
1059 |
-
|
1060 |
-
if (!this.results_showing && !this.is_multiple) {
|
1061 |
-
return this.results_show();
|
1062 |
-
} else if (this.result_highlight) {
|
1063 |
-
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1064 |
-
if (prev_sibs.length) {
|
1065 |
-
return this.result_do_highlight(prev_sibs.first());
|
1066 |
-
} else {
|
1067 |
-
if (this.choices_count() > 0) {
|
1068 |
-
this.results_hide();
|
1069 |
-
}
|
1070 |
-
return this.result_clear_highlight();
|
1071 |
-
}
|
1072 |
-
}
|
1073 |
-
};
|
1074 |
-
|
1075 |
-
Chosen.prototype.keydown_backstroke = function() {
|
1076 |
-
var next_available_destroy;
|
1077 |
-
|
1078 |
-
if (this.pending_backstroke) {
|
1079 |
-
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1080 |
-
return this.clear_backstroke();
|
1081 |
-
} else {
|
1082 |
-
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1083 |
-
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1084 |
-
this.pending_backstroke = next_available_destroy;
|
1085 |
-
if (this.single_backstroke_delete) {
|
1086 |
-
return this.keydown_backstroke();
|
1087 |
-
} else {
|
1088 |
-
return this.pending_backstroke.addClass("search-choice-focus");
|
1089 |
-
}
|
1090 |
-
}
|
1091 |
-
}
|
1092 |
-
};
|
1093 |
-
|
1094 |
-
Chosen.prototype.clear_backstroke = function() {
|
1095 |
-
if (this.pending_backstroke) {
|
1096 |
-
this.pending_backstroke.removeClass("search-choice-focus");
|
1097 |
-
}
|
1098 |
-
return this.pending_backstroke = null;
|
1099 |
-
};
|
1100 |
-
|
1101 |
-
Chosen.prototype.keydown_checker = function(evt) {
|
1102 |
-
var stroke, _ref1;
|
1103 |
-
|
1104 |
-
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1105 |
-
this.search_field_scale();
|
1106 |
-
if (stroke !== 8 && this.pending_backstroke) {
|
1107 |
-
this.clear_backstroke();
|
1108 |
-
}
|
1109 |
-
switch (stroke) {
|
1110 |
-
case 8:
|
1111 |
-
this.backstroke_length = this.search_field.val().length;
|
1112 |
-
break;
|
1113 |
-
case 9:
|
1114 |
-
if (this.results_showing && !this.is_multiple) {
|
1115 |
-
this.result_select(evt);
|
1116 |
-
}
|
1117 |
-
this.mouse_on_container = false;
|
1118 |
-
break;
|
1119 |
-
case 13:
|
1120 |
-
evt.preventDefault();
|
1121 |
-
break;
|
1122 |
-
case 38:
|
1123 |
-
evt.preventDefault();
|
1124 |
-
this.keyup_arrow();
|
1125 |
-
break;
|
1126 |
-
case 40:
|
1127 |
-
evt.preventDefault();
|
1128 |
-
this.keydown_arrow();
|
1129 |
-
break;
|
1130 |
-
}
|
1131 |
-
};
|
1132 |
-
|
1133 |
-
Chosen.prototype.search_field_scale = function() {
|
1134 |
-
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1135 |
-
|
1136 |
-
if (this.is_multiple) {
|
1137 |
-
h = 0;
|
1138 |
-
w = 0;
|
1139 |
-
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1140 |
-
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1141 |
-
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1142 |
-
style = styles[_i];
|
1143 |
-
style_block += style + ":" + this.search_field.css(style) + ";";
|
1144 |
-
}
|
1145 |
-
div = $('<div />', {
|
1146 |
-
'style': style_block
|
1147 |
-
});
|
1148 |
-
div.text(this.search_field.val());
|
1149 |
-
$('body').append(div);
|
1150 |
-
w = div.width() + 25;
|
1151 |
-
div.remove();
|
1152 |
-
f_width = this.container.outerWidth();
|
1153 |
-
if (w > f_width - 10) {
|
1154 |
-
w = f_width - 10;
|
1155 |
-
}
|
1156 |
-
return this.search_field.css({
|
1157 |
-
'width': w + 'px'
|
1158 |
-
});
|
1159 |
-
}
|
1160 |
-
};
|
1161 |
-
|
1162 |
-
return Chosen;
|
1163 |
-
|
1164 |
-
})(AbstractChosen);
|
1165 |
-
|
1166 |
-
}).call(this);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/chosen/chosen.jquery.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
-
!function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=""!==a.style.cssText?' style="'+a.style+'"':"",'<li class="'+b.join(" ")+'"'+c+' data-option-array-index="'+a.array_index+'">'+a.search_text+"</li>"):"":""},AbstractChosen.prototype.result_add_group=function(a){return a.search_match||a.group_match?a.active_options>0?'<li class="group-result">'+a.search_text+"</li>":"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;for(this.no_results_clear(),e=0,g=this.get_search_text(),a=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d=this.search_contains?"":"^",c=new RegExp(d+a,"i"),j=new RegExp(a,"i"),m=this.results_data,k=0,l=m.length;l>k;k++)b=m[k],b.search_match=!1,f=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(f=this.results_data[b.group_array_index],0===f.active_options&&f.search_match&&(e+=1),f.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.html,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(e+=1),b.search_match?(g.length&&(h=b.search_text.search(j),i=b.search_text.substr(0,h+g.length)+"</em>"+b.search_text.substr(h+g.length),b.search_text=i.substr(0,h)+"<em>"+i.substr(h)),null!=f&&(f.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>e&&g.length?(this.update_results_content(""),this.no_results(g)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d?d.destroy():d||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(document).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b,c,d;return b=-(null!=(c=a.originalEvent)?c.wheelDelta:void 0)||(null!=(d=a.originialEvent)?d.detail:void 0),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(document).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){return this.container.is(a(b.target).closest(".chosen-container"))?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results())},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.form_field.options[0].selected=!0,this.selected_option_count=null,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c,d;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):(this.result_single_selected&&(this.result_single_selected.removeClass("result-selected"),d=this.result_single_selected[0].getAttribute("data-option-array-index"),this.results_data[d].selected=!1),this.result_single_selected=b),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);
|
|
|
|
languages/groups-de_DE.mo
CHANGED
Binary file
|
languages/groups-de_DE.po
CHANGED
@@ -7,16 +7,16 @@ msgid ""
|
|
7 |
msgstr ""
|
8 |
"Project-Id-Version: \n"
|
9 |
"Report-Msgid-Bugs-To: \n"
|
10 |
-
"POT-Creation-Date:
|
11 |
-
"PO-Revision-Date:
|
12 |
-
"Last-Translator: \n"
|
13 |
"Language-Team: itthinx.com\n"
|
14 |
"Language: de_DE\n"
|
15 |
"MIME-Version: 1.0\n"
|
16 |
"Content-Type: text/plain; charset=UTF-8\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
-
"X-Generator: Poedit 1.8.
|
20 |
|
21 |
#: lib/core/class-groups-pagination.php:140
|
22 |
#, php-format
|
@@ -24,15 +24,17 @@ msgctxt "paging"
|
|
24 |
msgid "%1$s of %2$s"
|
25 |
msgstr "%1$s von %2$s"
|
26 |
|
27 |
-
#:
|
|
|
28 |
msgid "— No Change —"
|
29 |
msgstr "— Ohne Änderung —"
|
30 |
|
31 |
-
#:
|
|
|
32 |
msgid "(only unrestricted)"
|
33 |
msgstr "(ohne Beschränkung)"
|
34 |
|
35 |
-
#: lib/admin/class-groups-admin-users.php:
|
36 |
msgid "--"
|
37 |
msgstr "--"
|
38 |
|
@@ -43,7 +45,7 @@ msgid_plural "%s items"
|
|
43 |
msgstr[0] "1 Element"
|
44 |
msgstr[1] "%s Elemente"
|
45 |
|
46 |
-
#:
|
47 |
#, php-format
|
48 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
49 |
msgstr "<span title=\"%s\">Zugangsbeschränkungen</span>"
|
@@ -54,7 +56,7 @@ msgstr "<span title=\"%s\">Zugangsbeschränkungen</span>"
|
|
54 |
msgid "<strong>%s</strong>"
|
55 |
msgstr "<strong>%s</strong>"
|
56 |
|
57 |
-
#:
|
58 |
msgid ""
|
59 |
"<sup>*</sup> For each capability, the groups that have the capability "
|
60 |
"assigned are shown within parenthesis. You can choose a capability by typing "
|
@@ -68,7 +70,7 @@ msgstr ""
|
|
68 |
msgid "A Duck!"
|
69 |
msgstr "Eine Ente!"
|
70 |
|
71 |
-
#: lib/admin/groups-admin-options.php:
|
72 |
msgid "A minimum set of permissions will be preserved."
|
73 |
msgstr "Ein Minimalsatz von Genehmigungen wird beibehalten."
|
74 |
|
@@ -76,7 +78,7 @@ msgstr "Ein Minimalsatz von Genehmigungen wird beibehalten."
|
|
76 |
msgid "Access Groups"
|
77 |
msgstr "Zugang zu Groups"
|
78 |
|
79 |
-
#:
|
80 |
msgid "Access Restrictions"
|
81 |
msgstr "Zugangsbeschränkungen"
|
82 |
|
@@ -110,26 +112,26 @@ msgstr "Zugangsbeschränkungen"
|
|
110 |
#: lib/admin/groups-admin-groups-remove.php:181
|
111 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
112 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
113 |
-
#: lib/admin/groups-admin-options.php:39 lib/admin/groups-admin-options.php:
|
114 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
115 |
#: lib/test/groups-tests.php:391
|
116 |
msgid "Access denied."
|
117 |
msgstr "Zugriff verweigert."
|
118 |
|
119 |
-
#: lib/admin/groups-admin-options.php:
|
120 |
msgid "Access restricions"
|
121 |
msgstr "Zugangsbeschränkungen"
|
122 |
|
123 |
-
#:
|
124 |
-
#:
|
125 |
-
#:
|
126 |
-
#:
|
127 |
-
#:
|
128 |
msgid "Access restrictions"
|
129 |
msgstr "Zugangsbeschränkungen"
|
130 |
|
131 |
-
#:
|
132 |
-
#:
|
133 |
msgid "Access restrictions …"
|
134 |
msgstr "Zugangsbeschränkungen …"
|
135 |
|
@@ -152,19 +154,21 @@ msgstr "Neue Gruppe hinzufügen"
|
|
152 |
msgid "Add capability"
|
153 |
msgstr "Neue Kapazität"
|
154 |
|
155 |
-
#:
|
|
|
156 |
msgid "Add restriction"
|
157 |
msgstr "Beschränkung hinzufügen"
|
158 |
|
159 |
-
#: lib/admin/class-groups-admin-users.php:
|
160 |
msgid "Add to group"
|
161 |
msgstr "Zur Gruppe hinzufügen"
|
162 |
|
163 |
-
#: lib/admin/class-groups-admin
|
|
|
164 |
msgid "Add-Ons"
|
165 |
msgstr "Add-Ons"
|
166 |
|
167 |
-
#:
|
168 |
msgid ""
|
169 |
"Adding the group and capability manually and enabling it for access "
|
170 |
"restriction"
|
@@ -180,11 +184,11 @@ msgstr "Groups Verwalten"
|
|
180 |
msgid "Administer Groups plugin options"
|
181 |
msgstr "Groups Plugin Optionen verwalten"
|
182 |
|
183 |
-
#: lib/admin/groups-admin-options.php:
|
184 |
msgid "Administrator Access Override"
|
185 |
msgstr "Administrator-Zugriffsüberbrückung"
|
186 |
|
187 |
-
#: lib/admin/groups-admin-options.php:
|
188 |
msgid ""
|
189 |
"Administrators override all access permissions derived from Groups "
|
190 |
"capabilities."
|
@@ -192,7 +196,34 @@ msgstr ""
|
|
192 |
"Verwalter (mit der Administrator Rolle) können alle Zugriffsrechte "
|
193 |
"überbrücken."
|
194 |
|
195 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
#: lib/admin/groups-admin-capabilities.php:334
|
197 |
#: lib/admin/groups-admin-capabilities.php:360
|
198 |
#: lib/admin/groups-admin-capabilities.php:374
|
@@ -201,7 +232,7 @@ msgstr ""
|
|
201 |
msgid "Apply"
|
202 |
msgstr "Anwenden"
|
203 |
|
204 |
-
#:
|
205 |
msgid ""
|
206 |
"Become a member of the <em>Premium</em> group - this is required so you can "
|
207 |
"choose the <em>premium</em> capability to restrict access to a post."
|
@@ -215,7 +246,7 @@ msgstr ""
|
|
215 |
msgid "Bulk Actions"
|
216 |
msgstr "Aktion wählen"
|
217 |
|
218 |
-
#: lib/admin/groups-admin-options.php:
|
219 |
msgid ""
|
220 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
221 |
"plugin settings and data will be DELETED for <strong>all sites</strong>. If "
|
@@ -231,7 +262,7 @@ msgstr ""
|
|
231 |
"verantwortlich für etwaige Datenverluste sowie jede weitere Konsequenzen zu "
|
232 |
"sein."
|
233 |
|
234 |
-
#: lib/admin/groups-admin-options.php:
|
235 |
msgid ""
|
236 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
237 |
"plugin settings and data will be DELETED. If you are going to use this "
|
@@ -257,12 +288,12 @@ msgstr ""
|
|
257 |
msgid "Cancel"
|
258 |
msgstr "Abbrechen"
|
259 |
|
|
|
260 |
#: lib/admin/class-groups-admin.php:195
|
261 |
#: lib/admin/groups-admin-capabilities.php:192
|
262 |
#: lib/admin/groups-admin-groups-add.php:97
|
263 |
#: lib/admin/groups-admin-groups-edit.php:117
|
264 |
-
#: lib/admin/groups-admin-groups.php:306 lib/
|
265 |
-
#: lib/core/class-groups-help.php:71
|
266 |
msgid "Capabilities"
|
267 |
msgstr "Kapazitäten"
|
268 |
|
@@ -286,8 +317,13 @@ msgstr "Kapazität : %s"
|
|
286 |
msgid "Capability ID"
|
287 |
msgstr "Kapazitäts-ID"
|
288 |
|
289 |
-
#: lib/admin/class-groups-admin-posts.php:
|
290 |
-
#: lib/admin/class-groups-admin-posts.php:
|
|
|
|
|
|
|
|
|
|
|
291 |
msgid "Choose access restrictions …"
|
292 |
msgstr "Zugriffsbeschränkungen auswählen …"
|
293 |
|
@@ -296,15 +332,19 @@ msgstr "Zugriffsbeschränkungen auswählen …"
|
|
296 |
msgid "Choose capabilities …"
|
297 |
msgstr "Kapazitäten auswählen …"
|
298 |
|
299 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
300 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
301 |
-
#: lib/admin/class-groups-admin-
|
302 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
303 |
msgid "Choose groups …"
|
304 |
msgstr "Gruppen auswählen …"
|
305 |
|
306 |
-
#:
|
307 |
-
#:
|
308 |
msgid ""
|
309 |
"Choose one or more capabilities to restrict access. Groups that grant access "
|
310 |
"through the capabilities are shown in parenthesis. If no capabilities are "
|
@@ -317,6 +357,15 @@ msgstr ""
|
|
317 |
"Instant-Kästchen verwenden, um eine Gruppe und zugehörige Kapazität spontan "
|
318 |
"zu erstellen."
|
319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
#: lib/admin/groups-admin-capabilities.php:335
|
321 |
#: lib/admin/groups-admin-groups.php:324
|
322 |
msgid "Clear"
|
@@ -334,23 +383,23 @@ msgstr "Klicken um eine neue Gruppe zu erstellen"
|
|
334 |
msgid "Click to refresh capabilities"
|
335 |
msgstr "Klicken um die Kapazitäten zu aktualisieren"
|
336 |
|
337 |
-
#:
|
338 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
339 |
msgstr ""
|
340 |
"Klicken zum Umschalten, ob gewährende Gruppen zu den Kapazitäten angezeigt "
|
341 |
"werden."
|
342 |
|
343 |
-
#: lib/admin/groups-admin-options.php:
|
344 |
msgid "Deactivation and data persistence"
|
345 |
msgstr "Deaktivierung und Datenpersistenz"
|
346 |
|
347 |
-
#: lib/admin/groups-admin-options.php:
|
348 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
349 |
msgstr ""
|
350 |
"Alle Daten des Groups Plugins für ALLE Sites bei Netzwerkdeaktivierung "
|
351 |
"löschen"
|
352 |
|
353 |
-
#: lib/admin/groups-admin-options.php:
|
354 |
msgid "Delete all Groups plugin data on deactivation"
|
355 |
msgstr "Alle Daten des Groups Plugins bei deaktivierung löschen"
|
356 |
|
@@ -363,7 +412,7 @@ msgstr "Alle Daten des Groups Plugins bei deaktivierung löschen"
|
|
363 |
msgid "Description"
|
364 |
msgstr "Beschreibung"
|
365 |
|
366 |
-
#: lib/admin/groups-admin-options.php:
|
367 |
msgid ""
|
368 |
"Disabling this setting for a post type does not remove existing access "
|
369 |
"restrictions on individual posts of that type."
|
@@ -385,7 +434,7 @@ msgstr "Kapazität bearbeiten"
|
|
385 |
msgid "Edit a group"
|
386 |
msgstr "Gruppe bearbeiten"
|
387 |
|
388 |
-
#:
|
389 |
msgid ""
|
390 |
"Edit the post for which you want to restrict access and choose<sup>*</sup> "
|
391 |
"the <em>premium</em> capability."
|
@@ -393,12 +442,16 @@ msgstr ""
|
|
393 |
"Bearbeiten Sie den Beitrag für den Sie Zugang beschränken möchten und "
|
394 |
"wählen<sup>*</sup> Sie die <em>premium</em> Kapazität aus."
|
395 |
|
396 |
-
#: lib/
|
397 |
-
|
|
|
|
|
|
|
|
|
398 |
msgid "Enforce read access"
|
399 |
msgstr "Lesezugriff beschränken"
|
400 |
|
401 |
-
#: lib/admin/groups-admin-options.php:
|
402 |
msgid ""
|
403 |
"Enhanced functionality is available via official <a href=\"http://www."
|
404 |
"itthinx.com/shop/\">Extensions</a> for Groups."
|
@@ -406,7 +459,7 @@ msgstr ""
|
|
406 |
"Zusätzliche Leistungsmerkmale sind erhältlich über offizielle <a href="
|
407 |
"\"http://www.itthinx.com/shop/\">Erweiterungen</a> für Groups."
|
408 |
|
409 |
-
#:
|
410 |
msgid ""
|
411 |
"Enter <em>Premium</em> in the quick-create field located in the Access "
|
412 |
"restrictions panel and save or update the post (or hit Enter)."
|
@@ -415,16 +468,21 @@ msgstr ""
|
|
415 |
"Schaltfläche der Zugangsbeschränkungen befindet, Speichern bzw. "
|
416 |
"Aktualisieren Sie den Beitrag."
|
417 |
|
418 |
-
#:
|
|
|
419 |
msgid "Example:"
|
420 |
msgstr "Beispiel:"
|
421 |
|
|
|
|
|
|
|
|
|
422 |
#: lib/admin/groups-admin-capabilities.php:324
|
423 |
#: lib/admin/groups-admin-groups.php:315
|
424 |
msgid "Filters"
|
425 |
msgstr "Filter"
|
426 |
|
427 |
-
#:
|
428 |
msgid ""
|
429 |
"Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> "
|
430 |
"capability."
|
@@ -432,14 +490,14 @@ msgstr ""
|
|
432 |
"Gehen Sie auf <strong>Groups > Kapazitäten</strong> und fügen Sie die "
|
433 |
"Kapazität <em>premium</em> hinzu."
|
434 |
|
435 |
-
#:
|
436 |
msgid ""
|
437 |
"Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group."
|
438 |
msgstr ""
|
439 |
"Gehen Sie auf <strong>Groups > Gruppen</strong> und fügen Sie die Gruppe "
|
440 |
"<em>Premium</em> hinzu."
|
441 |
|
442 |
-
#:
|
443 |
msgid ""
|
444 |
"Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> "
|
445 |
"capability to the <em>Premium</em> group."
|
@@ -447,7 +505,7 @@ msgstr ""
|
|
447 |
"Gehen Sie auf <strong>Groups > Gruppen</strong> und weisen Sie die Kapazität "
|
448 |
"<em>premium</em> der Gruppe <em>Premium</em> zu."
|
449 |
|
450 |
-
#:
|
451 |
msgid ""
|
452 |
"Go to <strong>Groups > Options</strong> and enable the <em>premium</em> "
|
453 |
"capability to restrict access."
|
@@ -459,7 +517,7 @@ msgstr ""
|
|
459 |
msgid "Group"
|
460 |
msgstr "Gruppe"
|
461 |
|
462 |
-
#: lib/admin/class-groups-admin-users.php:
|
463 |
msgid "Group Actions"
|
464 |
msgstr "Gruppenaktionen"
|
465 |
|
@@ -476,15 +534,30 @@ msgstr "Gruppenname"
|
|
476 |
msgid "Group Name : %s"
|
477 |
msgstr "Gruppenname : %s"
|
478 |
|
479 |
-
#: lib/
|
480 |
-
#: lib/
|
481 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
482 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
483 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
484 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
485 |
msgid "Groups"
|
486 |
msgstr "Groups"
|
487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
#: lib/admin/class-groups-admin.php:140
|
489 |
msgctxt "menu item title"
|
490 |
msgid "Groups"
|
@@ -495,6 +568,20 @@ msgctxt "page-title"
|
|
495 |
msgid "Groups"
|
496 |
msgstr "Gruppen"
|
497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
#: lib/admin/class-groups-admin.php:220
|
499 |
msgid "Groups Add-Ons"
|
500 |
msgstr "Groups Add-Ons"
|
@@ -503,11 +590,11 @@ msgstr "Groups Add-Ons"
|
|
503 |
msgid "Groups Capabilities"
|
504 |
msgstr "Gruppenkapazitäten"
|
505 |
|
506 |
-
#: lib/admin/groups-admin-options.php:
|
507 |
msgid "Groups Options"
|
508 |
msgstr "Groups Optionen"
|
509 |
|
510 |
-
#: lib/admin/groups-admin-options.php:
|
511 |
msgid "Groups network options"
|
512 |
msgstr "Groups Netzwerkoptionen"
|
513 |
|
@@ -528,13 +615,57 @@ msgstr ""
|
|
528 |
msgid "ID"
|
529 |
msgstr "ID"
|
530 |
|
531 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
msgid "If you lock yourself out, please ask an administrator to help."
|
533 |
msgstr ""
|
534 |
"Sollten Sie sich selbst ausschließen, so fragen Sie bitte einen Verwalter "
|
535 |
"nach Hilfe."
|
536 |
|
537 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
msgid ""
|
539 |
"Include these capabilities to enforce read access on posts. The selected "
|
540 |
"capabilities will be offered to restrict access to posts."
|
@@ -547,6 +678,14 @@ msgstr ""
|
|
547 |
msgid "Inherited capabilities:"
|
548 |
msgstr "Geerbte Kapazitäten:"
|
549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
550 |
#: lib/views/class-groups-shortcodes.php:469
|
551 |
#, php-format
|
552 |
msgid "Join the %s group"
|
@@ -557,7 +696,12 @@ msgstr "Der Gruppe %s beitreten"
|
|
557 |
msgid "Leave the %s group"
|
558 |
msgstr "Die Gruppe %s verlassen"
|
559 |
|
560 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
561 |
msgid ""
|
562 |
"Let's assume that you want to limit the visibility of a post to members of "
|
563 |
"the <em>Premium</em> group."
|
@@ -569,12 +713,13 @@ msgstr ""
|
|
569 |
msgid "Log out"
|
570 |
msgstr "Abmelden"
|
571 |
|
572 |
-
#:
|
|
|
573 |
msgid "Media"
|
574 |
msgstr "Medien"
|
575 |
|
576 |
-
#:
|
577 |
-
#:
|
578 |
#, php-format
|
579 |
msgid "Members of the %1$s group can access this %2$s through this capability."
|
580 |
msgid_plural ""
|
@@ -591,7 +736,7 @@ msgstr[1] ""
|
|
591 |
msgid "Name"
|
592 |
msgstr "Name"
|
593 |
|
594 |
-
#: lib/admin/groups-admin-options.php:
|
595 |
msgid "Network deactivation and data persistence"
|
596 |
msgstr "Netzwerkdeaktivation und Datenpersistenz"
|
597 |
|
@@ -599,12 +744,16 @@ msgstr "Netzwerkdeaktivation und Datenpersistenz"
|
|
599 |
msgid "New Capability"
|
600 |
msgstr "Neue Kapazität"
|
601 |
|
|
|
|
|
|
|
|
|
602 |
#: lib/admin/groups-admin-groups.php:212
|
603 |
msgid "New Group"
|
604 |
msgstr "Neue Gruppe"
|
605 |
|
606 |
-
#:
|
607 |
-
#:
|
608 |
msgid ""
|
609 |
"No groups grant access through this capability. To grant access to group "
|
610 |
"members using this capability, you should assign it to a group and enable "
|
@@ -636,7 +785,7 @@ msgstr "Diese Gruppe ist nicht vorhanden."
|
|
636 |
msgid "No such groups."
|
637 |
msgstr "Solche Gruppen sind nicht vorhanden."
|
638 |
|
639 |
-
#:
|
640 |
msgid ""
|
641 |
"Note that you must be a member of a group that has such a capability "
|
642 |
"assigned."
|
@@ -644,6 +793,37 @@ msgstr ""
|
|
644 |
"Beachten Sie, dass Sie Mitglied einer Gruppe die diese Kapazität hat sein "
|
645 |
"müssen."
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
#: lib/admin/groups-admin-capabilities.php:121
|
648 |
#, php-format
|
649 |
msgid "One capability has been added."
|
@@ -651,12 +831,16 @@ msgid_plural "%d capabilities have been added."
|
|
651 |
msgstr[0] "Eine Kapazität wurde hinzugefügt."
|
652 |
msgstr[1] "%d Kapazitäten wurden hinzugefügt."
|
653 |
|
654 |
-
#:
|
655 |
msgid "One or more capabilities required to read the entry."
|
656 |
msgstr "Eine oder mehr Kapazitäten sind benötigt um den Beitrag zu lesen."
|
657 |
|
658 |
-
#: lib/
|
659 |
-
|
|
|
|
|
|
|
|
|
660 |
#, php-format
|
661 |
msgid ""
|
662 |
"Only groups or users that have one of the selected capabilities are allowed "
|
@@ -670,7 +854,7 @@ msgstr ""
|
|
670 |
msgid "Options"
|
671 |
msgstr "Optionen"
|
672 |
|
673 |
-
#: lib/admin/groups-admin-options.php:
|
674 |
msgid "Options saved."
|
675 |
msgstr "Optionen gespeichert."
|
676 |
|
@@ -679,7 +863,12 @@ msgstr "Optionen gespeichert."
|
|
679 |
msgid "Parent"
|
680 |
msgstr "Vorläufer"
|
681 |
|
682 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
683 |
msgid "Permissions"
|
684 |
msgstr "Berechtigungen"
|
685 |
|
@@ -707,27 +896,64 @@ msgstr ""
|
|
707 |
"Bitte geben Sie eine <a style=\"text-decoration:none;\" href=\"%s\">★"
|
708 |
"★★★★</a> Bewertung ab!"
|
709 |
|
710 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
711 |
msgid "Post"
|
712 |
msgstr "Beitrag"
|
713 |
|
714 |
-
#: lib/admin/groups-admin-options.php:
|
715 |
msgid "Post types"
|
716 |
msgstr "Beitragstypen"
|
717 |
|
718 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
msgid "Quick-create group & capability"
|
720 |
msgstr "Instant Gruppe & Kapazität"
|
721 |
|
722 |
-
#: lib/access/class-groups-
|
|
|
|
|
|
|
|
|
|
|
723 |
msgid "Read Post"
|
724 |
msgstr "Beitrag Lesen"
|
725 |
|
726 |
-
#: lib/admin/groups-admin-add-ons.php:
|
727 |
msgid "Recommended extensions for Groups"
|
728 |
msgstr "Empfohlene Erweiterungen für Groups"
|
729 |
|
730 |
-
#: lib/admin/groups-admin-add-ons.php:
|
731 |
msgid "Recommended plugins by itthinx"
|
732 |
msgstr "Empfohlene Plugins von itthinx"
|
733 |
|
@@ -766,7 +992,7 @@ msgstr "Kapazitäten löschen"
|
|
766 |
msgid "Remove capability"
|
767 |
msgstr "Kapazität löschen"
|
768 |
|
769 |
-
#: lib/admin/class-groups-admin-users.php:
|
770 |
msgid "Remove from group"
|
771 |
msgstr "Von der Gruppe entfernen"
|
772 |
|
@@ -778,43 +1004,69 @@ msgstr "Gruppe entfernen"
|
|
778 |
msgid "Remove groups"
|
779 |
msgstr "Gruppen entfernen"
|
780 |
|
781 |
-
#:
|
|
|
782 |
msgid "Remove restriction"
|
783 |
msgstr "Beschränkung entfernen"
|
784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
#: lib/admin/groups-admin-capabilities.php:357
|
786 |
#: lib/admin/groups-admin-groups.php:346
|
787 |
msgid "Results per page"
|
788 |
msgstr "Ergebnisse pro Seite"
|
789 |
|
790 |
-
#: lib/admin/groups-admin-options.php:
|
791 |
msgid "Role"
|
792 |
msgstr "Rolle"
|
793 |
|
794 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
795 |
#: lib/admin/groups-admin-groups-edit.php:158
|
796 |
-
#: lib/admin/groups-admin-options.php:
|
797 |
-
#: lib/admin/groups-admin-options.php:
|
798 |
-
#: lib/admin/groups-admin-options.php:
|
799 |
msgid "Save"
|
800 |
msgstr "Speichern"
|
801 |
|
802 |
-
#: lib/admin/groups-admin-options.php:
|
803 |
msgid "Show access restrictions for these post types."
|
804 |
msgstr "Zugangsbeschränkungen für diese Beitragstypen zeigen."
|
805 |
|
806 |
-
#:
|
807 |
msgid "Show groups"
|
808 |
msgstr "Gruppen zeigen"
|
809 |
|
810 |
-
#: lib/admin/groups-admin-options.php:
|
811 |
msgid "Show groups in user profiles."
|
812 |
msgstr "Gruppen in Benutzerprofilen zeigen"
|
813 |
|
814 |
-
#: lib/admin/groups-admin-options.php:
|
815 |
msgid "Show the Groups tree view."
|
816 |
msgstr "Die Baumansicht von Groups anzeigen."
|
817 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
818 |
#: lib/core/class-groups-help.php:141
|
819 |
msgid ""
|
820 |
"Thank you for using <a href=\"http://www.itthinx.com/plugins/groups\" target="
|
@@ -825,6 +1077,14 @@ msgstr ""
|
|
825 |
"target=\"_blank\">Groups</a> von <a href=\"http://www.itthinx.com\" target="
|
826 |
"\"_blank\">itthinx</a>."
|
827 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
828 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
829 |
#, php-format
|
830 |
msgid ""
|
@@ -901,11 +1161,16 @@ msgstr ""
|
|
901 |
"Die vollständige Dokumentation ist auf den <a href=\"http://docs.itthinx.com/"
|
902 |
"document/groups\">Documentation</a>-Seiten für Groups erhältlich."
|
903 |
|
|
|
|
|
|
|
|
|
|
|
904 |
#: lib/admin/groups-admin-groups.php:76
|
905 |
msgid "The group has been deleted."
|
906 |
msgstr "Die Gruppe wurde gelöscht."
|
907 |
|
908 |
-
#:
|
909 |
msgid "The manual way:"
|
910 |
msgstr "Der manuelle Weg:"
|
911 |
|
@@ -913,11 +1178,12 @@ msgstr "Der manuelle Weg:"
|
|
913 |
msgid "The name must not be empty."
|
914 |
msgstr "Der Name darf nicht leer sein."
|
915 |
|
916 |
-
#:
|
917 |
msgid "The quick way:"
|
918 |
msgstr "Der schnelle Weg:"
|
919 |
|
920 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
|
|
921 |
msgid "The user is a member of the chosen groups."
|
922 |
msgstr "Der Benutzer ist Mitglied der ausgewählten Gruppen."
|
923 |
|
@@ -930,7 +1196,7 @@ msgstr "Es liegen keine Resultate vor."
|
|
930 |
msgid "These capabilities will be assigned to the group."
|
931 |
msgstr "Diese Kapazitäten werden der Gruppe zugewiesen."
|
932 |
|
933 |
-
#: lib/admin/groups-admin-options.php:
|
934 |
msgid ""
|
935 |
"These permissions apply to Groups management. They do not apply to access "
|
936 |
"permissions derived from Groups capabilities."
|
@@ -938,7 +1204,11 @@ msgstr ""
|
|
938 |
"Diese Berechtigungen dienen der Verwaltung von Groups. Sie finden keine "
|
939 |
"Anwendung bei Berechtigungen die von Groups Kapazitäten abgeleitet werden."
|
940 |
|
941 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
942 |
msgid ""
|
943 |
"This determines for which post types access restriction settings are offered."
|
944 |
msgstr ""
|
@@ -949,6 +1219,40 @@ msgstr ""
|
|
949 |
msgid "This group has no capabilities."
|
950 |
msgstr "Diese Gruppe hat keine Kapazitäten."
|
951 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
953 |
msgid "Tree"
|
954 |
msgstr "Baum"
|
@@ -957,11 +1261,11 @@ msgstr "Baum"
|
|
957 |
msgid "Tree of Groups"
|
958 |
msgstr "Gruppenbaum"
|
959 |
|
960 |
-
#: lib/admin/groups-admin-options.php:
|
961 |
msgid "Tree view"
|
962 |
msgstr "Baumansicht"
|
963 |
|
964 |
-
#:
|
965 |
msgid ""
|
966 |
"Try the quick-create field first. Unless you need a more complex setup, "
|
967 |
"there is no reason to go this way instead."
|
@@ -969,13 +1273,13 @@ msgstr ""
|
|
969 |
"Probieren Sie das Instant-Feld zuerst aus. Es gibt keinen Grund diesen Weg "
|
970 |
"zu gehen, ausser Sie benötigen eine komplexere Einrichtung."
|
971 |
|
972 |
-
#:
|
973 |
-
#:
|
974 |
-
#:
|
975 |
msgid "Type and choose …"
|
976 |
msgstr "Tippen und wählen …"
|
977 |
|
978 |
-
#:
|
979 |
msgid ""
|
980 |
"Use the <em>Access restrictions</em> box to limit the visibility of posts, "
|
981 |
"pages and other post types."
|
@@ -983,15 +1287,23 @@ msgstr ""
|
|
983 |
"Verwenden Sie das Kästchen <em>Zugangsbeschränkungen</em> um die "
|
984 |
"Sichtbarkeit von Beiträgen, Seiten und anderen Beitragstypen einzuschränken."
|
985 |
|
986 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
msgid "User profiles"
|
988 |
msgstr "Benutzerprofile"
|
989 |
|
990 |
-
#:
|
991 |
msgid "Using the quick-create field"
|
992 |
msgstr "Verwendung des Instant-Feldes"
|
993 |
|
994 |
-
#:
|
995 |
msgid ""
|
996 |
"Using the quick-create field, you can create a new group and capability. The "
|
997 |
"capability will be assigned to the group and enabled to enforce read access. "
|
@@ -1012,12 +1324,65 @@ msgstr ""
|
|
1012 |
"Zugriffsbeschränkung aktiviert. Um die Kapazität verwenden zu können, wird "
|
1013 |
"ihr Benutzerkonto der Gruppe hinzugefügt."
|
1014 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1015 |
#: lib/views/class-groups-shortcodes.php:527
|
1016 |
#, php-format
|
1017 |
msgid "You are a member of the %s group."
|
1018 |
msgstr "Sie sind Mitglied der Gruppe %s."
|
1019 |
|
1020 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
msgid ""
|
1022 |
"You can create a new group and capability here. The capability will be "
|
1023 |
"assigned to the group and enabled to enforce read access. Group names are "
|
@@ -1038,7 +1403,33 @@ msgstr ""
|
|
1038 |
"aktiviert. Um die Kapazität verwenden zu können, wird ihr Benutzerkonto der "
|
1039 |
"Gruppe hinzugefügt."
|
1040 |
|
1041 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1042 |
msgid ""
|
1043 |
"You can select one or more capabilities that are enabled for access "
|
1044 |
"restriction."
|
@@ -1046,7 +1437,14 @@ msgstr ""
|
|
1046 |
"Sie können eine oder mehrere Kapazitäten auswählen die zur "
|
1047 |
"Zugriffsbeschränkung aktiviert sind."
|
1048 |
|
1049 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1050 |
msgid "You cannot set any access restrictions."
|
1051 |
msgstr "Sie können keine Zugriffsbeschränkungen setzen."
|
1052 |
|
@@ -1060,7 +1458,7 @@ msgstr "Sie sind der Gruppe %s beigetreten."
|
|
1060 |
msgid "You have left the %s group."
|
1061 |
msgstr "Sie haben die Gruppe %s verlassen."
|
1062 |
|
1063 |
-
#:
|
1064 |
msgid ""
|
1065 |
"You must be in a group that has at least one capability enabled to enforce "
|
1066 |
"read access."
|
@@ -1068,6 +1466,20 @@ msgstr ""
|
|
1068 |
"Sie müssen in einer Gruppe sein die zumindest eine Kapazität hat die zur "
|
1069 |
"Zugriffsbeschränkung aktiviert ist."
|
1070 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
#~ msgid "Capability Id"
|
1072 |
#~ msgstr "Kapazitäts-Id"
|
1073 |
|
7 |
msgstr ""
|
8 |
"Project-Id-Version: \n"
|
9 |
"Report-Msgid-Bugs-To: \n"
|
10 |
+
"POT-Creation-Date: 2017-01-26 20:58+0100\n"
|
11 |
+
"PO-Revision-Date: 2017-01-26 20:58+0100\n"
|
12 |
+
"Last-Translator: Karim\n"
|
13 |
"Language-Team: itthinx.com\n"
|
14 |
"Language: de_DE\n"
|
15 |
"MIME-Version: 1.0\n"
|
16 |
"Content-Type: text/plain; charset=UTF-8\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
+
"X-Generator: Poedit 1.8.11\n"
|
20 |
|
21 |
#: lib/core/class-groups-pagination.php:140
|
22 |
#, php-format
|
24 |
msgid "%1$s of %2$s"
|
25 |
msgstr "%1$s von %2$s"
|
26 |
|
27 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:184
|
28 |
+
#: lib/admin/class-groups-admin-posts.php:207
|
29 |
msgid "— No Change —"
|
30 |
msgstr "— Ohne Änderung —"
|
31 |
|
32 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:136
|
33 |
+
#: lib/admin/class-groups-admin-posts.php:148
|
34 |
msgid "(only unrestricted)"
|
35 |
msgstr "(ohne Beschränkung)"
|
36 |
|
37 |
+
#: lib/admin/class-groups-admin-users.php:374
|
38 |
msgid "--"
|
39 |
msgstr "--"
|
40 |
|
45 |
msgstr[0] "1 Element"
|
46 |
msgstr[1] "%s Elemente"
|
47 |
|
48 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:76
|
49 |
#, php-format
|
50 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
51 |
msgstr "<span title=\"%s\">Zugangsbeschränkungen</span>"
|
56 |
msgid "<strong>%s</strong>"
|
57 |
msgstr "<strong>%s</strong>"
|
58 |
|
59 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:164
|
60 |
msgid ""
|
61 |
"<sup>*</sup> For each capability, the groups that have the capability "
|
62 |
"assigned are shown within parenthesis. You can choose a capability by typing "
|
70 |
msgid "A Duck!"
|
71 |
msgstr "Eine Ente!"
|
72 |
|
73 |
+
#: lib/admin/groups-admin-options.php:269
|
74 |
msgid "A minimum set of permissions will be preserved."
|
75 |
msgstr "Ein Minimalsatz von Genehmigungen wird beibehalten."
|
76 |
|
78 |
msgid "Access Groups"
|
79 |
msgstr "Zugang zu Groups"
|
80 |
|
81 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:181
|
82 |
msgid "Access Restrictions"
|
83 |
msgstr "Zugangsbeschränkungen"
|
84 |
|
112 |
#: lib/admin/groups-admin-groups-remove.php:181
|
113 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
114 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
115 |
+
#: lib/admin/groups-admin-options.php:39 lib/admin/groups-admin-options.php:317
|
116 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
117 |
#: lib/test/groups-tests.php:391
|
118 |
msgid "Access denied."
|
119 |
msgstr "Zugriff verweigert."
|
120 |
|
121 |
+
#: lib/admin/groups-admin-options.php:214
|
122 |
msgid "Access restricions"
|
123 |
msgstr "Zugangsbeschränkungen"
|
124 |
|
125 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:97
|
126 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:107
|
127 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:121
|
128 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:124
|
129 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:592
|
130 |
msgid "Access restrictions"
|
131 |
msgstr "Zugangsbeschränkungen"
|
132 |
|
133 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:124
|
134 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:125
|
135 |
msgid "Access restrictions …"
|
136 |
msgstr "Zugangsbeschränkungen …"
|
137 |
|
154 |
msgid "Add capability"
|
155 |
msgstr "Neue Kapazität"
|
156 |
|
157 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:185
|
158 |
+
#: lib/admin/class-groups-admin-posts.php:208
|
159 |
msgid "Add restriction"
|
160 |
msgstr "Beschränkung hinzufügen"
|
161 |
|
162 |
+
#: lib/admin/class-groups-admin-users.php:212
|
163 |
msgid "Add to group"
|
164 |
msgstr "Zur Gruppe hinzufügen"
|
165 |
|
166 |
+
#: lib/admin/class-groups-admin-welcome.php:214
|
167 |
+
#: lib/admin/class-groups-admin.php:221 lib/admin/groups-admin-add-ons.php:32
|
168 |
msgid "Add-Ons"
|
169 |
msgstr "Add-Ons"
|
170 |
|
171 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:150
|
172 |
msgid ""
|
173 |
"Adding the group and capability manually and enabling it for access "
|
174 |
"restriction"
|
184 |
msgid "Administer Groups plugin options"
|
185 |
msgstr "Groups Plugin Optionen verwalten"
|
186 |
|
187 |
+
#: lib/admin/groups-admin-options.php:206
|
188 |
msgid "Administrator Access Override"
|
189 |
msgstr "Administrator-Zugriffsüberbrückung"
|
190 |
|
191 |
+
#: lib/admin/groups-admin-options.php:210
|
192 |
msgid ""
|
193 |
"Administrators override all access permissions derived from Groups "
|
194 |
"capabilities."
|
196 |
"Verwalter (mit der Administrator Rolle) können alle Zugriffsrechte "
|
197 |
"überbrücken."
|
198 |
|
199 |
+
#: lib/admin/class-groups-admin-posts.php:165
|
200 |
+
msgid "Also look for groups related to terms"
|
201 |
+
msgstr "Auch Gruppen beinhalten die auf Begriffe bezogen sind"
|
202 |
+
|
203 |
+
#: lib/admin/class-groups-admin-welcome.php:167
|
204 |
+
msgid ""
|
205 |
+
"And you can now filter the list of users by one or multiple groups with one "
|
206 |
+
"convenient field."
|
207 |
+
msgstr ""
|
208 |
+
"Und man kann jetzt die Liste der Benutzer mittels einem praktischen Feld "
|
209 |
+
"nach einer oder mehreren Gruppen filtern."
|
210 |
+
|
211 |
+
#: lib/admin/class-groups-admin-welcome.php:165
|
212 |
+
msgid ""
|
213 |
+
"Another improvement is better filtering by groups and a reduced footprint on "
|
214 |
+
"the Users admin screen."
|
215 |
+
msgstr ""
|
216 |
+
"Weitere Verbesserungen umschließen Gruppenfilter und einen reduzierten "
|
217 |
+
"Eindruck bei der Benutzerverwaltung."
|
218 |
+
|
219 |
+
#: lib/access/class-groups-access-meta-boxes.php:206
|
220 |
+
#: lib/access/class-groups-access-meta-boxes.php:207
|
221 |
+
#: lib/access/class-groups-access-meta-boxes.php:441
|
222 |
+
#: lib/access/class-groups-access-meta-boxes.php:442
|
223 |
+
msgid "Anyone …"
|
224 |
+
msgstr "Jeder …"
|
225 |
+
|
226 |
+
#: lib/admin/class-groups-admin-users.php:215
|
227 |
#: lib/admin/groups-admin-capabilities.php:334
|
228 |
#: lib/admin/groups-admin-capabilities.php:360
|
229 |
#: lib/admin/groups-admin-capabilities.php:374
|
232 |
msgid "Apply"
|
233 |
msgstr "Anwenden"
|
234 |
|
235 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:160
|
236 |
msgid ""
|
237 |
"Become a member of the <em>Premium</em> group - this is required so you can "
|
238 |
"choose the <em>premium</em> capability to restrict access to a post."
|
246 |
msgid "Bulk Actions"
|
247 |
msgstr "Aktion wählen"
|
248 |
|
249 |
+
#: lib/admin/groups-admin-options.php:351
|
250 |
msgid ""
|
251 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
252 |
"plugin settings and data will be DELETED for <strong>all sites</strong>. If "
|
262 |
"verantwortlich für etwaige Datenverluste sowie jede weitere Konsequenzen zu "
|
263 |
"sein."
|
264 |
|
265 |
+
#: lib/admin/groups-admin-options.php:283
|
266 |
msgid ""
|
267 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
268 |
"plugin settings and data will be DELETED. If you are going to use this "
|
288 |
msgid "Cancel"
|
289 |
msgstr "Abbrechen"
|
290 |
|
291 |
+
#: legacy/admin/groups-admin-options-legacy.php:58
|
292 |
#: lib/admin/class-groups-admin.php:195
|
293 |
#: lib/admin/groups-admin-capabilities.php:192
|
294 |
#: lib/admin/groups-admin-groups-add.php:97
|
295 |
#: lib/admin/groups-admin-groups-edit.php:117
|
296 |
+
#: lib/admin/groups-admin-groups.php:306 lib/core/class-groups-help.php:71
|
|
|
297 |
msgid "Capabilities"
|
298 |
msgstr "Kapazitäten"
|
299 |
|
317 |
msgid "Capability ID"
|
318 |
msgstr "Kapazitäts-ID"
|
319 |
|
320 |
+
#: lib/admin/class-groups-admin-posts.php:221
|
321 |
+
#: lib/admin/class-groups-admin-posts.php:222
|
322 |
+
msgid "Choose access restriction groups …"
|
323 |
+
msgstr "Gruppen für Zugriffsbeschränkungen auswählen …"
|
324 |
+
|
325 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:195
|
326 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:196
|
327 |
msgid "Choose access restrictions …"
|
328 |
msgstr "Zugriffsbeschränkungen auswählen …"
|
329 |
|
332 |
msgid "Choose capabilities …"
|
333 |
msgstr "Kapazitäten auswählen …"
|
334 |
|
335 |
+
#: lib/admin/class-groups-admin-user-profile.php:80
|
336 |
+
#: lib/admin/class-groups-admin-user-profile.php:81
|
337 |
+
#: lib/admin/class-groups-admin-user-profile.php:167
|
338 |
+
#: lib/admin/class-groups-admin-user-profile.php:168
|
339 |
+
#: lib/admin/class-groups-admin-users.php:190
|
340 |
+
#: lib/admin/class-groups-admin-users.php:191
|
341 |
+
#: lib/admin/class-groups-admin-users.php:251
|
342 |
+
#: lib/admin/class-groups-admin-users.php:252
|
343 |
msgid "Choose groups …"
|
344 |
msgstr "Gruppen auswählen …"
|
345 |
|
346 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:214
|
347 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:541
|
348 |
msgid ""
|
349 |
"Choose one or more capabilities to restrict access. Groups that grant access "
|
350 |
"through the capabilities are shown in parenthesis. If no capabilities are "
|
357 |
"Instant-Kästchen verwenden, um eine Gruppe und zugehörige Kapazität spontan "
|
358 |
"zu erstellen."
|
359 |
|
360 |
+
#: lib/access/class-groups-access-meta-boxes.php:132
|
361 |
+
msgid ""
|
362 |
+
"Choose or enter <em>Premium</em> in the <em>Read</em> field located in the "
|
363 |
+
"<em>Groups</em> box and save or update the post (or hit Enter)."
|
364 |
+
msgstr ""
|
365 |
+
"Im Feld <em>Lesen</em> innerhalb der Box <em>Gruppen</em> <em>Premium</em> "
|
366 |
+
"auswählen oder eingeben und den Eintrag speichern oder aktualisieren (oder "
|
367 |
+
"die Eingabetaste betätigen)."
|
368 |
+
|
369 |
#: lib/admin/groups-admin-capabilities.php:335
|
370 |
#: lib/admin/groups-admin-groups.php:324
|
371 |
msgid "Clear"
|
383 |
msgid "Click to refresh capabilities"
|
384 |
msgstr "Klicken um die Kapazitäten zu aktualisieren"
|
385 |
|
386 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:274
|
387 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
388 |
msgstr ""
|
389 |
"Klicken zum Umschalten, ob gewährende Gruppen zu den Kapazitäten angezeigt "
|
390 |
"werden."
|
391 |
|
392 |
+
#: lib/admin/groups-admin-options.php:275
|
393 |
msgid "Deactivation and data persistence"
|
394 |
msgstr "Deaktivierung und Datenpersistenz"
|
395 |
|
396 |
+
#: lib/admin/groups-admin-options.php:348
|
397 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
398 |
msgstr ""
|
399 |
"Alle Daten des Groups Plugins für ALLE Sites bei Netzwerkdeaktivierung "
|
400 |
"löschen"
|
401 |
|
402 |
+
#: lib/admin/groups-admin-options.php:279
|
403 |
msgid "Delete all Groups plugin data on deactivation"
|
404 |
msgstr "Alle Daten des Groups Plugins bei deaktivierung löschen"
|
405 |
|
412 |
msgid "Description"
|
413 |
msgstr "Beschreibung"
|
414 |
|
415 |
+
#: lib/admin/groups-admin-options.php:243
|
416 |
msgid ""
|
417 |
"Disabling this setting for a post type does not remove existing access "
|
418 |
"restrictions on individual posts of that type."
|
434 |
msgid "Edit a group"
|
435 |
msgstr "Gruppe bearbeiten"
|
436 |
|
437 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:161
|
438 |
msgid ""
|
439 |
"Edit the post for which you want to restrict access and choose<sup>*</sup> "
|
440 |
"the <em>premium</em> capability."
|
442 |
"Bearbeiten Sie den Beitrag für den Sie Zugang beschränken möchten und "
|
443 |
"wählen<sup>*</sup> Sie die <em>premium</em> Kapazität aus."
|
444 |
|
445 |
+
#: lib/admin/groups-admin-options.php:292
|
446 |
+
msgid "Enable legacy access control based on capabilities."
|
447 |
+
msgstr "Legacy Zugriffsbeschränkungen basierend auf Kapazitäten aktivieren."
|
448 |
+
|
449 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:204
|
450 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:505
|
451 |
msgid "Enforce read access"
|
452 |
msgstr "Lesezugriff beschränken"
|
453 |
|
454 |
+
#: lib/admin/groups-admin-options.php:189
|
455 |
msgid ""
|
456 |
"Enhanced functionality is available via official <a href=\"http://www."
|
457 |
"itthinx.com/shop/\">Extensions</a> for Groups."
|
459 |
"Zusätzliche Leistungsmerkmale sind erhältlich über offizielle <a href="
|
460 |
"\"http://www.itthinx.com/shop/\">Erweiterungen</a> für Groups."
|
461 |
|
462 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:143
|
463 |
msgid ""
|
464 |
"Enter <em>Premium</em> in the quick-create field located in the Access "
|
465 |
"restrictions panel and save or update the post (or hit Enter)."
|
468 |
"Schaltfläche der Zugangsbeschränkungen befindet, Speichern bzw. "
|
469 |
"Aktualisieren Sie den Beitrag."
|
470 |
|
471 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:135
|
472 |
+
#: lib/access/class-groups-access-meta-boxes.php:126
|
473 |
msgid "Example:"
|
474 |
msgstr "Beispiel:"
|
475 |
|
476 |
+
#: lib/admin/class-groups-admin-users.php:275
|
477 |
+
msgid "Filter"
|
478 |
+
msgstr "Filtern"
|
479 |
+
|
480 |
#: lib/admin/groups-admin-capabilities.php:324
|
481 |
#: lib/admin/groups-admin-groups.php:315
|
482 |
msgid "Filters"
|
483 |
msgstr "Filter"
|
484 |
|
485 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:157
|
486 |
msgid ""
|
487 |
"Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> "
|
488 |
"capability."
|
490 |
"Gehen Sie auf <strong>Groups > Kapazitäten</strong> und fügen Sie die "
|
491 |
"Kapazität <em>premium</em> hinzu."
|
492 |
|
493 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:156
|
494 |
msgid ""
|
495 |
"Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group."
|
496 |
msgstr ""
|
497 |
"Gehen Sie auf <strong>Groups > Gruppen</strong> und fügen Sie die Gruppe "
|
498 |
"<em>Premium</em> hinzu."
|
499 |
|
500 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:158
|
501 |
msgid ""
|
502 |
"Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> "
|
503 |
"capability to the <em>Premium</em> group."
|
505 |
"Gehen Sie auf <strong>Groups > Gruppen</strong> und weisen Sie die Kapazität "
|
506 |
"<em>premium</em> der Gruppe <em>Premium</em> zu."
|
507 |
|
508 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:159
|
509 |
msgid ""
|
510 |
"Go to <strong>Groups > Options</strong> and enable the <em>premium</em> "
|
511 |
"capability to restrict access."
|
517 |
msgid "Group"
|
518 |
msgstr "Gruppe"
|
519 |
|
520 |
+
#: lib/admin/class-groups-admin-users.php:211
|
521 |
msgid "Group Actions"
|
522 |
msgstr "Gruppenaktionen"
|
523 |
|
534 |
msgid "Group Name : %s"
|
535 |
msgstr "Gruppenname : %s"
|
536 |
|
537 |
+
#: lib/access/class-groups-access-meta-boxes.php:112
|
538 |
+
#: lib/access/class-groups-access-meta-boxes.php:115
|
539 |
+
#: lib/access/class-groups-access-meta-boxes.php:463
|
540 |
+
#: lib/admin/class-groups-admin-posts.php:204
|
541 |
+
#: lib/admin/class-groups-admin-user-profile.php:72
|
542 |
+
#: lib/admin/class-groups-admin-user-profile.php:133
|
543 |
+
#: lib/admin/class-groups-admin-user-profile.php:157
|
544 |
+
#: lib/admin/class-groups-admin-users.php:347
|
545 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
546 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
547 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
548 |
msgid "Groups"
|
549 |
msgstr "Groups"
|
550 |
|
551 |
+
#: lib/admin/class-groups-admin-post-columns.php:93
|
552 |
+
msgctxt "Column header"
|
553 |
+
msgid "Groups"
|
554 |
+
msgstr "Gruppen"
|
555 |
+
|
556 |
+
#: lib/access/class-groups-access-meta-boxes.php:98
|
557 |
+
msgctxt "Meta box title"
|
558 |
+
msgid "Groups"
|
559 |
+
msgstr "Gruppen"
|
560 |
+
|
561 |
#: lib/admin/class-groups-admin.php:140
|
562 |
msgctxt "menu item title"
|
563 |
msgid "Groups"
|
568 |
msgid "Groups"
|
569 |
msgstr "Gruppen"
|
570 |
|
571 |
+
#: lib/admin/class-groups-admin-welcome.php:182
|
572 |
+
#, php-format
|
573 |
+
msgid ""
|
574 |
+
"Groups %s features a simpler model for access restrictions based on groups "
|
575 |
+
"instead of capabilities used in previous versions."
|
576 |
+
msgstr ""
|
577 |
+
"Groups %s bietet ein vereinfachtes Model für Zugriffsberechtigungen, "
|
578 |
+
"basierend auf Gruppen anstatt Kapazitäten aus vorigen Versionen."
|
579 |
+
|
580 |
+
#: lib/admin/class-groups-admin-posts.php:136
|
581 |
+
#: lib/admin/class-groups-admin-posts.php:137
|
582 |
+
msgid "Groups …"
|
583 |
+
msgstr "Gruppen …"
|
584 |
+
|
585 |
#: lib/admin/class-groups-admin.php:220
|
586 |
msgid "Groups Add-Ons"
|
587 |
msgstr "Groups Add-Ons"
|
590 |
msgid "Groups Capabilities"
|
591 |
msgstr "Gruppenkapazitäten"
|
592 |
|
593 |
+
#: lib/admin/groups-admin-options.php:129
|
594 |
msgid "Groups Options"
|
595 |
msgstr "Groups Optionen"
|
596 |
|
597 |
+
#: lib/admin/groups-admin-options.php:323
|
598 |
msgid "Groups network options"
|
599 |
msgstr "Groups Netzwerkoptionen"
|
600 |
|
615 |
msgid "ID"
|
616 |
msgstr "ID"
|
617 |
|
618 |
+
#: lib/admin/class-groups-admin-welcome.php:201
|
619 |
+
msgid ""
|
620 |
+
"If you had any access restrictions in place based on capabilities, the "
|
621 |
+
"entries will now be unprotected, unless you enable legacy access "
|
622 |
+
"restrictions or place appropriate access restrictions based on groups on the "
|
623 |
+
"desired entries."
|
624 |
+
msgstr ""
|
625 |
+
"Falls Zugriffsbeschränkungen basierend auf Kapazitäten gesetzt waren, sind "
|
626 |
+
"die Einträge nun ungeschützt, ausser die Legacy Zugriffsbeschränkungen "
|
627 |
+
"werden aktiviert oder es werden Beschränkungen basierend auf Gruppen gesetzt."
|
628 |
+
|
629 |
+
#: lib/admin/groups-admin-options.php:271
|
630 |
msgid "If you lock yourself out, please ask an administrator to help."
|
631 |
msgstr ""
|
632 |
"Sollten Sie sich selbst ausschließen, so fragen Sie bitte einen Verwalter "
|
633 |
"nach Hilfe."
|
634 |
|
635 |
+
#: lib/admin/class-groups-admin-welcome.php:205
|
636 |
+
msgid ""
|
637 |
+
"If you would like to switch to access restrictions based on groups "
|
638 |
+
"(recommended) instead of capabilities, you can easily do so by setting the "
|
639 |
+
"appropriate groups on your protected posts, pages and other entries to "
|
640 |
+
"restrict access."
|
641 |
+
msgstr ""
|
642 |
+
"Um auf gruppenbasierende Zugriffsbeschränkungen umzusteigen (empfohlen), "
|
643 |
+
"kann dies einfach getan werden indem man die entsprechenden Gruppen für die "
|
644 |
+
"geschützten Beiträge, Seiten und andere Einträge setzt um den Zugang "
|
645 |
+
"einzuschränken."
|
646 |
+
|
647 |
+
#: lib/admin/class-groups-admin-welcome.php:135
|
648 |
+
msgid "Important"
|
649 |
+
msgstr "Wichtig"
|
650 |
+
|
651 |
+
#: lib/admin/class-groups-admin-welcome.php:160
|
652 |
+
msgid "Improved User Interface"
|
653 |
+
msgstr "Verbesserte Benutzeroberfläche"
|
654 |
+
|
655 |
+
#: lib/access/class-groups-access-meta-boxes.php:136
|
656 |
+
msgid ""
|
657 |
+
"In the same field, you can create a new group and restrict access. Group "
|
658 |
+
"names are case-sensitive. In order to be able to use the new group, your "
|
659 |
+
"user account will be assigned to it. You will not be able to restrict access "
|
660 |
+
"if the group already exists but you do not belong to it."
|
661 |
+
msgstr ""
|
662 |
+
"Im selben Feld kann man eine neue Gruppe erstellen und den Zugang "
|
663 |
+
"einschränken. Bei Gruppennamen wird die Groß- und Kleinschreibung beachtet. "
|
664 |
+
"Um die neue Gruppe verwenden zu können wird man der Gruppe hinzugefügt. Es "
|
665 |
+
"ist nicht möglich den Zugang mittels einer Gruppe zu beschränken die bereits "
|
666 |
+
"existiert wenn man dieser nicht zugehört."
|
667 |
+
|
668 |
+
#: legacy/admin/groups-admin-options-legacy.php:61
|
669 |
msgid ""
|
670 |
"Include these capabilities to enforce read access on posts. The selected "
|
671 |
"capabilities will be offered to restrict access to posts."
|
678 |
msgid "Inherited capabilities:"
|
679 |
msgstr "Geerbte Kapazitäten:"
|
680 |
|
681 |
+
#: lib/admin/class-groups-admin-welcome.php:138
|
682 |
+
msgid ""
|
683 |
+
"It seems that you have updated from Groups 1.x where access restrictions "
|
684 |
+
"were based on capabilities."
|
685 |
+
msgstr ""
|
686 |
+
"Es scheint hier wurde von Groups 1.x aktualisiert, wo Zugangsbeschränkungen "
|
687 |
+
"auf Kapazitäten basierten."
|
688 |
+
|
689 |
#: lib/views/class-groups-shortcodes.php:469
|
690 |
#, php-format
|
691 |
msgid "Join the %s group"
|
696 |
msgid "Leave the %s group"
|
697 |
msgstr "Die Gruppe %s verlassen"
|
698 |
|
699 |
+
#: lib/admin/groups-admin-options.php:288
|
700 |
+
msgid "Legacy Settings"
|
701 |
+
msgstr "Legacy Einstellungen"
|
702 |
+
|
703 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:137
|
704 |
+
#: lib/access/class-groups-access-meta-boxes.php:128
|
705 |
msgid ""
|
706 |
"Let's assume that you want to limit the visibility of a post to members of "
|
707 |
"the <em>Premium</em> group."
|
713 |
msgid "Log out"
|
714 |
msgstr "Abmelden"
|
715 |
|
716 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:503
|
717 |
+
#: lib/access/class-groups-access-meta-boxes.php:409
|
718 |
msgid "Media"
|
719 |
msgstr "Medien"
|
720 |
|
721 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:231
|
722 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:558
|
723 |
#, php-format
|
724 |
msgid "Members of the %1$s group can access this %2$s through this capability."
|
725 |
msgid_plural ""
|
736 |
msgid "Name"
|
737 |
msgstr "Name"
|
738 |
|
739 |
+
#: lib/admin/groups-admin-options.php:345
|
740 |
msgid "Network deactivation and data persistence"
|
741 |
msgstr "Netzwerkdeaktivation und Datenpersistenz"
|
742 |
|
744 |
msgid "New Capability"
|
745 |
msgstr "Neue Kapazität"
|
746 |
|
747 |
+
#: lib/admin/class-groups-admin-welcome.php:171
|
748 |
+
msgid "New Documentation"
|
749 |
+
msgstr "Neue Dokumentation"
|
750 |
+
|
751 |
#: lib/admin/groups-admin-groups.php:212
|
752 |
msgid "New Group"
|
753 |
msgstr "Neue Gruppe"
|
754 |
|
755 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:240
|
756 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:567
|
757 |
msgid ""
|
758 |
"No groups grant access through this capability. To grant access to group "
|
759 |
"members using this capability, you should assign it to a group and enable "
|
785 |
msgid "No such groups."
|
786 |
msgstr "Solche Gruppen sind nicht vorhanden."
|
787 |
|
788 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:132
|
789 |
msgid ""
|
790 |
"Note that you must be a member of a group that has such a capability "
|
791 |
"assigned."
|
793 |
"Beachten Sie, dass Sie Mitglied einer Gruppe die diese Kapazität hat sein "
|
794 |
"müssen."
|
795 |
|
796 |
+
#: lib/access/class-groups-access-meta-boxes.php:123
|
797 |
+
msgid "Note that you must be a member of a group to use it to restrict access."
|
798 |
+
msgstr ""
|
799 |
+
"Es ist zu beachten dass man Mitglied einer Gruppe sein muss, um diese zur "
|
800 |
+
"Zugangsbeschränkung verwenden zu können."
|
801 |
+
|
802 |
+
#: lib/admin/class-groups-admin-welcome.php:163
|
803 |
+
msgid ""
|
804 |
+
"Now you can assign new users directly to groups when you create a new user "
|
805 |
+
"account from the Dashboard."
|
806 |
+
msgstr ""
|
807 |
+
"Jetzt kann man neue Benutzer direkt Gruppen zuweisen wenn man deren "
|
808 |
+
"Benutzerkonto vom Dashboard aus erstellt."
|
809 |
+
|
810 |
+
#: lib/admin/class-groups-admin-welcome.php:154
|
811 |
+
msgid ""
|
812 |
+
"Now you can protect your posts, pages and any other custom post type like "
|
813 |
+
"products or events by simply assigning them to one or more groups."
|
814 |
+
msgstr ""
|
815 |
+
"Man kann jetzt Beiträge, Seiten und alle anderen Eintragstypen wie Produkte "
|
816 |
+
"oder Evente einfach schützen, indem man diese einer oder mehreren Gruppen "
|
817 |
+
"zuweist."
|
818 |
+
|
819 |
+
#: lib/admin/class-groups-admin-welcome.php:207
|
820 |
+
msgid ""
|
821 |
+
"Once you have adjusted your access restrictions based on groups, you can "
|
822 |
+
"disable legacy access control."
|
823 |
+
msgstr ""
|
824 |
+
"Die Legacy Zugriffsbeschränkungen können deaktiviert werden sobald diese auf "
|
825 |
+
"Gruppen umgestellt wurden."
|
826 |
+
|
827 |
#: lib/admin/groups-admin-capabilities.php:121
|
828 |
#, php-format
|
829 |
msgid "One capability has been added."
|
831 |
msgstr[0] "Eine Kapazität wurde hinzugefügt."
|
832 |
msgstr[1] "%d Kapazitäten wurden hinzugefügt."
|
833 |
|
834 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:77
|
835 |
msgid "One or more capabilities required to read the entry."
|
836 |
msgstr "Eine oder mehr Kapazitäten sind benötigt um den Beitrag zu lesen."
|
837 |
|
838 |
+
#: lib/admin/class-groups-admin-post-columns.php:92
|
839 |
+
msgid "One or more groups granting access to entries."
|
840 |
+
msgstr "Eine oder mehr Gruppen die Zugriff auf Einträge erstatten."
|
841 |
+
|
842 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:270
|
843 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:588
|
844 |
#, php-format
|
845 |
msgid ""
|
846 |
"Only groups or users that have one of the selected capabilities are allowed "
|
854 |
msgid "Options"
|
855 |
msgstr "Optionen"
|
856 |
|
857 |
+
#: lib/admin/groups-admin-options.php:121
|
858 |
msgid "Options saved."
|
859 |
msgstr "Optionen gespeichert."
|
860 |
|
863 |
msgid "Parent"
|
864 |
msgstr "Vorläufer"
|
865 |
|
866 |
+
#: lib/admin/class-groups-admin-welcome.php:217
|
867 |
+
msgid "Perfect complements to memberships and access control with Groups."
|
868 |
+
msgstr ""
|
869 |
+
"Perfekte Ergänzungen für Mitgliedschaften und Zugangskontrolle mit Groups."
|
870 |
+
|
871 |
+
#: lib/admin/groups-admin-options.php:265
|
872 |
msgid "Permissions"
|
873 |
msgstr "Berechtigungen"
|
874 |
|
896 |
"Bitte geben Sie eine <a style=\"text-decoration:none;\" href=\"%s\">★"
|
897 |
"★★★★</a> Bewertung ab!"
|
898 |
|
899 |
+
#: lib/admin/class-groups-admin-welcome.php:140
|
900 |
+
#, php-format
|
901 |
+
msgid ""
|
902 |
+
"Please make sure to read the notes on <strong>Switching to Groups %s</"
|
903 |
+
"strong> below."
|
904 |
+
msgstr ""
|
905 |
+
"Bitte beachte die Hinweise unten bezüglich <strong>Umstellen auf Groups %s</"
|
906 |
+
"strong>."
|
907 |
+
|
908 |
+
#: lib/admin/class-groups-admin-welcome.php:209
|
909 |
+
msgid ""
|
910 |
+
"Please refer to the <a target=\"_blank\" href=\"http://docs.itthinx.com/"
|
911 |
+
"document/groups/\">Documentation</a> for details on how to switch to and use "
|
912 |
+
"the new access restrictions."
|
913 |
+
msgstr ""
|
914 |
+
"Bitte beachte die <a target=\"_blank\" href=\"http://docs.itthinx.com/"
|
915 |
+
"document/groups/\">Dokumentation</a> für Details über die Umstellung und "
|
916 |
+
"Benutzung der neuen Zugriffsbeschränkungen."
|
917 |
+
|
918 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:189
|
919 |
+
#: lib/access/class-groups-access-meta-boxes.php:162
|
920 |
msgid "Post"
|
921 |
msgstr "Beitrag"
|
922 |
|
923 |
+
#: lib/admin/groups-admin-options.php:216
|
924 |
msgid "Post types"
|
925 |
msgstr "Beitragstypen"
|
926 |
|
927 |
+
#: lib/admin/class-groups-admin-welcome.php:156
|
928 |
+
msgid ""
|
929 |
+
"Previously we used capabilities to do that, but changing to this new model "
|
930 |
+
"makes things even easier."
|
931 |
+
msgstr ""
|
932 |
+
"Bisher wurden Kapazitäten verwendet um das zu tun, aber der Wechsel zum "
|
933 |
+
"neuen Modell macht die Dinge noch viel einfacher."
|
934 |
+
|
935 |
+
#: lib/admin/class-groups-admin-welcome.php:149
|
936 |
+
msgid "Protect Content Easily"
|
937 |
+
msgstr "Inhalte Einfach Schützen"
|
938 |
+
|
939 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:308
|
940 |
msgid "Quick-create group & capability"
|
941 |
msgstr "Instant Gruppe & Kapazität"
|
942 |
|
943 |
+
#: lib/access/class-groups-access-meta-boxes.php:200
|
944 |
+
#: lib/access/class-groups-access-meta-boxes.php:411
|
945 |
+
msgid "Read"
|
946 |
+
msgstr "Lesen"
|
947 |
+
|
948 |
+
#: legacy/access/class-groups-post-access-legacy.php:52
|
949 |
msgid "Read Post"
|
950 |
msgstr "Beitrag Lesen"
|
951 |
|
952 |
+
#: lib/admin/groups-admin-add-ons.php:49
|
953 |
msgid "Recommended extensions for Groups"
|
954 |
msgstr "Empfohlene Erweiterungen für Groups"
|
955 |
|
956 |
+
#: lib/admin/groups-admin-add-ons.php:157
|
957 |
msgid "Recommended plugins by itthinx"
|
958 |
msgstr "Empfohlene Plugins von itthinx"
|
959 |
|
992 |
msgid "Remove capability"
|
993 |
msgstr "Kapazität löschen"
|
994 |
|
995 |
+
#: lib/admin/class-groups-admin-users.php:213
|
996 |
msgid "Remove from group"
|
997 |
msgstr "Von der Gruppe entfernen"
|
998 |
|
1004 |
msgid "Remove groups"
|
1005 |
msgstr "Gruppen entfernen"
|
1006 |
|
1007 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:186
|
1008 |
+
#: lib/admin/class-groups-admin-posts.php:209
|
1009 |
msgid "Remove restriction"
|
1010 |
msgstr "Beschränkung entfernen"
|
1011 |
|
1012 |
+
#: lib/admin/groups-admin-options.php:53
|
1013 |
+
msgid "Restrict Access"
|
1014 |
+
msgstr "Zugang Beschränken"
|
1015 |
+
|
1016 |
+
#: lib/access/class-groups-access-meta-boxes.php:226
|
1017 |
+
#, php-format
|
1018 |
+
msgid "Restricts the visibility of this %s to members of the chosen groups."
|
1019 |
+
msgstr ""
|
1020 |
+
"Beschränkt die %s-Sichtbarkeit auf Mitglieder der ausgewählten Gruppen."
|
1021 |
+
|
1022 |
+
#: lib/access/class-groups-access-meta-boxes.php:459
|
1023 |
+
msgid "Restricts the visibility of this entry to members of the chosen groups."
|
1024 |
+
msgstr ""
|
1025 |
+
"Beschränkt die Sichtbarkeit dieses Eintrags auf Mitglieder der ausgewählten "
|
1026 |
+
"Gruppen."
|
1027 |
+
|
1028 |
#: lib/admin/groups-admin-capabilities.php:357
|
1029 |
#: lib/admin/groups-admin-groups.php:346
|
1030 |
msgid "Results per page"
|
1031 |
msgstr "Ergebnisse pro Seite"
|
1032 |
|
1033 |
+
#: lib/admin/groups-admin-options.php:144
|
1034 |
msgid "Role"
|
1035 |
msgstr "Rolle"
|
1036 |
|
1037 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
1038 |
#: lib/admin/groups-admin-groups-edit.php:158
|
1039 |
+
#: lib/admin/groups-admin-options.php:201
|
1040 |
+
#: lib/admin/groups-admin-options.php:303
|
1041 |
+
#: lib/admin/groups-admin-options.php:355
|
1042 |
msgid "Save"
|
1043 |
msgstr "Speichern"
|
1044 |
|
1045 |
+
#: lib/admin/groups-admin-options.php:219
|
1046 |
msgid "Show access restrictions for these post types."
|
1047 |
msgstr "Zugangsbeschränkungen für diese Beitragstypen zeigen."
|
1048 |
|
1049 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:277
|
1050 |
msgid "Show groups"
|
1051 |
msgstr "Gruppen zeigen"
|
1052 |
|
1053 |
+
#: lib/admin/groups-admin-options.php:251
|
1054 |
msgid "Show groups in user profiles."
|
1055 |
msgstr "Gruppen in Benutzerprofilen zeigen"
|
1056 |
|
1057 |
+
#: lib/admin/groups-admin-options.php:260
|
1058 |
msgid "Show the Groups tree view."
|
1059 |
msgstr "Die Baumansicht von Groups anzeigen."
|
1060 |
|
1061 |
+
#: lib/admin/class-groups-admin-welcome.php:179
|
1062 |
+
#, php-format
|
1063 |
+
msgid "Switching to Groups %s"
|
1064 |
+
msgstr "Umstellen auf Groups %s"
|
1065 |
+
|
1066 |
+
#: lib/admin/class-groups-admin-posts.php:167
|
1067 |
+
msgid "Terms"
|
1068 |
+
msgstr "Begriffe"
|
1069 |
+
|
1070 |
#: lib/core/class-groups-help.php:141
|
1071 |
msgid ""
|
1072 |
"Thank you for using <a href=\"http://www.itthinx.com/plugins/groups\" target="
|
1077 |
"target=\"_blank\">Groups</a> von <a href=\"http://www.itthinx.com\" target="
|
1078 |
"\"_blank\">itthinx</a>."
|
1079 |
|
1080 |
+
#: lib/admin/class-groups-admin-welcome.php:129
|
1081 |
+
msgid ""
|
1082 |
+
"Thanks for using Groups! We have made it even easier to protect your content "
|
1083 |
+
"and hope you like it :)"
|
1084 |
+
msgstr ""
|
1085 |
+
"Danke dass Ihr Groups verwendet! Wir haben es noch einfacher gemacht Inhalte "
|
1086 |
+
"zu schützen und hoffen es gefällt euch :)"
|
1087 |
+
|
1088 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
1089 |
#, php-format
|
1090 |
msgid ""
|
1161 |
"Die vollständige Dokumentation ist auf den <a href=\"http://docs.itthinx.com/"
|
1162 |
"document/groups\">Documentation</a>-Seiten für Groups erhältlich."
|
1163 |
|
1164 |
+
#: lib/admin/class-groups-admin-welcome.php:190
|
1165 |
+
msgid "The following is only of interest if you have upgraded from Groups 1.x:"
|
1166 |
+
msgstr ""
|
1167 |
+
"Folgendes ist nur von Interesse wenn von Groups 1.x aktualisiert wurde:"
|
1168 |
+
|
1169 |
#: lib/admin/groups-admin-groups.php:76
|
1170 |
msgid "The group has been deleted."
|
1171 |
msgstr "Die Gruppe wurde gelöscht."
|
1172 |
|
1173 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:148
|
1174 |
msgid "The manual way:"
|
1175 |
msgstr "Der manuelle Weg:"
|
1176 |
|
1178 |
msgid "The name must not be empty."
|
1179 |
msgstr "Der Name darf nicht leer sein."
|
1180 |
|
1181 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:139
|
1182 |
msgid "The quick way:"
|
1183 |
msgstr "Der schnelle Weg:"
|
1184 |
|
1185 |
+
#: lib/admin/class-groups-admin-user-profile.php:88
|
1186 |
+
#: lib/admin/class-groups-admin-user-profile.php:176
|
1187 |
msgid "The user is a member of the chosen groups."
|
1188 |
msgstr "Der Benutzer ist Mitglied der ausgewählten Gruppen."
|
1189 |
|
1196 |
msgid "These capabilities will be assigned to the group."
|
1197 |
msgstr "Diese Kapazitäten werden der Gruppe zugewiesen."
|
1198 |
|
1199 |
+
#: lib/admin/groups-admin-options.php:266
|
1200 |
msgid ""
|
1201 |
"These permissions apply to Groups management. They do not apply to access "
|
1202 |
"permissions derived from Groups capabilities."
|
1204 |
"Diese Berechtigungen dienen der Verwaltung von Groups. Sie finden keine "
|
1205 |
"Anwendung bei Berechtigungen die von Groups Kapazitäten abgeleitet werden."
|
1206 |
|
1207 |
+
#: lib/admin/class-groups-admin-welcome.php:199
|
1208 |
+
msgid "This could be important!"
|
1209 |
+
msgstr "Dies könnte wichtig sein!"
|
1210 |
+
|
1211 |
+
#: lib/admin/groups-admin-options.php:242
|
1212 |
msgid ""
|
1213 |
"This determines for which post types access restriction settings are offered."
|
1214 |
msgstr ""
|
1219 |
msgid "This group has no capabilities."
|
1220 |
msgstr "Diese Gruppe hat keine Kapazitäten."
|
1221 |
|
1222 |
+
#: lib/admin/class-groups-admin-welcome.php:195
|
1223 |
+
msgid ""
|
1224 |
+
"This means that if you had access restrictions in place that were based on "
|
1225 |
+
"capabilities, your entries will still be protected."
|
1226 |
+
msgstr ""
|
1227 |
+
"Dies bedeutet dass vorige Zugangsbeschränkungen die auf Kapazitäten basieren "
|
1228 |
+
"immer noch die Einträge schützen."
|
1229 |
+
|
1230 |
+
#: lib/access/class-groups-post-access.php:477
|
1231 |
+
msgid ""
|
1232 |
+
"This method is deprecated. You should use Groups_Post_Access_Legacy::"
|
1233 |
+
"get_read_post_capabilities() to retrieve the capabilities instead."
|
1234 |
+
msgstr ""
|
1235 |
+
"Diese Methode ist veraltet. Es sollte stattdessen Groups_Post_Access_Legacy::"
|
1236 |
+
"get_read_post_capabilities() verwendet werden um die Kapazitäten zu erhalten."
|
1237 |
+
|
1238 |
+
#: lib/admin/class-groups-admin-welcome.php:186
|
1239 |
+
msgid ""
|
1240 |
+
"To make it easier to transition to the new model for those who migrate from "
|
1241 |
+
"a previous version, we have included legacy access control based on "
|
1242 |
+
"capabilities."
|
1243 |
+
msgstr ""
|
1244 |
+
"Um die Umstellung auf das neue Modell für Benutzer einer vorigen Version "
|
1245 |
+
"einfach zu halten, haben wir Legacy Zugriffsbeschränkungen einbezogen die "
|
1246 |
+
"auf Kapazitäten basieren."
|
1247 |
+
|
1248 |
+
#: lib/admin/class-groups-admin-welcome.php:184
|
1249 |
+
msgid ""
|
1250 |
+
"To put it simple, previously you would have used capabilities to restrict "
|
1251 |
+
"access to posts and now you simply use groups."
|
1252 |
+
msgstr ""
|
1253 |
+
"Einfach gesagt, vorher wurden Kapazitäten verwendet um den Zugriff auf "
|
1254 |
+
"Beiträge zu schützen und jetzt verwendet man schlicht Gruppen."
|
1255 |
+
|
1256 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
1257 |
msgid "Tree"
|
1258 |
msgstr "Baum"
|
1261 |
msgid "Tree of Groups"
|
1262 |
msgstr "Gruppenbaum"
|
1263 |
|
1264 |
+
#: lib/admin/groups-admin-options.php:256
|
1265 |
msgid "Tree view"
|
1266 |
msgstr "Baumansicht"
|
1267 |
|
1268 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:153
|
1269 |
msgid ""
|
1270 |
"Try the quick-create field first. Unless you need a more complex setup, "
|
1271 |
"there is no reason to go this way instead."
|
1273 |
"Probieren Sie das Instant-Feld zuerst aus. Es gibt keinen Grund diesen Weg "
|
1274 |
"zu gehen, ausser Sie benötigen eine komplexere Einrichtung."
|
1275 |
|
1276 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:212
|
1277 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:213
|
1278 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:540
|
1279 |
msgid "Type and choose …"
|
1280 |
msgstr "Tippen und wählen …"
|
1281 |
|
1282 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:127
|
1283 |
msgid ""
|
1284 |
"Use the <em>Access restrictions</em> box to limit the visibility of posts, "
|
1285 |
"pages and other post types."
|
1287 |
"Verwenden Sie das Kästchen <em>Zugangsbeschränkungen</em> um die "
|
1288 |
"Sichtbarkeit von Beiträgen, Seiten und anderen Beitragstypen einzuschränken."
|
1289 |
|
1290 |
+
#: lib/access/class-groups-access-meta-boxes.php:118
|
1291 |
+
msgid ""
|
1292 |
+
"Use the <em>Groups</em> box to limit the visibility of posts, pages and "
|
1293 |
+
"other post types."
|
1294 |
+
msgstr ""
|
1295 |
+
"Verwende den Kasten <em>Gruppen</em> um die Sichtbarkeit von Beiträgen, "
|
1296 |
+
"Seiten und anderen Beitragstypen einzuschränken."
|
1297 |
+
|
1298 |
+
#: lib/admin/groups-admin-options.php:247
|
1299 |
msgid "User profiles"
|
1300 |
msgstr "Benutzerprofile"
|
1301 |
|
1302 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:141
|
1303 |
msgid "Using the quick-create field"
|
1304 |
msgstr "Verwendung des Instant-Feldes"
|
1305 |
|
1306 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:146
|
1307 |
msgid ""
|
1308 |
"Using the quick-create field, you can create a new group and capability. The "
|
1309 |
"capability will be assigned to the group and enabled to enforce read access. "
|
1324 |
"Zugriffsbeschränkung aktiviert. Um die Kapazität verwenden zu können, wird "
|
1325 |
"ihr Benutzerkonto der Gruppe hinzugefügt."
|
1326 |
|
1327 |
+
#: lib/admin/class-groups-admin-welcome.php:97
|
1328 |
+
msgid "View the Welcome screen for this version of Groups"
|
1329 |
+
msgstr "Den Begrüßungsbildschirm für diese Version von Groups anzeigen"
|
1330 |
+
|
1331 |
+
#: lib/admin/class-groups-admin-welcome.php:152
|
1332 |
+
msgid "We have made it even easier to protect your content!"
|
1333 |
+
msgstr "Wir haben es noch einfacher gemacht Inhalte zu schützen!"
|
1334 |
+
|
1335 |
+
#: lib/admin/class-groups-admin-welcome.php:98
|
1336 |
+
msgid "Welcome"
|
1337 |
+
msgstr "Willkommen"
|
1338 |
+
|
1339 |
+
#: lib/admin/class-groups-admin-welcome.php:46
|
1340 |
+
#: lib/admin/class-groups-admin-welcome.php:47
|
1341 |
+
msgid "Welcome to Groups"
|
1342 |
+
msgstr "Willkommen zu Groups"
|
1343 |
+
|
1344 |
+
#: lib/admin/class-groups-admin-welcome.php:125
|
1345 |
+
#, php-format
|
1346 |
+
msgid "Welcome to Groups %s"
|
1347 |
+
msgstr "Willkommen zu Groups %s"
|
1348 |
+
|
1349 |
+
#: lib/admin/class-groups-admin-welcome.php:145
|
1350 |
+
msgid "What's New?"
|
1351 |
+
msgstr "Was gibt’s Neues?"
|
1352 |
+
|
1353 |
+
#: lib/admin/class-groups-admin-welcome.php:174
|
1354 |
+
msgid ""
|
1355 |
+
"Whether you are new to Groups or have been using it before, please make sure "
|
1356 |
+
"to visit the <a target=\"_blank\" href=\"http://docs.itthinx.com/document/"
|
1357 |
+
"groups/\">Documentation</a> pages to know more about how to use it."
|
1358 |
+
msgstr ""
|
1359 |
+
"Egal ob man bei Groups neu ist oder es bereits zuvor verwendet hat, raten "
|
1360 |
+
"wir es an die <a target=\"_blank\" href=\"http://docs.itthinx.com/document/"
|
1361 |
+
"groups/\">Dokumentation</a> anzusehen um mehr darüber zu erfahren wie man es "
|
1362 |
+
"verwendet."
|
1363 |
+
|
1364 |
#: lib/views/class-groups-shortcodes.php:527
|
1365 |
#, php-format
|
1366 |
msgid "You are a member of the %s group."
|
1367 |
msgstr "Sie sind Mitglied der Gruppe %s."
|
1368 |
|
1369 |
+
#: lib/admin/class-groups-admin-welcome.php:197
|
1370 |
+
msgid ""
|
1371 |
+
"You are running the system with legacy access control based on capabilities "
|
1372 |
+
"disabled."
|
1373 |
+
msgstr ""
|
1374 |
+
"Das System läuft mit Legacy Zugriffsbeschränkungen basierend auf Kapazitäten "
|
1375 |
+
"deaktiviert."
|
1376 |
+
|
1377 |
+
#: lib/admin/class-groups-admin-welcome.php:193
|
1378 |
+
msgid ""
|
1379 |
+
"You are running the system with legacy access control based on capabilities "
|
1380 |
+
"enabled."
|
1381 |
+
msgstr ""
|
1382 |
+
"Das System läuft mit Legacy Zugriffsbeschränkungen basierend auf Kapazitäten "
|
1383 |
+
"aktiviert."
|
1384 |
+
|
1385 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:312
|
1386 |
msgid ""
|
1387 |
"You can create a new group and capability here. The capability will be "
|
1388 |
"assigned to the group and enabled to enforce read access. Group names are "
|
1403 |
"aktiviert. Um die Kapazität verwenden zu können, wird ihr Benutzerkonto der "
|
1404 |
"Gruppe hinzugefügt."
|
1405 |
|
1406 |
+
#: lib/access/class-groups-access-meta-boxes.php:193
|
1407 |
+
#: lib/access/class-groups-access-meta-boxes.php:444
|
1408 |
+
msgid "You can create a new group by indicating the group's name."
|
1409 |
+
msgstr ""
|
1410 |
+
"Eine neue Gruppe kann erstellt werden indem man den Namen der Gruppe eingibt."
|
1411 |
+
|
1412 |
+
#: lib/access/class-groups-access-meta-boxes.php:187
|
1413 |
+
#, php-format
|
1414 |
+
msgid ""
|
1415 |
+
"You can restrict the visibility of this %1$s to group members. Choose one or "
|
1416 |
+
"more groups that are allowed to read this %2$s. If no groups are chosen, the "
|
1417 |
+
"%3$s is visible to anyone."
|
1418 |
+
msgstr ""
|
1419 |
+
"Die %1$s-Sichtbarkeit kann auf Gruppenmitglieder eingeschränkt werden. Eine "
|
1420 |
+
"oder mehrere Gruppen auswählen die diese/n/s %2$s lesen dürfen. Werden keine "
|
1421 |
+
"Gruppen ausgewählt dann ist diese/r/s %3$s für alle sichtbar."
|
1422 |
+
|
1423 |
+
#: lib/access/class-groups-access-meta-boxes.php:443
|
1424 |
+
msgid ""
|
1425 |
+
"You can restrict the visibility to group members. Choose one or more groups "
|
1426 |
+
"to restrict access. If no groups are chosen, this entry is visible to anyone."
|
1427 |
+
msgstr ""
|
1428 |
+
"Die Sichtbarkeit kann auf Gruppenmitglieder eingeschränkt werden. Eine oder "
|
1429 |
+
"mehrere Gruppen auswählen um den Zugriff einzuschränken. Werden keine "
|
1430 |
+
"Gruppen ausgewählt ist dieser Eintrag für alle sichtbar."
|
1431 |
+
|
1432 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:130
|
1433 |
msgid ""
|
1434 |
"You can select one or more capabilities that are enabled for access "
|
1435 |
"restriction."
|
1437 |
"Sie können eine oder mehrere Kapazitäten auswählen die zur "
|
1438 |
"Zugriffsbeschränkung aktiviert sind."
|
1439 |
|
1440 |
+
#: lib/access/class-groups-access-meta-boxes.php:121
|
1441 |
+
msgid "You can select one or more groups to restrict access to its members."
|
1442 |
+
msgstr ""
|
1443 |
+
"Es kann eine oder mehrere Gruppen ausgewählt werden um den Zugriff auf ihre "
|
1444 |
+
"Mitglieder einzuschränken."
|
1445 |
+
|
1446 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:290
|
1447 |
+
#: lib/access/class-groups-access-meta-boxes.php:233
|
1448 |
msgid "You cannot set any access restrictions."
|
1449 |
msgstr "Sie können keine Zugriffsbeschränkungen setzen."
|
1450 |
|
1458 |
msgid "You have left the %s group."
|
1459 |
msgstr "Sie haben die Gruppe %s verlassen."
|
1460 |
|
1461 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:296
|
1462 |
msgid ""
|
1463 |
"You must be in a group that has at least one capability enabled to enforce "
|
1464 |
"read access."
|
1466 |
"Sie müssen in einer Gruppe sein die zumindest eine Kapazität hat die zur "
|
1467 |
"Zugriffsbeschränkung aktiviert ist."
|
1468 |
|
1469 |
+
#: lib/access/class-groups-access-meta-boxes.php:239
|
1470 |
+
msgid "You need to have permission to set access restrictions."
|
1471 |
+
msgstr ""
|
1472 |
+
"Man benötigt die entsprechenden Rechte um Zugriffsbeschränkungen setzen zu "
|
1473 |
+
"können."
|
1474 |
+
|
1475 |
+
#: lib/access/class-groups-post-access.php:352
|
1476 |
+
msgid ""
|
1477 |
+
"You should use Groups_Post_Access_Legacy::create() to pass a capability "
|
1478 |
+
"restriction instead."
|
1479 |
+
msgstr ""
|
1480 |
+
"Man sollte stattdessen Groups_Post_Access_Legacy::create() verwenden um eine "
|
1481 |
+
"beschränkende Kapazität weiterzugeben."
|
1482 |
+
|
1483 |
#~ msgid "Capability Id"
|
1484 |
#~ msgstr "Kapazitäts-Id"
|
1485 |
|
languages/groups-es_ES.mo
CHANGED
Binary file
|
languages/groups-es_ES.po
CHANGED
@@ -4,9 +4,9 @@ msgid ""
|
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Groups\n"
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
-
"POT-Creation-Date:
|
8 |
-
"PO-Revision-Date:
|
9 |
-
"Last-Translator:
|
10 |
"Language-Team: itthinx.com\n"
|
11 |
"Language: es_ES\n"
|
12 |
"MIME-Version: 1.0\n"
|
@@ -14,7 +14,7 @@ msgstr ""
|
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
-
"X-Generator: Poedit 1.8.
|
18 |
|
19 |
#: lib/core/class-groups-pagination.php:140
|
20 |
#, php-format
|
@@ -22,15 +22,17 @@ msgctxt "paging"
|
|
22 |
msgid "%1$s of %2$s"
|
23 |
msgstr "%1$s de %2$s"
|
24 |
|
25 |
-
#:
|
|
|
26 |
msgid "— No Change —"
|
27 |
msgstr "— Sin cambios —"
|
28 |
|
29 |
-
#:
|
|
|
30 |
msgid "(only unrestricted)"
|
31 |
msgstr "(sin restricción)"
|
32 |
|
33 |
-
#: lib/admin/class-groups-admin-users.php:
|
34 |
msgid "--"
|
35 |
msgstr "--"
|
36 |
|
@@ -41,7 +43,7 @@ msgid_plural "%s items"
|
|
41 |
msgstr[0] "1 elemento"
|
42 |
msgstr[1] "%s elementos"
|
43 |
|
44 |
-
#:
|
45 |
#, php-format
|
46 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
47 |
msgstr "<span title=\"%s\">Restricción de Acceso</span>"
|
@@ -52,7 +54,7 @@ msgstr "<span title=\"%s\">Restricción de Acceso</span>"
|
|
52 |
msgid "<strong>%s</strong>"
|
53 |
msgstr "<strong>%s</strong>"
|
54 |
|
55 |
-
#:
|
56 |
msgid ""
|
57 |
"<sup>*</sup> For each capability, the groups that have the capability "
|
58 |
"assigned are shown within parenthesis. You can choose a capability by typing "
|
@@ -66,7 +68,7 @@ msgstr ""
|
|
66 |
msgid "A Duck!"
|
67 |
msgstr "Un Pato!"
|
68 |
|
69 |
-
#: lib/admin/groups-admin-options.php:
|
70 |
msgid "A minimum set of permissions will be preserved."
|
71 |
msgstr "Se preservarán un mínimo de permisos."
|
72 |
|
@@ -74,7 +76,7 @@ msgstr "Se preservarán un mínimo de permisos."
|
|
74 |
msgid "Access Groups"
|
75 |
msgstr "Acceder a Groups"
|
76 |
|
77 |
-
#:
|
78 |
msgid "Access Restrictions"
|
79 |
msgstr "Restricción de Acceso"
|
80 |
|
@@ -108,26 +110,26 @@ msgstr "Restricción de Acceso"
|
|
108 |
#: lib/admin/groups-admin-groups-remove.php:181
|
109 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
110 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
111 |
-
#: lib/admin/groups-admin-options.php:39 lib/admin/groups-admin-options.php:
|
112 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
113 |
#: lib/test/groups-tests.php:391
|
114 |
msgid "Access denied."
|
115 |
msgstr "Acceso denegado."
|
116 |
|
117 |
-
#: lib/admin/groups-admin-options.php:
|
118 |
msgid "Access restricions"
|
119 |
msgstr "Restricciones de acceso"
|
120 |
|
121 |
-
#:
|
122 |
-
#:
|
123 |
-
#:
|
124 |
-
#:
|
125 |
-
#:
|
126 |
msgid "Access restrictions"
|
127 |
msgstr "Restricciones de acceso"
|
128 |
|
129 |
-
#:
|
130 |
-
#:
|
131 |
msgid "Access restrictions …"
|
132 |
msgstr "Restricción de acceso …"
|
133 |
|
@@ -150,19 +152,21 @@ msgstr "Añadir un nuevo grupo"
|
|
150 |
msgid "Add capability"
|
151 |
msgstr "Añadir capacidad"
|
152 |
|
153 |
-
#:
|
|
|
154 |
msgid "Add restriction"
|
155 |
msgstr "Añadir restricción"
|
156 |
|
157 |
-
#: lib/admin/class-groups-admin-users.php:
|
158 |
msgid "Add to group"
|
159 |
msgstr "Añadir a grupo"
|
160 |
|
161 |
-
#: lib/admin/class-groups-admin
|
|
|
162 |
msgid "Add-Ons"
|
163 |
msgstr "Add-Ons"
|
164 |
|
165 |
-
#:
|
166 |
msgid ""
|
167 |
"Adding the group and capability manually and enabling it for access "
|
168 |
"restriction"
|
@@ -178,11 +182,11 @@ msgstr "Administrar Groups"
|
|
178 |
msgid "Administer Groups plugin options"
|
179 |
msgstr "Administrar opciones de Groups"
|
180 |
|
181 |
-
#: lib/admin/groups-admin-options.php:
|
182 |
msgid "Administrator Access Override"
|
183 |
msgstr "Acceso general del Administrador"
|
184 |
|
185 |
-
#: lib/admin/groups-admin-options.php:
|
186 |
msgid ""
|
187 |
"Administrators override all access permissions derived from Groups "
|
188 |
"capabilities."
|
@@ -190,7 +194,34 @@ msgstr ""
|
|
190 |
"Los administradores heredan todos los permisos de acceso derivados de las "
|
191 |
"capacidades de Grupos."
|
192 |
|
193 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
#: lib/admin/groups-admin-capabilities.php:334
|
195 |
#: lib/admin/groups-admin-capabilities.php:360
|
196 |
#: lib/admin/groups-admin-capabilities.php:374
|
@@ -199,7 +230,7 @@ msgstr ""
|
|
199 |
msgid "Apply"
|
200 |
msgstr "Aplicar"
|
201 |
|
202 |
-
#:
|
203 |
msgid ""
|
204 |
"Become a member of the <em>Premium</em> group - this is required so you can "
|
205 |
"choose the <em>premium</em> capability to restrict access to a post."
|
@@ -212,7 +243,7 @@ msgstr ""
|
|
212 |
msgid "Bulk Actions"
|
213 |
msgstr "Acciones en Lote"
|
214 |
|
215 |
-
#: lib/admin/groups-admin-options.php:
|
216 |
msgid ""
|
217 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
218 |
"plugin settings and data will be DELETED for <strong>all sites</strong>. If "
|
@@ -227,7 +258,7 @@ msgstr ""
|
|
227 |
"responsabilidad por la pérdida de cualquier dato o cualquier otra "
|
228 |
"consecuencia."
|
229 |
|
230 |
-
#: lib/admin/groups-admin-options.php:
|
231 |
msgid ""
|
232 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
233 |
"plugin settings and data will be DELETED. If you are going to use this "
|
@@ -253,12 +284,12 @@ msgstr ""
|
|
253 |
msgid "Cancel"
|
254 |
msgstr "Cancelar"
|
255 |
|
|
|
256 |
#: lib/admin/class-groups-admin.php:195
|
257 |
#: lib/admin/groups-admin-capabilities.php:192
|
258 |
#: lib/admin/groups-admin-groups-add.php:97
|
259 |
#: lib/admin/groups-admin-groups-edit.php:117
|
260 |
-
#: lib/admin/groups-admin-groups.php:306 lib/
|
261 |
-
#: lib/core/class-groups-help.php:71
|
262 |
msgid "Capabilities"
|
263 |
msgstr "Capacidades"
|
264 |
|
@@ -282,8 +313,13 @@ msgstr "Capacidad : %s"
|
|
282 |
msgid "Capability ID"
|
283 |
msgstr "ID Capacidad"
|
284 |
|
285 |
-
#: lib/admin/class-groups-admin-posts.php:
|
286 |
-
#: lib/admin/class-groups-admin-posts.php:
|
|
|
|
|
|
|
|
|
|
|
287 |
msgid "Choose access restrictions …"
|
288 |
msgstr "Elegir restricciones de acceso"
|
289 |
|
@@ -292,15 +328,19 @@ msgstr "Elegir restricciones de acceso"
|
|
292 |
msgid "Choose capabilities …"
|
293 |
msgstr "Elegir capacidades …"
|
294 |
|
295 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
296 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
297 |
-
#: lib/admin/class-groups-admin-
|
298 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
299 |
msgid "Choose groups …"
|
300 |
msgstr "Elegir grupos …"
|
301 |
|
302 |
-
#:
|
303 |
-
#:
|
304 |
msgid ""
|
305 |
"Choose one or more capabilities to restrict access. Groups that grant access "
|
306 |
"through the capabilities are shown in parenthesis. If no capabilities are "
|
@@ -312,6 +352,15 @@ msgstr ""
|
|
312 |
"hubiese capacidades disponibles, puedes usar la caja de creación instantánea "
|
313 |
"para crear un grupo y una capacidad sobre la marcha."
|
314 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
#: lib/admin/groups-admin-capabilities.php:335
|
316 |
#: lib/admin/groups-admin-groups.php:324
|
317 |
msgid "Clear"
|
@@ -329,20 +378,20 @@ msgstr "Haz click para añadir un nuevo grupo"
|
|
329 |
msgid "Click to refresh capabilities"
|
330 |
msgstr "Haz click para actualizar las capacidades"
|
331 |
|
332 |
-
#:
|
333 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
334 |
msgstr ""
|
335 |
"Haz click para cambiar el despliegue de grupos que otorga las capacidades"
|
336 |
|
337 |
-
#: lib/admin/groups-admin-options.php:
|
338 |
msgid "Deactivation and data persistence"
|
339 |
msgstr "Desactivación y persistencia de los datos"
|
340 |
|
341 |
-
#: lib/admin/groups-admin-options.php:
|
342 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
343 |
msgstr "Borrar todos los datos de los plugins al desactivar"
|
344 |
|
345 |
-
#: lib/admin/groups-admin-options.php:
|
346 |
msgid "Delete all Groups plugin data on deactivation"
|
347 |
msgstr "Borrar todos los datos de los plugin al desactivar"
|
348 |
|
@@ -355,7 +404,7 @@ msgstr "Borrar todos los datos de los plugin al desactivar"
|
|
355 |
msgid "Description"
|
356 |
msgstr "Descripción"
|
357 |
|
358 |
-
#: lib/admin/groups-admin-options.php:
|
359 |
msgid ""
|
360 |
"Disabling this setting for a post type does not remove existing access "
|
361 |
"restrictions on individual posts of that type."
|
@@ -376,7 +425,7 @@ msgstr "Editar una capacidad"
|
|
376 |
msgid "Edit a group"
|
377 |
msgstr "Editar un grupo"
|
378 |
|
379 |
-
#:
|
380 |
msgid ""
|
381 |
"Edit the post for which you want to restrict access and choose<sup>*</sup> "
|
382 |
"the <em>premium</em> capability."
|
@@ -384,12 +433,16 @@ msgstr ""
|
|
384 |
"Edita la entrada a la cual quieres restringir acceso y elige la <sup>*</"
|
385 |
"sup>capacidad <em>premium</em> ."
|
386 |
|
387 |
-
#: lib/
|
388 |
-
|
|
|
|
|
|
|
|
|
389 |
msgid "Enforce read access"
|
390 |
msgstr "Forzar permiso de lectura"
|
391 |
|
392 |
-
#: lib/admin/groups-admin-options.php:
|
393 |
msgid ""
|
394 |
"Enhanced functionality is available via official <a href=\"http://www."
|
395 |
"itthinx.com/shop/\">Extensions</a> for Groups."
|
@@ -397,7 +450,7 @@ msgstr ""
|
|
397 |
"Funcionalidad extendida está disponible a través de <a href=\"http://www."
|
398 |
"itthinx.com/shop/\">Extensiones</a> oficiales para Groups."
|
399 |
|
400 |
-
#:
|
401 |
msgid ""
|
402 |
"Enter <em>Premium</em> in the quick-create field located in the Access "
|
403 |
"restrictions panel and save or update the post (or hit Enter)."
|
@@ -406,16 +459,21 @@ msgstr ""
|
|
406 |
"en el panel de Restricción de Acceso y guarda o actualiza la entrada (o "
|
407 |
"pulsa Entrar)."
|
408 |
|
409 |
-
#:
|
|
|
410 |
msgid "Example:"
|
411 |
msgstr "Ejemplo:"
|
412 |
|
|
|
|
|
|
|
|
|
413 |
#: lib/admin/groups-admin-capabilities.php:324
|
414 |
#: lib/admin/groups-admin-groups.php:315
|
415 |
msgid "Filters"
|
416 |
msgstr "Filtros"
|
417 |
|
418 |
-
#:
|
419 |
msgid ""
|
420 |
"Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> "
|
421 |
"capability."
|
@@ -423,14 +481,14 @@ msgstr ""
|
|
423 |
"Dirígete a <strong>Groups > Capacidades</strong> y añade la capacidad "
|
424 |
"<em>premium</em>."
|
425 |
|
426 |
-
#:
|
427 |
msgid ""
|
428 |
"Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group."
|
429 |
msgstr ""
|
430 |
"Dirígete a <strong>Groups > Grupos</strong> y añade el grupo <em>Premium</"
|
431 |
"em>."
|
432 |
|
433 |
-
#:
|
434 |
msgid ""
|
435 |
"Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> "
|
436 |
"capability to the <em>Premium</em> group."
|
@@ -438,7 +496,7 @@ msgstr ""
|
|
438 |
"Dirígete a <strong>Groups > Grupos</strong> y asigna la capacidad "
|
439 |
"<em>premium</em> al grupo <em>Premium</em>."
|
440 |
|
441 |
-
#:
|
442 |
msgid ""
|
443 |
"Go to <strong>Groups > Options</strong> and enable the <em>premium</em> "
|
444 |
"capability to restrict access."
|
@@ -450,7 +508,7 @@ msgstr ""
|
|
450 |
msgid "Group"
|
451 |
msgstr "Grupo"
|
452 |
|
453 |
-
#: lib/admin/class-groups-admin-users.php:
|
454 |
msgid "Group Actions"
|
455 |
msgstr "Acciones de Grupo"
|
456 |
|
@@ -467,15 +525,30 @@ msgstr "Nombre del Grupo"
|
|
467 |
msgid "Group Name : %s"
|
468 |
msgstr "Nombre del Grupo : %s"
|
469 |
|
470 |
-
#: lib/
|
471 |
-
#: lib/
|
472 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
473 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
474 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
475 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
476 |
msgid "Groups"
|
477 |
msgstr "Groups"
|
478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
#: lib/admin/class-groups-admin.php:140
|
480 |
msgctxt "menu item title"
|
481 |
msgid "Groups"
|
@@ -486,6 +559,20 @@ msgctxt "page-title"
|
|
486 |
msgid "Groups"
|
487 |
msgstr "Grupos"
|
488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
#: lib/admin/class-groups-admin.php:220
|
490 |
msgid "Groups Add-Ons"
|
491 |
msgstr "Add-Ons para Groups"
|
@@ -494,11 +581,11 @@ msgstr "Add-Ons para Groups"
|
|
494 |
msgid "Groups Capabilities"
|
495 |
msgstr "Capacidades de los Grupos"
|
496 |
|
497 |
-
#: lib/admin/groups-admin-options.php:
|
498 |
msgid "Groups Options"
|
499 |
msgstr "Opciones de Groups"
|
500 |
|
501 |
-
#: lib/admin/groups-admin-options.php:
|
502 |
msgid "Groups network options"
|
503 |
msgstr "Opciones de red para Grupos"
|
504 |
|
@@ -519,11 +606,54 @@ msgstr ""
|
|
519 |
msgid "ID"
|
520 |
msgstr "ID"
|
521 |
|
522 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
msgid "If you lock yourself out, please ask an administrator to help."
|
524 |
msgstr "Si te bloqueas a ti mismo, pide ayuda a un administrador."
|
525 |
|
526 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
msgid ""
|
528 |
"Include these capabilities to enforce read access on posts. The selected "
|
529 |
"capabilities will be offered to restrict access to posts."
|
@@ -535,6 +665,14 @@ msgstr ""
|
|
535 |
msgid "Inherited capabilities:"
|
536 |
msgstr "Capacidades "
|
537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
538 |
#: lib/views/class-groups-shortcodes.php:469
|
539 |
#, php-format
|
540 |
msgid "Join the %s group"
|
@@ -545,7 +683,12 @@ msgstr "Unirse al grupo %s"
|
|
545 |
msgid "Leave the %s group"
|
546 |
msgstr "Dejar el grupo %s"
|
547 |
|
548 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
549 |
msgid ""
|
550 |
"Let's assume that you want to limit the visibility of a post to members of "
|
551 |
"the <em>Premium</em> group."
|
@@ -557,12 +700,13 @@ msgstr ""
|
|
557 |
msgid "Log out"
|
558 |
msgstr "Desconectar"
|
559 |
|
560 |
-
#:
|
|
|
561 |
msgid "Media"
|
562 |
msgstr "Multimedia"
|
563 |
|
564 |
-
#:
|
565 |
-
#:
|
566 |
#, php-format
|
567 |
msgid "Members of the %1$s group can access this %2$s through this capability."
|
568 |
msgid_plural ""
|
@@ -578,7 +722,7 @@ msgstr[1] ""
|
|
578 |
msgid "Name"
|
579 |
msgstr "Nombre"
|
580 |
|
581 |
-
#: lib/admin/groups-admin-options.php:
|
582 |
msgid "Network deactivation and data persistence"
|
583 |
msgstr "Desactivación y persistencia de los datos"
|
584 |
|
@@ -586,12 +730,16 @@ msgstr "Desactivación y persistencia de los datos"
|
|
586 |
msgid "New Capability"
|
587 |
msgstr "Nueva capacidad"
|
588 |
|
|
|
|
|
|
|
|
|
589 |
#: lib/admin/groups-admin-groups.php:212
|
590 |
msgid "New Group"
|
591 |
msgstr "Nuevo Grupo"
|
592 |
|
593 |
-
#:
|
594 |
-
#:
|
595 |
msgid ""
|
596 |
"No groups grant access through this capability. To grant access to group "
|
597 |
"members using this capability, you should assign it to a group and enable "
|
@@ -623,12 +771,41 @@ msgstr "No existe ese grupo."
|
|
623 |
msgid "No such groups."
|
624 |
msgstr "No existen esos grupos."
|
625 |
|
626 |
-
#:
|
627 |
msgid ""
|
628 |
"Note that you must be a member of a group that has such a capability "
|
629 |
"assigned."
|
630 |
msgstr "Debes ser miembro de un grupo que tenga dicha capacidad asignada."
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
#: lib/admin/groups-admin-capabilities.php:121
|
633 |
#, php-format
|
634 |
msgid "One capability has been added."
|
@@ -636,12 +813,16 @@ msgid_plural "%d capabilities have been added."
|
|
636 |
msgstr[0] "Se ha asignado una capacidad."
|
637 |
msgstr[1] "Se han asignado %d capacidades."
|
638 |
|
639 |
-
#:
|
640 |
msgid "One or more capabilities required to read the entry."
|
641 |
msgstr "Se necesitan una o más capacidades para leer la entrada."
|
642 |
|
643 |
-
#: lib/
|
644 |
-
|
|
|
|
|
|
|
|
|
645 |
#, php-format
|
646 |
msgid ""
|
647 |
"Only groups or users that have one of the selected capabilities are allowed "
|
@@ -655,7 +836,7 @@ msgstr ""
|
|
655 |
msgid "Options"
|
656 |
msgstr "Opciones"
|
657 |
|
658 |
-
#: lib/admin/groups-admin-options.php:
|
659 |
msgid "Options saved."
|
660 |
msgstr "Opciones guardadas."
|
661 |
|
@@ -664,7 +845,12 @@ msgstr "Opciones guardadas."
|
|
664 |
msgid "Parent"
|
665 |
msgstr "Padre"
|
666 |
|
667 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
668 |
msgid "Permissions"
|
669 |
msgstr "Permisos"
|
670 |
|
@@ -692,27 +878,64 @@ msgstr ""
|
|
692 |
"Gracias por dejar una valoración <a href=\"%s\">★★★★"
|
693 |
"★</a>."
|
694 |
|
695 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
msgid "Post"
|
697 |
msgstr "Entrada"
|
698 |
|
699 |
-
#: lib/admin/groups-admin-options.php:
|
700 |
msgid "Post types"
|
701 |
msgstr "Tipos de entradas"
|
702 |
|
703 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
msgid "Quick-create group & capability"
|
705 |
msgstr "Crear al instante grupo y capacidad"
|
706 |
|
707 |
-
#: lib/access/class-groups-
|
|
|
|
|
|
|
|
|
|
|
708 |
msgid "Read Post"
|
709 |
msgstr "Leer entrada"
|
710 |
|
711 |
-
#: lib/admin/groups-admin-add-ons.php:
|
712 |
msgid "Recommended extensions for Groups"
|
713 |
msgstr "Extensiones recomendadas para Groups"
|
714 |
|
715 |
-
#: lib/admin/groups-admin-add-ons.php:
|
716 |
msgid "Recommended plugins by itthinx"
|
717 |
msgstr "Plugins recomendados de itthinx"
|
718 |
|
@@ -751,7 +974,7 @@ msgstr "Eliminar capacidades"
|
|
751 |
msgid "Remove capability"
|
752 |
msgstr "Eliminar capacidad"
|
753 |
|
754 |
-
#: lib/admin/class-groups-admin-users.php:
|
755 |
msgid "Remove from group"
|
756 |
msgstr "Eliminar de un grupo"
|
757 |
|
@@ -763,43 +986,69 @@ msgstr "Eliminar grupo"
|
|
763 |
msgid "Remove groups"
|
764 |
msgstr "Eliminar grupos"
|
765 |
|
766 |
-
#:
|
|
|
767 |
msgid "Remove restriction"
|
768 |
msgstr "Eliminar restricción"
|
769 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
#: lib/admin/groups-admin-capabilities.php:357
|
771 |
#: lib/admin/groups-admin-groups.php:346
|
772 |
msgid "Results per page"
|
773 |
msgstr "Resultados por página"
|
774 |
|
775 |
-
#: lib/admin/groups-admin-options.php:
|
776 |
msgid "Role"
|
777 |
msgstr "Rol"
|
778 |
|
779 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
780 |
#: lib/admin/groups-admin-groups-edit.php:158
|
781 |
-
#: lib/admin/groups-admin-options.php:
|
782 |
-
#: lib/admin/groups-admin-options.php:
|
783 |
-
#: lib/admin/groups-admin-options.php:
|
784 |
msgid "Save"
|
785 |
msgstr "Guardar"
|
786 |
|
787 |
-
#: lib/admin/groups-admin-options.php:
|
788 |
msgid "Show access restrictions for these post types."
|
789 |
msgstr "Mostrar restricciones de acceso para este tipo de entradas."
|
790 |
|
791 |
-
#:
|
792 |
msgid "Show groups"
|
793 |
msgstr "Mostrar grupos"
|
794 |
|
795 |
-
#: lib/admin/groups-admin-options.php:
|
796 |
msgid "Show groups in user profiles."
|
797 |
msgstr "Mostrar grupos en los perfiles de usuario."
|
798 |
|
799 |
-
#: lib/admin/groups-admin-options.php:
|
800 |
msgid "Show the Groups tree view."
|
801 |
msgstr "Mostrar la vista en árbol de los Grupos."
|
802 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
803 |
#: lib/core/class-groups-help.php:141
|
804 |
msgid ""
|
805 |
"Thank you for using <a href=\"http://www.itthinx.com/plugins/groups\" target="
|
@@ -810,6 +1059,14 @@ msgstr ""
|
|
810 |
"\"_blank\">Groups</a> de <a href=\"http://www.itthinx.com\" target=\"_blank"
|
811 |
"\">itthinx</a>."
|
812 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
813 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
814 |
#, php-format
|
815 |
msgid ""
|
@@ -882,11 +1139,15 @@ msgstr ""
|
|
882 |
"La documentación completa está disponible en las páginas de <a href=\"http://"
|
883 |
"docs.itthinx.com/document/groups\">Documentación</a> de Groups."
|
884 |
|
|
|
|
|
|
|
|
|
885 |
#: lib/admin/groups-admin-groups.php:76
|
886 |
msgid "The group has been deleted."
|
887 |
msgstr "Se ha borrado el grupo."
|
888 |
|
889 |
-
#:
|
890 |
msgid "The manual way:"
|
891 |
msgstr "La forma manual:"
|
892 |
|
@@ -894,11 +1155,12 @@ msgstr "La forma manual:"
|
|
894 |
msgid "The name must not be empty."
|
895 |
msgstr "El nombre no debe estar vacío."
|
896 |
|
897 |
-
#:
|
898 |
msgid "The quick way:"
|
899 |
msgstr "La forma rápida:"
|
900 |
|
901 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
|
|
902 |
msgid "The user is a member of the chosen groups."
|
903 |
msgstr "El usuario es miembro de los grupos seleccionados."
|
904 |
|
@@ -911,7 +1173,7 @@ msgstr "No hay resultados."
|
|
911 |
msgid "These capabilities will be assigned to the group."
|
912 |
msgstr "Estas capacidades se añadirán al grupo."
|
913 |
|
914 |
-
#: lib/admin/groups-admin-options.php:
|
915 |
msgid ""
|
916 |
"These permissions apply to Groups management. They do not apply to access "
|
917 |
"permissions derived from Groups capabilities."
|
@@ -919,7 +1181,11 @@ msgstr ""
|
|
919 |
"Estos permisos se aplican a la gestión de Grupos. No se aplican a los "
|
920 |
"permisos de acceso derivados de las capacidades de Grupos."
|
921 |
|
922 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
923 |
msgid ""
|
924 |
"This determines for which post types access restriction settings are offered."
|
925 |
msgstr ""
|
@@ -930,6 +1196,41 @@ msgstr ""
|
|
930 |
msgid "This group has no capabilities."
|
931 |
msgstr "Este grupo no tiene capacidades."
|
932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
933 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
934 |
msgid "Tree"
|
935 |
msgstr "Árbol"
|
@@ -938,11 +1239,11 @@ msgstr "Árbol"
|
|
938 |
msgid "Tree of Groups"
|
939 |
msgstr "Árbol de Grupos"
|
940 |
|
941 |
-
#: lib/admin/groups-admin-options.php:
|
942 |
msgid "Tree view"
|
943 |
msgstr "Vista en árbol"
|
944 |
|
945 |
-
#:
|
946 |
msgid ""
|
947 |
"Try the quick-create field first. Unless you need a more complex setup, "
|
948 |
"there is no reason to go this way instead."
|
@@ -950,13 +1251,13 @@ msgstr ""
|
|
950 |
"Prueba el campo de creación instantánea primero. A menos que necesites una "
|
951 |
"configuración más compleja, no hay razón para que lo hagas de este otro modo."
|
952 |
|
953 |
-
#:
|
954 |
-
#:
|
955 |
-
#:
|
956 |
msgid "Type and choose …"
|
957 |
msgstr "Escribe y elige …"
|
958 |
|
959 |
-
#:
|
960 |
msgid ""
|
961 |
"Use the <em>Access restrictions</em> box to limit the visibility of posts, "
|
962 |
"pages and other post types."
|
@@ -964,15 +1265,23 @@ msgstr ""
|
|
964 |
"Usa la caja de <em>Restricciones de acceso</em> para limitar la visibilidad "
|
965 |
"a entradas, páginas y otros tipos de entrada."
|
966 |
|
967 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
968 |
msgid "User profiles"
|
969 |
msgstr "Perfiles de usuario"
|
970 |
|
971 |
-
#:
|
972 |
msgid "Using the quick-create field"
|
973 |
msgstr "Usando el campo de creación instantánea"
|
974 |
|
975 |
-
#:
|
976 |
msgid ""
|
977 |
"Using the quick-create field, you can create a new group and capability. The "
|
978 |
"capability will be assigned to the group and enabled to enforce read access. "
|
@@ -993,12 +1302,64 @@ msgstr ""
|
|
993 |
"lectura. Para poder usar la capacidad, tu cuenta de usuario se asignará al "
|
994 |
"grupo."
|
995 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
996 |
#: lib/views/class-groups-shortcodes.php:527
|
997 |
#, php-format
|
998 |
msgid "You are a member of the %s group."
|
999 |
msgstr "Es miembro del grupo %s."
|
1000 |
|
1001 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1002 |
msgid ""
|
1003 |
"You can create a new group and capability here. The capability will be "
|
1004 |
"assigned to the group and enabled to enforce read access. Group names are "
|
@@ -1018,7 +1379,32 @@ msgstr ""
|
|
1018 |
"para forzar el permiso de lectura. Para poder usar la capacidad, tu cuenta "
|
1019 |
"de usuario se asignará al grupo."
|
1020 |
|
1021 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1022 |
msgid ""
|
1023 |
"You can select one or more capabilities that are enabled for access "
|
1024 |
"restriction."
|
@@ -1026,7 +1412,14 @@ msgstr ""
|
|
1026 |
"Puedes seleccionar una o más capacidades que están activadas para la "
|
1027 |
"restricción de acceso."
|
1028 |
|
1029 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
msgid "You cannot set any access restrictions."
|
1031 |
msgstr "No puedes establecer ninguna restricción de acceso."
|
1032 |
|
@@ -1040,7 +1433,7 @@ msgstr "Se ha unido al grupo %s."
|
|
1040 |
msgid "You have left the %s group."
|
1041 |
msgstr "Ha dejado el grupo %s."
|
1042 |
|
1043 |
-
#:
|
1044 |
msgid ""
|
1045 |
"You must be in a group that has at least one capability enabled to enforce "
|
1046 |
"read access."
|
@@ -1048,6 +1441,18 @@ msgstr ""
|
|
1048 |
"Debes pertenecer a un grupo que tenga al menos una capacidad activada para "
|
1049 |
"forzar el permiso de lectura."
|
1050 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
#~ msgid "Capability Id"
|
1052 |
#~ msgstr "Id de la capacidad"
|
1053 |
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Groups\n"
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
+
"POT-Creation-Date: 2017-01-26 20:57+0100\n"
|
8 |
+
"PO-Revision-Date: 2017-01-26 20:58+0100\n"
|
9 |
+
"Last-Translator: Karim\n"
|
10 |
"Language-Team: itthinx.com\n"
|
11 |
"Language: es_ES\n"
|
12 |
"MIME-Version: 1.0\n"
|
14 |
"Content-Transfer-Encoding: 8bit\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Generator: Poedit 1.8.11\n"
|
18 |
|
19 |
#: lib/core/class-groups-pagination.php:140
|
20 |
#, php-format
|
22 |
msgid "%1$s of %2$s"
|
23 |
msgstr "%1$s de %2$s"
|
24 |
|
25 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:184
|
26 |
+
#: lib/admin/class-groups-admin-posts.php:207
|
27 |
msgid "— No Change —"
|
28 |
msgstr "— Sin cambios —"
|
29 |
|
30 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:136
|
31 |
+
#: lib/admin/class-groups-admin-posts.php:148
|
32 |
msgid "(only unrestricted)"
|
33 |
msgstr "(sin restricción)"
|
34 |
|
35 |
+
#: lib/admin/class-groups-admin-users.php:374
|
36 |
msgid "--"
|
37 |
msgstr "--"
|
38 |
|
43 |
msgstr[0] "1 elemento"
|
44 |
msgstr[1] "%s elementos"
|
45 |
|
46 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:76
|
47 |
#, php-format
|
48 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
49 |
msgstr "<span title=\"%s\">Restricción de Acceso</span>"
|
54 |
msgid "<strong>%s</strong>"
|
55 |
msgstr "<strong>%s</strong>"
|
56 |
|
57 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:164
|
58 |
msgid ""
|
59 |
"<sup>*</sup> For each capability, the groups that have the capability "
|
60 |
"assigned are shown within parenthesis. You can choose a capability by typing "
|
68 |
msgid "A Duck!"
|
69 |
msgstr "Un Pato!"
|
70 |
|
71 |
+
#: lib/admin/groups-admin-options.php:269
|
72 |
msgid "A minimum set of permissions will be preserved."
|
73 |
msgstr "Se preservarán un mínimo de permisos."
|
74 |
|
76 |
msgid "Access Groups"
|
77 |
msgstr "Acceder a Groups"
|
78 |
|
79 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:181
|
80 |
msgid "Access Restrictions"
|
81 |
msgstr "Restricción de Acceso"
|
82 |
|
110 |
#: lib/admin/groups-admin-groups-remove.php:181
|
111 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
112 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
113 |
+
#: lib/admin/groups-admin-options.php:39 lib/admin/groups-admin-options.php:317
|
114 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
115 |
#: lib/test/groups-tests.php:391
|
116 |
msgid "Access denied."
|
117 |
msgstr "Acceso denegado."
|
118 |
|
119 |
+
#: lib/admin/groups-admin-options.php:214
|
120 |
msgid "Access restricions"
|
121 |
msgstr "Restricciones de acceso"
|
122 |
|
123 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:97
|
124 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:107
|
125 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:121
|
126 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:124
|
127 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:592
|
128 |
msgid "Access restrictions"
|
129 |
msgstr "Restricciones de acceso"
|
130 |
|
131 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:124
|
132 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:125
|
133 |
msgid "Access restrictions …"
|
134 |
msgstr "Restricción de acceso …"
|
135 |
|
152 |
msgid "Add capability"
|
153 |
msgstr "Añadir capacidad"
|
154 |
|
155 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:185
|
156 |
+
#: lib/admin/class-groups-admin-posts.php:208
|
157 |
msgid "Add restriction"
|
158 |
msgstr "Añadir restricción"
|
159 |
|
160 |
+
#: lib/admin/class-groups-admin-users.php:212
|
161 |
msgid "Add to group"
|
162 |
msgstr "Añadir a grupo"
|
163 |
|
164 |
+
#: lib/admin/class-groups-admin-welcome.php:214
|
165 |
+
#: lib/admin/class-groups-admin.php:221 lib/admin/groups-admin-add-ons.php:32
|
166 |
msgid "Add-Ons"
|
167 |
msgstr "Add-Ons"
|
168 |
|
169 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:150
|
170 |
msgid ""
|
171 |
"Adding the group and capability manually and enabling it for access "
|
172 |
"restriction"
|
182 |
msgid "Administer Groups plugin options"
|
183 |
msgstr "Administrar opciones de Groups"
|
184 |
|
185 |
+
#: lib/admin/groups-admin-options.php:206
|
186 |
msgid "Administrator Access Override"
|
187 |
msgstr "Acceso general del Administrador"
|
188 |
|
189 |
+
#: lib/admin/groups-admin-options.php:210
|
190 |
msgid ""
|
191 |
"Administrators override all access permissions derived from Groups "
|
192 |
"capabilities."
|
194 |
"Los administradores heredan todos los permisos de acceso derivados de las "
|
195 |
"capacidades de Grupos."
|
196 |
|
197 |
+
#: lib/admin/class-groups-admin-posts.php:165
|
198 |
+
msgid "Also look for groups related to terms"
|
199 |
+
msgstr "Mirar también en grupos relacionados con términos"
|
200 |
+
|
201 |
+
#: lib/admin/class-groups-admin-welcome.php:167
|
202 |
+
msgid ""
|
203 |
+
"And you can now filter the list of users by one or multiple groups with one "
|
204 |
+
"convenient field."
|
205 |
+
msgstr ""
|
206 |
+
"Y ahora se puede filtrar la lista de usuarios por uno o múltiples grupos con "
|
207 |
+
"un campo conveniente."
|
208 |
+
|
209 |
+
#: lib/admin/class-groups-admin-welcome.php:165
|
210 |
+
msgid ""
|
211 |
+
"Another improvement is better filtering by groups and a reduced footprint on "
|
212 |
+
"the Users admin screen."
|
213 |
+
msgstr ""
|
214 |
+
"Otra mejora se centra en el filtrado por grupos y un impacto reducido sobre "
|
215 |
+
"la pantalla de administración de Usuarios."
|
216 |
+
|
217 |
+
#: lib/access/class-groups-access-meta-boxes.php:206
|
218 |
+
#: lib/access/class-groups-access-meta-boxes.php:207
|
219 |
+
#: lib/access/class-groups-access-meta-boxes.php:441
|
220 |
+
#: lib/access/class-groups-access-meta-boxes.php:442
|
221 |
+
msgid "Anyone …"
|
222 |
+
msgstr "Todos …"
|
223 |
+
|
224 |
+
#: lib/admin/class-groups-admin-users.php:215
|
225 |
#: lib/admin/groups-admin-capabilities.php:334
|
226 |
#: lib/admin/groups-admin-capabilities.php:360
|
227 |
#: lib/admin/groups-admin-capabilities.php:374
|
230 |
msgid "Apply"
|
231 |
msgstr "Aplicar"
|
232 |
|
233 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:160
|
234 |
msgid ""
|
235 |
"Become a member of the <em>Premium</em> group - this is required so you can "
|
236 |
"choose the <em>premium</em> capability to restrict access to a post."
|
243 |
msgid "Bulk Actions"
|
244 |
msgstr "Acciones en Lote"
|
245 |
|
246 |
+
#: lib/admin/groups-admin-options.php:351
|
247 |
msgid ""
|
248 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
249 |
"plugin settings and data will be DELETED for <strong>all sites</strong>. If "
|
258 |
"responsabilidad por la pérdida de cualquier dato o cualquier otra "
|
259 |
"consecuencia."
|
260 |
|
261 |
+
#: lib/admin/groups-admin-options.php:283
|
262 |
msgid ""
|
263 |
"CAUTION: If this option is active while the plugin is deactivated, ALL "
|
264 |
"plugin settings and data will be DELETED. If you are going to use this "
|
284 |
msgid "Cancel"
|
285 |
msgstr "Cancelar"
|
286 |
|
287 |
+
#: legacy/admin/groups-admin-options-legacy.php:58
|
288 |
#: lib/admin/class-groups-admin.php:195
|
289 |
#: lib/admin/groups-admin-capabilities.php:192
|
290 |
#: lib/admin/groups-admin-groups-add.php:97
|
291 |
#: lib/admin/groups-admin-groups-edit.php:117
|
292 |
+
#: lib/admin/groups-admin-groups.php:306 lib/core/class-groups-help.php:71
|
|
|
293 |
msgid "Capabilities"
|
294 |
msgstr "Capacidades"
|
295 |
|
313 |
msgid "Capability ID"
|
314 |
msgstr "ID Capacidad"
|
315 |
|
316 |
+
#: lib/admin/class-groups-admin-posts.php:221
|
317 |
+
#: lib/admin/class-groups-admin-posts.php:222
|
318 |
+
msgid "Choose access restriction groups …"
|
319 |
+
msgstr "Seleccionar grupos para restringir el acceso …"
|
320 |
+
|
321 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:195
|
322 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:196
|
323 |
msgid "Choose access restrictions …"
|
324 |
msgstr "Elegir restricciones de acceso"
|
325 |
|
328 |
msgid "Choose capabilities …"
|
329 |
msgstr "Elegir capacidades …"
|
330 |
|
331 |
+
#: lib/admin/class-groups-admin-user-profile.php:80
|
332 |
+
#: lib/admin/class-groups-admin-user-profile.php:81
|
333 |
+
#: lib/admin/class-groups-admin-user-profile.php:167
|
334 |
+
#: lib/admin/class-groups-admin-user-profile.php:168
|
335 |
+
#: lib/admin/class-groups-admin-users.php:190
|
336 |
+
#: lib/admin/class-groups-admin-users.php:191
|
337 |
+
#: lib/admin/class-groups-admin-users.php:251
|
338 |
+
#: lib/admin/class-groups-admin-users.php:252
|
339 |
msgid "Choose groups …"
|
340 |
msgstr "Elegir grupos …"
|
341 |
|
342 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:214
|
343 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:541
|
344 |
msgid ""
|
345 |
"Choose one or more capabilities to restrict access. Groups that grant access "
|
346 |
"through the capabilities are shown in parenthesis. If no capabilities are "
|
352 |
"hubiese capacidades disponibles, puedes usar la caja de creación instantánea "
|
353 |
"para crear un grupo y una capacidad sobre la marcha."
|
354 |
|
355 |
+
#: lib/access/class-groups-access-meta-boxes.php:132
|
356 |
+
msgid ""
|
357 |
+
"Choose or enter <em>Premium</em> in the <em>Read</em> field located in the "
|
358 |
+
"<em>Groups</em> box and save or update the post (or hit Enter)."
|
359 |
+
msgstr ""
|
360 |
+
"Seleccionar o introducir <em>Premium</em> en el campo <em>Leer</em> ubicado "
|
361 |
+
"en la caja <em>Grupos</em> y guardar o actualizar la entrada (o pulsar la "
|
362 |
+
"tecla de Entrada)."
|
363 |
+
|
364 |
#: lib/admin/groups-admin-capabilities.php:335
|
365 |
#: lib/admin/groups-admin-groups.php:324
|
366 |
msgid "Clear"
|
378 |
msgid "Click to refresh capabilities"
|
379 |
msgstr "Haz click para actualizar las capacidades"
|
380 |
|
381 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:274
|
382 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
383 |
msgstr ""
|
384 |
"Haz click para cambiar el despliegue de grupos que otorga las capacidades"
|
385 |
|
386 |
+
#: lib/admin/groups-admin-options.php:275
|
387 |
msgid "Deactivation and data persistence"
|
388 |
msgstr "Desactivación y persistencia de los datos"
|
389 |
|
390 |
+
#: lib/admin/groups-admin-options.php:348
|
391 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
392 |
msgstr "Borrar todos los datos de los plugins al desactivar"
|
393 |
|
394 |
+
#: lib/admin/groups-admin-options.php:279
|
395 |
msgid "Delete all Groups plugin data on deactivation"
|
396 |
msgstr "Borrar todos los datos de los plugin al desactivar"
|
397 |
|
404 |
msgid "Description"
|
405 |
msgstr "Descripción"
|
406 |
|
407 |
+
#: lib/admin/groups-admin-options.php:243
|
408 |
msgid ""
|
409 |
"Disabling this setting for a post type does not remove existing access "
|
410 |
"restrictions on individual posts of that type."
|
425 |
msgid "Edit a group"
|
426 |
msgstr "Editar un grupo"
|
427 |
|
428 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:161
|
429 |
msgid ""
|
430 |
"Edit the post for which you want to restrict access and choose<sup>*</sup> "
|
431 |
"the <em>premium</em> capability."
|
433 |
"Edita la entrada a la cual quieres restringir acceso y elige la <sup>*</"
|
434 |
"sup>capacidad <em>premium</em> ."
|
435 |
|
436 |
+
#: lib/admin/groups-admin-options.php:292
|
437 |
+
msgid "Enable legacy access control based on capabilities."
|
438 |
+
msgstr "Habilitar el control de acceso legado basado en capacidades."
|
439 |
+
|
440 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:204
|
441 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:505
|
442 |
msgid "Enforce read access"
|
443 |
msgstr "Forzar permiso de lectura"
|
444 |
|
445 |
+
#: lib/admin/groups-admin-options.php:189
|
446 |
msgid ""
|
447 |
"Enhanced functionality is available via official <a href=\"http://www."
|
448 |
"itthinx.com/shop/\">Extensions</a> for Groups."
|
450 |
"Funcionalidad extendida está disponible a través de <a href=\"http://www."
|
451 |
"itthinx.com/shop/\">Extensiones</a> oficiales para Groups."
|
452 |
|
453 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:143
|
454 |
msgid ""
|
455 |
"Enter <em>Premium</em> in the quick-create field located in the Access "
|
456 |
"restrictions panel and save or update the post (or hit Enter)."
|
459 |
"en el panel de Restricción de Acceso y guarda o actualiza la entrada (o "
|
460 |
"pulsa Entrar)."
|
461 |
|
462 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:135
|
463 |
+
#: lib/access/class-groups-access-meta-boxes.php:126
|
464 |
msgid "Example:"
|
465 |
msgstr "Ejemplo:"
|
466 |
|
467 |
+
#: lib/admin/class-groups-admin-users.php:275
|
468 |
+
msgid "Filter"
|
469 |
+
msgstr "Filtrar"
|
470 |
+
|
471 |
#: lib/admin/groups-admin-capabilities.php:324
|
472 |
#: lib/admin/groups-admin-groups.php:315
|
473 |
msgid "Filters"
|
474 |
msgstr "Filtros"
|
475 |
|
476 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:157
|
477 |
msgid ""
|
478 |
"Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> "
|
479 |
"capability."
|
481 |
"Dirígete a <strong>Groups > Capacidades</strong> y añade la capacidad "
|
482 |
"<em>premium</em>."
|
483 |
|
484 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:156
|
485 |
msgid ""
|
486 |
"Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group."
|
487 |
msgstr ""
|
488 |
"Dirígete a <strong>Groups > Grupos</strong> y añade el grupo <em>Premium</"
|
489 |
"em>."
|
490 |
|
491 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:158
|
492 |
msgid ""
|
493 |
"Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> "
|
494 |
"capability to the <em>Premium</em> group."
|
496 |
"Dirígete a <strong>Groups > Grupos</strong> y asigna la capacidad "
|
497 |
"<em>premium</em> al grupo <em>Premium</em>."
|
498 |
|
499 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:159
|
500 |
msgid ""
|
501 |
"Go to <strong>Groups > Options</strong> and enable the <em>premium</em> "
|
502 |
"capability to restrict access."
|
508 |
msgid "Group"
|
509 |
msgstr "Grupo"
|
510 |
|
511 |
+
#: lib/admin/class-groups-admin-users.php:211
|
512 |
msgid "Group Actions"
|
513 |
msgstr "Acciones de Grupo"
|
514 |
|
525 |
msgid "Group Name : %s"
|
526 |
msgstr "Nombre del Grupo : %s"
|
527 |
|
528 |
+
#: lib/access/class-groups-access-meta-boxes.php:112
|
529 |
+
#: lib/access/class-groups-access-meta-boxes.php:115
|
530 |
+
#: lib/access/class-groups-access-meta-boxes.php:463
|
531 |
+
#: lib/admin/class-groups-admin-posts.php:204
|
532 |
+
#: lib/admin/class-groups-admin-user-profile.php:72
|
533 |
+
#: lib/admin/class-groups-admin-user-profile.php:133
|
534 |
+
#: lib/admin/class-groups-admin-user-profile.php:157
|
535 |
+
#: lib/admin/class-groups-admin-users.php:347
|
536 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
537 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
538 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
539 |
msgid "Groups"
|
540 |
msgstr "Groups"
|
541 |
|
542 |
+
#: lib/admin/class-groups-admin-post-columns.php:93
|
543 |
+
msgctxt "Column header"
|
544 |
+
msgid "Groups"
|
545 |
+
msgstr "Grupos"
|
546 |
+
|
547 |
+
#: lib/access/class-groups-access-meta-boxes.php:98
|
548 |
+
msgctxt "Meta box title"
|
549 |
+
msgid "Groups"
|
550 |
+
msgstr "Grupos"
|
551 |
+
|
552 |
#: lib/admin/class-groups-admin.php:140
|
553 |
msgctxt "menu item title"
|
554 |
msgid "Groups"
|
559 |
msgid "Groups"
|
560 |
msgstr "Grupos"
|
561 |
|
562 |
+
#: lib/admin/class-groups-admin-welcome.php:182
|
563 |
+
#, php-format
|
564 |
+
msgid ""
|
565 |
+
"Groups %s features a simpler model for access restrictions based on groups "
|
566 |
+
"instead of capabilities used in previous versions."
|
567 |
+
msgstr ""
|
568 |
+
"Groups %s proporciona un modelo más simple para las restricciones de acceso, "
|
569 |
+
"basado en grupos en vez de capacidades usadas en versiones anteriores."
|
570 |
+
|
571 |
+
#: lib/admin/class-groups-admin-posts.php:136
|
572 |
+
#: lib/admin/class-groups-admin-posts.php:137
|
573 |
+
msgid "Groups …"
|
574 |
+
msgstr "Grupos …"
|
575 |
+
|
576 |
#: lib/admin/class-groups-admin.php:220
|
577 |
msgid "Groups Add-Ons"
|
578 |
msgstr "Add-Ons para Groups"
|
581 |
msgid "Groups Capabilities"
|
582 |
msgstr "Capacidades de los Grupos"
|
583 |
|
584 |
+
#: lib/admin/groups-admin-options.php:129
|
585 |
msgid "Groups Options"
|
586 |
msgstr "Opciones de Groups"
|
587 |
|
588 |
+
#: lib/admin/groups-admin-options.php:323
|
589 |
msgid "Groups network options"
|
590 |
msgstr "Opciones de red para Grupos"
|
591 |
|
606 |
msgid "ID"
|
607 |
msgstr "ID"
|
608 |
|
609 |
+
#: lib/admin/class-groups-admin-welcome.php:201
|
610 |
+
msgid ""
|
611 |
+
"If you had any access restrictions in place based on capabilities, the "
|
612 |
+
"entries will now be unprotected, unless you enable legacy access "
|
613 |
+
"restrictions or place appropriate access restrictions based on groups on the "
|
614 |
+
"desired entries."
|
615 |
+
msgstr ""
|
616 |
+
"Si había restricciones de acceso basadas en capacidades, las entradas "
|
617 |
+
"estarán ahora desprotegidas, salvo que se hayan habilitado las restricciones "
|
618 |
+
"de acceso legadas o se han puesto restricciones de acceso basado en grupos "
|
619 |
+
"en las entradas deseadas."
|
620 |
+
|
621 |
+
#: lib/admin/groups-admin-options.php:271
|
622 |
msgid "If you lock yourself out, please ask an administrator to help."
|
623 |
msgstr "Si te bloqueas a ti mismo, pide ayuda a un administrador."
|
624 |
|
625 |
+
#: lib/admin/class-groups-admin-welcome.php:205
|
626 |
+
msgid ""
|
627 |
+
"If you would like to switch to access restrictions based on groups "
|
628 |
+
"(recommended) instead of capabilities, you can easily do so by setting the "
|
629 |
+
"appropriate groups on your protected posts, pages and other entries to "
|
630 |
+
"restrict access."
|
631 |
+
msgstr ""
|
632 |
+
"Si se desea cambiar a restricciones de acceso basado en grupos (recomendado) "
|
633 |
+
"en vez de capacidades, se puede hacer fácilmente, poniendo los grupos "
|
634 |
+
"apropiados en las entradas y páginas protegidas para restringir el acceso."
|
635 |
+
|
636 |
+
#: lib/admin/class-groups-admin-welcome.php:135
|
637 |
+
msgid "Important"
|
638 |
+
msgstr "Importante"
|
639 |
+
|
640 |
+
#: lib/admin/class-groups-admin-welcome.php:160
|
641 |
+
msgid "Improved User Interface"
|
642 |
+
msgstr "Interfaz de Usuario Mejorada"
|
643 |
+
|
644 |
+
#: lib/access/class-groups-access-meta-boxes.php:136
|
645 |
+
msgid ""
|
646 |
+
"In the same field, you can create a new group and restrict access. Group "
|
647 |
+
"names are case-sensitive. In order to be able to use the new group, your "
|
648 |
+
"user account will be assigned to it. You will not be able to restrict access "
|
649 |
+
"if the group already exists but you do not belong to it."
|
650 |
+
msgstr ""
|
651 |
+
"En el mismo campo se puede crear un nuevo grupo y restringir el acceso. Los "
|
652 |
+
"nombres de grupos distinguen las letras minúsculas de las mayúsculas. Para "
|
653 |
+
"poder usar el nuevo grupo, se le hará miembro del grupo. No se puede "
|
654 |
+
"restringir acceso si el grupo ya existe y no se es miembro de él."
|
655 |
+
|
656 |
+
#: legacy/admin/groups-admin-options-legacy.php:61
|
657 |
msgid ""
|
658 |
"Include these capabilities to enforce read access on posts. The selected "
|
659 |
"capabilities will be offered to restrict access to posts."
|
665 |
msgid "Inherited capabilities:"
|
666 |
msgstr "Capacidades "
|
667 |
|
668 |
+
#: lib/admin/class-groups-admin-welcome.php:138
|
669 |
+
msgid ""
|
670 |
+
"It seems that you have updated from Groups 1.x where access restrictions "
|
671 |
+
"were based on capabilities."
|
672 |
+
msgstr ""
|
673 |
+
"Parece que ha actualizado desde Groups 1.x donde las restricciones de acceso "
|
674 |
+
"estaban basadas en capacidades."
|
675 |
+
|
676 |
#: lib/views/class-groups-shortcodes.php:469
|
677 |
#, php-format
|
678 |
msgid "Join the %s group"
|
683 |
msgid "Leave the %s group"
|
684 |
msgstr "Dejar el grupo %s"
|
685 |
|
686 |
+
#: lib/admin/groups-admin-options.php:288
|
687 |
+
msgid "Legacy Settings"
|
688 |
+
msgstr "Ajustes de Legado"
|
689 |
+
|
690 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:137
|
691 |
+
#: lib/access/class-groups-access-meta-boxes.php:128
|
692 |
msgid ""
|
693 |
"Let's assume that you want to limit the visibility of a post to members of "
|
694 |
"the <em>Premium</em> group."
|
700 |
msgid "Log out"
|
701 |
msgstr "Desconectar"
|
702 |
|
703 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:503
|
704 |
+
#: lib/access/class-groups-access-meta-boxes.php:409
|
705 |
msgid "Media"
|
706 |
msgstr "Multimedia"
|
707 |
|
708 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:231
|
709 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:558
|
710 |
#, php-format
|
711 |
msgid "Members of the %1$s group can access this %2$s through this capability."
|
712 |
msgid_plural ""
|
722 |
msgid "Name"
|
723 |
msgstr "Nombre"
|
724 |
|
725 |
+
#: lib/admin/groups-admin-options.php:345
|
726 |
msgid "Network deactivation and data persistence"
|
727 |
msgstr "Desactivación y persistencia de los datos"
|
728 |
|
730 |
msgid "New Capability"
|
731 |
msgstr "Nueva capacidad"
|
732 |
|
733 |
+
#: lib/admin/class-groups-admin-welcome.php:171
|
734 |
+
msgid "New Documentation"
|
735 |
+
msgstr "Nueva Documentación"
|
736 |
+
|
737 |
#: lib/admin/groups-admin-groups.php:212
|
738 |
msgid "New Group"
|
739 |
msgstr "Nuevo Grupo"
|
740 |
|
741 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:240
|
742 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:567
|
743 |
msgid ""
|
744 |
"No groups grant access through this capability. To grant access to group "
|
745 |
"members using this capability, you should assign it to a group and enable "
|
771 |
msgid "No such groups."
|
772 |
msgstr "No existen esos grupos."
|
773 |
|
774 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:132
|
775 |
msgid ""
|
776 |
"Note that you must be a member of a group that has such a capability "
|
777 |
"assigned."
|
778 |
msgstr "Debes ser miembro de un grupo que tenga dicha capacidad asignada."
|
779 |
|
780 |
+
#: lib/access/class-groups-access-meta-boxes.php:123
|
781 |
+
msgid "Note that you must be a member of a group to use it to restrict access."
|
782 |
+
msgstr ""
|
783 |
+
"Hay que ser miembro de un grupo para poder restringir el acceso con él."
|
784 |
+
|
785 |
+
#: lib/admin/class-groups-admin-welcome.php:163
|
786 |
+
msgid ""
|
787 |
+
"Now you can assign new users directly to groups when you create a new user "
|
788 |
+
"account from the Dashboard."
|
789 |
+
msgstr ""
|
790 |
+
"Ahora se pueden asignar los nuevos usuarios directamente a grupos cuando se "
|
791 |
+
"crea la cuenta de usuario desde el Escritorio."
|
792 |
+
|
793 |
+
#: lib/admin/class-groups-admin-welcome.php:154
|
794 |
+
msgid ""
|
795 |
+
"Now you can protect your posts, pages and any other custom post type like "
|
796 |
+
"products or events by simply assigning them to one or more groups."
|
797 |
+
msgstr ""
|
798 |
+
"Ya se pueden proteger a las entradas, páginas y otros tipos de entrada como "
|
799 |
+
"productos o eventos, simplemente asignando uno o más grupos."
|
800 |
+
|
801 |
+
#: lib/admin/class-groups-admin-welcome.php:207
|
802 |
+
msgid ""
|
803 |
+
"Once you have adjusted your access restrictions based on groups, you can "
|
804 |
+
"disable legacy access control."
|
805 |
+
msgstr ""
|
806 |
+
"Una vez ajustadas las restricciones de acceso basadas en grupos, se puede "
|
807 |
+
"desactivar el control de acceso legado."
|
808 |
+
|
809 |
#: lib/admin/groups-admin-capabilities.php:121
|
810 |
#, php-format
|
811 |
msgid "One capability has been added."
|
813 |
msgstr[0] "Se ha asignado una capacidad."
|
814 |
msgstr[1] "Se han asignado %d capacidades."
|
815 |
|
816 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:77
|
817 |
msgid "One or more capabilities required to read the entry."
|
818 |
msgstr "Se necesitan una o más capacidades para leer la entrada."
|
819 |
|
820 |
+
#: lib/admin/class-groups-admin-post-columns.php:92
|
821 |
+
msgid "One or more groups granting access to entries."
|
822 |
+
msgstr "Uno o más grupos que conceden el acceso a entradas."
|
823 |
+
|
824 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:270
|
825 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:588
|
826 |
#, php-format
|
827 |
msgid ""
|
828 |
"Only groups or users that have one of the selected capabilities are allowed "
|
836 |
msgid "Options"
|
837 |
msgstr "Opciones"
|
838 |
|
839 |
+
#: lib/admin/groups-admin-options.php:121
|
840 |
msgid "Options saved."
|
841 |
msgstr "Opciones guardadas."
|
842 |
|
845 |
msgid "Parent"
|
846 |
msgstr "Padre"
|
847 |
|
848 |
+
#: lib/admin/class-groups-admin-welcome.php:217
|
849 |
+
msgid "Perfect complements to memberships and access control with Groups."
|
850 |
+
msgstr ""
|
851 |
+
"Complementos perfectos para la membresía y el control de acceso con Groups."
|
852 |
+
|
853 |
+
#: lib/admin/groups-admin-options.php:265
|
854 |
msgid "Permissions"
|
855 |
msgstr "Permisos"
|
856 |
|
878 |
"Gracias por dejar una valoración <a href=\"%s\">★★★★"
|
879 |
"★</a>."
|
880 |
|
881 |
+
#: lib/admin/class-groups-admin-welcome.php:140
|
882 |
+
#, php-format
|
883 |
+
msgid ""
|
884 |
+
"Please make sure to read the notes on <strong>Switching to Groups %s</"
|
885 |
+
"strong> below."
|
886 |
+
msgstr ""
|
887 |
+
"Por favor asegurarse de leer las notas en <strong>Cambiar a Groups %s</"
|
888 |
+
"strong> abajo."
|
889 |
+
|
890 |
+
#: lib/admin/class-groups-admin-welcome.php:209
|
891 |
+
msgid ""
|
892 |
+
"Please refer to the <a target=\"_blank\" href=\"http://docs.itthinx.com/"
|
893 |
+
"document/groups/\">Documentation</a> for details on how to switch to and use "
|
894 |
+
"the new access restrictions."
|
895 |
+
msgstr ""
|
896 |
+
"Ver la <a target=\"_blank\" href=\"http://docs.itthinx.com/document/groups/"
|
897 |
+
"\">Documentación</a> para más información sobre cómo cambiar a y usar las "
|
898 |
+
"nuevas restricciones de acceso."
|
899 |
+
|
900 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:189
|
901 |
+
#: lib/access/class-groups-access-meta-boxes.php:162
|
902 |
msgid "Post"
|
903 |
msgstr "Entrada"
|
904 |
|
905 |
+
#: lib/admin/groups-admin-options.php:216
|
906 |
msgid "Post types"
|
907 |
msgstr "Tipos de entradas"
|
908 |
|
909 |
+
#: lib/admin/class-groups-admin-welcome.php:156
|
910 |
+
msgid ""
|
911 |
+
"Previously we used capabilities to do that, but changing to this new model "
|
912 |
+
"makes things even easier."
|
913 |
+
msgstr ""
|
914 |
+
"Antes usábamos las capacidades para hacerlo pero el cambio al nuevo modelo "
|
915 |
+
"simplifica las cosas aun más."
|
916 |
+
|
917 |
+
#: lib/admin/class-groups-admin-welcome.php:149
|
918 |
+
msgid "Protect Content Easily"
|
919 |
+
msgstr "Proteger Contenido Fácilmente"
|
920 |
+
|
921 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:308
|
922 |
msgid "Quick-create group & capability"
|
923 |
msgstr "Crear al instante grupo y capacidad"
|
924 |
|
925 |
+
#: lib/access/class-groups-access-meta-boxes.php:200
|
926 |
+
#: lib/access/class-groups-access-meta-boxes.php:411
|
927 |
+
msgid "Read"
|
928 |
+
msgstr "Leer"
|
929 |
+
|
930 |
+
#: legacy/access/class-groups-post-access-legacy.php:52
|
931 |
msgid "Read Post"
|
932 |
msgstr "Leer entrada"
|
933 |
|
934 |
+
#: lib/admin/groups-admin-add-ons.php:49
|
935 |
msgid "Recommended extensions for Groups"
|
936 |
msgstr "Extensiones recomendadas para Groups"
|
937 |
|
938 |
+
#: lib/admin/groups-admin-add-ons.php:157
|
939 |
msgid "Recommended plugins by itthinx"
|
940 |
msgstr "Plugins recomendados de itthinx"
|
941 |
|
974 |
msgid "Remove capability"
|
975 |
msgstr "Eliminar capacidad"
|
976 |
|
977 |
+
#: lib/admin/class-groups-admin-users.php:213
|
978 |
msgid "Remove from group"
|
979 |
msgstr "Eliminar de un grupo"
|
980 |
|
986 |
msgid "Remove groups"
|
987 |
msgstr "Eliminar grupos"
|
988 |
|
989 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:186
|
990 |
+
#: lib/admin/class-groups-admin-posts.php:209
|
991 |
msgid "Remove restriction"
|
992 |
msgstr "Eliminar restricción"
|
993 |
|
994 |
+
#: lib/admin/groups-admin-options.php:53
|
995 |
+
msgid "Restrict Access"
|
996 |
+
msgstr "Restringir Acceso"
|
997 |
+
|
998 |
+
#: lib/access/class-groups-access-meta-boxes.php:226
|
999 |
+
#, php-format
|
1000 |
+
msgid "Restricts the visibility of this %s to members of the chosen groups."
|
1001 |
+
msgstr ""
|
1002 |
+
"Restringe la visibilidad de esta/e %s a miembros de los grupos seleccionados."
|
1003 |
+
|
1004 |
+
#: lib/access/class-groups-access-meta-boxes.php:459
|
1005 |
+
msgid "Restricts the visibility of this entry to members of the chosen groups."
|
1006 |
+
msgstr ""
|
1007 |
+
"Restringe la visibilidad de esta entrada a miembros de los grupos "
|
1008 |
+
"seleccionados."
|
1009 |
+
|
1010 |
#: lib/admin/groups-admin-capabilities.php:357
|
1011 |
#: lib/admin/groups-admin-groups.php:346
|
1012 |
msgid "Results per page"
|
1013 |
msgstr "Resultados por página"
|
1014 |
|
1015 |
+
#: lib/admin/groups-admin-options.php:144
|
1016 |
msgid "Role"
|
1017 |
msgstr "Rol"
|
1018 |
|
1019 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
1020 |
#: lib/admin/groups-admin-groups-edit.php:158
|
1021 |
+
#: lib/admin/groups-admin-options.php:201
|
1022 |
+
#: lib/admin/groups-admin-options.php:303
|
1023 |
+
#: lib/admin/groups-admin-options.php:355
|
1024 |
msgid "Save"
|
1025 |
msgstr "Guardar"
|
1026 |
|
1027 |
+
#: lib/admin/groups-admin-options.php:219
|
1028 |
msgid "Show access restrictions for these post types."
|
1029 |
msgstr "Mostrar restricciones de acceso para este tipo de entradas."
|
1030 |
|
1031 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:277
|
1032 |
msgid "Show groups"
|
1033 |
msgstr "Mostrar grupos"
|
1034 |
|
1035 |
+
#: lib/admin/groups-admin-options.php:251
|
1036 |
msgid "Show groups in user profiles."
|
1037 |
msgstr "Mostrar grupos en los perfiles de usuario."
|
1038 |
|
1039 |
+
#: lib/admin/groups-admin-options.php:260
|
1040 |
msgid "Show the Groups tree view."
|
1041 |
msgstr "Mostrar la vista en árbol de los Grupos."
|
1042 |
|
1043 |
+
#: lib/admin/class-groups-admin-welcome.php:179
|
1044 |
+
#, php-format
|
1045 |
+
msgid "Switching to Groups %s"
|
1046 |
+
msgstr "Cambiar a Groups %s"
|
1047 |
+
|
1048 |
+
#: lib/admin/class-groups-admin-posts.php:167
|
1049 |
+
msgid "Terms"
|
1050 |
+
msgstr "Términos"
|
1051 |
+
|
1052 |
#: lib/core/class-groups-help.php:141
|
1053 |
msgid ""
|
1054 |
"Thank you for using <a href=\"http://www.itthinx.com/plugins/groups\" target="
|
1059 |
"\"_blank\">Groups</a> de <a href=\"http://www.itthinx.com\" target=\"_blank"
|
1060 |
"\">itthinx</a>."
|
1061 |
|
1062 |
+
#: lib/admin/class-groups-admin-welcome.php:129
|
1063 |
+
msgid ""
|
1064 |
+
"Thanks for using Groups! We have made it even easier to protect your content "
|
1065 |
+
"and hope you like it :)"
|
1066 |
+
msgstr ""
|
1067 |
+
"¡Gracias por usar Groups! Hemos simplificado aun más la protección de "
|
1068 |
+
"contenidos y esperamos que os guste :)"
|
1069 |
+
|
1070 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
1071 |
#, php-format
|
1072 |
msgid ""
|
1139 |
"La documentación completa está disponible en las páginas de <a href=\"http://"
|
1140 |
"docs.itthinx.com/document/groups\">Documentación</a> de Groups."
|
1141 |
|
1142 |
+
#: lib/admin/class-groups-admin-welcome.php:190
|
1143 |
+
msgid "The following is only of interest if you have upgraded from Groups 1.x:"
|
1144 |
+
msgstr "Lo siguiente sólo interesa si se ha actualizado desde Groups 1.x:"
|
1145 |
+
|
1146 |
#: lib/admin/groups-admin-groups.php:76
|
1147 |
msgid "The group has been deleted."
|
1148 |
msgstr "Se ha borrado el grupo."
|
1149 |
|
1150 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:148
|
1151 |
msgid "The manual way:"
|
1152 |
msgstr "La forma manual:"
|
1153 |
|
1155 |
msgid "The name must not be empty."
|
1156 |
msgstr "El nombre no debe estar vacío."
|
1157 |
|
1158 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:139
|
1159 |
msgid "The quick way:"
|
1160 |
msgstr "La forma rápida:"
|
1161 |
|
1162 |
+
#: lib/admin/class-groups-admin-user-profile.php:88
|
1163 |
+
#: lib/admin/class-groups-admin-user-profile.php:176
|
1164 |
msgid "The user is a member of the chosen groups."
|
1165 |
msgstr "El usuario es miembro de los grupos seleccionados."
|
1166 |
|
1173 |
msgid "These capabilities will be assigned to the group."
|
1174 |
msgstr "Estas capacidades se añadirán al grupo."
|
1175 |
|
1176 |
+
#: lib/admin/groups-admin-options.php:266
|
1177 |
msgid ""
|
1178 |
"These permissions apply to Groups management. They do not apply to access "
|
1179 |
"permissions derived from Groups capabilities."
|
1181 |
"Estos permisos se aplican a la gestión de Grupos. No se aplican a los "
|
1182 |
"permisos de acceso derivados de las capacidades de Grupos."
|
1183 |
|
1184 |
+
#: lib/admin/class-groups-admin-welcome.php:199
|
1185 |
+
msgid "This could be important!"
|
1186 |
+
msgstr "¡Esto puede ser importante!"
|
1187 |
+
|
1188 |
+
#: lib/admin/groups-admin-options.php:242
|
1189 |
msgid ""
|
1190 |
"This determines for which post types access restriction settings are offered."
|
1191 |
msgstr ""
|
1196 |
msgid "This group has no capabilities."
|
1197 |
msgstr "Este grupo no tiene capacidades."
|
1198 |
|
1199 |
+
#: lib/admin/class-groups-admin-welcome.php:195
|
1200 |
+
msgid ""
|
1201 |
+
"This means that if you had access restrictions in place that were based on "
|
1202 |
+
"capabilities, your entries will still be protected."
|
1203 |
+
msgstr ""
|
1204 |
+
"Esto significa que si había restricciones de acceso basadas en capacidades, "
|
1205 |
+
"las entradas están aún protegidas."
|
1206 |
+
|
1207 |
+
#: lib/access/class-groups-post-access.php:477
|
1208 |
+
msgid ""
|
1209 |
+
"This method is deprecated. You should use Groups_Post_Access_Legacy::"
|
1210 |
+
"get_read_post_capabilities() to retrieve the capabilities instead."
|
1211 |
+
msgstr ""
|
1212 |
+
"Este método está en desuso. En vez de ello se debería usar "
|
1213 |
+
"Groups_Post_Access_Legacy::get_read_post_capabilities() para obtener las "
|
1214 |
+
"capacidades."
|
1215 |
+
|
1216 |
+
#: lib/admin/class-groups-admin-welcome.php:186
|
1217 |
+
msgid ""
|
1218 |
+
"To make it easier to transition to the new model for those who migrate from "
|
1219 |
+
"a previous version, we have included legacy access control based on "
|
1220 |
+
"capabilities."
|
1221 |
+
msgstr ""
|
1222 |
+
"Para facilitar la transición al nuevo modelo para los que migran de una "
|
1223 |
+
"versión anterior, hemos incluido el control de acceso legado basado en "
|
1224 |
+
"capacidades."
|
1225 |
+
|
1226 |
+
#: lib/admin/class-groups-admin-welcome.php:184
|
1227 |
+
msgid ""
|
1228 |
+
"To put it simple, previously you would have used capabilities to restrict "
|
1229 |
+
"access to posts and now you simply use groups."
|
1230 |
+
msgstr ""
|
1231 |
+
"Simplemente, antes se usaban capacidades para restringir el acceso a las "
|
1232 |
+
"entradas y ahora se utilizan grupos."
|
1233 |
+
|
1234 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
1235 |
msgid "Tree"
|
1236 |
msgstr "Árbol"
|
1239 |
msgid "Tree of Groups"
|
1240 |
msgstr "Árbol de Grupos"
|
1241 |
|
1242 |
+
#: lib/admin/groups-admin-options.php:256
|
1243 |
msgid "Tree view"
|
1244 |
msgstr "Vista en árbol"
|
1245 |
|
1246 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:153
|
1247 |
msgid ""
|
1248 |
"Try the quick-create field first. Unless you need a more complex setup, "
|
1249 |
"there is no reason to go this way instead."
|
1251 |
"Prueba el campo de creación instantánea primero. A menos que necesites una "
|
1252 |
"configuración más compleja, no hay razón para que lo hagas de este otro modo."
|
1253 |
|
1254 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:212
|
1255 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:213
|
1256 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:540
|
1257 |
msgid "Type and choose …"
|
1258 |
msgstr "Escribe y elige …"
|
1259 |
|
1260 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:127
|
1261 |
msgid ""
|
1262 |
"Use the <em>Access restrictions</em> box to limit the visibility of posts, "
|
1263 |
"pages and other post types."
|
1265 |
"Usa la caja de <em>Restricciones de acceso</em> para limitar la visibilidad "
|
1266 |
"a entradas, páginas y otros tipos de entrada."
|
1267 |
|
1268 |
+
#: lib/access/class-groups-access-meta-boxes.php:118
|
1269 |
+
msgid ""
|
1270 |
+
"Use the <em>Groups</em> box to limit the visibility of posts, pages and "
|
1271 |
+
"other post types."
|
1272 |
+
msgstr ""
|
1273 |
+
"Usar la caja <em>Grupos</em> para limitar la visibilidad de entradas, "
|
1274 |
+
"páginas y otros tipos de entrada."
|
1275 |
+
|
1276 |
+
#: lib/admin/groups-admin-options.php:247
|
1277 |
msgid "User profiles"
|
1278 |
msgstr "Perfiles de usuario"
|
1279 |
|
1280 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:141
|
1281 |
msgid "Using the quick-create field"
|
1282 |
msgstr "Usando el campo de creación instantánea"
|
1283 |
|
1284 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:146
|
1285 |
msgid ""
|
1286 |
"Using the quick-create field, you can create a new group and capability. The "
|
1287 |
"capability will be assigned to the group and enabled to enforce read access. "
|
1302 |
"lectura. Para poder usar la capacidad, tu cuenta de usuario se asignará al "
|
1303 |
"grupo."
|
1304 |
|
1305 |
+
#: lib/admin/class-groups-admin-welcome.php:97
|
1306 |
+
msgid "View the Welcome screen for this version of Groups"
|
1307 |
+
msgstr "Ver la pantalla de bienvenida para esta versión de Groups."
|
1308 |
+
|
1309 |
+
#: lib/admin/class-groups-admin-welcome.php:152
|
1310 |
+
msgid "We have made it even easier to protect your content!"
|
1311 |
+
msgstr "Hemos hecho aún más fácil proteger contenidos."
|
1312 |
+
|
1313 |
+
#: lib/admin/class-groups-admin-welcome.php:98
|
1314 |
+
msgid "Welcome"
|
1315 |
+
msgstr "Bienvenidos"
|
1316 |
+
|
1317 |
+
#: lib/admin/class-groups-admin-welcome.php:46
|
1318 |
+
#: lib/admin/class-groups-admin-welcome.php:47
|
1319 |
+
msgid "Welcome to Groups"
|
1320 |
+
msgstr "Bienvenidos a Groups"
|
1321 |
+
|
1322 |
+
#: lib/admin/class-groups-admin-welcome.php:125
|
1323 |
+
#, php-format
|
1324 |
+
msgid "Welcome to Groups %s"
|
1325 |
+
msgstr "Bienvenidos a Groups %s"
|
1326 |
+
|
1327 |
+
#: lib/admin/class-groups-admin-welcome.php:145
|
1328 |
+
msgid "What's New?"
|
1329 |
+
msgstr "¿Qué hay de nuevo?"
|
1330 |
+
|
1331 |
+
#: lib/admin/class-groups-admin-welcome.php:174
|
1332 |
+
msgid ""
|
1333 |
+
"Whether you are new to Groups or have been using it before, please make sure "
|
1334 |
+
"to visit the <a target=\"_blank\" href=\"http://docs.itthinx.com/document/"
|
1335 |
+
"groups/\">Documentation</a> pages to know more about how to use it."
|
1336 |
+
msgstr ""
|
1337 |
+
"Bien si se ha utilizado Groups antes o no, se ruega visitar a las páginas de "
|
1338 |
+
"<a target=\"_blank\" href=\"http://docs.itthinx.com/document/groups/"
|
1339 |
+
"\">Documentación</a> para saber más sobre su uso."
|
1340 |
+
|
1341 |
#: lib/views/class-groups-shortcodes.php:527
|
1342 |
#, php-format
|
1343 |
msgid "You are a member of the %s group."
|
1344 |
msgstr "Es miembro del grupo %s."
|
1345 |
|
1346 |
+
#: lib/admin/class-groups-admin-welcome.php:197
|
1347 |
+
msgid ""
|
1348 |
+
"You are running the system with legacy access control based on capabilities "
|
1349 |
+
"disabled."
|
1350 |
+
msgstr ""
|
1351 |
+
"El sistema está funcionando con el control de acceso legado basado en "
|
1352 |
+
"capacidades desactivado."
|
1353 |
+
|
1354 |
+
#: lib/admin/class-groups-admin-welcome.php:193
|
1355 |
+
msgid ""
|
1356 |
+
"You are running the system with legacy access control based on capabilities "
|
1357 |
+
"enabled."
|
1358 |
+
msgstr ""
|
1359 |
+
"El sistema está funcionando con el control de acceso legado basado en "
|
1360 |
+
"capacidades activado."
|
1361 |
+
|
1362 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:312
|
1363 |
msgid ""
|
1364 |
"You can create a new group and capability here. The capability will be "
|
1365 |
"assigned to the group and enabled to enforce read access. Group names are "
|
1379 |
"para forzar el permiso de lectura. Para poder usar la capacidad, tu cuenta "
|
1380 |
"de usuario se asignará al grupo."
|
1381 |
|
1382 |
+
#: lib/access/class-groups-access-meta-boxes.php:193
|
1383 |
+
#: lib/access/class-groups-access-meta-boxes.php:444
|
1384 |
+
msgid "You can create a new group by indicating the group's name."
|
1385 |
+
msgstr "Se puede crear un nuevo grupo indicando el nombre del grupo."
|
1386 |
+
|
1387 |
+
#: lib/access/class-groups-access-meta-boxes.php:187
|
1388 |
+
#, php-format
|
1389 |
+
msgid ""
|
1390 |
+
"You can restrict the visibility of this %1$s to group members. Choose one or "
|
1391 |
+
"more groups that are allowed to read this %2$s. If no groups are chosen, the "
|
1392 |
+
"%3$s is visible to anyone."
|
1393 |
+
msgstr ""
|
1394 |
+
"Se puede restringir la visibilidad de esta/e %1$s a miembros de grupos. "
|
1395 |
+
"Seleccionar uno o más grupos que tienen permiso de leer esta/e %2$s. Si no "
|
1396 |
+
"se selecciona ningún grupo, el/la %3$s es visible para todo el mundo."
|
1397 |
+
|
1398 |
+
#: lib/access/class-groups-access-meta-boxes.php:443
|
1399 |
+
msgid ""
|
1400 |
+
"You can restrict the visibility to group members. Choose one or more groups "
|
1401 |
+
"to restrict access. If no groups are chosen, this entry is visible to anyone."
|
1402 |
+
msgstr ""
|
1403 |
+
"Se puede restringir la visibilidad a miembros de grupos. Seleccionar uno o "
|
1404 |
+
"más grupos para restringir el acceso. Si no se seleccionan grupos, la "
|
1405 |
+
"entrada queda visible para todos."
|
1406 |
+
|
1407 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:130
|
1408 |
msgid ""
|
1409 |
"You can select one or more capabilities that are enabled for access "
|
1410 |
"restriction."
|
1412 |
"Puedes seleccionar una o más capacidades que están activadas para la "
|
1413 |
"restricción de acceso."
|
1414 |
|
1415 |
+
#: lib/access/class-groups-access-meta-boxes.php:121
|
1416 |
+
msgid "You can select one or more groups to restrict access to its members."
|
1417 |
+
msgstr ""
|
1418 |
+
"Se pueden seleccionar uno o más grupos para restringir el acceso a sus "
|
1419 |
+
"miembros."
|
1420 |
+
|
1421 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:290
|
1422 |
+
#: lib/access/class-groups-access-meta-boxes.php:233
|
1423 |
msgid "You cannot set any access restrictions."
|
1424 |
msgstr "No puedes establecer ninguna restricción de acceso."
|
1425 |
|
1433 |
msgid "You have left the %s group."
|
1434 |
msgstr "Ha dejado el grupo %s."
|
1435 |
|
1436 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:296
|
1437 |
msgid ""
|
1438 |
"You must be in a group that has at least one capability enabled to enforce "
|
1439 |
"read access."
|
1441 |
"Debes pertenecer a un grupo que tenga al menos una capacidad activada para "
|
1442 |
"forzar el permiso de lectura."
|
1443 |
|
1444 |
+
#: lib/access/class-groups-access-meta-boxes.php:239
|
1445 |
+
msgid "You need to have permission to set access restrictions."
|
1446 |
+
msgstr "Se debe disponer de permisos para poner restricciones de acceso."
|
1447 |
+
|
1448 |
+
#: lib/access/class-groups-post-access.php:352
|
1449 |
+
msgid ""
|
1450 |
+
"You should use Groups_Post_Access_Legacy::create() to pass a capability "
|
1451 |
+
"restriction instead."
|
1452 |
+
msgstr ""
|
1453 |
+
"Se debería usar Groups_Post_Access_Legacy::create() para pasar una capacidad "
|
1454 |
+
"de restricción en vez de ello."
|
1455 |
+
|
1456 |
#~ msgid "Capability Id"
|
1457 |
#~ msgstr "Id de la capacidad"
|
1458 |
|
languages/groups.pot
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
msgid ""
|
8 |
msgstr "Project-Id-Version: PACKAGE VERSION\n"
|
9 |
"Report-Msgid-Bugs-To: \n"
|
10 |
-
"POT-Creation-Date:
|
11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -23,15 +23,17 @@ msgctxt "paging"
|
|
23 |
msgid "%1$s of %2$s"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#:
|
|
|
27 |
msgid "— No Change —"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#:
|
|
|
31 |
msgid "(only unrestricted)"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: lib/admin/class-groups-admin-users.php:
|
35 |
msgid "--"
|
36 |
msgstr ""
|
37 |
|
@@ -42,7 +44,7 @@ msgid_plural "%s items"
|
|
42 |
msgstr[0] ""
|
43 |
msgstr[1] ""
|
44 |
|
45 |
-
#:
|
46 |
#, php-format
|
47 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
48 |
msgstr ""
|
@@ -53,7 +55,7 @@ msgstr ""
|
|
53 |
msgid "<strong>%s</strong>"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#:
|
57 |
msgid "<sup>*</sup> For each capability, the groups that have the "
|
58 |
"capability assigned are shown within parenthesis. You can choose a "
|
59 |
"capability by typing part of the group's or the capability's name."
|
@@ -63,7 +65,7 @@ msgstr ""
|
|
63 |
msgid "A Duck!"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: lib/admin/groups-admin-options.php:
|
67 |
msgid "A minimum set of permissions will be preserved."
|
68 |
msgstr ""
|
69 |
|
@@ -71,7 +73,7 @@ msgstr ""
|
|
71 |
msgid "Access Groups"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#:
|
75 |
msgid "Access Restrictions"
|
76 |
msgstr ""
|
77 |
|
@@ -106,26 +108,26 @@ msgstr ""
|
|
106 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
107 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
108 |
#: lib/admin/groups-admin-options.php:39
|
109 |
-
#: lib/admin/groups-admin-options.php:
|
110 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
111 |
#: lib/test/groups-tests.php:391
|
112 |
msgid "Access denied."
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: lib/admin/groups-admin-options.php:
|
116 |
msgid "Access restricions"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#:
|
120 |
-
#:
|
121 |
-
#:
|
122 |
-
#:
|
123 |
-
#:
|
124 |
msgid "Access restrictions"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#:
|
128 |
-
#:
|
129 |
msgid "Access restrictions …"
|
130 |
msgstr ""
|
131 |
|
@@ -148,19 +150,21 @@ msgstr ""
|
|
148 |
msgid "Add capability"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#:
|
|
|
152 |
msgid "Add restriction"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: lib/admin/class-groups-admin-users.php:
|
156 |
msgid "Add to group"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: lib/admin/class-groups-admin
|
|
|
160 |
msgid "Add-Ons"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#:
|
164 |
msgid "Adding the group and capability manually and enabling it for access "
|
165 |
"restriction"
|
166 |
msgstr ""
|
@@ -173,16 +177,37 @@ msgstr ""
|
|
173 |
msgid "Administer Groups plugin options"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: lib/admin/groups-admin-options.php:
|
177 |
msgid "Administrator Access Override"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: lib/admin/groups-admin-options.php:
|
181 |
msgid "Administrators override all access permissions derived from Groups "
|
182 |
"capabilities."
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
#: lib/admin/groups-admin-capabilities.php:334
|
187 |
#: lib/admin/groups-admin-capabilities.php:360
|
188 |
#: lib/admin/groups-admin-capabilities.php:374
|
@@ -191,7 +216,7 @@ msgstr ""
|
|
191 |
msgid "Apply"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#:
|
195 |
msgid "Become a member of the <em>Premium</em> group - this is required so "
|
196 |
"you can choose the <em>premium</em> capability to restrict access to "
|
197 |
"a post."
|
@@ -202,7 +227,7 @@ msgstr ""
|
|
202 |
msgid "Bulk Actions"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: lib/admin/groups-admin-options.php:
|
206 |
msgid "CAUTION: If this option is active while the plugin is deactivated, "
|
207 |
"ALL plugin settings and data will be DELETED for <strong>all sites</"
|
208 |
"strong>. If you are going to use this option, now would be a good "
|
@@ -211,7 +236,7 @@ msgid "CAUTION: If this option is active while the plugin is deactivated, "
|
|
211 |
"thereof."
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: lib/admin/groups-admin-options.php:
|
215 |
msgid "CAUTION: If this option is active while the plugin is deactivated, "
|
216 |
"ALL plugin settings and data will be DELETED. If you are going to "
|
217 |
"use this option, now would be a good time to make a backup. By "
|
@@ -230,12 +255,12 @@ msgstr ""
|
|
230 |
msgid "Cancel"
|
231 |
msgstr ""
|
232 |
|
|
|
233 |
#: lib/admin/class-groups-admin.php:195
|
234 |
#: lib/admin/groups-admin-capabilities.php:192
|
235 |
#: lib/admin/groups-admin-groups-add.php:97
|
236 |
#: lib/admin/groups-admin-groups-edit.php:117
|
237 |
-
#: lib/admin/groups-admin-groups.php:306
|
238 |
-
#: lib/admin/groups-admin-options.php:251 lib/core/class-groups-help.php:71
|
239 |
msgid "Capabilities"
|
240 |
msgstr ""
|
241 |
|
@@ -259,8 +284,13 @@ msgstr ""
|
|
259 |
msgid "Capability ID"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: lib/admin/class-groups-admin-posts.php:
|
263 |
-
#: lib/admin/class-groups-admin-posts.php:
|
|
|
|
|
|
|
|
|
|
|
264 |
msgid "Choose access restrictions …"
|
265 |
msgstr ""
|
266 |
|
@@ -269,15 +299,19 @@ msgstr ""
|
|
269 |
msgid "Choose capabilities …"
|
270 |
msgstr ""
|
271 |
|
272 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
273 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
274 |
-
#: lib/admin/class-groups-admin-
|
275 |
-
#: lib/admin/class-groups-admin-
|
|
|
|
|
|
|
|
|
276 |
msgid "Choose groups …"
|
277 |
msgstr ""
|
278 |
|
279 |
-
#:
|
280 |
-
#:
|
281 |
msgid "Choose one or more capabilities to restrict access. Groups that "
|
282 |
"grant access through the capabilities are shown in parenthesis. If "
|
283 |
"no capabilities are available yet, you can use the quick-create box "
|
@@ -285,6 +319,12 @@ msgid "Choose one or more capabilities to restrict access. Groups that "
|
|
285 |
"the fly."
|
286 |
msgstr ""
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
#: lib/admin/groups-admin-capabilities.php:335
|
289 |
#: lib/admin/groups-admin-groups.php:324
|
290 |
msgid "Clear"
|
@@ -302,19 +342,19 @@ msgstr ""
|
|
302 |
msgid "Click to refresh capabilities"
|
303 |
msgstr ""
|
304 |
|
305 |
-
#:
|
306 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: lib/admin/groups-admin-options.php:
|
310 |
msgid "Deactivation and data persistence"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: lib/admin/groups-admin-options.php:
|
314 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: lib/admin/groups-admin-options.php:
|
318 |
msgid "Delete all Groups plugin data on deactivation"
|
319 |
msgstr ""
|
320 |
|
@@ -327,7 +367,7 @@ msgstr ""
|
|
327 |
msgid "Description"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: lib/admin/groups-admin-options.php:
|
331 |
msgid "Disabling this setting for a post type does not remove existing "
|
332 |
"access restrictions on individual posts of that type."
|
333 |
msgstr ""
|
@@ -345,51 +385,60 @@ msgstr ""
|
|
345 |
msgid "Edit a group"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#:
|
349 |
msgid "Edit the post for which you want to restrict access and "
|
350 |
"choose<sup>*</sup> the <em>premium</em> capability."
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: lib/
|
354 |
-
|
|
|
|
|
|
|
|
|
355 |
msgid "Enforce read access"
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: lib/admin/groups-admin-options.php:
|
359 |
msgid "Enhanced functionality is available via official <a href=\"http://"
|
360 |
"www.itthinx.com/shop/\">Extensions</a> for Groups."
|
361 |
msgstr ""
|
362 |
|
363 |
-
#:
|
364 |
msgid "Enter <em>Premium</em> in the quick-create field located in the "
|
365 |
"Access restrictions panel and save or update the post (or hit Enter)."
|
366 |
msgstr ""
|
367 |
|
368 |
-
#:
|
|
|
369 |
msgid "Example:"
|
370 |
msgstr ""
|
371 |
|
|
|
|
|
|
|
|
|
372 |
#: lib/admin/groups-admin-capabilities.php:324
|
373 |
#: lib/admin/groups-admin-groups.php:315
|
374 |
msgid "Filters"
|
375 |
msgstr ""
|
376 |
|
377 |
-
#:
|
378 |
msgid "Go to <strong>Groups > Capabilities</strong> and add the "
|
379 |
"<em>premium</em> capability."
|
380 |
msgstr ""
|
381 |
|
382 |
-
#:
|
383 |
msgid "Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> "
|
384 |
"group."
|
385 |
msgstr ""
|
386 |
|
387 |
-
#:
|
388 |
msgid "Go to <strong>Groups > Groups</strong> and assign the <em>premium</"
|
389 |
"em> capability to the <em>Premium</em> group."
|
390 |
msgstr ""
|
391 |
|
392 |
-
#:
|
393 |
msgid "Go to <strong>Groups > Options</strong> and enable the <em>premium</"
|
394 |
"em> capability to restrict access."
|
395 |
msgstr ""
|
@@ -398,7 +447,7 @@ msgstr ""
|
|
398 |
msgid "Group"
|
399 |
msgstr ""
|
400 |
|
401 |
-
#: lib/admin/class-groups-admin-users.php:
|
402 |
msgid "Group Actions"
|
403 |
msgstr ""
|
404 |
|
@@ -415,15 +464,30 @@ msgstr ""
|
|
415 |
msgid "Group Name : %s"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: lib/
|
419 |
-
#: lib/
|
420 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
421 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
422 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
423 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
424 |
msgid "Groups"
|
425 |
msgstr ""
|
426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
#: lib/admin/class-groups-admin.php:140
|
428 |
msgctxt "menu item title"
|
429 |
msgid "Groups"
|
@@ -434,6 +498,17 @@ msgctxt "page-title"
|
|
434 |
msgid "Groups"
|
435 |
msgstr ""
|
436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
#: lib/admin/class-groups-admin.php:220
|
438 |
msgid "Groups Add-Ons"
|
439 |
msgstr ""
|
@@ -442,11 +517,11 @@ msgstr ""
|
|
442 |
msgid "Groups Capabilities"
|
443 |
msgstr ""
|
444 |
|
445 |
-
#: lib/admin/groups-admin-options.php:
|
446 |
msgid "Groups Options"
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: lib/admin/groups-admin-options.php:
|
450 |
msgid "Groups network options"
|
451 |
msgstr ""
|
452 |
|
@@ -464,11 +539,41 @@ msgstr ""
|
|
464 |
msgid "ID"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
msgid "If you lock yourself out, please ask an administrator to help."
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
msgid "Include these capabilities to enforce read access on posts. The "
|
473 |
"selected capabilities will be offered to restrict access to posts."
|
474 |
msgstr ""
|
@@ -477,6 +582,11 @@ msgstr ""
|
|
477 |
msgid "Inherited capabilities:"
|
478 |
msgstr ""
|
479 |
|
|
|
|
|
|
|
|
|
|
|
480 |
#: lib/views/class-groups-shortcodes.php:469
|
481 |
#, php-format
|
482 |
msgid "Join the %s group"
|
@@ -487,7 +597,12 @@ msgstr ""
|
|
487 |
msgid "Leave the %s group"
|
488 |
msgstr ""
|
489 |
|
490 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
491 |
msgid "Let's assume that you want to limit the visibility of a post to "
|
492 |
"members of the <em>Premium</em> group."
|
493 |
msgstr ""
|
@@ -496,12 +611,13 @@ msgstr ""
|
|
496 |
msgid "Log out"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#:
|
|
|
500 |
msgid "Media"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#:
|
504 |
-
#:
|
505 |
#, php-format
|
506 |
msgid "Members of the %1$s group can access this %2$s through this "
|
507 |
"capability."
|
@@ -515,7 +631,7 @@ msgstr[1] ""
|
|
515 |
msgid "Name"
|
516 |
msgstr ""
|
517 |
|
518 |
-
#: lib/admin/groups-admin-options.php:
|
519 |
msgid "Network deactivation and data persistence"
|
520 |
msgstr ""
|
521 |
|
@@ -523,12 +639,16 @@ msgstr ""
|
|
523 |
msgid "New Capability"
|
524 |
msgstr ""
|
525 |
|
|
|
|
|
|
|
|
|
526 |
#: lib/admin/groups-admin-groups.php:212
|
527 |
msgid "New Group"
|
528 |
msgstr ""
|
529 |
|
530 |
-
#:
|
531 |
-
#:
|
532 |
msgid "No groups grant access through this capability. To grant access to "
|
533 |
"group members using this capability, you should assign it to a group "
|
534 |
"and enable the capability for access restriction."
|
@@ -556,11 +676,32 @@ msgstr ""
|
|
556 |
msgid "No such groups."
|
557 |
msgstr ""
|
558 |
|
559 |
-
#:
|
560 |
msgid "Note that you must be a member of a group that has such a capability "
|
561 |
"assigned."
|
562 |
msgstr ""
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
#: lib/admin/groups-admin-capabilities.php:121
|
565 |
#, php-format
|
566 |
msgid "One capability has been added."
|
@@ -568,12 +709,16 @@ msgid_plural "%d capabilities have been added."
|
|
568 |
msgstr[0] ""
|
569 |
msgstr[1] ""
|
570 |
|
571 |
-
#:
|
572 |
msgid "One or more capabilities required to read the entry."
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: lib/
|
576 |
-
|
|
|
|
|
|
|
|
|
577 |
#, php-format
|
578 |
msgid "Only groups or users that have one of the selected capabilities are "
|
579 |
"allowed to read this %s."
|
@@ -584,7 +729,7 @@ msgstr ""
|
|
584 |
msgid "Options"
|
585 |
msgstr ""
|
586 |
|
587 |
-
#: lib/admin/groups-admin-options.php:
|
588 |
msgid "Options saved."
|
589 |
msgstr ""
|
590 |
|
@@ -593,7 +738,11 @@ msgstr ""
|
|
593 |
msgid "Parent"
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
597 |
msgid "Permissions"
|
598 |
msgstr ""
|
599 |
|
@@ -613,27 +762,54 @@ msgid "Please give it a <a href=\"%s\">★★★★★</"
|
|
613 |
"a> rating."
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
msgid "Post"
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: lib/admin/groups-admin-options.php:
|
621 |
msgid "Post types"
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
msgid "Quick-create group & capability"
|
626 |
msgstr ""
|
627 |
|
628 |
-
#: lib/access/class-groups-
|
|
|
|
|
|
|
|
|
|
|
629 |
msgid "Read Post"
|
630 |
msgstr ""
|
631 |
|
632 |
-
#: lib/admin/groups-admin-add-ons.php:
|
633 |
msgid "Recommended extensions for Groups"
|
634 |
msgstr ""
|
635 |
|
636 |
-
#: lib/admin/groups-admin-add-ons.php:
|
637 |
msgid "Recommended plugins by itthinx"
|
638 |
msgstr ""
|
639 |
|
@@ -672,7 +848,7 @@ msgstr ""
|
|
672 |
msgid "Remove capability"
|
673 |
msgstr ""
|
674 |
|
675 |
-
#: lib/admin/class-groups-admin-users.php:
|
676 |
msgid "Remove from group"
|
677 |
msgstr ""
|
678 |
|
@@ -684,49 +860,78 @@ msgstr ""
|
|
684 |
msgid "Remove groups"
|
685 |
msgstr ""
|
686 |
|
687 |
-
#:
|
|
|
688 |
msgid "Remove restriction"
|
689 |
msgstr ""
|
690 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
691 |
#: lib/admin/groups-admin-capabilities.php:357
|
692 |
#: lib/admin/groups-admin-groups.php:346
|
693 |
msgid "Results per page"
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: lib/admin/groups-admin-options.php:
|
697 |
msgid "Role"
|
698 |
msgstr ""
|
699 |
|
700 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
701 |
#: lib/admin/groups-admin-groups-edit.php:158
|
702 |
-
#: lib/admin/groups-admin-options.php:
|
703 |
-
#: lib/admin/groups-admin-options.php:
|
704 |
-
#: lib/admin/groups-admin-options.php:
|
705 |
msgid "Save"
|
706 |
msgstr ""
|
707 |
|
708 |
-
#: lib/admin/groups-admin-options.php:
|
709 |
msgid "Show access restrictions for these post types."
|
710 |
msgstr ""
|
711 |
|
712 |
-
#:
|
713 |
msgid "Show groups"
|
714 |
msgstr ""
|
715 |
|
716 |
-
#: lib/admin/groups-admin-options.php:
|
717 |
msgid "Show groups in user profiles."
|
718 |
msgstr ""
|
719 |
|
720 |
-
#: lib/admin/groups-admin-options.php:
|
721 |
msgid "Show the Groups tree view."
|
722 |
msgstr ""
|
723 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
#: lib/core/class-groups-help.php:141
|
725 |
msgid "Thank you for using <a href=\"http://www.itthinx.com/plugins/groups"
|
726 |
"\" target=\"_blank\">Groups</a> by <a href=\"http://www.itthinx.com"
|
727 |
"\" target=\"_blank\">itthinx</a>."
|
728 |
msgstr ""
|
729 |
|
|
|
|
|
|
|
|
|
|
|
730 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
731 |
#, php-format
|
732 |
msgid "The <em>%s</em> capability already exists and cannot be assigned to "
|
@@ -796,11 +1001,16 @@ msgid "The complete documentation is available on the <a href=\"http://docs."
|
|
796 |
"itthinx.com/document/groups\">Documentation</a> pages for Groups."
|
797 |
msgstr ""
|
798 |
|
|
|
|
|
|
|
|
|
|
|
799 |
#: lib/admin/groups-admin-groups.php:76
|
800 |
msgid "The group has been deleted."
|
801 |
msgstr ""
|
802 |
|
803 |
-
#:
|
804 |
msgid "The manual way:"
|
805 |
msgstr ""
|
806 |
|
@@ -808,11 +1018,12 @@ msgstr ""
|
|
808 |
msgid "The name must not be empty."
|
809 |
msgstr ""
|
810 |
|
811 |
-
#:
|
812 |
msgid "The quick way:"
|
813 |
msgstr ""
|
814 |
|
815 |
-
#: lib/admin/class-groups-admin-user-profile.php:
|
|
|
816 |
msgid "The user is a member of the chosen groups."
|
817 |
msgstr ""
|
818 |
|
@@ -825,12 +1036,16 @@ msgstr ""
|
|
825 |
msgid "These capabilities will be assigned to the group."
|
826 |
msgstr ""
|
827 |
|
828 |
-
#: lib/admin/groups-admin-options.php:
|
829 |
msgid "These permissions apply to Groups management. They do not apply to "
|
830 |
"access permissions derived from Groups capabilities."
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: lib/admin/groups-admin-
|
|
|
|
|
|
|
|
|
834 |
msgid "This determines for which post types access restriction settings are "
|
835 |
"offered."
|
836 |
msgstr ""
|
@@ -839,6 +1054,27 @@ msgstr ""
|
|
839 |
msgid "This group has no capabilities."
|
840 |
msgstr ""
|
841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
843 |
msgid "Tree"
|
844 |
msgstr ""
|
@@ -847,35 +1083,40 @@ msgstr ""
|
|
847 |
msgid "Tree of Groups"
|
848 |
msgstr ""
|
849 |
|
850 |
-
#: lib/admin/groups-admin-options.php:
|
851 |
msgid "Tree view"
|
852 |
msgstr ""
|
853 |
|
854 |
-
#:
|
855 |
msgid "Try the quick-create field first. Unless you need a more complex "
|
856 |
"setup, there is no reason to go this way instead."
|
857 |
msgstr ""
|
858 |
|
859 |
-
#:
|
860 |
-
#:
|
861 |
-
#:
|
862 |
msgid "Type and choose …"
|
863 |
msgstr ""
|
864 |
|
865 |
-
#:
|
866 |
msgid "Use the <em>Access restrictions</em> box to limit the visibility of "
|
867 |
"posts, pages and other post types."
|
868 |
msgstr ""
|
869 |
|
870 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
871 |
msgid "User profiles"
|
872 |
msgstr ""
|
873 |
|
874 |
-
#:
|
875 |
msgid "Using the quick-create field"
|
876 |
msgstr ""
|
877 |
|
878 |
-
#:
|
879 |
msgid "Using the quick-create field, you can create a new group and "
|
880 |
"capability. The capability will be assigned to the group and enabled "
|
881 |
"to enforce read access. Group names are case-sensitive, the name of "
|
@@ -887,12 +1128,55 @@ msgid "Using the quick-create field, you can create a new group and "
|
|
887 |
"capability, your user account will be assigned to the group."
|
888 |
msgstr ""
|
889 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
#: lib/views/class-groups-shortcodes.php:527
|
891 |
#, php-format
|
892 |
msgid "You are a member of the %s group."
|
893 |
msgstr ""
|
894 |
|
895 |
-
#: lib/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
896 |
msgid "You can create a new group and capability here. The capability will "
|
897 |
"be assigned to the group and enabled to enforce read access. Group "
|
898 |
"names are case-sensitive, the name of the capability is the lower-"
|
@@ -904,12 +1188,35 @@ msgid "You can create a new group and capability here. The capability will "
|
|
904 |
"will be assigned to the group."
|
905 |
msgstr ""
|
906 |
|
907 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
msgid "You can select one or more capabilities that are enabled for access "
|
909 |
"restriction."
|
910 |
msgstr ""
|
911 |
|
912 |
-
#: lib/access/class-groups-access-meta-boxes.php:
|
|
|
|
|
|
|
|
|
|
|
913 |
msgid "You cannot set any access restrictions."
|
914 |
msgstr ""
|
915 |
|
@@ -923,7 +1230,16 @@ msgstr ""
|
|
923 |
msgid "You have left the %s group."
|
924 |
msgstr ""
|
925 |
|
926 |
-
#:
|
927 |
msgid "You must be in a group that has at least one capability enabled to "
|
928 |
"enforce read access."
|
929 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
msgid ""
|
8 |
msgstr "Project-Id-Version: PACKAGE VERSION\n"
|
9 |
"Report-Msgid-Bugs-To: \n"
|
10 |
+
"POT-Creation-Date: 2017-01-26 20:57+0100\n"
|
11 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
23 |
msgid "%1$s of %2$s"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:184
|
27 |
+
#: lib/admin/class-groups-admin-posts.php:207
|
28 |
msgid "— No Change —"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:136
|
32 |
+
#: lib/admin/class-groups-admin-posts.php:148
|
33 |
msgid "(only unrestricted)"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: lib/admin/class-groups-admin-users.php:374
|
37 |
msgid "--"
|
38 |
msgstr ""
|
39 |
|
44 |
msgstr[0] ""
|
45 |
msgstr[1] ""
|
46 |
|
47 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:76
|
48 |
#, php-format
|
49 |
msgid "<span title=\"%s\">Access Restrictions</span>"
|
50 |
msgstr ""
|
55 |
msgid "<strong>%s</strong>"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:164
|
59 |
msgid "<sup>*</sup> For each capability, the groups that have the "
|
60 |
"capability assigned are shown within parenthesis. You can choose a "
|
61 |
"capability by typing part of the group's or the capability's name."
|
65 |
msgid "A Duck!"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: lib/admin/groups-admin-options.php:269
|
69 |
msgid "A minimum set of permissions will be preserved."
|
70 |
msgstr ""
|
71 |
|
73 |
msgid "Access Groups"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:181
|
77 |
msgid "Access Restrictions"
|
78 |
msgstr ""
|
79 |
|
108 |
#: lib/admin/groups-admin-groups.php:49 lib/admin/groups-admin-groups.php:148
|
109 |
#: lib/admin/groups-admin-groups.php:179 lib/admin/groups-admin-groups.php:185
|
110 |
#: lib/admin/groups-admin-options.php:39
|
111 |
+
#: lib/admin/groups-admin-options.php:317
|
112 |
#: lib/admin/groups-admin-tree-view.php:37 lib/test/groups-tests.php:385
|
113 |
#: lib/test/groups-tests.php:391
|
114 |
msgid "Access denied."
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: lib/admin/groups-admin-options.php:214
|
118 |
msgid "Access restricions"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:97
|
122 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:107
|
123 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:121
|
124 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:124
|
125 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:592
|
126 |
msgid "Access restrictions"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:124
|
130 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:125
|
131 |
msgid "Access restrictions …"
|
132 |
msgstr ""
|
133 |
|
150 |
msgid "Add capability"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:185
|
154 |
+
#: lib/admin/class-groups-admin-posts.php:208
|
155 |
msgid "Add restriction"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: lib/admin/class-groups-admin-users.php:212
|
159 |
msgid "Add to group"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: lib/admin/class-groups-admin-welcome.php:214
|
163 |
+
#: lib/admin/class-groups-admin.php:221 lib/admin/groups-admin-add-ons.php:32
|
164 |
msgid "Add-Ons"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:150
|
168 |
msgid "Adding the group and capability manually and enabling it for access "
|
169 |
"restriction"
|
170 |
msgstr ""
|
177 |
msgid "Administer Groups plugin options"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: lib/admin/groups-admin-options.php:206
|
181 |
msgid "Administrator Access Override"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: lib/admin/groups-admin-options.php:210
|
185 |
msgid "Administrators override all access permissions derived from Groups "
|
186 |
"capabilities."
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: lib/admin/class-groups-admin-posts.php:165
|
190 |
+
msgid "Also look for groups related to terms"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: lib/admin/class-groups-admin-welcome.php:167
|
194 |
+
msgid "And you can now filter the list of users by one or multiple groups "
|
195 |
+
"with one convenient field."
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: lib/admin/class-groups-admin-welcome.php:165
|
199 |
+
msgid "Another improvement is better filtering by groups and a reduced "
|
200 |
+
"footprint on the Users admin screen."
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: lib/access/class-groups-access-meta-boxes.php:206
|
204 |
+
#: lib/access/class-groups-access-meta-boxes.php:207
|
205 |
+
#: lib/access/class-groups-access-meta-boxes.php:441
|
206 |
+
#: lib/access/class-groups-access-meta-boxes.php:442
|
207 |
+
msgid "Anyone …"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: lib/admin/class-groups-admin-users.php:215
|
211 |
#: lib/admin/groups-admin-capabilities.php:334
|
212 |
#: lib/admin/groups-admin-capabilities.php:360
|
213 |
#: lib/admin/groups-admin-capabilities.php:374
|
216 |
msgid "Apply"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:160
|
220 |
msgid "Become a member of the <em>Premium</em> group - this is required so "
|
221 |
"you can choose the <em>premium</em> capability to restrict access to "
|
222 |
"a post."
|
227 |
msgid "Bulk Actions"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: lib/admin/groups-admin-options.php:351
|
231 |
msgid "CAUTION: If this option is active while the plugin is deactivated, "
|
232 |
"ALL plugin settings and data will be DELETED for <strong>all sites</"
|
233 |
"strong>. If you are going to use this option, now would be a good "
|
236 |
"thereof."
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: lib/admin/groups-admin-options.php:283
|
240 |
msgid "CAUTION: If this option is active while the plugin is deactivated, "
|
241 |
"ALL plugin settings and data will be DELETED. If you are going to "
|
242 |
"use this option, now would be a good time to make a backup. By "
|
255 |
msgid "Cancel"
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: legacy/admin/groups-admin-options-legacy.php:58
|
259 |
#: lib/admin/class-groups-admin.php:195
|
260 |
#: lib/admin/groups-admin-capabilities.php:192
|
261 |
#: lib/admin/groups-admin-groups-add.php:97
|
262 |
#: lib/admin/groups-admin-groups-edit.php:117
|
263 |
+
#: lib/admin/groups-admin-groups.php:306 lib/core/class-groups-help.php:71
|
|
|
264 |
msgid "Capabilities"
|
265 |
msgstr ""
|
266 |
|
284 |
msgid "Capability ID"
|
285 |
msgstr ""
|
286 |
|
287 |
+
#: lib/admin/class-groups-admin-posts.php:221
|
288 |
+
#: lib/admin/class-groups-admin-posts.php:222
|
289 |
+
msgid "Choose access restriction groups …"
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:195
|
293 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:196
|
294 |
msgid "Choose access restrictions …"
|
295 |
msgstr ""
|
296 |
|
299 |
msgid "Choose capabilities …"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: lib/admin/class-groups-admin-user-profile.php:80
|
303 |
+
#: lib/admin/class-groups-admin-user-profile.php:81
|
304 |
+
#: lib/admin/class-groups-admin-user-profile.php:167
|
305 |
+
#: lib/admin/class-groups-admin-user-profile.php:168
|
306 |
+
#: lib/admin/class-groups-admin-users.php:190
|
307 |
+
#: lib/admin/class-groups-admin-users.php:191
|
308 |
+
#: lib/admin/class-groups-admin-users.php:251
|
309 |
+
#: lib/admin/class-groups-admin-users.php:252
|
310 |
msgid "Choose groups …"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:214
|
314 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:541
|
315 |
msgid "Choose one or more capabilities to restrict access. Groups that "
|
316 |
"grant access through the capabilities are shown in parenthesis. If "
|
317 |
"no capabilities are available yet, you can use the quick-create box "
|
319 |
"the fly."
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: lib/access/class-groups-access-meta-boxes.php:132
|
323 |
+
msgid "Choose or enter <em>Premium</em> in the <em>Read</em> field located "
|
324 |
+
"in the <em>Groups</em> box and save or update the post (or hit "
|
325 |
+
"Enter)."
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
#: lib/admin/groups-admin-capabilities.php:335
|
329 |
#: lib/admin/groups-admin-groups.php:324
|
330 |
msgid "Clear"
|
342 |
msgid "Click to refresh capabilities"
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:274
|
346 |
msgid "Click to toggle the display of groups that grant the capabilities."
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: lib/admin/groups-admin-options.php:275
|
350 |
msgid "Deactivation and data persistence"
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: lib/admin/groups-admin-options.php:348
|
354 |
msgid "Delete all Groups plugin data for ALL sites on network deactivation"
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: lib/admin/groups-admin-options.php:279
|
358 |
msgid "Delete all Groups plugin data on deactivation"
|
359 |
msgstr ""
|
360 |
|
367 |
msgid "Description"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: lib/admin/groups-admin-options.php:243
|
371 |
msgid "Disabling this setting for a post type does not remove existing "
|
372 |
"access restrictions on individual posts of that type."
|
373 |
msgstr ""
|
385 |
msgid "Edit a group"
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:161
|
389 |
msgid "Edit the post for which you want to restrict access and "
|
390 |
"choose<sup>*</sup> the <em>premium</em> capability."
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: lib/admin/groups-admin-options.php:292
|
394 |
+
msgid "Enable legacy access control based on capabilities."
|
395 |
+
msgstr ""
|
396 |
+
|
397 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:204
|
398 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:505
|
399 |
msgid "Enforce read access"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: lib/admin/groups-admin-options.php:189
|
403 |
msgid "Enhanced functionality is available via official <a href=\"http://"
|
404 |
"www.itthinx.com/shop/\">Extensions</a> for Groups."
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:143
|
408 |
msgid "Enter <em>Premium</em> in the quick-create field located in the "
|
409 |
"Access restrictions panel and save or update the post (or hit Enter)."
|
410 |
msgstr ""
|
411 |
|
412 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:135
|
413 |
+
#: lib/access/class-groups-access-meta-boxes.php:126
|
414 |
msgid "Example:"
|
415 |
msgstr ""
|
416 |
|
417 |
+
#: lib/admin/class-groups-admin-users.php:275
|
418 |
+
msgid "Filter"
|
419 |
+
msgstr ""
|
420 |
+
|
421 |
#: lib/admin/groups-admin-capabilities.php:324
|
422 |
#: lib/admin/groups-admin-groups.php:315
|
423 |
msgid "Filters"
|
424 |
msgstr ""
|
425 |
|
426 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:157
|
427 |
msgid "Go to <strong>Groups > Capabilities</strong> and add the "
|
428 |
"<em>premium</em> capability."
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:156
|
432 |
msgid "Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> "
|
433 |
"group."
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:158
|
437 |
msgid "Go to <strong>Groups > Groups</strong> and assign the <em>premium</"
|
438 |
"em> capability to the <em>Premium</em> group."
|
439 |
msgstr ""
|
440 |
|
441 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:159
|
442 |
msgid "Go to <strong>Groups > Options</strong> and enable the <em>premium</"
|
443 |
"em> capability to restrict access."
|
444 |
msgstr ""
|
447 |
msgid "Group"
|
448 |
msgstr ""
|
449 |
|
450 |
+
#: lib/admin/class-groups-admin-users.php:211
|
451 |
msgid "Group Actions"
|
452 |
msgstr ""
|
453 |
|
464 |
msgid "Group Name : %s"
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: lib/access/class-groups-access-meta-boxes.php:112
|
468 |
+
#: lib/access/class-groups-access-meta-boxes.php:115
|
469 |
+
#: lib/access/class-groups-access-meta-boxes.php:463
|
470 |
+
#: lib/admin/class-groups-admin-posts.php:204
|
471 |
+
#: lib/admin/class-groups-admin-user-profile.php:72
|
472 |
+
#: lib/admin/class-groups-admin-user-profile.php:133
|
473 |
+
#: lib/admin/class-groups-admin-user-profile.php:157
|
474 |
+
#: lib/admin/class-groups-admin-users.php:347
|
475 |
#: lib/admin/class-groups-admin.php:244 lib/admin/class-groups-admin.php:245
|
476 |
#: lib/admin/class-groups-admin.php:274 lib/core/class-groups-help.php:63
|
477 |
#: lib/core/class-groups-help.php:68 lib/core/class-groups-help.php:69
|
478 |
msgid "Groups"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: lib/admin/class-groups-admin-post-columns.php:93
|
482 |
+
msgctxt "Column header"
|
483 |
+
msgid "Groups"
|
484 |
+
msgstr ""
|
485 |
+
|
486 |
+
#: lib/access/class-groups-access-meta-boxes.php:98
|
487 |
+
msgctxt "Meta box title"
|
488 |
+
msgid "Groups"
|
489 |
+
msgstr ""
|
490 |
+
|
491 |
#: lib/admin/class-groups-admin.php:140
|
492 |
msgctxt "menu item title"
|
493 |
msgid "Groups"
|
498 |
msgid "Groups"
|
499 |
msgstr ""
|
500 |
|
501 |
+
#: lib/admin/class-groups-admin-welcome.php:182
|
502 |
+
#, php-format
|
503 |
+
msgid "Groups %s features a simpler model for access restrictions based on "
|
504 |
+
"groups instead of capabilities used in previous versions."
|
505 |
+
msgstr ""
|
506 |
+
|
507 |
+
#: lib/admin/class-groups-admin-posts.php:136
|
508 |
+
#: lib/admin/class-groups-admin-posts.php:137
|
509 |
+
msgid "Groups …"
|
510 |
+
msgstr ""
|
511 |
+
|
512 |
#: lib/admin/class-groups-admin.php:220
|
513 |
msgid "Groups Add-Ons"
|
514 |
msgstr ""
|
517 |
msgid "Groups Capabilities"
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: lib/admin/groups-admin-options.php:129
|
521 |
msgid "Groups Options"
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: lib/admin/groups-admin-options.php:323
|
525 |
msgid "Groups network options"
|
526 |
msgstr ""
|
527 |
|
539 |
msgid "ID"
|
540 |
msgstr ""
|
541 |
|
542 |
+
#: lib/admin/class-groups-admin-welcome.php:201
|
543 |
+
msgid "If you had any access restrictions in place based on capabilities, "
|
544 |
+
"the entries will now be unprotected, unless you enable legacy access "
|
545 |
+
"restrictions or place appropriate access restrictions based on "
|
546 |
+
"groups on the desired entries."
|
547 |
+
msgstr ""
|
548 |
+
|
549 |
+
#: lib/admin/groups-admin-options.php:271
|
550 |
msgid "If you lock yourself out, please ask an administrator to help."
|
551 |
msgstr ""
|
552 |
|
553 |
+
#: lib/admin/class-groups-admin-welcome.php:205
|
554 |
+
msgid "If you would like to switch to access restrictions based on groups "
|
555 |
+
"(recommended) instead of capabilities, you can easily do so by "
|
556 |
+
"setting the appropriate groups on your protected posts, pages and "
|
557 |
+
"other entries to restrict access."
|
558 |
+
msgstr ""
|
559 |
+
|
560 |
+
#: lib/admin/class-groups-admin-welcome.php:135
|
561 |
+
msgid "Important"
|
562 |
+
msgstr ""
|
563 |
+
|
564 |
+
#: lib/admin/class-groups-admin-welcome.php:160
|
565 |
+
msgid "Improved User Interface"
|
566 |
+
msgstr ""
|
567 |
+
|
568 |
+
#: lib/access/class-groups-access-meta-boxes.php:136
|
569 |
+
msgid "In the same field, you can create a new group and restrict access. "
|
570 |
+
"Group names are case-sensitive. In order to be able to use the new "
|
571 |
+
"group, your user account will be assigned to it. You will not be "
|
572 |
+
"able to restrict access if the group already exists but you do not "
|
573 |
+
"belong to it."
|
574 |
+
msgstr ""
|
575 |
+
|
576 |
+
#: legacy/admin/groups-admin-options-legacy.php:61
|
577 |
msgid "Include these capabilities to enforce read access on posts. The "
|
578 |
"selected capabilities will be offered to restrict access to posts."
|
579 |
msgstr ""
|
582 |
msgid "Inherited capabilities:"
|
583 |
msgstr ""
|
584 |
|
585 |
+
#: lib/admin/class-groups-admin-welcome.php:138
|
586 |
+
msgid "It seems that you have updated from Groups 1.x where access "
|
587 |
+
"restrictions were based on capabilities."
|
588 |
+
msgstr ""
|
589 |
+
|
590 |
#: lib/views/class-groups-shortcodes.php:469
|
591 |
#, php-format
|
592 |
msgid "Join the %s group"
|
597 |
msgid "Leave the %s group"
|
598 |
msgstr ""
|
599 |
|
600 |
+
#: lib/admin/groups-admin-options.php:288
|
601 |
+
msgid "Legacy Settings"
|
602 |
+
msgstr ""
|
603 |
+
|
604 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:137
|
605 |
+
#: lib/access/class-groups-access-meta-boxes.php:128
|
606 |
msgid "Let's assume that you want to limit the visibility of a post to "
|
607 |
"members of the <em>Premium</em> group."
|
608 |
msgstr ""
|
611 |
msgid "Log out"
|
612 |
msgstr ""
|
613 |
|
614 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:503
|
615 |
+
#: lib/access/class-groups-access-meta-boxes.php:409
|
616 |
msgid "Media"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:231
|
620 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:558
|
621 |
#, php-format
|
622 |
msgid "Members of the %1$s group can access this %2$s through this "
|
623 |
"capability."
|
631 |
msgid "Name"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: lib/admin/groups-admin-options.php:345
|
635 |
msgid "Network deactivation and data persistence"
|
636 |
msgstr ""
|
637 |
|
639 |
msgid "New Capability"
|
640 |
msgstr ""
|
641 |
|
642 |
+
#: lib/admin/class-groups-admin-welcome.php:171
|
643 |
+
msgid "New Documentation"
|
644 |
+
msgstr ""
|
645 |
+
|
646 |
#: lib/admin/groups-admin-groups.php:212
|
647 |
msgid "New Group"
|
648 |
msgstr ""
|
649 |
|
650 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:240
|
651 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:567
|
652 |
msgid "No groups grant access through this capability. To grant access to "
|
653 |
"group members using this capability, you should assign it to a group "
|
654 |
"and enable the capability for access restriction."
|
676 |
msgid "No such groups."
|
677 |
msgstr ""
|
678 |
|
679 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:132
|
680 |
msgid "Note that you must be a member of a group that has such a capability "
|
681 |
"assigned."
|
682 |
msgstr ""
|
683 |
|
684 |
+
#: lib/access/class-groups-access-meta-boxes.php:123
|
685 |
+
msgid "Note that you must be a member of a group to use it to restrict "
|
686 |
+
"access."
|
687 |
+
msgstr ""
|
688 |
+
|
689 |
+
#: lib/admin/class-groups-admin-welcome.php:163
|
690 |
+
msgid "Now you can assign new users directly to groups when you create a "
|
691 |
+
"new user account from the Dashboard."
|
692 |
+
msgstr ""
|
693 |
+
|
694 |
+
#: lib/admin/class-groups-admin-welcome.php:154
|
695 |
+
msgid "Now you can protect your posts, pages and any other custom post type "
|
696 |
+
"like products or events by simply assigning them to one or more "
|
697 |
+
"groups."
|
698 |
+
msgstr ""
|
699 |
+
|
700 |
+
#: lib/admin/class-groups-admin-welcome.php:207
|
701 |
+
msgid "Once you have adjusted your access restrictions based on groups, you "
|
702 |
+
"can disable legacy access control."
|
703 |
+
msgstr ""
|
704 |
+
|
705 |
#: lib/admin/groups-admin-capabilities.php:121
|
706 |
#, php-format
|
707 |
msgid "One capability has been added."
|
709 |
msgstr[0] ""
|
710 |
msgstr[1] ""
|
711 |
|
712 |
+
#: legacy/admin/class-groups-admin-post-columns-legacy.php:77
|
713 |
msgid "One or more capabilities required to read the entry."
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: lib/admin/class-groups-admin-post-columns.php:92
|
717 |
+
msgid "One or more groups granting access to entries."
|
718 |
+
msgstr ""
|
719 |
+
|
720 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:270
|
721 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:588
|
722 |
#, php-format
|
723 |
msgid "Only groups or users that have one of the selected capabilities are "
|
724 |
"allowed to read this %s."
|
729 |
msgid "Options"
|
730 |
msgstr ""
|
731 |
|
732 |
+
#: lib/admin/groups-admin-options.php:121
|
733 |
msgid "Options saved."
|
734 |
msgstr ""
|
735 |
|
738 |
msgid "Parent"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: lib/admin/class-groups-admin-welcome.php:217
|
742 |
+
msgid "Perfect complements to memberships and access control with Groups."
|
743 |
+
msgstr ""
|
744 |
+
|
745 |
+
#: lib/admin/groups-admin-options.php:265
|
746 |
msgid "Permissions"
|
747 |
msgstr ""
|
748 |
|
762 |
"a> rating."
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: lib/admin/class-groups-admin-welcome.php:140
|
766 |
+
#, php-format
|
767 |
+
msgid "Please make sure to read the notes on <strong>Switching to Groups "
|
768 |
+
"%s</strong> below."
|
769 |
+
msgstr ""
|
770 |
+
|
771 |
+
#: lib/admin/class-groups-admin-welcome.php:209
|
772 |
+
msgid "Please refer to the <a target=\"_blank\" href=\"http://docs.itthinx."
|
773 |
+
"com/document/groups/\">Documentation</a> for details on how to "
|
774 |
+
"switch to and use the new access restrictions."
|
775 |
+
msgstr ""
|
776 |
+
|
777 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:189
|
778 |
+
#: lib/access/class-groups-access-meta-boxes.php:162
|
779 |
msgid "Post"
|
780 |
msgstr ""
|
781 |
|
782 |
+
#: lib/admin/groups-admin-options.php:216
|
783 |
msgid "Post types"
|
784 |
msgstr ""
|
785 |
|
786 |
+
#: lib/admin/class-groups-admin-welcome.php:156
|
787 |
+
msgid "Previously we used capabilities to do that, but changing to this new "
|
788 |
+
"model makes things even easier."
|
789 |
+
msgstr ""
|
790 |
+
|
791 |
+
#: lib/admin/class-groups-admin-welcome.php:149
|
792 |
+
msgid "Protect Content Easily"
|
793 |
+
msgstr ""
|
794 |
+
|
795 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:308
|
796 |
msgid "Quick-create group & capability"
|
797 |
msgstr ""
|
798 |
|
799 |
+
#: lib/access/class-groups-access-meta-boxes.php:200
|
800 |
+
#: lib/access/class-groups-access-meta-boxes.php:411
|
801 |
+
msgid "Read"
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: legacy/access/class-groups-post-access-legacy.php:52
|
805 |
msgid "Read Post"
|
806 |
msgstr ""
|
807 |
|
808 |
+
#: lib/admin/groups-admin-add-ons.php:49
|
809 |
msgid "Recommended extensions for Groups"
|
810 |
msgstr ""
|
811 |
|
812 |
+
#: lib/admin/groups-admin-add-ons.php:157
|
813 |
msgid "Recommended plugins by itthinx"
|
814 |
msgstr ""
|
815 |
|
848 |
msgid "Remove capability"
|
849 |
msgstr ""
|
850 |
|
851 |
+
#: lib/admin/class-groups-admin-users.php:213
|
852 |
msgid "Remove from group"
|
853 |
msgstr ""
|
854 |
|
860 |
msgid "Remove groups"
|
861 |
msgstr ""
|
862 |
|
863 |
+
#: legacy/admin/class-groups-admin-posts-legacy.php:186
|
864 |
+
#: lib/admin/class-groups-admin-posts.php:209
|
865 |
msgid "Remove restriction"
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: lib/admin/groups-admin-options.php:53
|
869 |
+
msgid "Restrict Access"
|
870 |
+
msgstr ""
|
871 |
+
|
872 |
+
#: lib/access/class-groups-access-meta-boxes.php:226
|
873 |
+
#, php-format
|
874 |
+
msgid "Restricts the visibility of this %s to members of the chosen groups."
|
875 |
+
msgstr ""
|
876 |
+
|
877 |
+
#: lib/access/class-groups-access-meta-boxes.php:459
|
878 |
+
msgid "Restricts the visibility of this entry to members of the chosen "
|
879 |
+
"groups."
|
880 |
+
msgstr ""
|
881 |
+
|
882 |
#: lib/admin/groups-admin-capabilities.php:357
|
883 |
#: lib/admin/groups-admin-groups.php:346
|
884 |
msgid "Results per page"
|
885 |
msgstr ""
|
886 |
|
887 |
+
#: lib/admin/groups-admin-options.php:144
|
888 |
msgid "Role"
|
889 |
msgstr ""
|
890 |
|
891 |
#: lib/admin/groups-admin-capabilities-edit.php:77
|
892 |
#: lib/admin/groups-admin-groups-edit.php:158
|
893 |
+
#: lib/admin/groups-admin-options.php:201
|
894 |
+
#: lib/admin/groups-admin-options.php:303
|
895 |
+
#: lib/admin/groups-admin-options.php:355
|
896 |
msgid "Save"
|
897 |
msgstr ""
|
898 |
|
899 |
+
#: lib/admin/groups-admin-options.php:219
|
900 |
msgid "Show access restrictions for these post types."
|
901 |
msgstr ""
|
902 |
|
903 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:277
|
904 |
msgid "Show groups"
|
905 |
msgstr ""
|
906 |
|
907 |
+
#: lib/admin/groups-admin-options.php:251
|
908 |
msgid "Show groups in user profiles."
|
909 |
msgstr ""
|
910 |
|
911 |
+
#: lib/admin/groups-admin-options.php:260
|
912 |
msgid "Show the Groups tree view."
|
913 |
msgstr ""
|
914 |
|
915 |
+
#: lib/admin/class-groups-admin-welcome.php:179
|
916 |
+
#, php-format
|
917 |
+
msgid "Switching to Groups %s"
|
918 |
+
msgstr ""
|
919 |
+
|
920 |
+
#: lib/admin/class-groups-admin-posts.php:167
|
921 |
+
msgid "Terms"
|
922 |
+
msgstr ""
|
923 |
+
|
924 |
#: lib/core/class-groups-help.php:141
|
925 |
msgid "Thank you for using <a href=\"http://www.itthinx.com/plugins/groups"
|
926 |
"\" target=\"_blank\">Groups</a> by <a href=\"http://www.itthinx.com"
|
927 |
"\" target=\"_blank\">itthinx</a>."
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: lib/admin/class-groups-admin-welcome.php:129
|
931 |
+
msgid "Thanks for using Groups! We have made it even easier to protect your "
|
932 |
+
"content and hope you like it :)"
|
933 |
+
msgstr ""
|
934 |
+
|
935 |
#: lib/admin/groups-admin-capabilities-edit.php:116
|
936 |
#, php-format
|
937 |
msgid "The <em>%s</em> capability already exists and cannot be assigned to "
|
1001 |
"itthinx.com/document/groups\">Documentation</a> pages for Groups."
|
1002 |
msgstr ""
|
1003 |
|
1004 |
+
#: lib/admin/class-groups-admin-welcome.php:190
|
1005 |
+
msgid "The following is only of interest if you have upgraded from Groups 1."
|
1006 |
+
"x:"
|
1007 |
+
msgstr ""
|
1008 |
+
|
1009 |
#: lib/admin/groups-admin-groups.php:76
|
1010 |
msgid "The group has been deleted."
|
1011 |
msgstr ""
|
1012 |
|
1013 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:148
|
1014 |
msgid "The manual way:"
|
1015 |
msgstr ""
|
1016 |
|
1018 |
msgid "The name must not be empty."
|
1019 |
msgstr ""
|
1020 |
|
1021 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:139
|
1022 |
msgid "The quick way:"
|
1023 |
msgstr ""
|
1024 |
|
1025 |
+
#: lib/admin/class-groups-admin-user-profile.php:88
|
1026 |
+
#: lib/admin/class-groups-admin-user-profile.php:176
|
1027 |
msgid "The user is a member of the chosen groups."
|
1028 |
msgstr ""
|
1029 |
|
1036 |
msgid "These capabilities will be assigned to the group."
|
1037 |
msgstr ""
|
1038 |
|
1039 |
+
#: lib/admin/groups-admin-options.php:266
|
1040 |
msgid "These permissions apply to Groups management. They do not apply to "
|
1041 |
"access permissions derived from Groups capabilities."
|
1042 |
msgstr ""
|
1043 |
|
1044 |
+
#: lib/admin/class-groups-admin-welcome.php:199
|
1045 |
+
msgid "This could be important!"
|
1046 |
+
msgstr ""
|
1047 |
+
|
1048 |
+
#: lib/admin/groups-admin-options.php:242
|
1049 |
msgid "This determines for which post types access restriction settings are "
|
1050 |
"offered."
|
1051 |
msgstr ""
|
1054 |
msgid "This group has no capabilities."
|
1055 |
msgstr ""
|
1056 |
|
1057 |
+
#: lib/admin/class-groups-admin-welcome.php:195
|
1058 |
+
msgid "This means that if you had access restrictions in place that were "
|
1059 |
+
"based on capabilities, your entries will still be protected."
|
1060 |
+
msgstr ""
|
1061 |
+
|
1062 |
+
#: lib/access/class-groups-post-access.php:477
|
1063 |
+
msgid "This method is deprecated. You should use Groups_Post_Access_Legacy::"
|
1064 |
+
"get_read_post_capabilities() to retrieve the capabilities instead."
|
1065 |
+
msgstr ""
|
1066 |
+
|
1067 |
+
#: lib/admin/class-groups-admin-welcome.php:186
|
1068 |
+
msgid "To make it easier to transition to the new model for those who "
|
1069 |
+
"migrate from a previous version, we have included legacy access "
|
1070 |
+
"control based on capabilities."
|
1071 |
+
msgstr ""
|
1072 |
+
|
1073 |
+
#: lib/admin/class-groups-admin-welcome.php:184
|
1074 |
+
msgid "To put it simple, previously you would have used capabilities to "
|
1075 |
+
"restrict access to posts and now you simply use groups."
|
1076 |
+
msgstr ""
|
1077 |
+
|
1078 |
#: lib/admin/class-groups-admin.php:180 lib/admin/class-groups-admin.php:181
|
1079 |
msgid "Tree"
|
1080 |
msgstr ""
|
1083 |
msgid "Tree of Groups"
|
1084 |
msgstr ""
|
1085 |
|
1086 |
+
#: lib/admin/groups-admin-options.php:256
|
1087 |
msgid "Tree view"
|
1088 |
msgstr ""
|
1089 |
|
1090 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:153
|
1091 |
msgid "Try the quick-create field first. Unless you need a more complex "
|
1092 |
"setup, there is no reason to go this way instead."
|
1093 |
msgstr ""
|
1094 |
|
1095 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:212
|
1096 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:213
|
1097 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:540
|
1098 |
msgid "Type and choose …"
|
1099 |
msgstr ""
|
1100 |
|
1101 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:127
|
1102 |
msgid "Use the <em>Access restrictions</em> box to limit the visibility of "
|
1103 |
"posts, pages and other post types."
|
1104 |
msgstr ""
|
1105 |
|
1106 |
+
#: lib/access/class-groups-access-meta-boxes.php:118
|
1107 |
+
msgid "Use the <em>Groups</em> box to limit the visibility of posts, pages "
|
1108 |
+
"and other post types."
|
1109 |
+
msgstr ""
|
1110 |
+
|
1111 |
+
#: lib/admin/groups-admin-options.php:247
|
1112 |
msgid "User profiles"
|
1113 |
msgstr ""
|
1114 |
|
1115 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:141
|
1116 |
msgid "Using the quick-create field"
|
1117 |
msgstr ""
|
1118 |
|
1119 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:146
|
1120 |
msgid "Using the quick-create field, you can create a new group and "
|
1121 |
"capability. The capability will be assigned to the group and enabled "
|
1122 |
"to enforce read access. Group names are case-sensitive, the name of "
|
1128 |
"capability, your user account will be assigned to the group."
|
1129 |
msgstr ""
|
1130 |
|
1131 |
+
#: lib/admin/class-groups-admin-welcome.php:97
|
1132 |
+
msgid "View the Welcome screen for this version of Groups"
|
1133 |
+
msgstr ""
|
1134 |
+
|
1135 |
+
#: lib/admin/class-groups-admin-welcome.php:152
|
1136 |
+
msgid "We have made it even easier to protect your content!"
|
1137 |
+
msgstr ""
|
1138 |
+
|
1139 |
+
#: lib/admin/class-groups-admin-welcome.php:98
|
1140 |
+
msgid "Welcome"
|
1141 |
+
msgstr ""
|
1142 |
+
|
1143 |
+
#: lib/admin/class-groups-admin-welcome.php:46
|
1144 |
+
#: lib/admin/class-groups-admin-welcome.php:47
|
1145 |
+
msgid "Welcome to Groups"
|
1146 |
+
msgstr ""
|
1147 |
+
|
1148 |
+
#: lib/admin/class-groups-admin-welcome.php:125
|
1149 |
+
#, php-format
|
1150 |
+
msgid "Welcome to Groups %s"
|
1151 |
+
msgstr ""
|
1152 |
+
|
1153 |
+
#: lib/admin/class-groups-admin-welcome.php:145
|
1154 |
+
msgid "What's New?"
|
1155 |
+
msgstr ""
|
1156 |
+
|
1157 |
+
#: lib/admin/class-groups-admin-welcome.php:174
|
1158 |
+
msgid "Whether you are new to Groups or have been using it before, please "
|
1159 |
+
"make sure to visit the <a target=\"_blank\" href=\"http://docs."
|
1160 |
+
"itthinx.com/document/groups/\">Documentation</a> pages to know more "
|
1161 |
+
"about how to use it."
|
1162 |
+
msgstr ""
|
1163 |
+
|
1164 |
#: lib/views/class-groups-shortcodes.php:527
|
1165 |
#, php-format
|
1166 |
msgid "You are a member of the %s group."
|
1167 |
msgstr ""
|
1168 |
|
1169 |
+
#: lib/admin/class-groups-admin-welcome.php:197
|
1170 |
+
msgid "You are running the system with legacy access control based on "
|
1171 |
+
"capabilities disabled."
|
1172 |
+
msgstr ""
|
1173 |
+
|
1174 |
+
#: lib/admin/class-groups-admin-welcome.php:193
|
1175 |
+
msgid "You are running the system with legacy access control based on "
|
1176 |
+
"capabilities enabled."
|
1177 |
+
msgstr ""
|
1178 |
+
|
1179 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:312
|
1180 |
msgid "You can create a new group and capability here. The capability will "
|
1181 |
"be assigned to the group and enabled to enforce read access. Group "
|
1182 |
"names are case-sensitive, the name of the capability is the lower-"
|
1188 |
"will be assigned to the group."
|
1189 |
msgstr ""
|
1190 |
|
1191 |
+
#: lib/access/class-groups-access-meta-boxes.php:193
|
1192 |
+
#: lib/access/class-groups-access-meta-boxes.php:444
|
1193 |
+
msgid "You can create a new group by indicating the group's name."
|
1194 |
+
msgstr ""
|
1195 |
+
|
1196 |
+
#: lib/access/class-groups-access-meta-boxes.php:187
|
1197 |
+
#, php-format
|
1198 |
+
msgid "You can restrict the visibility of this %1$s to group members. "
|
1199 |
+
"Choose one or more groups that are allowed to read this %2$s. If no "
|
1200 |
+
"groups are chosen, the %3$s is visible to anyone."
|
1201 |
+
msgstr ""
|
1202 |
+
|
1203 |
+
#: lib/access/class-groups-access-meta-boxes.php:443
|
1204 |
+
msgid "You can restrict the visibility to group members. Choose one or more "
|
1205 |
+
"groups to restrict access. If no groups are chosen, this entry is "
|
1206 |
+
"visible to anyone."
|
1207 |
+
msgstr ""
|
1208 |
+
|
1209 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:130
|
1210 |
msgid "You can select one or more capabilities that are enabled for access "
|
1211 |
"restriction."
|
1212 |
msgstr ""
|
1213 |
|
1214 |
+
#: lib/access/class-groups-access-meta-boxes.php:121
|
1215 |
+
msgid "You can select one or more groups to restrict access to its members."
|
1216 |
+
msgstr ""
|
1217 |
+
|
1218 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:290
|
1219 |
+
#: lib/access/class-groups-access-meta-boxes.php:233
|
1220 |
msgid "You cannot set any access restrictions."
|
1221 |
msgstr ""
|
1222 |
|
1230 |
msgid "You have left the %s group."
|
1231 |
msgstr ""
|
1232 |
|
1233 |
+
#: legacy/access/class-groups-access-meta-boxes-legacy.php:296
|
1234 |
msgid "You must be in a group that has at least one capability enabled to "
|
1235 |
"enforce read access."
|
1236 |
msgstr ""
|
1237 |
+
|
1238 |
+
#: lib/access/class-groups-access-meta-boxes.php:239
|
1239 |
+
msgid "You need to have permission to set access restrictions."
|
1240 |
+
msgstr ""
|
1241 |
+
|
1242 |
+
#: lib/access/class-groups-post-access.php:352
|
1243 |
+
msgid "You should use Groups_Post_Access_Legacy::create() to pass a "
|
1244 |
+
"capability restriction instead."
|
1245 |
+
msgstr ""
|
legacy/access/class-groups-access-meta-boxes-legacy.php
ADDED
@@ -0,0 +1,677 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* class-groups-access-meta-boxes-legacy.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 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-post-access-legacy.php' );
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Adds meta boxes to edit screens.
|
30 |
+
*
|
31 |
+
* @link http://codex.wordpress.org/Function_Reference/add_meta_box
|
32 |
+
*/
|
33 |
+
class Groups_Access_Meta_Boxes_Legacy {
|
34 |
+
|
35 |
+
const NONCE = 'groups-meta-box-nonce-legacy';
|
36 |
+
const SET_CAPABILITY = 'set-capability';
|
37 |
+
const READ_ACCESS = 'read-access';
|
38 |
+
const CAPABILITY = 'capability';
|
39 |
+
const SHOW_GROUPS = 'access-meta-box-show-groups';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Sets up an init hook where actions and filters are added.
|
43 |
+
*/
|
44 |
+
public static function init() {
|
45 |
+
add_action( 'init', array( __CLASS__, 'wp_init' ) );
|
46 |
+
add_action( 'admin_init', array( __CLASS__,'admin_init' ) );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Hooks for capabilities meta box and saving options.
|
51 |
+
*/
|
52 |
+
public static function wp_init() {
|
53 |
+
if ( current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
54 |
+
require_once GROUPS_VIEWS_LIB . '/class-groups-uie.php';
|
55 |
+
|
56 |
+
add_action( 'add_meta_boxes', array( __CLASS__, 'add_meta_boxes' ), 10, 2 );
|
57 |
+
add_action( 'save_post', array( __CLASS__, 'save_post' ), 10, 2 );
|
58 |
+
add_filter( 'wp_insert_post_empty_content', array( __CLASS__, 'wp_insert_post_empty_content' ), 10, 2 );
|
59 |
+
|
60 |
+
add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'attachment_fields_to_edit' ), 10, 2 );
|
61 |
+
add_filter( 'attachment_fields_to_save', array( __CLASS__, 'attachment_fields_to_save' ), 10, 2 );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Hooked on admin_init to register our action on admin_enqueue_scripts.
|
67 |
+
*/
|
68 |
+
public static function admin_init() {
|
69 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Hooked on admin_enqueue_scripts to timely enqueue resources required
|
74 |
+
* on the media upload / attachment popup.
|
75 |
+
*/
|
76 |
+
public static function admin_enqueue_scripts() {
|
77 |
+
global $pagenow;
|
78 |
+
if ( $pagenow == 'upload.php' ) {
|
79 |
+
Groups_UIE::enqueue( 'select' );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Triggered by init() to add capability meta box.
|
85 |
+
*/
|
86 |
+
public static function add_meta_boxes( $post_type, $post = null ) {
|
87 |
+
global $wp_version;
|
88 |
+
$post_type_object = get_post_type_object( $post_type );
|
89 |
+
if ( $post_type_object && $post_type != 'attachment' ) {
|
90 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
91 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
92 |
+
if ( $wp_version < 3.3 ) {
|
93 |
+
$post_types = get_post_types();
|
94 |
+
foreach ( $post_types as $post_type ) {
|
95 |
+
add_meta_box(
|
96 |
+
'groups-access',
|
97 |
+
__( "Access restrictions", 'groups' ),
|
98 |
+
array( __CLASS__, 'capability' ),
|
99 |
+
$post_type,
|
100 |
+
'side',
|
101 |
+
'high'
|
102 |
+
);
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
add_meta_box(
|
106 |
+
'groups-access',
|
107 |
+
__( 'Access restrictions', 'groups' ),
|
108 |
+
array( __CLASS__, 'capability' ),
|
109 |
+
null,
|
110 |
+
'side',
|
111 |
+
'high'
|
112 |
+
);
|
113 |
+
}
|
114 |
+
|
115 |
+
Groups_UIE::enqueue( 'select' );
|
116 |
+
|
117 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
118 |
+
if ( $screen = get_current_screen() ) {
|
119 |
+
$screen->add_help_tab( array(
|
120 |
+
'id' => 'groups-access',
|
121 |
+
'title' => __( 'Access restrictions', 'groups' ),
|
122 |
+
'content' =>
|
123 |
+
'<p>' .
|
124 |
+
'<strong>' . __( 'Access restrictions', 'groups' ) . '</strong>' .
|
125 |
+
'</p>' .
|
126 |
+
'<p>' .
|
127 |
+
__( 'Use the <em>Access restrictions</em> box to limit the visibility of posts, pages and other post types.', 'groups' ) .
|
128 |
+
'</p>' .
|
129 |
+
'<p>' .
|
130 |
+
__( 'You can select one or more capabilities that are enabled for access restriction.', 'groups' ) .
|
131 |
+
' ' .
|
132 |
+
__( 'Note that you must be a member of a group that has such a capability assigned.', 'groups' ) .
|
133 |
+
'</p>' .
|
134 |
+
'<p>' .
|
135 |
+
'<strong>' . __( 'Example:', 'groups' ) . '</strong>' .
|
136 |
+
'</p>' .
|
137 |
+
__( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.', 'groups' ) .
|
138 |
+
'<p>' .
|
139 |
+
'<strong>' . __( 'The quick way:', 'groups' ) . '</strong>' .
|
140 |
+
' ' .
|
141 |
+
__( 'Using the quick-create field', 'groups' ) .
|
142 |
+
'</p>' .
|
143 |
+
__( 'Enter <em>Premium</em> in the quick-create field located in the Access restrictions panel and save or update the post (or hit Enter).', 'groups' ) .
|
144 |
+
'<p>' .
|
145 |
+
'<p>' .
|
146 |
+
__( 'Using the quick-create field, you can create a new group and capability. The capability will be assigned to the group and enabled to enforce read access. Group names are case-sensitive, the name of the capability is the lower-case version of the name of the group. If the group already exists, a new capability is created and assigned to the existing group. If the capability already exists, it will be assigned to the group. If both already exist, the capability is enabled to enforce read access. In order to be able to use the capability, your user account will be assigned to the group.', 'groups' ) .
|
147 |
+
'</p>' .
|
148 |
+
'<em>' . __( 'The manual way:', 'groups' ) . '</em>' .
|
149 |
+
' ' .
|
150 |
+
__( 'Adding the group and capability manually and enabling it for access restriction', 'groups' ) .
|
151 |
+
'</p>' .
|
152 |
+
'<p>' .
|
153 |
+
__( 'Try the quick-create field first. Unless you need a more complex setup, there is no reason to go this way instead.', 'groups' ) .
|
154 |
+
'</p>' .
|
155 |
+
'<ol>' .
|
156 |
+
'<li>' . __( 'Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group.', 'groups' ) . '</li>' .
|
157 |
+
'<li>' . __( 'Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> capability.', 'groups' ) . '</li>' .
|
158 |
+
'<li>' . __( 'Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> capability to the <em>Premium</em> group.', 'groups' ) . '</li>' .
|
159 |
+
'<li>' . __( 'Go to <strong>Groups > Options</strong> and enable the <em>premium</em> capability to restrict access.', 'groups' ) . '</li>' .
|
160 |
+
'<li>' . __( 'Become a member of the <em>Premium</em> group - this is required so you can choose the <em>premium</em> capability to restrict access to a post.', 'groups' ) . '</li>' .
|
161 |
+
'<li>' . __( 'Edit the post for which you want to restrict access and choose<sup>*</sup> the <em>premium</em> capability.', 'groups' ) . '</li>' .
|
162 |
+
'</ol>' .
|
163 |
+
'<p>' .
|
164 |
+
__( '<sup>*</sup> For each capability, the groups that have the capability assigned are shown within parenthesis. You can choose a capability by typing part of the group\'s or the capability\'s name.', 'groups' ) .
|
165 |
+
'</p>'
|
166 |
+
) );
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Render meta box for capabilities.
|
175 |
+
*
|
176 |
+
* @see do_meta_boxes()
|
177 |
+
*
|
178 |
+
* @param Object $object
|
179 |
+
* @param Object $box
|
180 |
+
*/
|
181 |
+
public static function capability( $object = null, $box = null ) {
|
182 |
+
|
183 |
+
$output = '';
|
184 |
+
|
185 |
+
$show_groups = Groups_Options::get_user_option( self::SHOW_GROUPS, true );
|
186 |
+
|
187 |
+
$post_id = isset( $object->ID ) ? $object->ID : null;
|
188 |
+
$post_type = isset( $object->post_type ) ? $object->post_type : null;
|
189 |
+
$post_singular_name = __( 'Post', 'groups' );
|
190 |
+
if ( $post_type !== null ) {
|
191 |
+
$post_type_object = get_post_type_object( $post_type );
|
192 |
+
$labels = isset( $post_type_object->labels ) ? $post_type_object->labels : null;
|
193 |
+
if ( $labels !== null ) {
|
194 |
+
if ( isset( $labels->singular_name ) ) {
|
195 |
+
$post_singular_name = __( $labels->singular_name );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
$output .= wp_nonce_field( self::SET_CAPABILITY, self::NONCE, true, false );
|
201 |
+
|
202 |
+
if ( self::user_can_restrict() ) {
|
203 |
+
$user = new Groups_User( get_current_user_id() );
|
204 |
+
$output .= __( 'Enforce read access', 'groups' );
|
205 |
+
|
206 |
+
$read_caps = get_post_meta( $post_id, Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
|
207 |
+
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
208 |
+
$output .= '<div class="select-capability-container">';
|
209 |
+
$output .= sprintf(
|
210 |
+
'<select class="select capability" name="%s" multiple="multiple" placeholder="%s" data-placeholder="%s" title="%s">',
|
211 |
+
self::CAPABILITY . '[]',
|
212 |
+
__( 'Type and choose …', 'groups'),
|
213 |
+
__( 'Type and choose …', 'groups'),
|
214 |
+
__( 'Choose one or more capabilities to restrict access. Groups that grant access through the capabilities are shown in parenthesis. If no capabilities are available yet, you can use the quick-create box to create a group and capability enabled for access restriction on the fly.', 'groups' )
|
215 |
+
);
|
216 |
+
$output .= '<option value=""></option>';
|
217 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
218 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
219 |
+
if ( $user->can( $capability->capability ) ) {
|
220 |
+
$c = new Groups_Capability( $capability->capability_id );
|
221 |
+
$groups = $c->groups;
|
222 |
+
$group_names = array();
|
223 |
+
if ( !empty( $groups ) ) {
|
224 |
+
foreach( $groups as $group ) {
|
225 |
+
$group_names[] = $group->name;
|
226 |
+
}
|
227 |
+
}
|
228 |
+
if ( count( $group_names ) > 0 ) {
|
229 |
+
$label_title = sprintf(
|
230 |
+
_n(
|
231 |
+
'Members of the %1$s group can access this %2$s through this capability.',
|
232 |
+
'Members of the %1$s groups can access this %2$s through this capability.',
|
233 |
+
count( $group_names ),
|
234 |
+
'groups'
|
235 |
+
),
|
236 |
+
wp_filter_nohtml_kses( implode( ',', $group_names ) ),
|
237 |
+
$post_singular_name
|
238 |
+
);
|
239 |
+
} else {
|
240 |
+
$label_title = __( 'No groups grant access through this capability. To grant access to group members using this capability, you should assign it to a group and enable the capability for access restriction.', 'groups' );
|
241 |
+
}
|
242 |
+
|
243 |
+
$selected = apply_filters(
|
244 |
+
'groups_access_restrictions_capability_selected',
|
245 |
+
in_array( $capability->capability, $read_caps ),
|
246 |
+
$capability->capability,
|
247 |
+
$capability->capability_id,
|
248 |
+
$read_caps,
|
249 |
+
$post_id,
|
250 |
+
$post_type
|
251 |
+
);
|
252 |
+
$output .= sprintf( '<option value="%s" %s>', esc_attr( $capability->capability_id ), $selected ? ' selected="selected" ': '' );
|
253 |
+
$output .= wp_filter_nohtml_kses( $capability->capability );
|
254 |
+
if ( $show_groups ) {
|
255 |
+
if ( count( $group_names ) > 0 ) {
|
256 |
+
$output .= ' ';
|
257 |
+
$output .= '(' . wp_filter_nohtml_kses( implode( ', ', $group_names ) ) . ')';
|
258 |
+
}
|
259 |
+
}
|
260 |
+
$output .= '</option>';
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
$output .= '</select>';
|
265 |
+
|
266 |
+
$output .= Groups_UIE::render_select( '.select.capability' );
|
267 |
+
$output .= '</div>';
|
268 |
+
|
269 |
+
$output .= '<p class="description">';
|
270 |
+
$output .= sprintf( __( "Only groups or users that have one of the selected capabilities are allowed to read this %s.", 'groups' ), $post_singular_name );
|
271 |
+
$output .= '</p>';
|
272 |
+
|
273 |
+
$output .= '<p class="description">';
|
274 |
+
$output .= sprintf( '<label title="%s">', __( 'Click to toggle the display of groups that grant the capabilities.', 'groups' ) );
|
275 |
+
$output .= sprintf( '<input id="access-show-groups" type="checkbox" name="%s" %s />', esc_attr( self::SHOW_GROUPS ), $show_groups ? ' checked="checked" ' : '' );
|
276 |
+
$output .= ' ';
|
277 |
+
$output .= __( 'Show groups', 'groups' );
|
278 |
+
$output .= '</label>';
|
279 |
+
$output .= '</p>';
|
280 |
+
$output .= '<script type="text/javascript">';
|
281 |
+
$output .= 'if (typeof jQuery !== "undefined"){';
|
282 |
+
$output .= !$show_groups ? 'jQuery("span.groups.description").hide();' : '';
|
283 |
+
$output .= 'jQuery("#access-show-groups").click(function(){';
|
284 |
+
$output .= 'jQuery("span.groups.description").toggle();';
|
285 |
+
$output .= '});';
|
286 |
+
$output .= '}';
|
287 |
+
$output .= '</script>';
|
288 |
+
} else {
|
289 |
+
$output .= '<p class="description">';
|
290 |
+
$output .= sprintf( __( 'You cannot set any access restrictions.', 'groups' ), $post_singular_name );
|
291 |
+
$style = 'cursor:help;vertical-align:middle;';
|
292 |
+
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
293 |
+
$style = 'cursor:pointer;vertical-align:middle;';
|
294 |
+
$output .= sprintf( '<a href="%s">', esc_url( admin_url( 'admin.php?page=groups-admin-options' ) ) );
|
295 |
+
}
|
296 |
+
$output .= sprintf( '<img style="%s" alt="?" title="%s" src="%s" />', $style, esc_attr( __( 'You must be in a group that has at least one capability enabled to enforce read access.', 'groups' ) ), esc_attr( GROUPS_PLUGIN_URL . 'images/help.png' ) );
|
297 |
+
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
298 |
+
$output .= '</a>';
|
299 |
+
}
|
300 |
+
$output .= '</p>';
|
301 |
+
}
|
302 |
+
|
303 |
+
// quick-create
|
304 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
305 |
+
$style = 'cursor:help;vertical-align:middle;';
|
306 |
+
$output .= '<div class="quick-create-group-capability" style="margin:4px 0">';
|
307 |
+
$output .= '<label>';
|
308 |
+
$output .= sprintf( '<input style="width:100%%;margin-right:-20px;" id="quick-group-capability" name="quick-group-capability" class="quick-group-capability" type="text" value="" placeholder="%s"/>', __( 'Quick-create group & capability', 'groups' ) );
|
309 |
+
$output .= sprintf(
|
310 |
+
'<img id="quick-create-help-icon" style="%s" alt="?" title="%s" src="%s" />',
|
311 |
+
$style,
|
312 |
+
esc_attr( __( 'You can create a new group and capability here. The capability will be assigned to the group and enabled to enforce read access. Group names are case-sensitive, the name of the capability is the lower-case version of the name of the group. If the group already exists, a new capability is created and assigned to the existing group. If the capability already exists, it will be assigned to the group. If both already exist, the capability is enabled to enforce read access. In order to be able to use the capability, your user account will be assigned to the group.', 'groups' ) ),
|
313 |
+
esc_attr( GROUPS_PLUGIN_URL . 'images/help.png' )
|
314 |
+
);
|
315 |
+
$output .= '</label>';
|
316 |
+
$output .= '</div>';
|
317 |
+
$output .= '<script type="text/javascript">';
|
318 |
+
$output .= 'if (typeof jQuery !== "undefined"){';
|
319 |
+
$output .= 'jQuery("#quick-create-help-icon").click(function(){';
|
320 |
+
$output .= 'jQuery("#contextual-help-link").click();';
|
321 |
+
$output .= '});';
|
322 |
+
$output .= '}';
|
323 |
+
$output .= '</script>';
|
324 |
+
}
|
325 |
+
|
326 |
+
echo $output;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Invokes our save_post() if the post content is considered empty.
|
331 |
+
* This is required because even on an empty post, we want to allow to
|
332 |
+
* quick-create group and category as well as assign capabilities.
|
333 |
+
* At WordPress 3.6.1, this is the only way we can achieve that, because
|
334 |
+
* the save_post action is not invoked if the post content is considered
|
335 |
+
* empty.
|
336 |
+
*
|
337 |
+
* @param boolean $maybe_empty
|
338 |
+
* @param array $postarr
|
339 |
+
* @return boolean
|
340 |
+
*/
|
341 |
+
public static function wp_insert_post_empty_content( $maybe_empty, $postarr ) {
|
342 |
+
|
343 |
+
// Only consider invoking save_post() here, if the post content is
|
344 |
+
// considered to be empty at this stage. This is so we don't end up
|
345 |
+
// having save_post() invoked twice when the post is not empty.
|
346 |
+
if ( $maybe_empty ) {
|
347 |
+
$post_id = !empty( $postarr['ID'] ) ? $postarr['ID'] : !empty( $postarr['post_ID'] ) ? $postarr['post_ID'] : null;
|
348 |
+
if ( $post_id ) {
|
349 |
+
self::save_post( $post_id );
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
return $maybe_empty;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Save capability options.
|
358 |
+
*
|
359 |
+
* @param int $post_id
|
360 |
+
* @param mixed $post post data (not used here)
|
361 |
+
*/
|
362 |
+
public static function save_post( $post_id = null, $post = null ) {
|
363 |
+
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
|
364 |
+
} else {
|
365 |
+
$post_type = get_post_type( $post_id );
|
366 |
+
$post_type_object = get_post_type_object( $post_type );
|
367 |
+
if ( $post_type_object && $post_type != 'attachment' ) {
|
368 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
369 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
370 |
+
if ( isset( $_POST[self::NONCE] ) && wp_verify_nonce( $_POST[self::NONCE], self::SET_CAPABILITY ) ) {
|
371 |
+
$post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : null;
|
372 |
+
if ( $post_type !== null ) {
|
373 |
+
// See http://codex.wordpress.org/Function_Reference/current_user_can 20130119 WP 3.5
|
374 |
+
// "... Some capability checks (like 'edit_post' or 'delete_page') require this [the post ID] be provided."
|
375 |
+
// If the post ID is not provided, it will throw:
|
376 |
+
// PHP Notice: Undefined offset: 0 in /var/www/groups-forums/wp-includes/capabilities.php on line 1067
|
377 |
+
$edit_post_type = 'edit_' . $post_type;
|
378 |
+
if ( $post_type_object = get_post_type_object( $post_type ) ) {
|
379 |
+
if ( !isset( $post_type_object->capabilities ) ) {
|
380 |
+
// get_post_type_capabilities() (WP 3.8) will throw a warning
|
381 |
+
// when trying to merge the missing property otherwise. It's either a
|
382 |
+
// bug or the function's documentation should make it clear that you
|
383 |
+
// have to provide that.
|
384 |
+
$post_type_object->capabilities = array();
|
385 |
+
}
|
386 |
+
$caps_object = get_post_type_capabilities( $post_type_object );
|
387 |
+
if ( isset( $caps_object->edit_post ) ) {
|
388 |
+
$edit_post_type = $caps_object->edit_post;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
if ( current_user_can( $edit_post_type, $post_id ) ) {
|
393 |
+
// quick-create ?
|
394 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
395 |
+
if ( !empty( $_POST['quick-group-capability'] ) ) {
|
396 |
+
$creator_id = get_current_user_id();
|
397 |
+
$datetime = date( 'Y-m-d H:i:s', time() );
|
398 |
+
$name = ucfirst( strtolower( trim( $_POST['quick-group-capability'] ) ) );
|
399 |
+
if ( strlen( $name ) > 0 ) {
|
400 |
+
// create or obtain the group
|
401 |
+
if ( $group = Groups_Group::read_by_name( $name ) ) {
|
402 |
+
} else {
|
403 |
+
if ( $group_id = Groups_Group::create( compact( 'creator_id', 'datetime', 'name' ) ) ) {
|
404 |
+
$group = Groups_Group::read( $group_id );
|
405 |
+
}
|
406 |
+
}
|
407 |
+
// create or obtain the capability
|
408 |
+
$name = strtolower( $name );
|
409 |
+
if ( $capability = Groups_Capability::read_by_capability( $name ) ) {
|
410 |
+
} else {
|
411 |
+
if ( $capability_id = Groups_Capability::create( array( 'capability' => $name ) ) ) {
|
412 |
+
$capability = Groups_Capability::read( $capability_id );
|
413 |
+
}
|
414 |
+
}
|
415 |
+
if ( $group && $capability ) {
|
416 |
+
// add the capability to the group
|
417 |
+
if ( !Groups_Group_Capability::read( $group->group_id, $capability->capability_id ) ) {
|
418 |
+
Groups_Group_Capability::create(
|
419 |
+
array(
|
420 |
+
'group_id' => $group->group_id,
|
421 |
+
'capability_id' => $capability->capability_id
|
422 |
+
)
|
423 |
+
);
|
424 |
+
}
|
425 |
+
// enable the capability for access restriction
|
426 |
+
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
427 |
+
if ( !in_array( $capability->capability, $valid_read_caps ) ) {
|
428 |
+
$valid_read_caps[] = $capability->capability;
|
429 |
+
}
|
430 |
+
Groups_Options::update_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, $valid_read_caps );
|
431 |
+
// add the current user to the group
|
432 |
+
Groups_User_Group::create(
|
433 |
+
array(
|
434 |
+
'user_id' => get_current_user_id(),
|
435 |
+
'group_id' => $group->group_id
|
436 |
+
)
|
437 |
+
);
|
438 |
+
// put the capability ID in $_POST[self::CAPABILITY] so it is treated below
|
439 |
+
if ( empty( $_POST[self::CAPABILITY] ) ) {
|
440 |
+
$_POST[self::CAPABILITY] = array();
|
441 |
+
}
|
442 |
+
if ( !in_array( $capability->capability_id, $_POST[self::CAPABILITY] ) ) {
|
443 |
+
$_POST[self::CAPABILITY][] = $capability->capability_id;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
}
|
447 |
+
}
|
448 |
+
}
|
449 |
+
// set
|
450 |
+
if ( self::user_can_restrict() ) {
|
451 |
+
$valid_read_caps = self::get_valid_read_caps_for_user();
|
452 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
453 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
454 |
+
if ( !empty( $_POST[self::CAPABILITY] ) && is_array( $_POST[self::CAPABILITY] ) && in_array( $capability->capability_id, $_POST[self::CAPABILITY] ) ) {
|
455 |
+
Groups_Post_Access_Legacy::create( array(
|
456 |
+
'post_id' => $post_id,
|
457 |
+
'capability' => $capability->capability
|
458 |
+
) );
|
459 |
+
} else {
|
460 |
+
Groups_Post_Access_Legacy::delete( $post_id, $capability->capability );
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
464 |
+
}
|
465 |
+
// show groups
|
466 |
+
Groups_Options::update_user_option( self::SHOW_GROUPS, !empty( $_POST[self::SHOW_GROUPS] ) );
|
467 |
+
}
|
468 |
+
}
|
469 |
+
}
|
470 |
+
}
|
471 |
+
}
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Enqueue scripts and styles.
|
477 |
+
*/
|
478 |
+
private static function enqueue() {
|
479 |
+
global $groups_version;
|
480 |
+
if ( !wp_script_is( 'selectize' ) ) {
|
481 |
+
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
|
482 |
+
}
|
483 |
+
if ( !wp_style_is( 'selectize' ) ) {
|
484 |
+
wp_enqueue_style( 'selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version );
|
485 |
+
}
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* Render capabilities box for attachment post type (Media).
|
490 |
+
* @param array $form_fields
|
491 |
+
* @param object $post
|
492 |
+
* @return array
|
493 |
+
*/
|
494 |
+
public static function attachment_fields_to_edit( $form_fields, $post ) {
|
495 |
+
|
496 |
+
Groups_UIE::enqueue( 'select' );
|
497 |
+
|
498 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
499 |
+
if ( !isset( $post_types_option['attachment']['add_meta_box'] ) || $post_types_option['attachment']['add_meta_box'] ) {
|
500 |
+
if ( self::user_can_restrict() ) {
|
501 |
+
$user = new Groups_User( get_current_user_id() );
|
502 |
+
$output = "";
|
503 |
+
$post_singular_name = __( 'Media', 'groups' );
|
504 |
+
|
505 |
+
$output .= __( "Enforce read access", 'groups' );
|
506 |
+
$read_caps = get_post_meta( $post->ID, Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
|
507 |
+
$valid_read_caps = self::get_valid_read_caps_for_user();
|
508 |
+
|
509 |
+
// On attachments edited within the 'Insert Media' popup, the update is triggered too soon and we end up with only the last capability selected.
|
510 |
+
// This occurs when using normal checkboxes as well as the select below (Chosen and Selectize tested).
|
511 |
+
// With checkboxes it's even more confusing, it's actually better to have it using a select as below,
|
512 |
+
// because the visual feedback corresponds with what is assigned.
|
513 |
+
// See http://wordpress.org/support/topic/multiple-access-restrictions-for-media-items-are-not-saved-in-grid-view
|
514 |
+
// and https://core.trac.wordpress.org/ticket/28053 - this is an issue with multiple value fields and should
|
515 |
+
// be fixed within WordPress.
|
516 |
+
|
517 |
+
// $output .= '<div style="padding:0 1em;margin:1em 0;border:1px solid #ccc;border-radius:4px;">';
|
518 |
+
// $output .= '<ul>';
|
519 |
+
// foreach( $valid_read_caps as $valid_read_cap ) {
|
520 |
+
// if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
521 |
+
// $checked = in_array( $capability->capability, $read_caps ) ? ' checked="checked" ' : '';
|
522 |
+
// $output .= '<li>';
|
523 |
+
// $output .= '<label>';
|
524 |
+
// $output .= '<input name="attachments[' . $post->ID . '][' . self::CAPABILITY . '][]" ' . $checked . ' type="checkbox" value="' . esc_attr( $capability->capability_id ) . '" />';
|
525 |
+
// $output .= wp_filter_nohtml_kses( $capability->capability );
|
526 |
+
// $output .= '</label>';
|
527 |
+
// $output .= '</li>';
|
528 |
+
// }
|
529 |
+
// }
|
530 |
+
// $output .= '</ul>';
|
531 |
+
// $output .= '</div>';
|
532 |
+
|
533 |
+
$show_groups = Groups_Options::get_user_option( self::SHOW_GROUPS, true );
|
534 |
+
$output .= '<div class="select-capability-container">';
|
535 |
+
$select_id = 'attachments-' . $post->ID . '-' . self::CAPABILITY;
|
536 |
+
$output .= sprintf(
|
537 |
+
'<select id="%s" class="select capability" name="%s" multiple="multiple" data-placeholder="%s" title="%s">',
|
538 |
+
$select_id,
|
539 |
+
'attachments[' . $post->ID . '][' . self::CAPABILITY . '][]',
|
540 |
+
__( 'Type and choose …', 'groups'),
|
541 |
+
__( 'Choose one or more capabilities to restrict access. Groups that grant access through the capabilities are shown in parenthesis. If no capabilities are available yet, you can use the quick-create box to create a group and capability enabled for access restriction on the fly.', 'groups' )
|
542 |
+
);
|
543 |
+
$output .= '<option value=""></option>';
|
544 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
545 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
546 |
+
if ( $user->can( $capability->capability ) ) {
|
547 |
+
$c = new Groups_Capability( $capability->capability_id );
|
548 |
+
$groups = $c->groups;
|
549 |
+
$group_names = array();
|
550 |
+
if ( !empty( $groups ) ) {
|
551 |
+
foreach( $groups as $group ) {
|
552 |
+
$group_names[] = $group->name;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
if ( count( $group_names ) > 0 ) {
|
556 |
+
$label_title = sprintf(
|
557 |
+
_n(
|
558 |
+
'Members of the %1$s group can access this %2$s through this capability.',
|
559 |
+
'Members of the %1$s groups can access this %2$s through this capability.',
|
560 |
+
count( $group_names ),
|
561 |
+
'groups'
|
562 |
+
),
|
563 |
+
wp_filter_nohtml_kses( implode( ',', $group_names ) ),
|
564 |
+
$post_singular_name
|
565 |
+
);
|
566 |
+
} else {
|
567 |
+
$label_title = __( 'No groups grant access through this capability. To grant access to group members using this capability, you should assign it to a group and enable the capability for access restriction.', 'groups' );
|
568 |
+
}
|
569 |
+
$output .= sprintf( '<option value="%s" %s>', esc_attr( $capability->capability_id ), in_array( $capability->capability, $read_caps ) ? ' selected="selected" ' : '' );
|
570 |
+
$output .= wp_filter_nohtml_kses( $capability->capability );
|
571 |
+
if ( $show_groups ) {
|
572 |
+
if ( count( $group_names ) > 0 ) {
|
573 |
+
$output .= ' ';
|
574 |
+
$output .= '(' . wp_filter_nohtml_kses( implode( ', ', $group_names ) ) . ')';
|
575 |
+
}
|
576 |
+
}
|
577 |
+
$output .= '</option>';
|
578 |
+
}
|
579 |
+
}
|
580 |
+
}
|
581 |
+
$output .= '</select>';
|
582 |
+
|
583 |
+
$output .= Groups_UIE::render_select( '#'.$select_id );
|
584 |
+
|
585 |
+
$output .= '</div>';
|
586 |
+
|
587 |
+
$output .= '<p class="description">';
|
588 |
+
$output .= sprintf( __( "Only groups or users that have one of the selected capabilities are allowed to read this %s.", 'groups' ), $post_singular_name );
|
589 |
+
$output .= '</p>';
|
590 |
+
|
591 |
+
$form_fields['groups_access'] = array(
|
592 |
+
'label' => __( 'Access restrictions', 'groups' ),
|
593 |
+
'input' => 'html',
|
594 |
+
'html' => $output
|
595 |
+
);
|
596 |
+
}
|
597 |
+
}
|
598 |
+
return $form_fields;
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Save capabilities for attachment post type (Media).
|
603 |
+
* When multiple attachments are saved, this is called once for each.
|
604 |
+
* @param array $post post data
|
605 |
+
* @param array $attachment attachment field data
|
606 |
+
* @return array
|
607 |
+
*/
|
608 |
+
public static function attachment_fields_to_save( $post, $attachment ) {
|
609 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
610 |
+
if ( !isset( $post_types_option['attachment']['add_meta_box'] ) || $post_types_option['attachment']['add_meta_box'] ) {
|
611 |
+
// if we're here, we assume the user is allowed to edit attachments,
|
612 |
+
// but we still need to check if the user can restrict access
|
613 |
+
if ( self::user_can_restrict() ) {
|
614 |
+
$post_id = null;
|
615 |
+
if ( isset( $post['ID'] ) ) {
|
616 |
+
$post_id = $post['ID'];
|
617 |
+
} else if ( isset( $post['post_ID'] ) ) {
|
618 |
+
$post_id = $post['post_ID'];
|
619 |
+
}
|
620 |
+
if ( $post_id !== null ) {
|
621 |
+
$valid_read_caps = self::get_valid_read_caps_for_user();
|
622 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
623 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
624 |
+
if ( !empty( $attachment[self::CAPABILITY] ) && is_array( $attachment[self::CAPABILITY] ) && in_array( $capability->capability_id, $attachment[self::CAPABILITY] ) ) {
|
625 |
+
Groups_Post_Access_Legacy::create( array(
|
626 |
+
'post_id' => $post_id,
|
627 |
+
'capability' => $capability->capability
|
628 |
+
) );
|
629 |
+
} else {
|
630 |
+
Groups_Post_Access_Legacy::delete( $post_id, $capability->capability );
|
631 |
+
}
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}
|
635 |
+
}
|
636 |
+
}
|
637 |
+
return $post;
|
638 |
+
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Returns true if the current user has at least one of the capabilities
|
642 |
+
* that can be used to restrict access to posts.
|
643 |
+
* @return boolean
|
644 |
+
*/
|
645 |
+
public static function user_can_restrict() {
|
646 |
+
$has_read_cap = false;
|
647 |
+
$user = new Groups_User( get_current_user_id() );
|
648 |
+
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
649 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
650 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
651 |
+
if ( $user->can( $capability->capability_id ) ) {
|
652 |
+
$has_read_cap = true;
|
653 |
+
break;
|
654 |
+
}
|
655 |
+
}
|
656 |
+
}
|
657 |
+
return $has_read_cap;
|
658 |
+
}
|
659 |
+
|
660 |
+
/**
|
661 |
+
* @return array of valid read capabilities for the current or given user
|
662 |
+
*/
|
663 |
+
public static function get_valid_read_caps_for_user( $user_id = null ) {
|
664 |
+
$result = array();
|
665 |
+
$user = new Groups_User( $user_id === null ? get_current_user_id() : $user_id );
|
666 |
+
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
667 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
668 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
669 |
+
if ( $user->can( $capability->capability ) ) {
|
670 |
+
$result[] = $valid_read_cap;
|
671 |
+
}
|
672 |
+
}
|
673 |
+
}
|
674 |
+
return $result;
|
675 |
+
}
|
676 |
+
}
|
677 |
+
Groups_Access_Meta_Boxes_Legacy::init();
|
legacy/access/class-groups-post-access-legacy.php
ADDED
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* class-groups-post-access-legacy.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 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Post access restrictions.
|
28 |
+
*/
|
29 |
+
class Groups_Post_Access_Legacy {
|
30 |
+
|
31 |
+
const POSTMETA_PREFIX = 'groups-';
|
32 |
+
|
33 |
+
const CACHE_GROUP = 'groups';
|
34 |
+
const CAN_READ_POST = 'can_read_post';
|
35 |
+
|
36 |
+
const READ_POST_CAPABILITY = 'groups_read_post';
|
37 |
+
const READ_POST_CAPABILITY_NAME = 'Read Post';
|
38 |
+
const READ_POST_CAPABILITIES = 'read_post_capabilities';
|
39 |
+
const POST_TYPES = 'post_types';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Create needed capabilities on plugin activation.
|
43 |
+
* Must be called explicitly or hooked into activation.
|
44 |
+
*/
|
45 |
+
public static function activate() {
|
46 |
+
if ( !Groups_Capability::read_by_capability( self::READ_POST_CAPABILITY ) ) {
|
47 |
+
Groups_Capability::create( array( 'capability' => self::READ_POST_CAPABILITY ) );
|
48 |
+
// default read caps
|
49 |
+
Groups_Options::update_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
50 |
+
// for translation
|
51 |
+
// @see self::READ_POST_CAPABILITY_NAME
|
52 |
+
__( 'Read Post', 'groups' );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Sets up filters to restrict access.
|
58 |
+
*/
|
59 |
+
public static function init() {
|
60 |
+
// Before Groups 2.0.0 this was called through Groups_Controller::activate() but
|
61 |
+
// now we only need to create the capabilities if legacy is enabled.
|
62 |
+
self::activate();
|
63 |
+
// post access
|
64 |
+
add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
|
65 |
+
add_filter( 'get_pages', array( __CLASS__, 'get_pages' ), 1 );
|
66 |
+
if ( apply_filters( 'groups_filter_the_posts', false ) ) {
|
67 |
+
add_filter( 'the_posts', array( __CLASS__, 'the_posts' ), 1, 2 );
|
68 |
+
}
|
69 |
+
add_filter( 'wp_get_nav_menu_items', array( __CLASS__, 'wp_get_nav_menu_items' ), 1, 3 );
|
70 |
+
// content access
|
71 |
+
add_filter( 'get_the_excerpt', array( __CLASS__, 'get_the_excerpt' ), 1 );
|
72 |
+
add_filter( 'the_content', array( __CLASS__, 'the_content' ), 1 );
|
73 |
+
// edit & delete post
|
74 |
+
add_filter( 'map_meta_cap', array( __CLASS__, 'map_meta_cap' ), 10, 4 );
|
75 |
+
add_action( 'groups_deleted_capability_capability', array( __CLASS__, 'groups_deleted_capability_capability' ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Restrict access to edit or delete posts based on the post's access restrictions.
|
80 |
+
*
|
81 |
+
* @param array $caps
|
82 |
+
* @param string $cap
|
83 |
+
* @param int $user_id
|
84 |
+
* @param array $args
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public static function map_meta_cap( $caps, $cap, $user_id, $args ) {
|
88 |
+
if ( isset( $args[0] ) ) {
|
89 |
+
if ( strpos( $cap, 'edit_' ) === 0 || strpos( $cap, 'delete_' ) === 0 ) {
|
90 |
+
if ( $post_type = get_post_type( $args[0] ) ) {
|
91 |
+
|
92 |
+
$edit_post_type = 'edit_' . $post_type;
|
93 |
+
$delete_post_type = 'delete_' . $post_type;
|
94 |
+
if ( $post_type_object = get_post_type_object( $post_type ) ) {
|
95 |
+
if ( !isset( $post_type_object->capabilities ) ) {
|
96 |
+
$post_type_object->capabilities = array();
|
97 |
+
}
|
98 |
+
$caps_object = get_post_type_capabilities( $post_type_object );
|
99 |
+
if ( isset( $caps_object->edit_post ) ) {
|
100 |
+
$edit_post_type = $caps_object->edit_post;
|
101 |
+
}
|
102 |
+
if ( isset( $caps_object->delete_post ) ) {
|
103 |
+
$delete_post_type = $caps_object->delete_post;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( $cap === $edit_post_type || $cap === $delete_post_type ) {
|
108 |
+
$post_id = null;
|
109 |
+
if ( is_numeric( $args[0] ) ) {
|
110 |
+
$post_id = $args[0];
|
111 |
+
} else if ( $args[0] instanceof WP_Post ) {
|
112 |
+
$post_id = $post->ID;
|
113 |
+
}
|
114 |
+
if ( $post_id ) {
|
115 |
+
if ( !self::user_can_read_post( $post_id, $user_id ) ) {
|
116 |
+
$caps[] = 'do_not_allow';
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
return $caps;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Filters out posts that the user should not be able to access.
|
128 |
+
*
|
129 |
+
* @param string $where current where conditions
|
130 |
+
* @param WP_Query $query current query
|
131 |
+
* @return string modified $where
|
132 |
+
*/
|
133 |
+
public static function posts_where( $where, &$query ) {
|
134 |
+
|
135 |
+
global $wpdb;
|
136 |
+
|
137 |
+
$user_id = get_current_user_id();
|
138 |
+
|
139 |
+
// this only applies to logged in users
|
140 |
+
if ( $user_id ) {
|
141 |
+
// if administrators can override access, don't filter
|
142 |
+
if ( get_option( GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE, GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE_DEFAULT ) ) {
|
143 |
+
if ( user_can( $user_id, 'administrator' ) ) {
|
144 |
+
return $where;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
// 1. Get all the capabilities that the user has, including those that are inherited:
|
150 |
+
$caps = array();
|
151 |
+
if ( $user = new Groups_User( $user_id ) ) {
|
152 |
+
$capabilities = $user->capabilities_deep;
|
153 |
+
if ( is_array( $capabilities ) ) {
|
154 |
+
foreach ( $capabilities as $capability ) {
|
155 |
+
$caps[] = "'". $capability . "'";
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( count( $caps ) > 0 ) {
|
161 |
+
$caps = implode( ',', $caps );
|
162 |
+
} else {
|
163 |
+
$caps = '\'\'';
|
164 |
+
}
|
165 |
+
|
166 |
+
// 2. Filter the posts that require a capability that the user doesn't
|
167 |
+
// have, or in other words: exclude posts that the user must NOT access:
|
168 |
+
|
169 |
+
// The following is not correct in that it requires the user to have ALL capabilities:
|
170 |
+
// $where .= sprintf(
|
171 |
+
// " AND {$wpdb->posts}.ID NOT IN (SELECT DISTINCT ID FROM $wpdb->posts LEFT JOIN $wpdb->postmeta on {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id WHERE {$wpdb->postmeta}.meta_key = '%s' AND {$wpdb->postmeta}.meta_value NOT IN (%s) ) ",
|
172 |
+
// self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY,
|
173 |
+
// $caps
|
174 |
+
// );
|
175 |
+
|
176 |
+
// This allows the user to access posts where the posts are not restricted or where
|
177 |
+
// the user has ANY of the capabilities:
|
178 |
+
$where .= sprintf(
|
179 |
+
" AND {$wpdb->posts}.ID IN " .
|
180 |
+
" ( " .
|
181 |
+
" SELECT ID FROM $wpdb->posts WHERE ID NOT IN ( SELECT post_id FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' ) " . // posts without access restriction
|
182 |
+
" UNION ALL " . // we don't care about duplicates here, just make it quick
|
183 |
+
" SELECT post_id AS ID FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' AND {$wpdb->postmeta}.meta_value IN (%s) " . // posts that require any capability the user has
|
184 |
+
" ) ",
|
185 |
+
self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY,
|
186 |
+
self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY,
|
187 |
+
$caps
|
188 |
+
);
|
189 |
+
|
190 |
+
return $where;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Filter pages by access capability.
|
195 |
+
*
|
196 |
+
* @param array $pages
|
197 |
+
*/
|
198 |
+
public static function get_pages( $pages ) {
|
199 |
+
$result = array();
|
200 |
+
$user_id = get_current_user_id();
|
201 |
+
foreach ( $pages as $page ) {
|
202 |
+
if ( self::user_can_read_post( $page->ID, $user_id ) ) {
|
203 |
+
$result[] = $page;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
return $result;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Filter posts by access capability.
|
211 |
+
*
|
212 |
+
* @param array $posts list of posts
|
213 |
+
* @param WP_Query $query
|
214 |
+
*/
|
215 |
+
public static function the_posts( $posts, &$query ) {
|
216 |
+
$result = array();
|
217 |
+
$user_id = get_current_user_id();
|
218 |
+
foreach ( $posts as $post ) {
|
219 |
+
if ( self::user_can_read_post( $post->ID, $user_id ) ) {
|
220 |
+
$result[] = $post;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
return $result;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Filter menu items by access capability.
|
228 |
+
*
|
229 |
+
* @param array $items
|
230 |
+
* @param mixed $menu
|
231 |
+
* @param array $args
|
232 |
+
*/
|
233 |
+
public static function wp_get_nav_menu_items( $items = null, $menu = null, $args = null ) {
|
234 |
+
$result = array();
|
235 |
+
$user_id = get_current_user_id();
|
236 |
+
foreach ( $items as $item ) {
|
237 |
+
if ( self::user_can_read_post( $item->object_id, $user_id ) ) {
|
238 |
+
$result[] = $item;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
return $result;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Filter excerpt by access capability.
|
246 |
+
*
|
247 |
+
* @param string $output
|
248 |
+
* @return $output if access granted, otherwise ''
|
249 |
+
*/
|
250 |
+
public static function get_the_excerpt( $output ) {
|
251 |
+
global $post;
|
252 |
+
$result = '';
|
253 |
+
if ( isset( $post->ID ) ) {
|
254 |
+
if ( self::user_can_read_post( $post->ID ) ) {
|
255 |
+
$result = $output;
|
256 |
+
}
|
257 |
+
} else {
|
258 |
+
// not a post, don't interfere
|
259 |
+
$result = $output;
|
260 |
+
}
|
261 |
+
return $result;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Filter content by access capability.
|
266 |
+
*
|
267 |
+
* @param string $output
|
268 |
+
* @return $output if access granted, otherwise ''
|
269 |
+
*/
|
270 |
+
public static function the_content( $output ) {
|
271 |
+
global $post;
|
272 |
+
$result = '';
|
273 |
+
if ( isset( $post->ID ) ) {
|
274 |
+
if ( self::user_can_read_post( $post->ID ) ) {
|
275 |
+
$result = $output;
|
276 |
+
}
|
277 |
+
} else {
|
278 |
+
// not a post, don't interfere
|
279 |
+
$result = $output;
|
280 |
+
}
|
281 |
+
return $result;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Adds an access capability requirement.
|
286 |
+
*
|
287 |
+
* $map must contain 'post_id' (*)
|
288 |
+
*
|
289 |
+
* For now this only should be used to add the READ_POST_CAPABILITY which
|
290 |
+
* it does automatically. Nothing else is checked for granting access.
|
291 |
+
*
|
292 |
+
* (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
|
293 |
+
* add_post_meta stores postmeta for the revision's parent, we retrieve
|
294 |
+
* the parent's post ID if it applies and check against that to see if
|
295 |
+
* that capability is already present. This is to avoid duplicating
|
296 |
+
* the already existing postmeta entry (which ocurred in previous
|
297 |
+
* versions).
|
298 |
+
*
|
299 |
+
* @param array $map
|
300 |
+
* @return true if the capability could be added to the post, otherwis false
|
301 |
+
*/
|
302 |
+
public static function create( $map ) {
|
303 |
+
extract( $map );
|
304 |
+
$result = false;
|
305 |
+
|
306 |
+
if ( !isset( $capability ) ) {
|
307 |
+
$capability = self::READ_POST_CAPABILITY;
|
308 |
+
}
|
309 |
+
|
310 |
+
if ( !empty( $post_id ) && !empty( $capability) ) {
|
311 |
+
if ( Groups_Capability::read_by_capability( $capability ) ) {
|
312 |
+
if ( $revision_parent_id = wp_is_post_revision( $post_id ) ) {
|
313 |
+
$post_id = $revision_parent_id;
|
314 |
+
}
|
315 |
+
if ( !in_array( $capability, get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY ) ) ) {
|
316 |
+
$result = add_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY, $capability );
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
return $result;
|
321 |
+
}
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Returns true if the post requires the given capability to grant access.
|
325 |
+
*
|
326 |
+
* Currently only READ_POST_CAPABILITY should be used, this is also taken
|
327 |
+
* as the default.
|
328 |
+
*
|
329 |
+
* @param int $post_id
|
330 |
+
* @param string $capability capability label
|
331 |
+
* @return true if the capability is required, otherwise false
|
332 |
+
*/
|
333 |
+
public static function read( $post_id, $capability = self::READ_POST_CAPABILITY ) {
|
334 |
+
$result = false;
|
335 |
+
$caps = get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY );
|
336 |
+
if ( $caps ) {
|
337 |
+
$result = in_array( $capability, $caps );
|
338 |
+
}
|
339 |
+
return $result;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Currently does nothing, always returns false.
|
344 |
+
*
|
345 |
+
* @param array $map
|
346 |
+
* @return false
|
347 |
+
*/
|
348 |
+
public static function update( $map ) {
|
349 |
+
return false;
|
350 |
+
}
|
351 |
+
|
352 |
+
/**
|
353 |
+
* Removes a capability requirement from a post.
|
354 |
+
*
|
355 |
+
* @param int $post_id
|
356 |
+
* @param string $capability defaults to groups_read_post, removes all if null is given
|
357 |
+
* @return true on success, otherwise false
|
358 |
+
*/
|
359 |
+
public static function delete( $post_id, $capability = self::READ_POST_CAPABILITY ) {
|
360 |
+
$result = false;
|
361 |
+
if ( !empty( $post_id ) ) {
|
362 |
+
if ( !empty( $capability ) ) {
|
363 |
+
$result = delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY, $capability );
|
364 |
+
} else {
|
365 |
+
$result = delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY );
|
366 |
+
}
|
367 |
+
}
|
368 |
+
return $result;
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Returns a list of capabilities that grant access to the post.
|
373 |
+
*
|
374 |
+
* @param int $post_id
|
375 |
+
* @return array of string, capabilities
|
376 |
+
*/
|
377 |
+
public static function get_read_post_capabilities( $post_id ) {
|
378 |
+
return get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY );
|
379 |
+
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Returns true if the user has any of the capabilities that grant access to the post.
|
383 |
+
*
|
384 |
+
* @param int $post_id post id
|
385 |
+
* @param int $user_id user id or null for current user
|
386 |
+
* @return boolean true if user can read the post
|
387 |
+
*/
|
388 |
+
public static function user_can_read_post( $post_id, $user_id = null ) {
|
389 |
+
$result = false;
|
390 |
+
if ( !empty( $post_id ) ) {
|
391 |
+
if ( $user_id === null ) {
|
392 |
+
$user_id = get_current_user_id();
|
393 |
+
}
|
394 |
+
$cached = Groups_Cache::get( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, self::CACHE_GROUP );
|
395 |
+
if ( $cached !== null ) {
|
396 |
+
$result = $cached->value;
|
397 |
+
unset( $cached ) ;
|
398 |
+
} else {
|
399 |
+
$groups_user = new Groups_User( $user_id );
|
400 |
+
$read_caps = self::get_read_post_capabilities( $post_id );
|
401 |
+
if ( !empty( $read_caps ) ) {
|
402 |
+
foreach( $read_caps as $read_cap ) {
|
403 |
+
if ( $groups_user->can( $read_cap ) ) {
|
404 |
+
$result = true;
|
405 |
+
break;
|
406 |
+
}
|
407 |
+
}
|
408 |
+
} else {
|
409 |
+
$result = true;
|
410 |
+
}
|
411 |
+
$result = apply_filters( 'groups_post_access_user_can_read_post', $result, $post_id, $user_id );
|
412 |
+
Groups_Cache::set( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, $result, self::CACHE_GROUP );
|
413 |
+
}
|
414 |
+
}
|
415 |
+
return $result;
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* Hooks into groups_deleted_capability_capability to remove existing access
|
420 |
+
* restrictions based on the deleted capability.
|
421 |
+
*
|
422 |
+
* @param string $name of the deleted capability
|
423 |
+
*/
|
424 |
+
public static function groups_deleted_capability_capability( $capability ) {
|
425 |
+
delete_metadata( 'post', null, self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY, $capability, true );
|
426 |
+
}
|
427 |
+
|
428 |
+
}
|
429 |
+
Groups_Post_Access_Legacy::init();
|
legacy/admin/class-groups-admin-post-columns-legacy.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* class-groups-admin-custom-posts-legacy.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2012 "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 Antonio Blanco
|
18 |
+
* @package groups
|
19 |
+
* @since groups 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Post column extensions.
|
28 |
+
*/
|
29 |
+
class Groups_Admin_Post_Columns_Legacy {
|
30 |
+
|
31 |
+
const CAPABILITIES = 'capabilities';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Adds an admin_init action.
|
35 |
+
*/
|
36 |
+
public static function init() {
|
37 |
+
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Adds the filters and actions only for users who have the right
|
42 |
+
* Groups permissions and for the post types that have access
|
43 |
+
* restrictions enabled.
|
44 |
+
*/
|
45 |
+
public static function admin_init() {
|
46 |
+
if ( current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
47 |
+
$post_types = get_post_types( array( 'public' => true ) );
|
48 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
49 |
+
foreach ( $post_types as $post_type ) {
|
50 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
51 |
+
if ( ( $post_type == 'attachment' ) ) {
|
52 |
+
// filters to display the media's access restriction capabilities
|
53 |
+
add_filter( 'manage_media_columns', array( __CLASS__, 'columns' ) );
|
54 |
+
// args: string $column_name, int $media_id
|
55 |
+
add_action( 'manage_media_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
56 |
+
} else {
|
57 |
+
// filters to display the posts' access restriction capabilities
|
58 |
+
add_filter( 'manage_' . $post_type . '_posts_columns', array( __CLASS__, 'columns' ) );
|
59 |
+
// args: string $column_name, int $post_id
|
60 |
+
add_action( 'manage_' . $post_type . '_posts_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Adds a new column to the post type's table showing the access
|
69 |
+
* restriction capabilities.
|
70 |
+
*
|
71 |
+
* @param array $column_headers
|
72 |
+
* @return array column headers
|
73 |
+
*/
|
74 |
+
public static function columns( $column_headers ) {
|
75 |
+
$column_headers[self::CAPABILITIES] = sprintf(
|
76 |
+
__( '<span title="%s">Access Restrictions</span>', 'groups' ),
|
77 |
+
esc_attr( __( 'One or more capabilities required to read the entry.', 'groups' ) )
|
78 |
+
);
|
79 |
+
return $column_headers;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Renders custom column content.
|
84 |
+
*
|
85 |
+
* @param string $column_name
|
86 |
+
* @param int $post_id
|
87 |
+
* @return string custom column content
|
88 |
+
*/
|
89 |
+
public static function custom_column( $column_name, $post_id ) {
|
90 |
+
$output = '';
|
91 |
+
switch ( $column_name ) {
|
92 |
+
case self::CAPABILITIES :
|
93 |
+
$read_caps = get_post_meta( $post_id, Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
|
94 |
+
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
95 |
+
if ( count( $valid_read_caps ) > 0 ) {
|
96 |
+
sort( $valid_read_caps );
|
97 |
+
$output = '<ul>';
|
98 |
+
foreach( $valid_read_caps as $valid_read_cap ) {
|
99 |
+
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
100 |
+
if ( in_array( $valid_read_cap, $read_caps ) ) {
|
101 |
+
$output .= '<li>';
|
102 |
+
$output .= wp_strip_all_tags( $capability->capability );
|
103 |
+
$output .= '</li>';
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
$output .= '</ul>';
|
108 |
+
} else {
|
109 |
+
$output .= '';
|
110 |
+
}
|
111 |
+
break;
|
112 |
+
}
|
113 |
+
echo $output;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
Groups_Admin_Post_Columns_Legacy::init();
|
legacy/admin/class-groups-admin-posts-legacy.php
ADDED
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* class-groups-admin-posts-legacy.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2013 "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 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Additions to post overview admin screens.
|
28 |
+
*/
|
29 |
+
class Groups_Admin_Posts_Legacy {
|
30 |
+
|
31 |
+
const NOT_RESTRICTED = '#not-restricted#';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Sets up an admin_init hook where our actions and filters are added.
|
35 |
+
*/
|
36 |
+
public static function init() {
|
37 |
+
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Adds actions and filters to handle filtering by access restriction
|
42 |
+
* capability.
|
43 |
+
*/
|
44 |
+
public static function admin_init() {
|
45 |
+
if ( current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
46 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
|
47 |
+
add_action( 'admin_head', array( __CLASS__, 'admin_head' ) );
|
48 |
+
add_action( 'restrict_manage_posts', array( __CLASS__, 'restrict_manage_posts' ) );
|
49 |
+
add_filter( 'parse_query', array( __CLASS__, 'parse_query' ) );
|
50 |
+
|
51 |
+
add_action( 'bulk_edit_custom_box', array( __CLASS__, 'bulk_edit_custom_box' ), 10, 2);
|
52 |
+
add_action( 'save_post', array( __CLASS__, 'save_post' ) );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Enqueues the select script.
|
58 |
+
*/
|
59 |
+
public static function admin_enqueue_scripts() {
|
60 |
+
|
61 |
+
global $pagenow;
|
62 |
+
|
63 |
+
if ( $pagenow == 'edit.php' ) {
|
64 |
+
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
65 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
66 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
67 |
+
Groups_UIE::enqueue( 'select' );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Adds CSS rules to display our access restriction filter coherently.
|
74 |
+
*/
|
75 |
+
public static function admin_head() {
|
76 |
+
|
77 |
+
global $pagenow;
|
78 |
+
|
79 |
+
if ( $pagenow == 'edit.php' ) {
|
80 |
+
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
81 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
82 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
83 |
+
echo '<style type="text/css">';
|
84 |
+
echo '.groups-capabilities-container { display: inline-block; line-height: 24px; padding-bottom: 1em; vertical-align: top; margin-left: 4px; margin-right: 4px; }';
|
85 |
+
echo '.groups-capabilities-container .groups-select-container { display: inline-block; vertical-align: top; }';
|
86 |
+
echo '.groups-capabilities-container .groups-select-container select, .groups-bulk-container select.groups-action { float: none; margin-right: 4px; vertical-align: top; }';
|
87 |
+
echo '.groups-capabilities-container .selectize-control { min-width: 128px; }';
|
88 |
+
echo '.groups-capabilities-container .selectize-control, .groups-bulk-container select.groups-action { margin-right: 4px; vertical-align: top; }';
|
89 |
+
echo '.groups-capabilities-container .selectize-input { font-size: inherit; line-height: 18px; padding: 1px 2px 2px 2px; vertical-align: middle; }';
|
90 |
+
echo '.groups-capabilities-container .selectize-input input[type="text"] { font-size: inherit; vertical-align: middle; }';
|
91 |
+
echo '.groups-capabilities-container input.button { margin-top: 1px; vertical-align: top; }';
|
92 |
+
echo '.inline-edit-row fieldset .capabilities-bulk-container label span.title { min-width: 5em; padding: 2px 1em; width: auto; }';
|
93 |
+
echo '.tablenav .actions { overflow: visible; }'; // this is important so that the selectize options aren't hidden
|
94 |
+
echo '.wp-list-table td { overflow: visible; }'; // idem for bulk actions
|
95 |
+
echo '</style>';
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Renders the access restriction field.
|
102 |
+
*/
|
103 |
+
public static function restrict_manage_posts() {
|
104 |
+
|
105 |
+
global $pagenow, $wpdb;
|
106 |
+
|
107 |
+
if ( is_admin() ) {
|
108 |
+
|
109 |
+
if ( $pagenow == 'edit.php' ) { // check that we're on the right screen
|
110 |
+
|
111 |
+
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
112 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
113 |
+
|
114 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
115 |
+
|
116 |
+
$output = '';
|
117 |
+
|
118 |
+
// capabilities select
|
119 |
+
$output .= '<div class="groups-capabilities-container">';
|
120 |
+
$applicable_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
121 |
+
$output .= sprintf(
|
122 |
+
'<select class="select capability" name="%s[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
123 |
+
esc_attr( Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY ),
|
124 |
+
esc_attr( __( 'Access restrictions …', 'groups' ) ) ,
|
125 |
+
esc_attr( __( 'Access restrictions …', 'groups' ) )
|
126 |
+
);
|
127 |
+
|
128 |
+
$previous_selected = array();
|
129 |
+
if ( !empty( $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY] ) ) {
|
130 |
+
$previous_selected = $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY];
|
131 |
+
if ( !is_array( $previous_selected ) ) {
|
132 |
+
$previous_selected = array();
|
133 |
+
}
|
134 |
+
}
|
135 |
+
$selected = in_array( self::NOT_RESTRICTED, $previous_selected ) ? ' selected="selected" ' : '';
|
136 |
+
$output .= sprintf( '<option value="%s" %s >%s</option>', self::NOT_RESTRICTED, esc_attr( $selected ), esc_attr( __( '(only unrestricted)', 'groups' ) ) );
|
137 |
+
|
138 |
+
foreach( $applicable_read_caps as $capability ) {
|
139 |
+
$selected = in_array( $capability, $previous_selected ) ? ' selected="selected" ' : '';
|
140 |
+
$output .= sprintf( '<option value="%s" %s >%s</option>', esc_attr( $capability ), esc_attr( $selected ), wp_filter_nohtml_kses( $capability ) );
|
141 |
+
}
|
142 |
+
$output .= '</select>';
|
143 |
+
$output .= '</div>';
|
144 |
+
$output .= Groups_UIE::render_select( '.select.capability' );
|
145 |
+
|
146 |
+
echo $output;
|
147 |
+
}
|
148 |
+
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Bulk-edit access restriction capabilities.
|
156 |
+
*
|
157 |
+
* @param string $column_name
|
158 |
+
* @param string $post_type
|
159 |
+
*/
|
160 |
+
public static function bulk_edit_custom_box( $column_name, $post_type ) {
|
161 |
+
|
162 |
+
global $pagenow, $wpdb;
|
163 |
+
|
164 |
+
if ( $column_name == 'capabilities' ) {
|
165 |
+
|
166 |
+
if ( $pagenow == 'edit.php' ) { // check that we're on the right screen
|
167 |
+
|
168 |
+
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
169 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
170 |
+
|
171 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
172 |
+
|
173 |
+
$output = '<fieldset class="inline-edit-col-right">';
|
174 |
+
$output .= '<div class="bulk-edit-groups">';
|
175 |
+
|
176 |
+
// capability/access restriction bulk actions added through extra_tablenav()
|
177 |
+
$output .= '<div id="capability-bulk-actions" class="capabilities-bulk-container" style="display:inline">';
|
178 |
+
|
179 |
+
$output .= '<label style="display:inline;">';
|
180 |
+
$output .= '<span class="title">';
|
181 |
+
$output .= __( 'Access Restrictions', 'groups' );
|
182 |
+
$output .= '</span>';
|
183 |
+
$output .= '<select class="capabilities-action" name="capabilities-action">';
|
184 |
+
$output .= '<option selected="selected" value="-1">' . __( '— No Change —', 'groups' ) . '</option>';
|
185 |
+
$output .= '<option value="add-capability">' . __( 'Add restriction', 'groups' ) . '</option>';
|
186 |
+
$output .= '<option value="remove-capability">' . __( 'Remove restriction', 'groups' ) . '</option>';
|
187 |
+
$output .= '</select>';
|
188 |
+
$output .= '</label>';
|
189 |
+
|
190 |
+
$output .= '<div class="groups-capabilities-container">';
|
191 |
+
$valid_read_caps = Groups_Access_Meta_Boxes_Legacy::get_valid_read_caps_for_user();
|
192 |
+
$output .= sprintf(
|
193 |
+
'<select class="select bulk-capability" name="%s[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
194 |
+
esc_attr( Groups_Post_Access_Legacy::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access_Legacy::READ_POST_CAPABILITY ),
|
195 |
+
esc_attr( __( 'Choose access restrictions …', 'groups' ) ) ,
|
196 |
+
esc_attr( __( 'Choose access restrictions …', 'groups' ) )
|
197 |
+
);
|
198 |
+
|
199 |
+
foreach( $valid_read_caps as $capability ) {
|
200 |
+
$output .= sprintf( '<option value="%s" >%s</option>', esc_attr( $capability ), wp_filter_nohtml_kses( $capability ) );
|
201 |
+
}
|
202 |
+
$output .= '</select>';
|
203 |
+
$output .= '</div>'; // .groups-capabilities-container
|
204 |
+
$output .= Groups_UIE::render_select( '.select.bulk-capability' );
|
205 |
+
|
206 |
+
$output .= '</div>'; // .capabilities-bulk-container
|
207 |
+
|
208 |
+
$output .= '</div>'; // .bulk-edit-groups
|
209 |
+
$output .= '</fieldset>'; // .inline-edit-col-right
|
210 |
+
|
211 |
+
$output .= wp_nonce_field( 'post-capability', 'bulk-post-capability-nonce', true, false );
|
212 |
+
|
213 |
+
echo $output;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Handles access restriction capability modifications from bulk-editing.
|
221 |
+
* This is called once for each post that is included in bulk-editing.
|
222 |
+
* The fields that are handled here are rendered through the
|
223 |
+
* bulk_edit_custom_box() method in this class.
|
224 |
+
*
|
225 |
+
* @param int $post_id
|
226 |
+
*/
|
227 |
+
public static function save_post( $post_id ) {
|
228 |
+
if ( isset( $_REQUEST['capabilities-action'] ) ) {
|
229 |
+
if ( wp_verify_nonce( $_REQUEST['bulk-post-capability-nonce'], 'post-capability' ) ) {
|
230 |
+
$field = Groups_Post_Access_Legacy::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access_Legacy::READ_POST_CAPABILITY;
|
231 |
+
if ( !empty( $_REQUEST[$field] ) && is_array( $_REQUEST[$field] ) ) {
|
232 |
+
if ( Groups_Access_Meta_Boxes_Legacy::user_can_restrict() ) {
|
233 |
+
$valid_read_caps = Groups_Access_Meta_Boxes_Legacy::get_valid_read_caps_for_user();
|
234 |
+
foreach( $_REQUEST[$field] as $capability_name ) {
|
235 |
+
if ( $capability = Groups_Capability::read_by_capability( $capability_name ) ) {
|
236 |
+
if ( in_array( $capability->capability, $valid_read_caps ) ) {
|
237 |
+
switch( $_REQUEST['capabilities-action'] ) {
|
238 |
+
case 'add-capability' :
|
239 |
+
Groups_Post_Access_Legacy::create( array(
|
240 |
+
'post_id' => $post_id,
|
241 |
+
'capability' => $capability->capability
|
242 |
+
) );
|
243 |
+
break;
|
244 |
+
case 'remove-capability' :
|
245 |
+
Groups_Post_Access_Legacy::delete( $post_id, $capability->capability );
|
246 |
+
break;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
}
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Query modifier to take the selected access restriction capability into
|
259 |
+
* account.
|
260 |
+
*
|
261 |
+
* @param WP_Query $query query object passed by reference
|
262 |
+
*/
|
263 |
+
public static function parse_query( &$query ) {
|
264 |
+
|
265 |
+
global $pagenow;
|
266 |
+
|
267 |
+
if ( is_admin() ) {
|
268 |
+
|
269 |
+
if ( $pagenow == 'edit.php' ) { // check that we're on the right screen
|
270 |
+
|
271 |
+
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
272 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access_Legacy::POST_TYPES, array() );
|
273 |
+
|
274 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
275 |
+
|
276 |
+
if ( !empty( $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY] ) &&
|
277 |
+
is_array( $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY] )
|
278 |
+
) {
|
279 |
+
|
280 |
+
$include_unrestricted = false;
|
281 |
+
if ( in_array( self::NOT_RESTRICTED, $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY] ) ) {
|
282 |
+
$include_unrestricted = true;
|
283 |
+
}
|
284 |
+
|
285 |
+
$capabilities = array();
|
286 |
+
foreach ( $_GET[Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY] as $capability ) {
|
287 |
+
if ( Groups_Capability::read_by_capability( $capability ) ) {
|
288 |
+
$capabilities[] = $capability;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
if ( !empty( $capabilities ) ) {
|
293 |
+
if ( $include_unrestricted ) {
|
294 |
+
// meta_query does not handle a conjunction
|
295 |
+
// on the same meta field correctly
|
296 |
+
// (at least not up to WordPress 3.7.1)
|
297 |
+
// $query->query_vars['meta_query'] = array (
|
298 |
+
// 'relation' => 'OR',
|
299 |
+
// array (
|
300 |
+
// 'key' => Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY,
|
301 |
+
// 'value' => $capabilities,
|
302 |
+
// 'compare' => 'IN'
|
303 |
+
// ),
|
304 |
+
// array (
|
305 |
+
// 'key' => Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY,
|
306 |
+
// 'compare' => 'NOT EXISTS'
|
307 |
+
// )
|
308 |
+
// );
|
309 |
+
// we'll limit it to show just unrestricted entries
|
310 |
+
// until the above is solved
|
311 |
+
$query->query_vars['meta_query'] = array (
|
312 |
+
array (
|
313 |
+
'key' => Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY,
|
314 |
+
'compare' => 'NOT EXISTS'
|
315 |
+
)
|
316 |
+
);
|
317 |
+
} else {
|
318 |
+
$query->query_vars['meta_query'] = array (
|
319 |
+
array (
|
320 |
+
'key' => Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY,
|
321 |
+
'value' => $capabilities,
|
322 |
+
'compare' => 'IN'
|
323 |
+
)
|
324 |
+
);
|
325 |
+
}
|
326 |
+
} else if ( $include_unrestricted ) {
|
327 |
+
$query->query_vars['meta_query'] = array (
|
328 |
+
array (
|
329 |
+
'key' => Groups_Post_Access_Legacy::POSTMETA_PREFIX . Groups_Post_Access_Legacy::READ_POST_CAPABILITY,
|
330 |
+
'compare' => 'NOT EXISTS'
|
331 |
+
)
|
332 |
+
);
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
}
|
339 |
+
|
340 |
+
}
|
341 |
+
|
342 |
+
}
|
343 |
+
Groups_Admin_Posts_Legacy::init();
|
legacy/admin/groups-admin-options-legacy.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* groups-admin-options-legacy.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 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Legacy options admin screen extension.
|
28 |
+
*/
|
29 |
+
function groups_admin_options_legacy() {
|
30 |
+
|
31 |
+
global $wpdb;
|
32 |
+
|
33 |
+
require_once GROUPS_LEGACY_LIB . '/access/class-groups-post-access-legacy.php';
|
34 |
+
|
35 |
+
//
|
36 |
+
// handle legacy options after form submission
|
37 |
+
//
|
38 |
+
if ( isset( $_POST['submit'] ) ) {
|
39 |
+
if ( wp_verify_nonce( $_POST[GROUPS_ADMIN_OPTIONS_NONCE], 'admin' ) ) {
|
40 |
+
$valid_read_caps = array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY );
|
41 |
+
if ( !empty( $_POST[GROUPS_READ_POST_CAPABILITIES] ) ) {
|
42 |
+
$read_caps = $_POST[GROUPS_READ_POST_CAPABILITIES];
|
43 |
+
foreach( $read_caps as $read_cap ) {
|
44 |
+
if ( $valid_cap = Groups_Capability::read( $read_cap ) ) {
|
45 |
+
if ( !in_array( $valid_cap->capability, $valid_read_caps ) ) {
|
46 |
+
$valid_read_caps[] = $valid_cap->capability;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
}
|
51 |
+
Groups_Options::update_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, $valid_read_caps );
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
//
|
56 |
+
// render legacy settings
|
57 |
+
//
|
58 |
+
echo '<h3>' . __( 'Capabilities', 'groups' ) . '</h3>';
|
59 |
+
|
60 |
+
echo '<p class="description">' .
|
61 |
+
__( 'Include these capabilities to enforce read access on posts. The selected capabilities will be offered to restrict access to posts.', 'groups' ) .
|
62 |
+
'</p>';
|
63 |
+
|
64 |
+
$capability_table = _groups_get_tablename( 'capability' );
|
65 |
+
$capabilities = $wpdb->get_results( "SELECT * FROM $capability_table ORDER BY capability" );
|
66 |
+
$applicable_read_caps = Groups_Options::get_option( Groups_Post_Access_Legacy::READ_POST_CAPABILITIES, array( Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) );
|
67 |
+
echo '<div class="select-capability-container" style="width:62%;">';
|
68 |
+
printf( '<select class="select capability" name="%s" multiple="multiple">', GROUPS_READ_POST_CAPABILITIES . '[]' );
|
69 |
+
foreach( $capabilities as $capability ) {
|
70 |
+
$selected = in_array( $capability->capability, $applicable_read_caps ) ? ' selected="selected" ' : '';
|
71 |
+
if ( $capability->capability == Groups_Post_Access_Legacy::READ_POST_CAPABILITY ) {
|
72 |
+
$selected .= ' disabled="disabled" ';
|
73 |
+
}
|
74 |
+
printf( '<option value="%s" %s>%s</option>', esc_attr( $capability->capability_id ), $selected, wp_filter_nohtml_kses( $capability->capability ) );
|
75 |
+
}
|
76 |
+
echo '</select>';
|
77 |
+
echo '</div>'; // .select-capability-container
|
78 |
+
|
79 |
+
echo Groups_UIE::render_select( '.select.capability' );
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
add_action( 'groups_admin_options_legacy', 'groups_admin_options_legacy' );
|
lib/access/class-groups-access-meta-boxes.php
CHANGED
@@ -30,11 +30,16 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
30 |
*/
|
31 |
class Groups_Access_Meta_Boxes {
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
const NONCE = 'groups-meta-box-nonce';
|
34 |
-
const
|
35 |
-
const
|
36 |
-
const
|
37 |
-
const SHOW_GROUPS = 'access-meta-box-show-groups';
|
38 |
|
39 |
/**
|
40 |
* Sets up an init hook where actions and filters are added.
|
@@ -51,8 +56,8 @@ class Groups_Access_Meta_Boxes {
|
|
51 |
if ( current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
52 |
require_once GROUPS_VIEWS_LIB . '/class-groups-uie.php';
|
53 |
|
54 |
-
add_action( 'add_meta_boxes', array( __CLASS__,
|
55 |
-
add_action( 'save_post', array( __CLASS__,
|
56 |
add_filter( 'wp_insert_post_empty_content', array( __CLASS__, 'wp_insert_post_empty_content' ), 10, 2 );
|
57 |
|
58 |
add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'attachment_fields_to_edit' ), 10, 2 );
|
@@ -87,80 +92,52 @@ class Groups_Access_Meta_Boxes {
|
|
87 |
if ( $post_type_object && $post_type != 'attachment' ) {
|
88 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
89 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
90 |
-
|
91 |
-
$post_types = get_post_types();
|
92 |
-
foreach ( $post_types as $post_type ) {
|
93 |
-
add_meta_box(
|
94 |
-
"groups-access",
|
95 |
-
__( "Access restrictions", GROUPS_PLUGIN_DOMAIN ),
|
96 |
-
array( __CLASS__, "capability" ),
|
97 |
-
$post_type,
|
98 |
-
"side",
|
99 |
-
"high"
|
100 |
-
);
|
101 |
-
}
|
102 |
-
} else {
|
103 |
add_meta_box(
|
104 |
-
|
105 |
-
|
106 |
-
array( __CLASS__,
|
107 |
null,
|
108 |
-
|
109 |
-
|
110 |
);
|
111 |
-
}
|
112 |
|
113 |
Groups_UIE::enqueue( 'select' );
|
114 |
|
115 |
-
if (
|
116 |
if ( $screen = get_current_screen() ) {
|
|
|
117 |
$screen->add_help_tab( array(
|
118 |
'id' => 'groups-access',
|
119 |
-
'title' => __( '
|
120 |
'content' =>
|
121 |
'<p>' .
|
122 |
-
'<strong>' . __( '
|
123 |
'</p>' .
|
124 |
'<p>' .
|
125 |
-
__( 'Use the <em>
|
126 |
'</p>' .
|
127 |
'<p>' .
|
128 |
-
__( 'You can select one or more
|
129 |
' ' .
|
130 |
-
__( 'Note that you must be a member of a group
|
131 |
'</p>' .
|
132 |
'<p>' .
|
133 |
-
'<strong>' . __( 'Example:',
|
134 |
'</p>' .
|
135 |
-
__( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.',
|
136 |
'<p>' .
|
137 |
-
'<strong>' . __( 'The quick way:', GROUPS_PLUGIN_DOMAIN ) . '</strong>' .
|
138 |
' ' .
|
139 |
-
__( 'Using the quick-create field', GROUPS_PLUGIN_DOMAIN ) .
|
140 |
'</p>' .
|
141 |
-
__( '
|
142 |
'<p>' .
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
'<p>' .
|
151 |
-
__( 'Try the quick-create field first. Unless you need a more complex setup, there is no reason to go this way instead.', GROUPS_PLUGIN_DOMAIN ) .
|
152 |
-
'</p>' .
|
153 |
-
'<ol>' .
|
154 |
-
'<li>' . __( 'Go to <strong>Groups > Groups</strong> and add the <em>Premium</em> group.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
155 |
-
'<li>' . __( 'Go to <strong>Groups > Capabilities</strong> and add the <em>premium</em> capability.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
156 |
-
'<li>' . __( 'Go to <strong>Groups > Groups</strong> and assign the <em>premium</em> capability to the <em>Premium</em> group.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
157 |
-
'<li>' . __( 'Go to <strong>Groups > Options</strong> and enable the <em>premium</em> capability to restrict access.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
158 |
-
'<li>' . __( 'Become a member of the <em>Premium</em> group - this is required so you can choose the <em>premium</em> capability to restrict access to a post.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
159 |
-
'<li>' . __( 'Edit the post for which you want to restrict access and choose<sup>*</sup> the <em>premium</em> capability.', GROUPS_PLUGIN_DOMAIN ) . '</li>' .
|
160 |
-
'</ol>' .
|
161 |
-
'<p>' .
|
162 |
-
__( '<sup>*</sup> For each capability, the groups that have the capability assigned are shown within parenthesis. You can choose a capability by typing part of the group\'s or the capability\'s name.', GROUPS_PLUGIN_DOMAIN ) .
|
163 |
-
'</p>'
|
164 |
) );
|
165 |
}
|
166 |
}
|
@@ -169,169 +146,108 @@ class Groups_Access_Meta_Boxes {
|
|
169 |
}
|
170 |
|
171 |
/**
|
172 |
-
* Render meta box for
|
173 |
-
*
|
174 |
* @see do_meta_boxes()
|
175 |
-
*
|
176 |
* @param Object $object
|
177 |
* @param Object $box
|
178 |
*/
|
179 |
-
public static function
|
180 |
|
181 |
-
$output =
|
182 |
|
183 |
-
$
|
184 |
-
|
185 |
-
$post_id = isset( $object->ID ) ? $object->ID : null;
|
186 |
$post_type = isset( $object->post_type ) ? $object->post_type : null;
|
187 |
-
$post_singular_name = __(
|
188 |
if ( $post_type !== null ) {
|
189 |
$post_type_object = get_post_type_object( $post_type );
|
190 |
$labels = isset( $post_type_object->labels ) ? $post_type_object->labels : null;
|
191 |
if ( $labels !== null ) {
|
192 |
-
if ( isset( $labels->singular_name ) )
|
193 |
$post_singular_name = __( $labels->singular_name );
|
194 |
}
|
195 |
}
|
196 |
}
|
197 |
|
198 |
-
$output .= wp_nonce_field( self::
|
|
|
|
|
|
|
|
|
199 |
|
200 |
if ( self::user_can_restrict() ) {
|
201 |
-
$user = new Groups_User( get_current_user_id() );
|
202 |
-
$output .= __( "Enforce read access", GROUPS_PLUGIN_DOMAIN );
|
203 |
|
204 |
-
$
|
205 |
-
$
|
206 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
$output .= sprintf(
|
208 |
-
'<
|
209 |
-
|
210 |
-
__( 'Type and choose …', GROUPS_PLUGIN_DOMAIN),
|
211 |
-
__( 'Type and choose …', GROUPS_PLUGIN_DOMAIN),
|
212 |
-
__( 'Choose one or more capabilities to restrict access. Groups that grant access through the capabilities are shown in parenthesis. If no capabilities are available yet, you can use the quick-create box to create a group and capability enabled for access restriction on the fly.', GROUPS_PLUGIN_DOMAIN )
|
213 |
);
|
214 |
-
$output .= '
|
215 |
-
|
216 |
-
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
217 |
-
if ( $user->can( $capability->capability ) ) {
|
218 |
-
$c = new Groups_Capability( $capability->capability_id );
|
219 |
-
$groups = $c->groups;
|
220 |
-
$group_names = array();
|
221 |
-
if ( !empty( $groups ) ) {
|
222 |
-
foreach( $groups as $group ) {
|
223 |
-
$group_names[] = $group->name;
|
224 |
-
}
|
225 |
-
}
|
226 |
-
if ( count( $group_names ) > 0 ) {
|
227 |
-
$label_title = sprintf(
|
228 |
-
_n(
|
229 |
-
'Members of the %1$s group can access this %2$s through this capability.',
|
230 |
-
'Members of the %1$s groups can access this %2$s through this capability.',
|
231 |
-
count( $group_names ),
|
232 |
-
GROUPS_PLUGIN_DOMAIN
|
233 |
-
),
|
234 |
-
wp_filter_nohtml_kses( implode( ',', $group_names ) ),
|
235 |
-
$post_singular_name
|
236 |
-
);
|
237 |
-
} else {
|
238 |
-
$label_title = __( 'No groups grant access through this capability. To grant access to group members using this capability, you should assign it to a group and enable the capability for access restriction.', GROUPS_PLUGIN_DOMAIN );
|
239 |
-
}
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
if ( count( $group_names ) > 0 ) {
|
254 |
-
$output .= ' ';
|
255 |
-
$output .= '(' . wp_filter_nohtml_kses( implode( ', ', $group_names ) ) . ')';
|
256 |
-
}
|
257 |
-
}
|
258 |
-
$output .= '</option>';
|
259 |
-
}
|
260 |
-
}
|
261 |
}
|
262 |
$output .= '</select>';
|
263 |
-
|
264 |
-
$output .= Groups_UIE::render_select(
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
// $output .= 'jQuery(".select.capability").selectize({plugins: ["remove_button"]});';
|
271 |
-
// }
|
272 |
-
// $output .= '}';
|
273 |
-
// $output .= '</script>';
|
274 |
-
// $output .= '<style type="text/css">';
|
275 |
-
// $output .= '.select-capability-container input[type="text"] { min-height: 2em; }';
|
276 |
-
// $output .= '</style>';
|
277 |
-
$output .= '</div>';
|
278 |
-
|
279 |
$output .= '<p class="description">';
|
280 |
-
$output .= sprintf(
|
|
|
|
|
|
|
281 |
$output .= '</p>';
|
282 |
|
283 |
-
$output .= '<p class="description">';
|
284 |
-
$output .= sprintf( '<label title="%s">', __( 'Click to toggle the display of groups that grant the capabilities.', GROUPS_PLUGIN_DOMAIN ) );
|
285 |
-
$output .= sprintf( '<input id="access-show-groups" type="checkbox" name="%s" %s />', esc_attr( self::SHOW_GROUPS ), $show_groups ? ' checked="checked" ' : '' );
|
286 |
-
$output .= ' ';
|
287 |
-
$output .= __( 'Show groups', GROUPS_PLUGIN_DOMAIN );
|
288 |
-
$output .= '</label>';
|
289 |
-
$output .= '</p>';
|
290 |
-
$output .= '<script type="text/javascript">';
|
291 |
-
$output .= 'if (typeof jQuery !== "undefined"){';
|
292 |
-
$output .= !$show_groups ? 'jQuery("span.groups.description").hide();' : '';
|
293 |
-
$output .= 'jQuery("#access-show-groups").click(function(){';
|
294 |
-
$output .= 'jQuery("span.groups.description").toggle();';
|
295 |
-
$output .= '});';
|
296 |
-
$output .= '}';
|
297 |
-
$output .= '</script>';
|
298 |
} else {
|
299 |
$output .= '<p class="description">';
|
300 |
-
$output .= sprintf( __( 'You cannot set any access restrictions.',
|
301 |
$style = 'cursor:help;vertical-align:middle;';
|
302 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
303 |
$style = 'cursor:pointer;vertical-align:middle;';
|
304 |
$output .= sprintf( '<a href="%s">', esc_url( admin_url( 'admin.php?page=groups-admin-options' ) ) );
|
305 |
}
|
306 |
-
$output .= sprintf( '<img style="%s" alt="?" title="%s" src="%s" />', $style, esc_attr( __( 'You
|
307 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
308 |
$output .= '</a>';
|
309 |
}
|
310 |
$output .= '</p>';
|
311 |
}
|
312 |
|
313 |
-
//
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
$output .= sprintf( '<input style="width:100%%;margin-right:-20px;" id="quick-group-capability" name="quick-group-capability" class="quick-group-capability" type="text" value="" placeholder="%s"/>', __( 'Quick-create group & capability', GROUPS_PLUGIN_DOMAIN ) );
|
319 |
-
$output .= sprintf(
|
320 |
-
'<img id="quick-create-help-icon" style="%s" alt="?" title="%s" src="%s" />',
|
321 |
-
$style,
|
322 |
-
esc_attr( __( 'You can create a new group and capability here. The capability will be assigned to the group and enabled to enforce read access. Group names are case-sensitive, the name of the capability is the lower-case version of the name of the group. If the group already exists, a new capability is created and assigned to the existing group. If the capability already exists, it will be assigned to the group. If both already exist, the capability is enabled to enforce read access. In order to be able to use the capability, your user account will be assigned to the group.', GROUPS_PLUGIN_DOMAIN ) ),
|
323 |
-
esc_attr( GROUPS_PLUGIN_URL . 'images/help.png' )
|
324 |
-
);
|
325 |
-
$output .= '</label>';
|
326 |
-
$output .= '</div>';
|
327 |
-
$output .= '<script type="text/javascript">';
|
328 |
-
$output .= 'if (typeof jQuery !== "undefined"){';
|
329 |
-
$output .= 'jQuery("#quick-create-help-icon").click(function(){';
|
330 |
-
$output .= 'jQuery("#contextual-help-link").click();';
|
331 |
-
$output .= '});';
|
332 |
-
$output .= '}';
|
333 |
-
$output .= '</script>';
|
334 |
-
}
|
335 |
|
336 |
echo $output;
|
337 |
}
|
@@ -364,119 +280,92 @@ class Groups_Access_Meta_Boxes {
|
|
364 |
}
|
365 |
|
366 |
/**
|
367 |
-
* Save
|
368 |
*
|
369 |
* @param int $post_id
|
370 |
* @param mixed $post post data (not used here)
|
371 |
*/
|
372 |
public static function save_post( $post_id = null, $post = null ) {
|
373 |
-
if
|
|
|
|
|
|
|
|
|
374 |
} else {
|
375 |
$post_type = get_post_type( $post_id );
|
376 |
$post_type_object = get_post_type_object( $post_type );
|
377 |
if ( $post_type_object && $post_type != 'attachment' ) {
|
378 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
379 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
380 |
-
|
381 |
-
|
382 |
-
if ( $
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
|
|
399 |
}
|
400 |
-
}
|
401 |
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
$
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$name = strtolower( $name );
|
419 |
-
if ( $capability = Groups_Capability::read_by_capability( $name ) ) {
|
420 |
-
} else {
|
421 |
-
if ( $capability_id = Groups_Capability::create( array( 'capability' => $name ) ) ) {
|
422 |
-
$capability = Groups_Capability::read( $capability_id );
|
423 |
-
}
|
424 |
}
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
)
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
$valid_read_caps[] = $capability->capability;
|
439 |
-
}
|
440 |
-
Groups_Options::update_option( Groups_Post_Access::READ_POST_CAPABILITIES, $valid_read_caps );
|
441 |
-
// add the current user to the group
|
442 |
-
Groups_User_Group::create(
|
443 |
-
array(
|
444 |
-
'user_id' => get_current_user_id(),
|
445 |
-
'group_id' => $group->group_id
|
446 |
-
)
|
447 |
-
);
|
448 |
-
// put the capability ID in $_POST[self::CAPABILITY] so it is treated below
|
449 |
-
if ( empty( $_POST[self::CAPABILITY] ) ) {
|
450 |
-
$_POST[self::CAPABILITY] = array();
|
451 |
-
}
|
452 |
-
if ( !in_array( $capability->capability_id, $_POST[self::CAPABILITY] ) ) {
|
453 |
-
$_POST[self::CAPABILITY][] = $capability->capability_id;
|
454 |
}
|
455 |
}
|
456 |
}
|
457 |
}
|
|
|
|
|
|
|
|
|
458 |
}
|
459 |
-
|
460 |
-
if ( self::user_can_restrict() ) {
|
461 |
-
$valid_read_caps = self::get_valid_read_caps_for_user();
|
462 |
-
foreach( $valid_read_caps as $valid_read_cap ) {
|
463 |
-
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
464 |
-
if ( !empty( $_POST[self::CAPABILITY] ) && is_array( $_POST[self::CAPABILITY] ) && in_array( $capability->capability_id, $_POST[self::CAPABILITY] ) ) {
|
465 |
-
Groups_Post_Access::create( array(
|
466 |
-
'post_id' => $post_id,
|
467 |
-
'capability' => $capability->capability
|
468 |
-
) );
|
469 |
-
} else {
|
470 |
-
Groups_Post_Access::delete( $post_id, $capability->capability );
|
471 |
-
}
|
472 |
-
}
|
473 |
-
}
|
474 |
-
}
|
475 |
-
// show groups
|
476 |
-
Groups_Options::update_user_option( self::SHOW_GROUPS, !empty( $_POST[self::SHOW_GROUPS] ) );
|
477 |
}
|
478 |
}
|
479 |
}
|
|
|
480 |
}
|
481 |
}
|
482 |
}
|
@@ -487,25 +376,17 @@ class Groups_Access_Meta_Boxes {
|
|
487 |
*/
|
488 |
private static function enqueue() {
|
489 |
global $groups_version;
|
490 |
-
if (
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
wp_enqueue_style( 'chosen', GROUPS_PLUGIN_URL . 'css/chosen/chosen.min.css', array(), $groups_version );
|
496 |
-
}
|
497 |
-
} else {
|
498 |
-
if ( !wp_script_is( 'selectize' ) ) {
|
499 |
-
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
|
500 |
-
}
|
501 |
-
if ( !wp_style_is( 'selectize' ) ) {
|
502 |
-
wp_enqueue_style( 'selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version );
|
503 |
-
}
|
504 |
}
|
505 |
}
|
506 |
|
507 |
/**
|
508 |
-
* Render
|
|
|
509 |
* @param array $form_fields
|
510 |
* @param object $post
|
511 |
* @return array
|
@@ -515,15 +396,20 @@ class Groups_Access_Meta_Boxes {
|
|
515 |
Groups_UIE::enqueue( 'select' );
|
516 |
|
517 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
|
|
518 |
if ( !isset( $post_types_option['attachment']['add_meta_box'] ) || $post_types_option['attachment']['add_meta_box'] ) {
|
|
|
519 |
if ( self::user_can_restrict() ) {
|
|
|
520 |
$user = new Groups_User( get_current_user_id() );
|
521 |
-
$
|
522 |
-
$
|
|
|
|
|
|
|
|
|
523 |
|
524 |
-
$output .= __(
|
525 |
-
$read_caps = get_post_meta( $post->ID, Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ_POST_CAPABILITY );
|
526 |
-
$valid_read_caps = self::get_valid_read_caps_for_user();
|
527 |
|
528 |
// On attachments edited within the 'Insert Media' popup, the update is triggered too soon and we end up with only the last capability selected.
|
529 |
// This occurs when using normal checkboxes as well as the select below (Chosen and Selectize tested).
|
@@ -535,80 +421,53 @@ class Groups_Access_Meta_Boxes {
|
|
535 |
|
536 |
// $output .= '<div style="padding:0 1em;margin:1em 0;border:1px solid #ccc;border-radius:4px;">';
|
537 |
// $output .= '<ul>';
|
538 |
-
// foreach( $
|
539 |
-
//
|
540 |
-
// $checked = in_array( $capability->capability, $read_caps ) ? ' checked="checked" ' : '';
|
541 |
// $output .= '<li>';
|
542 |
// $output .= '<label>';
|
543 |
-
// $output .= '<input name="attachments[' . $post->ID . '][' . self::
|
544 |
-
// $output .= wp_filter_nohtml_kses( $
|
545 |
// $output .= '</label>';
|
546 |
// $output .= '</li>';
|
547 |
-
// }
|
548 |
// }
|
549 |
// $output .= '</ul>';
|
550 |
// $output .= '</div>';
|
551 |
|
552 |
-
$
|
553 |
-
$
|
554 |
-
$select_id = 'attachments-' . $post->ID . '-' . self::CAPABILITY;
|
555 |
$output .= sprintf(
|
556 |
-
'<select id="%s" class="select
|
557 |
$select_id,
|
558 |
-
'attachments[' . $post->ID . '][' . self::
|
559 |
-
__( '
|
560 |
-
__( '
|
|
|
|
|
561 |
);
|
562 |
$output .= '<option value=""></option>';
|
563 |
-
foreach( $
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
$groups = $c->groups;
|
568 |
-
$group_names = array();
|
569 |
-
if ( !empty( $groups ) ) {
|
570 |
-
foreach( $groups as $group ) {
|
571 |
-
$group_names[] = $group->name;
|
572 |
-
}
|
573 |
-
}
|
574 |
-
if ( count( $group_names ) > 0 ) {
|
575 |
-
$label_title = sprintf(
|
576 |
-
_n(
|
577 |
-
'Members of the %1$s group can access this %2$s through this capability.',
|
578 |
-
'Members of the %1$s groups can access this %2$s through this capability.',
|
579 |
-
count( $group_names ),
|
580 |
-
GROUPS_PLUGIN_DOMAIN
|
581 |
-
),
|
582 |
-
wp_filter_nohtml_kses( implode( ',', $group_names ) ),
|
583 |
-
$post_singular_name
|
584 |
-
);
|
585 |
-
} else {
|
586 |
-
$label_title = __( 'No groups grant access through this capability. To grant access to group members using this capability, you should assign it to a group and enable the capability for access restriction.', GROUPS_PLUGIN_DOMAIN );
|
587 |
-
}
|
588 |
-
$output .= sprintf( '<option value="%s" %s>', esc_attr( $capability->capability_id ), in_array( $capability->capability, $read_caps ) ? ' selected="selected" ' : '' );
|
589 |
-
$output .= wp_filter_nohtml_kses( $capability->capability );
|
590 |
-
if ( $show_groups ) {
|
591 |
-
if ( count( $group_names ) > 0 ) {
|
592 |
-
$output .= ' ';
|
593 |
-
$output .= '(' . wp_filter_nohtml_kses( implode( ', ', $group_names ) ) . ')';
|
594 |
-
}
|
595 |
-
}
|
596 |
-
$output .= '</option>';
|
597 |
-
}
|
598 |
-
}
|
599 |
}
|
600 |
$output .= '</select>';
|
601 |
|
602 |
-
$output .= Groups_UIE::render_select( '#'.$select_id );
|
603 |
|
604 |
$output .= '</div>';
|
605 |
|
606 |
$output .= '<p class="description">';
|
607 |
-
$output .=
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
$output .= '</p>';
|
609 |
|
610 |
-
$form_fields['
|
611 |
-
'label' => __( '
|
612 |
'input' => 'html',
|
613 |
'html' => $output
|
614 |
);
|
@@ -618,8 +477,9 @@ class Groups_Access_Meta_Boxes {
|
|
618 |
}
|
619 |
|
620 |
/**
|
621 |
-
* Save
|
622 |
* When multiple attachments are saved, this is called once for each.
|
|
|
623 |
* @param array $post post data
|
624 |
* @param array $attachment attachment field data
|
625 |
* @return array
|
@@ -637,19 +497,20 @@ class Groups_Access_Meta_Boxes {
|
|
637 |
$post_id = $post['post_ID'];
|
638 |
}
|
639 |
if ( $post_id !== null ) {
|
640 |
-
$
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
} else {
|
649 |
-
Groups_Post_Access::delete( $post_id, $capability->capability );
|
650 |
}
|
651 |
}
|
652 |
}
|
|
|
|
|
|
|
653 |
}
|
654 |
}
|
655 |
}
|
@@ -657,40 +518,22 @@ class Groups_Access_Meta_Boxes {
|
|
657 |
}
|
658 |
|
659 |
/**
|
660 |
-
* Returns true if the current user
|
661 |
-
*
|
662 |
* @return boolean
|
663 |
*/
|
664 |
public static function user_can_restrict() {
|
665 |
-
$has_read_cap = false;
|
666 |
$user = new Groups_User( get_current_user_id() );
|
667 |
-
$
|
668 |
-
foreach( $valid_read_caps as $valid_read_cap ) {
|
669 |
-
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
670 |
-
if ( $user->can( $capability->capability_id ) ) {
|
671 |
-
$has_read_cap = true;
|
672 |
-
break;
|
673 |
-
}
|
674 |
-
}
|
675 |
-
}
|
676 |
-
return $has_read_cap;
|
677 |
}
|
678 |
|
679 |
/**
|
|
|
680 |
* @return array of valid read capabilities for the current or given user
|
681 |
*/
|
682 |
public static function get_valid_read_caps_for_user( $user_id = null ) {
|
683 |
-
|
684 |
-
|
685 |
-
$valid_read_caps = Groups_Options::get_option( Groups_Post_Access::READ_POST_CAPABILITIES, array( Groups_Post_Access::READ_POST_CAPABILITY ) );
|
686 |
-
foreach( $valid_read_caps as $valid_read_cap ) {
|
687 |
-
if ( $capability = Groups_Capability::read_by_capability( $valid_read_cap ) ) {
|
688 |
-
if ( $user->can( $capability->capability ) ) {
|
689 |
-
$result[] = $valid_read_cap;
|
690 |
-
}
|
691 |
-
}
|
692 |
-
}
|
693 |
-
return $result;
|
694 |
}
|
695 |
}
|
696 |
Groups_Access_Meta_Boxes::init();
|
30 |
*/
|
31 |
class Groups_Access_Meta_Boxes {
|
32 |
|
33 |
+
const CAPABILITY_NONCE = 'groups-meta-box-capability-nonce';
|
34 |
+
const SET_CAPABILITY = 'set-capability';
|
35 |
+
const READ_ACCESS = 'read-access';
|
36 |
+
const CAPABILITY = 'capability';
|
37 |
+
const SHOW_GROUPS = 'access-meta-box-show-groups';
|
38 |
+
|
39 |
const NONCE = 'groups-meta-box-nonce';
|
40 |
+
const SET_GROUPS = 'set-groups';
|
41 |
+
const GROUPS_READ = 'groups-read';
|
42 |
+
const READ = 'read';
|
|
|
43 |
|
44 |
/**
|
45 |
* Sets up an init hook where actions and filters are added.
|
56 |
if ( current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
57 |
require_once GROUPS_VIEWS_LIB . '/class-groups-uie.php';
|
58 |
|
59 |
+
add_action( 'add_meta_boxes', array( __CLASS__, 'add_meta_boxes' ), 10, 2 );
|
60 |
+
add_action( 'save_post', array( __CLASS__, 'save_post' ), 10, 2 );
|
61 |
add_filter( 'wp_insert_post_empty_content', array( __CLASS__, 'wp_insert_post_empty_content' ), 10, 2 );
|
62 |
|
63 |
add_filter( 'attachment_fields_to_edit', array( __CLASS__, 'attachment_fields_to_edit' ), 10, 2 );
|
92 |
if ( $post_type_object && $post_type != 'attachment' ) {
|
93 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
94 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
95 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
add_meta_box(
|
97 |
+
'groups-permissions',
|
98 |
+
_x( 'Groups', 'Meta box title', 'groups' ),
|
99 |
+
array( __CLASS__, 'groups' ),
|
100 |
null,
|
101 |
+
'side',
|
102 |
+
'high'
|
103 |
);
|
|
|
104 |
|
105 |
Groups_UIE::enqueue( 'select' );
|
106 |
|
107 |
+
if ( self::user_can_restrict() ) {
|
108 |
if ( $screen = get_current_screen() ) {
|
109 |
+
// help tab for group-based access restrictions
|
110 |
$screen->add_help_tab( array(
|
111 |
'id' => 'groups-access',
|
112 |
+
'title' => __( 'Groups', 'groups' ),
|
113 |
'content' =>
|
114 |
'<p>' .
|
115 |
+
'<strong>' . __( 'Groups', 'groups' ) . '</strong>' .
|
116 |
'</p>' .
|
117 |
'<p>' .
|
118 |
+
__( 'Use the <em>Groups</em> box to limit the visibility of posts, pages and other post types.', 'groups' ) .
|
119 |
'</p>' .
|
120 |
'<p>' .
|
121 |
+
__( 'You can select one or more groups to restrict access to its members.', 'groups' ) .
|
122 |
' ' .
|
123 |
+
__( 'Note that you must be a member of a group to use it to restrict access.', 'groups' ) .
|
124 |
'</p>' .
|
125 |
'<p>' .
|
126 |
+
'<strong>' . __( 'Example:', 'groups' ) . '</strong>' .
|
127 |
'</p>' .
|
128 |
+
__( 'Let\'s assume that you want to limit the visibility of a post to members of the <em>Premium</em> group.', 'groups' ) .
|
129 |
'<p>' .
|
|
|
130 |
' ' .
|
|
|
131 |
'</p>' .
|
132 |
+
__( 'Choose or enter <em>Premium</em> in the <em>Read</em> field located in the <em>Groups</em> box and save or update the post (or hit Enter).', 'groups' ) .
|
133 |
'<p>' .
|
134 |
+
( current_user_can( GROUPS_ADMINISTER_GROUPS ) ?
|
135 |
+
'<p>' .
|
136 |
+
__( 'In the same field, you can create a new group and restrict access. Group names are case-sensitive. In order to be able to use the new group, your user account will be assigned to it. You will not be able to restrict access if the group already exists but you do not belong to it.', 'groups' ) .
|
137 |
+
'</p>'
|
138 |
+
:
|
139 |
+
''
|
140 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
) );
|
142 |
}
|
143 |
}
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
+
* Render meta box for groups.
|
150 |
+
*
|
151 |
* @see do_meta_boxes()
|
152 |
+
*
|
153 |
* @param Object $object
|
154 |
* @param Object $box
|
155 |
*/
|
156 |
+
public static function groups( $object = null, $box = null ) {
|
157 |
|
158 |
+
$output = '';
|
159 |
|
160 |
+
$post_id = isset( $object->ID ) ? $object->ID : null;
|
|
|
|
|
161 |
$post_type = isset( $object->post_type ) ? $object->post_type : null;
|
162 |
+
$post_singular_name = __( 'Post', 'groups' );
|
163 |
if ( $post_type !== null ) {
|
164 |
$post_type_object = get_post_type_object( $post_type );
|
165 |
$labels = isset( $post_type_object->labels ) ? $post_type_object->labels : null;
|
166 |
if ( $labels !== null ) {
|
167 |
+
if ( isset( $labels->singular_name ) ) {
|
168 |
$post_singular_name = __( $labels->singular_name );
|
169 |
}
|
170 |
}
|
171 |
}
|
172 |
|
173 |
+
$output .= wp_nonce_field( self::SET_GROUPS, self::NONCE, true, false );
|
174 |
+
|
175 |
+
$output .= apply_filters( 'groups_access_meta_boxes_groups_before_read_groups', '', $object, $box );
|
176 |
+
|
177 |
+
$output .= '<div class="select-read-groups-container">';
|
178 |
|
179 |
if ( self::user_can_restrict() ) {
|
|
|
|
|
180 |
|
181 |
+
$user = new Groups_User( get_current_user_id() );
|
182 |
+
$include = $user->group_ids_deep;
|
183 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
184 |
+
$groups_read = get_post_meta( $post_id, Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ );
|
185 |
+
|
186 |
+
$read_help = sprintf(
|
187 |
+
__( 'You can restrict the visibility of this %1$s to group members. Choose one or more groups that are allowed to read this %2$s. If no groups are chosen, the %3$s is visible to anyone.', 'groups' ),
|
188 |
+
$post_singular_name,
|
189 |
+
$post_singular_name,
|
190 |
+
$post_singular_name
|
191 |
+
);
|
192 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
193 |
+
$read_help .= ' ' . __( 'You can create a new group by indicating the group\'s name.', 'groups' );
|
194 |
+
}
|
195 |
+
|
196 |
$output .= sprintf(
|
197 |
+
'<label title="%s">',
|
198 |
+
esc_attr( $read_help )
|
|
|
|
|
|
|
199 |
);
|
200 |
+
$output .= __( 'Read', 'groups' );
|
201 |
+
$output .= ' ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
+
$output .= sprintf(
|
204 |
+
'<select class="select groups-read" name="%s" multiple="multiple" placeholder="%s" data-placeholder="%s" title="%s">',
|
205 |
+
self::GROUPS_READ . '[]',
|
206 |
+
esc_attr( __( 'Anyone …', 'groups' ) ),
|
207 |
+
esc_attr( __( 'Anyone …', 'groups' ) ),
|
208 |
+
esc_attr( $read_help )
|
209 |
+
);
|
210 |
+
$output .= '<option value=""></option>';
|
211 |
+
foreach( $groups as $group ) {
|
212 |
+
$output .= sprintf( '<option value="%s" %s>', esc_attr( $group->group_id ), in_array( $group->group_id, $groups_read ) ? ' selected="selected" ' : '' );
|
213 |
+
$output .= wp_filter_nohtml_kses( $group->name );
|
214 |
+
$output .= '</option>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
$output .= '</select>';
|
217 |
+
$output .= '</label>';
|
218 |
+
$output .= Groups_UIE::render_select(
|
219 |
+
'.select.groups-read',
|
220 |
+
true,
|
221 |
+
true,
|
222 |
+
current_user_can( GROUPS_ADMINISTER_GROUPS )
|
223 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
$output .= '<p class="description">';
|
225 |
+
$output .= sprintf(
|
226 |
+
__( 'Restricts the visibility of this %s to members of the chosen groups.', 'groups' ),
|
227 |
+
$post_singular_name
|
228 |
+
);
|
229 |
$output .= '</p>';
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
} else {
|
232 |
$output .= '<p class="description">';
|
233 |
+
$output .= sprintf( __( 'You cannot set any access restrictions.', 'groups' ), $post_singular_name );
|
234 |
$style = 'cursor:help;vertical-align:middle;';
|
235 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
236 |
$style = 'cursor:pointer;vertical-align:middle;';
|
237 |
$output .= sprintf( '<a href="%s">', esc_url( admin_url( 'admin.php?page=groups-admin-options' ) ) );
|
238 |
}
|
239 |
+
$output .= sprintf( '<img style="%s" alt="?" title="%s" src="%s" />', $style, esc_attr( __( 'You need to have permission to set access restrictions.', 'groups' ) ), esc_attr( GROUPS_PLUGIN_URL . 'images/help.png' ) );
|
240 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
241 |
$output .= '</a>';
|
242 |
}
|
243 |
$output .= '</p>';
|
244 |
}
|
245 |
|
246 |
+
$output .= '</div>'; // .select-read-groups-container
|
247 |
+
|
248 |
+
$output .= apply_filters( 'groups_access_meta_boxes_groups_after_read_groups', '', $object, $box );
|
249 |
+
|
250 |
+
$output = apply_filters( 'groups_access_meta_boxes_groups', $output, $object, $box );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
echo $output;
|
253 |
}
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
+
* Save the group access restriction.
|
284 |
*
|
285 |
* @param int $post_id
|
286 |
* @param mixed $post post data (not used here)
|
287 |
*/
|
288 |
public static function save_post( $post_id = null, $post = null ) {
|
289 |
+
// This is called multiple times and if a new post is created and a new group is requested*,
|
290 |
+
// we can end up without the new group being assigned to the post unless we duely check
|
291 |
+
// for revision and autosave:
|
292 |
+
// (* on the second call, the new group exists and it will bail out on "if ( !( $group = Groups_Group::read_by_name( $name ) ) ) { ...")
|
293 |
+
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE || wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) ) {
|
294 |
} else {
|
295 |
$post_type = get_post_type( $post_id );
|
296 |
$post_type_object = get_post_type_object( $post_type );
|
297 |
if ( $post_type_object && $post_type != 'attachment' ) {
|
298 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
299 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
300 |
+
|
301 |
+
if ( self::user_can_restrict() ) {
|
302 |
+
if ( isset( $_POST[self::NONCE] ) && wp_verify_nonce( $_POST[self::NONCE], self::SET_GROUPS ) ) {
|
303 |
+
$post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : null;
|
304 |
+
if ( $post_type !== null ) {
|
305 |
+
|
306 |
+
// See http://codex.wordpress.org/Function_Reference/current_user_can 20130119 WP 3.5
|
307 |
+
// "... Some capability checks (like 'edit_post' or 'delete_page') require this [the post ID] be provided."
|
308 |
+
// If the post ID is not provided, it will throw:
|
309 |
+
// PHP Notice: Undefined offset: 0 in /var/www/groups-forums/wp-includes/capabilities.php on line 1067
|
310 |
+
$edit_post_type = 'edit_' . $post_type;
|
311 |
+
if ( $post_type_object = get_post_type_object( $post_type ) ) {
|
312 |
+
if ( !isset( $post_type_object->capabilities ) ) {
|
313 |
+
// get_post_type_capabilities() (WP 3.8) will throw a warning
|
314 |
+
// when trying to merge the missing property otherwise. It's either a
|
315 |
+
// bug or the function's documentation should make it clear that you
|
316 |
+
// have to provide that.
|
317 |
+
$post_type_object->capabilities = array();
|
318 |
+
}
|
319 |
+
$caps_object = get_post_type_capabilities( $post_type_object );
|
320 |
+
if ( isset( $caps_object->edit_post ) ) {
|
321 |
+
$edit_post_type = $caps_object->edit_post;
|
322 |
+
}
|
323 |
}
|
|
|
324 |
|
325 |
+
if ( current_user_can( $edit_post_type, $post_id ) ) {
|
326 |
+
$user = new Groups_User( get_current_user_id() );
|
327 |
+
$include = $user->group_ids_deep;
|
328 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
329 |
+
$user_group_ids_deep = array();
|
330 |
+
foreach( $groups as $group ) {
|
331 |
+
$user_group_ids_deep[] = $group->group_id;
|
332 |
+
}
|
333 |
+
$group_ids = array();
|
334 |
+
$submitted_group_ids = !empty( $_POST[self::GROUPS_READ] ) && is_array( $_POST[self::GROUPS_READ] ) ? $_POST[self::GROUPS_READ] : array();
|
335 |
+
|
336 |
+
// assign requested groups and create and assign new groups if allowed
|
337 |
+
foreach( $submitted_group_ids as $group_id ) {
|
338 |
+
if ( is_numeric( $group_id ) ) {
|
339 |
+
if ( in_array( $group_id, $user_group_ids_deep ) ) {
|
340 |
+
$group_ids[] = $group_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
}
|
342 |
+
} else {
|
343 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
344 |
+
$creator_id = get_current_user_id();
|
345 |
+
$datetime = date( 'Y-m-d H:i:s', time() );
|
346 |
+
$name = ucwords( strtolower( trim( preg_replace( '/\s+/', ' ', $group_id ) ) ) );
|
347 |
+
if ( strlen( $name ) > 0 ) {
|
348 |
+
if ( !( $group = Groups_Group::read_by_name( $name ) ) ) {
|
349 |
+
if ( $group_id = Groups_Group::create( compact( 'creator_id', 'datetime', 'name' ) ) ) {
|
350 |
+
if ( Groups_User_Group::create( array( 'user_id' => $creator_id, 'group_id' => $group_id ) ) ) {
|
351 |
+
$group_ids[] = $group_id;
|
352 |
+
}
|
353 |
+
}
|
354 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
}
|
357 |
}
|
358 |
}
|
359 |
+
|
360 |
+
do_action( 'groups_access_meta_boxes_before_groups_read_update', $post_id, $group_ids );
|
361 |
+
$update_result = Groups_Post_Access::update( array( 'post_id' => $post_id, 'groups_read' => $group_ids ) );
|
362 |
+
do_action( 'groups_access_meta_boxes_after_groups_read_update', $post_id, $group_ids, $update_result );
|
363 |
}
|
364 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
366 |
}
|
367 |
}
|
368 |
+
|
369 |
}
|
370 |
}
|
371 |
}
|
376 |
*/
|
377 |
private static function enqueue() {
|
378 |
global $groups_version;
|
379 |
+
if ( !wp_script_is( 'selectize' ) ) {
|
380 |
+
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
|
381 |
+
}
|
382 |
+
if ( !wp_style_is( 'selectize' ) ) {
|
383 |
+
wp_enqueue_style( 'selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
}
|
385 |
}
|
386 |
|
387 |
/**
|
388 |
+
* Render groups box for attachment post type (Media).
|
389 |
+
*
|
390 |
* @param array $form_fields
|
391 |
* @param object $post
|
392 |
* @return array
|
396 |
Groups_UIE::enqueue( 'select' );
|
397 |
|
398 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
399 |
+
|
400 |
if ( !isset( $post_types_option['attachment']['add_meta_box'] ) || $post_types_option['attachment']['add_meta_box'] ) {
|
401 |
+
|
402 |
if ( self::user_can_restrict() ) {
|
403 |
+
|
404 |
$user = new Groups_User( get_current_user_id() );
|
405 |
+
$include = $user->group_ids_deep;
|
406 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
407 |
+
$groups_read = get_post_meta( $post->ID, Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ );
|
408 |
+
|
409 |
+
$output = '';
|
410 |
+
$post_singular_name = __( 'Media', 'groups' );
|
411 |
|
412 |
+
$output .= __( 'Read', 'groups' );
|
|
|
|
|
413 |
|
414 |
// On attachments edited within the 'Insert Media' popup, the update is triggered too soon and we end up with only the last capability selected.
|
415 |
// This occurs when using normal checkboxes as well as the select below (Chosen and Selectize tested).
|
421 |
|
422 |
// $output .= '<div style="padding:0 1em;margin:1em 0;border:1px solid #ccc;border-radius:4px;">';
|
423 |
// $output .= '<ul>';
|
424 |
+
// foreach( $groups as $group ) {
|
425 |
+
// $checked = in_array( $group->group_id, $groups_read ) ? ' checked="checked" ' : '';
|
|
|
426 |
// $output .= '<li>';
|
427 |
// $output .= '<label>';
|
428 |
+
// $output .= '<input name="attachments[' . $post->ID . '][' . self::GROUPS_READ . '][]" ' . $checked . ' type="checkbox" value="' . esc_attr( $group->group_id ) . '" />';
|
429 |
+
// $output .= wp_filter_nohtml_kses( $group->name );
|
430 |
// $output .= '</label>';
|
431 |
// $output .= '</li>';
|
|
|
432 |
// }
|
433 |
// $output .= '</ul>';
|
434 |
// $output .= '</div>';
|
435 |
|
436 |
+
$output .= '<div class="select-groups-container">';
|
437 |
+
$select_id = 'attachments-' . $post->ID . '-' . self::GROUPS_READ;
|
|
|
438 |
$output .= sprintf(
|
439 |
+
'<select id="%s" class="select groups-read" name="%s" multiple="multiple" placeholder="%s" data-placeholder="%s" title="%s">',
|
440 |
$select_id,
|
441 |
+
'attachments[' . $post->ID . '][' . self::GROUPS_READ . '][]',
|
442 |
+
esc_attr( __( 'Anyone …', 'groups' ) ),
|
443 |
+
esc_attr( __( 'Anyone …', 'groups' ) ),
|
444 |
+
__( 'You can restrict the visibility to group members. Choose one or more groups to restrict access. If no groups are chosen, this entry is visible to anyone.', 'groups' ) .
|
445 |
+
current_user_can( GROUPS_ADMINISTER_GROUPS ) ? ' ' . __( 'You can create a new group by indicating the group\'s name.', 'groups' ) : ''
|
446 |
);
|
447 |
$output .= '<option value=""></option>';
|
448 |
+
foreach( $groups as $group ) {
|
449 |
+
$output .= sprintf( '<option value="%s" %s>', esc_attr( $group->group_id ), in_array( $group->group_id, $groups_read ) ? ' selected="selected" ' : '' );
|
450 |
+
$output .= wp_filter_nohtml_kses( $group->name );
|
451 |
+
$output .= '</option>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
}
|
453 |
$output .= '</select>';
|
454 |
|
455 |
+
$output .= Groups_UIE::render_select( '#'.$select_id, true, true, current_user_can( GROUPS_ADMINISTER_GROUPS ) );
|
456 |
|
457 |
$output .= '</div>';
|
458 |
|
459 |
$output .= '<p class="description">';
|
460 |
+
$output .= __( 'Restricts the visibility of this entry to members of the chosen groups.', 'groups' );
|
461 |
+
$output .= '</p>';
|
462 |
+
|
463 |
+
$output .= '<p class="description">';
|
464 |
+
$output .= __( 'The attachment page is restricted to authorized users, but due to technical limitations, the file can still be accessed directly via its URL.', 'groups' );
|
465 |
+
$output .= ' ';
|
466 |
+
$output .= sprintf( __( 'Please use <a href="%s" target="_blank">Groups File Access</a> for files that require complete protection.', 'groups' ), esc_url( 'http://www.itthinx.com/shop/groups-file-access/' ) );
|
467 |
$output .= '</p>';
|
468 |
|
469 |
+
$form_fields['groups_read'] = array(
|
470 |
+
'label' => __( 'Groups', 'groups' ),
|
471 |
'input' => 'html',
|
472 |
'html' => $output
|
473 |
);
|
477 |
}
|
478 |
|
479 |
/**
|
480 |
+
* Save groups for attachment post type (Media).
|
481 |
* When multiple attachments are saved, this is called once for each.
|
482 |
+
*
|
483 |
* @param array $post post data
|
484 |
* @param array $attachment attachment field data
|
485 |
* @return array
|
497 |
$post_id = $post['post_ID'];
|
498 |
}
|
499 |
if ( $post_id !== null ) {
|
500 |
+
$user = new Groups_User( get_current_user_id() );
|
501 |
+
$include = $user->group_ids_deep;
|
502 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
503 |
+
$group_ids = array();
|
504 |
+
if ( !empty( $attachment[self::GROUPS_READ] ) && is_array( $attachment[self::GROUPS_READ] ) ) {
|
505 |
+
foreach( $groups as $group ) {
|
506 |
+
if ( in_array( $group->group_id, $attachment[self::GROUPS_READ] ) ) {
|
507 |
+
$group_ids[] = $group->group_id;
|
|
|
|
|
508 |
}
|
509 |
}
|
510 |
}
|
511 |
+
do_action( 'groups_access_meta_boxes_before_groups_read_update', $post_id, $group_ids );
|
512 |
+
$update_result = Groups_Post_Access::update( array( 'post_id' => $post_id, 'groups_read' => $group_ids ) );
|
513 |
+
do_action( 'groups_access_meta_boxes_after_groups_read_update', $post_id, $group_ids, $update_result );
|
514 |
}
|
515 |
}
|
516 |
}
|
518 |
}
|
519 |
|
520 |
/**
|
521 |
+
* Returns true if the current user can restrict access to posts.
|
522 |
+
*
|
523 |
* @return boolean
|
524 |
*/
|
525 |
public static function user_can_restrict() {
|
|
|
526 |
$user = new Groups_User( get_current_user_id() );
|
527 |
+
return $user->can( GROUPS_RESTRICT_ACCESS );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
}
|
529 |
|
530 |
/**
|
531 |
+
* @deprecated
|
532 |
* @return array of valid read capabilities for the current or given user
|
533 |
*/
|
534 |
public static function get_valid_read_caps_for_user( $user_id = null ) {
|
535 |
+
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-access-meta-boxes-legacy.php' );
|
536 |
+
return Groups_Access_Meta_Boxes_Legacy::get_valid_read_caps_for_user( $user_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
}
|
538 |
}
|
539 |
Groups_Access_Meta_Boxes::init();
|
lib/access/class-groups-access-shortcodes.php
CHANGED
@@ -51,12 +51,12 @@ class Groups_Access_Shortcodes {
|
|
51 |
* @param string $content content to render
|
52 |
*/
|
53 |
public static function groups_member( $atts, $content = null ) {
|
54 |
-
$output =
|
55 |
-
$options = shortcode_atts( array(
|
56 |
$show_content = false;
|
57 |
if ( $content !== null ) {
|
58 |
$groups_user = new Groups_User( get_current_user_id() );
|
59 |
-
$groups = explode(
|
60 |
foreach ( $groups as $group ) {
|
61 |
$group = trim( $group );
|
62 |
$current_group = Groups_Group::read( $group );
|
@@ -89,12 +89,12 @@ class Groups_Access_Shortcodes {
|
|
89 |
* @param string $content content to render
|
90 |
*/
|
91 |
public static function groups_non_member( $atts, $content = null ) {
|
92 |
-
$output =
|
93 |
-
$options = shortcode_atts( array(
|
94 |
$show_content = true;
|
95 |
if ( $content !== null ) {
|
96 |
$groups_user = new Groups_User( get_current_user_id() );
|
97 |
-
$groups = explode(
|
98 |
foreach ( $groups as $group ) {
|
99 |
$group = trim( $group );
|
100 |
$current_group = Groups_Group::read( $group );
|
@@ -127,8 +127,8 @@ class Groups_Access_Shortcodes {
|
|
127 |
* @param string $content content to render
|
128 |
*/
|
129 |
public static function groups_can( $atts, $content = null ) {
|
130 |
-
$output =
|
131 |
-
$options = shortcode_atts( array(
|
132 |
if ( $content !== null ) {
|
133 |
$groups_user = new Groups_User( get_current_user_id() );
|
134 |
$capability = $options['capability'];
|
@@ -159,8 +159,8 @@ class Groups_Access_Shortcodes {
|
|
159 |
* @param string $content content to render
|
160 |
*/
|
161 |
public static function groups_can_not( $atts, $content = null ) {
|
162 |
-
$output =
|
163 |
-
$options = shortcode_atts( array(
|
164 |
if ( $content !== null ) {
|
165 |
$groups_user = new Groups_User( get_current_user_id() );
|
166 |
$capability = $options['capability'];
|
51 |
* @param string $content content to render
|
52 |
*/
|
53 |
public static function groups_member( $atts, $content = null ) {
|
54 |
+
$output = '';
|
55 |
+
$options = shortcode_atts( array( 'group' => '' ), $atts );
|
56 |
$show_content = false;
|
57 |
if ( $content !== null ) {
|
58 |
$groups_user = new Groups_User( get_current_user_id() );
|
59 |
+
$groups = explode( ',', $options['group'] );
|
60 |
foreach ( $groups as $group ) {
|
61 |
$group = trim( $group );
|
62 |
$current_group = Groups_Group::read( $group );
|
89 |
* @param string $content content to render
|
90 |
*/
|
91 |
public static function groups_non_member( $atts, $content = null ) {
|
92 |
+
$output = '';
|
93 |
+
$options = shortcode_atts( array( 'group' => '' ), $atts );
|
94 |
$show_content = true;
|
95 |
if ( $content !== null ) {
|
96 |
$groups_user = new Groups_User( get_current_user_id() );
|
97 |
+
$groups = explode( ',', $options['group'] );
|
98 |
foreach ( $groups as $group ) {
|
99 |
$group = trim( $group );
|
100 |
$current_group = Groups_Group::read( $group );
|
127 |
* @param string $content content to render
|
128 |
*/
|
129 |
public static function groups_can( $atts, $content = null ) {
|
130 |
+
$output = '';
|
131 |
+
$options = shortcode_atts( array( 'capability' => '' ), $atts );
|
132 |
if ( $content !== null ) {
|
133 |
$groups_user = new Groups_User( get_current_user_id() );
|
134 |
$capability = $options['capability'];
|
159 |
* @param string $content content to render
|
160 |
*/
|
161 |
public static function groups_can_not( $atts, $content = null ) {
|
162 |
+
$output = '';
|
163 |
+
$options = shortcode_atts( array( 'capability' => '' ), $atts );
|
164 |
if ( $content !== null ) {
|
165 |
$groups_user = new Groups_User( get_current_user_id() );
|
166 |
$capability = $options['capability'];
|
lib/access/class-groups-post-access.php
CHANGED
@@ -28,29 +28,55 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
*/
|
29 |
class Groups_Post_Access {
|
30 |
|
|
|
|
|
|
|
31 |
const POSTMETA_PREFIX = 'groups-';
|
32 |
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
const READ_POST_CAPABILITIES = 'read_post_capabilities';
|
|
|
|
|
|
|
|
|
39 |
const POST_TYPES = 'post_types';
|
40 |
|
41 |
/**
|
42 |
-
*
|
43 |
-
*
|
44 |
*/
|
45 |
public static function activate() {
|
46 |
-
if ( !Groups_Capability::read_by_capability( self::READ_POST_CAPABILITY ) ) {
|
47 |
-
Groups_Capability::create( array( "capability" => self::READ_POST_CAPABILITY ) );
|
48 |
-
// default read caps
|
49 |
-
Groups_Options::update_option( Groups_Post_Access::READ_POST_CAPABILITIES, array( Groups_Post_Access::READ_POST_CAPABILITY ) );
|
50 |
-
// for translation
|
51 |
-
// @see self::READ_POST_CAPABILITY_NAME
|
52 |
-
__( "Read Post", GROUPS_PLUGIN_DOMAIN );
|
53 |
-
}
|
54 |
}
|
55 |
|
56 |
/**
|
@@ -59,21 +85,22 @@ class Groups_Post_Access {
|
|
59 |
public static function init() {
|
60 |
// post access
|
61 |
add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
|
62 |
-
add_filter( 'get_pages', array( __CLASS__,
|
63 |
if ( apply_filters( 'groups_filter_the_posts', false ) ) {
|
64 |
-
add_filter( 'the_posts', array( __CLASS__,
|
65 |
}
|
66 |
-
add_filter( 'wp_get_nav_menu_items', array( __CLASS__,
|
67 |
// content access
|
68 |
-
add_filter(
|
69 |
-
add_filter(
|
70 |
// edit & delete post
|
71 |
add_filter( 'map_meta_cap', array( __CLASS__, 'map_meta_cap' ), 10, 4 );
|
72 |
// @todo these could be interesting to add later ...
|
73 |
// add_filter( "plugin_row_meta", array( __CLASS__, "plugin_row_meta" ), 1 );
|
74 |
// add_filter( "posts_join_paged", array( __CLASS__, "posts_join_paged" ), 1 );
|
75 |
// add_filter( "posts_where_paged", array( __CLASS__, "posts_where_paged" ), 1 );
|
76 |
-
|
|
|
77 |
add_filter( 'wp_count_posts', array( __CLASS__, 'wp_count_posts' ), 10, 3 );
|
78 |
// @todo enable the filter and implement below if needed to correct attachment counts
|
79 |
// add_filter( 'wp_count_attachments', array( __CLASS__, 'wp_count_attachments' ), 10, 2 );
|
@@ -138,60 +165,53 @@ class Groups_Post_Access {
|
|
138 |
|
139 |
global $wpdb;
|
140 |
|
141 |
-
$
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
149 |
}
|
150 |
}
|
151 |
-
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
$caps[] = "'". $capability . "'";
|
160 |
}
|
161 |
}
|
162 |
-
}
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
//
|
178 |
-
//
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
" ( " .
|
185 |
-
" SELECT ID FROM $wpdb->posts WHERE ID NOT IN ( SELECT post_id FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' ) " . // posts without access restriction
|
186 |
-
" UNION ALL " . // we don't care about duplicates here, just make it quick
|
187 |
-
" SELECT post_id AS ID FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' AND {$wpdb->postmeta}.meta_value IN (%s) " . // posts that require any capability the user has
|
188 |
-
" ) ",
|
189 |
-
self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY,
|
190 |
-
self::POSTMETA_PREFIX . self::READ_POST_CAPABILITY,
|
191 |
-
$caps
|
192 |
-
);
|
193 |
|
194 |
-
|
|
|
|
|
195 |
}
|
196 |
|
197 |
/**
|
@@ -201,11 +221,15 @@ class Groups_Post_Access {
|
|
201 |
*/
|
202 |
public static function get_pages( $pages ) {
|
203 |
$result = array();
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
208 |
}
|
|
|
|
|
209 |
}
|
210 |
return $result;
|
211 |
}
|
@@ -218,11 +242,15 @@ class Groups_Post_Access {
|
|
218 |
*/
|
219 |
public static function the_posts( $posts, &$query ) {
|
220 |
$result = array();
|
221 |
-
$
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
|
|
225 |
}
|
|
|
|
|
226 |
}
|
227 |
return $result;
|
228 |
}
|
@@ -238,13 +266,17 @@ class Groups_Post_Access {
|
|
238 |
*/
|
239 |
public static function wp_get_nav_menu_items( $items = null, $menu = null, $args = null ) {
|
240 |
$result = array();
|
241 |
-
$
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
247 |
}
|
|
|
|
|
248 |
}
|
249 |
return $result;
|
250 |
}
|
@@ -258,12 +290,16 @@ class Groups_Post_Access {
|
|
258 |
public static function get_the_excerpt( $output ) {
|
259 |
global $post;
|
260 |
$result = '';
|
261 |
-
if (
|
262 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
263 |
$result = $output;
|
264 |
}
|
265 |
} else {
|
266 |
-
// not a post, don't interfere
|
267 |
$result = $output;
|
268 |
}
|
269 |
return $result;
|
@@ -278,24 +314,23 @@ class Groups_Post_Access {
|
|
278 |
public static function the_content( $output ) {
|
279 |
global $post;
|
280 |
$result = '';
|
281 |
-
if (
|
282 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
283 |
$result = $output;
|
284 |
}
|
285 |
} else {
|
286 |
-
// not a post, don't interfere
|
287 |
$result = $output;
|
288 |
}
|
289 |
return $result;
|
290 |
}
|
291 |
|
292 |
/**
|
293 |
-
* Adds an access
|
294 |
-
*
|
295 |
-
* $map must contain 'post_id' (*)
|
296 |
-
*
|
297 |
-
* For now this only should be used to add the READ_POST_CAPABILITY which
|
298 |
-
* it does automatically. Nothing else is checked for granting access.
|
299 |
*
|
300 |
* (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
|
301 |
* add_post_meta stores postmeta for the revision's parent, we retrieve
|
@@ -304,24 +339,30 @@ class Groups_Post_Access {
|
|
304 |
* the already existing postmeta entry (which ocurred in previous
|
305 |
* versions).
|
306 |
*
|
307 |
-
* @param array $map
|
308 |
-
* @return true if the capability could be added to the post,
|
309 |
*/
|
310 |
public static function create( $map ) {
|
311 |
extract( $map );
|
312 |
$result = false;
|
313 |
|
314 |
-
if (
|
315 |
-
|
|
|
|
|
|
|
|
|
316 |
}
|
317 |
|
318 |
-
if ( !empty( $post_id ) && !empty( $
|
319 |
-
|
|
|
|
|
320 |
if ( $revision_parent_id = wp_is_post_revision( $post_id ) ) {
|
321 |
$post_id = $revision_parent_id;
|
322 |
}
|
323 |
-
if ( !in_array( $
|
324 |
-
$result = add_post_meta( $post_id, self::POSTMETA_PREFIX . self::
|
325 |
}
|
326 |
}
|
327 |
}
|
@@ -329,48 +370,95 @@ class Groups_Post_Access {
|
|
329 |
}
|
330 |
|
331 |
/**
|
332 |
-
* Returns true if the post requires the given
|
333 |
*
|
334 |
-
*
|
335 |
-
*
|
336 |
*
|
337 |
-
* @
|
338 |
-
* @param string $capability capability label
|
339 |
-
* @return true if the capability is required, otherwise false
|
340 |
*/
|
341 |
-
public static function read( $post_id, $
|
|
|
342 |
$result = false;
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
347 |
return $result;
|
348 |
}
|
349 |
|
350 |
/**
|
351 |
-
*
|
|
|
|
|
352 |
*
|
353 |
* @param array $map
|
354 |
-
* @return false
|
355 |
*/
|
356 |
public static function update( $map ) {
|
357 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
}
|
359 |
|
360 |
/**
|
361 |
-
* Removes a
|
362 |
*
|
363 |
* @param int $post_id
|
364 |
-
* @param
|
365 |
* @return true on success, otherwise false
|
366 |
*/
|
367 |
-
public static function delete( $post_id, $
|
|
|
368 |
$result = false;
|
369 |
if ( !empty( $post_id ) ) {
|
370 |
-
if (
|
371 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
} else {
|
373 |
-
$result = delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::
|
374 |
}
|
375 |
}
|
376 |
return $result;
|
@@ -379,42 +467,60 @@ class Groups_Post_Access {
|
|
379 |
/**
|
380 |
* Returns a list of capabilities that grant access to the post.
|
381 |
*
|
|
|
382 |
* @param int $post_id
|
383 |
* @return array of string, capabilities
|
384 |
*/
|
385 |
public static function get_read_post_capabilities( $post_id ) {
|
386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
}
|
388 |
|
389 |
/**
|
390 |
-
* Returns true if the user
|
391 |
*
|
392 |
* @param int $post_id post id
|
393 |
* @param int $user_id user id or null for current user
|
394 |
* @return boolean true if user can read the post
|
395 |
*/
|
396 |
public static function user_can_read_post( $post_id, $user_id = null ) {
|
|
|
397 |
$result = false;
|
|
|
398 |
if ( !empty( $post_id ) ) {
|
399 |
if ( $user_id === null ) {
|
400 |
$user_id = get_current_user_id();
|
401 |
}
|
|
|
402 |
$cached = Groups_Cache::get( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, self::CACHE_GROUP );
|
|
|
403 |
if ( $cached !== null ) {
|
404 |
$result = $cached->value;
|
405 |
-
unset( $cached )
|
406 |
} else {
|
407 |
$groups_user = new Groups_User( $user_id );
|
408 |
-
$
|
409 |
-
if (
|
410 |
-
foreach( $read_caps as $read_cap ) {
|
411 |
-
if ( $groups_user->can( $read_cap ) ) {
|
412 |
-
$result = true;
|
413 |
-
break;
|
414 |
-
}
|
415 |
-
}
|
416 |
-
} else {
|
417 |
$result = true;
|
|
|
|
|
|
|
418 |
}
|
419 |
$result = apply_filters( 'groups_post_access_user_can_read_post', $result, $post_id, $user_id );
|
420 |
Groups_Cache::set( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, $result, self::CACHE_GROUP );
|
@@ -424,13 +530,15 @@ class Groups_Post_Access {
|
|
424 |
}
|
425 |
|
426 |
/**
|
427 |
-
* Hooks into
|
428 |
-
*
|
429 |
*
|
430 |
-
* @param
|
431 |
*/
|
432 |
-
public static function
|
433 |
-
|
|
|
|
|
434 |
}
|
435 |
|
436 |
/**
|
28 |
*/
|
29 |
class Groups_Post_Access {
|
30 |
|
31 |
+
/**
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
const POSTMETA_PREFIX = 'groups-';
|
35 |
|
36 |
+
/**
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
const READ = 'read';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
const CACHE_GROUP = 'groups';
|
45 |
+
|
46 |
+
/**
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
*/
|
50 |
+
const CAN_READ_POST = 'can_read_post';
|
51 |
|
52 |
+
/**
|
53 |
+
* @deprecated
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
const READ_POST_CAPABILITY = 'groups_read_post';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @deprecated
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
const READ_POST_CAPABILITY_NAME = 'Read Post';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @deprecated
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
const READ_POST_CAPABILITIES = 'read_post_capabilities';
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
const POST_TYPES = 'post_types';
|
74 |
|
75 |
/**
|
76 |
+
* Work done on activation, currently does nothing.
|
77 |
+
* @see Groups_Controller::activate()
|
78 |
*/
|
79 |
public static function activate() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
/**
|
85 |
public static function init() {
|
86 |
// post access
|
87 |
add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
|
88 |
+
add_filter( 'get_pages', array( __CLASS__, 'get_pages' ), 1 );
|
89 |
if ( apply_filters( 'groups_filter_the_posts', false ) ) {
|
90 |
+
add_filter( 'the_posts', array( __CLASS__, 'the_posts' ), 1, 2 );
|
91 |
}
|
92 |
+
add_filter( 'wp_get_nav_menu_items', array( __CLASS__, 'wp_get_nav_menu_items' ), 1, 3 );
|
93 |
// content access
|
94 |
+
add_filter( 'get_the_excerpt', array( __CLASS__, 'get_the_excerpt' ), 1 );
|
95 |
+
add_filter( 'the_content', array( __CLASS__, 'the_content' ), 1 );
|
96 |
// edit & delete post
|
97 |
add_filter( 'map_meta_cap', array( __CLASS__, 'map_meta_cap' ), 10, 4 );
|
98 |
// @todo these could be interesting to add later ...
|
99 |
// add_filter( "plugin_row_meta", array( __CLASS__, "plugin_row_meta" ), 1 );
|
100 |
// add_filter( "posts_join_paged", array( __CLASS__, "posts_join_paged" ), 1 );
|
101 |
// add_filter( "posts_where_paged", array( __CLASS__, "posts_where_paged" ), 1 );
|
102 |
+
|
103 |
+
add_action( 'groups_deleted_group', array( __CLASS__, 'groups_deleted_group' ) );
|
104 |
add_filter( 'wp_count_posts', array( __CLASS__, 'wp_count_posts' ), 10, 3 );
|
105 |
// @todo enable the filter and implement below if needed to correct attachment counts
|
106 |
// add_filter( 'wp_count_attachments', array( __CLASS__, 'wp_count_attachments' ), 10, 2 );
|
165 |
|
166 |
global $wpdb;
|
167 |
|
168 |
+
if ( apply_filters( 'groups_post_access_posts_where_apply', true, $where, $query ) ) {
|
169 |
+
|
170 |
+
$user_id = get_current_user_id();
|
171 |
|
172 |
+
// this only applies to logged in users
|
173 |
+
if ( $user_id ) {
|
174 |
+
// if administrators can override access, don't filter
|
175 |
+
if ( get_option( GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE, GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE_DEFAULT ) ) {
|
176 |
+
if ( user_can( $user_id, 'administrator' ) ) {
|
177 |
+
return $where;
|
178 |
+
}
|
179 |
}
|
180 |
}
|
|
|
181 |
|
182 |
+
// 1. Get all the groups that the user belongs to, including those that are inherited:
|
183 |
+
$group_ids = array();
|
184 |
+
if ( $user = new Groups_User( $user_id ) ) {
|
185 |
+
$group_ids_deep = $user->group_ids_deep;
|
186 |
+
if ( is_array( $group_ids_deep ) ) {
|
187 |
+
$group_ids = $group_ids_deep;
|
|
|
188 |
}
|
189 |
}
|
|
|
190 |
|
191 |
+
if ( count( $group_ids ) > 0 ) {
|
192 |
+
$group_ids = "'" . implode( "','", $group_ids ) . "'";
|
193 |
+
} else {
|
194 |
+
$group_ids = '\'\'';
|
195 |
+
}
|
196 |
|
197 |
+
// 2. Filter the posts:
|
198 |
+
// This allows the user to access posts where the posts are not restricted or where
|
199 |
+
// the user belongs to ANY of the groups:
|
200 |
+
$where .= sprintf(
|
201 |
+
" AND {$wpdb->posts}.ID IN " .
|
202 |
+
" ( " .
|
203 |
+
" SELECT ID FROM $wpdb->posts WHERE ID NOT IN ( SELECT post_id FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' ) " . // posts without access restriction
|
204 |
+
" UNION ALL " . // we don't care about duplicates here, just make it quick
|
205 |
+
" SELECT post_id AS ID FROM $wpdb->postmeta WHERE {$wpdb->postmeta}.meta_key = '%s' AND {$wpdb->postmeta}.meta_value IN (%s) " . // posts that require any group the user belongs to
|
206 |
+
" ) ",
|
207 |
+
self::POSTMETA_PREFIX . self::READ,
|
208 |
+
self::POSTMETA_PREFIX . self::READ,
|
209 |
+
$group_ids
|
210 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
+
}
|
213 |
+
|
214 |
+
return apply_filters( 'groups_post_access_posts_where', $where, $query );
|
215 |
}
|
216 |
|
217 |
/**
|
221 |
*/
|
222 |
public static function get_pages( $pages ) {
|
223 |
$result = array();
|
224 |
+
if ( apply_filters( 'groups_post_access_get_pages_apply', true, $pages ) ) {
|
225 |
+
$user_id = get_current_user_id();
|
226 |
+
foreach ( $pages as $page ) {
|
227 |
+
if ( self::user_can_read_post( $page->ID, $user_id ) ) {
|
228 |
+
$result[] = $page;
|
229 |
+
}
|
230 |
}
|
231 |
+
} else {
|
232 |
+
$result = $pages;
|
233 |
}
|
234 |
return $result;
|
235 |
}
|
242 |
*/
|
243 |
public static function the_posts( $posts, &$query ) {
|
244 |
$result = array();
|
245 |
+
if ( apply_filters( 'groups_post_access_the_posts_apply', true, $posts, $query ) ) {
|
246 |
+
$user_id = get_current_user_id();
|
247 |
+
foreach ( $posts as $post ) {
|
248 |
+
if ( self::user_can_read_post( $post->ID, $user_id ) ) {
|
249 |
+
$result[] = $post;
|
250 |
+
}
|
251 |
}
|
252 |
+
} else {
|
253 |
+
$result = $posts;
|
254 |
}
|
255 |
return $result;
|
256 |
}
|
266 |
*/
|
267 |
public static function wp_get_nav_menu_items( $items = null, $menu = null, $args = null ) {
|
268 |
$result = array();
|
269 |
+
if ( apply_filters( 'groups_post_access_wp_get_nav_menu_items_apply', true, $items, $menu, $args ) ) {
|
270 |
+
$user_id = get_current_user_id();
|
271 |
+
foreach ( $items as $item ) {
|
272 |
+
// @todo might want to check $item->object and $item->type first,
|
273 |
+
// for example these are 'page' and 'post_type' for a page
|
274 |
+
if ( self::user_can_read_post( $item->object_id, $user_id ) ) {
|
275 |
+
$result[] = $item;
|
276 |
+
}
|
277 |
}
|
278 |
+
} else {
|
279 |
+
$result = $items;
|
280 |
}
|
281 |
return $result;
|
282 |
}
|
290 |
public static function get_the_excerpt( $output ) {
|
291 |
global $post;
|
292 |
$result = '';
|
293 |
+
if ( apply_filters( 'groups_post_access_get_the_excerpt_apply', true, $output ) ) {
|
294 |
+
if ( isset( $post->ID ) ) {
|
295 |
+
if ( self::user_can_read_post( $post->ID ) ) {
|
296 |
+
$result = $output;
|
297 |
+
}
|
298 |
+
} else {
|
299 |
+
// not a post, don't interfere
|
300 |
$result = $output;
|
301 |
}
|
302 |
} else {
|
|
|
303 |
$result = $output;
|
304 |
}
|
305 |
return $result;
|
314 |
public static function the_content( $output ) {
|
315 |
global $post;
|
316 |
$result = '';
|
317 |
+
if ( apply_filters( 'groups_post_access_the_content_apply', true, $output ) ) {
|
318 |
+
if ( isset( $post->ID ) ) {
|
319 |
+
if ( self::user_can_read_post( $post->ID ) ) {
|
320 |
+
$result = $output;
|
321 |
+
}
|
322 |
+
} else {
|
323 |
+
// not a post, don't interfere
|
324 |
$result = $output;
|
325 |
}
|
326 |
} else {
|
|
|
327 |
$result = $output;
|
328 |
}
|
329 |
return $result;
|
330 |
}
|
331 |
|
332 |
/**
|
333 |
+
* Adds an access requirement based on post_id and group_id.
|
|
|
|
|
|
|
|
|
|
|
334 |
*
|
335 |
* (*) Revisions : As of Groups 1.3.13 and at WordPress 3.6.1, as
|
336 |
* add_post_meta stores postmeta for the revision's parent, we retrieve
|
339 |
* the already existing postmeta entry (which ocurred in previous
|
340 |
* versions).
|
341 |
*
|
342 |
+
* @param array $map must contain 'post_id' (*) and 'group_id'
|
343 |
+
* @return true if the capability could be added to the post, otherwise false
|
344 |
*/
|
345 |
public static function create( $map ) {
|
346 |
extract( $map );
|
347 |
$result = false;
|
348 |
|
349 |
+
if ( isset( $capability ) ) {
|
350 |
+
_doing_it_wrong(
|
351 |
+
__CLASS__ . '::' . __METHOD__,
|
352 |
+
__( 'You should use Groups_Post_Access_Legacy::create() to pass a capability restriction instead.', 'groups' ),
|
353 |
+
'2.0.0'
|
354 |
+
);
|
355 |
}
|
356 |
|
357 |
+
if ( !empty( $post_id ) && !empty( $group_id ) ) {
|
358 |
+
$post_id = Groups_Utility::id( $post_id );
|
359 |
+
$group_id = Groups_Utility::id( $group_id );
|
360 |
+
if ( Groups_Group::read( $group_id ) ) {
|
361 |
if ( $revision_parent_id = wp_is_post_revision( $post_id ) ) {
|
362 |
$post_id = $revision_parent_id;
|
363 |
}
|
364 |
+
if ( !in_array( $group_id, get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ ) ) ) {
|
365 |
+
$result = add_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ, $group_id );
|
366 |
}
|
367 |
}
|
368 |
}
|
370 |
}
|
371 |
|
372 |
/**
|
373 |
+
* Returns true if the post requires the user to be a member of the given group(s) to grant access.
|
374 |
*
|
375 |
+
* @param int $post_id ID of the post
|
376 |
+
* @param array $map should provide 'post_id' and 'groups_read'
|
377 |
*
|
378 |
+
* @return true if the group(s) is required, otherwise false
|
|
|
|
|
379 |
*/
|
380 |
+
public static function read( $post_id, $map = array() ) {
|
381 |
+
extract( $map );
|
382 |
$result = false;
|
383 |
+
if ( !empty( $post_id ) ) {
|
384 |
+
if ( isset( $groups_read ) ) {
|
385 |
+
if ( empty( $groups_read ) ) {
|
386 |
+
$groups_read = array();
|
387 |
+
} else if ( !is_array( $groups_read ) ) {
|
388 |
+
$groups_read = array( $groups_read );
|
389 |
+
}
|
390 |
+
$group_ids = get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ );
|
391 |
+
if ( $group_ids ) {
|
392 |
+
foreach( $groups_read as $group_id ) {
|
393 |
+
$result = in_array( $group_id, $group_ids );
|
394 |
+
if ( !$result ) {
|
395 |
+
break;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
}
|
400 |
}
|
401 |
return $result;
|
402 |
}
|
403 |
|
404 |
/**
|
405 |
+
* Update the post access restrictions.
|
406 |
+
*
|
407 |
+
* $map must provide 'post_id' (int) indicating the post's ID and 'groups_read' (int|array of int) holding group IDs that restrict read access.
|
408 |
*
|
409 |
* @param array $map
|
410 |
+
* @return array of group ids, false on failure
|
411 |
*/
|
412 |
public static function update( $map ) {
|
413 |
+
extract( $map );
|
414 |
+
$result = false;
|
415 |
+
if ( !empty( $post_id ) ) {
|
416 |
+
if ( empty( $groups_read ) ) {
|
417 |
+
$groups_read = array();
|
418 |
+
} else if ( !is_array( $groups_read ) ) {
|
419 |
+
$groups_read = array( $groups_read );
|
420 |
+
}
|
421 |
+
$groups_read = array_map( array( 'Groups_Utility', 'id' ), $groups_read );
|
422 |
+
$current_groups_read = get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ );
|
423 |
+
$current_groups_read = array_map( array( 'Groups_Utility', 'id' ), $current_groups_read );
|
424 |
+
foreach( $groups_read as $group_id ) {
|
425 |
+
if ( !in_array( $group_id, $current_groups_read ) ) {
|
426 |
+
add_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ, $group_id );
|
427 |
+
}
|
428 |
+
}
|
429 |
+
foreach( $current_groups_read as $group_id ) {
|
430 |
+
if ( !in_array( $group_id, $groups_read ) ) {
|
431 |
+
delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ, $group_id );
|
432 |
+
}
|
433 |
+
}
|
434 |
+
$result = array_map( array( 'Groups_Utility', 'id' ), get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ ) );
|
435 |
+
}
|
436 |
+
return $result;
|
437 |
}
|
438 |
|
439 |
/**
|
440 |
+
* Removes a access restrictions from a post.
|
441 |
*
|
442 |
* @param int $post_id
|
443 |
+
* @param array $map must provide 'groups_read' holding group IDs to remove from restricting access to the post; if empty, all access restrictions will be removed
|
444 |
* @return true on success, otherwise false
|
445 |
*/
|
446 |
+
public static function delete( $post_id, $map = array() ) {
|
447 |
+
extract( $map );
|
448 |
$result = false;
|
449 |
if ( !empty( $post_id ) ) {
|
450 |
+
if ( empty( $groups_read ) ) {
|
451 |
+
$groups_read = array();
|
452 |
+
} else if ( !is_array( $groups_read ) ) {
|
453 |
+
$groups_read = array( $groups_read );
|
454 |
+
}
|
455 |
+
$groups_read = array_map( array( 'Groups_Utility', 'id' ), $groups_read );
|
456 |
+
if ( !empty( $groups_read ) ) {
|
457 |
+
foreach( $groups_read as $group_id ) {
|
458 |
+
$result = delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ, $group_id );
|
459 |
+
}
|
460 |
} else {
|
461 |
+
$result = delete_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ );
|
462 |
}
|
463 |
}
|
464 |
return $result;
|
467 |
/**
|
468 |
* Returns a list of capabilities that grant access to the post.
|
469 |
*
|
470 |
+
* @deprecated
|
471 |
* @param int $post_id
|
472 |
* @return array of string, capabilities
|
473 |
*/
|
474 |
public static function get_read_post_capabilities( $post_id ) {
|
475 |
+
_doing_it_wrong(
|
476 |
+
__CLASS__ . '::' . __METHOD__,
|
477 |
+
__( 'This method is deprecated. You should use Groups_Post_Access_Legacy::get_read_post_capabilities() to retrieve the capabilities instead.', 'groups' ),
|
478 |
+
'2.0.0'
|
479 |
+
);
|
480 |
+
|
481 |
+
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-post-access-legacy.php' );
|
482 |
+
return Groups_Post_Access_Legacy::get_read_post_capabilities( $post_id );
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Returns a list of group IDs that grant read access to the post.
|
487 |
+
*
|
488 |
+
* @param int $post_id
|
489 |
+
* @return array of int, group IDs
|
490 |
+
*/
|
491 |
+
public static function get_read_group_ids( $post_id ) {
|
492 |
+
return get_post_meta( $post_id, self::POSTMETA_PREFIX . self::READ );
|
493 |
}
|
494 |
|
495 |
/**
|
496 |
+
* Returns true if the user belongs to any of the groups that grant access to the post.
|
497 |
*
|
498 |
* @param int $post_id post id
|
499 |
* @param int $user_id user id or null for current user
|
500 |
* @return boolean true if user can read the post
|
501 |
*/
|
502 |
public static function user_can_read_post( $post_id, $user_id = null ) {
|
503 |
+
|
504 |
$result = false;
|
505 |
+
|
506 |
if ( !empty( $post_id ) ) {
|
507 |
if ( $user_id === null ) {
|
508 |
$user_id = get_current_user_id();
|
509 |
}
|
510 |
+
|
511 |
$cached = Groups_Cache::get( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, self::CACHE_GROUP );
|
512 |
+
|
513 |
if ( $cached !== null ) {
|
514 |
$result = $cached->value;
|
515 |
+
unset( $cached );
|
516 |
} else {
|
517 |
$groups_user = new Groups_User( $user_id );
|
518 |
+
$group_ids = self::get_read_group_ids( $post_id );
|
519 |
+
if ( empty( $group_ids ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
$result = true;
|
521 |
+
} else {
|
522 |
+
$ids = array_intersect( $groups_user->group_ids_deep, $group_ids );
|
523 |
+
$result = !empty( $ids );
|
524 |
}
|
525 |
$result = apply_filters( 'groups_post_access_user_can_read_post', $result, $post_id, $user_id );
|
526 |
Groups_Cache::set( self::CAN_READ_POST . '_' . $user_id . '_' . $post_id, $result, self::CACHE_GROUP );
|
530 |
}
|
531 |
|
532 |
/**
|
533 |
+
* Hooks into groups_deleted_group to remove existing access restrictions
|
534 |
+
* based on the deleted group.
|
535 |
*
|
536 |
+
* @param int $group_id the ID of the deleted group
|
537 |
*/
|
538 |
+
public static function groups_deleted_group( $group_id ) {
|
539 |
+
if ( $group_id ) {
|
540 |
+
delete_metadata( 'post', null, self::POSTMETA_PREFIX . self::READ, $group_id, true );
|
541 |
+
}
|
542 |
}
|
543 |
|
544 |
/**
|
lib/admin/class-groups-admin-post-columns.php
CHANGED
@@ -15,6 +15,7 @@
|
|
15 |
* This header and all notices must be kept intact.
|
16 |
*
|
17 |
* @author Antonio Blanco
|
|
|
18 |
* @package groups
|
19 |
* @since groups 1.4.2
|
20 |
*/
|
@@ -28,7 +29,17 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
*/
|
29 |
class Groups_Admin_Post_Columns {
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
/**
|
34 |
* Adds an admin_init action.
|
@@ -49,15 +60,19 @@ class Groups_Admin_Post_Columns {
|
|
49 |
foreach ( $post_types as $post_type ) {
|
50 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
51 |
if ( ( $post_type == 'attachment' ) ) {
|
52 |
-
// filters to display the media's access restriction
|
53 |
add_filter( 'manage_media_columns', array( __CLASS__, 'columns' ) );
|
54 |
// args: string $column_name, int $media_id
|
55 |
add_action( 'manage_media_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
|
|
|
|
56 |
} else {
|
57 |
-
// filters to display the posts' access restriction
|
58 |
add_filter( 'manage_' . $post_type . '_posts_columns', array( __CLASS__, 'columns' ) );
|
59 |
// args: string $column_name, int $post_id
|
60 |
add_action( 'manage_' . $post_type . '_posts_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
|
|
|
|
61 |
}
|
62 |
}
|
63 |
}
|
@@ -66,15 +81,16 @@ class Groups_Admin_Post_Columns {
|
|
66 |
|
67 |
/**
|
68 |
* Adds a new column to the post type's table showing the access
|
69 |
-
* restriction
|
70 |
*
|
71 |
* @param array $column_headers
|
72 |
* @return array column headers
|
73 |
*/
|
74 |
public static function columns( $column_headers ) {
|
75 |
-
$column_headers[self::
|
76 |
-
|
77 |
-
esc_attr( __( 'One or more
|
|
|
78 |
);
|
79 |
return $column_headers;
|
80 |
}
|
@@ -89,28 +105,72 @@ class Groups_Admin_Post_Columns {
|
|
89 |
public static function custom_column( $column_name, $post_id ) {
|
90 |
$output = '';
|
91 |
switch ( $column_name ) {
|
92 |
-
case self::
|
93 |
-
$
|
94 |
-
$
|
95 |
-
if ( count( $
|
96 |
-
|
97 |
-
$
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
}
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$output .= '</ul>';
|
108 |
-
} else {
|
109 |
-
$output .= '';
|
110 |
}
|
111 |
break;
|
112 |
}
|
113 |
echo $output;
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
Groups_Admin_Post_Columns::init();
|
15 |
* This header and all notices must be kept intact.
|
16 |
*
|
17 |
* @author Antonio Blanco
|
18 |
+
* @author Karim Rahimpur
|
19 |
* @package groups
|
20 |
* @since groups 1.4.2
|
21 |
*/
|
29 |
*/
|
30 |
class Groups_Admin_Post_Columns {
|
31 |
|
32 |
+
/**
|
33 |
+
* Groups column header id.
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
const GROUPS = 'groups-read';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Field name.
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
const GROUPS_READ = 'groups-read';
|
43 |
|
44 |
/**
|
45 |
* Adds an admin_init action.
|
60 |
foreach ( $post_types as $post_type ) {
|
61 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
62 |
if ( ( $post_type == 'attachment' ) ) {
|
63 |
+
// filters to display the media's access restriction groups
|
64 |
add_filter( 'manage_media_columns', array( __CLASS__, 'columns' ) );
|
65 |
// args: string $column_name, int $media_id
|
66 |
add_action( 'manage_media_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
67 |
+
// make the groups column sortable
|
68 |
+
add_filter( 'manage_upload_sortable_columns', array( __CLASS__, 'manage_edit_post_sortable_columns' ) );
|
69 |
} else {
|
70 |
+
// filters to display the posts' access restriction groups
|
71 |
add_filter( 'manage_' . $post_type . '_posts_columns', array( __CLASS__, 'columns' ) );
|
72 |
// args: string $column_name, int $post_id
|
73 |
add_action( 'manage_' . $post_type . '_posts_custom_column', array( __CLASS__, 'custom_column' ), 10, 2 );
|
74 |
+
// make the groups column sortable
|
75 |
+
add_filter( 'manage_edit-' . $post_type . '_sortable_columns', array( __CLASS__, 'manage_edit_post_sortable_columns' ) );
|
76 |
}
|
77 |
}
|
78 |
}
|
81 |
|
82 |
/**
|
83 |
* Adds a new column to the post type's table showing the access
|
84 |
+
* restriction groups.
|
85 |
*
|
86 |
* @param array $column_headers
|
87 |
* @return array column headers
|
88 |
*/
|
89 |
public static function columns( $column_headers ) {
|
90 |
+
$column_headers[self::GROUPS] = sprintf(
|
91 |
+
'<span title="%s">%s</span>',
|
92 |
+
esc_attr( __( 'One or more groups granting access to entries.', 'groups' ) ),
|
93 |
+
esc_html( _x( 'Groups', 'Column header', 'groups' ) )
|
94 |
);
|
95 |
return $column_headers;
|
96 |
}
|
105 |
public static function custom_column( $column_name, $post_id ) {
|
106 |
$output = '';
|
107 |
switch ( $column_name ) {
|
108 |
+
case self::GROUPS :
|
109 |
+
$entries = array();
|
110 |
+
$groups_read = get_post_meta( $post_id, Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ );
|
111 |
+
if ( count( $groups_read ) > 0 ) {
|
112 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $groups_read ) );
|
113 |
+
if ( ( count( $groups ) > 0 ) ) {
|
114 |
+
foreach( $groups as $group ) {
|
115 |
+
$entries[] = wp_strip_all_tags( $group->name );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
if (
|
120 |
+
function_exists( 'get_term_meta' ) && // >= WordPress 4.4
|
121 |
+
class_exists( 'Groups_Restrict_Categories' ) &&
|
122 |
+
method_exists( 'Groups_Restrict_Categories', 'get_controlled_taxonomies' ) &&
|
123 |
+
method_exists( 'Groups_Restrict_Categories', 'get_term_read_groups' ) // >= Groups Restrict Categories 2.0.0
|
124 |
+
) {
|
125 |
+
$terms = array();
|
126 |
+
$taxonomies = Groups_Restrict_Categories::get_controlled_taxonomies();
|
127 |
+
foreach( $taxonomies as $taxonomy ) {
|
128 |
+
$terms = array_merge( $terms, wp_get_post_terms( $post_id, $taxonomy ) );
|
129 |
+
}
|
130 |
+
foreach( $terms as $term ) {
|
131 |
+
if ( in_array( $term->taxonomy, $taxonomies ) ) {
|
132 |
+
$term_group_ids = Groups_Restrict_Categories::get_term_read_groups( $term->term_id );
|
133 |
+
$edit_term_link = get_edit_term_link( $term->term_id, $term->taxonomy, get_post_type( $post_id ) );
|
134 |
+
if ( !empty( $term_group_ids ) ) {
|
135 |
+
foreach( $term_group_ids as $group_id ) {
|
136 |
+
if ( $group = Groups_Group::read( $group_id ) ) {
|
137 |
+
$entries[] = sprintf( '%s <a href="%s">%s</a>', wp_strip_all_tags( $group->name ), esc_url( $edit_term_link ), esc_html( $term->name ) );
|
138 |
+
}
|
139 |
+
}
|
140 |
}
|
141 |
}
|
142 |
}
|
143 |
+
}
|
144 |
+
if ( !empty( $entries ) ) {
|
145 |
+
sort( $entries );
|
146 |
+
$output .= '<ul>';
|
147 |
+
foreach( $entries as $entry ) {
|
148 |
+
$output .= '<li>';
|
149 |
+
$output .= $entry; // entries are already escaped for output
|
150 |
+
$output .= '</li>';
|
151 |
+
}
|
152 |
$output .= '</ul>';
|
|
|
|
|
153 |
}
|
154 |
break;
|
155 |
}
|
156 |
echo $output;
|
157 |
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Groups column is sortable.
|
161 |
+
*
|
162 |
+
* Sorting depends on the filters Groups_Admin_Posts::posts_join() and Groups_Admin_Posts::posts_orderby()
|
163 |
+
* which add the relevant group information and sort by group name.
|
164 |
+
*
|
165 |
+
* @see Groups_Admin_Posts::posts_join()
|
166 |
+
* @see Groups_Admin_Posts::posts_orderby()
|
167 |
+
* @param array $sortable_columns
|
168 |
+
* @return array
|
169 |
+
*/
|
170 |
+
public static function manage_edit_post_sortable_columns( $sortable_columns ) {
|
171 |
+
$sortable_columns[self::GROUPS] = self::GROUPS;
|
172 |
+
return $sortable_columns;
|
173 |
+
}
|
174 |
+
|
175 |
}
|
176 |
Groups_Admin_Post_Columns::init();
|
lib/admin/class-groups-admin-posts.php
CHANGED
@@ -24,10 +24,18 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
-
* Additions to post overview admin screens
|
|
|
|
|
28 |
*/
|
29 |
class Groups_Admin_Posts {
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
const NOT_RESTRICTED = "#not-restricted#";
|
32 |
|
33 |
/**
|
@@ -46,7 +54,11 @@ class Groups_Admin_Posts {
|
|
46 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
|
47 |
add_action( 'admin_head', array( __CLASS__, 'admin_head' ) );
|
48 |
add_action( 'restrict_manage_posts', array( __CLASS__, 'restrict_manage_posts' ) );
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
|
51 |
add_action( 'bulk_edit_custom_box', array( __CLASS__, 'bulk_edit_custom_box' ), 10, 2);
|
52 |
add_action( 'save_post', array( __CLASS__, 'save_post' ) );
|
@@ -81,24 +93,25 @@ class Groups_Admin_Posts {
|
|
81 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
82 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
83 |
echo '<style type="text/css">';
|
84 |
-
echo '.groups-
|
85 |
-
echo '.groups-
|
86 |
-
echo '.groups-
|
87 |
-
echo '.groups-
|
88 |
-
echo '.groups-
|
89 |
-
echo '.groups-
|
90 |
-
echo '.groups-
|
91 |
-
echo '.groups-
|
92 |
echo '.inline-edit-row fieldset .capabilities-bulk-container label span.title { min-width: 5em; padding: 2px 1em; width: auto; }';
|
93 |
echo '.tablenav .actions { overflow: visible; }'; // this is important so that the selectize options aren't hidden
|
94 |
echo '.wp-list-table td { overflow: visible; }'; // idem for bulk actions
|
|
|
95 |
echo '</style>';
|
96 |
}
|
97 |
}
|
98 |
}
|
99 |
|
100 |
/**
|
101 |
-
* Renders the access restriction field.
|
102 |
*/
|
103 |
public static function restrict_manage_posts() {
|
104 |
|
@@ -116,33 +129,44 @@ class Groups_Admin_Posts {
|
|
116 |
$output = '';
|
117 |
|
118 |
// capabilities select
|
119 |
-
$output .= '<div class="groups-
|
120 |
-
$applicable_read_caps = Groups_Options::get_option( Groups_Post_Access::READ_POST_CAPABILITIES, array( Groups_Post_Access::READ_POST_CAPABILITY ) );
|
121 |
$output .= sprintf(
|
122 |
-
'<select class="select
|
123 |
-
esc_attr( Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
124 |
-
esc_attr( __( '
|
125 |
-
esc_attr( __( '
|
126 |
);
|
127 |
|
128 |
$previous_selected = array();
|
129 |
-
if ( !empty( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
130 |
-
$previous_selected = $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
131 |
if ( !is_array( $previous_selected ) ) {
|
132 |
$previous_selected = array();
|
133 |
}
|
134 |
}
|
135 |
$selected = in_array( self::NOT_RESTRICTED, $previous_selected ) ? ' selected="selected" ' : '';
|
136 |
-
$output .= sprintf( '<option value="%s" %s >%s</option>', self::NOT_RESTRICTED, esc_attr( $selected ), esc_attr( __( '(only unrestricted)',
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
$
|
|
|
141 |
}
|
142 |
$output .= '</select>';
|
143 |
$output .= '</div>';
|
144 |
-
$output .= Groups_UIE::render_select( '.select.
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
echo $output;
|
147 |
}
|
148 |
|
@@ -152,7 +176,7 @@ class Groups_Admin_Posts {
|
|
152 |
}
|
153 |
|
154 |
/**
|
155 |
-
* Bulk-edit access restriction
|
156 |
*
|
157 |
* @param string $column_name
|
158 |
* @param string $post_type
|
@@ -161,8 +185,7 @@ class Groups_Admin_Posts {
|
|
161 |
|
162 |
global $pagenow, $wpdb;
|
163 |
|
164 |
-
if ( $column_name ==
|
165 |
-
|
166 |
if ( $pagenow == 'edit.php' ) { // check that we're on the right screen
|
167 |
|
168 |
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
@@ -171,44 +194,47 @@ class Groups_Admin_Posts {
|
|
171 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
172 |
|
173 |
$output = '<fieldset class="inline-edit-col-right">';
|
174 |
-
$output .= '<div class="bulk-edit-groups">';
|
175 |
|
176 |
// capability/access restriction bulk actions added through extra_tablenav()
|
177 |
-
$output .= '<div id="
|
178 |
|
179 |
$output .= '<label style="display:inline;">';
|
180 |
$output .= '<span class="title">';
|
181 |
-
$output .= __( '
|
182 |
$output .= '</span>';
|
183 |
-
$output .= '<select class="
|
184 |
-
$output .= '<option selected="selected" value="-1">' . __( '— No Change —',
|
185 |
-
$output .= '<option value="add-
|
186 |
-
$output .= '<option value="remove-
|
187 |
$output .= '</select>';
|
188 |
$output .= '</label>';
|
189 |
|
190 |
-
$
|
191 |
-
$
|
|
|
|
|
|
|
192 |
$output .= sprintf(
|
193 |
-
'<select class="select bulk-
|
194 |
-
esc_attr( Groups_Post_Access::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access::
|
195 |
-
esc_attr( __( 'Choose access
|
196 |
-
esc_attr( __( 'Choose access
|
197 |
);
|
198 |
|
199 |
-
foreach( $
|
200 |
-
$output .= sprintf( '<option value="%s" >%s</option>', esc_attr( $
|
201 |
}
|
202 |
$output .= '</select>';
|
203 |
-
$output .= '</div>'; // .groups-
|
204 |
-
$output .= Groups_UIE::render_select( '.select.bulk-
|
205 |
|
206 |
-
$output .= '</div>'; // .
|
207 |
|
208 |
$output .= '</div>'; // .bulk-edit-groups
|
209 |
$output .= '</fieldset>'; // .inline-edit-col-right
|
210 |
|
211 |
-
$output .= wp_nonce_field( 'post-
|
212 |
|
213 |
echo $output;
|
214 |
}
|
@@ -217,7 +243,7 @@ class Groups_Admin_Posts {
|
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
-
* Handles access restriction
|
221 |
* This is called once for each post that is included in bulk-editing.
|
222 |
* The fields that are handled here are rendered through the
|
223 |
* bulk_edit_custom_box() method in this class.
|
@@ -225,24 +251,30 @@ class Groups_Admin_Posts {
|
|
225 |
* @param int $post_id
|
226 |
*/
|
227 |
public static function save_post( $post_id ) {
|
228 |
-
if ( isset( $_REQUEST['
|
229 |
-
if ( wp_verify_nonce( $_REQUEST['bulk-post-
|
230 |
-
$field = Groups_Post_Access::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access::
|
231 |
if ( !empty( $_REQUEST[$field] ) && is_array( $_REQUEST[$field] ) ) {
|
232 |
if ( Groups_Access_Meta_Boxes::user_can_restrict() ) {
|
233 |
-
$
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
Groups_Post_Access::create( array(
|
240 |
'post_id' => $post_id,
|
241 |
-
'
|
242 |
) );
|
243 |
break;
|
244 |
-
case 'remove-
|
245 |
-
Groups_Post_Access::delete( $post_id, $
|
246 |
break;
|
247 |
}
|
248 |
}
|
@@ -255,7 +287,7 @@ class Groups_Admin_Posts {
|
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
-
* Query modifier to take the selected access restriction
|
259 |
* account.
|
260 |
*
|
261 |
* @param WP_Query $query query object passed by reference
|
@@ -273,23 +305,23 @@ class Groups_Admin_Posts {
|
|
273 |
|
274 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
275 |
|
276 |
-
if ( !empty( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
277 |
-
is_array( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
278 |
) {
|
279 |
|
280 |
$include_unrestricted = false;
|
281 |
-
if ( in_array( self::NOT_RESTRICTED, $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
282 |
$include_unrestricted = true;
|
283 |
}
|
284 |
|
285 |
-
$
|
286 |
-
foreach ( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
287 |
-
if (
|
288 |
-
$
|
289 |
}
|
290 |
}
|
291 |
|
292 |
-
if ( !empty( $
|
293 |
if ( $include_unrestricted ) {
|
294 |
// meta_query does not handle a conjunction
|
295 |
// on the same meta field correctly
|
@@ -297,12 +329,12 @@ class Groups_Admin_Posts {
|
|
297 |
// $query->query_vars['meta_query'] = array (
|
298 |
// 'relation' => 'OR',
|
299 |
// array (
|
300 |
-
// 'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
301 |
-
// 'value' => $
|
302 |
// 'compare' => 'IN'
|
303 |
// ),
|
304 |
// array (
|
305 |
-
// 'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
306 |
// 'compare' => 'NOT EXISTS'
|
307 |
// )
|
308 |
// );
|
@@ -310,15 +342,15 @@ class Groups_Admin_Posts {
|
|
310 |
// until the above is solved
|
311 |
$query->query_vars['meta_query'] = array (
|
312 |
array (
|
313 |
-
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
314 |
'compare' => 'NOT EXISTS'
|
315 |
)
|
316 |
);
|
317 |
} else {
|
318 |
$query->query_vars['meta_query'] = array (
|
319 |
array (
|
320 |
-
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
321 |
-
'value' => $
|
322 |
'compare' => 'IN'
|
323 |
)
|
324 |
);
|
@@ -326,7 +358,7 @@ class Groups_Admin_Posts {
|
|
326 |
} else if ( $include_unrestricted ) {
|
327 |
$query->query_vars['meta_query'] = array (
|
328 |
array (
|
329 |
-
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::
|
330 |
'compare' => 'NOT EXISTS'
|
331 |
)
|
332 |
);
|
@@ -339,5 +371,211 @@ class Groups_Admin_Posts {
|
|
339 |
|
340 |
}
|
341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
343 |
Groups_Admin_Posts::init();
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* Additions to post overview admin screens:
|
28 |
+
* - Filter posts by group.
|
29 |
+
* - Apply bulk actions to add or remove group access restrictions.
|
30 |
*/
|
31 |
class Groups_Admin_Posts {
|
32 |
|
33 |
+
/**
|
34 |
+
* Field name
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
const GROUPS_READ = 'groups-read';
|
38 |
+
|
39 |
const NOT_RESTRICTED = "#not-restricted#";
|
40 |
|
41 |
/**
|
54 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin_enqueue_scripts' ) );
|
55 |
add_action( 'admin_head', array( __CLASS__, 'admin_head' ) );
|
56 |
add_action( 'restrict_manage_posts', array( __CLASS__, 'restrict_manage_posts' ) );
|
57 |
+
// add_filter( 'parse_query', array( __CLASS__, 'parse_query' ) );
|
58 |
+
|
59 |
+
add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
|
60 |
+
add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
|
61 |
+
add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ), 10, 2 );
|
62 |
|
63 |
add_action( 'bulk_edit_custom_box', array( __CLASS__, 'bulk_edit_custom_box' ), 10, 2);
|
64 |
add_action( 'save_post', array( __CLASS__, 'save_post' ) );
|
93 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
94 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
95 |
echo '<style type="text/css">';
|
96 |
+
echo '.groups-groups-container { display: inline-block; line-height: 24px; padding-bottom: 1em; vertical-align: top; margin-left: 4px; margin-right: 4px; }';
|
97 |
+
echo '.groups-groups-container .groups-select-container { display: inline-block; vertical-align: top; }';
|
98 |
+
echo '.groups-groups-container .groups-select-container select, .groups-bulk-container select.groups-action { float: none; margin-right: 4px; vertical-align: top; }';
|
99 |
+
echo '.groups-groups-container .selectize-control { min-width: 128px; }';
|
100 |
+
echo '.groups-groups-container .selectize-control, .groups-bulk-container select.groups-action { margin-right: 4px; vertical-align: top; }';
|
101 |
+
echo '.groups-groups-container .selectize-input { font-size: inherit; line-height: 18px; padding: 1px 2px 2px 2px; vertical-align: middle; }';
|
102 |
+
echo '.groups-groups-container .selectize-input input[type="text"] { font-size: inherit; vertical-align: middle; }';
|
103 |
+
echo '.groups-groups-container input.button { margin-top: 1px; vertical-align: top; }';
|
104 |
echo '.inline-edit-row fieldset .capabilities-bulk-container label span.title { min-width: 5em; padding: 2px 1em; width: auto; }';
|
105 |
echo '.tablenav .actions { overflow: visible; }'; // this is important so that the selectize options aren't hidden
|
106 |
echo '.wp-list-table td { overflow: visible; }'; // idem for bulk actions
|
107 |
+
echo 'label.groups-read-terms {vertical-align: middle; line-height: 28px; margin-right: 4px; }'; // Terms checkbox
|
108 |
echo '</style>';
|
109 |
}
|
110 |
}
|
111 |
}
|
112 |
|
113 |
/**
|
114 |
+
* Renders the groups access restriction filter field.
|
115 |
*/
|
116 |
public static function restrict_manage_posts() {
|
117 |
|
129 |
$output = '';
|
130 |
|
131 |
// capabilities select
|
132 |
+
$output .= '<div class="groups-groups-container">';
|
|
|
133 |
$output .= sprintf(
|
134 |
+
'<select class="select group" name="%s[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
135 |
+
esc_attr( Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ ),
|
136 |
+
esc_attr( __( 'Groups …', 'groups' ) ) ,
|
137 |
+
esc_attr( __( 'Groups …', 'groups' ) )
|
138 |
);
|
139 |
|
140 |
$previous_selected = array();
|
141 |
+
if ( !empty( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] ) ) {
|
142 |
+
$previous_selected = $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ];
|
143 |
if ( !is_array( $previous_selected ) ) {
|
144 |
$previous_selected = array();
|
145 |
}
|
146 |
}
|
147 |
$selected = in_array( self::NOT_RESTRICTED, $previous_selected ) ? ' selected="selected" ' : '';
|
148 |
+
$output .= sprintf( '<option value="%s" %s >%s</option>', self::NOT_RESTRICTED, esc_attr( $selected ), esc_attr( __( '(only unrestricted)', 'groups' ) ) );
|
149 |
|
150 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC' ) );
|
151 |
+
foreach( $groups as $group ) {
|
152 |
+
$selected = in_array( $group->group_id, $previous_selected ) ? ' selected="selected" ' : '';
|
153 |
+
$output .= sprintf( '<option value="%s" %s >%s</option>', esc_attr( $group->group_id ), esc_attr( $selected ), wp_filter_nohtml_kses( $group->name ) );
|
154 |
}
|
155 |
$output .= '</select>';
|
156 |
$output .= '</div>';
|
157 |
+
$output .= Groups_UIE::render_select( '.select.group' );
|
158 |
|
159 |
+
if (
|
160 |
+
function_exists( 'get_term_meta' ) && // >= WordPress 4.4.0 as we query the termmeta table
|
161 |
+
class_exists( 'Groups_Restrict_Categories' ) &&
|
162 |
+
method_exists( 'Groups_Restrict_Categories', 'get_controlled_taxonomies' ) &&
|
163 |
+
method_exists( 'Groups_Restrict_Categories', 'get_term_read_groups' ) // >= Groups Restrict Categories 2.0.0, the method isn't used here but it wouldn't make any sense to query unless we're >= 2.0.0
|
164 |
+
) {
|
165 |
+
$output .= sprintf( '<label class="groups-read-terms" title="%s">', esc_attr( __( 'Also look for groups related to terms', 'groups' ) ) );
|
166 |
+
$output .= sprintf( '<input type="checkbox" name="groups-read-terms" value="1" %s />', empty( $_GET['groups-read-terms'] ) ? '' : ' checked="checked" ' );
|
167 |
+
$output .= __( 'Terms', 'groups' );
|
168 |
+
$output .= '</label>';
|
169 |
+
}
|
170 |
echo $output;
|
171 |
}
|
172 |
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
+
* Bulk-edit access restriction groups.
|
180 |
*
|
181 |
* @param string $column_name
|
182 |
* @param string $post_type
|
185 |
|
186 |
global $pagenow, $wpdb;
|
187 |
|
188 |
+
if ( $column_name == self::GROUPS_READ ) {
|
|
|
189 |
if ( $pagenow == 'edit.php' ) { // check that we're on the right screen
|
190 |
|
191 |
$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post';
|
194 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
195 |
|
196 |
$output = '<fieldset class="inline-edit-col-right">';
|
197 |
+
$output .= '<div class="bulk-edit-groups" style="padding:0 0.5em;">';
|
198 |
|
199 |
// capability/access restriction bulk actions added through extra_tablenav()
|
200 |
+
$output .= '<div id="group-bulk-actions" class="groups-bulk-container" style="display:inline">';
|
201 |
|
202 |
$output .= '<label style="display:inline;">';
|
203 |
$output .= '<span class="title">';
|
204 |
+
$output .= __( 'Groups', 'groups' );
|
205 |
$output .= '</span>';
|
206 |
+
$output .= '<select class="groups-action" name="groups-action">';
|
207 |
+
$output .= '<option selected="selected" value="-1">' . __( '— No Change —', 'groups' ) . '</option>';
|
208 |
+
$output .= '<option value="add-group">' . __( 'Add restriction', 'groups' ) . '</option>';
|
209 |
+
$output .= '<option value="remove-group">' . __( 'Remove restriction', 'groups' ) . '</option>';
|
210 |
$output .= '</select>';
|
211 |
$output .= '</label>';
|
212 |
|
213 |
+
$user = new Groups_User( get_current_user_id() );
|
214 |
+
$include = $user->group_ids_deep;
|
215 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
216 |
+
|
217 |
+
$output .= '<div class="groups-groups-container">';
|
218 |
$output .= sprintf(
|
219 |
+
'<select class="select bulk-group" name="%s[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
220 |
+
esc_attr( Groups_Post_Access::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access::READ ),
|
221 |
+
esc_attr( __( 'Choose access restriction groups …', 'groups' ) ) ,
|
222 |
+
esc_attr( __( 'Choose access restriction groups …', 'groups' ) )
|
223 |
);
|
224 |
|
225 |
+
foreach( $groups as $group ) {
|
226 |
+
$output .= sprintf( '<option value="%s" >%s</option>', esc_attr( $group->group_id ), wp_filter_nohtml_kses( $group->name ) );
|
227 |
}
|
228 |
$output .= '</select>';
|
229 |
+
$output .= '</div>'; // .groups-groups-container
|
230 |
+
$output .= Groups_UIE::render_select( '.select.bulk-group' );
|
231 |
|
232 |
+
$output .= '</div>'; // .groups-bulk-container
|
233 |
|
234 |
$output .= '</div>'; // .bulk-edit-groups
|
235 |
$output .= '</fieldset>'; // .inline-edit-col-right
|
236 |
|
237 |
+
$output .= wp_nonce_field( 'post-group', 'bulk-post-group-nonce', true, false );
|
238 |
|
239 |
echo $output;
|
240 |
}
|
243 |
}
|
244 |
|
245 |
/**
|
246 |
+
* Handles access restriction group modifications from bulk-editing.
|
247 |
* This is called once for each post that is included in bulk-editing.
|
248 |
* The fields that are handled here are rendered through the
|
249 |
* bulk_edit_custom_box() method in this class.
|
251 |
* @param int $post_id
|
252 |
*/
|
253 |
public static function save_post( $post_id ) {
|
254 |
+
if ( isset( $_REQUEST['groups-action'] ) ) {
|
255 |
+
if ( wp_verify_nonce( $_REQUEST['bulk-post-group-nonce'], 'post-group' ) ) {
|
256 |
+
$field = Groups_Post_Access::POSTMETA_PREFIX . 'bulk-' . Groups_Post_Access::READ;
|
257 |
if ( !empty( $_REQUEST[$field] ) && is_array( $_REQUEST[$field] ) ) {
|
258 |
if ( Groups_Access_Meta_Boxes::user_can_restrict() ) {
|
259 |
+
$user = new Groups_User( get_current_user_id() );
|
260 |
+
$include = $user->group_ids_deep;
|
261 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC', 'include' => $include ) );
|
262 |
+
$group_ids = array();
|
263 |
+
foreach( $groups as $group ) {
|
264 |
+
$group_ids[] = $group->group_id;
|
265 |
+
}
|
266 |
+
foreach( $_REQUEST[$field] as $group_id ) {
|
267 |
+
if ( $group = Groups_Group::read( $group_id ) ) {
|
268 |
+
if ( in_array( $group->group_id, $group_ids ) ) {
|
269 |
+
switch( $_REQUEST['groups-action'] ) {
|
270 |
+
case 'add-group' :
|
271 |
Groups_Post_Access::create( array(
|
272 |
'post_id' => $post_id,
|
273 |
+
'group_id' => $group->group_id
|
274 |
) );
|
275 |
break;
|
276 |
+
case 'remove-group' :
|
277 |
+
Groups_Post_Access::delete( $post_id, array( 'groups_read' => $group->group_id ) );
|
278 |
break;
|
279 |
}
|
280 |
}
|
287 |
}
|
288 |
|
289 |
/**
|
290 |
+
* Query modifier to take the selected access restriction groups into
|
291 |
* account.
|
292 |
*
|
293 |
* @param WP_Query $query query object passed by reference
|
305 |
|
306 |
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
307 |
|
308 |
+
if ( !empty( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] ) &&
|
309 |
+
is_array( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] )
|
310 |
) {
|
311 |
|
312 |
$include_unrestricted = false;
|
313 |
+
if ( in_array( self::NOT_RESTRICTED, $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] ) ) {
|
314 |
$include_unrestricted = true;
|
315 |
}
|
316 |
|
317 |
+
$group_ids = array();
|
318 |
+
foreach ( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] as $group_id ) {
|
319 |
+
if ( Groups_Group::read( $group_id ) ) {
|
320 |
+
$group_ids[] = $group_id;
|
321 |
}
|
322 |
}
|
323 |
|
324 |
+
if ( !empty( $group_ids ) ) {
|
325 |
if ( $include_unrestricted ) {
|
326 |
// meta_query does not handle a conjunction
|
327 |
// on the same meta field correctly
|
329 |
// $query->query_vars['meta_query'] = array (
|
330 |
// 'relation' => 'OR',
|
331 |
// array (
|
332 |
+
// 'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ,
|
333 |
+
// 'value' => $group_ids,
|
334 |
// 'compare' => 'IN'
|
335 |
// ),
|
336 |
// array (
|
337 |
+
// 'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ,
|
338 |
// 'compare' => 'NOT EXISTS'
|
339 |
// )
|
340 |
// );
|
342 |
// until the above is solved
|
343 |
$query->query_vars['meta_query'] = array (
|
344 |
array (
|
345 |
+
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ,
|
346 |
'compare' => 'NOT EXISTS'
|
347 |
)
|
348 |
);
|
349 |
} else {
|
350 |
$query->query_vars['meta_query'] = array (
|
351 |
array (
|
352 |
+
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ,
|
353 |
+
'value' => $group_ids,
|
354 |
'compare' => 'IN'
|
355 |
)
|
356 |
);
|
358 |
} else if ( $include_unrestricted ) {
|
359 |
$query->query_vars['meta_query'] = array (
|
360 |
array (
|
361 |
+
'key' => Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ,
|
362 |
'compare' => 'NOT EXISTS'
|
363 |
)
|
364 |
);
|
371 |
|
372 |
}
|
373 |
|
374 |
+
/**
|
375 |
+
* Filters out posts by group. This is used when you choose groups on the post admin screen so that
|
376 |
+
* only those posts who are restricted by groups are shown.
|
377 |
+
*
|
378 |
+
* @param string $where
|
379 |
+
* @param WP_Query $query
|
380 |
+
* @return string
|
381 |
+
*/
|
382 |
+
public static function posts_where( $where, $query ) {
|
383 |
+
|
384 |
+
global $wpdb;
|
385 |
+
|
386 |
+
if ( self::extend_for_filter_groups_read( $query ) ) {
|
387 |
+
|
388 |
+
$group_ids = array();
|
389 |
+
foreach ( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] as $group_id ) {
|
390 |
+
if ( $group_id = Groups_Utility::id( $group_id ) ) {
|
391 |
+
if ( Groups_Group::read( $group_id ) ) {
|
392 |
+
$group_ids[] = $group_id;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
if ( !empty( $group_ids ) ) {
|
398 |
+
$groups = ' ( ' . implode(',', $group_ids ) . ' ) ';
|
399 |
+
$group_table = _groups_get_tablename( 'group' );
|
400 |
+
if (
|
401 |
+
!empty( $_GET['groups-read-terms'] ) &&
|
402 |
+
function_exists( 'get_term_meta' ) && // >= WordPress 4.4.0 as we query the termmeta table
|
403 |
+
class_exists( 'Groups_Restrict_Categories' ) &&
|
404 |
+
method_exists( 'Groups_Restrict_Categories', 'get_controlled_taxonomies' ) &&
|
405 |
+
method_exists( 'Groups_Restrict_Categories', 'get_term_read_groups' ) // >= Groups Restrict Categories 2.0.0, the method isn't used here but it wouldn't make any sense to query unless we're >= 2.0.0
|
406 |
+
) {
|
407 |
+
$where .= "
|
408 |
+
AND $wpdb->posts.ID IN (
|
409 |
+
SELECT post_id
|
410 |
+
FROM $wpdb->postmeta pm
|
411 |
+
WHERE
|
412 |
+
pm.meta_key = 'groups-read' AND
|
413 |
+
pm.meta_value IN $groups
|
414 |
+
UNION ALL
|
415 |
+
SELECT p.ID post_id
|
416 |
+
FROM $wpdb->posts p
|
417 |
+
LEFT JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id
|
418 |
+
LEFT JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
419 |
+
LEFT JOIN $wpdb->termmeta tm ON tt.term_id = tm.term_id
|
420 |
+
WHERE
|
421 |
+
tm.meta_key = 'groups-read' AND
|
422 |
+
tm.meta_value IN $groups
|
423 |
+
)
|
424 |
+
";
|
425 |
+
} else {
|
426 |
+
$where .= "
|
427 |
+
AND $wpdb->posts.ID IN (
|
428 |
+
SELECT post_id
|
429 |
+
FROM $wpdb->postmeta pm
|
430 |
+
WHERE
|
431 |
+
pm.meta_key = 'groups-read' AND
|
432 |
+
pm.meta_value IN $groups
|
433 |
+
)
|
434 |
+
";
|
435 |
+
}
|
436 |
+
} // !empty( $group_ids )
|
437 |
+
|
438 |
+
}
|
439 |
+
|
440 |
+
return $where;
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Adds to the join to allow advanced sorting by group on the admin back end for post tables.
|
445 |
+
*
|
446 |
+
* @param string $join
|
447 |
+
* @param WP_Query $query
|
448 |
+
*/
|
449 |
+
public static function posts_join( $join, $query ) {
|
450 |
+
global $wpdb;
|
451 |
+
if ( self::extend_for_orderby_groups_read( $query ) ) {
|
452 |
+
$group_table = _groups_get_tablename( 'group' );
|
453 |
+
if ( function_exists( 'get_term_meta' ) ) { // >= WordPress 4.4.0 as we query the termmeta table
|
454 |
+
$join .= "
|
455 |
+
LEFT JOIN (
|
456 |
+
SELECT p.ID post_id, GROUP_CONCAT(DISTINCT groups_read.group_name ORDER BY groups_read.group_name) groups
|
457 |
+
FROM $wpdb->posts p
|
458 |
+
LEFT JOIN (
|
459 |
+
SELECT post_id, g.name group_name
|
460 |
+
FROM $wpdb->postmeta pm
|
461 |
+
LEFT JOIN $group_table g ON pm.meta_value = g.group_id
|
462 |
+
WHERE pm.meta_key = 'groups-read'
|
463 |
+
UNION ALL
|
464 |
+
SELECT p.ID post_id, g.name group_name
|
465 |
+
FROM $wpdb->posts p
|
466 |
+
LEFT JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id
|
467 |
+
LEFT JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
468 |
+
LEFT JOIN $wpdb->termmeta tm ON tt.term_id = tm.term_id
|
469 |
+
LEFT JOIN $group_table g ON tm.meta_value = g.group_id
|
470 |
+
WHERE tm.meta_key = 'groups-read'
|
471 |
+
) as groups_read ON p.ID = groups_read.post_id
|
472 |
+
GROUP BY p.ID
|
473 |
+
) groups_tmp ON $wpdb->posts.ID = groups_tmp.post_id
|
474 |
+
";
|
475 |
+
} else {
|
476 |
+
$join .= "
|
477 |
+
LEFT JOIN (
|
478 |
+
SELECT p.ID post_id, GROUP_CONCAT(DISTINCT groups_read.group_name ORDER BY groups_read.group_name) groups
|
479 |
+
FROM $wpdb->posts p
|
480 |
+
LEFT JOIN (
|
481 |
+
SELECT post_id, g.name group_name
|
482 |
+
FROM $wpdb->postmeta pm
|
483 |
+
LEFT JOIN $group_table g ON pm.meta_value = g.group_id
|
484 |
+
WHERE pm.meta_key = 'groups-read'
|
485 |
+
) as groups_read ON p.ID = groups_read.post_id
|
486 |
+
GROUP BY p.ID
|
487 |
+
) groups_tmp ON $wpdb->posts.ID = groups_tmp.post_id
|
488 |
+
";
|
489 |
+
}
|
490 |
+
}
|
491 |
+
return $join;
|
492 |
+
}
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Extend the orderby clause to sort by groups related to the post and its terms.
|
496 |
+
*
|
497 |
+
* @param $string $orderby
|
498 |
+
* @param WP_Query $query
|
499 |
+
* @return string
|
500 |
+
*/
|
501 |
+
public static function posts_orderby( $orderby, $query ) {
|
502 |
+
if ( self::extend_for_orderby_groups_read( $query ) ) {
|
503 |
+
switch( $query->get( 'order' ) ) {
|
504 |
+
case 'desc' :
|
505 |
+
case 'DESC' :
|
506 |
+
$order = 'DESC';
|
507 |
+
break;
|
508 |
+
default :
|
509 |
+
$order = 'ASC';
|
510 |
+
}
|
511 |
+
$prefix = ' groups_tmp.groups ' . $order;
|
512 |
+
if ( !empty( $orderby ) ) {
|
513 |
+
$prefix .= ' , ';
|
514 |
+
}
|
515 |
+
$orderby = $prefix . $orderby;
|
516 |
+
}
|
517 |
+
return $orderby;
|
518 |
+
}
|
519 |
+
|
520 |
+
/**
|
521 |
+
* Check if we should apply our posts_join and posts_orderby filters. Used in those.
|
522 |
+
*
|
523 |
+
* @param WP_Query $query
|
524 |
+
* @return boolean
|
525 |
+
*/
|
526 |
+
private static function extend_for_orderby_groups_read( &$query ) {
|
527 |
+
$result = false;
|
528 |
+
if ( is_admin() ) {
|
529 |
+
// check if query is for a post type we handle
|
530 |
+
$post_type = $query->get( 'post_type' );
|
531 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
532 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
533 |
+
// only act on post etc. screens
|
534 |
+
$screen = get_current_screen();
|
535 |
+
if (
|
536 |
+
!empty( $screen ) &&
|
537 |
+
!empty( $screen->id ) &&
|
538 |
+
( $screen->id == 'edit-' . $post_type )
|
539 |
+
) {
|
540 |
+
if ( $query->get( 'orderby' ) == self::GROUPS_READ ) {
|
541 |
+
$result = true;
|
542 |
+
}
|
543 |
+
}
|
544 |
+
}
|
545 |
+
}
|
546 |
+
return $result;
|
547 |
+
}
|
548 |
+
|
549 |
+
/**
|
550 |
+
* Check if we should apply our posts_where filter. Used in it.
|
551 |
+
*
|
552 |
+
* @param WP_Query $query
|
553 |
+
* @return boolean
|
554 |
+
*/
|
555 |
+
private static function extend_for_filter_groups_read( &$query ) {
|
556 |
+
$result = false;
|
557 |
+
if ( is_admin() ) {
|
558 |
+
// check if query is for a post type we handle
|
559 |
+
$post_type = $query->get( 'post_type' );
|
560 |
+
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
561 |
+
if ( !isset( $post_types_option[$post_type]['add_meta_box'] ) || $post_types_option[$post_type]['add_meta_box'] ) {
|
562 |
+
// only act on post etc. screens
|
563 |
+
$screen = get_current_screen();
|
564 |
+
if (
|
565 |
+
!empty( $screen ) &&
|
566 |
+
!empty( $screen->id ) &&
|
567 |
+
( $screen->id == 'edit-' . $post_type )
|
568 |
+
) {
|
569 |
+
if (
|
570 |
+
!empty( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] ) &&
|
571 |
+
is_array( $_GET[Groups_Post_Access::POSTMETA_PREFIX . Groups_Post_Access::READ] )
|
572 |
+
) {
|
573 |
+
$result = true;
|
574 |
+
}
|
575 |
+
}
|
576 |
+
}
|
577 |
+
}
|
578 |
+
return $result;
|
579 |
+
}
|
580 |
}
|
581 |
Groups_Admin_Posts::init();
|
lib/admin/class-groups-admin-user-profile.php
CHANGED
@@ -32,6 +32,8 @@ class Groups_Admin_User_Profile {
|
|
32 |
* Adds user profile actions.
|
33 |
*/
|
34 |
public static function init() {
|
|
|
|
|
35 |
add_action( 'show_user_profile', array( __CLASS__, 'show_user_profile' ) );
|
36 |
add_action( 'edit_user_profile', array( __CLASS__, 'edit_user_profile' ) );
|
37 |
add_action( 'personal_options_update', array( __CLASS__, 'personal_options_update' ) );
|
@@ -46,6 +48,7 @@ class Groups_Admin_User_Profile {
|
|
46 |
$screen = get_current_screen();
|
47 |
if ( isset( $screen->id ) ) {
|
48 |
switch( $screen->id ) {
|
|
|
49 |
case 'user-edit' :
|
50 |
case 'profile' :
|
51 |
require_once GROUPS_VIEWS_LIB . '/class-groups-uie.php';
|
@@ -55,6 +58,70 @@ class Groups_Admin_User_Profile {
|
|
55 |
}
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* Own profile.
|
60 |
* @param WP_User $user
|
@@ -63,7 +130,7 @@ class Groups_Admin_User_Profile {
|
|
63 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
64 |
self::edit_user_profile( $user );
|
65 |
} else {
|
66 |
-
$output = '<h3>' . __( 'Groups',
|
67 |
$user = new Groups_User( $user->ID );
|
68 |
$groups = $user->groups;
|
69 |
if ( is_array( $groups ) ) {
|
@@ -87,7 +154,7 @@ class Groups_Admin_User_Profile {
|
|
87 |
public static function edit_user_profile( $user ) {
|
88 |
global $wpdb;
|
89 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
90 |
-
$output = '<h3>' . __( 'Groups',
|
91 |
$user = new Groups_User( $user->ID );
|
92 |
$user_groups = $user->groups;
|
93 |
$groups_table = _groups_get_tablename( 'group' );
|
@@ -97,8 +164,8 @@ class Groups_Admin_User_Profile {
|
|
97 |
$output .= '</style>';
|
98 |
$output .= sprintf(
|
99 |
'<select id="user-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
100 |
-
esc_attr( __( 'Choose groups …',
|
101 |
-
esc_attr( __( 'Choose groups …',
|
102 |
);
|
103 |
foreach( $groups as $group ) {
|
104 |
$is_member = Groups_User_Group::read( $user->ID, $group->group_id ) ? true : false;
|
@@ -106,7 +173,7 @@ class Groups_Admin_User_Profile {
|
|
106 |
}
|
107 |
$output .= '</select>';
|
108 |
$output .= Groups_UIE::render_select( '#user-groups' );
|
109 |
-
$output .= '<p class="description">' . __( 'The user is a member of the chosen groups.',
|
110 |
}
|
111 |
echo $output;
|
112 |
}
|
32 |
* Adds user profile actions.
|
33 |
*/
|
34 |
public static function init() {
|
35 |
+
add_action( 'user_new_form', array( __CLASS__, 'user_new_form' ) );
|
36 |
+
add_action( 'user_register', array( __CLASS__, 'user_register' ) );
|
37 |
add_action( 'show_user_profile', array( __CLASS__, 'show_user_profile' ) );
|
38 |
add_action( 'edit_user_profile', array( __CLASS__, 'edit_user_profile' ) );
|
39 |
add_action( 'personal_options_update', array( __CLASS__, 'personal_options_update' ) );
|
48 |
$screen = get_current_screen();
|
49 |
if ( isset( $screen->id ) ) {
|
50 |
switch( $screen->id ) {
|
51 |
+
case 'user' : // creating a new user
|
52 |
case 'user-edit' :
|
53 |
case 'profile' :
|
54 |
require_once GROUPS_VIEWS_LIB . '/class-groups-uie.php';
|
58 |
}
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* Hook for the form to create a new user.
|
63 |
+
*
|
64 |
+
* See wp-admin/user-new.php
|
65 |
+
*
|
66 |
+
* @param string $type form context, expecting 'add-existing-user' (Multisite), or 'add-new-user' (single site and network admin)
|
67 |
+
*/
|
68 |
+
public static function user_new_form( $type = null ) {
|
69 |
+
global $wpdb;
|
70 |
+
if ( $type == 'add-new-user' ) {
|
71 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
72 |
+
$output = '<h3>' . __( 'Groups', 'groups' ) . '</h3>';
|
73 |
+
$groups_table = _groups_get_tablename( 'group' );
|
74 |
+
if ( $groups = $wpdb->get_results( "SELECT * FROM $groups_table ORDER BY name" ) ) {
|
75 |
+
$output .= '<style type="text/css">';
|
76 |
+
$output .= '.groups .selectize-input { font-size: inherit; }';
|
77 |
+
$output .= '</style>';
|
78 |
+
$output .= sprintf(
|
79 |
+
'<select id="user-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
80 |
+
esc_attr( __( 'Choose groups …', 'groups' ) ) ,
|
81 |
+
esc_attr( __( 'Choose groups …', 'groups' ) )
|
82 |
+
);
|
83 |
+
foreach( $groups as $group ) {
|
84 |
+
$output .= sprintf( '<option value="%d">%s</option>', Groups_Utility::id( $group->group_id ), wp_filter_nohtml_kses( $group->name ) );
|
85 |
+
}
|
86 |
+
$output .= '</select>';
|
87 |
+
$output .= Groups_UIE::render_select( '#user-groups' );
|
88 |
+
$output .= '<p class="description">' . __( 'The user is a member of the chosen groups.', 'groups' ) . '</p>';
|
89 |
+
}
|
90 |
+
echo $output;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Adds the new user to chosen groups when creating a new user account
|
97 |
+
* from the admin side.
|
98 |
+
*
|
99 |
+
* @param int $user_id
|
100 |
+
*/
|
101 |
+
public static function user_register( $user_id ) {
|
102 |
+
|
103 |
+
global $wpdb;
|
104 |
+
|
105 |
+
if ( is_admin() ) {
|
106 |
+
$screen = get_current_screen();
|
107 |
+
if ( isset( $screen->id ) && $screen->id === 'user' ) {
|
108 |
+
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
109 |
+
$groups_table = _groups_get_tablename( 'group' );
|
110 |
+
if ( $groups = $wpdb->get_results( "SELECT * FROM $groups_table" ) ) {
|
111 |
+
$user_group_ids = isset( $_POST['group_ids'] ) && is_array( $_POST['group_ids'] ) ? $_POST['group_ids'] : array();
|
112 |
+
foreach( $groups as $group ) {
|
113 |
+
if ( in_array( $group->group_id, $user_group_ids ) ) {
|
114 |
+
if ( !Groups_User_Group::read( $user_id, $group->group_id ) ) {
|
115 |
+
Groups_User_Group::create( array( 'user_id' => $user_id, 'group_id' => $group->group_id ) );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
/**
|
126 |
* Own profile.
|
127 |
* @param WP_User $user
|
130 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
131 |
self::edit_user_profile( $user );
|
132 |
} else {
|
133 |
+
$output = '<h3>' . __( 'Groups', 'groups' ) . '</h3>';
|
134 |
$user = new Groups_User( $user->ID );
|
135 |
$groups = $user->groups;
|
136 |
if ( is_array( $groups ) ) {
|
154 |
public static function edit_user_profile( $user ) {
|
155 |
global $wpdb;
|
156 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
157 |
+
$output = '<h3>' . __( 'Groups', 'groups' ) . '</h3>';
|
158 |
$user = new Groups_User( $user->ID );
|
159 |
$user_groups = $user->groups;
|
160 |
$groups_table = _groups_get_tablename( 'group' );
|
164 |
$output .= '</style>';
|
165 |
$output .= sprintf(
|
166 |
'<select id="user-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
167 |
+
esc_attr( __( 'Choose groups …', 'groups' ) ) ,
|
168 |
+
esc_attr( __( 'Choose groups …', 'groups' ) )
|
169 |
);
|
170 |
foreach( $groups as $group ) {
|
171 |
$is_member = Groups_User_Group::read( $user->ID, $group->group_id ) ? true : false;
|
173 |
}
|
174 |
$output .= '</select>';
|
175 |
$output .= Groups_UIE::render_select( '#user-groups' );
|
176 |
+
$output .= '<p class="description">' . __( 'The user is a member of the chosen groups.', 'groups' ) . '</p>';
|
177 |
}
|
178 |
echo $output;
|
179 |
}
|
lib/admin/class-groups-admin-users.php
CHANGED
@@ -81,19 +81,26 @@ class Groups_Admin_Users {
|
|
81 |
public static function pre_user_query( $user_query ) {
|
82 |
global $pagenow, $wpdb;
|
83 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
84 |
-
if ( isset( $_REQUEST['
|
85 |
-
$
|
86 |
-
|
87 |
-
|
88 |
-
$
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
-
|
95 |
-
$
|
96 |
}
|
|
|
|
|
|
|
97 |
$ids = implode( ',', wp_parse_id_list( $include ) );
|
98 |
$user_query->query_where .= " AND $wpdb->users.ID IN ($ids)";
|
99 |
}
|
@@ -132,7 +139,7 @@ class Groups_Admin_Users {
|
|
132 |
|
133 |
// group-actions
|
134 |
echo '<style type="text/css">';
|
135 |
-
echo '.groups-bulk-container { display: inline-block; line-height: 24px; padding-bottom:
|
136 |
echo '.groups-bulk-container .groups-select-container { display: inline-block; vertical-align: top; }';
|
137 |
echo '.groups-bulk-container .groups-select-container select, .groups-bulk-container select.groups-action { float: none; margin-right: 4px; vertical-align: top; }';
|
138 |
echo '.groups-bulk-container .selectize-control { min-width: 128px; }';
|
@@ -142,6 +149,19 @@ class Groups_Admin_Users {
|
|
142 |
echo '.groups-bulk-container input.button { margin-top: 1px; vertical-align: top; }';
|
143 |
echo '.tablenav .actions { overflow: visible; }'; // this is important so that the selectize options aren't hidden
|
144 |
echo '</style>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
}
|
147 |
|
@@ -162,21 +182,24 @@ class Groups_Admin_Users {
|
|
162 |
$output = '';
|
163 |
|
164 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
165 |
-
$group_table = _groups_get_tablename( "group" );
|
166 |
// groups select
|
167 |
$groups_table = _groups_get_tablename( 'group' );
|
168 |
if ( $groups = $wpdb->get_results( "SELECT * FROM $groups_table ORDER BY name" ) ) {
|
169 |
$groups_select = sprintf(
|
170 |
'<select id="user-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
171 |
-
esc_attr( __( 'Choose groups …',
|
172 |
-
esc_attr( __( 'Choose groups …',
|
173 |
);
|
174 |
foreach( $groups as $group ) {
|
175 |
$is_member = false;
|
176 |
-
$groups_select .= sprintf(
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
178 |
$groups_select .= '</select>';
|
179 |
-
|
180 |
}
|
181 |
|
182 |
// group bulk actions added through extra_tablenav()
|
@@ -185,11 +208,11 @@ class Groups_Admin_Users {
|
|
185 |
$box .= $groups_select;
|
186 |
$box .= '</div>';
|
187 |
$box .= '<select class="groups-action" name="groups-action">';
|
188 |
-
$box .= '<option selected="selected" value="-1">' . __( 'Group Actions',
|
189 |
-
$box .= '<option value="add-group">' . __( 'Add to group',
|
190 |
-
$box .= '<option value="remove-group">' . __( 'Remove from group',
|
191 |
$box .= '</select>';
|
192 |
-
$box .= sprintf( '<input class="button" type="submit" name="groups" value="%s" />', __( 'Apply',
|
193 |
$box .= '</div>';
|
194 |
$box = str_replace( '"', "'", $box );
|
195 |
|
@@ -213,31 +236,46 @@ class Groups_Admin_Users {
|
|
213 |
}
|
214 |
|
215 |
/**
|
216 |
-
* Hooked on filter in class-wp-list-table.php to
|
217 |
* filter by group.
|
218 |
* @param array $views
|
219 |
*/
|
220 |
public static function views_users( $views ) {
|
221 |
global $pagenow, $wpdb;
|
222 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
223 |
-
$
|
224 |
-
$
|
225 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
foreach( $groups as $group ) {
|
227 |
-
$group = new Groups_Group( $group->group_id );
|
228 |
// Do not use $user_count = count( $group->users ); here,
|
229 |
// as it creates a lot of unneccessary objects and can lead
|
230 |
// to out of memory issues on large user bases.
|
231 |
$user_count = $wpdb->get_var( $wpdb->prepare(
|
232 |
"SELECT COUNT(user_id) FROM $user_group_table WHERE group_id = %d",
|
233 |
-
Groups_Utility::id( $group->group_id ) )
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
239 |
);
|
240 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
return $views;
|
243 |
}
|
@@ -306,7 +344,7 @@ class Groups_Admin_Users {
|
|
306 |
* @return array column headers
|
307 |
*/
|
308 |
public static function manage_users_columns( $column_headers ) {
|
309 |
-
$column_headers[self::GROUPS] = __( 'Groups',
|
310 |
return $column_headers;
|
311 |
}
|
312 |
|
@@ -333,7 +371,7 @@ class Groups_Admin_Users {
|
|
333 |
}
|
334 |
$output .= '</ul>';
|
335 |
} else {
|
336 |
-
$output .= __( '--',
|
337 |
}
|
338 |
break;
|
339 |
}
|
81 |
public static function pre_user_query( $user_query ) {
|
82 |
global $pagenow, $wpdb;
|
83 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
84 |
+
if ( isset( $_REQUEST['group_ids'] ) && is_array( $_REQUEST['group_ids'] ) ) {
|
85 |
+
$group_ids = array_map( array( 'Groups_Utility', 'id' ), array_map( 'trim', $_REQUEST['group_ids'] ) );
|
86 |
+
$include = array();
|
87 |
+
foreach ( $group_ids as $group_id ) {
|
88 |
+
if ( Groups_Group::read( $group_id ) ) {
|
89 |
+
$group = new Groups_Group( $group_id );
|
90 |
+
$users = $group->users;
|
91 |
+
if ( count( $users ) > 0 ) {
|
92 |
+
foreach( $users as $user ) {
|
93 |
+
$include[] = $user->user->ID;
|
94 |
+
}
|
95 |
+
} else { // no results
|
96 |
+
$include[] = 0;
|
97 |
}
|
98 |
+
unset( $group );
|
99 |
+
unset( $users );
|
100 |
}
|
101 |
+
}
|
102 |
+
if ( count( $include ) > 0 ) {
|
103 |
+
$include = array_unique( $include );
|
104 |
$ids = implode( ',', wp_parse_id_list( $include ) );
|
105 |
$user_query->query_where .= " AND $wpdb->users.ID IN ($ids)";
|
106 |
}
|
139 |
|
140 |
// group-actions
|
141 |
echo '<style type="text/css">';
|
142 |
+
echo '.groups-bulk-container { display: inline-block; line-height: 24px; padding-bottom: 2px; vertical-align: top; margin-left: 0.31em; margin-right: 0.31em; }';
|
143 |
echo '.groups-bulk-container .groups-select-container { display: inline-block; vertical-align: top; }';
|
144 |
echo '.groups-bulk-container .groups-select-container select, .groups-bulk-container select.groups-action { float: none; margin-right: 4px; vertical-align: top; }';
|
145 |
echo '.groups-bulk-container .selectize-control { min-width: 128px; }';
|
149 |
echo '.groups-bulk-container input.button { margin-top: 1px; vertical-align: top; }';
|
150 |
echo '.tablenav .actions { overflow: visible; }'; // this is important so that the selectize options aren't hidden
|
151 |
echo '</style>';
|
152 |
+
|
153 |
+
// groups filter
|
154 |
+
echo '<style type="text/css">';
|
155 |
+
echo '.groups-filter-container { display: inline-block; line-height: 24px; vertical-align: middle; }';
|
156 |
+
echo '.groups-filter-container .groups-select-container { display: inline-block; vertical-align: top; }';
|
157 |
+
echo '.groups-filter-container .groups-select-container select, .groups-bulk-container select.groups-action { float: none; margin-right: 4px; vertical-align: top; }';
|
158 |
+
echo '.groups-filter-container .selectize-control { min-width: 128px; }';
|
159 |
+
echo '.groups-filter-container .selectize-control, .groups-bulk-container select.groups-action { margin-right: 4px; vertical-align: top; }';
|
160 |
+
echo '.groups-filter-container .selectize-input { font-size: inherit; line-height: 18px; padding: 1px 2px 2px 2px; vertical-align: middle; }';
|
161 |
+
echo '.groups-filter-container .selectize-input input[type="text"] { font-size: inherit; vertical-align: middle; height: 24px; }';
|
162 |
+
echo '.groups-filter-container .selectize-input .item a { line-height: inherit; }'; // neutralize .subsubsub a rule
|
163 |
+
echo '.groups-filter-container input.button { margin-top: 1px; vertical-align: top; }';
|
164 |
+
echo '</style>';
|
165 |
}
|
166 |
}
|
167 |
|
182 |
$output = '';
|
183 |
|
184 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
|
|
185 |
// groups select
|
186 |
$groups_table = _groups_get_tablename( 'group' );
|
187 |
if ( $groups = $wpdb->get_results( "SELECT * FROM $groups_table ORDER BY name" ) ) {
|
188 |
$groups_select = sprintf(
|
189 |
'<select id="user-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
190 |
+
esc_attr( __( 'Choose groups …', 'groups' ) ) ,
|
191 |
+
esc_attr( __( 'Choose groups …', 'groups' ) )
|
192 |
);
|
193 |
foreach( $groups as $group ) {
|
194 |
$is_member = false;
|
195 |
+
$groups_select .= sprintf(
|
196 |
+
'<option value="%d" %s>%s</option>',
|
197 |
+
Groups_Utility::id( $group->group_id ),
|
198 |
+
$is_member ? ' selected="selected" ' : '',
|
199 |
+
wp_filter_nohtml_kses( $group->name )
|
200 |
+
);
|
201 |
}
|
202 |
$groups_select .= '</select>';
|
|
|
203 |
}
|
204 |
|
205 |
// group bulk actions added through extra_tablenav()
|
208 |
$box .= $groups_select;
|
209 |
$box .= '</div>';
|
210 |
$box .= '<select class="groups-action" name="groups-action">';
|
211 |
+
$box .= '<option selected="selected" value="-1">' . __( 'Group Actions', 'groups' ) . '</option>';
|
212 |
+
$box .= '<option value="add-group">' . __( 'Add to group', 'groups' ) . '</option>';
|
213 |
+
$box .= '<option value="remove-group">' . __( 'Remove from group', 'groups' ) . '</option>';
|
214 |
$box .= '</select>';
|
215 |
+
$box .= sprintf( '<input class="button" type="submit" name="groups" value="%s" />', __( 'Apply', 'groups' ) );
|
216 |
$box .= '</div>';
|
217 |
$box = str_replace( '"', "'", $box );
|
218 |
|
236 |
}
|
237 |
|
238 |
/**
|
239 |
+
* Hooked on filter in class-wp-list-table.php to
|
240 |
* filter by group.
|
241 |
* @param array $views
|
242 |
*/
|
243 |
public static function views_users( $views ) {
|
244 |
global $pagenow, $wpdb;
|
245 |
if ( ( $pagenow == 'users.php' ) && empty( $_GET['page'] ) ) {
|
246 |
+
$output = '<form id="filter-groups-form" action="" method="get">';
|
247 |
+
$output .= '<div class="groups-filter-container">';
|
248 |
+
$output .= '<div class="groups-select-container">';
|
249 |
+
$output .= sprintf(
|
250 |
+
'<select id="filter-groups" class="groups" name="group_ids[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
251 |
+
esc_attr( __( 'Choose groups …', 'groups' ) ) ,
|
252 |
+
esc_attr( __( 'Choose groups …', 'groups' ) )
|
253 |
+
);
|
254 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
255 |
+
$groups = Groups_Group::get_groups( array( 'order_by' => 'name', 'order' => 'ASC' ) );
|
256 |
foreach( $groups as $group ) {
|
|
|
257 |
// Do not use $user_count = count( $group->users ); here,
|
258 |
// as it creates a lot of unneccessary objects and can lead
|
259 |
// to out of memory issues on large user bases.
|
260 |
$user_count = $wpdb->get_var( $wpdb->prepare(
|
261 |
"SELECT COUNT(user_id) FROM $user_group_table WHERE group_id = %d",
|
262 |
+
Groups_Utility::id( $group->group_id ) )
|
263 |
+
);
|
264 |
+
$selected = isset( $_REQUEST['group_ids'] ) && is_array( $_REQUEST['group_ids'] ) && in_array( $group->group_id, $_REQUEST['group_ids'] );
|
265 |
+
$output .= sprintf(
|
266 |
+
'<option value="%d" %s>%s</option>',
|
267 |
+
Groups_Utility::id( $group->group_id ),
|
268 |
+
$selected ? ' selected="selected" ' : '',
|
269 |
+
sprintf( '%s <span class="count">(%s)</span>', wp_filter_nohtml_kses( $group->name ), esc_html( $user_count ) )
|
270 |
);
|
271 |
}
|
272 |
+
$output .= '</select>';
|
273 |
+
$output .= '</div>'; // .groups-select-container
|
274 |
+
$output .= '</div>'; // .groups-filter-container
|
275 |
+
$output .= '<input class="button" type="submit" value="' . esc_attr( __( 'Filter', 'groups' ) ) . '"/>';
|
276 |
+
$output .= '</form>';
|
277 |
+
$output .= Groups_UIE::render_select( '#filter-groups' );
|
278 |
+
$views['groups'] = $output;
|
279 |
}
|
280 |
return $views;
|
281 |
}
|
344 |
* @return array column headers
|
345 |
*/
|
346 |
public static function manage_users_columns( $column_headers ) {
|
347 |
+
$column_headers[self::GROUPS] = __( 'Groups', 'groups' );
|
348 |
return $column_headers;
|
349 |
}
|
350 |
|
371 |
}
|
372 |
$output .= '</ul>';
|
373 |
} else {
|
374 |
+
$output .= __( '--', 'groups' );
|
375 |
}
|
376 |
break;
|
377 |
}
|
lib/admin/class-groups-admin-welcome.php
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* class-groups-admin-welcome.php
|
4 |
+
*
|
5 |
+
* Copyright (c) 2017 "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 2.0.0
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( !defined( 'ABSPATH' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Groups admin welcome and update screen.
|
28 |
+
*/
|
29 |
+
class Groups_Admin_Welcome {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Adds actions to admin_menu, admin_head and admin_init.
|
33 |
+
*/
|
34 |
+
public static function init() {
|
35 |
+
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
|
36 |
+
add_action( 'admin_head', array( __CLASS__, 'admin_head' ) );
|
37 |
+
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
|
38 |
+
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Adds the welcome screen to the dashboard menu.
|
43 |
+
*/
|
44 |
+
public static function admin_menu() {
|
45 |
+
add_dashboard_page(
|
46 |
+
__( 'Welcome to Groups', 'groups' ),
|
47 |
+
__( 'Welcome to Groups', 'groups' ),
|
48 |
+
'manage_options',
|
49 |
+
'groups-welcome',
|
50 |
+
array( __CLASS__, 'groups_welcome' )
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Removes the welcome screen from the dashboard menu.
|
56 |
+
*/
|
57 |
+
public static function admin_head() {
|
58 |
+
remove_submenu_page( 'index.php', 'groups-welcome' );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Checks if the welcome screen should be shown and redirected to.
|
63 |
+
*/
|
64 |
+
public static function admin_init() {
|
65 |
+
if ( get_transient( 'groups_plugin_activated' ) || get_transient( 'groups_plugin_updated_legacy' ) ) {
|
66 |
+
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
67 |
+
$doing_cron = defined( 'DOING_CRON' ) && DOING_CRON;
|
68 |
+
// we'll delete the transients in the welcome screen handler
|
69 |
+
if (
|
70 |
+
!$doing_ajax &&
|
71 |
+
!$doing_cron &&
|
72 |
+
( empty( $_GET['page'] ) || $_GET['page'] !== 'groups-welcome' ) &&
|
73 |
+
!is_network_admin() &&
|
74 |
+
!isset( $_GET['activate-multi'] ) &&
|
75 |
+
current_user_can( GROUPS_ACCESS_GROUPS ) &&
|
76 |
+
apply_filters( 'groups_welcome_show', true )
|
77 |
+
) {
|
78 |
+
wp_safe_redirect( admin_url( 'index.php?page=groups-welcome' ) );
|
79 |
+
exit;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Adds an entry leading to the welcome screen.
|
86 |
+
*
|
87 |
+
* @param array $links
|
88 |
+
* @param string $file plugin file basename
|
89 |
+
* @return array
|
90 |
+
*/
|
91 |
+
public static function plugin_row_meta( $links, $file ) {
|
92 |
+
if ( $file == plugin_basename( GROUPS_FILE ) ) {
|
93 |
+
$row_meta = array(
|
94 |
+
'welcome' => sprintf(
|
95 |
+
'<a href="%s" title="%s">%s</a>',
|
96 |
+
esc_url( admin_url( 'index.php?page=groups-welcome' ) ),
|
97 |
+
esc_attr( __( 'View the Welcome screen for this version of Groups', 'groups' ) ),
|
98 |
+
esc_html( __( 'Welcome', 'groups' ) )
|
99 |
+
)
|
100 |
+
);
|
101 |
+
return array_merge( $links, $row_meta );
|
102 |
+
}
|
103 |
+
return (array) $links;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Renders the welcome screen.
|
108 |
+
*/
|
109 |
+
public static function groups_welcome() {
|
110 |
+
|
111 |
+
global $groups_version;
|
112 |
+
|
113 |
+
wp_enqueue_style( 'groups_admin' );
|
114 |
+
|
115 |
+
delete_transient( 'groups_plugin_activated' );
|
116 |
+
$legacy_update = get_transient( 'groups_plugin_updated_legacy' );
|
117 |
+
delete_transient( 'groups_plugin_updated_legacy' );
|
118 |
+
|
119 |
+
echo '<div class="groups-welcome-panel">';
|
120 |
+
echo '<div class="groups-welcome-panel-content">';
|
121 |
+
|
122 |
+
printf( '<img class="groups-welcome-icon" width="64" height="64" src="%s"/>', esc_attr( GROUPS_PLUGIN_URL . 'images/groups-256x256.png' ) );
|
123 |
+
|
124 |
+
echo '<h1>';
|
125 |
+
printf( __( 'Welcome to Groups %s', 'groups' ), esc_html( $groups_version ) );
|
126 |
+
echo '</h1>';
|
127 |
+
|
128 |
+
echo '<p class="headline">';
|
129 |
+
_e( 'Thanks for using Groups! We have made it even easier to protect your content and hope you like it :)', 'groups' );
|
130 |
+
echo '</p>';
|
131 |
+
|
132 |
+
if ( $legacy_update ) {
|
133 |
+
echo '<p class="important">';
|
134 |
+
echo '<strong>';
|
135 |
+
_e( 'Important', 'groups' );
|
136 |
+
echo '</strong>';
|
137 |
+
echo '<br/><br/>';
|
138 |
+
_e( 'It seems that you have updated from Groups 1.x where access restrictions were based on capabilities.', 'groups' );
|
139 |
+
echo '<br/>';
|
140 |
+
printf( __( 'Please make sure to read the notes on <strong>Switching to Groups %s</strong> below.', 'groups' ), esc_html( $groups_version ) );
|
141 |
+
echo '</p>';
|
142 |
+
}
|
143 |
+
|
144 |
+
echo '<h2>';
|
145 |
+
_e( "What's New?", 'groups' );
|
146 |
+
echo '</h2>';
|
147 |
+
|
148 |
+
echo '<h3>';
|
149 |
+
_e( 'Protect Content Easily', 'groups' );
|
150 |
+
echo '</h3>';
|
151 |
+
echo '<p>';
|
152 |
+
_e( 'We have made it even easier to protect your content!', 'groups' );
|
153 |
+
echo ' ';
|
154 |
+
_e( 'Now you can protect your posts, pages and any other custom post type like products or events by simply assigning them to one or more groups.', 'groups' );
|
155 |
+
echo ' ';
|
156 |
+
_e( 'Previously we used capabilities to do that, but changing to this new model makes things even easier.', 'groups' );
|
157 |
+
echo '</p>';
|
158 |
+
|
159 |
+
echo '<h3>';
|
160 |
+
_e( 'Improved User Interface', 'groups' );
|
161 |
+
echo '</h3>';
|
162 |
+
echo '<p>';
|
163 |
+
_e( 'Now you can assign new users directly to groups when you create a new user account from the Dashboard.', 'groups' );
|
164 |
+
echo ' ';
|
165 |
+
_e( 'Another improvement is better filtering by groups and a reduced footprint on the Users admin screen.', 'groups' );
|
166 |
+
echo ' ';
|
167 |
+
_e( 'And you can now filter the list of users by one or multiple groups with one convenient field.', 'groups' );
|
168 |
+
echo '</p>';
|
169 |
+
|
170 |
+
echo '<h3>';
|
171 |
+
_e( 'New Documentation', 'groups' );
|
172 |
+
echo '</h3>';
|
173 |
+
echo '<p>';
|
174 |
+
_e( 'Whether you are new to Groups or have been using it before, please make sure to visit the <a target="_blank" href="http://docs.itthinx.com/document/groups/">Documentation</a> pages to know more about how to use it.', 'groups' );
|
175 |
+
echo '</p>';
|
176 |
+
|
177 |
+
$legacy_enabled = Groups_Options::get_option( GROUPS_LEGACY_ENABLE );
|
178 |
+
echo '<h2>';
|
179 |
+
printf( __( 'Switching to Groups %s', 'groups' ), esc_html( $groups_version ) );
|
180 |
+
echo '</h2>';
|
181 |
+
echo '<p>';
|
182 |
+
printf( __( 'Groups %s features a simpler model for access restrictions based on groups instead of capabilities used in previous versions.', 'groups' ), esc_html( $groups_version ) );
|
183 |
+
echo ' ';
|
184 |
+
_e( 'To put it simple, previously you would have used capabilities to restrict access to posts and now you simply use groups.', 'groups' );
|
185 |
+
echo ' ';
|
186 |
+
_e( 'To make it easier to transition to the new model for those who migrate from a previous version, we have included legacy access control based on capabilities.', 'groups' );
|
187 |
+
echo '</p>';
|
188 |
+
echo '<div class="indent">';
|
189 |
+
echo '<p>';
|
190 |
+
_e( 'The following is only of interest if you have upgraded from Groups 1.x:', 'groups' );
|
191 |
+
echo '<br/>';
|
192 |
+
if ( $legacy_enabled ) {
|
193 |
+
_e( 'You are running the system with legacy access control based on capabilities enabled.', 'groups' );
|
194 |
+
echo ' ';
|
195 |
+
_e( 'This means that if you had access restrictions in place that were based on capabilities, your entries will still be protected.', 'groups' );
|
196 |
+
} else {
|
197 |
+
_e( 'You are running the system with legacy access control based on capabilities disabled.', 'groups' );
|
198 |
+
echo ' ';
|
199 |
+
_e( 'This could be important!', 'groups' );
|
200 |
+
echo ' ';
|
201 |
+
_e( 'If you had any access restrictions in place based on capabilities, the entries will now be unprotected, unless you enable legacy access restrictions or place appropriate access restrictions based on groups on the desired entries.', 'groups' );
|
202 |
+
}
|
203 |
+
echo '</p>';
|
204 |
+
echo '<p>';
|
205 |
+
_e( 'If you would like to switch to access restrictions based on groups (recommended) instead of capabilities, you can easily do so by setting the appropriate groups on your protected posts, pages and other entries to restrict access.', 'groups' );
|
206 |
+
echo ' ';
|
207 |
+
_e( 'Once you have adjusted your access restrictions based on groups, you can disable legacy access control.', 'groups' );
|
208 |
+
echo ' ';
|
209 |
+
_e( 'Please refer to the <a target="_blank" href="http://docs.itthinx.com/document/groups/">Documentation</a> for details on how to switch to and use the new access restrictions.', 'groups' );
|
210 |
+
echo '</p>';
|
211 |
+
echo '</div>'; // .indent
|
212 |
+
|
213 |
+
echo '<h2>';
|
214 |
+
_e( 'Add-Ons', 'groups' );
|
215 |
+
echo '</h2>';
|
216 |
+
echo '<p>';
|
217 |
+
_e( 'Perfect complements to memberships and access control with Groups.', 'groups' );
|
218 |
+
echo '</p>';
|
219 |
+
echo '<div class="groups-admin-add-ons">';
|
220 |
+
groups_admin_add_ons_content( array( 'offset' => 1 ) );
|
221 |
+
echo '</div>'; // .groups-admin-add-ons
|
222 |
+
|
223 |
+
echo '</div>'; // .groups-welcome-panel-content
|
224 |
+
echo '</div>'; // .groups-welcome-panel
|
225 |
+
}
|
226 |
+
}
|
227 |
+
Groups_Admin_Welcome::init();
|
lib/admin/class-groups-admin.php
CHANGED
@@ -137,7 +137,7 @@ class Groups_Admin {
|
|
137 |
public static function admin_head() {
|
138 |
global $submenu;
|
139 |
if ( isset( $submenu['groups-admin'] ) ) {
|
140 |
-
$submenu['groups-admin'][0][0] = _x( 'Groups', 'menu item title',
|
141 |
}
|
142 |
}
|
143 |
|
@@ -155,7 +155,7 @@ class Groups_Admin {
|
|
155 |
|
156 |
// main
|
157 |
$page = add_menu_page(
|
158 |
-
_x( 'Groups', 'page-title',
|
159 |
'Groups', // don't translate, reasons: a) Groups menu title consistency and b) http://core.trac.wordpress.org/ticket/18857 translation affects $screen->id
|
160 |
GROUPS_ADMINISTER_GROUPS,
|
161 |
'groups-admin',
|
@@ -177,8 +177,8 @@ class Groups_Admin {
|
|
177 |
include_once( GROUPS_ADMIN_LIB . '/groups-admin-tree-view.php');
|
178 |
$page = add_submenu_page(
|
179 |
'groups-admin',
|
180 |
-
__( 'Tree',
|
181 |
-
__( 'Tree',
|
182 |
GROUPS_ACCESS_GROUPS,
|
183 |
'groups-admin-tree-view',
|
184 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_tree_view' )
|
@@ -191,8 +191,8 @@ class Groups_Admin {
|
|
191 |
// capabilities
|
192 |
$page = add_submenu_page(
|
193 |
'groups-admin',
|
194 |
-
__( 'Groups Capabilities',
|
195 |
-
__( 'Capabilities',
|
196 |
GROUPS_ADMINISTER_GROUPS,
|
197 |
'groups-admin-capabilities',
|
198 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_capabilities' )
|
@@ -204,8 +204,8 @@ class Groups_Admin {
|
|
204 |
// options
|
205 |
$page = add_submenu_page(
|
206 |
'groups-admin',
|
207 |
-
__( 'Groups options',
|
208 |
-
__( 'Options',
|
209 |
GROUPS_ADMINISTER_OPTIONS,
|
210 |
'groups-admin-options',
|
211 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_options' )
|
@@ -217,8 +217,8 @@ class Groups_Admin {
|
|
217 |
// add-ons
|
218 |
$page = add_submenu_page(
|
219 |
'groups-admin',
|
220 |
-
__( 'Groups Add-Ons',
|
221 |
-
__( 'Add-Ons',
|
222 |
GROUPS_ACCESS_GROUPS,
|
223 |
'groups-admin-add-ons',
|
224 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_add_ons' )
|
@@ -241,8 +241,8 @@ class Groups_Admin {
|
|
241 |
|
242 |
// main
|
243 |
$page = add_menu_page(
|
244 |
-
__( 'Groups',
|
245 |
-
__( 'Groups',
|
246 |
GROUPS_ADMINISTER_GROUPS,
|
247 |
'groups-network-admin',
|
248 |
apply_filters( 'groups_add_menu_page_function', 'groups_network_admin_options' ),
|
@@ -265,13 +265,13 @@ class Groups_Admin {
|
|
265 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
266 |
array_unshift(
|
267 |
$links,
|
268 |
-
'<a href="' . get_admin_url( null, 'admin.php?page=groups-admin-options' ) . '">' . __( 'Options',
|
269 |
);
|
270 |
}
|
271 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
272 |
array_unshift(
|
273 |
$links,
|
274 |
-
'<a href="' . get_admin_url( null, 'admin.php?page=groups-admin' ) . '">' . __( 'Groups',
|
275 |
);
|
276 |
}
|
277 |
return $links;
|
137 |
public static function admin_head() {
|
138 |
global $submenu;
|
139 |
if ( isset( $submenu['groups-admin'] ) ) {
|
140 |
+
$submenu['groups-admin'][0][0] = _x( 'Groups', 'menu item title', 'groups' );
|
141 |
}
|
142 |
}
|
143 |
|
155 |
|
156 |
// main
|
157 |
$page = add_menu_page(
|
158 |
+
_x( 'Groups', 'page-title', 'groups' ),
|
159 |
'Groups', // don't translate, reasons: a) Groups menu title consistency and b) http://core.trac.wordpress.org/ticket/18857 translation affects $screen->id
|
160 |
GROUPS_ADMINISTER_GROUPS,
|
161 |
'groups-admin',
|
177 |
include_once( GROUPS_ADMIN_LIB . '/groups-admin-tree-view.php');
|
178 |
$page = add_submenu_page(
|
179 |
'groups-admin',
|
180 |
+
__( 'Tree', 'groups' ),
|
181 |
+
__( 'Tree', 'groups' ),
|
182 |
GROUPS_ACCESS_GROUPS,
|
183 |
'groups-admin-tree-view',
|
184 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_tree_view' )
|
191 |
// capabilities
|
192 |
$page = add_submenu_page(
|
193 |
'groups-admin',
|
194 |
+
__( 'Groups Capabilities', 'groups' ),
|
195 |
+
__( 'Capabilities', 'groups' ),
|
196 |
GROUPS_ADMINISTER_GROUPS,
|
197 |
'groups-admin-capabilities',
|
198 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_capabilities' )
|
204 |
// options
|
205 |
$page = add_submenu_page(
|
206 |
'groups-admin',
|
207 |
+
__( 'Groups options', 'groups' ),
|
208 |
+
__( 'Options', 'groups' ),
|
209 |
GROUPS_ADMINISTER_OPTIONS,
|
210 |
'groups-admin-options',
|
211 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_options' )
|
217 |
// add-ons
|
218 |
$page = add_submenu_page(
|
219 |
'groups-admin',
|
220 |
+
__( 'Groups Add-Ons', 'groups' ),
|
221 |
+
__( 'Add-Ons', 'groups' ),
|
222 |
GROUPS_ACCESS_GROUPS,
|
223 |
'groups-admin-add-ons',
|
224 |
apply_filters( 'groups_add_submenu_page_function', 'groups_admin_add_ons' )
|
241 |
|
242 |
// main
|
243 |
$page = add_menu_page(
|
244 |
+
__( 'Groups', 'groups' ),
|
245 |
+
__( 'Groups', 'groups' ),
|
246 |
GROUPS_ADMINISTER_GROUPS,
|
247 |
'groups-network-admin',
|
248 |
apply_filters( 'groups_add_menu_page_function', 'groups_network_admin_options' ),
|
265 |
if ( current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
266 |
array_unshift(
|
267 |
$links,
|
268 |
+
'<a href="' . get_admin_url( null, 'admin.php?page=groups-admin-options' ) . '">' . __( 'Options', 'groups' ) . '</a>'
|
269 |
);
|
270 |
}
|
271 |
if ( current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
272 |
array_unshift(
|
273 |
$links,
|
274 |
+
'<a href="' . get_admin_url( null, 'admin.php?page=groups-admin' ) . '">' . __( 'Groups', 'groups' ) . '</a>'
|
275 |
);
|
276 |
}
|
277 |
return $links;
|
lib/admin/groups-admin-add-ons.php
CHANGED
@@ -24,19 +24,30 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
-
* Renders the content
|
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',
|
35 |
echo '</h1>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
|
41 |
$entries = array(
|
42 |
'groups-file-access' => array(
|
@@ -142,9 +153,9 @@ function groups_admin_add_ons() {
|
|
142 |
}
|
143 |
echo '</ul>'; // .add-ons
|
144 |
|
145 |
-
echo
|
146 |
-
echo __( 'Recommended plugins by itthinx',
|
147 |
-
echo
|
148 |
|
149 |
$entries = array(
|
150 |
'affiliates-pro' => array(
|
@@ -179,8 +190,6 @@ function groups_admin_add_ons() {
|
|
179 |
echo '</li>'; // .add-on
|
180 |
}
|
181 |
echo '</ul>'; // .add-ons
|
182 |
-
|
183 |
-
echo '</div>'; // .groups-admin-add-ons
|
184 |
}
|
185 |
|
186 |
function groups_admin_add_ons_sort( $e1, $e2 ) {
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* Renders the heading and content container for the Add-Ons section.
|
28 |
*/
|
29 |
function groups_admin_add_ons() {
|
|
|
30 |
echo '<div class="groups-admin-add-ons wrap">';
|
|
|
31 |
echo '<h1>';
|
32 |
+
echo __( 'Add-Ons', 'groups' );
|
33 |
echo '</h1>';
|
34 |
+
groups_admin_add_ons_content();
|
35 |
+
echo '</div>'; // .groups-admin-add-ons.wrap
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Renders the content of the Add-Ons section.
|
40 |
+
*
|
41 |
+
* @param $params array of options (offset is 0 by default and used to adjust heading h2)
|
42 |
+
*/
|
43 |
+
function groups_admin_add_ons_content( $params = array( 'offset' => 0 ) ) {
|
44 |
|
45 |
+
$d = intval( $params['offset'] );
|
46 |
+
$h2 = sprintf( 'h%d', 2+$d );
|
47 |
+
|
48 |
+
echo "<$h2>";
|
49 |
+
echo __( 'Recommended extensions for Groups', 'groups' );
|
50 |
+
echo "</$h2>";
|
51 |
|
52 |
$entries = array(
|
53 |
'groups-file-access' => array(
|
153 |
}
|
154 |
echo '</ul>'; // .add-ons
|
155 |
|
156 |
+
echo "<$h2>";
|
157 |
+
echo __( 'Recommended plugins by itthinx', 'groups' );
|
158 |
+
echo "</$h2>";
|
159 |
|
160 |
$entries = array(
|
161 |
'affiliates-pro' => array(
|
190 |
echo '</li>'; // .add-on
|
191 |
}
|
192 |
echo '</ul>'; // .add-ons
|
|
|
|
|
193 |
}
|
194 |
|
195 |
function groups_admin_add_ons_sort( $e1, $e2 ) {
|
lib/admin/groups-admin-capabilities-add.php
CHANGED
@@ -31,7 +31,7 @@ function groups_admin_capabilities_add() {
|
|
31 |
global $wpdb;
|
32 |
|
33 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
34 |
-
wp_die( __( 'Access denied.',
|
35 |
}
|
36 |
|
37 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
@@ -47,27 +47,27 @@ function groups_admin_capabilities_add() {
|
|
47 |
$output =
|
48 |
'<div class="manage-capabilities wrap">' .
|
49 |
'<h1>' .
|
50 |
-
__( 'Add a new capability',
|
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',
|
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',
|
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',
|
69 |
'<input type="hidden" value="add" name="action"/>' .
|
70 |
-
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
71 |
'</div>' .
|
72 |
'</div>' . // .capability.new
|
73 |
'</form>' .
|
@@ -86,11 +86,11 @@ function groups_admin_capabilities_add_submit() {
|
|
86 |
global $wpdb;
|
87 |
|
88 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
89 |
-
wp_die( __( 'Access denied.',
|
90 |
}
|
91 |
|
92 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-add' ) ) {
|
93 |
-
wp_die( __( 'Access denied.',
|
94 |
}
|
95 |
|
96 |
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : null;
|
@@ -99,9 +99,9 @@ function groups_admin_capabilities_add_submit() {
|
|
99 |
$capability_id = Groups_Capability::create( compact( "capability", "description" ) );
|
100 |
if ( !$capability_id ) {
|
101 |
if ( empty( $capability ) ) {
|
102 |
-
Groups_Admin::add_message( __( 'The <em>Capability</em> must not be empty.',
|
103 |
} else if ( Groups_Capability::read_by_capability( $capability ) ) {
|
104 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability already exists.',
|
105 |
}
|
106 |
}
|
107 |
return $capability_id;
|
31 |
global $wpdb;
|
32 |
|
33 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
34 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
35 |
}
|
36 |
|
37 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
47 |
$output =
|
48 |
'<div class="manage-capabilities wrap">' .
|
49 |
'<h1>' .
|
50 |
+
__( 'Add a new capability', 'groups' ) .
|
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' ) . '</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' ) . '</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' ) . '"/>' .
|
69 |
'<input type="hidden" value="add" name="action"/>' .
|
70 |
+
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>' .
|
71 |
'</div>' .
|
72 |
'</div>' . // .capability.new
|
73 |
'</form>' .
|
86 |
global $wpdb;
|
87 |
|
88 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
89 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
90 |
}
|
91 |
|
92 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-add' ) ) {
|
93 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
94 |
}
|
95 |
|
96 |
$capability = isset( $_POST['capability-field'] ) ? $_POST['capability-field'] : null;
|
99 |
$capability_id = Groups_Capability::create( compact( "capability", "description" ) );
|
100 |
if ( !$capability_id ) {
|
101 |
if ( empty( $capability ) ) {
|
102 |
+
Groups_Admin::add_message( __( 'The <em>Capability</em> must not be empty.', 'groups' ), 'error' );
|
103 |
} else if ( Groups_Capability::read_by_capability( $capability ) ) {
|
104 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability already exists.', 'groups' ), stripslashes( wp_filter_nohtml_kses( ( $capability ) ) ) ), 'error' );
|
105 |
}
|
106 |
}
|
107 |
return $capability_id;
|
lib/admin/groups-admin-capabilities-edit.php
CHANGED
@@ -32,13 +32,13 @@ function groups_admin_capabilities_edit( $capability_id ) {
|
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
-
wp_die( __( 'Access denied.',
|
36 |
}
|
37 |
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
|
40 |
if ( empty( $capability ) ) {
|
41 |
-
wp_die( __( 'No such capability.',
|
42 |
}
|
43 |
|
44 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
@@ -53,7 +53,7 @@ function groups_admin_capabilities_edit( $capability_id ) {
|
|
53 |
$output =
|
54 |
'<div class="manage-capabilities wrap">' .
|
55 |
'<h1>' .
|
56 |
-
__( 'Edit a capability',
|
57 |
'</h1>' .
|
58 |
|
59 |
Groups_Admin::render_messages() .
|
@@ -63,20 +63,20 @@ function groups_admin_capabilities_edit( $capability_id ) {
|
|
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',
|
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',
|
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',
|
78 |
'<input type="hidden" value="edit" name="action"/>' .
|
79 |
-
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
80 |
'</div>' .
|
81 |
'</div>' . // .capability.edit
|
82 |
'</form>' .
|
@@ -93,11 +93,11 @@ function groups_admin_capabilities_edit_submit() {
|
|
93 |
$result = false;
|
94 |
|
95 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
96 |
-
wp_die( __( 'Access denied.',
|
97 |
}
|
98 |
|
99 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-edit' ) ) {
|
100 |
-
wp_die( __( 'Access denied.',
|
101 |
}
|
102 |
|
103 |
$capability_id = isset( $_POST['capability-id-field'] ) ? $_POST['capability-id-field'] : null;
|
@@ -113,7 +113,7 @@ function groups_admin_capabilities_edit_submit() {
|
|
113 |
$update = true;
|
114 |
if ( $other_capability = Groups_Capability::read_by_capability( $capability_field ) ) {
|
115 |
if ( $other_capability->capability_id != $capability_id ) {
|
116 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability already exists and cannot be assigned to this one.',
|
117 |
$update = false;
|
118 |
}
|
119 |
}
|
@@ -123,11 +123,11 @@ function groups_admin_capabilities_edit_submit() {
|
|
123 |
if ( $capability_id ) {
|
124 |
$result = $capability_id;
|
125 |
} else {
|
126 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability could not be updated.',
|
127 |
}
|
128 |
}
|
129 |
} else {
|
130 |
-
Groups_Admin::add_message( __( 'The <em>Capability</em> must not be empty.',
|
131 |
}
|
132 |
}
|
133 |
return $result;
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
36 |
}
|
37 |
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
|
40 |
if ( empty( $capability ) ) {
|
41 |
+
wp_die( __( 'No such capability.', 'groups' ) );
|
42 |
}
|
43 |
|
44 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
53 |
$output =
|
54 |
'<div class="manage-capabilities wrap">' .
|
55 |
'<h1>' .
|
56 |
+
__( 'Edit a capability', 'groups' ) .
|
57 |
'</h1>' .
|
58 |
|
59 |
Groups_Admin::render_messages() .
|
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' ) . '</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' ) . '</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' ) . '"/>' .
|
78 |
'<input type="hidden" value="edit" name="action"/>' .
|
79 |
+
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>' .
|
80 |
'</div>' .
|
81 |
'</div>' . // .capability.edit
|
82 |
'</form>' .
|
93 |
$result = false;
|
94 |
|
95 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
96 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
97 |
}
|
98 |
|
99 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-edit' ) ) {
|
100 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
101 |
}
|
102 |
|
103 |
$capability_id = isset( $_POST['capability-id-field'] ) ? $_POST['capability-id-field'] : null;
|
113 |
$update = true;
|
114 |
if ( $other_capability = Groups_Capability::read_by_capability( $capability_field ) ) {
|
115 |
if ( $other_capability->capability_id != $capability_id ) {
|
116 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability already exists and cannot be assigned to this one.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $other_capability->capability ) ) ), 'error' );
|
117 |
$update = false;
|
118 |
}
|
119 |
}
|
123 |
if ( $capability_id ) {
|
124 |
$result = $capability_id;
|
125 |
} else {
|
126 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability could not be updated.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $capability ) ) ), 'error' );
|
127 |
}
|
128 |
}
|
129 |
} else {
|
130 |
+
Groups_Admin::add_message( __( 'The <em>Capability</em> must not be empty.', 'groups' ), 'error' );
|
131 |
}
|
132 |
}
|
133 |
return $result;
|
lib/admin/groups-admin-capabilities-remove.php
CHANGED
@@ -32,13 +32,13 @@ function groups_admin_capabilities_remove( $capability_id ) {
|
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
-
wp_die( __( 'Access denied.',
|
36 |
}
|
37 |
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
|
40 |
if ( empty( $capability ) ) {
|
41 |
-
wp_die( __( 'No such capability.',
|
42 |
}
|
43 |
|
44 |
$capability_table = _groups_get_tablename( 'capability' );
|
@@ -50,18 +50,18 @@ function groups_admin_capabilities_remove( $capability_id ) {
|
|
50 |
$output =
|
51 |
'<div class="manage-capabilities wrap">' .
|
52 |
'<h1>' .
|
53 |
-
__( 'Remove a capability',
|
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 ) ) . '"/>' .
|
58 |
'<ul>' .
|
59 |
-
'<li>' . sprintf( __( 'Capability : %s',
|
60 |
'</ul> ' .
|
61 |
wp_nonce_field( 'capabilities-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
62 |
-
'<input class="button button-primary" type="submit" value="' . __( 'Remove',
|
63 |
'<input type="hidden" value="remove" name="action"/>' .
|
64 |
-
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
65 |
'</div>' .
|
66 |
'</div>' . // .capability.remove
|
67 |
'</form>' .
|
@@ -80,11 +80,11 @@ function groups_admin_capabilities_remove_submit() {
|
|
80 |
$result = false;
|
81 |
|
82 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
83 |
-
wp_die( __( 'Access denied.',
|
84 |
}
|
85 |
|
86 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-remove' ) ) {
|
87 |
-
wp_die( __( 'Access denied.',
|
88 |
}
|
89 |
|
90 |
$capability_id = isset( $_POST['capability-id-field'] ) ? $_POST['capability-id-field'] : null;
|
@@ -107,13 +107,13 @@ function groups_admin_capabilities_bulk_remove() {
|
|
107 |
$output = '';
|
108 |
|
109 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
110 |
-
wp_die( __( 'Access denied.',
|
111 |
}
|
112 |
|
113 |
$capability_ids = isset( $_POST['capability_ids'] ) ? $_POST['capability_ids'] : null;
|
114 |
|
115 |
if ( ! $capability_ids ) {
|
116 |
-
wp_die( __( 'No such capabilities.',
|
117 |
}
|
118 |
|
119 |
$capabilities = array();
|
@@ -130,24 +130,24 @@ function groups_admin_capabilities_bulk_remove() {
|
|
130 |
|
131 |
$output .= '<div class="manage-capabilities wrap">';
|
132 |
$output .= '<h1>';
|
133 |
-
$output .= __( 'Remove capabilities',
|
134 |
$output .= '</h1>';
|
135 |
|
136 |
$output .= '<form id="capabilities-action" method="post" action="">';
|
137 |
$output .= '<div class="capability remove">';
|
138 |
$output .= '<p>';
|
139 |
-
$output .= __( 'Please confirm to remove the following capabilities. This action cannot be undone.',
|
140 |
$output .= '</p>';
|
141 |
foreach ( $capabilities as $capability ) {
|
142 |
$output .= '<input id="capability_ids" name="capability_ids[]" type="hidden" value="' . esc_attr( intval( $capability->capability_id ) ) . '"/>';
|
143 |
$output .= '<ul>';
|
144 |
$output .= '<li>';
|
145 |
-
$output .= sprintf( __( '<strong>%s</strong>',
|
146 |
$output .= '</li>';
|
147 |
$output .= '</ul>';
|
148 |
}
|
149 |
-
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove",
|
150 |
-
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
151 |
|
152 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
153 |
$output .= '<input type="hidden" name="bulk-action" value="remove"/>';
|
@@ -172,11 +172,11 @@ function groups_admin_capabilities_bulk_remove_submit() {
|
|
172 |
$result = array();
|
173 |
|
174 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
175 |
-
wp_die( __( 'Access denied.',
|
176 |
}
|
177 |
|
178 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_ACTION_NONCE], 'admin' ) ) {
|
179 |
-
wp_die( __( 'Access denied.',
|
180 |
}
|
181 |
|
182 |
$capability_ids = isset( $_POST['capability_ids'] ) ? $_POST['capability_ids'] : null;
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
36 |
}
|
37 |
|
38 |
$capability = Groups_Capability::read( intval( $capability_id ) );
|
39 |
|
40 |
if ( empty( $capability ) ) {
|
41 |
+
wp_die( __( 'No such capability.', 'groups' ) );
|
42 |
}
|
43 |
|
44 |
$capability_table = _groups_get_tablename( 'capability' );
|
50 |
$output =
|
51 |
'<div class="manage-capabilities wrap">' .
|
52 |
'<h1>' .
|
53 |
+
__( 'Remove a capability', 'groups' ) .
|
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 ) ) . '"/>' .
|
58 |
'<ul>' .
|
59 |
+
'<li>' . sprintf( __( 'Capability : %s', 'groups' ), stripslashes( wp_filter_nohtml_kses( $capability->capability ) ) ) . '</li>' .
|
60 |
'</ul> ' .
|
61 |
wp_nonce_field( 'capabilities-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
62 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Remove', 'groups' ) . '"/>' .
|
63 |
'<input type="hidden" value="remove" name="action"/>' .
|
64 |
+
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>' .
|
65 |
'</div>' .
|
66 |
'</div>' . // .capability.remove
|
67 |
'</form>' .
|
80 |
$result = false;
|
81 |
|
82 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
83 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
84 |
}
|
85 |
|
86 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'capabilities-remove' ) ) {
|
87 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
88 |
}
|
89 |
|
90 |
$capability_id = isset( $_POST['capability-id-field'] ) ? $_POST['capability-id-field'] : null;
|
107 |
$output = '';
|
108 |
|
109 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
110 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
111 |
}
|
112 |
|
113 |
$capability_ids = isset( $_POST['capability_ids'] ) ? $_POST['capability_ids'] : null;
|
114 |
|
115 |
if ( ! $capability_ids ) {
|
116 |
+
wp_die( __( 'No such capabilities.', 'groups' ) );
|
117 |
}
|
118 |
|
119 |
$capabilities = array();
|
130 |
|
131 |
$output .= '<div class="manage-capabilities wrap">';
|
132 |
$output .= '<h1>';
|
133 |
+
$output .= __( 'Remove capabilities', 'groups' );
|
134 |
$output .= '</h1>';
|
135 |
|
136 |
$output .= '<form id="capabilities-action" method="post" action="">';
|
137 |
$output .= '<div class="capability remove">';
|
138 |
$output .= '<p>';
|
139 |
+
$output .= __( 'Please confirm to remove the following capabilities. This action cannot be undone.', 'groups' );
|
140 |
$output .= '</p>';
|
141 |
foreach ( $capabilities as $capability ) {
|
142 |
$output .= '<input id="capability_ids" name="capability_ids[]" type="hidden" value="' . esc_attr( intval( $capability->capability_id ) ) . '"/>';
|
143 |
$output .= '<ul>';
|
144 |
$output .= '<li>';
|
145 |
+
$output .= sprintf( __( '<strong>%s</strong>', 'groups' ), wp_filter_nohtml_kses( $capability->capability ) );
|
146 |
$output .= '</li>';
|
147 |
$output .= '</ul>';
|
148 |
}
|
149 |
+
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove", 'groups' ) . '"/>';
|
150 |
+
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>';
|
151 |
|
152 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
153 |
$output .= '<input type="hidden" name="bulk-action" value="remove"/>';
|
172 |
$result = array();
|
173 |
|
174 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
175 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
176 |
}
|
177 |
|
178 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_ACTION_NONCE], 'admin' ) ) {
|
179 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
180 |
}
|
181 |
|
182 |
$capability_ids = isset( $_POST['capability_ids'] ) ? $_POST['capability_ids'] : null;
|
lib/admin/groups-admin-capabilities.php
CHANGED
@@ -45,7 +45,7 @@ function groups_admin_capabilities() {
|
|
45 |
$today = date( 'Y-m-d', time() );
|
46 |
|
47 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
48 |
-
wp_die( __( 'Access denied.',
|
49 |
}
|
50 |
|
51 |
//
|
@@ -59,7 +59,7 @@ function groups_admin_capabilities() {
|
|
59 |
return groups_admin_capabilities_add();
|
60 |
} else {
|
61 |
$capability = Groups_Capability::read( $capability_id );
|
62 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability has been created.',
|
63 |
}
|
64 |
break;
|
65 |
case 'edit' :
|
@@ -67,12 +67,12 @@ function groups_admin_capabilities() {
|
|
67 |
return groups_admin_capabilities_edit( $_POST['capability-id-field'] );
|
68 |
} else {
|
69 |
$capability = Groups_Capability::read( $capability_id );
|
70 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability has been updated.',
|
71 |
}
|
72 |
break;
|
73 |
case 'remove' :
|
74 |
if ( $capability_id = groups_admin_capabilities_remove_submit() ) {
|
75 |
-
Groups_Admin::add_message( __( 'The capability has been deleted.',
|
76 |
}
|
77 |
break;
|
78 |
// bulk actions on groups: capabilities
|
@@ -118,12 +118,12 @@ function groups_admin_capabilities() {
|
|
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,
|
122 |
} else {
|
123 |
-
$output .= '<div class="updated fade"><p>' . __( 'No new capabilities have been found.',
|
124 |
}
|
125 |
} else {
|
126 |
-
wp_die( __( 'A Duck!',
|
127 |
}
|
128 |
break;
|
129 |
}
|
@@ -138,7 +138,7 @@ function groups_admin_capabilities() {
|
|
138 |
isset( $_POST['capability'] )
|
139 |
) {
|
140 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_FILTER_NONCE], 'admin' ) ) {
|
141 |
-
wp_die( __( 'Access denied.',
|
142 |
}
|
143 |
}
|
144 |
|
@@ -169,13 +169,13 @@ function groups_admin_capabilities() {
|
|
169 |
|
170 |
if ( isset( $_POST['row_count'] ) ) {
|
171 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_NONCE_1], 'admin' ) ) {
|
172 |
-
wp_die( __( 'Access denied.',
|
173 |
}
|
174 |
}
|
175 |
|
176 |
if ( isset( $_POST['paged'] ) ) {
|
177 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_NONCE_2], 'admin' ) ) {
|
178 |
-
wp_die( __( 'Access denied.',
|
179 |
}
|
180 |
}
|
181 |
|
@@ -189,37 +189,37 @@ function groups_admin_capabilities() {
|
|
189 |
$output .=
|
190 |
'<div class="manage-capabilities wrap">' .
|
191 |
'<h1>' .
|
192 |
-
__( 'Capabilities',
|
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',
|
197 |
esc_url( $current_url . '&action=add' )
|
198 |
) .
|
199 |
sprintf(
|
200 |
'<img class="icon" alt="%s" src="%s" />',
|
201 |
-
esc_attr( __( 'Add',
|
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',
|
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',
|
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',
|
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',
|
223 |
) .
|
224 |
'</a>' .
|
225 |
'</h1>';
|
@@ -310,9 +310,9 @@ function groups_admin_capabilities() {
|
|
310 |
$results = $wpdb->get_results( $query, OBJECT );
|
311 |
|
312 |
$column_display_names = array(
|
313 |
-
'capability_id' => __( 'ID',
|
314 |
-
'capability' => __( 'Capability',
|
315 |
-
'description' => __( 'Description',
|
316 |
);
|
317 |
|
318 |
$output .= '<div class="capabilities-overview">';
|
@@ -321,18 +321,18 @@ function groups_admin_capabilities() {
|
|
321 |
'<div class="filters">' .
|
322 |
'<form id="setfilters" action="" method="post">' .
|
323 |
'<fieldset>' .
|
324 |
-
'<legend>' . __( 'Filters',
|
325 |
'<label class="capability-id-filter">' .
|
326 |
-
__( 'Capability ID',
|
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',
|
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',
|
335 |
-
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear',
|
336 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
337 |
'</fieldset>' .
|
338 |
'</form>' .
|
@@ -354,10 +354,10 @@ function groups_admin_capabilities() {
|
|
354 |
$output .= '<div class="page-options right">';
|
355 |
$output .= '<form id="setrowcount" action="" method="post">';
|
356 |
$output .= '<div>';
|
357 |
-
$output .= '<label for="row_count">' . __( 'Results per page',
|
358 |
$output .= '<input name="row_count" type="text" size="2" value="' . esc_attr( $row_count ) .'" />';
|
359 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_CAPABILITIES_NONCE_1, true, false );
|
360 |
-
$output .= '<input class="button" type="submit" value="' . __( 'Apply',
|
361 |
$output .= '</div>';
|
362 |
$output .= '</form>';
|
363 |
$output .= '</div>';
|
@@ -368,10 +368,10 @@ function groups_admin_capabilities() {
|
|
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',
|
372 |
-
$output .= '<option value="remove">' . esc_html( __( 'Remove',
|
373 |
$output .= '</select>';
|
374 |
-
$output .= '<input class="button" type="submit" name="bulk" value="' . esc_attr( __( "Apply",
|
375 |
$output .= '</div>';
|
376 |
$output .= '</div>';
|
377 |
$output .= '</div>';
|
@@ -446,7 +446,7 @@ function groups_admin_capabilities() {
|
|
446 |
'<span class="edit">' .
|
447 |
'<a href="' . esc_url( $edit_url ) . '">' .
|
448 |
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
449 |
-
__( 'Edit',
|
450 |
'</a>';
|
451 |
if ( $result->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) {
|
452 |
$row_actions .=
|
@@ -455,7 +455,7 @@ function groups_admin_capabilities() {
|
|
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',
|
459 |
'</a>' .
|
460 |
'</span>';
|
461 |
}
|
@@ -481,7 +481,7 @@ function groups_admin_capabilities() {
|
|
481 |
$output .= '</tr>';
|
482 |
}
|
483 |
} else {
|
484 |
-
$output .= '<tr><td colspan="3">' . __( 'There are no results.',
|
485 |
}
|
486 |
|
487 |
$output .= '</tbody>';
|
45 |
$today = date( 'Y-m-d', time() );
|
46 |
|
47 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
48 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
49 |
}
|
50 |
|
51 |
//
|
59 |
return groups_admin_capabilities_add();
|
60 |
} else {
|
61 |
$capability = Groups_Capability::read( $capability_id );
|
62 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability has been created.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $capability->capability ) ) ) );
|
63 |
}
|
64 |
break;
|
65 |
case 'edit' :
|
67 |
return groups_admin_capabilities_edit( $_POST['capability-id-field'] );
|
68 |
} else {
|
69 |
$capability = Groups_Capability::read( $capability_id );
|
70 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> capability has been updated.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $capability->capability ) ) ) );
|
71 |
}
|
72 |
break;
|
73 |
case 'remove' :
|
74 |
if ( $capability_id = groups_admin_capabilities_remove_submit() ) {
|
75 |
+
Groups_Admin::add_message( __( 'The capability has been deleted.', 'groups' ) );
|
76 |
}
|
77 |
break;
|
78 |
// bulk actions on groups: capabilities
|
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' ), $n ) . '</p></div>';
|
122 |
} else {
|
123 |
+
$output .= '<div class="updated fade"><p>' . __( 'No new capabilities have been found.', 'groups' ) . '</p></div>';
|
124 |
}
|
125 |
} else {
|
126 |
+
wp_die( __( 'A Duck!', 'groups' ) );
|
127 |
}
|
128 |
break;
|
129 |
}
|
138 |
isset( $_POST['capability'] )
|
139 |
) {
|
140 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_FILTER_NONCE], 'admin' ) ) {
|
141 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
142 |
}
|
143 |
}
|
144 |
|
169 |
|
170 |
if ( isset( $_POST['row_count'] ) ) {
|
171 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_NONCE_1], 'admin' ) ) {
|
172 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
173 |
}
|
174 |
}
|
175 |
|
176 |
if ( isset( $_POST['paged'] ) ) {
|
177 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_CAPABILITIES_NONCE_2], 'admin' ) ) {
|
178 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
179 |
}
|
180 |
}
|
181 |
|
189 |
$output .=
|
190 |
'<div class="manage-capabilities wrap">' .
|
191 |
'<h1>' .
|
192 |
+
__( 'Capabilities', 'groups' ) .
|
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' ) ),
|
197 |
esc_url( $current_url . '&action=add' )
|
198 |
) .
|
199 |
sprintf(
|
200 |
'<img class="icon" alt="%s" src="%s" />',
|
201 |
+
esc_attr( __( 'Add', 'groups' ) ),
|
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' ) ) )
|
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' ) ),
|
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' ) ),
|
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' ) ) )
|
223 |
) .
|
224 |
'</a>' .
|
225 |
'</h1>';
|
310 |
$results = $wpdb->get_results( $query, OBJECT );
|
311 |
|
312 |
$column_display_names = array(
|
313 |
+
'capability_id' => __( 'ID', 'groups' ),
|
314 |
+
'capability' => __( 'Capability', 'groups' ),
|
315 |
+
'description' => __( 'Description', 'groups' )
|
316 |
);
|
317 |
|
318 |
$output .= '<div class="capabilities-overview">';
|
321 |
'<div class="filters">' .
|
322 |
'<form id="setfilters" action="" method="post">' .
|
323 |
'<fieldset>' .
|
324 |
+
'<legend>' . __( 'Filters', 'groups' ) . '</legend>' .
|
325 |
'<label class="capability-id-filter">' .
|
326 |
+
__( 'Capability ID', 'groups' ) . ' ' .
|
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' ) . ' ' .
|
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' ) . '"/>' . ' ' .
|
335 |
+
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', 'groups' ) . '"/>' .
|
336 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
337 |
'</fieldset>' .
|
338 |
'</form>' .
|
354 |
$output .= '<div class="page-options right">';
|
355 |
$output .= '<form id="setrowcount" action="" method="post">';
|
356 |
$output .= '<div>';
|
357 |
+
$output .= '<label for="row_count">' . __( 'Results per page', 'groups' ) . '</label>';
|
358 |
$output .= '<input name="row_count" type="text" size="2" value="' . esc_attr( $row_count ) .'" />';
|
359 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_CAPABILITIES_NONCE_1, true, false );
|
360 |
+
$output .= '<input class="button" type="submit" value="' . __( 'Apply', 'groups' ) . '"/>';
|
361 |
$output .= '</div>';
|
362 |
$output .= '</form>';
|
363 |
$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' ) ) . '</option>';
|
372 |
+
$output .= '<option value="remove">' . esc_html( __( 'Remove', 'groups' ) ) . '</option>';
|
373 |
$output .= '</select>';
|
374 |
+
$output .= '<input class="button" type="submit" name="bulk" value="' . esc_attr( __( "Apply", 'groups' ) ) . '"/>';
|
375 |
$output .= '</div>';
|
376 |
$output .= '</div>';
|
377 |
$output .= '</div>';
|
446 |
'<span class="edit">' .
|
447 |
'<a href="' . esc_url( $edit_url ) . '">' .
|
448 |
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
449 |
+
__( 'Edit', 'groups' ) .
|
450 |
'</a>';
|
451 |
if ( $result->capability !== Groups_Post_Access::READ_POST_CAPABILITY ) {
|
452 |
$row_actions .=
|
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' ) .
|
459 |
'</a>' .
|
460 |
'</span>';
|
461 |
}
|
481 |
$output .= '</tr>';
|
482 |
}
|
483 |
} else {
|
484 |
+
$output .= '<tr><td colspan="3">' . __( 'There are no results.', 'groups' ) . '</td></tr>';
|
485 |
}
|
486 |
|
487 |
$output .= '</tbody>';
|
lib/admin/groups-admin-groups-add.php
CHANGED
@@ -33,7 +33,7 @@ function groups_admin_groups_add() {
|
|
33 |
$output = '';
|
34 |
|
35 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
36 |
-
wp_die( __( 'Access denied.',
|
37 |
}
|
38 |
|
39 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
@@ -56,7 +56,7 @@ function groups_admin_groups_add() {
|
|
56 |
|
57 |
$output .= '<div class="manage-groups wrap">';
|
58 |
$output .= '<h1>';
|
59 |
-
$output .= __( 'Add a new group',
|
60 |
$output .= '</h1>';
|
61 |
|
62 |
$output .= Groups_Admin::render_messages();
|
@@ -66,21 +66,21 @@ function groups_admin_groups_add() {
|
|
66 |
|
67 |
$output .= '<div class="field">';
|
68 |
$output .= '<label for="name-field" class="field-label first required">';
|
69 |
-
$output .= __( 'Name',
|
70 |
$output .= '</label>';
|
71 |
$output .= '<input id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr( stripslashes( $name ) ) . '"/>';
|
72 |
$output .= '</div>';
|
73 |
|
74 |
$output .= '<div class="field">';
|
75 |
$output .= '<label for="parent-id-field" class="field-label">';
|
76 |
-
$output .= __( 'Parent',
|
77 |
$output .= '</label>';
|
78 |
$output .= $parent_select;
|
79 |
$output .= '</div>';
|
80 |
|
81 |
$output .= '<div class="field">';
|
82 |
$output .= '<label for="description-field" class="field-label description-field">';
|
83 |
-
$output .= __( 'Description',
|
84 |
$output .= '</label>';
|
85 |
$output .= '<textarea id="description-field" name="description-field" rows="5" cols="45">';
|
86 |
$output .= stripslashes( wp_filter_nohtml_kses( $description ) );
|
@@ -94,10 +94,10 @@ function groups_admin_groups_add() {
|
|
94 |
|
95 |
$output .= '<div class="select-capability-container" style="width:62%;">';
|
96 |
$output .= '<label>';
|
97 |
-
$output .= __( 'Capabilities',
|
98 |
$output .= sprintf(
|
99 |
'<select class="select capability" name="capability_ids[]" multiple="multiple" placeholder="%s">',
|
100 |
-
__( 'Choose capabilities …',
|
101 |
);
|
102 |
foreach( $capabilities as $capability ) {
|
103 |
$output .= sprintf( '<option value="%s">%s</option>', esc_attr( $capability->capability_id ), wp_filter_nohtml_kses( $capability->capability ) );
|
@@ -106,7 +106,7 @@ function groups_admin_groups_add() {
|
|
106 |
$output .= '</label>';
|
107 |
$output .= '</div>';
|
108 |
$output .= '<p class="description">';
|
109 |
-
$output .= __( 'These capabilities will be assigned to the group.',
|
110 |
$output .= '</p>';
|
111 |
|
112 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
@@ -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 button-primary" type="submit" value="' . __( 'Add',
|
120 |
$output .= '<input type="hidden" value="add" name="action"/>';
|
121 |
-
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
122 |
$output .= '</div>';
|
123 |
$output .= '</div>'; // .group.new
|
124 |
$output .= '</form>';
|
@@ -136,11 +136,11 @@ function groups_admin_groups_add_submit() {
|
|
136 |
global $wpdb;
|
137 |
|
138 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
139 |
-
wp_die( __( 'Access denied.',
|
140 |
}
|
141 |
|
142 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-add' ) ) {
|
143 |
-
wp_die( __( 'Access denied.',
|
144 |
}
|
145 |
|
146 |
$creator_id = get_current_user_id();
|
@@ -160,9 +160,9 @@ function groups_admin_groups_add_submit() {
|
|
160 |
do_action( 'groups_admin_groups_add_submit_success', $group_id );
|
161 |
} else {
|
162 |
if ( !$name ) {
|
163 |
-
Groups_Admin::add_message( __( 'The name must not be empty.',
|
164 |
} else if ( Groups_Group::read_by_name( $name ) ) {
|
165 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> group already exists.',
|
166 |
}
|
167 |
}
|
168 |
|
33 |
$output = '';
|
34 |
|
35 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
36 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
37 |
}
|
38 |
|
39 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
56 |
|
57 |
$output .= '<div class="manage-groups wrap">';
|
58 |
$output .= '<h1>';
|
59 |
+
$output .= __( 'Add a new group', 'groups' );
|
60 |
$output .= '</h1>';
|
61 |
|
62 |
$output .= Groups_Admin::render_messages();
|
66 |
|
67 |
$output .= '<div class="field">';
|
68 |
$output .= '<label for="name-field" class="field-label first required">';
|
69 |
+
$output .= __( 'Name', 'groups' );
|
70 |
$output .= '</label>';
|
71 |
$output .= '<input id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr( stripslashes( $name ) ) . '"/>';
|
72 |
$output .= '</div>';
|
73 |
|
74 |
$output .= '<div class="field">';
|
75 |
$output .= '<label for="parent-id-field" class="field-label">';
|
76 |
+
$output .= __( 'Parent', 'groups' );
|
77 |
$output .= '</label>';
|
78 |
$output .= $parent_select;
|
79 |
$output .= '</div>';
|
80 |
|
81 |
$output .= '<div class="field">';
|
82 |
$output .= '<label for="description-field" class="field-label description-field">';
|
83 |
+
$output .= __( 'Description', 'groups' );
|
84 |
$output .= '</label>';
|
85 |
$output .= '<textarea id="description-field" name="description-field" rows="5" cols="45">';
|
86 |
$output .= stripslashes( wp_filter_nohtml_kses( $description ) );
|
94 |
|
95 |
$output .= '<div class="select-capability-container" style="width:62%;">';
|
96 |
$output .= '<label>';
|
97 |
+
$output .= __( 'Capabilities', 'groups' );
|
98 |
$output .= sprintf(
|
99 |
'<select class="select capability" name="capability_ids[]" multiple="multiple" placeholder="%s">',
|
100 |
+
__( 'Choose capabilities …', 'groups' )
|
101 |
);
|
102 |
foreach( $capabilities as $capability ) {
|
103 |
$output .= sprintf( '<option value="%s">%s</option>', esc_attr( $capability->capability_id ), wp_filter_nohtml_kses( $capability->capability ) );
|
106 |
$output .= '</label>';
|
107 |
$output .= '</div>';
|
108 |
$output .= '<p class="description">';
|
109 |
+
$output .= __( 'These capabilities will be assigned to the group.', 'groups' );
|
110 |
$output .= '</p>';
|
111 |
|
112 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
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' ) . '"/>';
|
120 |
$output .= '<input type="hidden" value="add" name="action"/>';
|
121 |
+
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>';
|
122 |
$output .= '</div>';
|
123 |
$output .= '</div>'; // .group.new
|
124 |
$output .= '</form>';
|
136 |
global $wpdb;
|
137 |
|
138 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
139 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
140 |
}
|
141 |
|
142 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-add' ) ) {
|
143 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
144 |
}
|
145 |
|
146 |
$creator_id = get_current_user_id();
|
160 |
do_action( 'groups_admin_groups_add_submit_success', $group_id );
|
161 |
} else {
|
162 |
if ( !$name ) {
|
163 |
+
Groups_Admin::add_message( __( 'The name must not be empty.', 'groups' ), 'error' );
|
164 |
} else if ( Groups_Group::read_by_name( $name ) ) {
|
165 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> group already exists.', 'groups' ), stripslashes( wp_filter_nohtml_kses( ( $name ) ) ) ), 'error' );
|
166 |
}
|
167 |
}
|
168 |
|
lib/admin/groups-admin-groups-edit.php
CHANGED
@@ -34,13 +34,13 @@ function groups_admin_groups_edit( $group_id ) {
|
|
34 |
$output = '';
|
35 |
|
36 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
37 |
-
wp_die( __( 'Access denied.',
|
38 |
}
|
39 |
|
40 |
$group = Groups_Group::read( intval( $group_id ) );
|
41 |
|
42 |
if ( empty( $group ) ) {
|
43 |
-
wp_die( __( 'No such group.',
|
44 |
}
|
45 |
|
46 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
@@ -65,7 +65,7 @@ function groups_admin_groups_edit( $group_id ) {
|
|
65 |
|
66 |
$output .= '<div class="manage-groups wrap">';
|
67 |
$output .= '<h1>';
|
68 |
-
$output .= __( 'Edit a group',
|
69 |
$output .= '</h1>';
|
70 |
|
71 |
$output .= Groups_Admin::render_messages();
|
@@ -76,21 +76,21 @@ function groups_admin_groups_edit( $group_id ) {
|
|
76 |
|
77 |
$output .= '<div class="field">';
|
78 |
$output .= '<label for="name-field" class="field-label first required">';
|
79 |
-
$output .= __( 'Name',
|
80 |
$output .= '</label>';
|
81 |
$output .= '<input ' . $name_readonly . ' id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr( stripslashes( $name ) ) . '"/>';
|
82 |
$output .= '</div>';
|
83 |
|
84 |
$output .= '<div class="field">';
|
85 |
$output .= '<label for="parent-id-field" class="field-label">';
|
86 |
-
$output .= __( 'Parent',
|
87 |
$output .= '</label>';
|
88 |
$output .= $parent_select;
|
89 |
$output .= '</div>';
|
90 |
|
91 |
$output .= '<div class="field">';
|
92 |
$output .= '<label for="description-field" class="field-label description-field">';
|
93 |
-
$output .= __( 'Description',
|
94 |
$output .= '</label>';
|
95 |
$output .= '<textarea id="description-field" name="description-field" rows="5" cols="45">';
|
96 |
$output .= stripslashes( wp_filter_nohtml_kses( $description ) );
|
@@ -114,10 +114,10 @@ function groups_admin_groups_edit( $group_id ) {
|
|
114 |
$output .= '<div class="field">';
|
115 |
$output .= '<div class="select-capability-container" style="width:62%;">';
|
116 |
$output .= '<label>';
|
117 |
-
$output .= __( 'Capabilities',
|
118 |
$output .= sprintf(
|
119 |
'<select class="select capability" name="capability_ids[]" multiple="multiple" placeholder="%s">',
|
120 |
-
__( 'Choose capabilities …',
|
121 |
);
|
122 |
foreach( $capabilities as $capability ) {
|
123 |
$selected = in_array( $capability->capability_id, $group_capabilities_array ) ? ' selected="selected" ' : '';
|
@@ -127,7 +127,7 @@ function groups_admin_groups_edit( $group_id ) {
|
|
127 |
$output .= '</label>';
|
128 |
$output .= '</div>'; // .select-capability-container
|
129 |
$output .= '<p class="description">';
|
130 |
-
$output .= __( 'The chosen capabilities are assigned to the group.',
|
131 |
$output .= '</p>';
|
132 |
$output .= '</div>'; // .field
|
133 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
@@ -138,7 +138,7 @@ function groups_admin_groups_edit( $group_id ) {
|
|
138 |
if ( ( count( $group_capabilities_deep ) - count( $group_capabilities ) ) > 0 ) {
|
139 |
usort( $group_capabilities_deep, array( 'Groups_Utility', 'cmp' ) );
|
140 |
$output .= '<div class="field">';
|
141 |
-
$output .= __( 'Inherited capabilities:',
|
142 |
$output .= ' ';
|
143 |
$inherited_caps = array();
|
144 |
foreach ( $group_capabilities_deep as $group_capability ) {
|
@@ -155,9 +155,9 @@ function groups_admin_groups_edit( $group_id ) {
|
|
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',
|
159 |
$output .= '<input type="hidden" value="edit" name="action"/>';
|
160 |
-
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
161 |
$output .= '</div>';
|
162 |
$output .= '</div>'; // .group.edit
|
163 |
$output .= '</form>';
|
@@ -173,11 +173,11 @@ function groups_admin_groups_edit_submit() {
|
|
173 |
global $wpdb;
|
174 |
|
175 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
176 |
-
wp_die( __( 'Access denied.',
|
177 |
}
|
178 |
|
179 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-edit' ) ) {
|
180 |
-
wp_die( __( 'Access denied.',
|
181 |
}
|
182 |
|
183 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
@@ -193,7 +193,7 @@ function groups_admin_groups_edit_submit() {
|
|
193 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
194 |
|
195 |
if ( empty( $name ) ) {
|
196 |
-
Groups_Admin::add_message( __( 'The <em>Name</em> must not be empty.',
|
197 |
return false;
|
198 |
}
|
199 |
|
@@ -201,7 +201,7 @@ function groups_admin_groups_edit_submit() {
|
|
201 |
if ( $other_group->group_id != $group_id ) {
|
202 |
Groups_Admin::add_message(
|
203 |
sprintf(
|
204 |
-
__( 'The <em>%s</em> group already exists and cannot be used to name this one.',
|
205 |
),
|
206 |
'error'
|
207 |
);
|
34 |
$output = '';
|
35 |
|
36 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
37 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
38 |
}
|
39 |
|
40 |
$group = Groups_Group::read( intval( $group_id ) );
|
41 |
|
42 |
if ( empty( $group ) ) {
|
43 |
+
wp_die( __( 'No such group.', 'groups' ) );
|
44 |
}
|
45 |
|
46 |
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
65 |
|
66 |
$output .= '<div class="manage-groups wrap">';
|
67 |
$output .= '<h1>';
|
68 |
+
$output .= __( 'Edit a group', 'groups' );
|
69 |
$output .= '</h1>';
|
70 |
|
71 |
$output .= Groups_Admin::render_messages();
|
76 |
|
77 |
$output .= '<div class="field">';
|
78 |
$output .= '<label for="name-field" class="field-label first required">';
|
79 |
+
$output .= __( 'Name', 'groups' );
|
80 |
$output .= '</label>';
|
81 |
$output .= '<input ' . $name_readonly . ' id="name-field" name="name-field" class="namefield" type="text" value="' . esc_attr( stripslashes( $name ) ) . '"/>';
|
82 |
$output .= '</div>';
|
83 |
|
84 |
$output .= '<div class="field">';
|
85 |
$output .= '<label for="parent-id-field" class="field-label">';
|
86 |
+
$output .= __( 'Parent', 'groups' );
|
87 |
$output .= '</label>';
|
88 |
$output .= $parent_select;
|
89 |
$output .= '</div>';
|
90 |
|
91 |
$output .= '<div class="field">';
|
92 |
$output .= '<label for="description-field" class="field-label description-field">';
|
93 |
+
$output .= __( 'Description', 'groups' );
|
94 |
$output .= '</label>';
|
95 |
$output .= '<textarea id="description-field" name="description-field" rows="5" cols="45">';
|
96 |
$output .= stripslashes( wp_filter_nohtml_kses( $description ) );
|
114 |
$output .= '<div class="field">';
|
115 |
$output .= '<div class="select-capability-container" style="width:62%;">';
|
116 |
$output .= '<label>';
|
117 |
+
$output .= __( 'Capabilities', 'groups' );
|
118 |
$output .= sprintf(
|
119 |
'<select class="select capability" name="capability_ids[]" multiple="multiple" placeholder="%s">',
|
120 |
+
__( 'Choose capabilities …', 'groups' )
|
121 |
);
|
122 |
foreach( $capabilities as $capability ) {
|
123 |
$selected = in_array( $capability->capability_id, $group_capabilities_array ) ? ' selected="selected" ' : '';
|
127 |
$output .= '</label>';
|
128 |
$output .= '</div>'; // .select-capability-container
|
129 |
$output .= '<p class="description">';
|
130 |
+
$output .= __( 'The chosen capabilities are assigned to the group.', 'groups' );
|
131 |
$output .= '</p>';
|
132 |
$output .= '</div>'; // .field
|
133 |
$output .= Groups_UIE::render_select( '.select.capability' );
|
138 |
if ( ( count( $group_capabilities_deep ) - count( $group_capabilities ) ) > 0 ) {
|
139 |
usort( $group_capabilities_deep, array( 'Groups_Utility', 'cmp' ) );
|
140 |
$output .= '<div class="field">';
|
141 |
+
$output .= __( 'Inherited capabilities:', 'groups' );
|
142 |
$output .= ' ';
|
143 |
$inherited_caps = array();
|
144 |
foreach ( $group_capabilities_deep as $group_capability ) {
|
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' ) . '"/>';
|
159 |
$output .= '<input type="hidden" value="edit" name="action"/>';
|
160 |
+
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>';
|
161 |
$output .= '</div>';
|
162 |
$output .= '</div>'; // .group.edit
|
163 |
$output .= '</form>';
|
173 |
global $wpdb;
|
174 |
|
175 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
176 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
177 |
}
|
178 |
|
179 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-edit' ) ) {
|
180 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
181 |
}
|
182 |
|
183 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
193 |
$description = isset( $_POST['description-field'] ) ? $_POST['description-field'] : '';
|
194 |
|
195 |
if ( empty( $name ) ) {
|
196 |
+
Groups_Admin::add_message( __( 'The <em>Name</em> must not be empty.', 'groups' ), 'error' );
|
197 |
return false;
|
198 |
}
|
199 |
|
201 |
if ( $other_group->group_id != $group_id ) {
|
202 |
Groups_Admin::add_message(
|
203 |
sprintf(
|
204 |
+
__( 'The <em>%s</em> group already exists and cannot be used to name this one.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $other_group->name ) )
|
205 |
),
|
206 |
'error'
|
207 |
);
|
lib/admin/groups-admin-groups-remove.php
CHANGED
@@ -32,13 +32,13 @@ function groups_admin_groups_remove( $group_id ) {
|
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
-
wp_die( __( 'Access denied.',
|
36 |
}
|
37 |
|
38 |
$group = Groups_Group::read( intval( $group_id ) );
|
39 |
|
40 |
if ( empty( $group ) ) {
|
41 |
-
wp_die( __( 'No such group.',
|
42 |
}
|
43 |
|
44 |
$group_table = _groups_get_tablename( 'group' );
|
@@ -50,18 +50,18 @@ function groups_admin_groups_remove( $group_id ) {
|
|
50 |
$output =
|
51 |
'<div class="manage-groups wrap">' .
|
52 |
'<h1>' .
|
53 |
-
__( 'Remove a group',
|
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 ) ) . '"/>' .
|
58 |
'<ul>' .
|
59 |
-
'<li>' . sprintf( __( 'Group Name : %s',
|
60 |
'</ul> ' .
|
61 |
wp_nonce_field( 'groups-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
62 |
-
'<input class="button button-primary" type="submit" value="' . __( 'Remove',
|
63 |
'<input type="hidden" value="remove" name="action"/>' .
|
64 |
-
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
65 |
'</div>' .
|
66 |
'</div>' . // .group.remove
|
67 |
'</form>' .
|
@@ -80,11 +80,11 @@ function groups_admin_groups_remove_submit() {
|
|
80 |
$result = false;
|
81 |
|
82 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
83 |
-
wp_die( __( 'Access denied.',
|
84 |
}
|
85 |
|
86 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-remove' ) ) {
|
87 |
-
wp_die( __( 'Access denied.',
|
88 |
}
|
89 |
|
90 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
@@ -107,13 +107,13 @@ function groups_admin_groups_bulk_remove() {
|
|
107 |
$output = '';
|
108 |
|
109 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
110 |
-
wp_die( __( 'Access denied.',
|
111 |
}
|
112 |
|
113 |
$group_ids = isset( $_POST['group_ids'] ) ? $_POST['group_ids'] : null;
|
114 |
|
115 |
if ( ! $group_ids ) {
|
116 |
-
wp_die( __( 'No such groups.',
|
117 |
}
|
118 |
|
119 |
$groups = array();
|
@@ -132,26 +132,26 @@ function groups_admin_groups_bulk_remove() {
|
|
132 |
|
133 |
$output .= '<div class="manage-groups wrap">';
|
134 |
$output .= '<h1>';
|
135 |
-
$output .= __( 'Remove groups',
|
136 |
$output .= '</h1>';
|
137 |
|
138 |
$output .= '<form id="groups-action" method="post" action="">';
|
139 |
$output .= '<div class="group remove">';
|
140 |
|
141 |
$output .= '<p>';
|
142 |
-
$output .= __( 'Please confirm removal of the following groups. This action cannot be undone.',
|
143 |
$output .= '</p>';
|
144 |
|
145 |
foreach ( $groups as $group ) {
|
146 |
$output .= '<input id="group_ids" name="group_ids[]" type="hidden" value="' . esc_attr( intval( $group->group_id ) ) . '"/>';
|
147 |
$output .= '<ul>';
|
148 |
$output .= '<li>';
|
149 |
-
$output .= sprintf( __( '<strong>%s</strong>',
|
150 |
$output .= '</li>';
|
151 |
$output .= '</ul>';
|
152 |
}
|
153 |
-
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove",
|
154 |
-
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel',
|
155 |
|
156 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
157 |
$output .= '<input type="hidden" name="bulk-action" value="remove-group"/>';
|
@@ -174,11 +174,11 @@ function groups_admin_groups_bulk_remove_submit() {
|
|
174 |
|
175 |
$result = array();
|
176 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
177 |
-
wp_die( __( 'Access denied.',
|
178 |
}
|
179 |
|
180 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_ACTION_NONCE], 'admin' ) ) {
|
181 |
-
wp_die( __( 'Access denied.',
|
182 |
}
|
183 |
|
184 |
$group_ids = isset( $_POST['group_ids'] ) ? $_POST['group_ids'] : null;
|
32 |
global $wpdb;
|
33 |
|
34 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
35 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
36 |
}
|
37 |
|
38 |
$group = Groups_Group::read( intval( $group_id ) );
|
39 |
|
40 |
if ( empty( $group ) ) {
|
41 |
+
wp_die( __( 'No such group.', 'groups' ) );
|
42 |
}
|
43 |
|
44 |
$group_table = _groups_get_tablename( 'group' );
|
50 |
$output =
|
51 |
'<div class="manage-groups wrap">' .
|
52 |
'<h1>' .
|
53 |
+
__( 'Remove a group', 'groups' ) .
|
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 ) ) . '"/>' .
|
58 |
'<ul>' .
|
59 |
+
'<li>' . sprintf( __( 'Group Name : %s', 'groups' ), stripslashes( wp_filter_nohtml_kses( $group->name ) ) ) . '</li>' .
|
60 |
'</ul> ' .
|
61 |
wp_nonce_field( 'groups-remove', GROUPS_ADMIN_GROUPS_NONCE, true, false ) .
|
62 |
+
'<input class="button button-primary" type="submit" value="' . __( 'Remove', 'groups' ) . '"/>' .
|
63 |
'<input type="hidden" value="remove" name="action"/>' .
|
64 |
+
'<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>' .
|
65 |
'</div>' .
|
66 |
'</div>' . // .group.remove
|
67 |
'</form>' .
|
80 |
$result = false;
|
81 |
|
82 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
83 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
84 |
}
|
85 |
|
86 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE], 'groups-remove' ) ) {
|
87 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
88 |
}
|
89 |
|
90 |
$group_id = isset( $_POST['group-id-field'] ) ? $_POST['group-id-field'] : null;
|
107 |
$output = '';
|
108 |
|
109 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
110 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
111 |
}
|
112 |
|
113 |
$group_ids = isset( $_POST['group_ids'] ) ? $_POST['group_ids'] : null;
|
114 |
|
115 |
if ( ! $group_ids ) {
|
116 |
+
wp_die( __( 'No such groups.', 'groups' ) );
|
117 |
}
|
118 |
|
119 |
$groups = array();
|
132 |
|
133 |
$output .= '<div class="manage-groups wrap">';
|
134 |
$output .= '<h1>';
|
135 |
+
$output .= __( 'Remove groups', 'groups' );
|
136 |
$output .= '</h1>';
|
137 |
|
138 |
$output .= '<form id="groups-action" method="post" action="">';
|
139 |
$output .= '<div class="group remove">';
|
140 |
|
141 |
$output .= '<p>';
|
142 |
+
$output .= __( 'Please confirm removal of the following groups. This action cannot be undone.', 'groups' );
|
143 |
$output .= '</p>';
|
144 |
|
145 |
foreach ( $groups as $group ) {
|
146 |
$output .= '<input id="group_ids" name="group_ids[]" type="hidden" value="' . esc_attr( intval( $group->group_id ) ) . '"/>';
|
147 |
$output .= '<ul>';
|
148 |
$output .= '<li>';
|
149 |
+
$output .= sprintf( __( '<strong>%s</strong>', 'groups' ), wp_filter_nohtml_kses( $group->name ) );
|
150 |
$output .= '</li>';
|
151 |
$output .= '</ul>';
|
152 |
}
|
153 |
+
$output .= '<input class="button button-primary" type="submit" name="bulk" value="' . __( "Remove", 'groups' ) . '"/>';
|
154 |
+
$output .= '<a class="cancel button" href="' . esc_url( $current_url ) . '">' . __( 'Cancel', 'groups' ) . '</a>';
|
155 |
|
156 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
157 |
$output .= '<input type="hidden" name="bulk-action" value="remove-group"/>';
|
174 |
|
175 |
$result = array();
|
176 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
177 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
178 |
}
|
179 |
|
180 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_ACTION_NONCE], 'admin' ) ) {
|
181 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
182 |
}
|
183 |
|
184 |
$group_ids = isset( $_POST['group_ids'] ) ? $_POST['group_ids'] : null;
|
lib/admin/groups-admin-groups.php
CHANGED
@@ -46,7 +46,7 @@ function groups_admin_groups() {
|
|
46 |
$today = date( 'Y-m-d', time() );
|
47 |
|
48 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
49 |
-
wp_die( __( 'Access denied.',
|
50 |
}
|
51 |
|
52 |
//
|
@@ -60,7 +60,7 @@ function groups_admin_groups() {
|
|
60 |
return groups_admin_groups_add();
|
61 |
} else {
|
62 |
$group = Groups_Group::read( $group_id );
|
63 |
-
Groups_Admin::add_message( sprintf( __( "The <em>%s</em> group has been created.",
|
64 |
}
|
65 |
break;
|
66 |
case 'edit' :
|
@@ -68,12 +68,12 @@ function groups_admin_groups() {
|
|
68 |
return groups_admin_groups_edit( $_POST['group-id-field'] );
|
69 |
} else {
|
70 |
$group = Groups_Group::read( $group_id );
|
71 |
-
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> group has been updated.',
|
72 |
}
|
73 |
break;
|
74 |
case 'remove' :
|
75 |
if ( $group_id = groups_admin_groups_remove_submit() ) {
|
76 |
-
Groups_Admin::add_message( __( 'The group has been deleted.',
|
77 |
}
|
78 |
break;
|
79 |
// bulk actions on groups: add capabilities, remove capabilities, remove groups
|
@@ -145,7 +145,7 @@ function groups_admin_groups() {
|
|
145 |
isset( $_POST['group_name'] )
|
146 |
) {
|
147 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_FILTER_NONCE], 'admin' ) ) {
|
148 |
-
wp_die( __( 'Access denied.',
|
149 |
}
|
150 |
}
|
151 |
|
@@ -176,13 +176,13 @@ function groups_admin_groups() {
|
|
176 |
|
177 |
if ( isset( $_POST['row_count'] ) ) {
|
178 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE_1], 'admin' ) ) {
|
179 |
-
wp_die( __( 'Access denied.',
|
180 |
}
|
181 |
}
|
182 |
|
183 |
if ( isset( $_POST['paged'] ) ) {
|
184 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE_2], 'admin' ) ) {
|
185 |
-
wp_die( __( 'Access denied.',
|
186 |
}
|
187 |
}
|
188 |
|
@@ -196,20 +196,20 @@ function groups_admin_groups() {
|
|
196 |
$output .=
|
197 |
'<div class="manage-groups wrap">' .
|
198 |
'<h1>' .
|
199 |
-
_x( 'Groups', 'page-title',
|
200 |
sprintf(
|
201 |
'<a title="%s" class="add page-title-action" href="%s">',
|
202 |
-
esc_attr( __( 'Click to add a new group',
|
203 |
esc_url( $current_url . '&action=add' )
|
204 |
) .
|
205 |
sprintf(
|
206 |
'<img class="icon" alt="%s" src="%s" />',
|
207 |
-
esc_attr( __( 'Add',
|
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',
|
213 |
) .
|
214 |
'</a>' .
|
215 |
'</h1>';
|
@@ -300,10 +300,10 @@ function groups_admin_groups() {
|
|
300 |
$results = $wpdb->get_results( $query, OBJECT );
|
301 |
|
302 |
$column_display_names = array(
|
303 |
-
'group_id' => __( 'ID',
|
304 |
-
'name' => __( 'Group',
|
305 |
-
'description' => __( 'Description',
|
306 |
-
'capabilities' => __( 'Capabilities',
|
307 |
);
|
308 |
|
309 |
$output .= '<div class="groups-overview">';
|
@@ -312,16 +312,16 @@ function groups_admin_groups() {
|
|
312 |
'<div class="filters">' .
|
313 |
'<form id="setfilters" action="" method="post">' .
|
314 |
'<fieldset>' .
|
315 |
-
'<legend>' . __( 'Filters',
|
316 |
-
'<label class="group-id-filter">' . __( 'Group ID',
|
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',
|
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',
|
324 |
-
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear',
|
325 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
326 |
'</fieldset>' .
|
327 |
'</form>' .
|
@@ -343,10 +343,10 @@ function groups_admin_groups() {
|
|
343 |
$output .= '<div class="page-options right">';
|
344 |
$output .= '<form id="setrowcount" action="" method="post">';
|
345 |
$output .= '<div>';
|
346 |
-
$output .= '<label for="row_count">' . __('Results per page',
|
347 |
$output .= '<input name="row_count" type="text" size="2" value="' . esc_attr( $row_count ) .'" />';
|
348 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_NONCE_1, true, false );
|
349 |
-
$output .= '<input class="button" type="submit" value="' . __( 'Apply',
|
350 |
$output .= '</div>';
|
351 |
$output .= '</form>';
|
352 |
$output .= '</div>';
|
@@ -358,8 +358,8 @@ function groups_admin_groups() {
|
|
358 |
$capabilities = $wpdb->get_results( "SELECT * FROM $capability_table ORDER BY capability" );
|
359 |
$capabilities_select = sprintf(
|
360 |
'<select class="select capability" name="capability_id[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
361 |
-
esc_attr( __( 'Capabilities …',
|
362 |
-
esc_attr( __( 'Capabilities …',
|
363 |
);
|
364 |
foreach( $capabilities as $capability ) {
|
365 |
$capabilities_select .= sprintf( '<option value="%s">%s</option>', esc_attr( $capability->capability_id ), wp_filter_nohtml_kses( $capability->capability ) );
|
@@ -377,12 +377,12 @@ function groups_admin_groups() {
|
|
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',
|
381 |
-
$output .= '<option value="remove-group">' . esc_html( __( 'Remove group',
|
382 |
-
$output .= '<option value="add-capability">' . esc_html( __( 'Add capability',
|
383 |
-
$output .= '<option value="remove-capability">' . esc_html( __( 'Remove capability',
|
384 |
$output .= '</select>';
|
385 |
-
$output .= sprintf( '<input class="button" type="submit" name="bulk" value="%s" />', esc_attr( __( 'Apply',
|
386 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
387 |
$output .= '</div>';
|
388 |
$output .= '</div>';
|
@@ -457,7 +457,7 @@ function groups_admin_groups() {
|
|
457 |
'<span class="edit">' .
|
458 |
'<a href="' . esc_url( $edit_url ) . '">' .
|
459 |
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
460 |
-
__( 'Edit',
|
461 |
'</a>';
|
462 |
if ( $result->name !== Groups_Registered::REGISTERED_GROUP_NAME ) {
|
463 |
$row_actions .=
|
@@ -466,7 +466,7 @@ function groups_admin_groups() {
|
|
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',
|
470 |
'</a>' .
|
471 |
'</span>';
|
472 |
}
|
@@ -513,14 +513,14 @@ function groups_admin_groups() {
|
|
513 |
}
|
514 |
$output .= '</ul>';
|
515 |
} else {
|
516 |
-
$output .= __( 'This group has no capabilities.',
|
517 |
}
|
518 |
$output .= '</td>';
|
519 |
|
520 |
$output .= '</tr>';
|
521 |
}
|
522 |
} else {
|
523 |
-
$output .= '<tr><td colspan="4">' . __( 'There are no results.',
|
524 |
}
|
525 |
|
526 |
$output .= '</tbody>';
|
46 |
$today = date( 'Y-m-d', time() );
|
47 |
|
48 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
49 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
50 |
}
|
51 |
|
52 |
//
|
60 |
return groups_admin_groups_add();
|
61 |
} else {
|
62 |
$group = Groups_Group::read( $group_id );
|
63 |
+
Groups_Admin::add_message( sprintf( __( "The <em>%s</em> group has been created.", 'groups' ), stripslashes( wp_filter_nohtml_kses( $group->name ) ) ) );
|
64 |
}
|
65 |
break;
|
66 |
case 'edit' :
|
68 |
return groups_admin_groups_edit( $_POST['group-id-field'] );
|
69 |
} else {
|
70 |
$group = Groups_Group::read( $group_id );
|
71 |
+
Groups_Admin::add_message( sprintf( __( 'The <em>%s</em> group has been updated.', 'groups' ), stripslashes( wp_filter_nohtml_kses( $group->name ) ) ) );
|
72 |
}
|
73 |
break;
|
74 |
case 'remove' :
|
75 |
if ( $group_id = groups_admin_groups_remove_submit() ) {
|
76 |
+
Groups_Admin::add_message( __( 'The group has been deleted.', 'groups' ) );
|
77 |
}
|
78 |
break;
|
79 |
// bulk actions on groups: add capabilities, remove capabilities, remove groups
|
145 |
isset( $_POST['group_name'] )
|
146 |
) {
|
147 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_FILTER_NONCE], 'admin' ) ) {
|
148 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
149 |
}
|
150 |
}
|
151 |
|
176 |
|
177 |
if ( isset( $_POST['row_count'] ) ) {
|
178 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE_1], 'admin' ) ) {
|
179 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
180 |
}
|
181 |
}
|
182 |
|
183 |
if ( isset( $_POST['paged'] ) ) {
|
184 |
if ( !wp_verify_nonce( $_POST[GROUPS_ADMIN_GROUPS_NONCE_2], 'admin' ) ) {
|
185 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
186 |
}
|
187 |
}
|
188 |
|
196 |
$output .=
|
197 |
'<div class="manage-groups wrap">' .
|
198 |
'<h1>' .
|
199 |
+
_x( 'Groups', 'page-title', 'groups' ) .
|
200 |
sprintf(
|
201 |
'<a title="%s" class="add page-title-action" href="%s">',
|
202 |
+
esc_attr( __( 'Click to add a new group', 'groups' ) ),
|
203 |
esc_url( $current_url . '&action=add' )
|
204 |
) .
|
205 |
sprintf(
|
206 |
'<img class="icon" alt="%s" src="%s" />',
|
207 |
+
esc_attr( __( 'Add', 'groups' ) ),
|
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' ) ) )
|
213 |
) .
|
214 |
'</a>' .
|
215 |
'</h1>';
|
300 |
$results = $wpdb->get_results( $query, OBJECT );
|
301 |
|
302 |
$column_display_names = array(
|
303 |
+
'group_id' => __( 'ID', 'groups' ),
|
304 |
+
'name' => __( 'Group', 'groups' ),
|
305 |
+
'description' => __( 'Description', 'groups' ),
|
306 |
+
'capabilities' => __( 'Capabilities', 'groups' )
|
307 |
);
|
308 |
|
309 |
$output .= '<div class="groups-overview">';
|
312 |
'<div class="filters">' .
|
313 |
'<form id="setfilters" action="" method="post">' .
|
314 |
'<fieldset>' .
|
315 |
+
'<legend>' . __( 'Filters', 'groups' ) . '</legend>' .
|
316 |
+
'<label class="group-id-filter">' . __( 'Group ID', 'groups' ) . ' ' .
|
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' ) . ' ' .
|
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' ) . '"/>' . ' ' .
|
324 |
+
'<input class="button" type="submit" name="clear_filters" value="' . __( 'Clear', 'groups' ) . '"/>' .
|
325 |
'<input type="hidden" value="submitted" name="submitted"/>' .
|
326 |
'</fieldset>' .
|
327 |
'</form>' .
|
343 |
$output .= '<div class="page-options right">';
|
344 |
$output .= '<form id="setrowcount" action="" method="post">';
|
345 |
$output .= '<div>';
|
346 |
+
$output .= '<label for="row_count">' . __('Results per page', 'groups' ) . '</label>';
|
347 |
$output .= '<input name="row_count" type="text" size="2" value="' . esc_attr( $row_count ) .'" />';
|
348 |
$output .= wp_nonce_field( 'admin', GROUPS_ADMIN_GROUPS_NONCE_1, true, false );
|
349 |
+
$output .= '<input class="button" type="submit" value="' . __( 'Apply', 'groups' ) . '"/>';
|
350 |
$output .= '</div>';
|
351 |
$output .= '</form>';
|
352 |
$output .= '</div>';
|
358 |
$capabilities = $wpdb->get_results( "SELECT * FROM $capability_table ORDER BY capability" );
|
359 |
$capabilities_select = sprintf(
|
360 |
'<select class="select capability" name="capability_id[]" multiple="multiple" placeholder="%s" data-placeholder="%s">',
|
361 |
+
esc_attr( __( 'Capabilities …', 'groups' ) ) ,
|
362 |
+
esc_attr( __( 'Capabilities …', 'groups' ) )
|
363 |
);
|
364 |
foreach( $capabilities as $capability ) {
|
365 |
$capabilities_select .= sprintf( '<option value="%s">%s</option>', esc_attr( $capability->capability_id ), wp_filter_nohtml_kses( $capability->capability ) );
|
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' ) ) . '</option>';
|
381 |
+
$output .= '<option value="remove-group">' . esc_html( __( 'Remove group', 'groups' ) ) . '</option>';
|
382 |
+
$output .= '<option value="add-capability">' . esc_html( __( 'Add capability', 'groups' ) ) . '</option>';
|
383 |
+
$output .= '<option value="remove-capability">' . esc_html( __( 'Remove capability', 'groups' ) ) . '</option>';
|
384 |
$output .= '</select>';
|
385 |
+
$output .= sprintf( '<input class="button" type="submit" name="bulk" value="%s" />', esc_attr( __( 'Apply', 'groups' ) ) );
|
386 |
$output .= '<input type="hidden" name="action" value="groups-action"/>';
|
387 |
$output .= '</div>';
|
388 |
$output .= '</div>';
|
457 |
'<span class="edit">' .
|
458 |
'<a href="' . esc_url( $edit_url ) . '">' .
|
459 |
'<img src="' . GROUPS_PLUGIN_URL . 'images/edit.png"/>' .
|
460 |
+
__( 'Edit', 'groups' ) .
|
461 |
'</a>';
|
462 |
if ( $result->name !== Groups_Registered::REGISTERED_GROUP_NAME ) {
|
463 |
$row_actions .=
|
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' ) .
|
470 |
'</a>' .
|
471 |
'</span>';
|
472 |
}
|
513 |
}
|
514 |
$output .= '</ul>';
|
515 |
} else {
|
516 |
+
$output .= __( 'This group has no capabilities.', 'groups' );
|
517 |
}
|
518 |
$output .= '</td>';
|
519 |
|
520 |
$output .= '</tr>';
|
521 |
}
|
522 |
} else {
|
523 |
+
$output .= '<tr><td colspan="4">' . __( 'There are no results.', 'groups' ) . '</td></tr>';
|
524 |
}
|
525 |
|
526 |
$output .= '</tbody>';
|
lib/admin/groups-admin-options.php
CHANGED
@@ -36,7 +36,7 @@ function groups_admin_options() {
|
|
36 |
global $wpdb, $wp_roles;
|
37 |
|
38 |
if ( !current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
39 |
-
wp_die( __( 'Access denied.',
|
40 |
}
|
41 |
|
42 |
$is_sitewide_plugin = false;
|
@@ -47,9 +47,10 @@ function groups_admin_options() {
|
|
47 |
}
|
48 |
|
49 |
$caps = array(
|
50 |
-
GROUPS_ACCESS_GROUPS => __( 'Access Groups',
|
51 |
-
GROUPS_ADMINISTER_GROUPS => __( 'Administer Groups',
|
52 |
-
GROUPS_ADMINISTER_OPTIONS => __( 'Administer Groups plugin options',
|
|
|
53 |
);
|
54 |
|
55 |
//
|
@@ -76,19 +77,6 @@ function groups_admin_options() {
|
|
76 |
}
|
77 |
Groups_Options::update_option( Groups_Post_Access::POST_TYPES, $post_types_option );
|
78 |
|
79 |
-
$valid_read_caps = array( Groups_Post_Access::READ_POST_CAPABILITY );
|
80 |
-
if ( !empty( $_POST[GROUPS_READ_POST_CAPABILITIES] ) ) {
|
81 |
-
$read_caps = $_POST[GROUPS_READ_POST_CAPABILITIES];
|
82 |
-
foreach( $read_caps as $read_cap ) {
|
83 |
-
if ( $valid_cap = Groups_Capability::read( $read_cap ) ) {
|
84 |
-
if ( !in_array( $valid_cap->capability, $valid_read_caps ) ) {
|
85 |
-
$valid_read_caps[] = $valid_cap->capability;
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
}
|
90 |
-
Groups_Options::update_option( Groups_Post_Access::READ_POST_CAPABILITIES, $valid_read_caps );
|
91 |
-
|
92 |
// tree view
|
93 |
if ( !empty( $_POST[GROUPS_SHOW_TREE_VIEW] ) ) {
|
94 |
Groups_Options::update_option( GROUPS_SHOW_TREE_VIEW, true );
|
@@ -122,7 +110,15 @@ function groups_admin_options() {
|
|
122 |
Groups_Options::update_option( 'groups_delete_data', false );
|
123 |
}
|
124 |
}
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
}
|
128 |
|
@@ -130,7 +126,7 @@ function groups_admin_options() {
|
|
130 |
|
131 |
echo
|
132 |
'<h1>' .
|
133 |
-
__( 'Groups Options',
|
134 |
'</h1>';
|
135 |
|
136 |
echo Groups_Admin::render_messages();
|
@@ -145,7 +141,7 @@ function groups_admin_options() {
|
|
145 |
$caps_table .= '<thead>';
|
146 |
$caps_table .= '<tr>';
|
147 |
$caps_table .= '<td class="role">';
|
148 |
-
$caps_table .= __( 'Role',
|
149 |
$caps_table .= '</td>';
|
150 |
foreach ( $caps as $cap ) {
|
151 |
$caps_table .= '<td class="cap">';
|
@@ -190,7 +186,7 @@ function groups_admin_options() {
|
|
190 |
$dismiss_url = wp_nonce_url( add_query_arg( 'dismiss-groups-extensions-box', '1', admin_url( 'admin.php?page=groups-admin-options' ) ), 'dismiss-box', 'groups-extensions-box-nonce' );
|
191 |
$extensions_box =
|
192 |
'<div id="groups-extensions-box">' .
|
193 |
-
__( 'Enhanced functionality is available via official <a href="http://www.itthinx.com/shop/">Extensions</a> for Groups.',
|
194 |
sprintf( '<a class="close" href="%s">x</a>', esc_url( $dismiss_url ) ) .
|
195 |
'</div>';
|
196 |
}
|
@@ -202,25 +198,25 @@ function groups_admin_options() {
|
|
202 |
'<form action="" name="options" method="post">' .
|
203 |
|
204 |
'<p>' .
|
205 |
-
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save',
|
206 |
$extensions_box .
|
207 |
'</p>' .
|
208 |
|
209 |
'<div>' .
|
210 |
-
'<h2>' . __( 'Administrator Access Override',
|
211 |
'<p>' .
|
212 |
'<label>' .
|
213 |
'<input name="' . GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE . '" type="checkbox" ' . ( $admin_override ? 'checked="checked"' : '' ) . '/>' .
|
214 |
-
__( 'Administrators override all access permissions derived from Groups capabilities.',
|
215 |
'</label>' .
|
216 |
'</p>';
|
217 |
|
218 |
-
echo '<h2>' . __( 'Access restricions',
|
219 |
|
220 |
-
echo '<h3>' . __( 'Post types',
|
221 |
|
222 |
echo
|
223 |
-
'<p class="description">' . __( 'Show access restrictions for these post types.',
|
224 |
|
225 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
226 |
$post_types = get_post_types( array( 'public' => true ) );
|
@@ -243,78 +239,68 @@ function groups_admin_options() {
|
|
243 |
echo '<ul>';
|
244 |
echo
|
245 |
'<p class="description">' .
|
246 |
-
__( 'This determines for which post types access restriction settings are offered.',
|
247 |
-
__( 'Disabling this setting for a post type does not remove existing access restrictions on individual posts of that type.',
|
248 |
-
'</p>';
|
249 |
-
|
250 |
-
|
251 |
-
echo '<h3>' . __( 'Capabilities', GROUPS_PLUGIN_DOMAIN ) . '</h3>';
|
252 |
-
|
253 |
-
echo '<p class="description">' .
|
254 |
-
__( 'Include these capabilities to enforce read access on posts. The selected capabilities will be offered to restrict access to posts.', GROUPS_PLUGIN_DOMAIN ) .
|
255 |
'</p>';
|
256 |
|
257 |
-
$capability_table = _groups_get_tablename( "capability" );
|
258 |
-
$capabilities = $wpdb->get_results( "SELECT * FROM $capability_table ORDER BY capability" );
|
259 |
-
$applicable_read_caps = Groups_Options::get_option( Groups_Post_Access::READ_POST_CAPABILITIES, array( Groups_Post_Access::READ_POST_CAPABILITY ) );
|
260 |
-
echo '<div class="select-capability-container" style="width:62%;">';
|
261 |
-
printf( '<select class="select capability" name="%s" multiple="multiple">', GROUPS_READ_POST_CAPABILITIES . '[]' );
|
262 |
-
foreach( $capabilities as $capability ) {
|
263 |
-
$selected = in_array( $capability->capability, $applicable_read_caps ) ? ' selected="selected" ' : '';
|
264 |
-
if ( $capability->capability == Groups_Post_Access::READ_POST_CAPABILITY ) {
|
265 |
-
$selected .= ' disabled="disabled" ';
|
266 |
-
}
|
267 |
-
printf( '<option value="%s" %s>%s</option>', esc_attr( $capability->capability_id ), $selected, wp_filter_nohtml_kses( $capability->capability ) );
|
268 |
-
}
|
269 |
-
echo '</select>';
|
270 |
-
echo '</div>';
|
271 |
-
|
272 |
-
echo Groups_UIE::render_select( '.select.capability' );
|
273 |
-
|
274 |
echo
|
275 |
-
'<h2>' . __( 'User profiles',
|
276 |
'<p>' .
|
277 |
'<label>' .
|
278 |
'<input name="' . GROUPS_SHOW_IN_USER_PROFILE . '" type="checkbox" ' . ( $show_in_user_profile ? 'checked="checked"' : '' ) . '/>' .
|
279 |
-
__( 'Show groups in user profiles.',
|
280 |
'</label>' .
|
281 |
'</p>';
|
282 |
|
283 |
echo
|
284 |
-
'<h2>' . __( 'Tree view',
|
285 |
'<p>' .
|
286 |
'<label>' .
|
287 |
'<input name="' . GROUPS_SHOW_TREE_VIEW . '" type="checkbox" ' . ( $show_tree_view ? 'checked="checked"' : '' ) . '/>' .
|
288 |
-
__( 'Show the Groups tree view.',
|
289 |
'</label>' .
|
290 |
'</p>';
|
291 |
|
292 |
echo
|
293 |
-
'<h2>' . __( 'Permissions',
|
294 |
-
'<p>' . __( 'These permissions apply to Groups management. They do not apply to access permissions derived from Groups capabilities.',
|
295 |
$caps_table .
|
296 |
'<p class="description">' .
|
297 |
-
__( 'A minimum set of permissions will be preserved.',
|
298 |
'<br/>' .
|
299 |
-
__( 'If you lock yourself out, please ask an administrator to help.',
|
300 |
'</p>';
|
301 |
if ( !$is_sitewide_plugin ) {
|
302 |
echo
|
303 |
-
'<h2>' . __( 'Deactivation and data persistence',
|
304 |
'<p>' .
|
305 |
'<label>' .
|
306 |
'<input name="delete-data" type="checkbox" ' . ( $delete_data ? 'checked="checked"' : '' ) . '/>' .
|
307 |
-
__( 'Delete all Groups plugin data on deactivation',
|
308 |
'</label>' .
|
309 |
'</p>' .
|
310 |
'<p class="description warning">' .
|
311 |
-
__( 'CAUTION: If this option is active while the plugin is deactivated, ALL plugin settings and data will be DELETED. If you are going to use this option, now would be a good time to make a backup. By enabling this option you agree to be solely responsible for any loss of data or any other consequences thereof.',
|
312 |
'</p>';
|
313 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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',
|
318 |
'</p>' .
|
319 |
'</div>' .
|
320 |
'</form>';
|
@@ -322,16 +308,19 @@ function groups_admin_options() {
|
|
322 |
echo '</div>'; // .groups-options
|
323 |
}
|
324 |
|
|
|
|
|
|
|
325 |
function groups_network_admin_options() {
|
326 |
|
327 |
if ( !current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
328 |
-
wp_die( __( 'Access denied.',
|
329 |
}
|
330 |
|
331 |
echo
|
332 |
'<div>' .
|
333 |
'<h1>' .
|
334 |
-
__( 'Groups network options',
|
335 |
'</h1>' .
|
336 |
'</div>';
|
337 |
|
@@ -353,18 +342,18 @@ function groups_network_admin_options() {
|
|
353 |
echo
|
354 |
'<form action="" name="options" method="post">' .
|
355 |
'<div>' .
|
356 |
-
'<h2>' . __( 'Network deactivation and data persistence',
|
357 |
'<p>' .
|
358 |
'<input name="delete-data" type="checkbox" ' . ( $delete_data ? 'checked="checked"' : '' ) . '/>' .
|
359 |
-
'<label for="delete-data">' . __( 'Delete all Groups plugin data for ALL sites on network deactivation',
|
360 |
'</p>' .
|
361 |
'<p class="description warning">' .
|
362 |
-
__( 'CAUTION: If this option is active while the plugin is deactivated, ALL plugin settings and data will be DELETED for <strong>all sites</strong>. If you are going to use this option, now would be a good time to make a backup. By enabling this option you agree to be solely responsible for any loss of data or any other consequences thereof.',
|
363 |
'</p>' .
|
364 |
'<p>' .
|
365 |
wp_nonce_field( 'admin', GROUPS_ADMIN_OPTIONS_NONCE, true, false ) .
|
366 |
-
'<input type="submit" name="submit" value="' . __( 'Save',
|
367 |
'</p>' .
|
368 |
'</div>' .
|
369 |
'</form>';
|
370 |
-
}
|
36 |
global $wpdb, $wp_roles;
|
37 |
|
38 |
if ( !current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
39 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
40 |
}
|
41 |
|
42 |
$is_sitewide_plugin = false;
|
47 |
}
|
48 |
|
49 |
$caps = array(
|
50 |
+
GROUPS_ACCESS_GROUPS => __( 'Access Groups', 'groups' ),
|
51 |
+
GROUPS_ADMINISTER_GROUPS => __( 'Administer Groups', 'groups' ),
|
52 |
+
GROUPS_ADMINISTER_OPTIONS => __( 'Administer Groups plugin options', 'groups' ),
|
53 |
+
GROUPS_RESTRICT_ACCESS => __( 'Restrict Access', 'groups' )
|
54 |
);
|
55 |
|
56 |
//
|
77 |
}
|
78 |
Groups_Options::update_option( Groups_Post_Access::POST_TYPES, $post_types_option );
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
// tree view
|
81 |
if ( !empty( $_POST[GROUPS_SHOW_TREE_VIEW] ) ) {
|
82 |
Groups_Options::update_option( GROUPS_SHOW_TREE_VIEW, true );
|
110 |
Groups_Options::update_option( 'groups_delete_data', false );
|
111 |
}
|
112 |
}
|
113 |
+
|
114 |
+
// legacy enable ?
|
115 |
+
if ( !empty( $_POST[GROUPS_LEGACY_ENABLE] ) ) {
|
116 |
+
Groups_Options::update_option( GROUPS_LEGACY_ENABLE, true );
|
117 |
+
} else {
|
118 |
+
Groups_Options::update_option( GROUPS_LEGACY_ENABLE, false );
|
119 |
+
}
|
120 |
+
|
121 |
+
Groups_Admin::add_message( __( 'Options saved.', 'groups' ) );
|
122 |
}
|
123 |
}
|
124 |
|
126 |
|
127 |
echo
|
128 |
'<h1>' .
|
129 |
+
__( 'Groups Options', 'groups' ) .
|
130 |
'</h1>';
|
131 |
|
132 |
echo Groups_Admin::render_messages();
|
141 |
$caps_table .= '<thead>';
|
142 |
$caps_table .= '<tr>';
|
143 |
$caps_table .= '<td class="role">';
|
144 |
+
$caps_table .= __( 'Role', 'groups' );
|
145 |
$caps_table .= '</td>';
|
146 |
foreach ( $caps as $cap ) {
|
147 |
$caps_table .= '<td class="cap">';
|
186 |
$dismiss_url = wp_nonce_url( add_query_arg( 'dismiss-groups-extensions-box', '1', admin_url( 'admin.php?page=groups-admin-options' ) ), 'dismiss-box', 'groups-extensions-box-nonce' );
|
187 |
$extensions_box =
|
188 |
'<div id="groups-extensions-box">' .
|
189 |
+
__( 'Enhanced functionality is available via official <a href="http://www.itthinx.com/shop/">Extensions</a> for Groups.', 'groups' ) .
|
190 |
sprintf( '<a class="close" href="%s">x</a>', esc_url( $dismiss_url ) ) .
|
191 |
'</div>';
|
192 |
}
|
198 |
'<form action="" name="options" method="post">' .
|
199 |
|
200 |
'<p>' .
|
201 |
+
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save', 'groups' ) . '"/>' .
|
202 |
$extensions_box .
|
203 |
'</p>' .
|
204 |
|
205 |
'<div>' .
|
206 |
+
'<h2>' . __( 'Administrator Access Override', 'groups' ) . '</h2>' .
|
207 |
'<p>' .
|
208 |
'<label>' .
|
209 |
'<input name="' . GROUPS_ADMINISTRATOR_ACCESS_OVERRIDE . '" type="checkbox" ' . ( $admin_override ? 'checked="checked"' : '' ) . '/>' .
|
210 |
+
__( 'Administrators override all access permissions derived from Groups capabilities.', 'groups' ) .
|
211 |
'</label>' .
|
212 |
'</p>';
|
213 |
|
214 |
+
echo '<h2>' . __( 'Access restricions', 'groups' ) . '</h2>';
|
215 |
|
216 |
+
echo '<h3>' . __( 'Post types', 'groups' ) . '</h3>';
|
217 |
|
218 |
echo
|
219 |
+
'<p class="description">' . __( 'Show access restrictions for these post types.', 'groups' ) . '</p>';
|
220 |
|
221 |
$post_types_option = Groups_Options::get_option( Groups_Post_Access::POST_TYPES, array() );
|
222 |
$post_types = get_post_types( array( 'public' => true ) );
|
239 |
echo '<ul>';
|
240 |
echo
|
241 |
'<p class="description">' .
|
242 |
+
__( 'This determines for which post types access restriction settings are offered.', 'groups' ) . '<br/>' .
|
243 |
+
__( 'Disabling this setting for a post type does not remove existing access restrictions on individual posts of that type.', 'groups' ) . '<br/>' .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
'</p>';
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
echo
|
247 |
+
'<h2>' . __( 'User profiles', 'groups' ) . '</h2>' .
|
248 |
'<p>' .
|
249 |
'<label>' .
|
250 |
'<input name="' . GROUPS_SHOW_IN_USER_PROFILE . '" type="checkbox" ' . ( $show_in_user_profile ? 'checked="checked"' : '' ) . '/>' .
|
251 |
+
__( 'Show groups in user profiles.', 'groups' ) .
|
252 |
'</label>' .
|
253 |
'</p>';
|
254 |
|
255 |
echo
|
256 |
+
'<h2>' . __( 'Tree view', 'groups' ) . '</h2>' .
|
257 |
'<p>' .
|
258 |
'<label>' .
|
259 |
'<input name="' . GROUPS_SHOW_TREE_VIEW . '" type="checkbox" ' . ( $show_tree_view ? 'checked="checked"' : '' ) . '/>' .
|
260 |
+
__( 'Show the Groups tree view.', 'groups' ) .
|
261 |
'</label>' .
|
262 |
'</p>';
|
263 |
|
264 |
echo
|
265 |
+
'<h2>' . __( 'Permissions', 'groups' ) . '</h2>' .
|
266 |
+
'<p>' . __( 'These permissions apply to Groups management. They do not apply to access permissions derived from Groups capabilities.', 'groups' ) . '</p>' .
|
267 |
$caps_table .
|
268 |
'<p class="description">' .
|
269 |
+
__( 'A minimum set of permissions will be preserved.', 'groups' ) .
|
270 |
'<br/>' .
|
271 |
+
__( 'If you lock yourself out, please ask an administrator to help.', 'groups' ) .
|
272 |
'</p>';
|
273 |
if ( !$is_sitewide_plugin ) {
|
274 |
echo
|
275 |
+
'<h2>' . __( 'Deactivation and data persistence', 'groups' ) . '</h2>' .
|
276 |
'<p>' .
|
277 |
'<label>' .
|
278 |
'<input name="delete-data" type="checkbox" ' . ( $delete_data ? 'checked="checked"' : '' ) . '/>' .
|
279 |
+
__( 'Delete all Groups plugin data on deactivation', 'groups' ) .
|
280 |
'</label>' .
|
281 |
'</p>' .
|
282 |
'<p class="description warning">' .
|
283 |
+
__( 'CAUTION: If this option is active while the plugin is deactivated, ALL plugin settings and data will be DELETED. If you are going to use this option, now would be a good time to make a backup. By enabling this option you agree to be solely responsible for any loss of data or any other consequences thereof.', 'groups' ) .
|
284 |
'</p>';
|
285 |
}
|
286 |
+
|
287 |
+
$groups_legacy_enable = Groups_Options::get_option( GROUPS_LEGACY_ENABLE, GROUPS_LEGACY_ENABLE_DEFAULT );
|
288 |
+
echo '<h2>' . __( 'Legacy Settings', 'groups' ) . '</h2>';
|
289 |
+
echo '<p>' .
|
290 |
+
'<label>' .
|
291 |
+
'<input name="' . GROUPS_LEGACY_ENABLE . '" type="checkbox" ' . ( $groups_legacy_enable ? 'checked="checked"' : '' ) . '/>' .
|
292 |
+
__( 'Enable legacy access control based on capabilities.', 'groups' ) .
|
293 |
+
'</label>' .
|
294 |
+
'</p>';
|
295 |
+
if ( $groups_legacy_enable ) {
|
296 |
+
require_once GROUPS_LEGACY_LIB . '/admin/groups-admin-options-legacy.php';
|
297 |
+
do_action( 'groups_admin_options_legacy' );
|
298 |
+
}
|
299 |
+
|
300 |
echo
|
301 |
'<p>' .
|
302 |
wp_nonce_field( 'admin', GROUPS_ADMIN_OPTIONS_NONCE, true, false ) .
|
303 |
+
'<input class="button button-primary" type="submit" name="submit" value="' . __( 'Save', 'groups' ) . '"/>' .
|
304 |
'</p>' .
|
305 |
'</div>' .
|
306 |
'</form>';
|
308 |
echo '</div>'; // .groups-options
|
309 |
}
|
310 |
|
311 |
+
/**
|
312 |
+
* Network administration options.
|
313 |
+
*/
|
314 |
function groups_network_admin_options() {
|
315 |
|
316 |
if ( !current_user_can( GROUPS_ADMINISTER_OPTIONS ) ) {
|
317 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
318 |
}
|
319 |
|
320 |
echo
|
321 |
'<div>' .
|
322 |
'<h1>' .
|
323 |
+
__( 'Groups network options', 'groups' ) .
|
324 |
'</h1>' .
|
325 |
'</div>';
|
326 |
|
342 |
echo
|
343 |
'<form action="" name="options" method="post">' .
|
344 |
'<div>' .
|
345 |
+
'<h2>' . __( 'Network deactivation and data persistence', 'groups' ) . '</h2>' .
|
346 |
'<p>' .
|
347 |
'<input name="delete-data" type="checkbox" ' . ( $delete_data ? 'checked="checked"' : '' ) . '/>' .
|
348 |
+
'<label for="delete-data">' . __( 'Delete all Groups plugin data for ALL sites on network deactivation', 'groups' ) . '</label>' .
|
349 |
'</p>' .
|
350 |
'<p class="description warning">' .
|
351 |
+
__( 'CAUTION: If this option is active while the plugin is deactivated, ALL plugin settings and data will be DELETED for <strong>all sites</strong>. If you are going to use this option, now would be a good time to make a backup. By enabling this option you agree to be solely responsible for any loss of data or any other consequences thereof.', 'groups' ) .
|
352 |
'</p>' .
|
353 |
'<p>' .
|
354 |
wp_nonce_field( 'admin', GROUPS_ADMIN_OPTIONS_NONCE, true, false ) .
|
355 |
+
'<input type="submit" name="submit" value="' . __( 'Save', 'groups' ) . '"/>' .
|
356 |
'</p>' .
|
357 |
'</div>' .
|
358 |
'</form>';
|
359 |
+
}
|
lib/admin/groups-admin-tree-view.php
CHANGED
@@ -34,13 +34,13 @@ function groups_admin_tree_view() {
|
|
34 |
$today = date( 'Y-m-d', time() );
|
35 |
|
36 |
if ( !current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
37 |
-
wp_die( __( 'Access denied.',
|
38 |
}
|
39 |
|
40 |
$output .=
|
41 |
'<div class="groups-tree-view">' .
|
42 |
'<h1>' .
|
43 |
-
__( 'Tree of Groups',
|
44 |
'</h1>';
|
45 |
|
46 |
$tree = Groups_Utility::get_group_tree();
|
34 |
$today = date( 'Y-m-d', time() );
|
35 |
|
36 |
if ( !current_user_can( GROUPS_ACCESS_GROUPS ) ) {
|
37 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
38 |
}
|
39 |
|
40 |
$output .=
|
41 |
'<div class="groups-tree-view">' .
|
42 |
'<h1>' .
|
43 |
+
__( 'Tree of Groups', 'groups' ) .
|
44 |
'</h1>';
|
45 |
|
46 |
$tree = Groups_Utility::get_group_tree();
|
lib/auto/class-groups-registered.php
CHANGED
@@ -42,7 +42,7 @@ class Groups_Registered {
|
|
42 |
|
43 |
// create a group for the blog if it doesn't exist
|
44 |
if ( !( $group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME ) ) ) {
|
45 |
-
$group_id = Groups_Group::create( array(
|
46 |
} else {
|
47 |
$group_id = $group->group_id;
|
48 |
}
|
@@ -53,7 +53,7 @@ class Groups_Registered {
|
|
53 |
foreach( $users as $user ) {
|
54 |
// add the user to the group
|
55 |
if ( !Groups_User_Group::read( $user->ID, $group_id ) ) {
|
56 |
-
Groups_User_Group::create( array(
|
57 |
}
|
58 |
}
|
59 |
unset( $users );
|
@@ -70,7 +70,7 @@ class Groups_Registered {
|
|
70 |
public static function init() {
|
71 |
|
72 |
// For translation of the "Registered" group(s)
|
73 |
-
__( 'Registered',
|
74 |
|
75 |
// When a blog is added, create a new "Registered" group for that blog.
|
76 |
add_action( 'wpmu_new_blog', array( __CLASS__, 'wpmu_new_blog' ), 10, 2 );
|
@@ -106,14 +106,14 @@ class Groups_Registered {
|
|
106 |
Groups_Controller::switch_to_blog( $blog_id );
|
107 |
}
|
108 |
if ( !( $group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME ) ) ) {
|
109 |
-
$group_id = Groups_Group::create( array(
|
110 |
} else {
|
111 |
$group_id = $group->group_id;
|
112 |
}
|
113 |
// add the blog's admin user to the group
|
114 |
if ( $group_id ) {
|
115 |
if ( !Groups_User_Group::read( $user_id, $group_id ) ) {
|
116 |
-
Groups_User_Group::create( array(
|
117 |
}
|
118 |
}
|
119 |
if ( is_multisite() ) {
|
@@ -130,7 +130,7 @@ class Groups_Registered {
|
|
130 |
|
131 |
$registered_group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME );
|
132 |
if ( !$registered_group ) {
|
133 |
-
$registered_group_id = Groups_Group::create( array(
|
134 |
} else {
|
135 |
$registered_group_id = $registered_group->group_id;
|
136 |
}
|
@@ -184,7 +184,7 @@ class Groups_Registered {
|
|
184 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) {
|
185 |
$registered_group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME );
|
186 |
if ( !$registered_group ) {
|
187 |
-
$registered_group_id = Groups_Group::create( array(
|
188 |
} else {
|
189 |
$registered_group_id = $registered_group->group_id;
|
190 |
}
|
42 |
|
43 |
// create a group for the blog if it doesn't exist
|
44 |
if ( !( $group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME ) ) ) {
|
45 |
+
$group_id = Groups_Group::create( array( 'name' => self::REGISTERED_GROUP_NAME ) );
|
46 |
} else {
|
47 |
$group_id = $group->group_id;
|
48 |
}
|
53 |
foreach( $users as $user ) {
|
54 |
// add the user to the group
|
55 |
if ( !Groups_User_Group::read( $user->ID, $group_id ) ) {
|
56 |
+
Groups_User_Group::create( array( 'user_id' => $user->ID, 'group_id' => $group_id ) );
|
57 |
}
|
58 |
}
|
59 |
unset( $users );
|
70 |
public static function init() {
|
71 |
|
72 |
// For translation of the "Registered" group(s)
|
73 |
+
__( 'Registered', 'groups' );
|
74 |
|
75 |
// When a blog is added, create a new "Registered" group for that blog.
|
76 |
add_action( 'wpmu_new_blog', array( __CLASS__, 'wpmu_new_blog' ), 10, 2 );
|
106 |
Groups_Controller::switch_to_blog( $blog_id );
|
107 |
}
|
108 |
if ( !( $group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME ) ) ) {
|
109 |
+
$group_id = Groups_Group::create( array( 'name' => self::REGISTERED_GROUP_NAME ) );
|
110 |
} else {
|
111 |
$group_id = $group->group_id;
|
112 |
}
|
113 |
// add the blog's admin user to the group
|
114 |
if ( $group_id ) {
|
115 |
if ( !Groups_User_Group::read( $user_id, $group_id ) ) {
|
116 |
+
Groups_User_Group::create( array( 'user_id' => $user_id, 'group_id' => $group_id ) );
|
117 |
}
|
118 |
}
|
119 |
if ( is_multisite() ) {
|
130 |
|
131 |
$registered_group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME );
|
132 |
if ( !$registered_group ) {
|
133 |
+
$registered_group_id = Groups_Group::create( array( 'name' => self::REGISTERED_GROUP_NAME ) );
|
134 |
} else {
|
135 |
$registered_group_id = $registered_group->group_id;
|
136 |
}
|
184 |
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) {
|
185 |
$registered_group = Groups_Group::read_by_name( self::REGISTERED_GROUP_NAME );
|
186 |
if ( !$registered_group ) {
|
187 |
+
$registered_group_id = Groups_Group::create( array( 'name' => self::REGISTERED_GROUP_NAME ) );
|
188 |
} else {
|
189 |
$registered_group_id = $registered_group->group_id;
|
190 |
}
|
lib/core/class-groups-capability.php
CHANGED
@@ -68,16 +68,16 @@ class Groups_Capability {
|
|
68 |
$result = null;
|
69 |
if ( $this->capability !== null ) {
|
70 |
switch( $name ) {
|
71 |
-
case
|
72 |
-
case
|
73 |
-
case
|
74 |
-
case
|
75 |
-
case
|
76 |
-
case
|
77 |
$result = $this->capability->$name;
|
78 |
break;
|
79 |
case 'group_ids' :
|
80 |
-
$group_capability_table = _groups_get_tablename(
|
81 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
82 |
"SELECT group_id FROM $group_capability_table WHERE capability_id = %d",
|
83 |
Groups_Utility::id( $this->capability->capability_id )
|
@@ -90,7 +90,7 @@ class Groups_Capability {
|
|
90 |
}
|
91 |
break;
|
92 |
case 'groups' :
|
93 |
-
$group_capability_table = _groups_get_tablename(
|
94 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
95 |
"SELECT group_id FROM $group_capability_table WHERE capability_id = %d",
|
96 |
Groups_Utility::id( $this->capability->capability_id )
|
@@ -157,7 +157,7 @@ class Groups_Capability {
|
|
157 |
if ( $result = $wpdb->get_var( "SELECT LAST_INSERT_ID()" ) ) {
|
158 |
// read_by_capability above created a cache entry which needs to be reset
|
159 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $capability, self::CACHE_GROUP );
|
160 |
-
do_action(
|
161 |
}
|
162 |
}
|
163 |
}
|
@@ -266,7 +266,7 @@ class Groups_Capability {
|
|
266 |
if ( !empty( $old_capability_capability ) ) {
|
267 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $old_capability_capability, self::CACHE_GROUP );
|
268 |
}
|
269 |
-
do_action(
|
270 |
}
|
271 |
}
|
272 |
}
|
@@ -297,9 +297,9 @@ class Groups_Capability {
|
|
297 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $capability->capability, self::CACHE_GROUP );
|
298 |
do_action( 'groups_deleted_capability_capability', $capability->capability );
|
299 |
}
|
300 |
-
do_action(
|
301 |
}
|
302 |
}
|
303 |
return $result;
|
304 |
}
|
305 |
-
}
|
68 |
$result = null;
|
69 |
if ( $this->capability !== null ) {
|
70 |
switch( $name ) {
|
71 |
+
case 'capability_id' :
|
72 |
+
case 'capability' :
|
73 |
+
case 'class' :
|
74 |
+
case 'object' :
|
75 |
+
case 'name' :
|
76 |
+
case 'description' :
|
77 |
$result = $this->capability->$name;
|
78 |
break;
|
79 |
case 'group_ids' :
|
80 |
+
$group_capability_table = _groups_get_tablename( 'group_capability' );
|
81 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
82 |
"SELECT group_id FROM $group_capability_table WHERE capability_id = %d",
|
83 |
Groups_Utility::id( $this->capability->capability_id )
|
90 |
}
|
91 |
break;
|
92 |
case 'groups' :
|
93 |
+
$group_capability_table = _groups_get_tablename( 'group_capability' );
|
94 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
95 |
"SELECT group_id FROM $group_capability_table WHERE capability_id = %d",
|
96 |
Groups_Utility::id( $this->capability->capability_id )
|
157 |
if ( $result = $wpdb->get_var( "SELECT LAST_INSERT_ID()" ) ) {
|
158 |
// read_by_capability above created a cache entry which needs to be reset
|
159 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $capability, self::CACHE_GROUP );
|
160 |
+
do_action( 'groups_created_capability', $result );
|
161 |
}
|
162 |
}
|
163 |
}
|
266 |
if ( !empty( $old_capability_capability ) ) {
|
267 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $old_capability_capability, self::CACHE_GROUP );
|
268 |
}
|
269 |
+
do_action( 'groups_updated_capability', $result );
|
270 |
}
|
271 |
}
|
272 |
}
|
297 |
Groups_Cache::delete( self::READ_BY_CAPABILITY . '_' . $capability->capability, self::CACHE_GROUP );
|
298 |
do_action( 'groups_deleted_capability_capability', $capability->capability );
|
299 |
}
|
300 |
+
do_action( 'groups_deleted_capability', $result );
|
301 |
}
|
302 |
}
|
303 |
return $result;
|
304 |
}
|
305 |
+
}
|
lib/core/class-groups-controller.php
CHANGED
@@ -28,6 +28,12 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
28 |
*/
|
29 |
class Groups_Controller {
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* Cache-safe switching in case any multi-site hiccups might occur.
|
33 |
* Clears the cache after switching to the given blog to avoid using
|
@@ -105,9 +111,16 @@ class Groups_Controller {
|
|
105 |
/**
|
106 |
* Initialize.
|
107 |
* Loads the plugin's translations.
|
|
|
108 |
*/
|
109 |
public static function init() {
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
self::version_check();
|
112 |
}
|
113 |
|
@@ -125,6 +138,7 @@ class Groups_Controller {
|
|
125 |
}
|
126 |
} else {
|
127 |
self::setup();
|
|
|
128 |
}
|
129 |
}
|
130 |
|
@@ -220,9 +234,27 @@ class Groups_Controller {
|
|
220 |
global $groups_version, $groups_admin_messages;
|
221 |
$previous_version = get_option( 'groups_plugin_version', null );
|
222 |
$groups_version = GROUPS_CORE_VERSION;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
if ( version_compare( $previous_version, $groups_version ) < 0 ) {
|
224 |
if ( self::update( $previous_version ) ) {
|
225 |
-
update_option( 'groups_plugin_version', $groups_version )
|
|
|
|
|
226 |
} else {
|
227 |
$groups_admin_messages[] = '<div class="error">Updating Groups plugin core <em>failed</em>.</div>';
|
228 |
}
|
@@ -276,6 +308,10 @@ class Groups_Controller {
|
|
276 |
}
|
277 |
}
|
278 |
} // switch
|
|
|
|
|
|
|
|
|
279 |
foreach ( $queries as $query ) {
|
280 |
if ( $wpdb->query( $query ) === false ) {
|
281 |
$result = false;
|
@@ -318,6 +354,7 @@ class Groups_Controller {
|
|
318 |
$role->remove_cap( GROUPS_ACCESS_GROUPS );
|
319 |
$role->remove_cap( GROUPS_ADMINISTER_GROUPS );
|
320 |
$role->remove_cap( GROUPS_ADMINISTER_OPTIONS );
|
|
|
321 |
}
|
322 |
$wpdb->query('DROP TABLE IF EXISTS ' . _groups_get_tablename( 'group' ) );
|
323 |
$wpdb->query('DROP TABLE IF EXISTS ' . _groups_get_tablename( 'capability' ) );
|
@@ -351,12 +388,14 @@ class Groups_Controller {
|
|
351 |
$administrator_role->add_cap( GROUPS_ACCESS_GROUPS );
|
352 |
$administrator_role->add_cap( GROUPS_ADMINISTER_GROUPS );
|
353 |
$administrator_role->add_cap( GROUPS_ADMINISTER_OPTIONS );
|
|
|
354 |
} else {
|
355 |
foreach ( $wp_roles->role_objects as $role ) {
|
356 |
if ($role->has_cap( 'manage_options' ) ) {
|
357 |
$role->add_cap( GROUPS_ACCESS_GROUPS );
|
358 |
$role->add_cap( GROUPS_ADMINISTER_GROUPS );
|
359 |
$role->add_cap( GROUPS_ADMINISTER_OPTIONS );
|
|
|
360 |
}
|
361 |
}
|
362 |
}
|
28 |
*/
|
29 |
class Groups_Controller {
|
30 |
|
31 |
+
/**
|
32 |
+
* Version 2.0.0 number
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
const GROUPS_200 = '2.0.0';
|
36 |
+
|
37 |
/**
|
38 |
* Cache-safe switching in case any multi-site hiccups might occur.
|
39 |
* Clears the cache after switching to the given blog to avoid using
|
111 |
/**
|
112 |
* Initialize.
|
113 |
* Loads the plugin's translations.
|
114 |
+
* Invokes version check.
|
115 |
*/
|
116 |
public static function init() {
|
117 |
+
// Load our current translations first ...
|
118 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'groups' );
|
119 |
+
$mofile = GROUPS_CORE_DIR . '/languages/groups-' . $locale . '.mo';
|
120 |
+
load_textdomain( 'groups', $mofile );
|
121 |
+
// ... otherwise load_plugin_textdomain will simply get those in WP's languages
|
122 |
+
// and we won't have our up-to-date translations.
|
123 |
+
load_plugin_textdomain( 'groups', null, 'groups/languages' );
|
124 |
self::version_check();
|
125 |
}
|
126 |
|
138 |
}
|
139 |
} else {
|
140 |
self::setup();
|
141 |
+
set_transient( 'groups_plugin_activated', true, 60 );
|
142 |
}
|
143 |
}
|
144 |
|
234 |
global $groups_version, $groups_admin_messages;
|
235 |
$previous_version = get_option( 'groups_plugin_version', null );
|
236 |
$groups_version = GROUPS_CORE_VERSION;
|
237 |
+
// auto-enable legacy support on upgrade from Groups previous to 2.0.0
|
238 |
+
if ( $previous_version ) {
|
239 |
+
if ( version_compare( $previous_version, self::GROUPS_200 ) < 0 ) {
|
240 |
+
if ( Groups_Options::get_option( GROUPS_LEGACY_ENABLE ) === null ) {
|
241 |
+
Groups_Options::update_option( GROUPS_LEGACY_ENABLE, true );
|
242 |
+
}
|
243 |
+
set_transient( 'groups_plugin_updated_legacy', true, 60 );
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
// disable legacy support on new installations
|
248 |
+
if ( Groups_Options::get_option( GROUPS_LEGACY_ENABLE ) === null ) {
|
249 |
+
Groups_Options::update_option( GROUPS_LEGACY_ENABLE, false );
|
250 |
+
}
|
251 |
+
|
252 |
+
// run update procedure if newer version is installed
|
253 |
if ( version_compare( $previous_version, $groups_version ) < 0 ) {
|
254 |
if ( self::update( $previous_version ) ) {
|
255 |
+
if ( update_option( 'groups_plugin_version', $groups_version ) ) {
|
256 |
+
set_transient( 'groups_plugin_updated', true, 60 );
|
257 |
+
}
|
258 |
} else {
|
259 |
$groups_admin_messages[] = '<div class="error">Updating Groups plugin core <em>failed</em>.</div>';
|
260 |
}
|
308 |
}
|
309 |
}
|
310 |
} // switch
|
311 |
+
if ( version_compare( $previous_version, '2.0.0' ) < 0 ) {
|
312 |
+
self::set_default_capabilities();
|
313 |
+
Groups_WordPress::refresh_capabilities();
|
314 |
+
}
|
315 |
foreach ( $queries as $query ) {
|
316 |
if ( $wpdb->query( $query ) === false ) {
|
317 |
$result = false;
|
354 |
$role->remove_cap( GROUPS_ACCESS_GROUPS );
|
355 |
$role->remove_cap( GROUPS_ADMINISTER_GROUPS );
|
356 |
$role->remove_cap( GROUPS_ADMINISTER_OPTIONS );
|
357 |
+
$role->remove_cap( GROUPS_RESTRICT_ACCESS );
|
358 |
}
|
359 |
$wpdb->query('DROP TABLE IF EXISTS ' . _groups_get_tablename( 'group' ) );
|
360 |
$wpdb->query('DROP TABLE IF EXISTS ' . _groups_get_tablename( 'capability' ) );
|
388 |
$administrator_role->add_cap( GROUPS_ACCESS_GROUPS );
|
389 |
$administrator_role->add_cap( GROUPS_ADMINISTER_GROUPS );
|
390 |
$administrator_role->add_cap( GROUPS_ADMINISTER_OPTIONS );
|
391 |
+
$administrator_role->add_cap( GROUPS_RESTRICT_ACCESS );
|
392 |
} else {
|
393 |
foreach ( $wp_roles->role_objects as $role ) {
|
394 |
if ($role->has_cap( 'manage_options' ) ) {
|
395 |
$role->add_cap( GROUPS_ACCESS_GROUPS );
|
396 |
$role->add_cap( GROUPS_ADMINISTER_GROUPS );
|
397 |
$role->add_cap( GROUPS_ADMINISTER_OPTIONS );
|
398 |
+
$role->add_cap( GROUPS_RESTRICT_ACCESS );
|
399 |
}
|
400 |
}
|
401 |
}
|
lib/core/class-groups-group-capability.php
CHANGED
@@ -69,7 +69,7 @@ class Groups_Group_Capability {
|
|
69 |
$formats = array( '%d', '%d' );
|
70 |
if ( $wpdb->insert( $group_capability_table, $data, $formats ) ) {
|
71 |
$result = true;
|
72 |
-
do_action(
|
73 |
}
|
74 |
}
|
75 |
}
|
@@ -114,7 +114,7 @@ class Groups_Group_Capability {
|
|
114 |
// make sure group and capability exist
|
115 |
if ( Groups_Group::read( $group_id ) && Groups_Capability::read( $capability_id ) ) {
|
116 |
$result = true;
|
117 |
-
do_action(
|
118 |
}
|
119 |
}
|
120 |
return $result;
|
@@ -146,7 +146,7 @@ class Groups_Group_Capability {
|
|
146 |
// must have affected a row, otherwise no great success
|
147 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
148 |
if ( $result ) {
|
149 |
-
do_action(
|
150 |
}
|
151 |
}
|
152 |
return $result;
|
69 |
$formats = array( '%d', '%d' );
|
70 |
if ( $wpdb->insert( $group_capability_table, $data, $formats ) ) {
|
71 |
$result = true;
|
72 |
+
do_action( 'groups_created_group_capability', $group_id, $capability_id );
|
73 |
}
|
74 |
}
|
75 |
}
|
114 |
// make sure group and capability exist
|
115 |
if ( Groups_Group::read( $group_id ) && Groups_Capability::read( $capability_id ) ) {
|
116 |
$result = true;
|
117 |
+
do_action( 'groups_updated_group_capability', $group_id, $capability_id );
|
118 |
}
|
119 |
}
|
120 |
return $result;
|
146 |
// must have affected a row, otherwise no great success
|
147 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
148 |
if ( $result ) {
|
149 |
+
do_action( 'groups_deleted_group_capability', $group_id, $capability_id );
|
150 |
}
|
151 |
}
|
152 |
return $result;
|
lib/core/class-groups-group.php
CHANGED
@@ -23,7 +23,7 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
23 |
exit;
|
24 |
}
|
25 |
|
26 |
-
require_once( GROUPS_CORE_LIB .
|
27 |
|
28 |
/**
|
29 |
* Group OPM.
|
@@ -68,16 +68,16 @@ class Groups_Group implements I_Capable {
|
|
68 |
$result = null;
|
69 |
if ( $this->group !== null ) {
|
70 |
switch( $name ) {
|
71 |
-
case
|
72 |
-
case
|
73 |
-
case
|
74 |
-
case
|
75 |
-
case
|
76 |
-
case
|
77 |
$result = $this->group->$name;
|
78 |
break;
|
79 |
-
case
|
80 |
-
$group_capability_table = _groups_get_tablename(
|
81 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
82 |
"SELECT capability_id FROM $group_capability_table WHERE group_id = %d",
|
83 |
Groups_Utility::id( $this->group->group_id )
|
@@ -98,7 +98,7 @@ class Groups_Group implements I_Capable {
|
|
98 |
break;
|
99 |
case 'capability_ids_deep' :
|
100 |
$capability_ids = array();
|
101 |
-
$group_table = _groups_get_tablename(
|
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 ) );
|
@@ -108,7 +108,7 @@ class Groups_Group implements I_Capable {
|
|
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(
|
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 |
);
|
@@ -122,7 +122,7 @@ class Groups_Group implements I_Capable {
|
|
122 |
}
|
123 |
}
|
124 |
if ( count( $group_ids ) > 0 ) {
|
125 |
-
$id_list = implode(
|
126 |
$rows = $wpdb->get_results(
|
127 |
"SELECT DISTINCT capability_id FROM $group_capability_table WHERE group_id IN ($id_list)"
|
128 |
);
|
@@ -135,7 +135,7 @@ class Groups_Group implements I_Capable {
|
|
135 |
$result = $capability_ids;
|
136 |
break;
|
137 |
case 'users' :
|
138 |
-
$user_group_table = _groups_get_tablename(
|
139 |
$users = $wpdb->get_results( $wpdb->prepare(
|
140 |
"SELECT ID FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
141 |
Groups_Utility::id( $this->group->group_id )
|
@@ -163,9 +163,9 @@ class Groups_Group implements I_Capable {
|
|
163 |
|
164 |
if ( $this->group !== null ) {
|
165 |
|
166 |
-
$group_table = _groups_get_tablename(
|
167 |
-
$capability_table = _groups_get_tablename(
|
168 |
-
$group_capability_table = _groups_get_tablename(
|
169 |
|
170 |
// determine capability id
|
171 |
$capability_id = null;
|
@@ -191,7 +191,7 @@ class Groups_Group implements I_Capable {
|
|
191 |
while( ( $iterations < $all_groups ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
|
192 |
$iterations++;
|
193 |
$old_group_ids_count = count( $group_ids );
|
194 |
-
$id_list = implode(
|
195 |
$parent_group_ids = $wpdb->get_results(
|
196 |
"SELECT parent_id FROM $group_table WHERE parent_id IS NOT NULL AND group_id IN ($id_list)"
|
197 |
);
|
@@ -205,7 +205,7 @@ class Groups_Group implements I_Capable {
|
|
205 |
}
|
206 |
}
|
207 |
if ( count( $group_ids ) > 0 ) {
|
208 |
-
$id_list = implode(
|
209 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
210 |
"SELECT capability_id FROM $group_capability_table WHERE capability_id = %d AND group_id IN ($id_list)",
|
211 |
Groups_Utility::id( $capability_id )
|
@@ -218,7 +218,7 @@ class Groups_Group implements I_Capable {
|
|
218 |
}
|
219 |
}
|
220 |
}
|
221 |
-
$result = apply_filters_ref_array(
|
222 |
return $result;
|
223 |
}
|
224 |
|
@@ -243,7 +243,7 @@ class Groups_Group implements I_Capable {
|
|
243 |
|
244 |
if ( !empty( $name ) ) {
|
245 |
|
246 |
-
$group_table = _groups_get_tablename(
|
247 |
|
248 |
$data = array( 'name' => $name );
|
249 |
$formats = array( '%s' );
|
@@ -288,7 +288,7 @@ class Groups_Group implements I_Capable {
|
|
288 |
if ( $result = $wpdb->get_var( "SELECT LAST_INSERT_ID()" ) ) {
|
289 |
// must clear cache for this name in case it has been requested previously as it now exists
|
290 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $name, self::CACHE_GROUP );
|
291 |
-
do_action(
|
292 |
}
|
293 |
}
|
294 |
}
|
@@ -396,7 +396,7 @@ class Groups_Group implements I_Capable {
|
|
396 |
$iterations++;
|
397 |
$old_group_ids_count = count( $group_ids );
|
398 |
|
399 |
-
$id_list = implode(
|
400 |
// We can trust ourselves here, no need to use prepare()
|
401 |
// but careful if this query is modified!
|
402 |
$successor_group_ids = $wpdb->get_results(
|
@@ -428,7 +428,7 @@ class Groups_Group implements I_Capable {
|
|
428 |
if ( !empty( $old_group ) && !empty( $old_group->name ) ) {
|
429 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $old_group->name, self::CACHE_GROUP );
|
430 |
}
|
431 |
-
do_action(
|
432 |
}
|
433 |
return $result;
|
434 |
}
|
@@ -476,7 +476,7 @@ class Groups_Group implements I_Capable {
|
|
476 |
if ( !empty( $group->name ) ) {
|
477 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $group->name, self::CACHE_GROUP );
|
478 |
}
|
479 |
-
do_action(
|
480 |
}
|
481 |
}
|
482 |
return $result;
|
@@ -525,7 +525,7 @@ class Groups_Group implements I_Capable {
|
|
525 |
* - ['exclude'] array|string with one or more IDs of groups to exclude, separated by comma
|
526 |
* - ['exclude_by_name'] array|string with one ore more group names of groups to exclude, separated by comma
|
527 |
*
|
528 |
-
* @return array of
|
529 |
*
|
530 |
* @since groups 1.4.9
|
531 |
*/
|
@@ -535,10 +535,10 @@ class Groups_Group implements I_Capable {
|
|
535 |
extract( $args );
|
536 |
|
537 |
if ( !isset( $fields ) ) {
|
538 |
-
$fields =
|
539 |
} else {
|
540 |
$array_fields = explode( ',', sanitize_text_field( $fields ) );
|
541 |
-
$fields =
|
542 |
foreach ( $array_fields as $field ) {
|
543 |
switch( trim( $field ) ) {
|
544 |
case 'group_id' :
|
@@ -570,7 +570,7 @@ class Groups_Group implements I_Capable {
|
|
570 |
}
|
571 |
|
572 |
if ( !isset( $order_by ) ) {
|
573 |
-
$order_by =
|
574 |
} else {
|
575 |
$order_by = sanitize_text_field( $order_by );
|
576 |
switch( trim( $order_by ) ) {
|
@@ -580,7 +580,7 @@ class Groups_Group implements I_Capable {
|
|
580 |
case 'datetime' :
|
581 |
case 'name' :
|
582 |
case 'description' :
|
583 |
-
$order_by =
|
584 |
break;
|
585 |
default :
|
586 |
$order_by = '';
|
23 |
exit;
|
24 |
}
|
25 |
|
26 |
+
require_once( GROUPS_CORE_LIB . '/interface-i-capable.php' );
|
27 |
|
28 |
/**
|
29 |
* Group OPM.
|
68 |
$result = null;
|
69 |
if ( $this->group !== null ) {
|
70 |
switch( $name ) {
|
71 |
+
case 'group_id' :
|
72 |
+
case 'parent_id' :
|
73 |
+
case 'creator_id' :
|
74 |
+
case 'datetime' :
|
75 |
+
case 'name' :
|
76 |
+
case 'description' :
|
77 |
$result = $this->group->$name;
|
78 |
break;
|
79 |
+
case 'capabilities' :
|
80 |
+
$group_capability_table = _groups_get_tablename( 'group_capability' );
|
81 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
82 |
"SELECT capability_id FROM $group_capability_table WHERE group_id = %d",
|
83 |
Groups_Utility::id( $this->group->group_id )
|
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 ) );
|
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 |
);
|
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 |
);
|
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(
|
140 |
"SELECT ID FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
141 |
Groups_Utility::id( $this->group->group_id )
|
163 |
|
164 |
if ( $this->group !== null ) {
|
165 |
|
166 |
+
$group_table = _groups_get_tablename( 'group' );
|
167 |
+
$capability_table = _groups_get_tablename( 'capability' );
|
168 |
+
$group_capability_table = _groups_get_tablename( 'group_capability' );
|
169 |
|
170 |
// determine capability id
|
171 |
$capability_id = null;
|
191 |
while( ( $iterations < $all_groups ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
|
192 |
$iterations++;
|
193 |
$old_group_ids_count = count( $group_ids );
|
194 |
+
$id_list = implode( ',', $group_ids );
|
195 |
$parent_group_ids = $wpdb->get_results(
|
196 |
"SELECT parent_id FROM $group_table WHERE parent_id IS NOT NULL AND group_id IN ($id_list)"
|
197 |
);
|
205 |
}
|
206 |
}
|
207 |
if ( count( $group_ids ) > 0 ) {
|
208 |
+
$id_list = implode( ',', $group_ids );
|
209 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
210 |
"SELECT capability_id FROM $group_capability_table WHERE capability_id = %d AND group_id IN ($id_list)",
|
211 |
Groups_Utility::id( $capability_id )
|
218 |
}
|
219 |
}
|
220 |
}
|
221 |
+
$result = apply_filters_ref_array( 'groups_group_can', array( $result, &$this, $capability ) );
|
222 |
return $result;
|
223 |
}
|
224 |
|
243 |
|
244 |
if ( !empty( $name ) ) {
|
245 |
|
246 |
+
$group_table = _groups_get_tablename( 'group' );
|
247 |
|
248 |
$data = array( 'name' => $name );
|
249 |
$formats = array( '%s' );
|
288 |
if ( $result = $wpdb->get_var( "SELECT LAST_INSERT_ID()" ) ) {
|
289 |
// must clear cache for this name in case it has been requested previously as it now exists
|
290 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $name, self::CACHE_GROUP );
|
291 |
+
do_action( 'groups_created_group', $result );
|
292 |
}
|
293 |
}
|
294 |
}
|
396 |
$iterations++;
|
397 |
$old_group_ids_count = count( $group_ids );
|
398 |
|
399 |
+
$id_list = implode( ',', $group_ids );
|
400 |
// We can trust ourselves here, no need to use prepare()
|
401 |
// but careful if this query is modified!
|
402 |
$successor_group_ids = $wpdb->get_results(
|
428 |
if ( !empty( $old_group ) && !empty( $old_group->name ) ) {
|
429 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $old_group->name, self::CACHE_GROUP );
|
430 |
}
|
431 |
+
do_action( 'groups_updated_group', $result );
|
432 |
}
|
433 |
return $result;
|
434 |
}
|
476 |
if ( !empty( $group->name ) ) {
|
477 |
Groups_Cache::delete( self::READ_BY_NAME . '_' . $group->name, self::CACHE_GROUP );
|
478 |
}
|
479 |
+
do_action( 'groups_deleted_group', $result );
|
480 |
}
|
481 |
}
|
482 |
return $result;
|
525 |
* - ['exclude'] array|string with one or more IDs of groups to exclude, separated by comma
|
526 |
* - ['exclude_by_name'] array|string with one ore more group names of groups to exclude, separated by comma
|
527 |
*
|
528 |
+
* @return array of object with query rows
|
529 |
*
|
530 |
* @since groups 1.4.9
|
531 |
*/
|
535 |
extract( $args );
|
536 |
|
537 |
if ( !isset( $fields ) ) {
|
538 |
+
$fields = '*';
|
539 |
} else {
|
540 |
$array_fields = explode( ',', sanitize_text_field( $fields ) );
|
541 |
+
$fields = '';
|
542 |
foreach ( $array_fields as $field ) {
|
543 |
switch( trim( $field ) ) {
|
544 |
case 'group_id' :
|
570 |
}
|
571 |
|
572 |
if ( !isset( $order_by ) ) {
|
573 |
+
$order_by = '';
|
574 |
} else {
|
575 |
$order_by = sanitize_text_field( $order_by );
|
576 |
switch( trim( $order_by ) ) {
|
580 |
case 'datetime' :
|
581 |
case 'name' :
|
582 |
case 'description' :
|
583 |
+
$order_by = " ORDER BY $order_by $order "; // Watch out! This is unescaped but safe within this switch.
|
584 |
break;
|
585 |
default :
|
586 |
$order_by = '';
|
lib/core/class-groups-help.php
CHANGED
@@ -60,15 +60,15 @@ class Groups_Help {
|
|
60 |
public static function contextual_help() {
|
61 |
if ( $screen = get_current_screen() ) {
|
62 |
$show_groups_help = false;
|
63 |
-
$help_title = __( 'Groups',
|
64 |
$screen_id = $screen->base;
|
65 |
// The prefix of the $screen_id is translated, use only the suffix
|
66 |
// to identify a screen:
|
67 |
$ids = array(
|
68 |
-
'groups-admin' => __( 'Groups',
|
69 |
-
'groups-admin-groups' => __( 'Groups',
|
70 |
-
'groups-admin-options' => __( 'Options',
|
71 |
-
'groups-admin-capabilities' => __( 'Capabilities',
|
72 |
);
|
73 |
foreach ( $ids as $id => $title ) {
|
74 |
$i = strpos( $screen_id, $id );
|
@@ -84,12 +84,12 @@ class Groups_Help {
|
|
84 |
if ( $show_groups_help ) {
|
85 |
$help = '<h3><a href="http://www.itthinx.com/plugins/groups" target="_blank">'. $help_title .'</a></h3>';
|
86 |
$help .= '<p>';
|
87 |
-
$help .= __( 'The complete documentation is available on the <a href="http://docs.itthinx.com/document/groups">Documentation</a> pages for Groups.',
|
88 |
$help .= '</p>';
|
89 |
switch ( $screen_id ) {
|
90 |
case 'groups-admin' :
|
91 |
case 'groups-admin-groups':
|
92 |
-
$help .= '<p>' . __( 'Here you can <strong>add</strong>, <strong>edit</strong> and <strong>remove</strong> groups.',
|
93 |
break;
|
94 |
case 'groups-admin-options' :
|
95 |
case 'groups-admin-capabilities' :
|
@@ -138,10 +138,10 @@ class Groups_Help {
|
|
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>.',
|
142 |
' ' .
|
143 |
sprintf(
|
144 |
-
__( 'Please give it a <a href="%s">★★★★★</a> rating.',
|
145 |
esc_attr( 'http://wordpress.org/support/view/plugin-reviews/groups?filter=5#postform' )
|
146 |
) .
|
147 |
'</span>';
|
60 |
public static function contextual_help() {
|
61 |
if ( $screen = get_current_screen() ) {
|
62 |
$show_groups_help = false;
|
63 |
+
$help_title = __( 'Groups', 'groups' );
|
64 |
$screen_id = $screen->base;
|
65 |
// The prefix of the $screen_id is translated, use only the suffix
|
66 |
// to identify a screen:
|
67 |
$ids = array(
|
68 |
+
'groups-admin' => __( 'Groups', 'groups' ),
|
69 |
+
'groups-admin-groups' => __( 'Groups', 'groups' ),
|
70 |
+
'groups-admin-options' => __( 'Options', 'groups' ),
|
71 |
+
'groups-admin-capabilities' => __( 'Capabilities', 'groups' ),
|
72 |
);
|
73 |
foreach ( $ids as $id => $title ) {
|
74 |
$i = strpos( $screen_id, $id );
|
84 |
if ( $show_groups_help ) {
|
85 |
$help = '<h3><a href="http://www.itthinx.com/plugins/groups" target="_blank">'. $help_title .'</a></h3>';
|
86 |
$help .= '<p>';
|
87 |
+
$help .= __( 'The complete documentation is available on the <a href="http://docs.itthinx.com/document/groups">Documentation</a> pages for Groups.', 'groups' );
|
88 |
$help .= '</p>';
|
89 |
switch ( $screen_id ) {
|
90 |
case 'groups-admin' :
|
91 |
case 'groups-admin-groups':
|
92 |
+
$help .= '<p>' . __( 'Here you can <strong>add</strong>, <strong>edit</strong> and <strong>remove</strong> groups.', 'groups' ) . '</p>';
|
93 |
break;
|
94 |
case 'groups-admin-options' :
|
95 |
case 'groups-admin-capabilities' :
|
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' ) .
|
142 |
' ' .
|
143 |
sprintf(
|
144 |
+
__( 'Please give it a <a href="%s">★★★★★</a> rating.', 'groups' ),
|
145 |
esc_attr( 'http://wordpress.org/support/view/plugin-reviews/groups?filter=5#postform' )
|
146 |
) .
|
147 |
'</span>';
|
lib/core/class-groups-pagination.php
CHANGED
@@ -102,7 +102,7 @@ class Groups_Pagination {
|
|
102 |
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
103 |
|
104 |
// needs to remove rewritten added page
|
105 |
-
$current_url = preg_replace(
|
106 |
|
107 |
$page_links = array();
|
108 |
|
@@ -112,14 +112,14 @@ class Groups_Pagination {
|
|
112 |
if ( $current == $total_pages )
|
113 |
$disable_last = ' disabled';
|
114 |
|
115 |
-
$page_links[] = sprintf(
|
116 |
'first-page' . $disable_first,
|
117 |
esc_attr__( 'Go to the first page' ),
|
118 |
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
119 |
'«'
|
120 |
);
|
121 |
|
122 |
-
$page_links[] = sprintf(
|
123 |
'prev-page' . $disable_first,
|
124 |
esc_attr__( 'Go to the previous page' ),
|
125 |
esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
|
@@ -129,24 +129,24 @@ class Groups_Pagination {
|
|
129 |
if ( 'bottom' == $which )
|
130 |
$html_current_page = $current;
|
131 |
else
|
132 |
-
$html_current_page = sprintf(
|
133 |
esc_attr__( 'Current page' ),
|
134 |
esc_attr( 'paged' ),
|
135 |
$current,
|
136 |
strlen( $total_pages )
|
137 |
);
|
138 |
|
139 |
-
$html_total_pages = sprintf(
|
140 |
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
141 |
|
142 |
-
$page_links[] = sprintf(
|
143 |
'next-page' . $disable_last,
|
144 |
esc_attr__( 'Go to the next page' ),
|
145 |
esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
|
146 |
'›'
|
147 |
);
|
148 |
|
149 |
-
$page_links[] = sprintf(
|
150 |
'last-page' . $disable_last,
|
151 |
esc_attr__( 'Go to the last page' ),
|
152 |
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
|
102 |
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
103 |
|
104 |
// needs to remove rewritten added page
|
105 |
+
$current_url = preg_replace( '/\/page\/\d+/', '', $current_url );
|
106 |
|
107 |
$page_links = array();
|
108 |
|
112 |
if ( $current == $total_pages )
|
113 |
$disable_last = ' disabled';
|
114 |
|
115 |
+
$page_links[] = sprintf( '<a class="%s" title="%s" href="%s">%s</a>',
|
116 |
'first-page' . $disable_first,
|
117 |
esc_attr__( 'Go to the first page' ),
|
118 |
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
119 |
'«'
|
120 |
);
|
121 |
|
122 |
+
$page_links[] = sprintf( '<a class="%s" title="%s" href="%s">%s</a>',
|
123 |
'prev-page' . $disable_first,
|
124 |
esc_attr__( 'Go to the previous page' ),
|
125 |
esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
|
129 |
if ( 'bottom' == $which )
|
130 |
$html_current_page = $current;
|
131 |
else
|
132 |
+
$html_current_page = sprintf( '<input class="current-page" title="%s" type="text" name="%s" value="%s" size="%d" />',
|
133 |
esc_attr__( 'Current page' ),
|
134 |
esc_attr( 'paged' ),
|
135 |
$current,
|
136 |
strlen( $total_pages )
|
137 |
);
|
138 |
|
139 |
+
$html_total_pages = sprintf( '<span class="total-pages">%s</span>', number_format_i18n( $total_pages ) );
|
140 |
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
141 |
|
142 |
+
$page_links[] = sprintf( '<a class="%s" title="%s" href="%s">%s</a>',
|
143 |
'next-page' . $disable_last,
|
144 |
esc_attr__( 'Go to the next page' ),
|
145 |
esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
|
146 |
'›'
|
147 |
);
|
148 |
|
149 |
+
$page_links[] = sprintf( '<a class="%s" title="%s" href="%s">%s</a>',
|
150 |
'last-page' . $disable_last,
|
151 |
esc_attr__( 'Go to the last page' ),
|
152 |
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
|
lib/core/class-groups-user-capability.php
CHANGED
@@ -38,7 +38,7 @@ class Groups_User_Capability {
|
|
38 |
|
39 |
// when a user is deleted, user-capabilities must be removed
|
40 |
// triggered by wp_delete_user()
|
41 |
-
add_action(
|
42 |
// when a capability is deleted the relationship must also be resolved
|
43 |
add_action( 'groups_deleted_capability', array( __CLASS__, 'groups_deleted_capability' ) );
|
44 |
}
|
@@ -59,7 +59,7 @@ class Groups_User_Capability {
|
|
59 |
// if ( !empty( $user_id ) && !empty( $capability_id) ) {
|
60 |
if ( !empty( $capability_id) ) {
|
61 |
// make sure user and capability exist
|
62 |
-
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by(
|
63 |
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
64 |
// don't try to create duplicate entries
|
65 |
// also it would raise an error for duplicate PK
|
@@ -75,7 +75,7 @@ class Groups_User_Capability {
|
|
75 |
$formats = array( '%d', '%d' );
|
76 |
if ( $wpdb->insert( $user_capability_table, $data, $formats ) ) {
|
77 |
$result = true;
|
78 |
-
do_action(
|
79 |
}
|
80 |
}
|
81 |
}
|
@@ -120,9 +120,9 @@ class Groups_User_Capability {
|
|
120 |
// if ( !empty( $user_id ) && !empty( $capability_id) ) {
|
121 |
if ( !empty( $capability_id) ) {
|
122 |
// make sure user and capability exist
|
123 |
-
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by(
|
124 |
$result = true;
|
125 |
-
do_action(
|
126 |
}
|
127 |
}
|
128 |
return $result;
|
@@ -155,7 +155,7 @@ class Groups_User_Capability {
|
|
155 |
// must have affected a row, otherwise no great success
|
156 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
157 |
if ( $result ) {
|
158 |
-
do_action(
|
159 |
}
|
160 |
}
|
161 |
return $result;
|
@@ -170,7 +170,7 @@ class Groups_User_Capability {
|
|
170 |
public static function deleted_user( $user_id ) {
|
171 |
global $wpdb;
|
172 |
|
173 |
-
$user_capability_table = _groups_get_tablename(
|
174 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
175 |
"SELECT * FROM $user_capability_table WHERE user_id = %d",
|
176 |
Groups_Utility::id( $user_id )
|
@@ -192,7 +192,7 @@ class Groups_User_Capability {
|
|
192 |
public static function groups_deleted_capability( $capability_id ) {
|
193 |
global $wpdb;
|
194 |
|
195 |
-
$user_capability_table = _groups_get_tablename(
|
196 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
197 |
"SELECT * FROM $user_capability_table WHERE capability_id = %d",
|
198 |
Groups_Utility::id( $capability_id )
|
38 |
|
39 |
// when a user is deleted, user-capabilities must be removed
|
40 |
// triggered by wp_delete_user()
|
41 |
+
add_action( 'deleted_user', array( __CLASS__, 'deleted_user' ) );
|
42 |
// when a capability is deleted the relationship must also be resolved
|
43 |
add_action( 'groups_deleted_capability', array( __CLASS__, 'groups_deleted_capability' ) );
|
44 |
}
|
59 |
// if ( !empty( $user_id ) && !empty( $capability_id) ) {
|
60 |
if ( !empty( $capability_id) ) {
|
61 |
// make sure user and capability exist
|
62 |
+
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by( 'id', $user_id ) && Groups_Capability::read( $capability_id ) ) {
|
63 |
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
64 |
// don't try to create duplicate entries
|
65 |
// also it would raise an error for duplicate PK
|
75 |
$formats = array( '%d', '%d' );
|
76 |
if ( $wpdb->insert( $user_capability_table, $data, $formats ) ) {
|
77 |
$result = true;
|
78 |
+
do_action( 'groups_created_user_capability', $user_id, $capability_id );
|
79 |
}
|
80 |
}
|
81 |
}
|
120 |
// if ( !empty( $user_id ) && !empty( $capability_id) ) {
|
121 |
if ( !empty( $capability_id) ) {
|
122 |
// make sure user and capability exist
|
123 |
+
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by( 'id', $user_id ) && Groups_Capability::read( $capability_id ) ) {
|
124 |
$result = true;
|
125 |
+
do_action( 'groups_updated_user_capability', $user_id, $capability_id );
|
126 |
}
|
127 |
}
|
128 |
return $result;
|
155 |
// must have affected a row, otherwise no great success
|
156 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
157 |
if ( $result ) {
|
158 |
+
do_action( 'groups_deleted_user_capability', $user_id, $capability_id );
|
159 |
}
|
160 |
}
|
161 |
return $result;
|
170 |
public static function deleted_user( $user_id ) {
|
171 |
global $wpdb;
|
172 |
|
173 |
+
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
174 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
175 |
"SELECT * FROM $user_capability_table WHERE user_id = %d",
|
176 |
Groups_Utility::id( $user_id )
|
192 |
public static function groups_deleted_capability( $capability_id ) {
|
193 |
global $wpdb;
|
194 |
|
195 |
+
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
196 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
197 |
"SELECT * FROM $user_capability_table WHERE capability_id = %d",
|
198 |
Groups_Utility::id( $capability_id )
|
lib/core/class-groups-user-group.php
CHANGED
@@ -41,11 +41,11 @@ class Groups_User_Group {
|
|
41 |
public static function init() {
|
42 |
// when a user is deleted, it must be removed from all groups it
|
43 |
// belongs to - triggered by wp_delete_user() and wpmu_delete_user()
|
44 |
-
add_action(
|
45 |
|
46 |
// when a user is removed from a blog, the user must be removed
|
47 |
// from all groups in that blog that it belongs to
|
48 |
-
add_action(
|
49 |
}
|
50 |
|
51 |
/**
|
@@ -72,8 +72,8 @@ class Groups_User_Group {
|
|
72 |
$result = null;
|
73 |
if ( $this->user_group !== null ) {
|
74 |
switch( $name ) {
|
75 |
-
case
|
76 |
-
case
|
77 |
$result = $this->user_group->$name;
|
78 |
break;
|
79 |
}
|
@@ -119,7 +119,7 @@ class Groups_User_Group {
|
|
119 |
$formats = array( '%d', '%d' );
|
120 |
if ( $wpdb->insert( $user_group_table, $data, $formats ) ) {
|
121 |
$result = true;
|
122 |
-
do_action(
|
123 |
}
|
124 |
}
|
125 |
}
|
@@ -165,9 +165,9 @@ class Groups_User_Group {
|
|
165 |
// if ( !empty( $user_id ) && !empty( $group_id) ) {
|
166 |
if ( !empty( $group_id) ) {
|
167 |
// make sure user and group exist
|
168 |
-
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by(
|
169 |
$result = true;
|
170 |
-
do_action(
|
171 |
}
|
172 |
}
|
173 |
return $result;
|
@@ -200,7 +200,7 @@ class Groups_User_Group {
|
|
200 |
// must have affected a row, otherwise no great success
|
201 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
202 |
if ( $result ) {
|
203 |
-
do_action(
|
204 |
}
|
205 |
}
|
206 |
return $result;
|
@@ -215,7 +215,7 @@ class Groups_User_Group {
|
|
215 |
public static function deleted_user( $user_id ) {
|
216 |
global $wpdb;
|
217 |
|
218 |
-
$user_group_table = _groups_get_tablename(
|
219 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
220 |
"SELECT * FROM $user_group_table WHERE user_id = %d",
|
221 |
Groups_Utility::id( $user_id )
|
@@ -247,8 +247,8 @@ class Groups_User_Group {
|
|
247 |
|
248 |
global $wpdb;
|
249 |
|
250 |
-
$group_table = _groups_get_tablename(
|
251 |
-
$user_group_table = _groups_get_tablename(
|
252 |
// We can end up here while a blog is being deleted, in that case,
|
253 |
// the tables have already been deleted.
|
254 |
if ( ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) &&
|
41 |
public static function init() {
|
42 |
// when a user is deleted, it must be removed from all groups it
|
43 |
// belongs to - triggered by wp_delete_user() and wpmu_delete_user()
|
44 |
+
add_action( 'deleted_user', array( __CLASS__, 'deleted_user' ) );
|
45 |
|
46 |
// when a user is removed from a blog, the user must be removed
|
47 |
// from all groups in that blog that it belongs to
|
48 |
+
add_action( 'remove_user_from_blog', array( __CLASS__, 'remove_user_from_blog' ), 10, 2 );
|
49 |
}
|
50 |
|
51 |
/**
|
72 |
$result = null;
|
73 |
if ( $this->user_group !== null ) {
|
74 |
switch( $name ) {
|
75 |
+
case 'user_id' :
|
76 |
+
case 'group_id' :
|
77 |
$result = $this->user_group->$name;
|
78 |
break;
|
79 |
}
|
119 |
$formats = array( '%d', '%d' );
|
120 |
if ( $wpdb->insert( $user_group_table, $data, $formats ) ) {
|
121 |
$result = true;
|
122 |
+
do_action( 'groups_created_user_group', $user_id, $group_id );
|
123 |
}
|
124 |
}
|
125 |
}
|
165 |
// if ( !empty( $user_id ) && !empty( $group_id) ) {
|
166 |
if ( !empty( $group_id) ) {
|
167 |
// make sure user and group exist
|
168 |
+
if ( ( false !== Groups_Utility::id( $user_id ) ) && get_user_by( 'id', $user_id ) && Groups_Group::read( $group_id ) ) {
|
169 |
$result = true;
|
170 |
+
do_action( 'groups_updated_user_group', $user_id, $group_id );
|
171 |
}
|
172 |
}
|
173 |
return $result;
|
200 |
// must have affected a row, otherwise no great success
|
201 |
$result = ( $rows !== false ) && ( $rows > 0 );
|
202 |
if ( $result ) {
|
203 |
+
do_action( 'groups_deleted_user_group', $user_id, $group_id );
|
204 |
}
|
205 |
}
|
206 |
return $result;
|
215 |
public static function deleted_user( $user_id ) {
|
216 |
global $wpdb;
|
217 |
|
218 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
219 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
220 |
"SELECT * FROM $user_group_table WHERE user_id = %d",
|
221 |
Groups_Utility::id( $user_id )
|
247 |
|
248 |
global $wpdb;
|
249 |
|
250 |
+
$group_table = _groups_get_tablename( 'group' );
|
251 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
252 |
// We can end up here while a blog is being deleted, in that case,
|
253 |
// the tables have already been deleted.
|
254 |
if ( ( $wpdb->get_var( "SHOW TABLES LIKE '" . $group_table . "'" ) == $group_table ) &&
|
lib/core/class-groups-user.php
CHANGED
@@ -23,8 +23,8 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
23 |
exit;
|
24 |
}
|
25 |
|
26 |
-
require_once( GROUPS_CORE_LIB .
|
27 |
-
require_once( GROUPS_CORE_LIB .
|
28 |
|
29 |
/**
|
30 |
* User OPM.
|
@@ -87,7 +87,7 @@ class Groups_User implements I_Capable {
|
|
87 |
global $wpdb;
|
88 |
if ( $group = Groups_Group::read( $group_id ) ) {
|
89 |
// not using $group->users, as we don't need a lot of user objects created here
|
90 |
-
$user_group_table = _groups_get_tablename(
|
91 |
$users = $wpdb->get_results( $wpdb->prepare(
|
92 |
"SELECT ID FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
93 |
Groups_Utility::id( $group_id )
|
@@ -107,7 +107,7 @@ class Groups_User implements I_Capable {
|
|
107 |
*/
|
108 |
public function __construct( $user_id ) {
|
109 |
if ( Groups_Utility::id( $user_id ) ) {
|
110 |
-
$this->user = get_user_by(
|
111 |
} else {
|
112 |
$this->user = new WP_User( 0 );
|
113 |
}
|
@@ -133,7 +133,7 @@ class Groups_User implements I_Capable {
|
|
133 |
$result = $cached->value;
|
134 |
unset( $cached );
|
135 |
} else {
|
136 |
-
$user_capability_table = _groups_get_tablename(
|
137 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
138 |
"SELECT capability_id FROM $user_capability_table WHERE user_id = %d",
|
139 |
Groups_Utility::id( $this->user->ID )
|
@@ -167,7 +167,7 @@ class Groups_User implements I_Capable {
|
|
167 |
$result = $cached->value;
|
168 |
unset( $cached );
|
169 |
} else {
|
170 |
-
$user_group_table = _groups_get_tablename(
|
171 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
172 |
"SELECT group_id FROM $user_group_table WHERE user_id = %d",
|
173 |
Groups_Utility::id( $this->user->ID )
|
@@ -201,7 +201,7 @@ class Groups_User implements I_Capable {
|
|
201 |
$result = $cached->value;
|
202 |
unset( $cached );
|
203 |
} else {
|
204 |
-
$user_capability_table = _groups_get_tablename(
|
205 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
206 |
"SELECT capability_id FROM $user_capability_table WHERE user_id = %d",
|
207 |
Groups_Utility::id( $this->user->ID )
|
@@ -235,7 +235,7 @@ class Groups_User implements I_Capable {
|
|
235 |
$result = $cached->value;
|
236 |
unset( $cached );
|
237 |
} else {
|
238 |
-
$user_group_table = _groups_get_tablename(
|
239 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
240 |
"SELECT group_id FROM $user_group_table WHERE user_id = %d",
|
241 |
Groups_Utility::id( $this->user->ID )
|
@@ -311,7 +311,7 @@ class Groups_User implements I_Capable {
|
|
311 |
}
|
312 |
}
|
313 |
}
|
314 |
-
$result = apply_filters_ref_array(
|
315 |
return $result;
|
316 |
}
|
317 |
|
@@ -354,11 +354,11 @@ class Groups_User implements I_Capable {
|
|
354 |
$group_ids = array();
|
355 |
|
356 |
if ( ( $this->user !== null ) && ( Groups_Cache::get( self::GROUP_IDS . $this->user->ID, self::CACHE_GROUP ) === null ) ) {
|
357 |
-
$group_table = _groups_get_tablename(
|
358 |
-
$capability_table = _groups_get_tablename(
|
359 |
-
$group_capability_table = _groups_get_tablename(
|
360 |
-
$user_group_table = _groups_get_tablename(
|
361 |
-
$user_capability_table = _groups_get_tablename(
|
362 |
|
363 |
$limit = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
|
364 |
if ( $limit === null ) {
|
@@ -420,7 +420,7 @@ class Groups_User implements I_Capable {
|
|
420 |
while( ( $iterations < $limit ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
|
421 |
$iterations++;
|
422 |
$old_group_ids_count = count( $group_ids );
|
423 |
-
$id_list = implode(
|
424 |
$parent_group_ids = $wpdb->get_results(
|
425 |
"SELECT parent_id FROM $group_table WHERE parent_id IS NOT NULL AND group_id IN ($id_list)"
|
426 |
);
|
@@ -433,7 +433,7 @@ class Groups_User implements I_Capable {
|
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
-
$id_list = implode(
|
437 |
$rows = $wpdb->get_results(
|
438 |
"SELECT $group_capability_table.capability_id, $capability_table.capability FROM $group_capability_table LEFT JOIN $capability_table ON $group_capability_table.capability_id = $capability_table.capability_id WHERE group_id IN ($id_list)"
|
439 |
);
|
23 |
exit;
|
24 |
}
|
25 |
|
26 |
+
require_once( GROUPS_CORE_LIB . '/interface-i-capable.php' );
|
27 |
+
require_once( GROUPS_CORE_LIB . '/class-groups-capability.php' );
|
28 |
|
29 |
/**
|
30 |
* User OPM.
|
87 |
global $wpdb;
|
88 |
if ( $group = Groups_Group::read( $group_id ) ) {
|
89 |
// not using $group->users, as we don't need a lot of user objects created here
|
90 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
91 |
$users = $wpdb->get_results( $wpdb->prepare(
|
92 |
"SELECT ID FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
93 |
Groups_Utility::id( $group_id )
|
107 |
*/
|
108 |
public function __construct( $user_id ) {
|
109 |
if ( Groups_Utility::id( $user_id ) ) {
|
110 |
+
$this->user = get_user_by( 'id', $user_id );
|
111 |
} else {
|
112 |
$this->user = new WP_User( 0 );
|
113 |
}
|
133 |
$result = $cached->value;
|
134 |
unset( $cached );
|
135 |
} else {
|
136 |
+
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
137 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
138 |
"SELECT capability_id FROM $user_capability_table WHERE user_id = %d",
|
139 |
Groups_Utility::id( $this->user->ID )
|
167 |
$result = $cached->value;
|
168 |
unset( $cached );
|
169 |
} else {
|
170 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
171 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
172 |
"SELECT group_id FROM $user_group_table WHERE user_id = %d",
|
173 |
Groups_Utility::id( $this->user->ID )
|
201 |
$result = $cached->value;
|
202 |
unset( $cached );
|
203 |
} else {
|
204 |
+
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
205 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
206 |
"SELECT capability_id FROM $user_capability_table WHERE user_id = %d",
|
207 |
Groups_Utility::id( $this->user->ID )
|
235 |
$result = $cached->value;
|
236 |
unset( $cached );
|
237 |
} else {
|
238 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
239 |
$rows = $wpdb->get_results( $wpdb->prepare(
|
240 |
"SELECT group_id FROM $user_group_table WHERE user_id = %d",
|
241 |
Groups_Utility::id( $this->user->ID )
|
311 |
}
|
312 |
}
|
313 |
}
|
314 |
+
$result = apply_filters_ref_array( 'groups_user_can', array( $result, &$this, $capability ) );
|
315 |
return $result;
|
316 |
}
|
317 |
|
354 |
$group_ids = array();
|
355 |
|
356 |
if ( ( $this->user !== null ) && ( Groups_Cache::get( self::GROUP_IDS . $this->user->ID, self::CACHE_GROUP ) === null ) ) {
|
357 |
+
$group_table = _groups_get_tablename( 'group' );
|
358 |
+
$capability_table = _groups_get_tablename( 'capability' );
|
359 |
+
$group_capability_table = _groups_get_tablename( 'group_capability' );
|
360 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
361 |
+
$user_capability_table = _groups_get_tablename( 'user_capability' );
|
362 |
|
363 |
$limit = $wpdb->get_var( "SELECT COUNT(*) FROM $group_table" );
|
364 |
if ( $limit === null ) {
|
420 |
while( ( $iterations < $limit ) && ( count( $group_ids ) !== $old_group_ids_count ) ) {
|
421 |
$iterations++;
|
422 |
$old_group_ids_count = count( $group_ids );
|
423 |
+
$id_list = implode( ',', $group_ids );
|
424 |
$parent_group_ids = $wpdb->get_results(
|
425 |
"SELECT parent_id FROM $group_table WHERE parent_id IS NOT NULL AND group_id IN ($id_list)"
|
426 |
);
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
+
$id_list = implode( ',', $group_ids );
|
437 |
$rows = $wpdb->get_results(
|
438 |
"SELECT $group_capability_table.capability_id, $capability_table.capability FROM $group_capability_table LEFT JOIN $capability_table ON $group_capability_table.capability_id = $capability_table.capability_id WHERE group_id IN ($id_list)"
|
439 |
);
|
lib/core/constants.php
CHANGED
@@ -29,6 +29,8 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
29 |
define( 'GROUPS_DEFAULT_VERSION', '1.0.0' );
|
30 |
|
31 |
/**
|
|
|
|
|
32 |
* @var string plugin domain
|
33 |
*/
|
34 |
define( 'GROUPS_PLUGIN_DOMAIN', 'groups' );
|
@@ -65,6 +67,11 @@ define( 'GROUPS_ADMINISTER_GROUPS', 'groups_admin_groups');
|
|
65 |
*/
|
66 |
define( 'GROUPS_ADMINISTER_OPTIONS', 'groups_admin_options');
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* @var string admin nonce
|
70 |
*/
|
@@ -109,3 +116,15 @@ define( 'GROUPS_SHOW_IN_USER_PROFILE', 'groups-show-in-user-profile' );
|
|
109 |
* @var boolean
|
110 |
*/
|
111 |
define( 'GROUPS_SHOW_IN_USER_PROFILE_DEFAULT', false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
define( 'GROUPS_DEFAULT_VERSION', '1.0.0' );
|
30 |
|
31 |
/**
|
32 |
+
* Do NOT remove this constant.
|
33 |
+
*
|
34 |
* @var string plugin domain
|
35 |
*/
|
36 |
define( 'GROUPS_PLUGIN_DOMAIN', 'groups' );
|
67 |
*/
|
68 |
define( 'GROUPS_ADMINISTER_OPTIONS', 'groups_admin_options');
|
69 |
|
70 |
+
/**
|
71 |
+
* @var string grants permission to restrict access on posts etc.
|
72 |
+
*/
|
73 |
+
define( 'GROUPS_RESTRICT_ACCESS', 'groups_restrict_access' );
|
74 |
+
|
75 |
/**
|
76 |
* @var string admin nonce
|
77 |
*/
|
116 |
* @var boolean
|
117 |
*/
|
118 |
define( 'GROUPS_SHOW_IN_USER_PROFILE_DEFAULT', false );
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Whether legacy functions should be supported.
|
122 |
+
* @var string
|
123 |
+
*/
|
124 |
+
define( 'GROUPS_LEGACY_ENABLE', 'groups-legacy-enable' );
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Default value for legacy support.
|
128 |
+
* @var boolean
|
129 |
+
*/
|
130 |
+
define( 'GROUPS_LEGACY_ENABLE_DEFAULT', true );
|
lib/core/wp-init.php
CHANGED
@@ -37,7 +37,7 @@ if ( !isset( $groups_version ) ) {
|
|
37 |
// <= 3.2.1
|
38 |
if ( !function_exists( 'is_user_member_of_blog' ) ) {
|
39 |
function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
|
40 |
-
return false !== get_user_by(
|
41 |
}
|
42 |
}
|
43 |
|
@@ -56,15 +56,23 @@ require_once( GROUPS_CORE_LIB . '/class-groups-options.php' );
|
|
56 |
// plugin control: activation, deactivation, ...
|
57 |
require_once( GROUPS_CORE_LIB . '/class-groups-controller.php' );
|
58 |
|
|
|
|
|
|
|
59 |
// admin
|
60 |
if ( is_admin() ) {
|
61 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin.php' );
|
|
|
62 |
if ( Groups_Options::get_option( GROUPS_SHOW_IN_USER_PROFILE, GROUPS_SHOW_IN_USER_PROFILE_DEFAULT ) ) {
|
63 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-user-profile.php' );
|
64 |
}
|
65 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-users.php' );
|
66 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-posts.php' );
|
67 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-post-columns.php' );
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
// help
|
@@ -90,9 +98,15 @@ require_once( GROUPS_AUTO_LIB . '/class-groups-registered.php' );
|
|
90 |
*/
|
91 |
|
92 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-post-access.php' );
|
|
|
|
|
|
|
93 |
|
94 |
if ( is_admin() ) {
|
95 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-access-meta-boxes.php' );
|
|
|
|
|
|
|
96 |
}
|
97 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-access-shortcodes.php' );
|
98 |
require_once( GROUPS_VIEWS_LIB . '/class-groups-shortcodes.php' );
|
37 |
// <= 3.2.1
|
38 |
if ( !function_exists( 'is_user_member_of_blog' ) ) {
|
39 |
function is_user_member_of_blog( $user_id, $blog_id = 0 ) {
|
40 |
+
return false !== get_user_by( 'id', $user_id );
|
41 |
}
|
42 |
}
|
43 |
|
56 |
// plugin control: activation, deactivation, ...
|
57 |
require_once( GROUPS_CORE_LIB . '/class-groups-controller.php' );
|
58 |
|
59 |
+
// legacy enabled?
|
60 |
+
$groups_legacy_enable = Groups_Options::get_option( GROUPS_LEGACY_ENABLE, GROUPS_LEGACY_ENABLE_DEFAULT );
|
61 |
+
|
62 |
// admin
|
63 |
if ( is_admin() ) {
|
64 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin.php' );
|
65 |
+
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-welcome.php' );
|
66 |
if ( Groups_Options::get_option( GROUPS_SHOW_IN_USER_PROFILE, GROUPS_SHOW_IN_USER_PROFILE_DEFAULT ) ) {
|
67 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-user-profile.php' );
|
68 |
}
|
69 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-users.php' );
|
70 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-posts.php' );
|
71 |
require_once( GROUPS_ADMIN_LIB . '/class-groups-admin-post-columns.php' );
|
72 |
+
if ( $groups_legacy_enable ) {
|
73 |
+
require_once GROUPS_LEGACY_LIB . '/admin/class-groups-admin-posts-legacy.php';
|
74 |
+
require_once GROUPS_LEGACY_LIB . '/admin/class-groups-admin-post-columns-legacy.php';
|
75 |
+
}
|
76 |
}
|
77 |
|
78 |
// help
|
98 |
*/
|
99 |
|
100 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-post-access.php' );
|
101 |
+
if ( $groups_legacy_enable ) {
|
102 |
+
require_once GROUPS_LEGACY_LIB . '/access/class-groups-post-access-legacy.php';
|
103 |
+
}
|
104 |
|
105 |
if ( is_admin() ) {
|
106 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-access-meta-boxes.php' );
|
107 |
+
if ( $groups_legacy_enable ) {
|
108 |
+
require_once( GROUPS_LEGACY_LIB . '/access/class-groups-access-meta-boxes-legacy.php' );
|
109 |
+
}
|
110 |
}
|
111 |
require_once( GROUPS_ACCESS_LIB . '/class-groups-access-shortcodes.php' );
|
112 |
require_once( GROUPS_VIEWS_LIB . '/class-groups-shortcodes.php' );
|
lib/test/groups-tests.php
CHANGED
@@ -382,13 +382,13 @@ if ( defined( 'ABSPATH' ) ) {
|
|
382 |
}
|
383 |
if ( in_array( 'groups/groups.php', $active_plugins ) || key_exists( 'groups/groups.php', $active_sitewide_plugins ) ) {
|
384 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
385 |
-
wp_die( __( 'Access denied.',
|
386 |
} else {
|
387 |
$run = isset( $_POST['run'] ) ? $_POST['run'] : null;
|
388 |
switch( $run ) {
|
389 |
case 'run' :
|
390 |
if ( !isset( $_POST['groups-test-nonce'] ) || !wp_verify_nonce( $_POST['groups-test-nonce'], 'run-tests' ) ) {
|
391 |
-
wp_die( __( 'Access denied.',
|
392 |
}
|
393 |
echo '<h1>Running tests for <i>Groups</i> plugin ...</h1>';
|
394 |
groups_tests();
|
382 |
}
|
383 |
if ( in_array( 'groups/groups.php', $active_plugins ) || key_exists( 'groups/groups.php', $active_sitewide_plugins ) ) {
|
384 |
if ( !current_user_can( GROUPS_ADMINISTER_GROUPS ) ) {
|
385 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
386 |
} else {
|
387 |
$run = isset( $_POST['run'] ) ? $_POST['run'] : null;
|
388 |
switch( $run ) {
|
389 |
case 'run' :
|
390 |
if ( !isset( $_POST['groups-test-nonce'] ) || !wp_verify_nonce( $_POST['groups-test-nonce'], 'run-tests' ) ) {
|
391 |
+
wp_die( __( 'Access denied.', 'groups' ) );
|
392 |
}
|
393 |
echo '<h1>Running tests for <i>Groups</i> plugin ...</h1>';
|
394 |
groups_tests();
|
lib/views/class-groups-shortcodes.php
CHANGED
@@ -118,7 +118,7 @@ class Groups_Shortcodes {
|
|
118 |
$output = '';
|
119 |
if ( is_user_logged_in() ) {
|
120 |
$output .= sprintf( '<a href="%s">', esc_url( wp_logout_url( $redirect ) ) );
|
121 |
-
$output .= __( 'Log out',
|
122 |
$output .= '</a>';
|
123 |
}
|
124 |
return $output;
|
@@ -164,7 +164,7 @@ class Groups_Shortcodes {
|
|
164 |
$output .= wp_filter_nohtml_kses( $current_group->description );
|
165 |
break;
|
166 |
case 'count' :
|
167 |
-
$user_group_table = _groups_get_tablename(
|
168 |
$count = $wpdb->get_var( $wpdb->prepare(
|
169 |
"SELECT COUNT(*) FROM $user_group_table WHERE group_id = %d",
|
170 |
Groups_Utility::id( $current_group->group_id )
|
@@ -174,11 +174,11 @@ class Groups_Shortcodes {
|
|
174 |
} else {
|
175 |
$count = intval( $count );
|
176 |
}
|
177 |
-
$output .= _n( $options['single'], sprintf( $options['plural'], $count ), $count,
|
178 |
break;
|
179 |
// @todo experimental - could use pagination, sorting, link to profile, ...
|
180 |
case 'users' :
|
181 |
-
$user_group_table = _groups_get_tablename(
|
182 |
$users = $wpdb->get_results( $wpdb->prepare(
|
183 |
"SELECT * FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
184 |
Groups_Utility::id( $current_group->group_id )
|
@@ -212,7 +212,7 @@ class Groups_Shortcodes {
|
|
212 |
* @return rendered groups for current user
|
213 |
*/
|
214 |
public static function groups_user_groups( $atts, $content = null ) {
|
215 |
-
$output =
|
216 |
$options = shortcode_atts(
|
217 |
array(
|
218 |
'user_id' => null,
|
@@ -253,7 +253,7 @@ class Groups_Shortcodes {
|
|
253 |
// group attr
|
254 |
if ( $options['group'] !== null ) {
|
255 |
$groups = array();
|
256 |
-
$groups_incl = explode(
|
257 |
foreach ( $groups_incl as $group_incl ) {
|
258 |
$group = trim( $group_incl );
|
259 |
$current_group = Groups_Group::read( $group );
|
@@ -269,7 +269,7 @@ class Groups_Shortcodes {
|
|
269 |
}
|
270 |
// exclude_group attr
|
271 |
if ( $options['exclude_group'] !== null ) {
|
272 |
-
$groups_excl = explode(
|
273 |
foreach ( $groups_excl as $key => $group_excl ) {
|
274 |
$group = trim( $group_excl );
|
275 |
$current_group = Groups_Group::read( $group );
|
@@ -377,7 +377,7 @@ class Groups_Shortcodes {
|
|
377 |
*/
|
378 |
public static function groups_groups( $atts, $content = null ) {
|
379 |
global $wpdb;
|
380 |
-
$output =
|
381 |
$options = shortcode_atts(
|
382 |
array(
|
383 |
'format' => 'list',
|
@@ -406,7 +406,7 @@ class Groups_Shortcodes {
|
|
406 |
default :
|
407 |
$order = 'ASC';
|
408 |
}
|
409 |
-
$group_table = _groups_get_tablename(
|
410 |
if ( $groups = $wpdb->get_results(
|
411 |
"SELECT group_id FROM $group_table ORDER BY $order_by $order"
|
412 |
) ) {
|
@@ -459,14 +459,14 @@ class Groups_Shortcodes {
|
|
459 |
public static function groups_join( $atts, $content = null ) {
|
460 |
$nonce_action = 'groups_action';
|
461 |
$nonce = 'nonce_join';
|
462 |
-
$output =
|
463 |
|
464 |
$options = shortcode_atts(
|
465 |
array(
|
466 |
'group' => '',
|
467 |
'display_message' => true,
|
468 |
'display_is_member' => false,
|
469 |
-
'submit_text' => __( 'Join the %s group',
|
470 |
),
|
471 |
$atts
|
472 |
);
|
@@ -519,12 +519,12 @@ class Groups_Shortcodes {
|
|
519 |
} else if ( $display_message ) {
|
520 |
if ( $submitted && !$invalid_nonce && isset( $join_group ) && $join_group->group_id === $current_group->group_id ) {
|
521 |
$output .= '<div class="groups-join joined">';
|
522 |
-
$output .= sprintf( __( 'You have joined the %s group.',
|
523 |
$output .= '</div>';
|
524 |
}
|
525 |
else if ( $display_is_member && isset( $current_group ) && $current_group !== false ) {
|
526 |
$output .= '<div class="groups-join member">';
|
527 |
-
$output .= sprintf( __( 'You are a member of the %s group.',
|
528 |
$output .= '</div>';
|
529 |
}
|
530 |
}
|
@@ -544,13 +544,13 @@ class Groups_Shortcodes {
|
|
544 |
public static function groups_leave( $atts, $content = null ) {
|
545 |
$nonce_action = 'groups_action';
|
546 |
$nonce = 'nonce_leave';
|
547 |
-
$output =
|
548 |
|
549 |
$options = shortcode_atts(
|
550 |
array(
|
551 |
'group' => '',
|
552 |
'display_message' => true,
|
553 |
-
'submit_text' => __( 'Leave the %s group',
|
554 |
),
|
555 |
$atts
|
556 |
);
|
@@ -595,7 +595,7 @@ class Groups_Shortcodes {
|
|
595 |
} else if ( $display_message ) {
|
596 |
if ( $submitted && !$invalid_nonce && isset( $leave_group ) && $leave_group->group_id === $current_group->group_id ) {
|
597 |
$output .= '<div class="groups-join left">';
|
598 |
-
$output .= sprintf( __( 'You have left the %s group.',
|
599 |
$output .= '</div>';
|
600 |
}
|
601 |
}
|
118 |
$output = '';
|
119 |
if ( is_user_logged_in() ) {
|
120 |
$output .= sprintf( '<a href="%s">', esc_url( wp_logout_url( $redirect ) ) );
|
121 |
+
$output .= __( 'Log out', 'groups' );
|
122 |
$output .= '</a>';
|
123 |
}
|
124 |
return $output;
|
164 |
$output .= wp_filter_nohtml_kses( $current_group->description );
|
165 |
break;
|
166 |
case 'count' :
|
167 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
168 |
$count = $wpdb->get_var( $wpdb->prepare(
|
169 |
"SELECT COUNT(*) FROM $user_group_table WHERE group_id = %d",
|
170 |
Groups_Utility::id( $current_group->group_id )
|
174 |
} else {
|
175 |
$count = intval( $count );
|
176 |
}
|
177 |
+
$output .= _n( $options['single'], sprintf( $options['plural'], $count ), $count, 'groups' );
|
178 |
break;
|
179 |
// @todo experimental - could use pagination, sorting, link to profile, ...
|
180 |
case 'users' :
|
181 |
+
$user_group_table = _groups_get_tablename( 'user_group' );
|
182 |
$users = $wpdb->get_results( $wpdb->prepare(
|
183 |
"SELECT * FROM $wpdb->users LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d",
|
184 |
Groups_Utility::id( $current_group->group_id )
|
212 |
* @return rendered groups for current user
|
213 |
*/
|
214 |
public static function groups_user_groups( $atts, $content = null ) {
|
215 |
+
$output = '';
|
216 |
$options = shortcode_atts(
|
217 |
array(
|
218 |
'user_id' => null,
|
253 |
// group attr
|
254 |
if ( $options['group'] !== null ) {
|
255 |
$groups = array();
|
256 |
+
$groups_incl = explode( ',', $options['group'] );
|
257 |
foreach ( $groups_incl as $group_incl ) {
|
258 |
$group = trim( $group_incl );
|
259 |
$current_group = Groups_Group::read( $group );
|
269 |
}
|
270 |
// exclude_group attr
|
271 |
if ( $options['exclude_group'] !== null ) {
|
272 |
+
$groups_excl = explode( ',', $options['exclude_group'] );
|
273 |
foreach ( $groups_excl as $key => $group_excl ) {
|
274 |
$group = trim( $group_excl );
|
275 |
$current_group = Groups_Group::read( $group );
|
377 |
*/
|
378 |
public static function groups_groups( $atts, $content = null ) {
|
379 |
global $wpdb;
|
380 |
+
$output = '';
|
381 |
$options = shortcode_atts(
|
382 |
array(
|
383 |
'format' => 'list',
|
406 |
default :
|
407 |
$order = 'ASC';
|
408 |
}
|
409 |
+
$group_table = _groups_get_tablename( 'group' );
|
410 |
if ( $groups = $wpdb->get_results(
|
411 |
"SELECT group_id FROM $group_table ORDER BY $order_by $order"
|
412 |
) ) {
|
459 |
public static function groups_join( $atts, $content = null ) {
|
460 |
$nonce_action = 'groups_action';
|
461 |
$nonce = 'nonce_join';
|
462 |
+
$output = '';
|
463 |
|
464 |
$options = shortcode_atts(
|
465 |
array(
|
466 |
'group' => '',
|
467 |
'display_message' => true,
|
468 |
'display_is_member' => false,
|
469 |
+
'submit_text' => __( 'Join the %s group', 'groups' )
|
470 |
),
|
471 |
$atts
|
472 |
);
|
519 |
} else if ( $display_message ) {
|
520 |
if ( $submitted && !$invalid_nonce && isset( $join_group ) && $join_group->group_id === $current_group->group_id ) {
|
521 |
$output .= '<div class="groups-join joined">';
|
522 |
+
$output .= sprintf( __( 'You have joined the %s group.', 'groups' ), wp_filter_nohtml_kses( $join_group->name ) );
|
523 |
$output .= '</div>';
|
524 |
}
|
525 |
else if ( $display_is_member && isset( $current_group ) && $current_group !== false ) {
|
526 |
$output .= '<div class="groups-join member">';
|
527 |
+
$output .= sprintf( __( 'You are a member of the %s group.', 'groups' ), wp_filter_nohtml_kses( $current_group->name ) );
|
528 |
$output .= '</div>';
|
529 |
}
|
530 |
}
|
544 |
public static function groups_leave( $atts, $content = null ) {
|
545 |
$nonce_action = 'groups_action';
|
546 |
$nonce = 'nonce_leave';
|
547 |
+
$output = '';
|
548 |
|
549 |
$options = shortcode_atts(
|
550 |
array(
|
551 |
'group' => '',
|
552 |
'display_message' => true,
|
553 |
+
'submit_text' => __( 'Leave the %s group', 'groups' ),
|
554 |
),
|
555 |
$atts
|
556 |
);
|
595 |
} else if ( $display_message ) {
|
596 |
if ( $submitted && !$invalid_nonce && isset( $leave_group ) && $leave_group->group_id === $current_group->group_id ) {
|
597 |
$output .= '<div class="groups-join left">';
|
598 |
+
$output .= sprintf( __( 'You have left the %s group.', 'groups' ), wp_filter_nohtml_kses( $leave_group->name ) );
|
599 |
$output .= '</div>';
|
600 |
}
|
601 |
}
|
lib/views/class-groups-uie.php
CHANGED
@@ -49,7 +49,7 @@ class Groups_UIE {
|
|
49 |
* Extension chooser - determines what UI extension is used for an element.
|
50 |
*
|
51 |
* @param string $element choices: select
|
52 |
-
* @param string $extension choices:
|
53 |
*/
|
54 |
public static function set_extension( $element, $extension ) {
|
55 |
switch( $element ) {
|
@@ -67,14 +67,6 @@ class Groups_UIE {
|
|
67 |
switch( $element ) {
|
68 |
case 'select' :
|
69 |
switch ( self::$select ) {
|
70 |
-
case 'chosen' :
|
71 |
-
if ( !wp_script_is( 'chosen' ) ) {
|
72 |
-
wp_enqueue_script( 'chosen', GROUPS_PLUGIN_URL . 'js/chosen/chosen.jquery.min.js', array( 'jquery' ), $groups_version, false );
|
73 |
-
}
|
74 |
-
if ( !wp_style_is( 'chosen' ) ) {
|
75 |
-
wp_enqueue_style( 'chosen', GROUPS_PLUGIN_URL . 'css/chosen/chosen.min.css', array(), $groups_version );
|
76 |
-
}
|
77 |
-
break;
|
78 |
case 'selectize' :
|
79 |
if ( !wp_script_is( 'selectize' ) ) {
|
80 |
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
|
@@ -93,9 +85,10 @@ class Groups_UIE {
|
|
93 |
* @param string $selector identifying the select, default: select.groups-uie
|
94 |
* @param boolean $script render the script, default: true
|
95 |
* @param boolean $on_document_ready whether to trigger on document ready, default: true
|
|
|
96 |
* @return string HTML
|
97 |
*/
|
98 |
-
public static function render_select( $selector = 'select.groups-uie', $script = true, $on_document_ready = true ) {
|
99 |
$output = '';
|
100 |
if ( $script ) {
|
101 |
$output .= '<script type="text/javascript">';
|
@@ -104,11 +97,12 @@ class Groups_UIE {
|
|
104 |
$output .= 'jQuery("document").ready(function(){';
|
105 |
}
|
106 |
switch( self::$select ) {
|
107 |
-
case 'chosen' :
|
108 |
-
$output .= sprintf( 'jQuery("%s").chosen({width:"100%%",search_contains:true});', $selector );
|
109 |
-
break;
|
110 |
case 'selectize' :
|
111 |
-
$output .= sprintf(
|
|
|
|
|
|
|
|
|
112 |
break;
|
113 |
}
|
114 |
if ( $on_document_ready ) {
|
49 |
* Extension chooser - determines what UI extension is used for an element.
|
50 |
*
|
51 |
* @param string $element choices: select
|
52 |
+
* @param string $extension choices: selectize
|
53 |
*/
|
54 |
public static function set_extension( $element, $extension ) {
|
55 |
switch( $element ) {
|
67 |
switch( $element ) {
|
68 |
case 'select' :
|
69 |
switch ( self::$select ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
case 'selectize' :
|
71 |
if ( !wp_script_is( 'selectize' ) ) {
|
72 |
wp_enqueue_script( 'selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array( 'jquery' ), $groups_version, false );
|
85 |
* @param string $selector identifying the select, default: select.groups-uie
|
86 |
* @param boolean $script render the script, default: true
|
87 |
* @param boolean $on_document_ready whether to trigger on document ready, default: true
|
88 |
+
* @param boolean $create allow to create items, default: false (only with selectize)
|
89 |
* @return string HTML
|
90 |
*/
|
91 |
+
public static function render_select( $selector = 'select.groups-uie', $script = true, $on_document_ready = true, $create = false ) {
|
92 |
$output = '';
|
93 |
if ( $script ) {
|
94 |
$output .= '<script type="text/javascript">';
|
97 |
$output .= 'jQuery("document").ready(function(){';
|
98 |
}
|
99 |
switch( self::$select ) {
|
|
|
|
|
|
|
100 |
case 'selectize' :
|
101 |
+
$output .= sprintf(
|
102 |
+
'jQuery("%s").selectize({%splugins: ["remove_button"]});',
|
103 |
+
$selector,
|
104 |
+
$create ? 'create:true,' : ''
|
105 |
+
);
|
106 |
break;
|
107 |
}
|
108 |
if ( $on_document_ready ) {
|
readme.txt
CHANGED
@@ -3,25 +3,25 @@ Contributors: itthinx, proaktion
|
|
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.
|
7 |
-
Stable tag:
|
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.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
Groups is designed as an efficient, powerful and flexible solution for group-oriented
|
15 |
|
16 |
It provides group-based user membership management, group-based capabilities and access control for content, built on solid principles.
|
17 |
|
18 |
Groups is light-weight and offers an easy user interface, while it acts as a framework and integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
|
19 |
|
20 |
-
Enhanced functionality is available via
|
21 |
|
22 |
### Documentation ###
|
23 |
|
24 |
-
The official documentation is located at the [Groups
|
25 |
|
26 |
### Features ###
|
27 |
|
@@ -45,44 +45,37 @@ The official documentation is located at the [Groups documentation pages](http:/
|
|
45 |
|
46 |
#### Access control ####
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
- Built-in access control that allows to restrict access to posts, pages and custom content types to specific groups and users only
|
49 |
-
-
|
50 |
Shortcodes: [groups_member], [groups_non_member]
|
51 |
-
-
|
52 |
Shortcodes: [groups_can], [groups_can_not]
|
53 |
|
54 |
#### Easy user interface ####
|
55 |
|
56 |
-
-
|
57 |
-
-
|
58 |
-
-
|
59 |
-
-
|
60 |
-
-
|
61 |
|
62 |
#### Sensible options ####
|
63 |
|
64 |
-
-
|
65 |
-
- optional tree view for groups can be shown
|
66 |
-
-
|
67 |
-
-
|
68 |
-
|
69 |
-
#### Access Control ####
|
70 |
-
|
71 |
-
Access to posts and pages can be restricted by capability.
|
72 |
-
|
73 |
-
Any capability can be used to restrict access, including new capabilities.
|
74 |
-
|
75 |
-
If access to a post is restricted, only users who belong to a group with that
|
76 |
-
capability may access the post.
|
77 |
-
|
78 |
-
Groups defines the groups_read_post capability by default, which can be
|
79 |
-
used to restrict access to certain posts or pages to groups
|
80 |
-
with that capability only. Any other capability (including new ones) can be
|
81 |
-
used to limit access as well.
|
82 |
|
83 |
#### Framework ####
|
84 |
|
85 |
-
-
|
86 |
|
87 |
#### Multisite ####
|
88 |
|
@@ -92,9 +85,9 @@ used to limit access as well.
|
|
92 |
|
93 |
Feedback is welcome!
|
94 |
|
95 |
-
If you need help, have problems, want to leave feedback or want to provide constructive criticism, please do so here at the [Groups
|
96 |
|
97 |
-
Please try to solve problems there before you rate this plugin or say it doesn't work. There goes a _lot_ of work into providing you with free quality plugins! Please appreciate that and help with your feedback.
|
98 |
|
99 |
#### Twitter ####
|
100 |
|
@@ -121,37 +114,45 @@ Many thanks for your help!
|
|
121 |
|
122 |
= Where is the documentation? =
|
123 |
|
124 |
-
The official documentation is located at the [Groups
|
125 |
|
126 |
= I have a question, where do I ask? =
|
127 |
|
128 |
-
For questions directly related to Groups, you can leave a comment at the [Groups
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
= I want Advanced and Premium members, where the Premium members can access everything that Advanced members can access. How can I do that? =
|
131 |
|
132 |
Example: Advanced and Premium members
|
133 |
|
134 |
-
1. Go to *Groups >
|
135 |
-
2.
|
136 |
-
3.
|
137 |
-
4.
|
138 |
-
5. Now create an example post that only members of the *Advanced Members* group should be able to see and tick the *advanced* checkbox under _Access restrictions_.
|
139 |
-
6. Create another post for *Premium Members* and tick the *premium* checkbox for that post.
|
140 |
-
7. Assign test users to both groups, log in as each user in turn and see which posts will be accessible.
|
141 |
|
142 |
= How do I limit access to posts so that users in group A can not read the same as those in group B and vice-versa? =
|
143 |
|
144 |
Example: Green and Red members
|
145 |
|
146 |
-
1. Go to *Groups >
|
147 |
-
2.
|
148 |
-
3.
|
149 |
-
4.
|
150 |
-
5. Now create an example post that only members of the *Green Members* group should be able to see and tick the *green* checkbox under _Access restrictions_.
|
151 |
-
6. Create another post for *Red Members* and tick the *red* checkbox for that post.
|
152 |
-
7. Assign a test user to any of the above groups, log in as that user and the post will be accessible.
|
153 |
|
154 |
-
= Are access restrictions for Custom Post Types supported? =
|
155 |
|
156 |
Yes. Access restrictions can be turned on or off for specific CPTs on the *Groups > Options* page.
|
157 |
|
@@ -159,37 +160,51 @@ Yes. Access restrictions can be turned on or off for specific CPTs on the *Group
|
|
159 |
|
160 |
Go to *Groups > Options* and enable the option under *User profiles*.
|
161 |
|
162 |
-
= Developers aka What about Groups' API? =
|
163 |
|
164 |
The Groups plugin provides an extensive framework to handle memberships, group-based capabilities and access control.
|
165 |
|
166 |
The API documentation is available here: [Groups API](http://api.itthinx.com/groups).
|
167 |
|
168 |
-
Also refer to the official [Groups](http://www.itthinx.com/plugins/groups/)
|
169 |
|
170 |
== Screenshots ==
|
171 |
|
172 |
-
See also [Groups](http://www.itthinx.com/
|
173 |
|
174 |
1. Groups - this is where you add and remove groups and assign capabilities to groups.
|
175 |
2. Capabilities - here you get an overview of the capabilities that are defined and you can add and remove capabilities as well.
|
176 |
3. Users - group membership is managed from the standard Users admin view.
|
177 |
-
4.
|
178 |
-
5.
|
179 |
-
6.
|
180 |
-
7.
|
181 |
-
8.
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
== Changelog ==
|
184 |
|
185 |
-
|
186 |
-
* Fixed an issue where the wrong post count would be produced for statuses that do not represent a valid WooCommerce order status.
|
187 |
-
* Added support for post counts with WooCommerce Subscriptions.
|
188 |
|
189 |
-
=
|
190 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
== Upgrade Notice ==
|
193 |
|
194 |
-
=
|
195 |
-
|
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.7.2
|
7 |
+
Stable tag: 2.0.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.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Groups is designed as an efficient, powerful and flexible solution for group-oriented memberships and content access control.
|
15 |
|
16 |
It provides group-based user membership management, group-based capabilities and access control for content, built on solid principles.
|
17 |
|
18 |
Groups is light-weight and offers an easy user interface, while it acts as a framework and integrates standard WordPress capabilities and application-specific capabilities along with an extensive API.
|
19 |
|
20 |
+
Enhanced functionality is available via [Official Extensions](http://www.itthinx.com/product-category/groups/) for Groups.
|
21 |
|
22 |
### Documentation ###
|
23 |
|
24 |
+
The official documentation is located at the [Groups Documentation](http://docs.itthinx.com/document/groups/) pages.
|
25 |
|
26 |
### Features ###
|
27 |
|
45 |
|
46 |
#### Access control ####
|
47 |
|
48 |
+
Access to posts, pages and custom post types can be restricted by group.
|
49 |
+
|
50 |
+
If access to a post is restricted to one or more groups, only users who belong to one of those groups may view the post.
|
51 |
+
|
52 |
+
Fully supports custom post types, so that access to post types such as products or events can easily be restricted.
|
53 |
+
|
54 |
- Built-in access control that allows to restrict access to posts, pages and custom content types to specific groups and users only
|
55 |
+
- Control access to content by groups: shortcodes allow to control who can access content on posts, show parts to members of certain groups or to those who are not members -
|
56 |
Shortcodes: [groups_member], [groups_non_member]
|
57 |
+
- Control access to content by capabilities: show (or do not show) content to users who have certain capabilities -
|
58 |
Shortcodes: [groups_can], [groups_can_not]
|
59 |
|
60 |
#### Easy user interface ####
|
61 |
|
62 |
+
- Integrates nicely with the standard WordPress Users menu
|
63 |
+
- Provides an intuitive Groups menu
|
64 |
+
- Conceptually clean views showing the essentials
|
65 |
+
- Quick filters
|
66 |
+
- Bulk-actions where needed, for example apply capabilities to groups, bulk-add users to groups, bulk-remove users from groups
|
67 |
|
68 |
#### Sensible options ####
|
69 |
|
70 |
+
- Enable access restrictions by custom post type
|
71 |
+
- An optional tree view for groups can be shown when desired
|
72 |
+
- Provides its own set of permissions
|
73 |
+
- Administrator overrides for tests
|
74 |
+
- Cleans up after testing with a "delete all plugin data" option
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
#### Framework ####
|
77 |
|
78 |
+
- Groups is designed based on a solid and sound data-model with a complete API that allows developers to create group-oriented web applications and plugins
|
79 |
|
80 |
#### Multisite ####
|
81 |
|
85 |
|
86 |
Feedback is welcome!
|
87 |
|
88 |
+
If you need help, have problems, want to leave feedback or want to provide constructive criticism, please do so here at the [Groups Plugin](http://www.itthinx.com/plugins/groups/) page.
|
89 |
|
90 |
+
Please try to solve problems there before you rate this plugin or say it doesn't work. There goes a _lot_ of work into providing you with free quality plugins! Please appreciate that and help with your feedback. Many thanks!
|
91 |
|
92 |
#### Twitter ####
|
93 |
|
114 |
|
115 |
= Where is the documentation? =
|
116 |
|
117 |
+
The official documentation is located at the [Groups Documentation](http://docs.itthinx.com/document/groups/) pages.
|
118 |
|
119 |
= I have a question, where do I ask? =
|
120 |
|
121 |
+
For questions directly related to Groups, you can leave a comment at the [Groups Plugin](http://www.itthinx.com/plugins/groups/) page.
|
122 |
+
|
123 |
+
= How do I restrict access to a post? =
|
124 |
+
|
125 |
+
Let's assume you want members of the *Premium* group to be able to view some restricted posts.
|
126 |
+
|
127 |
+
- If you want to create a new protected post, simply go to *Posts > Add New* as usual and in the _Groups_ box input *Premium* in the _Read_ field. Save or publish your post.
|
128 |
+
- If you want to protect an existing post you can simply edit it, input *Premium* in the _Read_ field of the _Groups_ box and update the post.
|
129 |
+
|
130 |
+
In both cases, it doesn't matter if the *Premium* group already exists or not, if it doesn't, it will be created automatically.
|
131 |
+
|
132 |
+
If the *Premium* group already exists and you want to protect one or more existing posts in bulk, go to *Posts*, select all posts you want to protect and choose *Edit* in the *Bulk Actions* dropdown.
|
133 |
+
Now click *Apply*, select the *Premium* group and click *Update*.
|
134 |
+
|
135 |
+
After you publish or update your posts, only members of the *Premium* group will be able to see them.
|
136 |
|
137 |
= I want Advanced and Premium members, where the Premium members can access everything that Advanced members can access. How can I do that? =
|
138 |
|
139 |
Example: Advanced and Premium members
|
140 |
|
141 |
+
1. Go to *Groups > Groups > New Group* and add two new groups, let's call them *Advanced* and *Premium* - select *Advanced* as the *Parent* for the *Premium* group.
|
142 |
+
2. Now create an example post that only members of the *Advanced* group should be able to access and choose the *Advanced* group in the _Read_ field of the _Groups_ box.
|
143 |
+
3. Create another post for members of the *Premium* group and choose the *Premium* group for that post.
|
144 |
+
4. Assign test users to both groups, log in as each user in turn and see which posts will be accessible.
|
|
|
|
|
|
|
145 |
|
146 |
= How do I limit access to posts so that users in group A can not read the same as those in group B and vice-versa? =
|
147 |
|
148 |
Example: Green and Red members
|
149 |
|
150 |
+
1. Go to *Groups > Groups > New Group* and add two new groups, let's call them *Green Members* and *Red Members*
|
151 |
+
2. Now create an example post that only members of the *Green Members* group should be able to see and choose the *Green Members* group in the _Groups_ box.
|
152 |
+
3. Create another post for *Red Members* and choose the *Red Members* group for that post.
|
153 |
+
4. Assign a test user to each of the groups, log in as one of them and you will see that the member of the *Green Members* group will only have access to the post protected by that group but not to the post protected with the *Red Members* group and vice-versa.
|
|
|
|
|
|
|
154 |
|
155 |
+
= Are access restrictions for Custom Post Types (CPT) supported? =
|
156 |
|
157 |
Yes. Access restrictions can be turned on or off for specific CPTs on the *Groups > Options* page.
|
158 |
|
160 |
|
161 |
Go to *Groups > Options* and enable the option under *User profiles*.
|
162 |
|
163 |
+
= Developers ... aka ... What about Groups' API? =
|
164 |
|
165 |
The Groups plugin provides an extensive framework to handle memberships, group-based capabilities and access control.
|
166 |
|
167 |
The API documentation is available here: [Groups API](http://api.itthinx.com/groups).
|
168 |
|
169 |
+
Also refer to the official [Groups Plugin](http://www.itthinx.com/plugins/groups/) page to post your questions and the [Groups Documentation](http://docs.itthinx.com/document/groups/) pages.
|
170 |
|
171 |
== Screenshots ==
|
172 |
|
173 |
+
See also the [Groups Documentation](http://docs.itthinx.com/document/groups/) pages and the [Groups Plugin](http://www.itthinx.com/plugin/groups/) page.
|
174 |
|
175 |
1. Groups - this is where you add and remove groups and assign capabilities to groups.
|
176 |
2. Capabilities - here you get an overview of the capabilities that are defined and you can add and remove capabilities as well.
|
177 |
3. Users - group membership is managed from the standard Users admin view.
|
178 |
+
4. Filter the list of users by one or more groups.
|
179 |
+
5. Add users to groups or remove them in bulk.
|
180 |
+
6. Groups a users belongs to shown in the user profile.
|
181 |
+
7. Filter posts by groups.
|
182 |
+
8. Add or remove access restrictions based on groups in bulk.
|
183 |
+
9. Restrict access on pages and posts (and other custom post types) ... you can restrict access to users who are members of one or more groups.
|
184 |
+
10. A post restricted to members of a *Premium* group only.
|
185 |
+
11. Usage of the [groups_member] and [groups_non_member] shortcodes to limit visibility of content to users who are members of a group or users who are not members of a group. Multiple comma-separated groups can be specified.
|
186 |
+
12. Usage of the [groups_can] and [groups_can_not] shortcodes. Limits visibility of enclosed content to those users who have the capability or those who do not. Multiple capabilities can be given.
|
187 |
+
13. Options - you can adjust the plugin's settings here.
|
188 |
+
14. More options.
|
189 |
|
|
|
190 |
|
191 |
+
== Changelog ==
|
|
|
|
|
192 |
|
193 |
+
= 2.0.0 =
|
194 |
+
* Changed the access restriction model to group-based access restrictions.
|
195 |
+
* Provides an optional legacy mode that supports the previous capability-based access restrictions.
|
196 |
+
* Optimized the approach to restrict read access on posts using groups rather than access restriction capabilities.
|
197 |
+
* Added the `groups_restrict_access` capability which grants users to impose access restrictions.
|
198 |
+
* Fixed the order_by and order parameters in Groups_Group::get_groups()
|
199 |
+
* Added the $create parameter in Groups_UIE::render_select()
|
200 |
+
* Removed the "Chosen" library.
|
201 |
+
* Improved and reduced the footprint on the Users admin screen, now allowing to filter by one or multiple groups.
|
202 |
+
* Added a welcome screen.
|
203 |
+
* Added the option to assign groups to new users directly when creating them from the Dashboard.
|
204 |
+
* Changed the language domain to string literal instead of constant.
|
205 |
+
* Improvements on internal coding standards (single/double quotes, EOF, formatting).
|
206 |
|
207 |
== Upgrade Notice ==
|
208 |
|
209 |
+
= 2.0.0 =
|
210 |
+
Groups 2.0.0 simplifies the way access restrictions are handled.
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|
screenshot-4.png
DELETED
Binary file
|
screenshot-5.png
DELETED
Binary file
|
screenshot-6.png
DELETED
Binary file
|
screenshot-7.png
DELETED
Binary file
|
screenshot-8.png
DELETED
Binary file
|