PluginProbe
Members – Membership & User Role Editor Plugin / 3.2.24
Members – Membership & User Role Editor Plugin v3.2.24
3.2.25 3.2.26 3.2.24 3.2.23 3.2.22 3.2.21 trunk 0.1 0.1.1 0.2 0.2.1 0.2.2 0.2.3 0.2.4 0.2.5 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 2.0.0 2.0.1 2.0.2 All 66 releases
members / inc / functions-deprecated.php

functions-deprecated.php in Members – Membership & User Role Editor Plugin 3.2.24, at inc/functions-deprecated.php

465 lines 10.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Deprecated functions that are being phased out completely or should be replaced with other functions.
4 *
5 * @package Members
6 * @subpackage Includes
7 * @author The MemberPress Team
8 * @copyright Copyright (c) 2009 - 2018, The MemberPress Team
9 * @link https://members-plugin.com/
10 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11 */
12 if (!defined('ABSPATH')) {
13 die('You are not allowed to call this page directly.');
14 }
15
16 /**
17 * Returns an array of role names.
18 *
19 * @since 1.0.0
20 * @access public
21 * @return array
22 */
23 function members_get_role_names() {
24 _deprecated_function( __FUNCTION__, '2.0.0', '' );
25
26 $roles = array();
27
28 foreach ( members_get_roles() as $role )
29 $roles[ $role->name ] = $role->name;
30
31 return $roles;
32 }
33
34 /**
35 * Returns an array of the role names of roles that have users.
36 *
37 * @since 1.0.0
38 * @access public
39 * @return array
40 */
41 function members_get_active_role_names() {
42 _deprecated_function( __FUNCTION__, '2.0.0', '' );
43
44 $has_users = array();
45
46 foreach ( members_get_active_roles() as $role )
47 $has_users[ $role ] = members_get_role( $role )->get( 'label' );
48
49 return $has_users;
50 }
51
52 /**
53 * Returns an array of the role names of roles that do not have users.
54 *
55 * @since 1.0.0
56 * @access public
57 * @return array
58 */
59 function members_get_inactive_role_names() {
60 _deprecated_function( __FUNCTION__, '2.0.0', '' );
61
62 return array_diff( members_get_role_names(), members_get_active_role_names() );
63 }
64
65 /**
66 * Returns an array of editable role names.
67 *
68 * @since 1.0.0
69 * @access public
70 * @return array
71 */
72 function members_get_editable_role_names() {
73 _deprecated_function( __FUNCTION__, '2.0.0', '' );
74
75 $editable = array();
76
77 foreach ( members_role_registry()->editable as $role )
78 $editable[ $role->slug ] = $role->name;
79
80 return $editable;
81 }
82
83 /**
84 * Returns an array of editable roles.
85 *
86 * @since 1.0.0
87 * @access public
88 * @return array
89 */
90 function members_get_editable_role_slugs() {
91 _deprecated_function( __FUNCTION__, '2.0.0', '' );
92
93 return array_keys( members_role_registry()->editable );
94 }
95
96 /**
97 * Returns an array of uneditable role names.
98 *
99 * @since 1.0.0
100 * @access public
101 * @return array
102 */
103 function members_get_uneditable_role_names() {
104 _deprecated_function( __FUNCTION__, '2.0.0', '' );
105
106 $uneditable = array();
107
108 foreach ( members_role_registry()->uneditable as $role )
109 $uneditable[ $role->slug ] = $role->name;
110
111 return $uneditable;
112 }
113
114 /**
115 * Returns an array of uneditable roles.
116 *
117 * @since 1.0.0
118 * @access public
119 * @return array
120 */
121 function members_get_uneditable_role_slugs() {
122 _deprecated_function( __FUNCTION__, '2.0.0', '' );
123
124 return array_keys( members_role_registry()->uneditable );
125 }
126
127 /**
128 * Returns an array of core WordPress role names.
129 *
130 * @since 1.0.0
131 * @access public
132 * @return array
133 */
134 function members_get_wordpress_role_names() {
135 _deprecated_function( __FUNCTION__, '2.0.0', '' );
136
137 $names = array();
138
139 foreach ( members_role_registry()->wordpress as $role )
140 $names[ $role->slug ] = $role->name;
141
142 return $names;
143 }
144
145 /**
146 * Returns an array of core WP roles.
147 *
148 * @since 1.0.0
149 * @access public
150 * @return array
151 */
152 function members_get_wordpress_role_slugs() {
153 _deprecated_function( __FUNCTION__, '2.0.0', '' );
154
155 return array_keys( members_role_registry()->wordpress );
156 }
157
158 /**
159 * Returns the human-readable role name.
160 *
161 * @since 1.0.0
162 * @access public
163 * @param string $role
164 * @return string
165 */
166 function members_get_role_name( $role ) {
167 _deprecated_function( __FUNCTION__, '2.0.0', '' );
168
169 return members_role_registry()->get( $role )->name;
170 }
171
172 /**
173 * Returns an array of roles.
174 *
175 * @since 1.0.0
176 * @access public
177 * @return array
178 */
179 function members_get_role_slugs() {
180 _deprecated_function( __FUNCTION__, '2.0.0', '' );
181
182 return array_keys( members_get_roles() );
183 }
184
185 /**
186 * Returns an array of the roles that have users.
187 *
188 * @since 1.0.0
189 * @access public
190 * @return array
191 */
192 function members_get_active_role_slugs() {
193 _deprecated_function( __FUNCTION__, '2.0.0', '' );
194
195 $has_users = array();
196
197 foreach ( members_get_role_user_count() as $role => $count ) {
198
199 if ( 0 < $count )
200 $has_users[] = $role;
201 }
202
203 return $has_users;
204 }
205
206 /**
207 * Returns an array of the roles that have no users.
208 *
209 * @since 1.0.0
210 * @access public
211 * @return array
212 */
213 function members_get_inactive_role_slugs() {
214 _deprecated_function( __FUNCTION__, '2.0.0', '' );
215
216 return array_diff( array_keys( members_get_roles() ), members_get_active_roles() );
217 }
218
219 /**
220 * Returns the caps for the all capability group.
221 *
222 * @since 1.0.0
223 * @access public
224 * @return array
225 */
226 function members_get_all_group_caps() {
227 _deprecated_function( __FUNCTION__, '2.0.0', '' );
228
229 return members_get_capabilities();
230 }
231
232 /**
233 * Returns the caps for the general capability group.
234 *
235 * @since 1.0.0
236 * @deprecated 2.0.0
237 * @access public
238 * @return array
239 */
240 function members_get_general_group_caps() {
241
242 return array_keys( wp_list_filter( members_get_caps(), array( 'group' => 'general' ) ) );
243 }
244
245 /**
246 * Returns the caps for the theme capability group.
247 *
248 * @since 1.0.0
249 * @deprecated 2.0.0
250 * @access public
251 * @return array
252 */
253 function members_get_theme_group_caps() {
254
255 return array_keys( wp_list_filter( members_get_caps(), array( 'group' => 'theme' ) ) );
256 }
257
258 /**
259 * Returns the caps for the plugin capability group.
260 *
261 * @since 1.0.0
262 * @deprecated 2.0.0
263 * @access public
264 * @return array
265 */
266 function members_get_plugin_group_caps() {
267
268 return array_keys( wp_list_filter( members_get_caps(), array( 'group' => 'plugin' ) ) );
269 }
270
271 /**
272 * Returns the caps for the user capability group.
273 *
274 * @since 1.0.0
275 * @deprecated 2.0.0
276 * @access public
277 * @return array
278 */
279 function members_get_user_group_caps() {
280
281 return array_keys( wp_list_filter( members_get_caps(), array( 'group' => 'user' ) ) );
282 }
283
284 /**
285 * Additional capabilities provided by the Members plugin that gives users permissions to handle
286 * certain features of the plugin.
287 *
288 * @since 1.0.0
289 * @deprecated 2.0.0
290 * @access public
291 * @return array
292 */
293 function members_get_plugin_capabilities() {
294
295 return array(
296 'list_roles', // View roles list.
297 'create_roles', // Create new roles.
298 'delete_roles', // Delete roles.
299 'edit_roles', // Edit a role's caps.
300 'restrict_content' // Restrict content (content permissions component).
301 );
302 }
303
304 /**
305 * Make sure we keep the default capabilities in case users screw 'em up. A user could easily
306 * remove a useful WordPress capability from all roles. When this happens, the capability is no
307 * longer stored in any of the roles, so it basically doesn't exist. This function will house
308 * all of the default WordPress capabilities in case this scenario comes into play.
309 *
310 * For those reading this note, yes, I did "accidentally" remove all capabilities from my
311 * administrator account when developing this plugin. And yes, that was fun putting back
312 * together. ;)
313 *
314 * @link http://codex.wordpress.org/Roles_and_Capabilities#Capabilities
315 * @since 1.0.0
316 * @deprecated 2.0.0
317 * @access public
318 * @return array
319 */
320 function members_get_wp_capabilities() {
321
322 return array(
323 'activate_plugins',
324 'add_users',
325 'assign_categories',
326 'assign_post_tags',
327 'create_users',
328 'delete_categories',
329 'delete_others_pages',
330 'delete_others_posts',
331 'delete_pages',
332 'delete_plugins',
333 'delete_posts',
334 'delete_post_tags',
335 'delete_private_pages',
336 'delete_private_posts',
337 'delete_published_pages',
338 'delete_published_posts',
339 'delete_themes',
340 'delete_users',
341 'edit_categories',
342 'edit_dashboard',
343 'edit_files',
344 'edit_others_pages',
345 'edit_others_posts',
346 'edit_pages',
347 'edit_plugins',
348 'edit_posts',
349 'edit_post_tags',
350 'edit_private_pages',
351 'edit_private_posts',
352 'edit_published_pages',
353 'edit_published_posts',
354 'edit_theme_options',
355 'edit_themes',
356 'edit_users',
357 'export',
358 'import',
359 'install_plugins',
360 'install_themes',
361 'list_users',
362 'manage_categories',
363 'manage_links',
364 'manage_options',
365 'manage_post_tags',
366 'moderate_comments',
367 'promote_users',
368 'publish_pages',
369 'publish_posts',
370 'read',
371 'read_private_pages',
372 'read_private_posts',
373 'remove_users',
374 'switch_themes',
375 'unfiltered_html',
376 'unfiltered_upload',
377 'update_core',
378 'update_plugins',
379 'update_themes',
380 'upload_files'
381 );
382 }
383
384 /**
385 * @since 0.2.0
386 * @deprecated 1.0.0
387 */
388 //function members_get_active_roles() {
389 // _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_active_role_names' );
390 // return members_get_active_role_names();
391 //}
392
393 /**
394 * @since 0.2.0
395 * @deprecated 1.0.0
396 */
397 //function members_get_inactive_roles() {
398 // _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_inactive_role_names' );
399 // return members_get_inactive_role_names();
400 //}
401
402 /**
403 * @since 0.2.0
404 * @deprecated 1.0.0
405 */
406 function members_count_roles() {
407 _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_role_count' );
408 return members_get_role_count();
409 }
410
411 /**
412 * @since 0.1.0
413 * @deprecated 1.0.0
414 */
415 function members_get_default_capabilities() {
416 _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_wp_capabilities' );
417 return members_get_wp_capabilities();
418 }
419
420 /**
421 * @since 0.1.0
422 * @deprecated 1.0.0
423 */
424 function members_get_additional_capabilities() {
425 _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_plugin_capabilities' );
426 return members_get_plugin_capabilities();
427 }
428
429 /* ====== Functions removed in the 2.0 branch. ====== */
430
431 function members_role_factory() {}
432 function members_role_group_factory() {}
433 function members_cap_group_factory() {}
434 function members_manage_users_columns() {}
435 function members_manage_users_custom_column() {}
436
437 /* ====== Functions removed in the 1.0 branch. ====== */
438
439 if ( ! function_exists( 'has_role' ) ) { function has_role() {} }
440 if ( ! function_exists( 'current_user_has_role' ) ) { function current_user_has_role() {} }
441
442 function members_author_profile() {}
443 function members_login_form() {}
444 function members_get_login_form() {}
445 function members_get_avatar_shortcode() {}
446 function members_version_check() {}
447 function members_install() {}
448 function members_update() {}
449 function members_edit_roles_page() {}
450 function members_edit_capabilities_page() {}
451 function members_new_role_page() {}
452 function members_new_capability_page() {}
453 function members_message_role_deleted() {}
454 function members_message_roles_deleted() {}
455 function members_admin_message() {}
456 function members_admin_enqueue_scripts() {}
457 function members_admin_enqueue_style() {}
458 function members_get_nonce() {}
459 function members_admin_load_post_meta_boxes() {}
460 function members_content_permissions_create_meta_box() {}
461 function members_content_permissions_meta_box() {}
462 function members_content_permissions_save_meta() {}
463 function members_admin_setup() {}
464 function members_admin_contextual_help() {}
465