Members - Version 1.0.0

Version Description

Download this release

Release Info

Developer greenshady
Plugin Icon 128x128 Members
Version 1.0.0
Comparing to
See all releases

Code changes from version 0.2.5 to 1.0.0

Files changed (83) hide show
  1. admin/admin.php +0 -295
  2. admin/class-cap-control.php +129 -0
  3. admin/class-cap-group-factory.php +115 -0
  4. admin/class-cap-group.php +126 -0
  5. admin/class-cap-section.php +117 -0
  6. admin/class-cap-tabs.php +242 -0
  7. admin/class-manage-roles.php +166 -0
  8. admin/class-meta-box-content-permissions.php +224 -0
  9. admin/class-meta-box-custom-cap.php +108 -0
  10. admin/class-meta-box-publish-role.php +156 -0
  11. admin/class-role-edit.php +300 -0
  12. admin/class-role-group-factory.php +115 -0
  13. admin/class-role-group.php +129 -0
  14. admin/class-role-list-table.php +451 -0
  15. admin/class-role-new.php +388 -0
  16. admin/class-roles.php +311 -0
  17. admin/class-settings.php +510 -0
  18. admin/class-user-edit.php +201 -0
  19. admin/functions-admin.php +192 -0
  20. admin/functions-cap-groups.php +377 -0
  21. admin/functions-help.php +163 -0
  22. admin/functions-role-groups.php +165 -0
  23. admin/meta-box-plugin-settings.php +0 -172
  24. admin/meta-box-post-content-permissions.php +0 -161
  25. admin/role-edit.php +0 -133
  26. admin/role-new.php +0 -108
  27. admin/roles-list-table.php +0 -238
  28. admin/roles.php +0 -111
  29. admin/settings.php +0 -180
  30. admin/tmpl/cap-control.php +28 -0
  31. admin/tmpl/cap-section.php +35 -0
  32. changelog.md +102 -0
  33. contributing.md +31 -0
  34. css/admin.css +244 -68
  35. css/admin.min.css +1 -0
  36. docs/readme.css +0 -77
  37. docs/readme.html +0 -250
  38. inc/class-role-factory.php +151 -0
  39. inc/class-role.php +182 -0
  40. inc/class-widget-login.php +280 -0
  41. inc/class-widget-users.php +265 -0
  42. inc/functions-admin-bar.php +40 -0
  43. inc/functions-capabilities.php +374 -0
  44. inc/functions-content-permissions.php +273 -0
  45. inc/functions-deprecated.php +85 -0
  46. inc/functions-options.php +123 -0
  47. inc/functions-private-site.php +100 -0
  48. inc/functions-roles.php +471 -0
  49. inc/functions-shortcodes.php +146 -0
  50. inc/functions-users.php +107 -0
  51. inc/functions-widgets.php +40 -0
  52. inc/functions.php +24 -0
  53. inc/template.php +157 -0
  54. includes/admin-bar.php +0 -36
  55. includes/capabilities.php +0 -245
  56. includes/content-permissions.php +0 -152
  57. includes/deprecated.php +0 -98
  58. includes/functions.php +0 -174
  59. includes/private-site.php +0 -56
  60. includes/shortcodes.php +0 -144
  61. includes/template.php +0 -107
  62. includes/update.php +0 -111
  63. includes/widget-login-form.php +0 -272
  64. includes/widget-users.php +0 -238
  65. includes/widgets.php +0 -40
  66. js/admin.js +0 -25
  67. js/edit-role.js +409 -0
  68. js/edit-role.min.js +1 -0
  69. js/settings.js +30 -0
  70. js/settings.min.js +1 -0
  71. languages/members-en_EN.mo +0 -0
  72. languages/members-en_EN.po +0 -1573
  73. languages/members.pot +830 -1573
  74. docs/license.txt → license.md +0 -0
  75. members.php +266 -125
  76. readme.md +175 -0
  77. readme.txt +39 -76
  78. screenshot-1.png +0 -0
  79. screenshot-2.png +0 -0
  80. screenshot-3.png +0 -0
  81. screenshot-4.png +0 -0
  82. screenshot-5.png +0 -0
  83. {includes → templates}/comments.php +3 -6
admin/admin.php DELETED
@@ -1,295 +0,0 @@
1
- <?php
2
- /**
3
- * Handles the admin setup and functions for the plugin.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Set up the administration functionality. */
10
- add_action( 'admin_menu', 'members_admin_setup' );
11
-
12
- /**
13
- * Sets up any functionality needed in the admin.
14
- *
15
- * @since 0.2.0
16
- */
17
- function members_admin_setup() {
18
- global $members;
19
-
20
- /* Add contextual help to the "Help" tab for the plugin's pages in the admin. */
21
- add_filter( 'contextual_help', 'members_admin_contextual_help', 10, 2 );
22
-
23
- /* If the role manager feature is active, add its admin pages. */
24
- if ( members_get_setting( 'role_manager' ) ) {
25
-
26
- /**
27
- * The "Roles" page should be shown for anyone that has the 'list_roles', 'edit_roles', or
28
- * 'delete_roles' caps, so we're checking against all three.
29
- */
30
-
31
- /* If the current user can 'edit_roles'. */
32
- if ( current_user_can( 'edit_roles' ) )
33
- $edit_roles_cap = 'edit_roles';
34
-
35
- /* If the current user can 'delete_roles'. */
36
- elseif ( current_user_can( 'delete_roles' ) )
37
- $edit_roles_cap = 'delete_roles';
38
-
39
- /* Else, set the cap to the default, 'list_roles'. */
40
- else
41
- $edit_roles_cap = 'list_roles';
42
-
43
- /* Create the Manage Roles page. */
44
- $members->edit_roles_page = add_submenu_page( 'users.php', esc_attr__( 'Roles', 'members' ), esc_attr__( 'Roles', 'members' ), $edit_roles_cap, 'roles', 'members_edit_roles_page' );
45
-
46
- /* Create the New Role page. */
47
- $members->new_roles_page = add_submenu_page( 'users.php', esc_attr__( 'Add New Role', 'members' ), esc_attr__( 'Add New Role', 'members' ), 'create_roles', 'role-new', 'members_new_role_page' );
48
- }
49
-
50
- /* Load post meta boxes on the post editing screen. */
51
- add_action( 'load-post.php', 'members_admin_load_post_meta_boxes' );
52
- add_action( 'load-post-new.php', 'members_admin_load_post_meta_boxes' );
53
-
54
- /* Load stylesheets and scripts for our custom admin pages. */
55
- add_action( 'admin_enqueue_scripts', 'members_admin_enqueue_style' );
56
- add_action( 'admin_enqueue_scripts', 'members_admin_enqueue_scripts' );
57
- }
58
-
59
- /**
60
- * Loads the admin stylesheet for the required pages based off the $hook_suffix parameter.
61
- *
62
- * @since 0.2.0
63
- * @param string $hook_suffix The hook for the current page in the admin.
64
- */
65
- function members_admin_enqueue_style( $hook_suffix ) {
66
-
67
- $pages = array(
68
- 'users_page_roles',
69
- 'users_page_role-new',
70
- 'settings_page_members-settings'
71
- );
72
-
73
- if ( in_array( $hook_suffix, $pages ) )
74
- wp_enqueue_style( 'members-admin', trailingslashit( MEMBERS_URI ) . 'css/admin.css', false, '20110525', 'screen' );
75
- }
76
-
77
- /**
78
- * Loads the admin JavaScript for the required pages based off the $hook_suffix parameter.
79
- *
80
- * @since 0.2.0
81
- * @param string $hook_suffix The hook for the current page in the admin.
82
- */
83
- function members_admin_enqueue_scripts( $hook_suffix ) {
84
-
85
- $pages = array(
86
- 'users_page_roles',
87
- 'users_page_role-new'
88
- );
89
-
90
- if ( in_array( $hook_suffix, $pages ) )
91
- wp_enqueue_script( 'members-admin', trailingslashit( MEMBERS_URI ) . 'js/admin.js', array( 'jquery' ), '20110525', true );
92
- }
93
-
94
- /**
95
- * Loads meta boxes for the post editing screen.
96
- *
97
- * @since 0.2.0
98
- */
99
- function members_admin_load_post_meta_boxes() {
100
-
101
- /* If the content permissions component is active, load its post meta box. */
102
- if ( members_get_setting( 'content_permissions' ) )
103
- require_once( MEMBERS_ADMIN . 'meta-box-post-content-permissions.php' );
104
- }
105
-
106
- /**
107
- * Loads the role manager main page (Roles).
108
- *
109
- * @since 0.1.0
110
- */
111
- function members_edit_roles_page() {
112
- require_once( MEMBERS_ADMIN . 'roles.php' );
113
- }
114
-
115
- /**
116
- * Loads the New Role page.
117
- *
118
- * @since 0.1.0
119
- */
120
- function members_new_role_page() {
121
- require_once( MEMBERS_ADMIN . 'role-new.php' );
122
- }
123
-
124
- /**
125
- * Adds custom contextual help on the plugin's admin screens. This is the text shown under the "Help" tab.
126
- *
127
- * @since 0.2.0
128
- */
129
- function members_admin_contextual_help( $text, $screen ) {
130
-
131
- /* Text shown on the "Members Settings" screen in the admin. */
132
- if ( 'settings_page_members-settings' == $screen ) {
133
- $text = '';
134
-
135
- $text .= '<p>' . __( '<strong>Role Manager:</strong> This feature allows you to manage roles on your site by giving you the ability to create, edit, and delete any role. Note that changes to roles do not change settings for the Members plugin. You are literally changing data in your WordPress database. This plugin feature merely provides an interface for you to make these changes.', 'members' ) . '</p>';
136
- $text .= '<p>' . __( "<strong>Content Permissions:</strong> This feature adds a meta box to the post edit screen that allows you to grant permissions for who can read the post content based on the user's role. Only users of roles with the <code>restrict_content</code> capability will be able to use this component.", 'members' ) . '</p>';
137
- $text .= '<p>' . __( "<strong>Sidebar Widgets:</strong> This feature creates additional widgets for use in your theme's sidebars. You can access them by clicking Widgets in the menu.", 'members' ) . '</p>';
138
- $text .= '<p>' . __( '<strong>Private Site:</strong> This feature allows you to redirect all users who are not logged into the site to the login page, creating an entirely private site. You may also replace your feed content with a custom error message.', 'members' ) . '</p>';
139
-
140
- $text .= '<p><strong>' . __( 'For more information:', 'members' ) . '</strong></p>';
141
-
142
- $text .= '<ul>';
143
- $text .= '<li><a href="' . MEMBERS_URI . 'docs/readme.html">' . __( 'Documentation', 'members' ) . '</a></li>';
144
- $text .= '<li><a href="http://themehybrid.com/support">' . __( 'Support Forums', 'members' ) . '</a></li>';
145
- $text .= '</ul>';
146
- }
147
-
148
- /* Text shown on the "Roles" screens in the admin. */
149
- elseif ( 'users_page_roles' == $screen ) {
150
- $text = '';
151
-
152
- /* Text for the "Edit Role" screen. */
153
- if ( isset( $_GET['action'] ) && 'edit' == $_GET['action'] ) {
154
-
155
- $text .= '<p>' . __( 'This screen allows you to edit the capabilities given to the role. You can tick the checkbox next to a capability to add the capability to the role. You can untick the checkbox next to a capability to remove a capability from the role. You can also add as many custom capabilities as you need in the Custom Capabilities section.', 'members' ) . '</p>';
156
- $text .= '<p>' . __( 'Capabilities are both powerful and dangerous tools. You should not add or remove a capability to a role unless you understand what permission you are granting or removing.', 'members' ) . '</p>';
157
- }
158
-
159
- /* Text shown on the main "Roles" screen. */
160
- else {
161
- $text .= '<p>' . __( 'This screen lists all the user roles available on this site. Roles are given to users as a way to "group" them. Roles are made up of capabilities (permissions), which decide what functions users of each role can perform on the site. From this screen, you can manage these roles and their capabilities.', 'members' ) . '</p>';
162
- $text .= '<p>' . __( 'To add a role to a user, click Users in the menu. To create a new role, click the Add New button at the top of the screen or Add New Role under the Users menu.', 'members' ) . '</p>';
163
- }
164
-
165
- /* Text shown for both the "Roles" and "Edit Role" screen. */
166
- $text .= '<p><strong>' . __( 'For more information:', 'members' ) . '</strong></p>';
167
-
168
- $text .= '<ul>';
169
- $text .= '<li><a href="http://justintadlock.com/archives/2009/08/30/users-roles-and-capabilities-in-wordpress">' . __( 'Users, Roles, and Capabilities', 'members' ) . '</a></li>';
170
- $text .= '<li><a href="' . MEMBERS_URI . 'docs/readme.html">' . __( 'Documentation', 'members' ) . '</a></li>';
171
- $text .= '<li><a href="http://themehybrid.com/support">' . __( 'Support Forums', 'members' ) . '</a></li>';
172
- $text .= '</ul>';
173
- }
174
-
175
- /* Text to show on the "Add New Role" screen in the admin. */
176
- elseif ( 'users_page_role-new' == $screen || 'users_page_role' == $screen ) {
177
- $text = '';
178
-
179
- $text .= '<p>' . __( 'This screen allows you to create a new user role for your site. You must input a unique role name and role label. You can also grant capabilities (permissions) to the new role. Capabilities are both powerful and dangerous tools. You should not add a capability to a role unless you understand what permission you are granting.', 'members' ) . '</p>';
180
- $text .= '<p>' . __( 'To add a role to a user, click Users in the menu. To edit roles, click Roles under the Users menu.', 'members' ) . '</p>';
181
-
182
- $text .= '<p><strong>' . __( 'For more information:', 'members' ) . '</strong></p>';
183
-
184
- $text .= '<ul>';
185
- $text .= '<li><a href="http://justintadlock.com/archives/2009/08/30/users-roles-and-capabilities-in-wordpress">' . __( 'Users, Roles, and Capabilities', 'members' ) . '</a></li>';
186
- $text .= '<li><a href="' . MEMBERS_URI . 'docs/readme.html">' . __( 'Documentation', 'members' ) . '</a></li>';
187
- $text .= '<li><a href="http://themehybrid.com/support">' . __( 'Support Forums', 'members' ) . '</a></li>';
188
- $text .= '</ul>';
189
- }
190
-
191
- /* Return the contextual help text. */
192
- return $text;
193
- }
194
-
195
- /**
196
- * Message to show when a single role has been deleted.
197
- *
198
- * @since 0.1.0
199
- */
200
- function members_message_role_deleted() {
201
- members_admin_message( '', __( 'Role deleted.', 'members' ) );
202
- }
203
-
204
- /**
205
- * Message to show when multiple roles have been deleted (bulk delete).
206
- *
207
- * @since 0.1.0
208
- */
209
- function members_message_roles_deleted() {
210
- members_admin_message( '', __( 'Selected roles deleted.', 'members' ) );
211
- }
212
-
213
- /**
214
- * A function for displaying messages in the admin. It will wrap the message in the appropriate <div> with the
215
- * custom class entered. The updated class will be added if no $class is given.
216
- *
217
- * @since 0.1.0
218
- * @param $class string Class the <div> should have.
219
- * @param $message string The text that should be displayed.
220
- */
221
- function members_admin_message( $class = 'updated', $message = '' ) {
222
-
223
- echo '<div class="' . ( !empty( $class ) ? esc_attr( $class ) : 'updated' ) . '"><p><strong>' . $message . '</strong></p></div>';
224
- }
225
-
226
- /**
227
- * Members plugin nonce function. This is to help with securely making sure forms have been processed
228
- * from the correct place.
229
- *
230
- * @since 0.1.0
231
- * @param $action string Additional action to add to the nonce.
232
- */
233
- function members_get_nonce( $action = '' ) {
234
- if ( $action )
235
- return "members-component-action_{$action}";
236
- else
237
- return "members-plugin";
238
- }
239
-
240
- /**
241
- * Function for safely deleting a role and transferring the deleted role's users to the default role. Note that
242
- * this function can be extremely intensive. Whenever a role is deleted, it's best for the site admin to assign
243
- * the user's of the role to a different role beforehand.
244
- *
245
- * @since 0.2.0
246
- * @param string $role The name of the role to delete.
247
- */
248
- function members_delete_role( $role ) {
249
-
250
- /* Get the default role. */
251
- $default_role = get_option( 'default_role' );
252
-
253
- /* Don't delete the default role. Site admins should change the default before attempting to delete the role. */
254
- if ( $role == $default_role )
255
- return;
256
-
257
- /* Get all users with the role to be deleted. */
258
- $users = get_users( array( 'role' => $role ) );
259
-
260
- /* Check if there are any users with the role we're deleting. */
261
- if ( is_array( $users ) ) {
262
-
263
- /* If users are found, loop through them. */
264
- foreach ( $users as $user ) {
265
-
266
- /* Create a new user object. */
267
- $new_user = new WP_User( $user->ID );
268
-
269
- /* If the user has the role, remove it and set the default. Do we need this check? */
270
- if ( $new_user->has_cap( $role ) ) {
271
- $new_user->remove_role( $role );
272
- $new_user->set_role( $default_role );
273
- }
274
- }
275
- }
276
-
277
- /* Remove the role. */
278
- remove_role( $role );
279
- }
280
-
281
- /**
282
- * Returns an array of all the user meta keys in the $wpdb->usermeta table.
283
- *
284
- * @since 0.2.0
285
- * @return array $keys The user meta keys.
286
- */
287
- function members_get_user_meta_keys() {
288
- global $wpdb;
289
-
290
- $keys = $wpdb->get_col( "SELECT meta_key FROM $wpdb->usermeta GROUP BY meta_key ORDER BY meta_key" );
291
-
292
- return $keys;
293
- }
294
-
295
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/class-cap-control.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Capability control class for use in the edit capabilities tabs.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Cap control class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Cap_Control {
20
+
21
+ /**
22
+ * Stores the cap tabs object.
23
+ *
24
+ * @see Members_Cap_Tabs
25
+ * @since 1.0.0
26
+ * @access public
27
+ * @var object
28
+ */
29
+ public $manager;
30
+
31
+ /**
32
+ * Name of the capability the control is for.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ * @var string
37
+ */
38
+ public $cap = '';
39
+
40
+ /**
41
+ * ID of the section the control is for.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var string
46
+ */
47
+ public $section = '';
48
+
49
+ /**
50
+ * Array of data to pass as a json object to the Underscore template.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var array
55
+ */
56
+ public $json = array();
57
+
58
+ /**
59
+ * Creates a new control object.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @param object $manager
64
+ * @param string $cap
65
+ * @param array $args
66
+ * @return void
67
+ */
68
+ public function __construct( $manager, $cap, $args = array() ) {
69
+
70
+ foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
71
+
72
+ if ( isset( $args[ $key ] ) )
73
+ $this->$key = $args[ $key ];
74
+ }
75
+
76
+ $this->manager = $manager;
77
+ $this->cap = $cap;
78
+ }
79
+
80
+ /**
81
+ * Returns the json array.
82
+ *
83
+ * @since 1.0.0
84
+ * @access public
85
+ * @return array
86
+ */
87
+ public function json() {
88
+ $this->to_json();
89
+ return $this->json;
90
+ }
91
+
92
+ /**
93
+ * Adds custom data to the json array. This data is passed to the Underscore template.
94
+ *
95
+ * @since 1.0.0
96
+ * @access public
97
+ * @return void
98
+ */
99
+ public function to_json() {
100
+
101
+ // Is the role editable?
102
+ $is_editable = $this->manager->role ? members_is_role_editable( $this->manager->role->name ) : true;
103
+
104
+ // Get the current capability.
105
+ $this->json['cap'] = $this->cap;
106
+
107
+ // Add the section ID.
108
+ $this->json['section'] = $this->section;
109
+
110
+ // If the cap is not editable, the inputs should be read-only.
111
+ $this->json['readonly'] = $is_editable ? '' : ' disabled="disabled" readonly="readonly"';
112
+
113
+ // Set up the input labels.
114
+ $this->json['label'] = array(
115
+ 'grant' => sprintf( esc_html__( 'Grant %s capability', 'members' ), "<code>{$this->cap}</code>" ),
116
+ 'deny' => sprintf( esc_html__( 'Deny %s capability', 'members' ), "<code>{$this->cap}</code>" )
117
+ );
118
+
119
+ // Set up the input `name` attributes.
120
+ $this->json['name'] = array(
121
+ 'grant' => 'grant-caps[]',
122
+ 'deny' => 'deny-caps[]'
123
+ );
124
+
125
+ // Is this a granted or denied cap?
126
+ $this->json['is_granted_cap'] = isset( $this->manager->has_caps[ $this->cap ] ) && $this->manager->has_caps[ $this->cap ];
127
+ $this->json['is_denied_cap'] = isset( $this->manager->has_caps[ $this->cap ] ) && false === $this->manager->has_caps[ $this->cap ];
128
+ }
129
+ }
admin/class-cap-group-factory.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Singleton factory class for storying capability group objects.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Capability group factory class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Cap_Group_Factory {
20
+
21
+ /**
22
+ * Array of group objects.
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ * @var array
27
+ */
28
+ public $groups = array();
29
+
30
+ /**
31
+ * Constructor method.
32
+ *
33
+ * @since 1.0.0
34
+ * @access private
35
+ * @return void
36
+ */
37
+ private function __construct() {}
38
+
39
+ /**
40
+ * Register a new group object
41
+ *
42
+ * @see Members_Cap_Group::__construct()
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @param string $name
46
+ * @param array $args
47
+ * @return void
48
+ */
49
+ public function register_group( $name, $args = array() ) {
50
+
51
+ if ( ! $this->group_exists( $name ) ) {
52
+
53
+ $group = new Members_Cap_Group( $name, $args );
54
+
55
+ $this->groups[ $group->name ] = $group;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Unregisters a group object.
61
+ *
62
+ * @since 1.0.0
63
+ * @access public
64
+ * @param string $name
65
+ * @return void
66
+ */
67
+ public function unregister_group( $name ) {
68
+
69
+ if ( $this->group_exists( $name ) && false === $this->get( $name )->_internal )
70
+ unset( $this->groups[ $name ] );
71
+ }
72
+
73
+ /**
74
+ * Checks if a group exists.
75
+ *
76
+ * @since 1.0.0
77
+ * @access public
78
+ * @param string $name
79
+ * @return bool
80
+ */
81
+ public function group_exists( $name ) {
82
+
83
+ return isset( $this->groups[ $name ] );
84
+ }
85
+
86
+ /**
87
+ * Gets a group object.
88
+ *
89
+ * @since 1.0.0
90
+ * @access public
91
+ * @param string $name
92
+ * @return object|bool
93
+ */
94
+ public function get_group( $name ) {
95
+
96
+ return $this->group_exists( $name ) ? $this->groups[ $name ] : false;
97
+ }
98
+
99
+ /**
100
+ * Returns the instance.
101
+ *
102
+ * @since 1.0.0
103
+ * @access public
104
+ * @return object
105
+ */
106
+ public static function get_instance() {
107
+
108
+ static $instance = null;
109
+
110
+ if ( is_null( $instance ) )
111
+ $instance = new Members_Cap_Group_Factory;
112
+
113
+ return $instance;
114
+ }
115
+ }
admin/class-cap-group.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class for handling a capability group object.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Capability group object class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Cap_Group {
20
+
21
+ /**
22
+ * Stores the properties for the object.
23
+ *
24
+ * @since 1.0.0
25
+ * @access protected
26
+ * @var array
27
+ */
28
+ protected $args = array();
29
+
30
+ /**
31
+ * Magic method for getting object properties.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @param string $property
36
+ * @return mixed
37
+ */
38
+ public function __get( $property ) {
39
+
40
+ return isset( $this->$property ) ? $this->args[ $property ] : null;
41
+ }
42
+
43
+ /**
44
+ * Magic method for setting object properties.
45
+ *
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @param string $property
49
+ * @param mixed $value
50
+ * @return void
51
+ */
52
+ public function __set( $property, $value ) {
53
+
54
+ if ( isset( $this->$property ) )
55
+ $this->args[ $property ] = $value;
56
+ }
57
+
58
+ /**
59
+ * Magic method for checking if a property is set.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @param string $property
64
+ * @return bool
65
+ */
66
+ public function __isset( $property ) {
67
+
68
+ return isset( $this->args[ $property ] );
69
+ }
70
+
71
+ /**
72
+ * Don't allow properties to be unset.
73
+ *
74
+ * @since 3.0.0
75
+ * @access public
76
+ * @param string $property
77
+ * @return void
78
+ */
79
+ public function __unset( $property ) {}
80
+
81
+ /**
82
+ * Magic method to use in case someone tries to output the object as a string.
83
+ * We'll just return the name.
84
+ *
85
+ * @since 1.0.0
86
+ * @access public
87
+ * @return string
88
+ */
89
+ public function __toString() {
90
+ return $this->name;
91
+ }
92
+
93
+ /**
94
+ * Register a new object.
95
+ *
96
+ * @since 1.0.0
97
+ * @access public
98
+ * @param string $name
99
+ * @param array $args {
100
+ * @type string $label Internationalized text label.
101
+ * @type string $icon Dashicon icon in the form of `dashicons-icon-name`.
102
+ * @type array $caps Array of capabilities in the group.
103
+ * @type bool $merge_added Whether to merge this caps into the added caps array.
104
+ * @type bool $diff_added Whether to remove previously-added caps from this group.
105
+ * }
106
+ * @return void
107
+ */
108
+ public function __construct( $name, $args = array() ) {
109
+
110
+ $name = sanitize_key( $name );
111
+
112
+ $defaults = array(
113
+ 'label' => '',
114
+ 'icon' => 'dashicons-admin-generic',
115
+ 'caps' => array( 'read' ),
116
+ 'merge_added' => true,
117
+ 'diff_added' => false,
118
+ );
119
+
120
+ $this->args = wp_parse_args( $args, $defaults );
121
+
122
+ $this->args['name'] = $name;
123
+
124
+ $this->args['caps'] = members_remove_hidden_caps( $this->args['caps'] );
125
+ }
126
+ }
admin/class-cap-section.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Capability section class for use in the edit capabilities tabs.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Cap section class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Cap_Section {
20
+
21
+ /**
22
+ * Stores the cap tabs object.
23
+ *
24
+ * @see Members_Cap_Tabs
25
+ * @since 1.0.0
26
+ * @access public
27
+ * @var object
28
+ */
29
+ public $manager;
30
+
31
+ /**
32
+ * ID of the section.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ * @var string
37
+ */
38
+ public $section = '';
39
+
40
+ /**
41
+ * Dashicons icon for the section.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var string
46
+ */
47
+ public $icon = 'dashicons-admin-generic';
48
+
49
+ /**
50
+ * Label for the section.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var string
55
+ */
56
+ public $label = '';
57
+
58
+ /**
59
+ * Array of data to pass as a json object to the Underscore template.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @var array
64
+ */
65
+ public $json = array();
66
+
67
+ /**
68
+ * Creates a new section object.
69
+ *
70
+ * @since 1.0.0
71
+ * @access public
72
+ * @param object $manager
73
+ * @param string $section
74
+ * @param array $args
75
+ * @return void
76
+ */
77
+ public function __construct( $manager, $section, $args = array() ) {
78
+
79
+ foreach ( array_keys( get_object_vars( $this ) ) as $key ) {
80
+
81
+ if ( isset( $args[ $key ] ) )
82
+ $this->$key = $args[ $key ];
83
+ }
84
+
85
+ $this->manager = $manager;
86
+ $this->section = $section;
87
+ }
88
+
89
+ /**
90
+ * Returns the json array.
91
+ *
92
+ * @since 1.0.0
93
+ * @access public
94
+ * @return array
95
+ */
96
+ public function json() {
97
+ $this->to_json();
98
+ return $this->json;
99
+ }
100
+
101
+ /**
102
+ * Adds custom data to the json array. This data is passed to the Underscore template.
103
+ *
104
+ * @since 1.0.0
105
+ * @access public
106
+ * @return void
107
+ */
108
+ public function to_json() {
109
+
110
+ // Is the role editable?
111
+ $is_editable = $this->manager->role ? members_is_role_editable( $this->manager->role->name ) : true;
112
+
113
+ // Set up the ID and class.
114
+ $this->json['id'] = $this->section;
115
+ $this->json['class'] = 'members-tab-content' . ( $is_editable ? ' editable-role' : '' );
116
+ }
117
+ }
admin/class-cap-tabs.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Edit Capabilities tab section on the edit/new role screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Handles building the edit caps tabs.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Cap_Tabs {
20
+
21
+ /**
22
+ * The role object that we're creating tabs for.
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ * @var object
27
+ */
28
+ public $role;
29
+
30
+ /**
31
+ * Array of caps shown by the cap tabs.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @var array
36
+ */
37
+ public $added_caps = array();
38
+
39
+ /**
40
+ * The caps the role has. Note that if this is a new role (new role screen), the default
41
+ * new role caps will be passed in.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var array
46
+ */
47
+ public $has_caps = array();
48
+
49
+ /**
50
+ * Array of tab sections.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var array
55
+ */
56
+ public $sections = array();
57
+
58
+ /**
59
+ * Array of single cap controls.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @var array
64
+ */
65
+ public $controls = array();
66
+
67
+ /**
68
+ * Array of section json data.
69
+ *
70
+ * @since 1.0.0
71
+ * @access public
72
+ * @var array
73
+ */
74
+ public $sections_json = array();
75
+
76
+ /**
77
+ * Array of control json data.
78
+ *
79
+ * @since 1.0.0
80
+ * @access public
81
+ * @var array
82
+ */
83
+ public $controls_json = array();
84
+
85
+ /**
86
+ * Sets up the cap tabs.
87
+ *
88
+ * @since 1.0.0
89
+ * @access public
90
+ * @param string $role
91
+ * @param array $has_caps
92
+ * @return void
93
+ */
94
+ public function __construct( $role = '', $has_caps = array() ) {
95
+
96
+ // Check if there were explicit caps passed in.
97
+ if ( $has_caps )
98
+ $this->has_caps = $has_caps;
99
+
100
+ // Check if we have a role.
101
+ if ( $role ) {
102
+ $this->role = get_role( $role );
103
+
104
+ // If no explicit caps were passed in, use the role's caps.
105
+ if ( ! $has_caps )
106
+ $this->has_caps = $this->role->capabilities;
107
+ }
108
+
109
+ // Add sections and controls.
110
+ $this->register();
111
+
112
+ // Print custom JS in the footer.
113
+ add_action( 'admin_footer', array( $this, 'localize_scripts' ), 0 );
114
+ add_action( 'admin_footer', array( $this, 'print_templates' ) );
115
+ }
116
+
117
+ /**
118
+ * Registers the sections (and each section's controls) that will be used for
119
+ * the tab content.
120
+ *
121
+ * @since 1.0.0
122
+ * @access public
123
+ * @return void
124
+ */
125
+ public function register() {
126
+
127
+ // Hook before registering.
128
+ do_action( 'members_pre_edit_caps_manager_register' );
129
+
130
+ // Get and loop through the available capability groups.
131
+ foreach ( members_get_cap_groups() as $group ) {
132
+
133
+ $caps = $group->caps;
134
+
135
+ // Remove added caps.
136
+ if ( $group->diff_added )
137
+ $caps = array_diff( $group->caps, $this->added_caps );
138
+
139
+ // Add group's caps to the added caps array.
140
+ if ( $group->merge_added )
141
+ $this->added_caps = array_unique( array_merge( $this->added_caps, $caps ) );
142
+
143
+ // Create a new section.
144
+ $this->sections[] = $section = new Members_Cap_Section( $this, $group->name, array( 'icon' => $group->icon, 'label' => $group->label ) );
145
+
146
+ // Get the section json data.
147
+ $this->sections_json[] = $section->json();
148
+
149
+ // Create new controls for each cap.
150
+ foreach ( $caps as $cap ) {
151
+
152
+ $this->controls[] = $control = new Members_Cap_Control( $this, $cap, array( 'section' => $group->name ) );
153
+
154
+ // Get the control json data.
155
+ $this->controls_json[] = $control->json();
156
+ }
157
+ }
158
+
159
+ // Hook after registering.
160
+ do_action( 'members_edit_caps_manager_register' );
161
+ }
162
+
163
+ /**
164
+ * Displays the cap tabs.
165
+ *
166
+ * @since 1.0.0
167
+ * @access public
168
+ * @return void
169
+ */
170
+ public function display() { ?>
171
+
172
+ <div id="tabcapsdiv" class="postbox">
173
+
174
+ <h3><?php printf( esc_html__( 'Edit Capabilities: %s', 'members' ), '<span class="members-which-tab"></span>' ); ?></h3>
175
+
176
+ <div class="inside">
177
+
178
+ <div class="members-cap-tabs">
179
+ <?php $this->tab_nav(); ?>
180
+ <div class="members-tab-wrap"></div>
181
+ </div><!-- .members-cap-tabs -->
182
+
183
+ </div><!-- .inside -->
184
+
185
+ </div><!-- .postbox -->
186
+ <?php }
187
+
188
+ /**
189
+ * Outputs the tab nav.
190
+ *
191
+ * @since 1.0.0
192
+ * @access public
193
+ * @return void
194
+ */
195
+ public function tab_nav() { ?>
196
+
197
+ <ul class="members-tab-nav">
198
+
199
+ <?php foreach ( $this->sections as $section ) : ?>
200
+
201
+ <?php $icon = preg_match( '/dashicons-/', $section->icon ) ? sprintf( 'dashicons %s', sanitize_html_class( $section->icon ) ) : esc_attr( $section->icon ); ?>
202
+
203
+ <li class="members-tab-title">
204
+ <a href="<?php echo esc_attr( "#members-tab-{$section->section}" ); ?>"><i class="<?php echo $icon; ?>"></i> <span class="label"><?php echo esc_html( $section->label ); ?></span></a>
205
+ </li>
206
+
207
+ <?php endforeach; ?>
208
+
209
+ </ul><!-- .members-tab-nav -->
210
+ <?php }
211
+
212
+ /**
213
+ * Passes our sections and controls data as json to the `edit-role.js` file.
214
+ *
215
+ * @since 1.0.0
216
+ * @access public
217
+ * @return void
218
+ */
219
+ public function localize_scripts() {
220
+
221
+ wp_localize_script( 'members-edit-role', 'members_sections', $this->sections_json );
222
+ wp_localize_script( 'members-edit-role', 'members_controls', $this->controls_json );
223
+ }
224
+
225
+ /**
226
+ * Outputs the Underscore JS templates.
227
+ *
228
+ * @since 1.0.0
229
+ * @access public
230
+ * @return void
231
+ */
232
+ public function print_templates() { ?>
233
+
234
+ <script type="text/html" id="tmpl-members-cap-section">
235
+ <?php members_get_underscore_template( 'cap-section' ); ?>
236
+ </script>
237
+
238
+ <script type="text/html" id="tmpl-members-cap-control">
239
+ <?php members_get_underscore_template( 'cap-control' ); ?>
240
+ </script>
241
+ <?php }
242
+ }
admin/class-manage-roles.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Role management. This is the base class for the Roles and Edit Role screens.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Role management class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Admin_Manage_Roles {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Name of the page we've created.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @var string
36
+ */
37
+ public $page = '';
38
+
39
+ /**
40
+ * The page object to show.
41
+ *
42
+ * @since 1.0.0
43
+ * @access public
44
+ * @var object
45
+ */
46
+ public $page_obj = '';
47
+
48
+ /**
49
+ * Sets up our initial actions.
50
+ *
51
+ * @since 1.0.0
52
+ * @access public
53
+ * @return void
54
+ */
55
+ public function __construct() {
56
+
57
+ // If the role manager is active.
58
+ if ( members_role_manager_enabled() )
59
+ add_action( 'admin_menu', array( $this, 'add_admin_page' ) );
60
+ }
61
+
62
+ /**
63
+ * Adds the roles page to the admin.
64
+ *
65
+ * @since 1.0.0
66
+ * @access public
67
+ * @return void
68
+ */
69
+ public function add_admin_page() {
70
+
71
+ // The "Roles" page should be shown for anyone that has the 'list_roles', 'edit_roles', or
72
+ // 'delete_roles' caps, so we're checking against all three.
73
+ $edit_roles_cap = 'list_roles';
74
+
75
+ // If the current user can 'edit_roles'.
76
+ if ( current_user_can( 'edit_roles' ) )
77
+ $edit_roles_cap = 'edit_roles';
78
+
79
+ // If the current user can 'delete_roles'.
80
+ elseif ( current_user_can( 'delete_roles' ) )
81
+ $edit_roles_cap = 'delete_roles';
82
+
83
+ // Get the page title.
84
+ $title = esc_html__( 'Roles', 'members' );
85
+
86
+ if ( isset( $_GET['action'] ) && 'edit' === $_GET['action'] && isset( $_GET['role'] ) )
87
+ $title = esc_html__( 'Edit Role', 'members' );
88
+
89
+ // Create the Manage Roles page.
90
+ $this->page = add_submenu_page( 'users.php', $title, esc_html__( 'Roles', 'members' ), $edit_roles_cap, 'roles', array( $this, 'page' ) );
91
+
92
+ // Let's roll if we have a page.
93
+ if ( $this->page ) {
94
+
95
+ // If viewing the edit role page.
96
+ if ( isset( $_REQUEST['action'] ) && 'edit' === $_REQUEST['action'] && current_user_can( 'edit_roles' ) )
97
+ $this->page_obj = new Members_Admin_Role_Edit();
98
+
99
+ // If viewing the role list page.
100
+ else
101
+ $this->page_obj = new Members_Admin_Roles();
102
+
103
+ // Load actions.
104
+ add_action( "load-{$this->page}", array( $this, 'load' ) );
105
+
106
+ // Load scripts/styles.
107
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Checks posted data on load and performs actions if needed.
113
+ *
114
+ * @since 1.0.0
115
+ * @access public
116
+ * @return void
117
+ */
118
+ public function load() {
119
+
120
+ if ( method_exists( $this->page_obj, 'load' ) )
121
+ $this->page_obj->load();
122
+ }
123
+
124
+ /**
125
+ * Loads necessary scripts/styles.
126
+ *
127
+ * @since 1.0.0
128
+ * @access public
129
+ * @return void
130
+ */
131
+ public function enqueue() {
132
+
133
+ if ( method_exists( $this->page_obj, 'enqueue' ) )
134
+ $this->page_obj->enqueue();
135
+ }
136
+
137
+ /**
138
+ * Outputs the page.
139
+ *
140
+ * @since 1.0.0
141
+ * @access public
142
+ * @return void
143
+ */
144
+ public function page() {
145
+
146
+ if ( method_exists( $this->page_obj, 'page' ) )
147
+ $this->page_obj->page();
148
+ }
149
+
150
+ /**
151
+ * Returns the instance.
152
+ *
153
+ * @since 1.0.0
154
+ * @access public
155
+ * @return object
156
+ */
157
+ public static function get_instance() {
158
+
159
+ if ( ! self::$instance )
160
+ self::$instance = new self;
161
+
162
+ return self::$instance;
163
+ }
164
+ }
165
+
166
+ Members_Admin_Manage_Roles::get_instance();
admin/class-meta-box-content-permissions.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Content permissions meta box.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class to handle the content permissios meta box and saving the meta.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Meta_Box_Content_Permissions {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Sets up the appropriate actions.
32
+ *
33
+ * @since 1.0.0
34
+ * @access protected
35
+ * @return void
36
+ */
37
+ protected function __construct() {
38
+
39
+ // If content permissions is disabled, bail.
40
+ if ( ! members_content_permissions_enabled() )
41
+ return;
42
+
43
+ add_action( 'load-post.php', array( $this, 'load' ) );
44
+ add_action( 'load-post-new.php', array( $this, 'load' ) );
45
+ }
46
+
47
+ /**
48
+ * Fires on the page load hook to add actions specifically for the post and
49
+ * new post screens.
50
+ *
51
+ * @since 1.0.0
52
+ * @access public
53
+ * @return void
54
+ */
55
+ public function load() {
56
+
57
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
58
+
59
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
60
+
61
+ add_action( 'save_post', array( $this, 'update' ), 10, 2 );
62
+ }
63
+
64
+ /**
65
+ * Enqueues scripts styles.
66
+ *
67
+ * @since 1.0.0
68
+ * @access public
69
+ * @return void
70
+ */
71
+ public function enqueue() {
72
+
73
+ wp_enqueue_style( 'members-admin' );
74
+ }
75
+
76
+ /**
77
+ * Adds the meta box.
78
+ *
79
+ * @since 1.0.0
80
+ * @access public
81
+ * @param string $post_type
82
+ * @return void
83
+ */
84
+ public function add_meta_boxes( $post_type ) {
85
+
86
+ // If the current user can't restrict content, bail.
87
+ if ( ! current_user_can( 'restrict_content' ) )
88
+ return;
89
+
90
+ // Get the post type object.
91
+ $type = get_post_type_object( $post_type );
92
+
93
+ // If this is a public post type, add the meta box.
94
+ // Note that we're disabling for attachments b/c users get confused between "content" and "file".
95
+ if ( 'attachment' !== $type->name && $type->public )
96
+ add_meta_box( 'members-cp', esc_html__( 'Content Permissions', 'members' ), array( $this, 'meta_box' ), $post_type, 'advanced', 'high' );
97
+ }
98
+
99
+ /**
100
+ * Outputs the meta box HTML.
101
+ *
102
+ * @since 1.0.0
103
+ * @access public
104
+ * @param object $post
105
+ * @global object $wp_roles
106
+ * @return void
107
+ */
108
+ public function meta_box( $post ) {
109
+ global $wp_roles;
110
+
111
+ // Get roles and sort.
112
+ $_wp_roles = $wp_roles->role_names;
113
+ asort( $_wp_roles );
114
+
115
+ // Get the roles saved for the post.
116
+ $roles = get_post_meta( $post->ID, '_members_access_role', false );
117
+
118
+ // Convert old post meta to the new system if no roles were found.
119
+ if ( empty( $roles ) )
120
+ $roles = members_convert_old_post_meta( $post->ID );
121
+
122
+ wp_nonce_field( 'members_cp_meta_nonce', 'members_cp_meta' ); ?>
123
+
124
+ <p>
125
+ <?php esc_html_e( "Limit access to this post's content to users of the selected roles.", 'members' ); ?>
126
+ </p>
127
+
128
+ <div class="members-cp-role-list-wrap">
129
+
130
+ <ul class="members-cp-role-list">
131
+
132
+ <?php foreach ( $_wp_roles as $role => $name ) : ?>
133
+ <li>
134
+ <label>
135
+ <input type="checkbox" name="members_access_role[]" <?php checked( is_array( $roles ) && in_array( $role, $roles ) ); ?> value="<?php echo esc_attr( $role ); ?>" />
136
+ <?php echo esc_html( translate_user_role( $name ) ); ?>
137
+ </label>
138
+ </li>
139
+ <?php endforeach; ?>
140
+
141
+ </ul>
142
+ </div>
143
+
144
+ <p class="howto">
145
+ <?php printf( esc_html__( 'If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role.', 'members' ), '<code>restrict_content</code>' ); ?>
146
+ </p>
147
+
148
+ <p>
149
+ <label for="members_access_error"><?php esc_html_e( 'Custom error messsage:', 'members' ); ?></label>
150
+ <textarea class="widefat" id="members_access_error" name="members_access_error" rows="6"><?php echo esc_textarea( get_post_meta( $post->ID, '_members_access_error', true ) ); ?></textarea>
151
+ <span class="howto"><?php _e( 'Message shown to users that do no have permission to view the post.', 'members' ); ?></span>
152
+ </p>
153
+ <?php }
154
+
155
+ /**
156
+ * Saves the post meta.
157
+ *
158
+ * @since 1.0.0
159
+ * @access public
160
+ * @param int $post_id
161
+ * @param object $post
162
+ * @return void
163
+ */
164
+ public function update( $post_id, $post = '' ) {
165
+
166
+ // Fix for attachment save issue in WordPress 3.5.
167
+ // @link http://core.trac.wordpress.org/ticket/21963
168
+ if ( ! is_object( $post ) )
169
+ $post = get_post();
170
+
171
+ // Verify the nonce.
172
+ if ( ! isset( $_POST['members_cp_meta'] ) || ! wp_verify_nonce( $_POST['members_cp_meta'], 'members_cp_meta_nonce' ) )
173
+ return;
174
+
175
+ /* === Roles === */
176
+
177
+ // Get the current roles.
178
+ $current_roles = members_get_post_roles( $post_id );
179
+
180
+ // Get the new roles.
181
+ $new_roles = isset( $_POST['members_access_role'] ) ? $_POST['members_access_role'] : '';
182
+
183
+ // If we have an array of new roles, set the roles.
184
+ if ( is_array( $new_roles ) )
185
+ members_set_post_roles( $post_id, array_map( 'members_sanitize_role', $new_roles ) );
186
+
187
+ // Else, if we have current roles but no new roles, delete them all.
188
+ elseif ( !empty( $current_roles ) )
189
+ members_delete_post_roles( $post_id );
190
+
191
+ /* === Error Message === */
192
+
193
+ // Get the old access message.
194
+ $old_message = members_get_post_access_message( $post_id );
195
+
196
+ // Get the new message.
197
+ $new_message = isset( $_POST['members_access_error'] ) ? stripslashes( wp_filter_post_kses( addslashes( $_POST['members_access_error'] ) ) ) : '';
198
+
199
+ // If we have don't have a new message but do have an old one, delete it.
200
+ if ( '' == $new_message && $old_message )
201
+ members_delete_post_access_message( $post_id );
202
+
203
+ // If the new message doesn't match the old message, set it.
204
+ else if ( $new_message !== $old_message )
205
+ members_set_post_access_message( $post_id, $new_message );
206
+ }
207
+
208
+ /**
209
+ * Returns the instance.
210
+ *
211
+ * @since 1.0.0
212
+ * @access public
213
+ * @return object
214
+ */
215
+ public static function get_instance() {
216
+
217
+ if ( ! self::$instance )
218
+ self::$instance = new self;
219
+
220
+ return self::$instance;
221
+ }
222
+ }
223
+
224
+ Members_Meta_Box_Content_Permissions::get_instance();
admin/class-meta-box-custom-cap.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add new/custom capability meta box.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class to handle the new cap meta box on the edit/new role screen.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Meta_Box_Custom_Cap {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Adds our methods to the proper hooks.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @return void
36
+ */
37
+ protected function __construct() {
38
+
39
+ add_action( 'members_load_role_edit', array( $this, 'load' ) );
40
+ add_action( 'members_load_role_new', array( $this, 'load' ) );
41
+ }
42
+
43
+ /**
44
+ * Runs on the page load hook to hook in the meta boxes.
45
+ *
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @return void
49
+ */
50
+ public function load() {
51
+
52
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
53
+ }
54
+
55
+ /**
56
+ * Adds the meta box.
57
+ *
58
+ * @since 1.0.0
59
+ * @access public
60
+ * @param string $screen_id
61
+ * @param string $role
62
+ * @return void
63
+ */
64
+ public function add_meta_boxes( $screen_id, $role = '' ) {
65
+
66
+ // If role isn't editable, bail.
67
+ if ( $role && ! members_is_role_editable( $role ) )
68
+ return;
69
+
70
+ // Add the meta box.
71
+ add_meta_box( 'newcapdiv', esc_html__( 'Custom Capability', 'members' ), array( $this, 'meta_box' ), $screen_id, 'side', 'core' );
72
+ }
73
+
74
+ /**
75
+ * Outputs the meta box HTML.
76
+ *
77
+ * @since 1.0.0
78
+ * @access public
79
+ * @return void
80
+ */
81
+ public function meta_box() { ?>
82
+
83
+ <p>
84
+ <input type="text" id="members-new-cap-field" class="widefat" />
85
+ </p>
86
+
87
+ <p>
88
+ <button type="button" class="button-secondary" id="members-add-new-cap"><?php esc_html_e( 'Add New', 'members' ); ?></button>
89
+ </p>
90
+ <?php }
91
+
92
+ /**
93
+ * Returns the instance.
94
+ *
95
+ * @since 1.0.0
96
+ * @access public
97
+ * @return object
98
+ */
99
+ public static function get_instance() {
100
+
101
+ if ( ! self::$instance )
102
+ self::$instance = new self;
103
+
104
+ return self::$instance;
105
+ }
106
+ }
107
+
108
+ Members_Meta_Box_Custom_Cap::get_instance();
admin/class-meta-box-publish-role.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Publish/Update role meta box.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class to handle the role meta box edit/new role screen.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Meta_Box_Publish_Role {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Adds our methods to the proper hooks.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @return void
36
+ */
37
+ protected function __construct() {
38
+
39
+ add_action( 'members_load_role_edit', array( $this, 'load' ) );
40
+ add_action( 'members_load_role_new', array( $this, 'load' ) );
41
+ }
42
+
43
+ /**
44
+ * Runs on the page load hook to hook in the meta boxes.
45
+ *
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @return void
49
+ */
50
+ public function load() {
51
+
52
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
53
+ }
54
+
55
+ /**
56
+ * Adds the meta box.
57
+ *
58
+ * @since 1.0.0
59
+ * @access public
60
+ * @param string $screen_id
61
+ * @return void
62
+ */
63
+ public function add_meta_boxes( $screen_id ) {
64
+
65
+ add_meta_box( 'submitdiv', esc_html__( 'Role', 'members' ), array( $this, 'meta_box' ), $screen_id, 'side', 'high' );
66
+ }
67
+
68
+ /**
69
+ * Outputs the meta box HTML.
70
+ *
71
+ * @since 1.0.0
72
+ * @access public
73
+ * @param object $role
74
+ * @return void
75
+ */
76
+ public function meta_box( $role ) {
77
+
78
+ // Set up some defaults for new roles.
79
+ $is_editable = true;
80
+ $user_count = 0;
81
+ $grant_count = 0;
82
+ $deny_count = 0;
83
+
84
+ // If we're editing a role, overwrite the defaults.
85
+ if ( $role ) {
86
+ $is_editable = members_is_role_editable( $role->name );
87
+ $user_count = members_get_role_user_count( $role->name );
88
+ $grant_count = members_get_role_granted_cap_count( $role->name );
89
+ $deny_count = members_get_role_denied_cap_count( $role->name );
90
+ } ?>
91
+
92
+ <div class="submitbox" id="submitpost">
93
+
94
+ <div id="misc-publishing-actions">
95
+
96
+ <div class="misc-pub-section misc-pub-section-users">
97
+ <i class="dashicons dashicons-admin-users"></i>
98
+ <?php esc_html_e( 'Users:', 'members' ); ?>
99
+ <strong class="user-count"><?php echo number_format_i18n( $user_count ); ?></strong>
100
+ </div>
101
+
102
+ <div class="misc-pub-section misc-pub-section-granted">
103
+ <i class="dashicons dashicons-yes"></i>
104
+ <?php esc_html_e( 'Granted:', 'members' ); ?>
105
+ <strong class="granted-count"><?php echo number_format_i18n( $grant_count ); ?></strong>
106
+ </div>
107
+
108
+ <div class="misc-pub-section misc-pub-section-denied">
109
+ <i class="dashicons dashicons-no"></i>
110
+ <?php esc_html_e( 'Denied:', 'members' ); ?>
111
+ <strong class="denied-count"><?php echo number_format_i18n( $deny_count ); ?></strong>
112
+ </div>
113
+
114
+ </div><!-- #misc-publishing-actions -->
115
+
116
+ <div id="major-publishing-actions">
117
+
118
+ <div id="delete-action">
119
+
120
+ <?php if ( $is_editable && $role ) : ?>
121
+ <a class="submitdelete deletion members-delete-role-link" href="<?php echo esc_url( members_get_delete_role_url( $role->name ) ); ?>"><?php echo esc_html_x( 'Delete', 'delete role', 'members' ); ?></a>
122
+ <?php endif; ?>
123
+ </div>
124
+
125
+ <div id="publishing-action">
126
+
127
+ <?php if ( $is_editable ) : ?>
128
+ <?php submit_button( $role ? esc_attr__( 'Update', 'members' ) : esc_attr__( 'Add Role', 'members' ), 'primary', 'publish', false, array( 'id' => 'publish' ) ); ?>
129
+ <?php endif; ?>
130
+
131
+ </div><!-- #publishing-action -->
132
+
133
+ <div class="clear"></div>
134
+
135
+ </div><!-- #major-publishing-actions -->
136
+
137
+ </div><!-- .submitbox -->
138
+ <?php }
139
+
140
+ /**
141
+ * Returns the instance.
142
+ *
143
+ * @since 1.0.0
144
+ * @access public
145
+ * @return object
146
+ */
147
+ public static function get_instance() {
148
+
149
+ if ( ! self::$instance )
150
+ self::$instance = new self;
151
+
152
+ return self::$instance;
153
+ }
154
+ }
155
+
156
+ Members_Meta_Box_Publish_Role::get_instance();
admin/class-role-edit.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles the edit role screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class that displays the edit role screen and handles the form submissions for that page.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Admin_Role_Edit {
20
+
21
+ /**
22
+ * Current role object to be edited/viewed.
23
+ *
24
+ * @since 1.0.0
25
+ * @access protected
26
+ * @var object
27
+ */
28
+ protected $role;
29
+
30
+ /**
31
+ * Current Members role object to be edited/viewed.
32
+ *
33
+ * @since 1.0.0
34
+ * @access protected
35
+ * @var object
36
+ */
37
+ protected $members_role;
38
+
39
+ /**
40
+ * Whether the current role can be edited.
41
+ *
42
+ * @since 1.0.0
43
+ * @access protected
44
+ * @var bool
45
+ */
46
+ protected $is_editable = true;
47
+
48
+ /**
49
+ * Available capabilities.
50
+ *
51
+ * @since 1.0.0
52
+ * @access protected
53
+ * @var array
54
+ */
55
+ protected $capabilities = array();
56
+
57
+ /**
58
+ * Whether the page was updated.
59
+ *
60
+ * @since 1.0.0
61
+ * @access protected
62
+ * @var bool
63
+ */
64
+ protected $role_updated = false;
65
+
66
+ /**
67
+ * Sets up some necessary actions/filters.
68
+ *
69
+ * @since 1.0.0
70
+ * @access public
71
+ * @return void
72
+ */
73
+ public function __construct() {
74
+
75
+ // Add help tabs.
76
+ add_action( 'members_load_role_edit', array( $this, 'add_help_tabs' ) );
77
+ }
78
+
79
+ /**
80
+ * Runs on the `load-{$page}` hook. This is the handler for form submissions.
81
+ *
82
+ * @since 1.0.0
83
+ * @access public
84
+ * @return void
85
+ */
86
+ public function load() {
87
+
88
+ // If the current user can't edit roles, don't proceed.
89
+ if ( ! current_user_can( 'edit_roles' ) )
90
+ wp_die( esc_html__( 'Whoah, partner!', 'members' ) );
91
+
92
+ // Get the current role object to edit.
93
+ $this->role = get_role( members_sanitize_role( $_GET['role'] ) );
94
+
95
+ // If we don't have a real role, die.
96
+ if ( is_null( $this->role ) )
97
+ wp_die( esc_html__( 'The requested role to edit does not exist.', 'members' ) );
98
+
99
+ $this->members_role = members_get_role( $this->role->name );
100
+
101
+ // Get all the capabilities.
102
+ $this->capabilities = members_get_capabilities();
103
+
104
+ // Is the role editable?
105
+ $this->is_editable = members_is_role_editable( $this->role->name );
106
+
107
+ // Check if the form has been submitted.
108
+ if ( $this->is_editable && ( isset( $_POST['grant-caps'] ) || isset( $_POST['deny-caps'] ) || isset( $_POST['grant-new-caps'] ) || isset( $_POST['deny-new-caps'] ) ) ) {
109
+
110
+ $grant_caps = ! empty( $_POST['grant-caps'] ) ? array_unique( $_POST['grant-caps'] ) : array();
111
+ $deny_caps = ! empty( $_POST['deny-caps'] ) ? array_unique( $_POST['deny-caps'] ) : array();
112
+
113
+ $grant_new_caps = ! empty( $_POST['grant-new-caps'] ) ? array_unique( $_POST['grant-new-caps'] ) : array();
114
+ $deny_new_caps = ! empty( $_POST['deny-new-caps'] ) ? array_unique( $_POST['deny-new-caps'] ) : array();
115
+
116
+ // Verify the nonce.
117
+ check_admin_referer( 'edit_role', 'members_edit_role_nonce' );
118
+
119
+ // Set the $role_updated variable to true.
120
+ $this->role_updated = true;
121
+
122
+ // Loop through all available capabilities.
123
+ foreach ( $this->capabilities as $cap ) {
124
+
125
+ // Get the posted capability.
126
+ $grant_this_cap = in_array( $cap, $grant_caps );
127
+ $deny_this_cap = in_array( $cap, $deny_caps );
128
+
129
+ // Does the role have the cap?
130
+ $is_granted_cap = $this->role->has_cap( $cap );
131
+ $is_denied_cap = isset( $this->role->capabilities[ $cap ] ) && false === $this->role->capabilities[ $cap ];
132
+
133
+ if ( $grant_this_cap && ! $is_granted_cap )
134
+ $this->role->add_cap( $cap );
135
+
136
+ else if ( $deny_this_cap && ! $is_denied_cap )
137
+ $this->role->add_cap( $cap, false );
138
+
139
+ else if ( ! $grant_this_cap && $is_granted_cap )
140
+ $this->role->remove_cap( $cap );
141
+
142
+ else if ( ! $deny_this_cap && $is_denied_cap )
143
+ $this->role->remove_cap( $cap );
144
+
145
+ } // End loop through existing capabilities.
146
+
147
+ // Loop through the custom granted caps.
148
+ foreach ( $grant_new_caps as $grant_new_cap ) {
149
+
150
+ $_cap = members_sanitize_cap( $grant_new_cap );
151
+
152
+ // If not an existing cap, add it.
153
+ if ( ! in_array( $_cap, $this->capabilities ) )
154
+ $this->role->add_cap( $_cap );
155
+ }
156
+
157
+ // Loop through the custom denied caps.
158
+ foreach ( $deny_new_caps as $deny_new_cap ) {
159
+
160
+ $_cap = members_sanitize_cap( $deny_new_cap );
161
+
162
+ // If not a granted cap and not an existing cap, add it.
163
+ if ( ! in_array( $_cap, $this->capabilities ) && ! in_array( $_cap, $grant_new_caps ) )
164
+ $this->role->add_cap( $_cap, false );
165
+ }
166
+
167
+ // Add the updated role to the role factory.
168
+ members_role_factory()->add_role( $this->role->name );
169
+
170
+ // Reset the Members role object.
171
+ $this->members_role = members_get_role( $this->role->name );
172
+
173
+ } // End check for form submission.
174
+
175
+ // If successful update.
176
+ if ( $this->role_updated )
177
+ add_settings_error( 'members_edit_role', 'role_updated', sprintf( esc_html__( '%s role updated.', 'members' ), members_get_role_name( $this->role->name ) ), 'updated' );
178
+
179
+ // If the role is not editable.
180
+ if ( ! $this->is_editable )
181
+ add_settings_error( 'members_edit_role', 'role_uneditable', sprintf( esc_html__( 'The %s role is not editable. This means that it is most likely added via another plugin for a special use or that you do not have permission to edit it.', 'members' ), members_get_role_name( $this->role->name ) ) );
182
+
183
+ // If a new role was added (redirect from new role screen).
184
+ if ( isset( $_GET['message'] ) && 'role_added' === $_GET['message'] )
185
+ add_settings_error( 'members_edit_role', 'role_added', sprintf( esc_html__( 'The %s role has been created.', 'members' ), members_get_role_name( $this->role->name ) ), 'updated' );
186
+
187
+ // Load page hook.
188
+ do_action( 'members_load_role_edit' );
189
+
190
+ // Hook for adding in meta boxes.
191
+ do_action( 'add_meta_boxes_' . get_current_screen()->id, $this->role->name );
192
+ do_action( 'add_meta_boxes', get_current_screen()->id, $this->role->name );
193
+
194
+ // Add layout screen option.
195
+ add_screen_option( 'layout_columns', array( 'max' => 2, 'default' => 2 ) );
196
+ }
197
+
198
+ /**
199
+ * Adds help tabs.
200
+ *
201
+ * @since 1.0.0
202
+ * @access public
203
+ * @return void
204
+ */
205
+ public function add_help_tabs() {
206
+
207
+ // Get the current screen.
208
+ $screen = get_current_screen();
209
+
210
+ // Add help tabs.
211
+ $screen->add_help_tab( members_get_edit_role_help_overview_args() );
212
+ $screen->add_help_tab( members_get_edit_role_help_role_name_args() );
213
+ $screen->add_help_tab( members_get_edit_role_help_edit_caps_args() );
214
+ $screen->add_help_tab( members_get_edit_role_help_custom_cap_args() );
215
+
216
+ // Set the help sidebar.
217
+ $screen->set_help_sidebar( members_get_help_sidebar_text() );
218
+ }
219
+
220
+ /**
221
+ * Enqueue scripts/styles.
222
+ *
223
+ * @since 1.0.0
224
+ * @access public
225
+ * @return void
226
+ */
227
+ public function enqueue() {
228
+
229
+ wp_enqueue_style( 'members-admin' );
230
+ wp_enqueue_script( 'members-edit-role' );
231
+ }
232
+
233
+ /**
234
+ * Displays the page content.
235
+ *
236
+ * @since 1.0.0
237
+ * @access public
238
+ * @return void
239
+ */
240
+ public function page() { ?>
241
+
242
+ <div class="wrap">
243
+
244
+ <h1>
245
+ <?php esc_html_e( 'Edit Role', 'members' ); ?>
246
+
247
+ <?php if ( current_user_can( 'create_roles' ) ) : ?>
248
+ <?php printf( '<a class="page-title-action" href="%s">%s</a>', esc_url( members_get_new_role_url() ), esc_html__( 'Add New', 'members' ) ); ?>
249
+ <?php endif; ?>
250
+ </h1>
251
+
252
+ <?php settings_errors( 'members_edit_role' ); ?>
253
+
254
+ <div id="poststuff">
255
+
256
+ <form name="form0" method="post" action="<?php echo esc_url( members_get_edit_role_url( $this->role->name ) ); ?>">
257
+
258
+ <?php wp_nonce_field( 'edit_role', 'members_edit_role_nonce' ); ?>
259
+
260
+ <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? 1 : 2; ?>">
261
+
262
+ <div id="post-body-content">
263
+
264
+ <div id="titlediv" class="members-title-div">
265
+
266
+ <div id="titlewrap">
267
+ <span class="screen-reader-text"><?php esc_html_e( 'Role Name', 'members' ); ?></span>
268
+ <input type="text" disabled="disabled" readonly="readonly" value="<?php echo esc_attr( members_get_role_name( $this->role->name ) ); ?>" />
269
+ </div><!-- #titlewrap -->
270
+
271
+ <div class="inside">
272
+ <div id="edit-slug-box">
273
+ <strong><?php esc_html_e( 'Role:', 'members' ); ?></strong> <?php echo esc_attr( $this->role->name ); ?> <!-- edit box -->
274
+ </div>
275
+ </div><!-- .inside -->
276
+
277
+ </div><!-- .members-title-div -->
278
+
279
+ <?php $cap_tabs = new Members_Cap_Tabs( $this->role->name ); ?>
280
+ <?php $cap_tabs->display(); ?>
281
+
282
+ </div><!-- #post-body-content -->
283
+
284
+ <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
285
+ <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
286
+
287
+ <div id="postbox-container-1" class="postbox-container side">
288
+
289
+ <?php do_meta_boxes( get_current_screen()->id, 'side', $this->role ); ?>
290
+
291
+ </div><!-- .post-box-container -->
292
+
293
+ </div><!-- #post-body -->
294
+ </form>
295
+
296
+ </div><!-- #poststuff -->
297
+
298
+ </div><!-- .wrap -->
299
+ <?php }
300
+ }
admin/class-role-group-factory.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Singleton factory class for storying role group objects.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Roleability group factory class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Role_Group_Factory {
20
+
21
+ /**
22
+ * Array of group objects.
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ * @var array
27
+ */
28
+ public $groups = array();
29
+
30
+ /**
31
+ * Constructor method.
32
+ *
33
+ * @since 1.0.0
34
+ * @access private
35
+ * @return void
36
+ */
37
+ private function __construct() {}
38
+
39
+ /**
40
+ * Register a new group object
41
+ *
42
+ * @see Members_Role_Group::__construct()
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @param string $name
46
+ * @param array $args
47
+ * @return void
48
+ */
49
+ public function register_group( $name, $args = array() ) {
50
+
51
+ if ( ! $this->group_exists( $name ) ) {
52
+
53
+ $group = new Members_Role_Group( $name, $args );
54
+
55
+ $this->groups[ $group->name ] = $group;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Unregisters a group object.
61
+ *
62
+ * @since 1.0.0
63
+ * @access public
64
+ * @param string $name
65
+ * @return void
66
+ */
67
+ public function unregister_group( $name ) {
68
+
69
+ if ( $this->group_exists( $name ) && false === $this->get( $name )->_internal )
70
+ unset( $this->groups[ $name ] );
71
+ }
72
+
73
+ /**
74
+ * Checks if a group exists.
75
+ *
76
+ * @since 1.0.0
77
+ * @access public
78
+ * @param string $name
79
+ * @return bool
80
+ */
81
+ public function group_exists( $name ) {
82
+
83
+ return isset( $this->groups[ $name ] );
84
+ }
85
+
86
+ /**
87
+ * Gets a group object.
88
+ *
89
+ * @since 1.0.0
90
+ * @access public
91
+ * @param string $name
92
+ * @return object|bool
93
+ */
94
+ public function get_group( $name ) {
95
+
96
+ return $this->group_exists( $name ) ? $this->groups[ $name ] : false;
97
+ }
98
+
99
+ /**
100
+ * Returns the instance.
101
+ *
102
+ * @since 1.0.0
103
+ * @access public
104
+ * @return object
105
+ */
106
+ public static function get_instance() {
107
+
108
+ static $instance = null;
109
+
110
+ if ( is_null( $instance ) )
111
+ $instance = new Members_Role_Group_Factory;
112
+
113
+ return $instance;
114
+ }
115
+ }
admin/class-role-group.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class for handling a role group object.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Role group object class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Role_Group {
20
+
21
+ /**
22
+ * Stores the properties for the object.
23
+ *
24
+ * @since 1.0.0
25
+ * @access protected
26
+ * @var array
27
+ */
28
+ protected $args = array();
29
+
30
+ /**
31
+ * Magic method for getting object properties.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @param string $property
36
+ * @return mixed
37
+ */
38
+ public function __get( $property ) {
39
+
40
+ return isset( $this->$property ) ? $this->args[ $property ] : null;
41
+ }
42
+
43
+ /**
44
+ * Magic method for setting object properties.
45
+ *
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @param string $property
49
+ * @param mixed $value
50
+ * @return void
51
+ */
52
+ public function __set( $property, $value ) {
53
+
54
+ if ( isset( $this->$property ) )
55
+ $this->args[ $property ] = $value;
56
+ }
57
+
58
+ /**
59
+ * Magic method for checking if a property is set.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @param string $property
64
+ * @return bool
65
+ */
66
+ public function __isset( $property ) {
67
+
68
+ return isset( $this->args[ $property ] );
69
+ }
70
+
71
+ /**
72
+ * Don't allow properties to be unset.
73
+ *
74
+ * @since 3.0.0
75
+ * @access public
76
+ * @param string $property
77
+ * @return void
78
+ */
79
+ public function __unset( $property ) {}
80
+
81
+ /**
82
+ * Magic method to use in case someone tries to output the object as a string.
83
+ * We'll just return the name.
84
+ *
85
+ * @since 1.0.0
86
+ * @access public
87
+ * @return string
88
+ */
89
+ public function __toString() {
90
+ return $this->name;
91
+ }
92
+
93
+ /**
94
+ * Register a new object.
95
+ *
96
+ * @since 1.0.0
97
+ * @access public
98
+ * @param string $name
99
+ * @param array $args {
100
+ * @type string $label Internationalized text label.
101
+ * @type string $icon Count label in admin.
102
+ * @type array $roles Array of roles in the group.
103
+ * }
104
+ * @return void
105
+ */
106
+ public function __construct( $name, $args = array() ) {
107
+
108
+ $name = sanitize_key( $name );
109
+
110
+ $defaults = array(
111
+ 'label' => '',
112
+ 'label_count' => '',
113
+ 'roles' => array(),
114
+ 'show_in_view_list' => true
115
+ );
116
+
117
+ $this->args = wp_parse_args( $args, $defaults );
118
+
119
+ // Get the roles that exist.
120
+ $existing_roles = array_keys( members_get_role_names() );
121
+
122
+ // Remove roles that don't exist.
123
+ if ( $this->args['roles'] )
124
+ $this->args['roles'] = array_intersect( $existing_roles, $this->args['roles'] );
125
+
126
+ // Set the name.
127
+ $this->args['name'] = $name;
128
+ }
129
+ }
admin/class-role-list-table.php ADDED
@@ -0,0 +1,451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles the roles table on the Roles admin screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Role list table for the roles management page in the admin. Extends the core `WP_List_Table`
15
+ * class in the admin.
16
+ *
17
+ * @since 1.0.0
18
+ * @access public
19
+ */
20
+ class Members_Role_List_Table extends WP_List_Table {
21
+
22
+ /**
23
+ * The current view.
24
+ *
25
+ * @since 1.0.0
26
+ * @access public
27
+ * @var string
28
+ */
29
+ public $role_view = 'all';
30
+
31
+ /**
32
+ * Allowed role views.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ * @var array
37
+ */
38
+ public $allowed_role_views = array();
39
+
40
+ /**
41
+ * The default role. This will be assigned the value of `get_option( 'default_role' )`.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var string
46
+ */
47
+ public $default_role = 'subscriber';
48
+
49
+ /**
50
+ * The current user object.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var object
55
+ */
56
+ public $current_user = '';
57
+
58
+ /**
59
+ * Sets up the list table.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @return void
64
+ */
65
+ public function __construct() {
66
+
67
+ $args = array(
68
+ 'plural' => 'roles',
69
+ 'singular' => 'role',
70
+ );
71
+
72
+ parent::__construct( $args );
73
+
74
+ // Get the current user object.
75
+ $this->current_user = new WP_User( get_current_user_id() );
76
+
77
+ // Get the defined default role.
78
+ $this->default_role = get_option( 'default_role', $this->default_role );
79
+
80
+ // Get the role views.
81
+ $this->allowed_role_views = array_keys( $this->get_views() );
82
+
83
+ // Get the current view.
84
+ if ( isset( $_GET['role_view'] ) && in_array( $_GET['role_view'], $this->allowed_role_views ) )
85
+ $this->role_view = $_GET['role_view'];
86
+ }
87
+
88
+ /**
89
+ * Sets up the items (roles) to list.
90
+ *
91
+ * @since 1.0.0
92
+ * @access public
93
+ * @return void
94
+ */
95
+ public function prepare_items() {
96
+
97
+ // Get the roles for the default/All view.
98
+ if ( 'all' === $this->role_view ) {
99
+
100
+ $roles = members_get_role_slugs();
101
+
102
+ // If a custom view, get the roles.
103
+ } else {
104
+ // Get the current group being viewed.
105
+ $group = members_get_role_group( $this->role_view );
106
+
107
+ // Set the roles array.
108
+ $roles = $group ? $group->roles : array();
109
+ }
110
+
111
+ // Allow devs to filter the items.
112
+ $roles = apply_filters( 'members_manage_roles_items', $roles, $this->role_view );
113
+
114
+ // Sort the roles if given something to sort by.
115
+ if ( isset( $_GET['orderby'] ) && isset( $_GET['order'] ) ) {
116
+
117
+ // Sort by title/role name, descending.
118
+ if ( 'title' === $_GET['orderby'] && 'desc' === $_GET['order'] )
119
+ arsort( $roles );
120
+
121
+ // Sort by role, ascending.
122
+ elseif ( 'role' === $_GET['orderby'] && 'asc' === $_GET['order'] )
123
+ ksort( $roles );
124
+
125
+ // Sort by role, descending.
126
+ elseif ( 'role' === $_GET['orderby'] && 'desc' === $_GET['order'] )
127
+ krsort( $roles );
128
+
129
+ // Sort by title/role name, ascending.
130
+ else
131
+ asort( $roles );
132
+
133
+ // Sort by title/role name, ascending.
134
+ } else {
135
+ asort( $roles );
136
+ }
137
+
138
+ // Get the per page option name.
139
+ $option = $this->screen->get_option( 'per_page', 'option' );
140
+
141
+ if ( ! $option )
142
+ $option = str_replace( '-', '_', "{$this->screen->id}_per_page" );
143
+
144
+ // Get the number of roles to show per page.
145
+ $per_page = (int) get_user_option( $option );
146
+
147
+ if ( ! $per_page || $per_page < 1 ) {
148
+
149
+ $per_page = $this->screen->get_option( 'per_page', 'default' );
150
+
151
+ if ( ! $per_page )
152
+ $per_page = 20;
153
+ }
154
+
155
+ // Set up some current page variables.
156
+ $current_page = $this->get_pagenum();
157
+ $items = $roles;
158
+ $total_count = count( $items );
159
+
160
+ // Set the current page items.
161
+ $this->items = array_slice( $items, ( $current_page - 1 ) * $per_page, $per_page );
162
+
163
+ // Set the pagination arguments.
164
+ $this->set_pagination_args( array( 'total_items' => $total_count, 'per_page' => $per_page ) );
165
+ }
166
+
167
+ /**
168
+ * Returns an array of columns to show.
169
+ *
170
+ * @see members_manage_roles_columns()
171
+ * @since 1.0.0
172
+ * @access public
173
+ * @return array
174
+ */
175
+ public function get_columns() {
176
+ return get_column_headers( $this->screen );
177
+ }
178
+
179
+ /**
180
+ * The checkbox column callback.
181
+ *
182
+ * @since 1.0.0
183
+ * @access protected
184
+ * @param string $role
185
+ * @return string
186
+ */
187
+ protected function column_cb( $role ) {
188
+
189
+ if ( $role == get_option( 'default_role' ) || in_array( $role, $this->current_user->roles ) || ! members_is_role_editable( $role ) )
190
+ $out = '';
191
+
192
+ else
193
+ $out = sprintf( '<input type="checkbox" name="roles[%1$s]" value="%1$s" />', esc_attr( $role ) );
194
+
195
+ return apply_filters( 'members_manage_roles_column_cb', $out, $role );
196
+ }
197
+
198
+ /**
199
+ * The role name column callback.
200
+ *
201
+ * @since 1.0.0
202
+ * @access protected
203
+ * @param string $role
204
+ * @return string
205
+ */
206
+ protected function column_title( $role ) {
207
+
208
+ $states = array();
209
+ $role_states = '';
210
+
211
+ // If the role is the default role.
212
+ if ( $role == get_option( 'default_role' ) )
213
+ $states[] = esc_html__( 'Default Role', 'members' );
214
+
215
+ // If the current user has this role.
216
+ if ( members_current_user_has_role( $role ) )
217
+ $states[] = esc_html__( 'Your Role', 'members' );
218
+
219
+ // Allow devs to filter the role states.
220
+ $states = apply_filters( 'members_role_states', $states, $role );
221
+
222
+ // If we have states, string them together.
223
+ if ( ! empty( $states ) ) {
224
+
225
+ foreach ( $states as $state )
226
+ $role_states .= sprintf( '<span class="role-state">%s</span>', $state );
227
+
228
+ $role_states = ' &ndash; ' . $role_states;
229
+ }
230
+
231
+ // Add the title and role states.
232
+ $title = sprintf( '<strong><a class="row-title" href="%s">%s</a>%s</strong>', esc_url( members_get_edit_role_url( $role ) ), esc_html( members_get_role_name( $role ) ), $role_states );
233
+
234
+ return apply_filters( 'members_manage_roles_column_role_name', $title, $role );
235
+ }
236
+
237
+ /**
238
+ * The role column callback.
239
+ *
240
+ * @since 1.0.0
241
+ * @access protected
242
+ * @param string $role
243
+ * @return string
244
+ */
245
+ protected function column_role( $role ) {
246
+ return apply_filters( 'members_manage_roles_column_role', members_sanitize_role( $role ), $role );
247
+ }
248
+
249
+ /**
250
+ * The users column callback.
251
+ *
252
+ * @since 1.0.0
253
+ * @access protected
254
+ * @param string $role
255
+ * @return string
256
+ */
257
+ protected function column_users( $role ) {
258
+ return apply_filters( 'members_manage_roles_column_users', members_get_role_user_count( $role ), $role );
259
+ }
260
+
261
+ /**
262
+ * The caps column callback.
263
+ *
264
+ * @since 1.0.0
265
+ * @access protected
266
+ * @param string $role
267
+ * @return string
268
+ */
269
+ protected function column_granted_caps( $role ) {
270
+ return apply_filters( 'members_manage_roles_column_granted_caps', members_get_role_granted_cap_count( $role ), $role );
271
+ }
272
+
273
+ /**
274
+ * The caps column callback.
275
+ *
276
+ * @since 1.0.0
277
+ * @access protected
278
+ * @param string $role
279
+ * @return string
280
+ */
281
+ protected function column_denied_caps( $role ) {
282
+ return apply_filters( 'members_manage_roles_column_denied_caps', members_get_role_denied_cap_count( $role ), $role );
283
+ }
284
+
285
+ /**
286
+ * Returns the name of the primary column.
287
+ *
288
+ * @since 1.0.0
289
+ * @access protected
290
+ * @return string
291
+ */
292
+ protected function get_default_primary_column_name() {
293
+ return 'title';
294
+ }
295
+
296
+ /**
297
+ * Handles the row actions.
298
+ *
299
+ * @since 1.0.0
300
+ * @access protected
301
+ * @param string $role
302
+ * @param string $column_name
303
+ * @param string $primary
304
+ * @return array
305
+ */
306
+ protected function handle_row_actions( $role, $column_name, $primary ) {
307
+
308
+ $actions = array();
309
+
310
+ // Only add row actions on the primary column (title/role name).
311
+ if ( $primary === $column_name ) {
312
+
313
+ // If the role can be edited.
314
+ if ( members_is_role_editable( $role ) ) {
315
+
316
+ // If the current user can edit the role, add an edit link.
317
+ if ( current_user_can( 'edit_roles' ) )
318
+ $actions['edit'] = sprintf( '<a href="%s">%s</a>', esc_url( members_get_edit_role_url( $role ) ), esc_html__( 'Edit', 'members' ) );
319
+
320
+ // If the current user can delete the role, add a delete link.
321
+ if ( ( is_multisite() && is_super_admin() && $role !== $this->default_role ) || ( current_user_can( 'delete_roles' ) && $role !== $this->default_role && ! current_user_can( $role ) ) )
322
+ $actions['delete'] = sprintf( '<a class="members-delete-role-link" href="%s">%s</a>', esc_url( members_get_delete_role_url( $role ) ), esc_html__( 'Delete', 'members' ) );
323
+
324
+ // If the role cannot be edited.
325
+ } else {
326
+
327
+ // Add the view role link.
328
+ $actions['view'] = sprintf( '<a href="%s">%s</a>', esc_url( members_get_edit_role_url( $role ) ), esc_html__( 'View', 'members' ) );
329
+ }
330
+
331
+ // If the current user can create roles, add the clone role link.
332
+ if ( current_user_can( 'create_roles' ) )
333
+ $actions['clone'] = sprintf( '<a href="%s">%s</a>', esc_url( members_get_clone_role_url( $role ) ), esc_html__( 'Clone', 'members' ) );
334
+
335
+ // If this is the default role and the current user can manage options, add a default role change link.
336
+ if ( current_user_can( 'manage_options' ) && $role === $this->default_role )
337
+ $actions['default_role'] = sprintf( '<a href="%s">%s</a>', esc_url( admin_url( 'options-general.php#default_role' ) ), esc_html__( 'Change Default', 'members' ) );
338
+
339
+ // If the currrent user can view users, add a users link.
340
+ if ( current_user_can( 'list_users' ) )
341
+ $actions['users'] = sprintf( '<a href="%s">%s</a>', members_get_role_users_url( $role ), esc_html__( 'Users', 'members' ) );
342
+
343
+ // Allow devs to filter the row actions.
344
+ $actions = apply_filters( 'members_roles_row_actions', $actions, $role );
345
+ }
346
+
347
+ return $this->row_actions( $actions );
348
+ }
349
+
350
+ /**
351
+ * Returns an array of sortable columns.
352
+ *
353
+ * @since 1.0.0
354
+ * @access protected
355
+ * @return array
356
+ */
357
+ protected function get_sortable_columns() {
358
+
359
+ return array(
360
+ 'title' => array( 'title', true ),
361
+ 'role' => array( 'role', false ),
362
+ );
363
+ }
364
+
365
+ /**
366
+ * Returns an array of views for the list table.
367
+ *
368
+ * @since 1.0.0
369
+ * @access protected
370
+ * @return array
371
+ */
372
+ protected function get_views() {
373
+
374
+ $active = members_get_role_group( 'active' );
375
+ $inactive = members_get_role_group( 'inactive' );
376
+
377
+ if ( $active )
378
+ $active->roles = members_get_active_role_slugs();
379
+
380
+ if ( $inactive )
381
+ $inactive->roles = members_get_inactive_role_slugs();
382
+
383
+ $views = array();
384
+ $current = ' class="current"';
385
+ $all_count = count( members_get_role_slugs() );
386
+
387
+ // Add the default/all view.
388
+ $views['all'] = sprintf(
389
+ '<a%s href="%s">%s</a>',
390
+ 'all' === $this->role_view ? $current : '',
391
+ esc_url( members_get_edit_roles_url() ),
392
+ sprintf( _n( 'All %s', 'All %s', $all_count, 'members' ), sprintf( '<span class="count">(%s)</span>', number_format_i18n( $all_count ) ) )
393
+ );
394
+
395
+ // Loop through the role groups and put them into the view list.
396
+ foreach ( members_get_role_groups() as $group ) {
397
+
398
+ // Skip role groups that shouldn't be shown in the view list.
399
+ if ( ! $group->show_in_view_list )
400
+ continue;
401
+
402
+ $count = count( $group->roles );
403
+
404
+ // Skip any views with 0 roles.
405
+ if ( 0 >= $count )
406
+ continue;
407
+
408
+ $noop = $group->label_count;
409
+
410
+ // Add the view link.
411
+ $views[ $group->name ] = sprintf(
412
+ '<a%s href="%s">%s</a>',
413
+ $group->name === $this->role_view ? $current : '',
414
+ 'all' === $group->name ? esc_url( members_get_edit_roles_url() ) : esc_url( members_get_role_view_url( $group->name ) ),
415
+ sprintf( translate_nooped_plural( $noop, $count, $noop['domain'] ), sprintf( '<span class="count">(%s)</span>', number_format_i18n( $count ) ) )
416
+ );
417
+ }
418
+
419
+ return apply_filters( 'members_manage_roles_views', $views, $this->role_view, members_get_edit_roles_url() );
420
+ }
421
+
422
+ /**
423
+ * Displays the list table.
424
+ *
425
+ * @since 1.0.0
426
+ * @access public
427
+ * @return void
428
+ */
429
+ public function display() {
430
+
431
+ $this->views();
432
+
433
+ parent::display();
434
+ }
435
+
436
+ /**
437
+ * Returns an array of bulk actions available.
438
+ *
439
+ * @since 1.0.0
440
+ * @access protected
441
+ * @return array
442
+ */
443
+ protected function get_bulk_actions() {
444
+ $actions = array();
445
+
446
+ if ( current_user_can( 'delete_roles' ) )
447
+ $actions['delete'] = esc_html__( 'Delete', 'members' );
448
+
449
+ return apply_filters( 'members_manage_roles_bulk_actions', $actions );
450
+ }
451
+ }
admin/class-role-new.php ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles the new role screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class that displays the new role screen and handles the form submissions for that page.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Admin_Role_New {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Name of the page we've created.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @var string
36
+ */
37
+ public $page = '';
38
+
39
+ /**
40
+ * Role that's being created.
41
+ *
42
+ * @since 1.0.0
43
+ * @access public
44
+ * @var string
45
+ */
46
+ public $role = '';
47
+
48
+ /**
49
+ * Name of the role that's being created.
50
+ *
51
+ * @since 1.0.0
52
+ * @access public
53
+ * @var string
54
+ */
55
+ public $role_name = '';
56
+
57
+ /**
58
+ * Array of the role's capabilities.
59
+ *
60
+ * @since 1.0.0
61
+ * @access public
62
+ * @var array
63
+ */
64
+ public $capabilities = array();
65
+
66
+ /**
67
+ * Conditional to see if we're cloning a role.
68
+ *
69
+ * @since 1.0.0
70
+ * @access public
71
+ * @var bool
72
+ */
73
+ public $is_clone = false;
74
+
75
+ /**
76
+ * Role that is being cloned.
77
+ *
78
+ * @since 1.0.0
79
+ * @access public
80
+ * @var string
81
+ */
82
+ public $clone_role = '';
83
+
84
+ /**
85
+ * Sets up our initial actions.
86
+ *
87
+ * @since 1.0.0
88
+ * @access public
89
+ * @return void
90
+ */
91
+ public function __construct() {
92
+
93
+ // If the role manager is active.
94
+ if ( members_role_manager_enabled() )
95
+ add_action( 'admin_menu', array( $this, 'add_admin_page' ) );
96
+ }
97
+
98
+ /**
99
+ * Adds the roles page to the admin.
100
+ *
101
+ * @since 1.0.0
102
+ * @access public
103
+ * @return void
104
+ */
105
+ public function add_admin_page() {
106
+
107
+ $this->page = add_submenu_page( 'users.php', esc_html__( 'Add New Role', 'members' ), esc_html__( 'Add New Role', 'members' ), 'create_roles', 'role-new', array( $this, 'page' ) );
108
+
109
+ // Let's roll if we have a page.
110
+ if ( $this->page ) {
111
+
112
+ add_action( "load-{$this->page}", array( $this, 'load' ) );
113
+ add_action( "load-{$this->page}", array( $this, 'add_help_tabs' ) );
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Checks posted data on load and performs actions if needed.
119
+ *
120
+ * @since 1.0.0
121
+ * @access public
122
+ * @return void
123
+ */
124
+ public function load() {
125
+
126
+ // Are we cloning a role?
127
+ $this->is_clone = isset( $_GET['clone'] ) && members_role_exists( $_GET['clone'] );
128
+
129
+ if ( $this->is_clone ) {
130
+
131
+ // Override the default new role caps.
132
+ add_filter( 'members_new_role_default_caps', array( $this, 'clone_default_caps' ), 15 );
133
+
134
+ // Set the clone role.
135
+ $this->clone_role = members_sanitize_role( $_GET['clone'] );
136
+ }
137
+
138
+ // Check if the current user can create roles and the form has been submitted.
139
+ if ( current_user_can( 'create_roles' ) && ( isset( $_POST['role_name'] ) || isset( $_POST['role'] ) || isset( $_POST['grant-caps'] ) || isset( $_POST['deny-caps'] ) || isset( $_POST['grant-new-caps'] ) || isset( $_POST['deny-new-caps'] ) ) ) {
140
+
141
+ // Verify the nonce.
142
+ check_admin_referer( 'new_role', 'members_new_role_nonce' );
143
+
144
+ // Set up some variables.
145
+ $this->capabilities = array();
146
+ $new_caps = array();
147
+ $is_duplicate = false;
148
+
149
+ // Check if any capabilities were selected.
150
+ if ( isset( $_POST['grant-caps'] ) || isset( $_POST['deny-caps'] ) ) {
151
+
152
+ $grant_caps = ! empty( $_POST['grant-caps'] ) ? array_unique( $_POST['grant-caps'] ) : array();
153
+ $deny_caps = ! empty( $_POST['deny-caps'] ) ? array_unique( $_POST['deny-caps'] ) : array();
154
+
155
+ foreach ( members_get_capabilities() as $cap ) {
156
+
157
+ if ( in_array( $cap, $grant_caps ) )
158
+ $new_caps[ $cap ] = true;
159
+
160
+ else if ( in_array( $cap, $deny_caps ) )
161
+ $new_caps[ $cap ] = false;
162
+ }
163
+ }
164
+
165
+ $grant_new_caps = ! empty( $_POST['grant-new-caps'] ) ? array_unique( $_POST['grant-new-caps'] ) : array();
166
+ $deny_new_caps = ! empty( $_POST['deny-new-caps'] ) ? array_unique( $_POST['deny-new-caps'] ) : array();
167
+
168
+ $_m_caps = members_get_capabilities();
169
+
170
+ foreach ( $grant_new_caps as $grant_new_cap ) {
171
+
172
+ $_cap = members_sanitize_cap( $grant_new_cap );
173
+
174
+ if ( ! in_array( $_cap, $_m_caps ) )
175
+ $new_caps[ $_cap ] = true;
176
+ }
177
+
178
+ foreach ( $deny_new_caps as $deny_new_cap ) {
179
+
180
+ $_cap = members_sanitize_cap( $deny_new_cap );
181
+
182
+ if ( ! in_array( $_cap, $_m_caps ) )
183
+ $new_caps[ $_cap ] = false;
184
+ }
185
+
186
+ // Sanitize the new role name/label. We just want to strip any tags here.
187
+ if ( ! empty( $_POST['role_name'] ) )
188
+ $this->role_name = strip_tags( $_POST['role_name'] );
189
+
190
+ // Sanitize the new role, removing any unwanted characters.
191
+ if ( ! empty( $_POST['role'] ) )
192
+ $this->role = members_sanitize_role( $_POST['role'] );
193
+
194
+ else if ( $this->role_name )
195
+ $this->role = members_sanitize_role( $this->role_name );
196
+
197
+ // Is duplicate?
198
+ if ( members_role_exists( $this->role ) )
199
+ $is_duplicate = true;
200
+
201
+ // Add a new role with the data input.
202
+ if ( $this->role && $this->role_name && ! $is_duplicate ) {
203
+
204
+ add_role( $this->role, $this->role_name, $new_caps );
205
+
206
+ // If the current user can edit roles, redirect to edit role screen.
207
+ if ( current_user_can( 'edit_roles' ) ) {
208
+ wp_redirect( add_query_arg( 'message', 'role_added', members_get_edit_role_url( $this->role ) ) );
209
+ exit;
210
+ }
211
+
212
+ // Add role added message.
213
+ add_settings_error( 'members_role_new', 'role_added', sprintf( esc_html__( 'The %s role has been created.', 'members' ), $this->role_name ), 'updated' );
214
+ }
215
+
216
+ // If there are new caps, let's assign them.
217
+ if ( ! empty( $new_caps ) )
218
+ $this->capabilities = $new_caps;
219
+
220
+ // Add error if there's no role.
221
+ if ( ! $this->role )
222
+ add_settings_error( 'members_role_new', 'no_role', esc_html__( 'You must enter a valid role.', 'members' ) );
223
+
224
+ // Add error if this is a duplicate role.
225
+ if ( $is_duplicate )
226
+ add_settings_error( 'members_role_new', 'duplicate_role', sprintf( esc_html__( 'The %s role already exists.', 'members' ), $this->role ) );
227
+
228
+ // Add error if there's no role name.
229
+ if ( ! $this->role_name )
230
+ add_settings_error( 'members_role_new', 'no_role_name', esc_html__( 'You must enter a valid role name.', 'members' ) );
231
+ }
232
+
233
+ // If we don't have caps yet, get the new role default caps.
234
+ if ( empty( $this->capabilities ) )
235
+ $this->capabilities = members_new_role_default_caps();
236
+
237
+ // Load page hook.
238
+ do_action( 'members_load_role_new' );
239
+
240
+ // Hook for adding in meta boxes.
241
+ do_action( 'add_meta_boxes_' . get_current_screen()->id, '' );
242
+ do_action( 'add_meta_boxes', get_current_screen()->id, '' );
243
+
244
+ // Add layout screen option.
245
+ add_screen_option( 'layout_columns', array( 'max' => 2, 'default' => 2 ) );
246
+
247
+ // Load scripts/styles.
248
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
249
+ }
250
+
251
+ /**
252
+ * Adds help tabs.
253
+ *
254
+ * @since 1.0.0
255
+ * @access public
256
+ * @return void
257
+ */
258
+ public function add_help_tabs() {
259
+
260
+ // Get the current screen.
261
+ $screen = get_current_screen();
262
+
263
+ // Add help tabs.
264
+ $screen->add_help_tab( members_get_edit_role_help_overview_args() );
265
+ $screen->add_help_tab( members_get_edit_role_help_role_name_args() );
266
+ $screen->add_help_tab( members_get_edit_role_help_edit_caps_args() );
267
+ $screen->add_help_tab( members_get_edit_role_help_custom_cap_args() );
268
+
269
+ // Set the help sidebar.
270
+ $screen->set_help_sidebar( members_get_help_sidebar_text() );
271
+ }
272
+
273
+ /**
274
+ * Enqueue scripts/styles.
275
+ *
276
+ * @since 1.0.0
277
+ * @access public
278
+ * @return void
279
+ */
280
+ public function enqueue() {
281
+
282
+ wp_enqueue_style( 'members-admin' );
283
+ wp_enqueue_script( 'members-edit-role' );
284
+ }
285
+
286
+ /**
287
+ * Outputs the page.
288
+ *
289
+ * @since 1.0.0
290
+ * @access public
291
+ * @return void
292
+ */
293
+ public function page() { ?>
294
+
295
+ <div class="wrap">
296
+
297
+ <h1><?php ! $this->is_clone ? esc_html_e( 'Add New Role', 'members' ) : esc_html_e( 'Clone Role', 'members' ); ?></h1>
298
+
299
+ <?php settings_errors( 'members_role_new' ); ?>
300
+
301
+ <div id="poststuff">
302
+
303
+ <form name="form0" method="post" action="<?php echo esc_url( members_get_new_role_url() ); ?>">
304
+
305
+ <?php wp_nonce_field( 'new_role', 'members_new_role_nonce' ); ?>
306
+
307
+ <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? 1 : 2; ?>">
308
+
309
+ <div id="post-body-content">
310
+
311
+ <div id="titlediv" class="members-title-div">
312
+
313
+ <div id="titlewrap">
314
+ <span class="screen-reader-text"><?php esc_html_e( 'Role Name', 'members' ); ?></span>
315
+ <input type="text" name="role_name" value="<?php echo ! $this->role && $this->clone_role ? esc_attr( sprintf( __( '%s Clone', 'members' ), members_get_role_name( $this->clone_role ) ) ) : esc_attr( $this->role_name ); ?>" placeholder="<?php esc_attr_e( 'Enter role name', 'members' ); ?>" />
316
+ </div><!-- #titlewrap -->
317
+
318
+ <div class="inside">
319
+ <div id="edit-slug-box">
320
+ <strong><?php esc_html_e( 'Role:', 'members' ); ?></strong> <span class="role-slug"><?php echo ! $this->role && $this->clone_role ? esc_attr( "{$this->clone_role}_clone" ) : esc_attr( $this->role ); ?></span> <!-- edit box -->
321
+ <input type="text" name="role" value="<?php echo members_sanitize_role( $this->role ); ?>" />
322
+ <button type="button" class="role-edit-button button button-small closed"><?php esc_html_e( 'Edit', 'members' ); ?></button>
323
+ </div>
324
+ </div><!-- .inside -->
325
+
326
+ </div><!-- .members-title-div -->
327
+
328
+ <?php $cap_tabs = new Members_Cap_Tabs( '', $this->capabilities ); ?>
329
+ <?php $cap_tabs->display(); ?>
330
+
331
+ </div><!-- #post-body-content -->
332
+
333
+ <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
334
+ <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
335
+
336
+ <div id="postbox-container-1" class="postbox-container side">
337
+
338
+ <?php do_meta_boxes( get_current_screen()->id, 'side', '' ); ?>
339
+
340
+ </div><!-- .post-box-container -->
341
+
342
+ </div><!-- #post-body -->
343
+ </form>
344
+
345
+ </div><!-- #poststuff -->
346
+
347
+ </div><!-- .wrap -->
348
+
349
+ <?php }
350
+
351
+ /**
352
+ * Filters the new role default caps in the case that we're cloning a role.
353
+ *
354
+ * @since 1.0.0
355
+ * @access public
356
+ * @param array $capabilities
357
+ * @param array
358
+ */
359
+ public function clone_default_caps( $capabilities ) {
360
+
361
+ if ( $this->is_clone ) {
362
+
363
+ $role = get_role( $this->clone_role );
364
+
365
+ if ( $role && isset( $role->capabilities ) && is_array( $role->capabilities ) )
366
+ $capabilities = $role->capabilities;
367
+ }
368
+
369
+ return $capabilities;
370
+ }
371
+
372
+ /**
373
+ * Returns the instance.
374
+ *
375
+ * @since 1.0.0
376
+ * @access public
377
+ * @return object
378
+ */
379
+ public static function get_instance() {
380
+
381
+ if ( ! self::$instance )
382
+ self::$instance = new self;
383
+
384
+ return self::$instance;
385
+ }
386
+ }
387
+
388
+ Members_Admin_Role_New::get_instance();
admin/class-roles.php ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Roles admin screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Class that displays the roles admin screen and handles requests for that page.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Admin_Roles {
20
+
21
+ /**
22
+ * Sets up some necessary actions/filters.
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ * @return void
27
+ */
28
+ public function __construct() {
29
+
30
+ // Set up some page options for the current screen.
31
+ add_action( 'current_screen', array( $this, 'current_screen' ) );
32
+
33
+ // Set up the role list table columns.
34
+ add_filter( 'manage_users_page_roles_columns', array( $this, 'manage_roles_columns' ), 5 );
35
+
36
+ // Add help tabs.
37
+ add_action( 'members_load_manage_roles', array( $this, 'add_help_tabs' ) );
38
+ }
39
+
40
+ /**
41
+ * Modifies the current screen object.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @return void
46
+ */
47
+ public function current_screen( $screen ) {
48
+
49
+ if ( 'users_page_roles' === $screen->id )
50
+ $screen->add_option( 'per_page', array( 'default' => 20 ) );
51
+ }
52
+
53
+ /**
54
+ * Sets up the roles column headers.
55
+ *
56
+ * @since 1.0.0
57
+ * @access public
58
+ * @param array $columns
59
+ * @return array
60
+ */
61
+ public function manage_roles_columns( $columns ) {
62
+
63
+ $columns = array(
64
+ 'cb' => '<input type="checkbox" />',
65
+ 'title' => esc_html__( 'Role Name', 'members' ),
66
+ 'role' => esc_html__( 'Role', 'members' ),
67
+ 'users' => esc_html__( 'Users', 'members' ),
68
+ 'granted_caps' => esc_html__( 'Granted', 'members' ),
69
+ 'denied_caps' => esc_html__( 'Denied', 'members' )
70
+ );
71
+
72
+ return apply_filters( 'members_manage_roles_columns', $columns );
73
+ }
74
+
75
+ /**
76
+ * Runs on the `load-{$page}` hook. This is the handler for form submissions and requests.
77
+ *
78
+ * @since 1.0.0
79
+ * @access public
80
+ * @return void
81
+ */
82
+ public function load() {
83
+
84
+ // Get the current action if sent as request.
85
+ $action = isset( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : false;
86
+
87
+ // Get the current action if posted.
88
+ if ( ( isset( $_POST['action'] ) && 'delete' == $_POST['action'] ) || ( isset( $_POST['action2'] ) && 'delete' == $_POST['action2'] ) )
89
+ $action = 'bulk-delete';
90
+
91
+ // Bulk delete role handler.
92
+ if ( 'bulk-delete' === $action ) {
93
+
94
+ // If roles were selected, let's delete some roles.
95
+ if ( current_user_can( 'delete_roles' ) && isset( $_POST['roles'] ) && is_array( $_POST['roles'] ) ) {
96
+
97
+ // Verify the nonce. Nonce created via `WP_List_Table::display_tablenav()`.
98
+ check_admin_referer( 'bulk-roles' );
99
+
100
+ // Loop through each of the selected roles.
101
+ foreach ( $_POST['roles'] as $role ) {
102
+
103
+ $role = members_sanitize_role( $role );
104
+
105
+ if ( members_role_exists( $role ) )
106
+ members_delete_role( $role );
107
+ }
108
+
109
+ // Add roles deleted message.
110
+ add_settings_error( 'members_roles', 'roles_deleted', esc_html__( 'Selected roles deleted.', 'members' ), 'updated' );
111
+ }
112
+
113
+ // Delete single role handler.
114
+ } else if ( 'delete' === $action ) {
115
+
116
+ // Make sure the current user can delete roles.
117
+ if ( current_user_can( 'delete_roles' ) ) {
118
+
119
+ // Verify the referer.
120
+ check_admin_referer( 'delete_role', 'members_delete_role_nonce' );
121
+
122
+ // Get the role we want to delete.
123
+ $role = members_sanitize_role( $_GET['role'] );
124
+
125
+ // Check that we have a role before attempting to delete it.
126
+ if ( members_role_exists( $role ) ) {
127
+
128
+ // Add role deleted message.
129
+ add_settings_error( 'members_roles', 'role_deleted', sprintf( esc_html__( '%s role deleted.', 'members' ), members_get_role_name( $role ) ), 'updated' );
130
+
131
+ // Delete the role.
132
+ members_delete_role( $role );
133
+ }
134
+ }
135
+ }
136
+
137
+ // Load page hook.
138
+ do_action( 'members_load_manage_roles' );
139
+ }
140
+
141
+ /**
142
+ * Enqueue scripts/styles.
143
+ *
144
+ * @since 1.0.0
145
+ * @access public
146
+ * @return void
147
+ */
148
+ public function enqueue() {
149
+
150
+ wp_enqueue_style( 'members-admin' );
151
+ wp_enqueue_script( 'members-edit-role' );
152
+ }
153
+
154
+ /**
155
+ * Displays the page content.
156
+ *
157
+ * @since 1.0.0
158
+ * @access public
159
+ * @return void
160
+ */
161
+ public function page() {
162
+
163
+ require_once( members_plugin()->admin_dir . 'class-role-list-table.php' ); ?>
164
+
165
+ <div class="wrap">
166
+
167
+ <h1>
168
+ <?php esc_html_e( 'Roles', 'members' ); ?>
169
+
170
+ <?php if ( current_user_can( 'create_roles' ) ) : ?>
171
+ <a href="<?php echo esc_url( members_get_new_role_url() ); ?>" class="page-title-action"><?php esc_html_e( 'Add New', 'members' ); ?></a>
172
+ <?php endif; ?>
173
+ </h1>
174
+
175
+ <?php settings_errors( 'members_roles' ); ?>
176
+
177
+ <div id="poststuff">
178
+
179
+ <form id="roles" action="<?php echo esc_url( members_get_edit_roles_url() ); ?>" method="post">
180
+
181
+ <?php $table = new Members_Role_List_Table(); ?>
182
+ <?php $table->prepare_items(); ?>
183
+ <?php $table->display(); ?>
184
+
185
+ </form><!-- #roles -->
186
+
187
+ </div><!-- #poststuff -->
188
+
189
+ </div><!-- .wrap -->
190
+ <?php }
191
+
192
+ /**
193
+ * Adds help tabs.
194
+ *
195
+ * @since 1.0.0
196
+ * @access public
197
+ * @return void
198
+ */
199
+ public function add_help_tabs() {
200
+
201
+ // Get the current screen.
202
+ $screen = get_current_screen();
203
+
204
+ // Add overview help tab.
205
+ $screen->add_help_tab(
206
+ array(
207
+ 'id' => 'overview',
208
+ 'title' => esc_html__( 'Overview', 'members' ),
209
+ 'callback' => array( $this, 'help_tab_overview' )
210
+ )
211
+ );
212
+
213
+ // Add screen content help tab.
214
+ $screen->add_help_tab(
215
+ array(
216
+ 'id' => 'screen-content',
217
+ 'title' => esc_html__( 'Screen Content', 'members' ),
218
+ 'callback' => array( $this, 'help_tab_screen_content' )
219
+ )
220
+ );
221
+
222
+ // Add available actions help tab.
223
+ $screen->add_help_tab(
224
+ array(
225
+ 'id' => 'row-actions',
226
+ 'title' => esc_html__( 'Available Actions', 'members' ),
227
+ 'callback' => array( $this, 'help_tab_row_actions' )
228
+ )
229
+ );
230
+
231
+ // Add bulk actions help tab.
232
+ $screen->add_help_tab(
233
+ array(
234
+ 'id' => 'bulk-actions',
235
+ 'title' => esc_html__( 'Bulk Actions', 'members' ),
236
+ 'callback' => array( $this, 'help_tab_bulk_actions' )
237
+ )
238
+ );
239
+
240
+ // Set the help sidebar.
241
+ $screen->set_help_sidebar( members_get_help_sidebar_text() );
242
+ }
243
+
244
+ /**
245
+ * Overview help tab callback function.
246
+ *
247
+ * @since 1.0.0
248
+ * @access public
249
+ * @return void
250
+ */
251
+ public function help_tab_overview() { ?>
252
+
253
+ <p>
254
+ <?php esc_html_e( 'This screen provides access to all of your user roles. Roles are a method of grouping users. They are made up of capabilities (caps), which give permission to users to perform specific actions on the site.' ); ?>
255
+ <p>
256
+ <?php }
257
+
258
+ /**
259
+ * Screen content help tab callback function.
260
+ *
261
+ * @since 1.0.0
262
+ * @access public
263
+ * @return void
264
+ */
265
+ public function help_tab_screen_content() { ?>
266
+
267
+ <p>
268
+ <?php esc_html_e( 'You can customize the display of this screen&#8216;s contents in a number of ways:', 'members' ); ?>
269
+ </p>
270
+
271
+ <ul>
272
+ <li><?php esc_html_e( 'You can hide/display columns based on your needs and decide how many roles to list per screen using the Screen Options tab.', 'members' ); ?></li>
273
+ <li><?php esc_html_e( 'You can filter the list of roles by types using the text links in the upper left. The default view is to show all roles.', 'members' ); ?></li>
274
+ </ul>
275
+ <?php }
276
+
277
+ /**
278
+ * Row actions help tab callback function.
279
+ *
280
+ * @since 1.0.0
281
+ * @access public
282
+ * @return void
283
+ */
284
+ public function help_tab_row_actions() { ?>
285
+
286
+ <p>
287
+ <?php esc_html_e( 'Hovering over a row in the roles list will display action links that allow you to manage your role. You can perform the following actions:', 'members' ); ?>
288
+ </p>
289
+
290
+ <ul>
291
+ <li><?php _e( '<strong>Edit</strong> takes you to the editing screen for that role. You can also reach that screen by clicking on the role name.', 'members' ); ?></li>
292
+ <li><?php _e( '<strong>Delete</strong> removes your role from this list and permanently deletes it.', 'members' ); ?></li>
293
+ <li><?php _e( '<strong>Clone</strong> copies the role and takes you to the new role screen to further edit it.', 'members' ); ?></li>
294
+ <li><?php _e( '<strong>Users</strong> takes you to the users screen and lists the users that have that role.', 'members' ); ?></li>
295
+ </ul>
296
+ <?php }
297
+
298
+ /**
299
+ * Bulk actions help tab callback function.
300
+ *
301
+ * @since 1.0.0
302
+ * @access public
303
+ * @return void
304
+ */
305
+ public function help_tab_bulk_actions() { ?>
306
+
307
+ <p>
308
+ <?php esc_html_e( 'You can permanently delete multiple roles at once. Select the roles you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.', 'members' ); ?>
309
+ </p>
310
+ <?php }
311
+ }
admin/class-settings.php ADDED
@@ -0,0 +1,510 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles the settings screen.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Sets up and handles the plugin settings screen.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Settings_Page {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Settings page name.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @var string
36
+ */
37
+ public $settings_page = '';
38
+
39
+ /**
40
+ * Holds an array the plugin settings.
41
+ *
42
+ * @since 1.0.0
43
+ * @access public
44
+ * @var array
45
+ */
46
+ public $settings = array();
47
+
48
+ /**
49
+ * Sets up the needed actions for adding and saving the meta boxes.
50
+ *
51
+ * @since 1.0.0
52
+ * @access public
53
+ * @return void
54
+ */
55
+ private function __construct() {
56
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
57
+ }
58
+
59
+ /**
60
+ * Sets up custom admin menus.
61
+ *
62
+ * @since 1.0.0
63
+ * @access public
64
+ * @return void
65
+ */
66
+ public function admin_menu() {
67
+
68
+ // Create the settings page.
69
+ $this->settings_page = add_options_page(
70
+ esc_html__( 'Members Settings', 'members' ),
71
+ esc_html_x( 'Members', 'admin screen', 'members' ),
72
+ apply_filters( 'members_settings_capability', 'manage_options' ),
73
+ 'members-settings',
74
+ array( $this, 'settings_page' )
75
+ );
76
+
77
+ if ( $this->settings_page ) {
78
+
79
+ // Register setings.
80
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
81
+
82
+ // Add help tabs.
83
+ add_action( "load-{$this->settings_page}", array( $this, 'add_help_tabs' ) );
84
+
85
+ // Enqueue scripts/styles.
86
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Enqueue scripts/styles.
92
+ *
93
+ * @since 1.0.0
94
+ * @access public
95
+ * @param string $hook_suffix
96
+ * @return void
97
+ */
98
+ public function enqueue( $hook_suffix ) {
99
+
100
+ if ( $this->settings_page !== $hook_suffix )
101
+ return;
102
+
103
+ wp_enqueue_script( 'members-settings' );
104
+ }
105
+
106
+ /**
107
+ * Registers the plugin settings.
108
+ *
109
+ * @since 1.0.0
110
+ * @access public
111
+ * @return void
112
+ */
113
+ function register_settings() {
114
+
115
+ // Get the current plugin settings w/o the defaults.
116
+ $this->settings = get_option( 'members_settings' );
117
+
118
+ // Register the setting.
119
+ register_setting( 'members_settings', 'members_settings', array( $this, 'validate_settings' ) );
120
+
121
+ /* === Settings Sections === */
122
+
123
+ // Add settings sections.
124
+ add_settings_section( 'roles_caps', esc_html__( 'Roles and Capabilities', 'members' ), array( $this, 'section_roles_caps' ), $this->settings_page );
125
+ add_settings_section( 'content_permissions', esc_html__( 'Content Permissions', 'members' ), '__return_false', $this->settings_page );
126
+ add_settings_section( 'sidebar_widgets', esc_html__( 'Sidebar Widgets', 'members' ), '__return_false', $this->settings_page );
127
+ add_settings_section( 'private_site', esc_html__( 'Private Site', 'members' ), '__return_false', $this->settings_page );
128
+
129
+ /* === Settings Fields === */
130
+
131
+ // Role manager fields.
132
+ add_settings_field( 'enable_role_manager', esc_html__( 'Role Manager', 'members' ), array( $this, 'field_enable_role_manager' ), $this->settings_page, 'roles_caps' );
133
+ add_settings_field( 'explicit_denied_caps', esc_html__( 'Capabilities', 'members' ), array( $this, 'field_explicit_denied_caps' ), $this->settings_page, 'roles_caps' );
134
+ add_settings_field( 'enable_multi_roles', esc_html__( 'Multiple User Roles', 'members' ), array( $this, 'field_enable_multi_roles' ), $this->settings_page, 'roles_caps' );
135
+
136
+ // Content permissions fields.
137
+ add_settings_field( 'enable_content_permissions', esc_html__( 'Enable Permissions', 'members' ), array( $this, 'field_enable_content_permissions' ), $this->settings_page, 'content_permissions' );
138
+ add_settings_field( 'content_permissions_error', esc_html__( 'Error Message', 'members' ), array( $this, 'field_content_permissions_error' ), $this->settings_page, 'content_permissions' );
139
+
140
+ // Widgets fields.
141
+ add_settings_field( 'widget_login', esc_html__( 'Login Widget', 'members' ), array( $this, 'field_widget_login' ), $this->settings_page, 'sidebar_widgets' );
142
+ add_settings_field( 'widget_users', esc_html__( 'Users Widget', 'members' ), array( $this, 'field_widget_users' ), $this->settings_page, 'sidebar_widgets' );
143
+
144
+ // Private site fields.
145
+ add_settings_field( 'enable_private_site', esc_html__( 'Enable Private Site', 'members' ), array( $this, 'field_enable_private_site' ), $this->settings_page, 'private_site' );
146
+ add_settings_field( 'enable_private_feed', esc_html__( 'Disable Feed', 'members' ), array( $this, 'field_enable_private_feed' ), $this->settings_page, 'private_site' );
147
+ add_settings_field( 'private_feed_error', esc_html__( 'Feed Error Message', 'members' ), array( $this, 'field_private_feed_error' ), $this->settings_page, 'private_site' );
148
+ }
149
+
150
+ /**
151
+ * Validates the plugin settings.
152
+ *
153
+ * @since 1.0.0
154
+ * @access public
155
+ * @param array $input
156
+ * @return array
157
+ */
158
+ function validate_settings( $settings ) {
159
+
160
+ // Validate true/false checkboxes.
161
+ $settings['role_manager'] = isset( $settings['role_manager'] ) ? true : false;
162
+ $settings['explicit_denied_caps'] = isset( $settings['explicit_denied_caps'] ) ? true : false;
163
+ $settings['multi_roles'] = isset( $settings['multi_roles'] ) ? true : false;
164
+ $settings['content_permissions'] = isset( $settings['content_permissions'] ) ? true : false;
165
+ $settings['login_form_widget'] = isset( $settings['login_form_widget'] ) ? true : false;
166
+ $settings['users_widget'] = isset( $settings['users_widget'] ) ? true : false;
167
+ $settings['private_blog'] = isset( $settings['private_blog'] ) ? true : false;
168
+ $settings['private_feed'] = isset( $settings['private_feed'] ) ? true : false;
169
+
170
+ // Kill evil scripts.
171
+ $settings['content_permissions_error'] = stripslashes( wp_filter_post_kses( addslashes( $settings['content_permissions_error'] ) ) );
172
+ $settings['private_feed_error'] = stripslashes( wp_filter_post_kses( addslashes( $settings['private_feed_error'] ) ) );
173
+
174
+ // Return the validated/sanitized settings.
175
+ return $settings;
176
+ }
177
+
178
+ /**
179
+ * Role/Caps section callback.
180
+ *
181
+ * @since 1.0.0
182
+ * @access public
183
+ * @return void
184
+ */
185
+ public function section_roles_caps() { ?>
186
+
187
+ <p class="description">
188
+ <?php esc_html_e( 'Your roles and capabilities will not revert back to their previous settings after deactivating or uninstalling this plugin, so use this feature wisely.', 'members' ); ?>
189
+ </p>
190
+ <?php }
191
+
192
+ /**
193
+ * Role manager field callback.
194
+ *
195
+ * @since 1.0.0
196
+ * @access public
197
+ * @return void
198
+ */
199
+ public function field_enable_role_manager() { ?>
200
+
201
+ <label>
202
+ <input type="checkbox" name="members_settings[role_manager]" value="true" <?php checked( members_role_manager_enabled() ); ?> />
203
+ <?php esc_html_e( 'Enable the role manager.', 'members' ); ?>
204
+ </label>
205
+ <?php }
206
+
207
+ /**
208
+ * Explicit denied caps field callback.
209
+ *
210
+ * @since 1.0.0
211
+ * @access public
212
+ * @return void
213
+ */
214
+ public function field_explicit_denied_caps() { ?>
215
+
216
+ <label>
217
+ <input type="checkbox" name="members_settings[explicit_denied_caps]" value="true" <?php checked( members_explicitly_deny_caps() ); ?> />
218
+ <?php esc_html_e( 'Denied capabilities should always overrule granted capabilities.', 'members' ); ?>
219
+ </label>
220
+ <?php }
221
+
222
+ /**
223
+ * Multiple roles field callback.
224
+ *
225
+ * @since 1.0.0
226
+ * @access public
227
+ * @return void
228
+ */
229
+ public function field_enable_multi_roles() { ?>
230
+
231
+ <label>
232
+ <input type="checkbox" name="members_settings[multi_roles]" value="true" <?php checked( members_multiple_user_roles_enabled() ); ?> />
233
+ <?php esc_html_e( 'Allow users to be assigned more than a single role.', 'members' ); ?>
234
+ </label>
235
+ <?php }
236
+
237
+ /**
238
+ * Enable content permissions field callback.
239
+ *
240
+ * @since 1.0.0
241
+ * @access public
242
+ * @return void
243
+ */
244
+ public function field_enable_content_permissions() { ?>
245
+
246
+ <label>
247
+ <input type="checkbox" name="members_settings[content_permissions]" value="true" <?php checked( members_content_permissions_enabled() ); ?> />
248
+ <?php esc_html_e( 'Enable the content permissions feature.', 'members' ); ?>
249
+ </label>
250
+ <?php }
251
+
252
+ /**
253
+ * Content permissions error message field callback.
254
+ *
255
+ * @since 1.0.0
256
+ * @access public
257
+ * @return void
258
+ */
259
+ public function field_content_permissions_error() {
260
+
261
+ wp_editor(
262
+ members_get_setting( 'content_permissions_error' ),
263
+ 'members_settings_content_permissions_error',
264
+ array(
265
+ 'textarea_name' => 'members_settings[content_permissions_error]',
266
+ 'drag_drop_upload' => true,
267
+ 'editor_height' => 250
268
+ )
269
+ );
270
+ }
271
+
272
+ /**
273
+ * Login widget field callback.
274
+ *
275
+ * @since 1.0.0
276
+ * @access public
277
+ * @return void
278
+ */
279
+ public function field_widget_login() { ?>
280
+
281
+ <label>
282
+ <input type="checkbox" name="members_settings[login_form_widget]" value="true" <?php checked( members_login_widget_enabled() ); ?> />
283
+ <?php esc_html_e( 'Enable the login form widget.', 'members' ); ?>
284
+ </label>
285
+ <?php }
286
+
287
+ /**
288
+ * Uers widget field callback.
289
+ *
290
+ * @since 1.0.0
291
+ * @access public
292
+ * @return void
293
+ */
294
+ public function field_widget_users() { ?>
295
+
296
+ <label>
297
+ <input type="checkbox" name="members_settings[users_widget]" value="true" <?php checked( members_users_widget_enabled() ); ?> />
298
+ <?php esc_html_e( 'Enable the users widget.', 'members' ); ?>
299
+ </label>
300
+ <?php }
301
+
302
+ /**
303
+ * Enable private site field callback.
304
+ *
305
+ * @since 1.0.0
306
+ * @access public
307
+ * @return void
308
+ */
309
+ public function field_enable_private_site() { ?>
310
+
311
+ <label>
312
+ <input type="checkbox" name="members_settings[private_blog]" value="true" <?php checked( members_is_private_blog() ); ?> />
313
+ <?php esc_html_e( 'Redirect all logged-out users to the login page before allowing them to view the site.', 'members' ); ?>
314
+ </label>
315
+ <?php }
316
+
317
+ /**
318
+ * Enable private feed field callback.
319
+ *
320
+ * @since 1.0.0
321
+ * @access public
322
+ * @return void
323
+ */
324
+ public function field_enable_private_feed() { ?>
325
+
326
+ <label>
327
+ <input type="checkbox" name="members_settings[private_feed]" value="true" <?php checked( members_is_private_feed() ); ?> />
328
+ <?php esc_html_e( 'Show error message for feed items.', 'members' ); ?>
329
+ </label>
330
+ <?php }
331
+
332
+ /**
333
+ * Private feed error message field callback.
334
+ *
335
+ * @since 1.0.0
336
+ * @access public
337
+ * @return void
338
+ */
339
+ public function field_private_feed_error() {
340
+
341
+ wp_editor(
342
+ members_get_setting( 'private_feed_error' ),
343
+ 'members_settings_private_feed_error',
344
+ array(
345
+ 'textarea_name' => 'members_settings[private_feed_error]',
346
+ 'drag_drop_upload' => true,
347
+ 'editor_height' => 250
348
+ )
349
+ );
350
+ }
351
+
352
+ /**
353
+ * Renders the settings page.
354
+ *
355
+ * @since 1.0.0
356
+ * @access public
357
+ * @return void
358
+ */
359
+ public function settings_page() { ?>
360
+
361
+ <div class="wrap">
362
+ <h1><?php _e( 'Members Settings', 'members' ); ?></h1>
363
+
364
+ <form method="post" action="options.php">
365
+ <?php settings_fields( 'members_settings' ); ?>
366
+ <?php do_settings_sections( $this->settings_page ); ?>
367
+ <?php submit_button( esc_attr__( 'Update Settings', 'members' ), 'primary' ); ?>
368
+ </form>
369
+
370
+ </div><!-- wrap -->
371
+ <?php }
372
+
373
+ /**
374
+ * Adds help tabs.
375
+ *
376
+ * @since 1.0.0
377
+ * @access public
378
+ * @return void
379
+ */
380
+ public function add_help_tabs() {
381
+
382
+ // Get the current screen.
383
+ $screen = get_current_screen();
384
+
385
+ // Roles/Caps help tab.
386
+ $screen->add_help_tab(
387
+ array(
388
+ 'id' => 'roles-caps',
389
+ 'title' => esc_html__( 'Role and Capabilities', 'members' ),
390
+ 'callback' => array( $this, 'help_tab_roles_caps' )
391
+ )
392
+ );
393
+
394
+ // Content Permissions help tab.
395
+ $screen->add_help_tab(
396
+ array(
397
+ 'id' => 'content-permissions',
398
+ 'title' => esc_html__( 'Content Permissions', 'members' ),
399
+ 'callback' => array( $this, 'help_tab_content_permissions' )
400
+ )
401
+ );
402
+
403
+ // Widgets help tab.
404
+ $screen->add_help_tab(
405
+ array(
406
+ 'id' => 'sidebar-widgets',
407
+ 'title' => esc_html__( 'Sidebar Widgets', 'members' ),
408
+ 'callback' => array( $this, 'help_tab_sidebar_widgets' )
409
+ )
410
+ );
411
+
412
+ // Private Site help tab.
413
+ $screen->add_help_tab(
414
+ array(
415
+ 'id' => 'private-site',
416
+ 'title' => esc_html__( 'Private Site', 'members' ),
417
+ 'callback' => array( $this, 'help_tab_private_site' )
418
+ )
419
+ );
420
+
421
+ // Get docs and help links.
422
+ $docs_link = sprintf( '<li><a href="https://github.com/justintadlock/members/blob/master/readme.md">%s</a></li>', esc_html__( 'Documentation', 'members' ) );
423
+ $help_link = sprintf( '<li><a href="http://themehybrid.com/board/topics">%s</a></li>', esc_html__( 'Support Forums', 'members' ) );
424
+ $tut_link = sprintf( '<li><a href="http://justintadlock.com/archives/2009/08/30/users-roles-and-capabilities-in-wordpress">%s</a></li>', esc_html__( 'Users, Roles, and Capabilities', 'members' ) );
425
+
426
+ // Set the help sidebar.
427
+ $screen->set_help_sidebar( members_get_help_sidebar_text() );
428
+ }
429
+
430
+ /**
431
+ * Displays the roles/caps help tab.
432
+ *
433
+ * @since 1.0.0
434
+ * @access public
435
+ * @return void
436
+ */
437
+ public function help_tab_roles_caps() { ?>
438
+
439
+ <p>
440
+ <?php esc_html_e( 'The role manager allows you to manage roles on your site by giving you the ability to create, edit, and delete any role. Note that changes to roles do not change settings for the Members plugin. You are literally changing data in your WordPress database. This plugin feature merely provides an interface for you to make these changes.', 'members' ); ?>
441
+ </p>
442
+
443
+ <p>
444
+ <?php esc_html_e( 'Tick the checkbox for denied capabilities to always take precedence over granted capabilities when there is a conflict. This is only relevant when using multiple roles per user.', 'members' ); ?>
445
+ </p>
446
+
447
+ <p>
448
+ <?php esc_html_e( 'The multiple user roles feature allows you to assign more than one role to each user from the edit user screen.', 'members' ); ?>
449
+ </p>
450
+ <?php }
451
+
452
+ /**
453
+ * Displays the content permissions help tab.
454
+ *
455
+ * @since 1.0.0
456
+ * @access public
457
+ * @return void
458
+ */
459
+ public function help_tab_content_permissions() { ?>
460
+
461
+ <p>
462
+ <?php printf( esc_html__( "The content permissions features adds a meta box to the edit post screen that allows you to grant permissions for who can read the post content based on the user's role. Only users of roles with the %s capability will be able to use this component.", 'members' ), '<code>restrict_content</code>' ); ?>
463
+ </p>
464
+ <?php }
465
+
466
+ /**
467
+ * Displays the sidebar widgets help tab.
468
+ *
469
+ * @since 1.0.0
470
+ * @access public
471
+ * @return void
472
+ */
473
+ public function help_tab_sidebar_widgets() { ?>
474
+
475
+ <p>
476
+ <?php esc_html_e( "The sidebar widgets feature adds additional widgets for use in your theme's sidebars.", 'members' ); ?>
477
+ </p>
478
+ <?php }
479
+
480
+ /**
481
+ * Displays the private site help tab.
482
+ *
483
+ * @since 1.0.0
484
+ * @access public
485
+ * @return void
486
+ */
487
+ public function help_tab_private_site() { ?>
488
+
489
+ <p>
490
+ <?php esc_html_e( 'The private site feature redirects all users who are not logged into the site to the login page, creating an entirely private site. You may also replace your feed content with a custom error message.', 'members' ); ?>
491
+ </p>
492
+ <?php }
493
+
494
+ /**
495
+ * Returns the instance.
496
+ *
497
+ * @since 1.0.0
498
+ * @access public
499
+ * @return object
500
+ */
501
+ public static function get_instance() {
502
+
503
+ if ( ! self::$instance )
504
+ self::$instance = new self;
505
+
506
+ return self::$instance;
507
+ }
508
+ }
509
+
510
+ Members_Settings_Page::get_instance();
admin/class-user-edit.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles custom functionality on the edit user screen, such as multiple user roles.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Edit user screen class.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ */
19
+ final class Members_Admin_User_Edit {
20
+
21
+ /**
22
+ * Holds the instances of this class.
23
+ *
24
+ * @since 1.0.0
25
+ * @access private
26
+ * @var object
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Sets up needed actions/filters for the admin to initialize.
32
+ *
33
+ * @since 1.0.0
34
+ * @access public
35
+ * @return void
36
+ */
37
+ public function __construct() {
38
+
39
+ // If multiple roles per user is not enabled, bail.
40
+ if ( ! members_multiple_user_roles_enabled() )
41
+ return;
42
+
43
+ // Only run our customization on the 'user-edit.php' page in the admin.
44
+ add_action( 'load-user-edit.php', array( $this, 'load_user_edit' ) );
45
+ }
46
+
47
+ /**
48
+ * Adds actions/filters on load.
49
+ *
50
+ * @since 1.0.0
51
+ * @access public
52
+ * @return void
53
+ */
54
+ public function load_user_edit() {
55
+
56
+ add_action( 'admin_head', array( $this, 'print_styles' ) );
57
+
58
+ add_action( 'show_user_profile', array( $this, 'profile_fields' ) );
59
+ add_action( 'edit_user_profile', array( $this, 'profile_fields' ) );
60
+
61
+ // Must use `profile_update` to change role. Otherwise, WP will wipe it out.
62
+ add_action( 'profile_update', array( $this, 'role_update' ) );
63
+ }
64
+
65
+ /**
66
+ * Adds custom profile fields.
67
+ *
68
+ * @since 1.0.0
69
+ * @access public
70
+ * @param object $user
71
+ * @return void
72
+ */
73
+ public function profile_fields( $user ) {
74
+ global $wp_roles;
75
+
76
+ if ( ! current_user_can( 'promote_users' ) || ! current_user_can( 'edit_user', $user->ID ) )
77
+ return;
78
+
79
+ $user_roles = (array) $user->roles;
80
+
81
+ $editable_roles = members_get_editable_role_names();
82
+
83
+ asort( $editable_roles );
84
+
85
+ wp_nonce_field( 'new_user_roles', 'members_new_user_roles_nonce' ); ?>
86
+
87
+ <h3><?php esc_html_e( 'Roles', 'message-board' ); ?></h3>
88
+
89
+ <table class="form-table">
90
+
91
+ <tr>
92
+ <th><?php esc_html_e( 'User Roles', 'members' ); ?></th>
93
+
94
+ <td>
95
+ <ul>
96
+ <?php foreach ( $editable_roles as $role => $name ) : ?>
97
+ <li>
98
+ <label>
99
+ <input type="checkbox" name="members_user_roles[]" value="<?php echo esc_attr( $role ); ?>" <?php checked( in_array( $role, $user_roles ) ); ?> />
100
+ <?php echo esc_html( $name ); ?>
101
+ </label>
102
+ </li>
103
+ <?php endforeach; ?>
104
+ </ul>
105
+ </td>
106
+ </tr>
107
+
108
+ </table>
109
+ <?php }
110
+
111
+ /**
112
+ * Callback function for handling user role changes. Note that we needed to execute this function
113
+ * on a different hook, `profile_update`. Using the normal hooks on the edit user screen won't work
114
+ * because WP will wipe out the role.
115
+ *
116
+ * @since 1.0.0
117
+ * @access public
118
+ * @param int $user_id
119
+ * @return void
120
+ */
121
+ public function role_update( $user_id ) {
122
+
123
+ // If the current user can't promote users or edit this particular user, bail.
124
+ if ( ! current_user_can( 'promote_users' ) || ! current_user_can( 'edit_user', $user_id ) )
125
+ return;
126
+
127
+ // Is this a role change?
128
+ if ( ! isset( $_POST['members_new_user_roles_nonce'] ) || ! wp_verify_nonce( $_POST['members_new_user_roles_nonce'], 'new_user_roles' ) )
129
+ return;
130
+
131
+ // Create a new user object.
132
+ $user = new WP_User( $user_id );
133
+
134
+ // If we have an array of roles.
135
+ if ( ! empty( $_POST['members_user_roles'] ) ) {
136
+
137
+ // Get the current user roles.
138
+ $old_roles = (array) $user->roles;
139
+
140
+ // Sanitize the posted roles.
141
+ $new_roles = array_map( 'members_sanitize_role', $_POST['members_user_roles'] );
142
+
143
+ // Loop through the posted roles.
144
+ foreach ( $new_roles as $new_role ) {
145
+
146
+ // If the user doesn't already have the role, add it.
147
+ if ( ! in_array( $new_role, (array) $user->roles ) )
148
+ $user->add_role( $new_role );
149
+ }
150
+
151
+ // Loop through the current user roles.
152
+ foreach ( $old_roles as $old_role ) {
153
+
154
+ // If the role is editable and not in the new roles array, remove it.
155
+ if ( members_is_role_editable( $old_role ) && ! in_array( $old_role, $new_roles ) )
156
+ $user->remove_role( $old_role );
157
+ }
158
+
159
+ // If the posted roles are empty.
160
+ } else {
161
+
162
+ // Loop through the current user roles.
163
+ foreach ( (array) $user->roles as $old_role ) {
164
+
165
+ // Remove the role if it is editable.
166
+ if ( members_is_role_editable( $old_role ) )
167
+ $user->remove_role( $old_role );
168
+ }
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Enqueue the plugin admin CSS.
174
+ *
175
+ * @since 1.0.0
176
+ * @access public
177
+ * @return void
178
+ */
179
+ public function print_styles() { ?>
180
+
181
+ <style type="text/css">.user-role-wrap{ display: none !important; }</style>
182
+
183
+ <?php }
184
+
185
+ /**
186
+ * Returns the instance.
187
+ *
188
+ * @since 1.0.0
189
+ * @access public
190
+ * @return object
191
+ */
192
+ public static function get_instance() {
193
+
194
+ if ( ! self::$instance )
195
+ self::$instance = new self;
196
+
197
+ return self::$instance;
198
+ }
199
+ }
200
+
201
+ Members_Admin_User_Edit::get_instance();
admin/functions-admin.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General admin functionality.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Register scripts/styles.
14
+ add_action( 'admin_enqueue_scripts', 'members_admin_register_scripts', 0 );
15
+ add_action( 'admin_enqueue_scripts', 'members_admin_register_styles', 0 );
16
+
17
+ # Custom manage users columns.
18
+ add_filter( 'manage_users_columns', 'members_manage_users_columns' );
19
+ add_filter( 'manage_users_custom_column', 'members_manage_users_custom_column', 10, 3 );
20
+
21
+ /**
22
+ * Get an Underscore JS template.
23
+ *
24
+ * @since 1.0.0
25
+ * @access public
26
+ * @param string $name
27
+ * @return bool
28
+ */
29
+ function members_get_underscore_template( $name ) {
30
+ require_once( members_plugin()->admin_dir . "tmpl/{$name}.php" );
31
+ }
32
+
33
+ /**
34
+ * Registers custom plugin scripts.
35
+ *
36
+ * @since 1.0.0
37
+ * @access public
38
+ * @return void
39
+ */
40
+ function members_admin_register_scripts() {
41
+
42
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
43
+
44
+ wp_register_script( 'members-settings', members_plugin()->js_uri . "settings{$min}.js", array( 'jquery' ), '', true );
45
+ wp_register_script( 'members-edit-role', members_plugin()->js_uri . "edit-role{$min}.js", array( 'postbox', 'wp-util' ), '', true );
46
+
47
+ // Localize our script with some text we want to pass in.
48
+ $i18n = array(
49
+ 'button_role_edit' => esc_html__( 'Edit', 'members' ),
50
+ 'button_role_ok' => esc_html__( 'OK', 'members' ),
51
+ 'label_grant_cap' => esc_html__( 'Grant %s capability', 'members' ),
52
+ 'label_deny_cap' => esc_html__( 'Deny %s capability', 'members' ),
53
+ 'ays_delete_role' => esc_html__( 'Are you sure you want to delete this role? This is a permanent action and cannot be undone.', 'members' )
54
+ );
55
+
56
+ wp_localize_script( 'members-edit-role', 'members_i18n', $i18n );
57
+ }
58
+
59
+ /**
60
+ * Registers custom plugin scripts.
61
+ *
62
+ * @since 1.0.0
63
+ * @access public
64
+ * @return void
65
+ */
66
+ function members_admin_register_styles() {
67
+
68
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
69
+
70
+ wp_register_style( 'members-admin', members_plugin()->css_uri . "admin{$min}.css" );
71
+ }
72
+
73
+ /**
74
+ * Function for safely deleting a role and transferring the deleted role's users to the default
75
+ * role. Note that this function can be extremely intensive. Whenever a role is deleted, it's
76
+ * best for the site admin to assign the user's of the role to a different role beforehand.
77
+ *
78
+ * @since 0.2.0
79
+ * @access public
80
+ * @param string $role
81
+ * @return void
82
+ */
83
+ function members_delete_role( $role ) {
84
+
85
+ // Get the default role.
86
+ $default_role = get_option( 'default_role' );
87
+
88
+ // Don't delete the default role. Site admins should change the default before attempting to delete the role.
89
+ if ( $role == $default_role )
90
+ return;
91
+
92
+ // Get all users with the role to be deleted.
93
+ $users = get_users( array( 'role' => $role ) );
94
+
95
+ // Check if there are any users with the role we're deleting.
96
+ if ( is_array( $users ) ) {
97
+
98
+ // If users are found, loop through them.
99
+ foreach ( $users as $user ) {
100
+
101
+ // If the user has the role and no other roles, set their role to the default.
102
+ if ( $user->has_cap( $role ) && 1 >= count( $user->roles ) )
103
+ $user->set_role( $default_role );
104
+
105
+ // Else, remove the role.
106
+ else if ( $user->has_cap( $role ) )
107
+ $user->remove_role( $role );
108
+ }
109
+ }
110
+
111
+ // Remove the role.
112
+ remove_role( $role );
113
+ }
114
+
115
+ /**
116
+ * Returns an array of all the user meta keys in the $wpdb->usermeta table.
117
+ *
118
+ * @since 0.2.0
119
+ * @access public
120
+ * @global object $wpdb
121
+ * @return array
122
+ */
123
+ function members_get_user_meta_keys() {
124
+ global $wpdb;
125
+
126
+ return $wpdb->get_col( "SELECT meta_key FROM $wpdb->usermeta GROUP BY meta_key ORDER BY meta_key" );
127
+ }
128
+
129
+ /**
130
+ * Adds custom columns to the `users.php` screen.
131
+ *
132
+ * @since 1.0.0
133
+ * @access public
134
+ * @param array $columns
135
+ * @return array
136
+ */
137
+ function members_manage_users_columns( $columns ) {
138
+
139
+ // If multiple roles per user is not enabled, bail.
140
+ if ( ! members_multiple_user_roles_enabled() )
141
+ return $columns;
142
+
143
+ // Unset the core WP `role` column.
144
+ if ( isset( $columns['role'] ) )
145
+ unset( $columns['role'] );
146
+
147
+ // Add our new roles column.
148
+ $columns['roles'] = esc_html__( 'Roles', 'members' );
149
+
150
+ // Move the core WP `posts` column to the end.
151
+ if ( isset( $columns['posts'] ) ) {
152
+ $p = $columns['posts'];
153
+ unset( $columns['posts'] );
154
+ $columns['posts'] = $p;
155
+ }
156
+
157
+ return $columns;
158
+ }
159
+
160
+ /**
161
+ * Handles the output of the roles column on the `users.php` screen.
162
+ *
163
+ * @since 1.0.0
164
+ * @access public
165
+ * @param string $output
166
+ * @param string $column
167
+ * @param int $user_id
168
+ * @return string
169
+ */
170
+ function members_manage_users_custom_column( $output, $column, $user_id ) {
171
+
172
+ if ( 'roles' === $column && members_multiple_user_roles_enabled() ) {
173
+
174
+ $user = new WP_User( $user_id );
175
+
176
+ $user_roles = array();
177
+ $output = esc_html__( 'None', 'members' );
178
+
179
+ if ( is_array( $user->roles ) ) {
180
+
181
+ foreach ( $user->roles as $role ) {
182
+
183
+ if ( members_role_exists( $role ) )
184
+ $user_roles[] = members_translate_role( $role );
185
+ }
186
+
187
+ $output = join( ', ', $user_roles );
188
+ }
189
+ }
190
+
191
+ return $output;
192
+ }
admin/functions-cap-groups.php ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Capability groups API. Offers a standardized method for creating capability groups.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Registers default groups.
14
+ add_action( 'init', 'members_register_cap_groups', 15 );
15
+
16
+ /**
17
+ * Returns the instance of the `Members_Cap_Group_Factory` object. Use this function to access the object.
18
+ *
19
+ * @see Members_Cap_Group_Factory
20
+ * @since 1.0.0
21
+ * @access public
22
+ * @return object
23
+ */
24
+ function members_cap_group_factory() {
25
+ return Members_Cap_Group_Factory::get_instance();
26
+ }
27
+
28
+ /**
29
+ * Function for registering a cap group.
30
+ *
31
+ * @see Members_Cap_Group_Factory::register_group()
32
+ * @since 1.0.0
33
+ * @access public
34
+ * @param string $name
35
+ * @param array $args
36
+ * @return void
37
+ */
38
+ function members_register_cap_group( $name, $args = array() ) {
39
+ members_cap_group_factory()->register_group( $name, $args );
40
+ }
41
+
42
+ /**
43
+ * Unregisters a group.
44
+ *
45
+ * @see Members_Cap_Group_Factory::unregister_group()
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @param string $name
49
+ * @return void
50
+ */
51
+ function members_unregister_cap_group( $name ) {
52
+ members_cap_group_factory()->unregister_group( $name );
53
+ }
54
+
55
+ /**
56
+ * Checks if a group exists.
57
+ *
58
+ * @see Members_Cap_Group_Factory::group_exists()
59
+ * @since 1.0.0
60
+ * @access public
61
+ * @param string $name
62
+ * @return bool
63
+ */
64
+ function members_cap_group_exists( $name ) {
65
+ return members_cap_group_factory()->group_exists( $name );
66
+ }
67
+
68
+ /**
69
+ * Returns an array of registered group objects.
70
+ *
71
+ * @see Members_Cap_Group_Factory::group
72
+ * @since 1.0.0
73
+ * @access public
74
+ * @return array
75
+ */
76
+ function members_get_cap_groups() {
77
+ return members_cap_group_factory()->groups;
78
+ }
79
+
80
+ /**
81
+ * Returns a group object if it exists. Otherwise, `FALSE`.
82
+ *
83
+ * @see Members_Cap_Group_Factory::get_group()
84
+ * @see Members_Cap_Group
85
+ * @since 1.0.0
86
+ * @access public
87
+ * @param string $name
88
+ * @return object|bool
89
+ */
90
+ function members_get_cap_group( $name ) {
91
+ return members_cap_group_factory()->get_group( $name );
92
+ }
93
+
94
+ /**
95
+ * Registers the default cap groups.
96
+ *
97
+ * @since 1.0.0
98
+ * @access public
99
+ * @return void
100
+ */
101
+ function members_register_cap_groups() {
102
+
103
+ // Register the all group.
104
+ members_register_cap_group( 'all',
105
+ array(
106
+ 'label' => esc_html__( 'All', 'members' ),
107
+ 'caps' => members_get_all_group_caps(),
108
+ 'icon' => 'dashicons-plus',
109
+ 'merge_added' => false
110
+ )
111
+ );
112
+
113
+ // Registers the general group.
114
+ members_register_cap_group( 'general',
115
+ array(
116
+ 'label' => esc_html__( 'General', 'members' ),
117
+ 'caps' => members_get_general_group_caps(),
118
+ 'icon' => 'dashicons-wordpress'
119
+ )
120
+ );
121
+
122
+ // Loop through every custom post type.
123
+ foreach ( get_post_types( array(), 'objects' ) as $type ) {
124
+
125
+ // Skip revisions and nave menu items.
126
+ if ( in_array( $type->name, array( 'revision', 'nav_menu_item' ) ) )
127
+ continue;
128
+
129
+ // Get the caps for the post type.
130
+ $has_caps = members_get_post_type_group_caps( $type->name );
131
+
132
+ // Skip if the post type doesn't have caps.
133
+ if ( empty( $has_caps ) )
134
+ continue;
135
+
136
+ // Set the default post type icon.
137
+ $icon = $type->hierarchical ? 'dashicons-admin-page' : 'dashicons-admin-post';
138
+
139
+ // Get the post type icon.
140
+ if ( is_string( $type->menu_icon ) && preg_match( '/dashicons-/i', $type->menu_icon ) )
141
+ $icon = $type->menu_icon;
142
+
143
+ else if ( 'attachment' === $type->name )
144
+ $icon = 'dashicons-admin-media';
145
+
146
+ else if ( 'download' === $type->name )
147
+ $icon = 'dashicons-download'; // EDD
148
+
149
+ else if ( 'product' === $type->name )
150
+ $icon = 'dashicons-cart';
151
+
152
+ // Register the post type cap group.
153
+ members_register_cap_group( "type-{$type->name}",
154
+ array(
155
+ 'label' => $type->labels->name,
156
+ 'caps' => $has_caps,
157
+ 'icon' => $icon
158
+ )
159
+ );
160
+ }
161
+
162
+ // Register the taxonomy group.
163
+ members_register_cap_group( 'taxonomy',
164
+ array(
165
+ 'label' => esc_html__( 'Taxonomies', 'members' ),
166
+ 'caps' => members_get_taxonomy_group_caps(),
167
+ 'icon' => 'dashicons-tag',
168
+ 'diff_added' => true
169
+ )
170
+ );
171
+
172
+ // Register the theme group.
173
+ members_register_cap_group( 'theme',
174
+ array(
175
+ 'label' => esc_html__( 'Appearance', 'members' ),
176
+ 'caps' => members_get_theme_group_caps(),
177
+ 'icon' => 'dashicons-admin-appearance'
178
+ )
179
+ );
180
+
181
+ // Register the plugin group.
182
+ members_register_cap_group( 'plugin',
183
+ array(
184
+ 'label' => esc_html__( 'Plugins', 'members' ),
185
+ 'caps' => members_get_plugin_group_caps(),
186
+ 'icon' => 'dashicons-admin-plugins'
187
+ )
188
+ );
189
+
190
+ // Register the user group.
191
+ members_register_cap_group( 'user',
192
+ array(
193
+ 'label' => esc_html__( 'Users', 'members' ),
194
+ 'caps' => members_get_user_group_caps(),
195
+ 'icon' => 'dashicons-admin-users'
196
+ )
197
+ );
198
+
199
+ // Register the custom group.
200
+ members_register_cap_group( 'custom',
201
+ array(
202
+ 'label' => esc_html__( 'Custom', 'members' ),
203
+ 'caps' => members_get_capabilities(),
204
+ 'icon' => 'dashicons-admin-generic',
205
+ 'diff_added' => true
206
+ )
207
+ );
208
+
209
+ // Hook for registering cap groups. Plugins should always register on this hook.
210
+ do_action( 'members_register_cap_groups' );
211
+ }
212
+
213
+ /**
214
+ * Returns the caps for the all capability group.
215
+ *
216
+ * @since 1.0.0
217
+ * @access public
218
+ * @return array
219
+ */
220
+ function members_get_all_group_caps() {
221
+
222
+ return members_get_capabilities();
223
+ }
224
+
225
+ /**
226
+ * Returns the caps for the general capability group.
227
+ *
228
+ * @since 1.0.0
229
+ * @access public
230
+ * @return array
231
+ */
232
+ function members_get_general_group_caps() {
233
+
234
+ return array(
235
+ 'edit_dashboard',
236
+ 'edit_files',
237
+ 'export',
238
+ 'import',
239
+ 'manage_links',
240
+ 'manage_options',
241
+ 'moderate_comments',
242
+ 'read',
243
+ 'unfiltered_html',
244
+ 'update_core',
245
+ );
246
+ }
247
+
248
+ /**
249
+ * Returns the caps for a specific post type capability group.
250
+ *
251
+ * @since 1.0.0
252
+ * @access public
253
+ * @return array
254
+ */
255
+ function members_get_post_type_group_caps( $post_type = 'post' ) {
256
+
257
+ // Get the post type caps.
258
+ $caps = (array) get_post_type_object( $post_type )->cap;
259
+
260
+ // remove meta caps.
261
+ unset( $caps['edit_post'] );
262
+ unset( $caps['read_post'] );
263
+ unset( $caps['delete_post'] );
264
+
265
+ // Get the cap names only.
266
+ $caps = array_values( $caps );
267
+
268
+ // If this is not a core post/page post type.
269
+ if ( ! in_array( $post_type, array( 'post', 'page' ) ) ) {
270
+
271
+ // Get the post and page caps.
272
+ $post_caps = array_values( (array) get_post_type_object( 'post' )->cap );
273
+ $page_caps = array_values( (array) get_post_type_object( 'page' )->cap );
274
+
275
+ // Remove post/page caps from the current post type caps.
276
+ $caps = array_diff( $caps, $post_caps, $page_caps );
277
+ }
278
+
279
+ // If attachment post type, add the `unfiltered_upload` cap.
280
+ if ( 'attachment' === $post_type )
281
+ $caps[] = 'unfiltered_upload';
282
+
283
+ // Make sure there are no duplicates and return.
284
+ return array_unique( $caps );
285
+ }
286
+
287
+ /**
288
+ * Returns the caps for the taxonomy capability group.
289
+ *
290
+ * @since 1.0.0
291
+ * @access public
292
+ * @return array
293
+ */
294
+ function members_get_taxonomy_group_caps() {
295
+
296
+ $taxi = get_taxonomies( array(), 'objects' );
297
+
298
+ $caps = array();
299
+
300
+ foreach ( $taxi as $tax )
301
+ $caps = array_merge( $caps, array_values( (array) $tax->cap ) );
302
+
303
+ return array_unique( $caps );
304
+ }
305
+
306
+ /**
307
+ * Returns the caps for the theme capability group.
308
+ *
309
+ * @since 1.0.0
310
+ * @access public
311
+ * @return array
312
+ */
313
+ function members_get_theme_group_caps() {
314
+
315
+ return array(
316
+ 'delete_themes',
317
+ 'edit_theme_options',
318
+ 'edit_themes',
319
+ 'install_themes',
320
+ 'switch_themes',
321
+ 'update_themes',
322
+ );
323
+ }
324
+
325
+ /**
326
+ * Returns the caps for the plugin capability group.
327
+ *
328
+ * @since 1.0.0
329
+ * @access public
330
+ * @return array
331
+ */
332
+ function members_get_plugin_group_caps() {
333
+
334
+ return array(
335
+ 'activate_plugins',
336
+ 'delete_plugins',
337
+ 'edit_plugins',
338
+ 'install_plugins',
339
+ 'update_plugins',
340
+ );
341
+ }
342
+
343
+ /**
344
+ * Returns the caps for the user capability group.
345
+ *
346
+ * @since 1.0.0
347
+ * @access public
348
+ * @return array
349
+ */
350
+ function members_get_user_group_caps() {
351
+
352
+ return array(
353
+ 'add_users',
354
+ 'create_roles',
355
+ 'create_users',
356
+ 'delete_roles',
357
+ 'delete_users',
358
+ 'edit_roles',
359
+ 'edit_users',
360
+ 'list_roles',
361
+ 'list_users',
362
+ 'promote_users',
363
+ 'remove_users',
364
+ );
365
+ }
366
+
367
+ /**
368
+ * Returns the caps for the custom capability group.
369
+ *
370
+ * @since 1.0.0
371
+ * @access public
372
+ * @return array
373
+ */
374
+ function members_get_custom_group_caps() {
375
+
376
+ return members_get_capabilities();
377
+ }
admin/functions-help.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Callback functions for outputting help tabs in the admin.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Help sidebar for all of the help tabs.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ * @return string
19
+ */
20
+ function members_get_help_sidebar_text() {
21
+
22
+ // Get docs and help links.
23
+ $docs_link = sprintf( '<li><a href="https://github.com/justintadlock/members/blob/master/readme.md">%s</a></li>', esc_html__( 'Documentation', 'members' ) );
24
+ $help_link = sprintf( '<li><a href="http://themehybrid.com/board/topics">%s</a></li>', esc_html__( 'Support Forums', 'members' ) );
25
+
26
+ // Return the text.
27
+ return sprintf(
28
+ '<p><strong>%s</strong></p><ul>%s%s</ul>',
29
+ esc_html__( 'For more information:', 'members' ),
30
+ $docs_link,
31
+ $help_link
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Edit role overview help tab args.
37
+ *
38
+ * @since 1.0.0
39
+ * @access public
40
+ * @return array
41
+ */
42
+ function members_get_edit_role_help_overview_args() {
43
+
44
+ return array(
45
+ 'id' => 'overview',
46
+ 'title' => esc_html__( 'Overview', 'members' ),
47
+ 'callback' => 'members_edit_role_help_overview_cb'
48
+ );
49
+ }
50
+
51
+ /**
52
+ * Edit role name help tab args.
53
+ *
54
+ * @since 1.0.0
55
+ * @access public
56
+ * @return array
57
+ */
58
+ function members_get_edit_role_help_role_name_args() {
59
+
60
+ return array(
61
+ 'id' => 'role-name',
62
+ 'title' => esc_html__( 'Role Name', 'members' ),
63
+ 'callback' => 'members_edit_role_help_role_name_cb'
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Edit role edit caps help tab args.
69
+ *
70
+ * @since 1.0.0
71
+ * @access public
72
+ * @return array
73
+ */
74
+ function members_get_edit_role_help_edit_caps_args() {
75
+
76
+ return array(
77
+ 'id' => 'edit-capabilities',
78
+ 'title' => esc_html__( 'Edit Capabilities', 'members' ),
79
+ 'callback' => 'members_edit_role_help_edit_caps_cb'
80
+ );
81
+ }
82
+
83
+ /**
84
+ * Edit role custom cap help tab args.
85
+ *
86
+ * @since 1.0.0
87
+ * @access public
88
+ * @return array
89
+ */
90
+ function members_get_edit_role_help_custom_cap_args() {
91
+
92
+ return array(
93
+ 'id' => 'custom-capability',
94
+ 'title' => esc_html__( 'Custom Capability', 'members' ),
95
+ 'callback' => 'members_edit_role_help_custom_cap_cb'
96
+ );
97
+ }
98
+
99
+ /**
100
+ * Edit role overview help tab callback function.
101
+ *
102
+ * @since 1.0.0
103
+ * @access public
104
+ * @return void
105
+ */
106
+ function members_edit_role_help_overview_cb() { ?>
107
+
108
+ <p>
109
+ <?php esc_html_e( 'This screen allows you to edit an individual role and its capabilities.', 'members' ); ?>
110
+ <p>
111
+ <?php }
112
+
113
+ /**
114
+ * Edit role name help tab callback function.
115
+ *
116
+ * @since 1.0.0
117
+ * @access public
118
+ * @return void
119
+ */
120
+ function members_edit_role_help_role_name_cb() { ?>
121
+
122
+ <p>
123
+ <?php esc_html_e( 'The role name field allows you to enter a human-readable name for your role.', 'members' ); ?>
124
+ </p>
125
+
126
+ <p>
127
+ <?php esc_html_e( 'The machine-readable version of the role appears below the name field, which you can edit. This can only have lowercase letters, numbers, or underscores.', 'members' ); ?>
128
+ </p>
129
+ <?php }
130
+
131
+ /**
132
+ * Edit role edit caps help tab callback function.
133
+ *
134
+ * @since 1.0.0
135
+ * @access public
136
+ * @return void
137
+ */
138
+ function members_edit_role_help_edit_caps_cb() { ?>
139
+
140
+ <p>
141
+ <?php esc_html_e( 'The capabilities edit box is made up of tabs that separate capabilities into groups. You may take the following actions for each capability:', 'members' ); ?>
142
+ </p>
143
+
144
+ <ul>
145
+ <li><?php _e( '<strong>Grant</strong> allows you to grant the role a capability.', 'members' ); ?></li>
146
+ <li><?php _e( '<strong>Deny</strong> allows you to explicitly deny the role a capability.', 'members' ); ?></li>
147
+ <li><?php esc_html_e( 'You may also opt to neither grant nor deny the role a capability.', 'members' ); ?></li>
148
+ </ul>
149
+ <?php }
150
+
151
+ /**
152
+ * Edit role custom cap help tab callback function.
153
+ *
154
+ * @since 1.0.0
155
+ * @access public
156
+ * @return void
157
+ */
158
+ function members_edit_role_help_custom_cap_cb() { ?>
159
+
160
+ <p>
161
+ <?php esc_html_e( 'The custom capability box allows you to create a custom capability for the role. After hitting the Add New button, it will add the capability to the Custom tab in the Edit Capabilities box.', 'members' ); ?>
162
+ </p>
163
+ <?php }
admin/functions-role-groups.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Role groups API. Offers a standardized method for creating role groups.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Registers default groups.
14
+ add_action( 'init', 'members_register_role_groups', 15 );
15
+
16
+ /**
17
+ * Returns the instance of the `Members_Role_Group_Factory` object. Use this function to access the object.
18
+ *
19
+ * @see Members_Role_Group_Factory
20
+ * @since 1.0.0
21
+ * @access public
22
+ * @return object
23
+ */
24
+ function members_role_group_factory() {
25
+ return Members_Role_Group_Factory::get_instance();
26
+ }
27
+
28
+ /**
29
+ * Function for registering a role group.
30
+ *
31
+ * @see Members_Role_Group_Factory::register_group()
32
+ * @since 1.0.0
33
+ * @access public
34
+ * @param string $name
35
+ * @param array $args
36
+ * @return void
37
+ */
38
+ function members_register_role_group( $name, $args = array() ) {
39
+ members_role_group_factory()->register_group( $name, $args );
40
+ }
41
+
42
+ /**
43
+ * Unregisters a group.
44
+ *
45
+ * @see Members_Role_Group_Factory::unregister_group()
46
+ * @since 1.0.0
47
+ * @access public
48
+ * @param string $name
49
+ * @return void
50
+ */
51
+ function members_unregister_role_group( $name ) {
52
+ members_role_group_factory()->unregister_group( $name );
53
+ }
54
+
55
+ /**
56
+ * Checks if a group exists.
57
+ *
58
+ * @see Members_Role_Group_Factory::group_exists()
59
+ * @since 1.0.0
60
+ * @access public
61
+ * @param string $name
62
+ * @return bool
63
+ */
64
+ function members_role_group_exists( $name ) {
65
+ return members_role_group_factory()->group_exists( $name );
66
+ }
67
+
68
+ /**
69
+ * Returns an array of registered group objects.
70
+ *
71
+ * @see Members_Role_Group_Factory::group
72
+ * @since 1.0.0
73
+ * @access public
74
+ * @return array
75
+ */
76
+ function members_get_role_groups() {
77
+ return members_role_group_factory()->groups;
78
+ }
79
+
80
+ /**
81
+ * Returns a group object if it exists. Otherwise, `FALSE`.
82
+ *
83
+ * @see Members_Role_Group_Factory::get_group()
84
+ * @see Members_Role_Group
85
+ * @since 1.0.0
86
+ * @access public
87
+ * @param string $name
88
+ * @return object|bool
89
+ */
90
+ function members_get_role_group( $name ) {
91
+ return members_role_group_factory()->get_group( $name );
92
+ }
93
+
94
+ /**
95
+ * Registers the default role groups.
96
+ *
97
+ * @since 1.0.0
98
+ * @access public
99
+ * @return void
100
+ */
101
+ function members_register_role_groups() {
102
+
103
+ // Get the current user.
104
+ $current_user = wp_get_current_user();
105
+
106
+ if ( is_object( $current_user ) ) {
107
+
108
+ // Register the mine group.
109
+ members_register_role_group( 'mine',
110
+ array(
111
+ 'label' => esc_html__( 'Mine', 'members' ),
112
+ 'label_count' => _n_noop( 'Mine %s', 'Mine %s', 'members' ),
113
+ 'roles' => $current_user->roles,
114
+ )
115
+ );
116
+ }
117
+
118
+ // Register the active group.
119
+ members_register_role_group( 'active',
120
+ array(
121
+ 'label' => esc_html__( 'Has Users', 'members' ),
122
+ 'label_count' => _n_noop( 'Has Users %s', 'Has Users %s', 'members' ),
123
+ 'roles' => array(), // These will be updated on the fly b/c it requires counting users.
124
+ )
125
+ );
126
+
127
+ // Register the inactive group.
128
+ members_register_role_group( 'inactive',
129
+ array(
130
+ 'label' => esc_html__( 'No Users', 'members' ),
131
+ 'label_count' => _n_noop( 'No Users %s', 'No Users %s', 'members' ),
132
+ 'roles' => array(), // These will be updated on the fly b/c it requires counting users.
133
+ )
134
+ );
135
+
136
+ // Register the editable group.
137
+ members_register_role_group( 'editable',
138
+ array(
139
+ 'label' => esc_html__( 'Editable', 'members' ),
140
+ 'label_count' => _n_noop( 'Editable %s', 'Editable %s', 'members' ),
141
+ 'roles' => members_get_editable_role_slugs(),
142
+ )
143
+ );
144
+
145
+ // Register the uneditable group.
146
+ members_register_role_group( 'uneditable',
147
+ array(
148
+ 'label' => esc_html__( 'Uneditable', 'members' ),
149
+ 'label_count' => _n_noop( 'Uneditable %s', 'Uneditable %s', 'members' ),
150
+ 'roles' => members_get_uneditable_role_slugs(),
151
+ )
152
+ );
153
+
154
+ // Register the WordPress group.
155
+ members_register_role_group( 'wordpress',
156
+ array(
157
+ 'label' => esc_html__( 'WordPress', 'members' ),
158
+ 'label_count' => _n_noop( 'WordPress %s', 'WordPress %s', 'members' ),
159
+ 'roles' => members_get_wordpress_role_slugs(),
160
+ )
161
+ );
162
+
163
+ // Hook for registering role groups. Plugins should always register on this hook.
164
+ do_action( 'members_register_role_groups' );
165
+ }
admin/meta-box-plugin-settings.php DELETED
@@ -1,172 +0,0 @@
1
- <?php
2
- /**
3
- * Creates and adds the meta boxes to the Members Settings page in the admin.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Add the meta boxes for the settings page on the 'add_meta_boxes' hook. */
10
- add_action( 'add_meta_boxes', 'members_settings_page_create_meta_boxes' );
11
-
12
- /**
13
- * Adds the meta boxes to the Members plugin settings page.
14
- *
15
- * @since 0.2.0
16
- */
17
- function members_settings_page_create_meta_boxes() {
18
- global $members;
19
-
20
- /* Add the 'About' meta box. */
21
- add_meta_box( 'members-about', _x( 'About', 'meta box', 'members' ), 'members_meta_box_display_about', $members->settings_page, 'side', 'default' );
22
-
23
- /* Add the 'Donate' meta box. */
24
- add_meta_box( 'members-donate', _x( 'Like this plugin?', 'meta box', 'members' ), 'members_meta_box_display_donate', $members->settings_page, 'side', 'high' );
25
-
26
- /* Add the 'Support' meta box. */
27
- add_meta_box( 'members-support', _x( 'Support', 'meta box', 'members' ), 'members_meta_box_display_support', $members->settings_page, 'side', 'low' );
28
-
29
- /* Add the 'Role Manager' meta box. */
30
- add_meta_box( 'members-role-manager', _x( 'Role Manager', 'meta box', 'members' ), 'members_meta_box_display_role_manager', $members->settings_page, 'normal', 'high' );
31
-
32
- /* Add the 'Content Permissions' meta box. */
33
- add_meta_box( 'members-content-permissions', _x( 'Content Permissions', 'meta box', 'members' ), 'members_meta_box_display_content_permissions', $members->settings_page, 'normal', 'high' );
34
-
35
- /* Add the 'Sidebar Widgets' meta box. */
36
- add_meta_box( 'members-widgets', _x( 'Sidebar Widgets', 'meta box', 'members' ), 'members_meta_box_display_widgets', $members->settings_page, 'normal', 'high' );
37
-
38
- /* Add the 'Private Site' meta box. */
39
- add_meta_box( 'members-private-site', _x( 'Private Site', 'meta box', 'members' ), 'members_meta_box_display_private_site', $members->settings_page, 'normal', 'high' );
40
- }
41
-
42
- /**
43
- * Displays the about plugin meta box.
44
- *
45
- * @since 0.2.0
46
- */
47
- function members_meta_box_display_about( $object, $box ) {
48
-
49
- $plugin_data = get_plugin_data( MEMBERS_DIR . 'members.php' ); ?>
50
-
51
- <p>
52
- <strong><?php _e( 'Version:', 'members' ); ?></strong> <?php echo $plugin_data['Version']; ?>
53
- </p>
54
- <p>
55
- <strong><?php _e( 'Description:', 'members' ); ?></strong>
56
- </p>
57
- <p>
58
- <?php echo $plugin_data['Description']; ?>
59
- </p>
60
- <?php }
61
-
62
- /**
63
- * Displays the donation meta box.
64
- *
65
- * @since 0.2.0
66
- */
67
- function members_meta_box_display_donate( $object, $box ) { ?>
68
-
69
- <p><?php _e( "Here's how you can give back:", 'members' ); ?></p>
70
-
71
- <ul>
72
- <li><a href="http://wordpress.org/extend/plugins/members" title="<?php esc_attr_e( 'Members on the WordPress plugin repository', 'members' ); ?>"><?php _e( 'Give the plugin a good rating.', 'members' ); ?></a></li>
73
- <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=3687060" title="<?php esc_attr_e( 'Donate via PayPal', 'members' ); ?>"><?php _e( 'Donate a few dollars.', 'members' ); ?></a></li>
74
- <li><a href="http://amzn.com/w/31ZQROTXPR9IS" title="<?php esc_attr_e( "Justin Tadlock's Amazon Wish List", 'members' ); ?>"><?php _e( 'Get me something from my wish list.', 'members' ); ?></a></li>
75
- </ul>
76
- <?php
77
- }
78
-
79
- /**
80
- * Displays the support meta box.
81
- *
82
- * @since 0.2.0
83
- */
84
- function members_meta_box_display_support( $object, $box ) { ?>
85
- <p>
86
- <?php printf( __( 'Support for this plugin is provided via the support forums at %1$s. If you need any help using it, please ask your support questions there.', 'members' ), '<a href="http://themehybrid.com/support" title="' . esc_attr__( 'Theme Hybrid Support Forums', 'members' ) . '">' . __( 'Theme Hybrid', 'members' ) . '</a>' ); ?>
87
- </p>
88
- <?php }
89
-
90
- /**
91
- * Displays the role manager meta box.
92
- *
93
- * @since 0.2.0
94
- */
95
- function members_meta_box_display_role_manager( $object, $box ) { ?>
96
-
97
- <p>
98
- <input type="checkbox" name="members_settings[role_manager]" id="members_settings-role_manager" value="1" <?php checked( 1, members_get_setting( 'role_manager' ) ); ?> />
99
- <label for="members_settings-role_manager"><?php _e( 'Enable the role manager.', 'members' ); ?></label>
100
- </p>
101
- <p>
102
- <span class="howto"><?php _e( 'Your roles and capabilities will not revert back to their previous settings after deactivating or uninstalling this plugin, so use this feature wisely.', 'members' ); ?></span>
103
- </p>
104
-
105
- <?php }
106
-
107
- /**
108
- * Displays the content permissions meta box.
109
- *
110
- * @since 0.2.0
111
- */
112
- function members_meta_box_display_content_permissions( $object, $box ) { ?>
113
-
114
- <p>
115
- <input type="checkbox" name="members_settings[content_permissions]" id="members_settings-content_permissions" value="1" <?php checked( 1, members_get_setting( 'content_permissions' ) ); ?> />
116
- <label for="members_settings-content_permissions"><?php _e( 'Enable the content permissions feature.', 'members' ); ?></label>
117
- </p>
118
-
119
- <p>
120
- <label for="members_settings-content_permissions_error"><?Php _e( 'Default post error message:', 'members' ); ?></label>
121
- <textarea name="members_settings[content_permissions_error]" id="members_settings-content_permissions_error"><?php echo esc_textarea( members_get_setting( 'content_permissions_error' ) ); ?></textarea>
122
- <label for="members_settings-content_permissions_error"><?php _e( 'You can use <abbr title="Hypertext Markup Language">HTML</abbr> and/or shortcodes to create a custom error message for users that don\'t have permission to view posts.', 'members' ); ?></label>
123
- </p>
124
-
125
- <?php }
126
-
127
- /**
128
- * Displays the widgets meta box.
129
- *
130
- * @since 0.2.0
131
- */
132
- function members_meta_box_display_widgets( $object, $box ) { ?>
133
-
134
- <p>
135
- <input type="checkbox" name="members_settings[login_form_widget]" id="members_settings-login_form_widget" value="1" <?php checked( 1, members_get_setting( 'login_form_widget' ) ); ?> />
136
- <label for="members_settings-login_form_widget"><?php _e( 'Enable the login form widget.', 'members' ); ?></label>
137
- </p>
138
-
139
- <p>
140
- <input type="checkbox" name="members_settings[users_widget]" id="members_settings-users_widget" value="1" <?php checked( 1, members_get_setting( 'users_widget' ) ); ?> />
141
- <label for="members_settings-users_widget"><?php _e( 'Enable the users widget.', 'members' ); ?></label>
142
- </p>
143
-
144
- <?php }
145
-
146
- /**
147
- * Displays the private site meta box.
148
- *
149
- * @since 0.2.0
150
- */
151
- function members_meta_box_display_private_site( $object, $box ) { ?>
152
-
153
- <p>
154
- <input type="checkbox" name="members_settings[private_blog]" id="members_settings-private_blog" value="1" <?php checked( 1, members_get_setting( 'private_blog' ) ); ?> />
155
- <label for="members_settings-private_blog"><?php _e( 'Redirect all logged-out users to the login page before allowing them to view the site.', 'members' ); ?></label>
156
- </p>
157
-
158
- <p>
159
- <input type="checkbox" name="members_settings[private_feed]" id="members_settings-private_feed" value="1" <?php checked( 1, members_get_setting( 'private_feed' ) ); ?> />
160
- <label for="members_settings-private_feed"><?php _e( 'Show error message for feed items.', 'members' ); ?></label>
161
- </p>
162
-
163
- <p>
164
- <label for="members_settings-private_feed_error"><?php _e( 'Feed error message:', 'members' ); ?></label>
165
- <textarea name="members_settings[private_feed_error]" id="members_settings-private_feed_error"><?php echo esc_textarea( members_get_setting( 'private_feed_error' ) ); ?></textarea>
166
- <br />
167
- <label for="members_settings-private_feed_error"><?php _e( 'You can use <abbr title="Hypertext Markup Language">HTML</abbr> and/or shortcodes to create a custom error message to display instead of feed item content.', 'members' ); ?></label>
168
- </p>
169
-
170
- <?php }
171
-
172
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/meta-box-post-content-permissions.php DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
- /**
3
- * @todo Add inline styles the the admin.css stylesheet.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Adds the content permissions meta box to the 'add_meta_boxes' hook. */
10
- add_action( 'add_meta_boxes', 'members_content_permissions_create_meta_box' );
11
-
12
- /* Saves the content permissions metabox data to a custom field. */
13
- add_action( 'save_post', 'members_content_permissions_save_meta', 10, 2 );
14
- add_action( 'add_attachment', 'members_content_permissions_save_meta' );
15
- add_action( 'edit_attachment', 'members_content_permissions_save_meta' );
16
-
17
- /**
18
- * @since 0.1.0
19
- */
20
- function members_content_permissions_create_meta_box() {
21
-
22
- /* Only add the meta box if the current user has the 'restrict_content' capability. */
23
- if ( current_user_can( 'restrict_content' ) ) {
24
-
25
- /* Get all available public post types. */
26
- $post_types = get_post_types( array( 'public' => true ), 'objects' );
27
-
28
- /* Loop through each post type, adding the meta box for each type's post editor screen. */
29
- foreach ( $post_types as $type )
30
- add_meta_box( 'content-permissions-meta-box', __( 'Content Permissions', 'members' ), 'members_content_permissions_meta_box', $type->name, 'advanced', 'high' );
31
- }
32
- }
33
-
34
- /**
35
- * @since 0.1.0
36
- */
37
- function members_content_permissions_meta_box( $object, $box ) {
38
- global $wp_roles;
39
-
40
- /* Get the roles saved for the post. */
41
- $roles = get_post_meta( $object->ID, '_members_access_role', false );
42
-
43
- /* Convert old post meta to the new system if no roles were found. */
44
- if ( empty( $roles ) )
45
- $roles = members_convert_old_post_meta( $object->ID );
46
- ?>
47
-
48
- <input type="hidden" name="content_permissions_meta_nonce" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
49
-
50
- <div style="overflow: hidden; margin-left: 5px;">
51
-
52
- <p>
53
- <?php _e( "Limit access to this post's content to users of the selected roles.", 'members' ); ?>
54
- </p>
55
-
56
- <?php
57
-
58
- /* Loop through each of the available roles. */
59
- foreach ( $wp_roles->role_names as $role => $name ) {
60
- $checked = false;
61
-
62
- /* If the role has been selected, make sure it's checked. */
63
- if ( is_array( $roles ) && in_array( $role, $roles ) )
64
- $checked = ' checked="checked" '; ?>
65
-
66
- <div style="width: 32%; float: left; margin: 0 0 5px 0;">
67
- <label for="members_access_role-<?php echo $role; ?>">
68
- <input type="checkbox" name="members_access_role[<?php echo $role; ?>]" id="members_access_role-<?php echo $role; ?>" <?php echo $checked; ?> value="<?php echo $role; ?>" />
69
- <?php echo esc_html( $name ); ?>
70
- </label>
71
- </div>
72
- <?php } ?>
73
-
74
- </div>
75
-
76
- <p style="clear: left;">
77
- <span class="howto"><?php printf( __( 'If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role.', 'members' ), '<code>restrict_content</code>' ); ?></span>
78
- </p>
79
-
80
- <p>
81
- <label for="members_access_error"><?php _e( 'Custom error messsage:', 'members' ); ?></label>
82
- <textarea id="members_access_error" name="members_access_error" cols="60" rows="2" tabindex="30" style="width: 99%;"><?php echo esc_html( get_post_meta( $object->ID, '_members_access_error', true ) ); ?></textarea>
83
- <br />
84
- <span class="howto"><?php _e( 'Message shown to users that do no have permission to view the post.', 'members' ); ?></span>
85
- </p>
86
-
87
- <?php
88
- }
89
-
90
- /**
91
- * @since 0.1.0
92
- */
93
- function members_content_permissions_save_meta( $post_id, $post = '' ) {
94
- global $wp_roles;
95
-
96
- /* Fix for attachment save issue in WordPress 3.5. @link http://core.trac.wordpress.org/ticket/21963 */
97
- if ( !is_object( $post ) )
98
- $post = get_post();
99
-
100
- /* Verify the nonce. */
101
- if ( !isset( $_POST['content_permissions_meta_nonce'] ) || !wp_verify_nonce( $_POST['content_permissions_meta_nonce'], plugin_basename( __FILE__ ) ) )
102
- return false;
103
-
104
- if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
105
- if ( defined('DOING_AJAX') && DOING_AJAX ) return;
106
- if ( defined('DOING_CRON') && DOING_CRON ) return;
107
-
108
- /* Get the post type object. */
109
- $post_type = get_post_type_object( $post->post_type );
110
-
111
- /* Check if the current user has permission to edit the post. */
112
- if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
113
- return $post_id;
114
-
115
- /* Don't save if the post is only a revision. */
116
- if ( 'revision' == $post->post_type )
117
- return;
118
-
119
- $meta_values = get_post_meta( $post_id, '_members_access_role', false );
120
-
121
- if ( isset( $_POST['members_access_role'] ) && is_array( $_POST['members_access_role'] ) ) {
122
-
123
- foreach ( $_POST['members_access_role'] as $role ) {
124
- if ( !in_array( $role, $meta_values ) )
125
- add_post_meta( $post_id, '_members_access_role', $role, false );
126
- }
127
-
128
- foreach ( $wp_roles->role_names as $role => $name ) {
129
- if ( !in_array( $role, $_POST['members_access_role'] ) && in_array( $role, $meta_values ) )
130
- delete_post_meta( $post_id, '_members_access_role', $role );
131
- }
132
- }
133
- elseif ( !empty( $meta_values ) ) {
134
- delete_post_meta( $post_id, '_members_access_role' );
135
- }
136
-
137
- $meta = array(
138
- '_members_access_error' => esc_html( $_POST['members_access_error'] )
139
- );
140
-
141
- foreach ( $meta as $meta_key => $new_meta_value ) {
142
-
143
- /* Get the meta value of the custom field key. */
144
- $meta_value = get_post_meta( $post_id, $meta_key, true );
145
-
146
- /* If a new meta value was added and there was no previous value, add it. */
147
- if ( $new_meta_value && '' == $meta_value )
148
- add_post_meta( $post_id, $meta_key, $new_meta_value, true );
149
-
150
- /* If the new meta value does not match the old value, update it. */
151
- elseif ( $new_meta_value && $new_meta_value != $meta_value )
152
- update_post_meta( $post_id, $meta_key, $new_meta_value );
153
-
154
- /* If there is no new meta value but an old value exists, delete it. */
155
- elseif ( '' == $new_meta_value && $meta_value )
156
- delete_post_meta( $post_id, $meta_key, $meta_value );
157
- }
158
-
159
- }
160
-
161
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/role-edit.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles the display of the edit role form and the updates submitted by the user for the role.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Get the current role object to edit. */
10
- $role = get_role( esc_attr( strip_tags( $_GET['role'] ) ) );
11
-
12
- /* Get all the capabilities */
13
- $capabilities = members_get_capabilities();
14
-
15
- /* Check if the current user can edit roles and the form has been submitted. */
16
- if ( current_user_can( 'edit_roles' ) && ( isset( $_POST['role-caps'] ) || isset( $_POST['new-cap'] ) ) ) {
17
-
18
- /* Verify the nonce. */
19
- check_admin_referer( members_get_nonce( 'edit-roles' ) );
20
-
21
- /* Set the $role_updated variable to true. */
22
- $role_updated = true;
23
-
24
- /* Loop through all available capabilities. */
25
- foreach ( $capabilities as $cap ) {
26
-
27
- /* Get the posted capability. */
28
- $posted_cap = isset( $_POST['role-caps']["{$role->name}-{$cap}"] ) ? $_POST['role-caps']["{$role->name}-{$cap}"] : false;
29
-
30
- /* If the role doesn't have the capability and it was selected, add it. */
31
- if ( !$role->has_cap( $cap ) && !empty( $posted_cap ) )
32
- $role->add_cap( $cap );
33
-
34
- /* If the role has the capability and it wasn't selected, remove it. */
35
- elseif ( $role->has_cap( $cap ) && empty( $posted_cap ) )
36
- $role->remove_cap( $cap );
37
-
38
- } // End loop through existing capabilities
39
-
40
- /* If new caps were added and are in an array, we need to add them. */
41
- if ( !empty( $_POST['new-cap'] ) && is_array( $_POST['new-cap'] ) ) {
42
-
43
- /* Loop through each new capability from the edit roles form. */
44
- foreach ( $_POST['new-cap'] as $new_cap ) {
45
-
46
- /* Sanitize the new capability to remove any unwanted characters. */
47
- $new_cap = sanitize_key( $new_cap );
48
-
49
- /* Run one more check to make sure the new capability exists. Add the cap to the role. */
50
- if ( !empty( $new_cap ) && !$role->has_cap( $new_cap ) )
51
- $role->add_cap( $new_cap );
52
-
53
- } // End loop through new capabilities
54
-
55
- /* If new caps are added, we need to reset the $capabilities array. */
56
- $capabilities = members_get_capabilities();
57
-
58
- } // End check for new capabilities
59
-
60
- } // End check for form submission ?>
61
-
62
- <div class="wrap">
63
-
64
- <?php screen_icon(); ?>
65
-
66
- <h2>
67
- <?php _e( 'Edit Role', 'members' ); ?>
68
- <?php if ( current_user_can( 'create_roles' ) ) echo '<a href="' . admin_url( 'users.php?page=role-new' ) . '" class="add-new-h2">' . __( 'Add New', 'members' ) . '</a>'; ?>
69
- </h2>
70
-
71
- <?php if ( !empty( $role_updated ) ) echo '<div class="updated"><p><strong>' . __( 'Role updated.', 'members' ) . '</strong></p><p><a href="' . admin_url( 'users.php?page=roles' ) . '">' . __( '&larr; Back to Roles', 'members' ) . '</a></p></div>'; ?>
72
-
73
- <?php do_action( 'members_pre_edit_role_form' ); //Available pre-form hook for displaying messages. ?>
74
-
75
- <div id="poststuff">
76
-
77
- <form name="form0" method="post" action="<?php echo admin_url( esc_url( "users.php?page=roles&amp;action=edit&amp;role={$role->name}" ) ); ?>">
78
-
79
- <?php wp_nonce_field( members_get_nonce( 'edit-roles' ) ); ?>
80
-
81
- <table class="form-table">
82
-
83
- <tr>
84
- <th>
85
- <?php _e( 'Role Name', 'members' ); ?>
86
- </th>
87
- <td>
88
- <input type="text" disabled="disabled" readonly="readonly" value="<?php echo esc_attr( $role->name ); ?>" />
89
- </td>
90
- </tr>
91
-
92
- <tr>
93
- <th>
94
- <?php _e( 'Capabilities', 'members' ); ?>
95
- </th>
96
-
97
- <td>
98
- <?php $i = -1; foreach ( $capabilities as $cap ) { ?>
99
-
100
- <div class="members-role-checkbox <?php if ( ++$i % 3 == 0 ) echo 'clear'; ?>">
101
- <?php $has_cap = ( $role->has_cap( $cap ) ? true : false ); ?>
102
- <input type="checkbox" name="<?php echo esc_attr( "role-caps[{$role->name}-{$cap}]" ); ?>" id="<?php echo esc_attr( "{$role->name}-{$cap}" ); ?>" <?php checked( true, $has_cap ); ?> value="true" />
103
- <label for="<?php echo esc_attr( "{$role->name}-{$cap}" ); ?>" class="<?php echo ( $has_cap ? 'has-cap' : 'has-cap-not' ); ?>"><?php echo $cap; ?></label>
104
- </div>
105
-
106
- <?php } // Endforeach ?>
107
- </td>
108
- </tr>
109
-
110
- <tr>
111
- <th>
112
- <?php _e( 'Custom Capabilities', 'members' ); ?>
113
- </th>
114
- <td>
115
-
116
- <p class="members-add-new-cap-wrap clear hide-if-no-js">
117
- <a class="button-secondary" id="members-add-new-cap"><?php _e( 'Add New Capability', 'members' ); ?></a>
118
- </p>
119
- <p class="new-cap-holder">
120
- <input type="text" class="new-cap hide-if-js" name="new-cap[]" value="" size="20" />
121
- </p>
122
- </td>
123
- </tr>
124
-
125
- </table><!-- .form-table -->
126
-
127
- <?php submit_button( esc_attr__( 'Update Role', 'members' ) ); ?>
128
-
129
- </form>
130
-
131
- </div><!-- #poststuff -->
132
-
133
- </div><!-- .wrap -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/role-new.php DELETED
@@ -1,108 +0,0 @@
1
- <?php
2
- /**
3
- * Displays and processes the 'Add New Role' page in the admin.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Check if the current user can create roles and the form has been submitted. */
10
- if ( current_user_can( 'create_roles' ) && isset( $_POST['role-name'] ) && isset( $_POST['role-label'] ) ) {
11
-
12
- /* Verify the nonce. */
13
- check_admin_referer( members_get_nonce( 'new-role' ) );
14
-
15
- /* Check if any capabilities were selected. */
16
- if ( !empty( $_POST['capabilities'] ) && is_array( $_POST['capabilities'] ) )
17
- $new_role_caps = array_map( 'esc_attr', $_POST['capabilities'] );
18
-
19
- /* If no capabilities were selected, set the variable to null. */
20
- else
21
- $new_role_caps = null;
22
-
23
- /* Check if both a role name and role were submitted. */
24
- if ( !empty( $_POST['role-name'] ) && !empty( $_POST['role-label'] ) ) {
25
-
26
- /* Sanitize the new role, removing any unwanted characters. */
27
- $new_role_name = sanitize_key( $_POST['role-name'] );
28
-
29
- /* Sanitize the new role name/label. We just want to strip any tags here. */
30
- $new_role_label = strip_tags( $_POST['role-label'] );
31
-
32
- /* Add a new role with the data input. */
33
- if ( !empty( $new_role_name ) && !empty( $new_role_label ) )
34
- $new_role_added = add_role( $new_role_name, $new_role_label, $new_role_caps );
35
-
36
- } // End check for role and role name
37
-
38
- } // End check for form submit ?>
39
-
40
- <div class="wrap">
41
-
42
- <?php screen_icon(); ?>
43
-
44
- <h2><?php _e( 'Add New Role', 'members' ); ?></h2>
45
-
46
- <?php if ( !empty( $new_role_added ) ) members_admin_message( '', sprintf( __( 'The %s role has been created.', 'members' ), esc_html( $_POST['role-name'] ) ) ); ?>
47
-
48
- <?php do_action( 'members_pre_new_role_form' ); // Available action hook for displaying messages. ?>
49
-
50
- <div id="poststuff">
51
-
52
- <form name="form0" method="post" action="<?php echo admin_url( 'users.php?page=role-new' ); ?>">
53
-
54
- <?php wp_nonce_field( members_get_nonce( 'new-role' ) ); ?>
55
-
56
- <table class="form-table">
57
-
58
- <tr>
59
- <th>
60
- <label for="role-name"><?php _e( 'Role Name', 'members' ); ?></label>
61
- </th>
62
- <td>
63
- <input type="text" id="role-name" name="role-name" value="" size="30" />
64
- <br />
65
- <label for="role-name"><?php _e( "<strong>Required:</strong> The role name should be unique and contain only alphanumeric characters and underscores.", 'members' ); ?></label>
66
- </td>
67
- </tr>
68
-
69
- <tr>
70
- <th>
71
- <label for="role-label"><?php _e( 'Role Label', 'members' ); ?></label>
72
- </th>
73
- <td>
74
- <input type="text" id="role-label" name="role-label" value="" size="30" />
75
- <br />
76
- <label for="role-label"><?php _e( '<strong>Required:</strong> The role label is used to represent your role in the WordPress admin.', 'members' ); ?></label>
77
- </td>
78
- </tr>
79
-
80
- <tr>
81
- <th>
82
- <?php _e( 'Role Capabilities', 'members' ); ?>
83
- </th>
84
- <td>
85
- <p>
86
- <?php _e( '<strong>Optional:</strong> Select the capabilities this role should have. These may be updated later.', 'members' ); ?>
87
- </p>
88
-
89
- <?php $i = -1; foreach ( members_get_capabilities() as $cap ) { ?>
90
-
91
- <div class="members-role-checkbox <?php if ( ++$i % 3 == 0 ) echo 'clear'; ?>">
92
- <input type="checkbox" name="capabilities[<?php echo esc_attr( $cap ); ?>]" id="capabilities-<?php echo esc_attr( $cap ); ?>" <?php checked( true, in_array( $cap, members_new_role_default_capabilities() ) ); ?> value="true" />
93
- <label for="capabilities-<?php echo esc_attr( $cap ); ?>" class="<?php echo ( in_array( $cap, members_new_role_default_capabilities() ) ? 'has-cap' : 'has-cap-not' ); ?>"><?php echo $cap; ?></label>
94
- </div>
95
-
96
- <?php } // Endforeach ?>
97
- </td>
98
- </tr>
99
-
100
- </table><!-- .form-table -->
101
-
102
- <?php submit_button( esc_attr__( 'Add Role', 'members' ) ); ?>
103
-
104
- </form>
105
-
106
- </div><!-- #poststuff -->
107
-
108
- </div><!-- .poststuff -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/roles-list-table.php DELETED
@@ -1,238 +0,0 @@
1
- <?php
2
- /**
3
- * This file handles the display of the 'Roles' page in the admin.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Get a count of all the roles available. */
10
- $roles_count = members_count_roles();
11
-
12
- /* Get all of the active and inactive roles. */
13
- $active_roles = members_get_active_roles();
14
- $inactive_roles = members_get_inactive_roles();
15
-
16
- /* Get a count of the active and inactive roles. */
17
- $active_roles_count = count( $active_roles );
18
- $inactive_roles_count = count( $inactive_roles );
19
-
20
- /* If we're viewing 'active' or 'inactive' roles. */
21
- if ( !empty( $_GET['role_status'] ) && in_array( $_GET['role_status'], array( 'active', 'inactive' ) ) ) {
22
-
23
- /* Get the role status ('active' or 'inactive'). */
24
- $role_status = esc_attr( $_GET['role_status'] );
25
-
26
- /* Set up the roles array. */
27
- $list_roles = ( ( 'active' == $role_status ) ? $active_roles : $inactive_roles );
28
-
29
- /* Set the current page URL. */
30
- $current_page = admin_url( "users.php?page=roles&role_status={$role_status}" );
31
- }
32
-
33
- /* If viewing the regular role list table. */
34
- else {
35
-
36
- /* Get the role status ('active' or 'inactive'). */
37
- $role_status = 'all';
38
-
39
- /* Set up the roles array. */
40
- $list_roles = array_merge( $active_roles, $inactive_roles );
41
-
42
- /* Set the current page URL. */
43
- $current_page = $current_page = admin_url( 'users.php?page=roles' );
44
- }
45
-
46
- /* Sort the roles array into alphabetical order. */
47
- ksort( $list_roles ); ?>
48
-
49
- <div class="wrap">
50
-
51
- <?php screen_icon(); ?>
52
-
53
- <h2>
54
- <?php _e( 'Roles', 'members' ); ?>
55
- <?php if ( current_user_can( 'create_roles' ) ) echo '<a href="' . admin_url( 'users.php?page=role-new' ) . '" class="add-new-h2">' . __( 'Add New', 'members' ) . '</a>'; ?>
56
- </h2>
57
-
58
- <?php do_action( 'members_pre_edit_roles_form' ); // Available action hook for displaying messages. ?>
59
-
60
- <div id="poststuff">
61
-
62
- <form id="roles" action="<?php echo $current_page; ?>" method="post">
63
-
64
- <?php wp_nonce_field( members_get_nonce( 'edit-roles' ) ); ?>
65
-
66
- <ul class="subsubsub">
67
- <li><a <?php if ( 'all' == $role_status ) echo 'class="current"'; ?> href="<?php echo admin_url( esc_url( 'users.php?page=roles' ) ); ?>"><?php _e( 'All', 'members' ); ?> <span class="count">(<span id="all_count"><?php echo $roles_count; ?></span>)</span></a> | </li>
68
- <li><a <?php if ( 'active' == $role_status ) echo 'class="current"'; ?> href="<?php echo admin_url( esc_url( 'users.php?page=roles&amp;role_status=active' ) ); ?>"><?php _e( 'Has Users', 'members' ); ?> <span class="count">(<span id="active_count"><?php echo $active_roles_count; ?></span>)</span></a> | </li>
69
- <li><a <?php if ( 'inactive' == $role_status ) echo 'class="current"'; ?> href="<?php echo admin_url( esc_url( 'users.php?page=roles&amp;role_status=inactive' ) ); ?>"><?php _e( 'No Users', 'members' ); ?> <span class="count">(<span id="inactive_count"><?php echo $inactive_roles_count; ?></span>)</span></a></li>
70
- </ul><!-- .subsubsub -->
71
-
72
- <div class="tablenav">
73
-
74
- <?php if ( current_user_can( 'delete_roles' ) ) { ?>
75
-
76
- <div class="alignleft actions">
77
-
78
- <select name="bulk-action">
79
-
80
- <option value="" selected="selected"><?php _e( 'Bulk Actions', 'members' ); ?></option>
81
-
82
- <?php if ( current_user_can( 'delete_roles' ) ) { ?>
83
- <option value="delete"><?php esc_html_e( 'Delete', 'members' ); ?></option>
84
- <?php } ?>
85
-
86
- </select>
87
-
88
- <?php submit_button( esc_attr__( 'Apply', 'members' ), 'button-secondary action', 'roles-bulk-action', false ); ?>
89
-
90
- </div><!-- .alignleft .actions -->
91
-
92
- <?php } // End cap check ?>
93
-
94
- <div class='tablenav-pages one-page'>
95
- <span class="displaying-num"><?php printf( _n( '%s item', '%s items', count( $list_roles ), 'members' ), count( $list_roles ) ); ?></span>
96
- </div>
97
-
98
- <br class="clear" />
99
-
100
- </div><!-- .tablenav -->
101
-
102
- <table class="widefat fixed" cellspacing="0">
103
-
104
- <thead>
105
- <tr>
106
- <th class='check-column'><input type='checkbox' /></th>
107
- <th class='name-column'><?php _e( 'Role Label', 'members' ); ?></th>
108
- <th><?php _e( 'Role Name', 'members' ); ?></th>
109
- <th><?php _e( 'Users', 'members' ); ?></th>
110
- <th><?php _e( 'Capabilities', 'members' ); ?></th>
111
- </tr>
112
- </thead>
113
-
114
- <tfoot>
115
- <tr>
116
- <th class='check-column'><input type='checkbox' /></th>
117
- <th class='name-column'><?php _e( 'Role Label', 'members' ); ?></th>
118
- <th><?php _e( 'Role', 'members' ); ?></th>
119
- <th><?php _e( 'Users', 'members' ); ?></th>
120
- <th><?php _e( 'Capabilities', 'members' ); ?></th>
121
- </tr>
122
- </tfoot>
123
-
124
- <tbody id="users" class="list:user user-list plugins">
125
-
126
- <?php foreach ( $list_roles as $role => $name ) { ?>
127
-
128
- <tr valign="top" class="<?php echo ( isset( $active_roles[$role] ) ? 'active' : 'inactive' ); ?>">
129
-
130
- <th class="manage-column column-cb check-column">
131
-
132
- <?php if ( ( is_multisite() && is_super_admin() && $role !== get_option( 'default_role' ) ) || ( !current_user_can( $role ) && $role !== get_option( 'default_role' ) ) ) { ?>
133
- <input type="checkbox" name="roles[<?php echo esc_attr( $role ); ?>]" id="<?php echo esc_attr( $role ); ?>" value="<?php echo esc_attr( $role ); ?>" />
134
- <?php } ?>
135
-
136
- </th><!-- .manage-column .column-cb .check-column -->
137
-
138
- <td class="plugin-title">
139
-
140
- <?php $edit_link = admin_url( wp_nonce_url( "users.php?page=roles&amp;action=edit&amp;role={$role}", members_get_nonce( 'edit-roles' ) ) ); ?>
141
-
142
- <?php if ( current_user_can( 'edit_roles' ) ) { ?>
143
- <a href="<?php echo esc_url( $edit_link ); ?>" title="<?php printf( esc_attr__( 'Edit the %s role', 'members' ), $name ); ?>"><strong><?php echo esc_html( $name ); ?></strong></a>
144
- <?php } else { ?>
145
- <strong><?php echo esc_html( $name ); ?></strong>
146
- <?php } ?>
147
-
148
- <div class="row-actions">
149
-
150
- <?php if ( current_user_can( 'edit_roles' ) ) { ?>
151
- <a href="<?php echo esc_url( $edit_link ); ?>" title="<?php printf( esc_attr__( 'Edit the %s role', 'members' ), $name ); ?>"><?php _e( 'Edit', 'members' ); ?></a>
152
- <?php } ?>
153
-
154
- <?php if ( ( is_multisite() && is_super_admin() && $role !== get_option( 'default_role' ) ) || ( current_user_can( 'delete_roles' ) && $role !== get_option( 'default_role' ) && !current_user_can( $role ) ) ) { ?>
155
- | <a href="<?php echo admin_url( wp_nonce_url( "users.php?page=roles&amp;action=delete&amp;role={$role}", members_get_nonce( 'edit-roles' ) ) ); ?>" title="<?php printf( esc_attr__( 'Delete the %s role', 'members' ), $name ); ?>"><?php _e( 'Delete', 'members' ); ?></a>
156
- <?php } ?>
157
-
158
- <?php if ( current_user_can( 'manage_options' ) && $role == get_option( 'default_role' ) ) { ?>
159
- | <a href="<?php echo admin_url( ( 'options-general.php' ) ); ?>" title="<?php _e( 'Change default role', 'members' ); ?>"><?php _e( 'Default Role', 'members' ); ?></a>
160
- <?php } ?>
161
-
162
- <?php if ( current_user_can( 'list_users' ) ) { ?>
163
- | <a href="<?php echo admin_url( esc_url( "users.php?role={$role}" ) ); ?>" title="<?php printf( esc_attr__( 'View all users with the %s role', 'members' ), $name ); ?>"><?php _e( 'View Users', 'members' ); ?></a>
164
- <?php } ?>
165
-
166
- </div><!-- .row-actions -->
167
-
168
- </td><!-- .plugin-title -->
169
-
170
- <td class="desc">
171
- <p>
172
- <?php echo $role; ?>
173
- </p>
174
- </td><!-- .desc -->
175
-
176
- <td class="desc">
177
- <p>
178
- <?php if ( current_user_can( 'list_users' ) ) { ?>
179
- <a href="<?php echo admin_url( esc_url( "users.php?role={$role}" ) ); ?>" title="<?php printf( __( 'View all users with the %s role', 'members' ), $name ); ?>"><?php printf( _n( '%s User', '%s Users', members_get_role_user_count( $role ), 'members' ), members_get_role_user_count( $role ) ); ?></a>
180
- <?php } else { ?>
181
- <?php printf( _n( '%s User', '%s Users', members_get_role_user_count( $role ), 'members' ), members_get_role_user_count( $role ) ); ?>
182
- <?php } ?>
183
- </p>
184
- </td><!-- .desc -->
185
-
186
- <td class="desc">
187
- <p>
188
- <?php
189
- $role_object = get_role( $role );
190
- $cap_count = count( $role_object->capabilities );
191
- printf( _n( '%s Capability', '%s Capabilities', $cap_count, 'members' ), $cap_count );
192
- ?>
193
- </p>
194
- </td><!-- .desc -->
195
-
196
- </tr><!-- .active .inactive -->
197
-
198
- <?php } // End foreach ?>
199
-
200
- </tbody><!-- #users .list:user .user-list .plugins -->
201
-
202
- </table><!-- .widefat .fixed -->
203
-
204
- <div class="tablenav">
205
-
206
- <?php if ( current_user_can( 'delete_roles' ) ) { ?>
207
-
208
- <div class="alignleft actions">
209
-
210
- <select name="bulk-action-2">
211
-
212
- <option value="" selected="selected"><?php _e( 'Bulk Actions', 'members' ); ?></option>
213
-
214
- <?php if ( current_user_can( 'delete_roles' ) ) { ?>
215
- <option value="delete"><?php _e( 'Delete', 'members' ); ?></option>
216
- <?php } ?>
217
-
218
- </select>
219
-
220
- <?php submit_button( esc_attr__( 'Apply', 'members' ), 'button-secondary action', 'roles-bulk-action-2', false ); ?>
221
-
222
- </div><!-- .alignleft .actions -->
223
-
224
- <?php } // End cap check ?>
225
-
226
- <div class='tablenav-pages one-page'>
227
- <span class="displaying-num"><?php printf( _n( '%s item', '%s items', count( $list_roles ), 'members' ), count( $list_roles ) ); ?></span>
228
- </div>
229
-
230
- <br class="clear" />
231
-
232
- </div><!-- .tablenav -->
233
-
234
- </form><!-- #roles -->
235
-
236
- </div><!-- #poststuff -->
237
-
238
- </div><!-- .wrap -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/roles.php DELETED
@@ -1,111 +0,0 @@
1
- <?php
2
- /**
3
- * Handles the 'Roles' page in the admin. This file checks $_POST and $_GET data to decide which file should
4
- * be loaded.
5
- *
6
- * @package Members
7
- * @subpackage Admin
8
- */
9
-
10
- /* Get the current action performed by the user. */
11
- $action = isset( $_REQUEST['action'] ) ? esc_attr( $_REQUEST['action'] ) : false;
12
-
13
- /* If the bulk delete has been selected. */
14
- if ( ( isset( $_POST['bulk-action'] ) && 'delete' == $_POST['bulk-action'] ) || ( isset( $_POST['bulk-action-2'] ) && 'delete' == $_POST['bulk-action-2'] ) )
15
- $action = 'bulk-delete';
16
-
17
- /* Choose which actions to perform and pages to load according to the $action variable. */
18
- switch( $action ) {
19
-
20
- /* If the bulk delete was selected. */
21
- case 'bulk-delete' :
22
-
23
- /* Get all roles checked for deletion. */
24
- $delete_roles = $_POST['roles'];
25
-
26
- /* If roles were selected, let's delete some roles. */
27
- if ( current_user_can( 'delete_roles' ) && is_array( $delete_roles ) ) {
28
-
29
- /* Verify the nonce. */
30
- check_admin_referer( members_get_nonce( 'edit-roles' ) );
31
-
32
- /* Send through roles deleted message. */
33
- add_action( 'members_pre_edit_roles_form', 'members_message_roles_deleted' );
34
-
35
- /* Loop through each of the selected roles. */
36
- foreach ( $delete_roles as $role ) {
37
-
38
- /* Get the role we want to delete. */
39
- $role = esc_attr( strip_tags( $role ) );
40
-
41
- /* Delete the role and move its users to the default role. */
42
- if ( !empty( $role ) )
43
- members_delete_role( $role );
44
- }
45
- }
46
-
47
- /* Load the edit roles page. */
48
- require_once( MEMBERS_ADMIN . 'roles-list-table.php' );
49
-
50
- /* Break out of switch statement. */
51
- break;
52
-
53
- /* If a single role has been chosen to be deleted. */
54
- case 'delete' :
55
-
56
- /* Make sure the current user can delete roles. */
57
- if ( current_user_can( 'delete_roles' ) ) {
58
-
59
- /* Verify the referer. */
60
- check_admin_referer( members_get_nonce( 'edit-roles' ) );
61
-
62
- /* Send role deleted message. */
63
- add_action( 'members_pre_edit_roles_form', 'members_message_role_deleted' );
64
-
65
- /* Get the role we want to delete. */
66
- $role = esc_attr( strip_tags( $_GET['role'] ) );
67
-
68
- /* Delete the role and move its users to the default role. */
69
- if ( !empty( $role ) )
70
- members_delete_role( $role );
71
- }
72
-
73
- /* Load the edit roles page. */
74
- require_once( MEMBERS_ADMIN . 'roles-list-table.php' );
75
-
76
- /* Break out of switch statement. */
77
- break;
78
-
79
- /* If a role has been selected to be edited. */
80
- case 'edit' :
81
-
82
- /* Make sure the current user can edit roles. */
83
- if ( current_user_can( 'edit_roles' ) ) {
84
-
85
- /* Verify the referer. */
86
- check_admin_referer( members_get_nonce( 'edit-roles' ) );
87
-
88
- /* Load the edit role form. */
89
- require_once( MEMBERS_ADMIN . 'role-edit.php' );
90
- }
91
-
92
- /* If the user can't edit roles. */
93
- else {
94
- /* Load the edit roles page.*/
95
- require_once( MEMBERS_ADMIN . 'roles-list-table.php' );
96
- }
97
-
98
- /* Break out of switch statement. */
99
- break;
100
-
101
- /* The default page is the edit roles page. */
102
- default :
103
-
104
- /* Load the edit roles page.*/
105
- require_once( MEMBERS_ADMIN . 'roles-list-table.php' );
106
-
107
- /* Break out of switch statement. */
108
- break;
109
- }
110
-
111
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/settings.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- /**
3
- * Creates and handles all of the functionality needed for the 'Members Settings' page in the WordPress admin.
4
- *
5
- * @package Members
6
- * @subpackage Admin
7
- */
8
-
9
- /* Set up the administration functionality. */
10
- add_action( 'admin_menu', 'members_settings_page_setup' );
11
-
12
- /**
13
- * Initializes and sets up the main plugin settings page.
14
- *
15
- * @since 0.2.0
16
- */
17
- function members_settings_page_setup() {
18
- global $members;
19
-
20
- /* If no settings are available, add the default settings to the database. */
21
- if ( false === get_option( 'members_settings' ) )
22
- add_option( 'members_settings', members_get_default_settings(), '', 'yes' );
23
-
24
- /* Register the plugin settings. */
25
- add_action( 'admin_init', 'members_register_settings' );
26
-
27
- /* Add Members settings page. */
28
- $members->settings_page = add_submenu_page( 'options-general.php', esc_attr__( 'Members Settings', 'members' ), esc_attr__( 'Members', 'members' ), apply_filters( 'members_settings_capability', 'manage_options' ), 'members-settings', 'members_settings_page' );
29
-
30
- /* Add media for the settings page. */
31
- add_action( 'admin_enqueue_scripts', 'members_admin_enqueue_style' );
32
- add_action( 'admin_enqueue_scripts', 'members_settings_page_media' );
33
- add_action( "admin_head-{$members->settings_page}", 'members_settings_page_scripts' );
34
-
35
- /* Load the meta boxes. */
36
- add_action( "load-{$members->settings_page}", 'members_settings_page_load_meta_boxes' );
37
-
38
- /* Create a hook for adding meta boxes. */
39
- add_action( "load-{$members->settings_page}", 'members_settings_page_add_meta_boxes' );
40
- }
41
-
42
- /**
43
- * Registers the Members plugin settings with WordPress.
44
- *
45
- * @since 0.2.0
46
- */
47
- function members_register_settings() {
48
- register_setting( 'members_settings', 'members_settings', 'members_validate_settings' );
49
- }
50
-
51
- /**
52
- * Executes the 'add_meta_boxes' action hook because WordPress doesn't fire this on custom admin pages.
53
- *
54
- * @since 0.2.0
55
- */
56
- function members_settings_page_add_meta_boxes() {
57
- global $members;
58
- $plugin_data = get_plugin_data( MEMBERS_DIR . 'members.php' );
59
- do_action( 'add_meta_boxes', $members->settings_page, $plugin_data );
60
- }
61
-
62
- /**
63
- * Loads the plugin settings page meta boxes.
64
- *
65
- * @since 0.2.0
66
- */
67
- function members_settings_page_load_meta_boxes() {
68
- require_once( MEMBERS_ADMIN . 'meta-box-plugin-settings.php' );
69
- }
70
-
71
- /**
72
- * Function for validating the settings input from the plugin settings page.
73
- *
74
- * @since 0.2.0
75
- */
76
- function members_validate_settings( $settings ) {
77
-
78
- /* Check if the role manager is active. */
79
- $settings['role_manager'] = ( isset( $settings['role_manager'] ) ? 1 : 0 );
80
-
81
- /* Check if the content permissions feature is active. */
82
- $settings['content_permissions'] = ( isset( $settings['content_permissions'] ) ? 1 : 0 );
83
-
84
- /* Set the content permissions error text and kill evil scripts. */
85
- if ( current_user_can( 'unfiltered_html' ) && isset( $settings['content_permissions_error'] ) )
86
- $settings['content_permissions_error'] = stripslashes( wp_filter_post_kses( addslashes( $settings['content_permissions_error'] ) ) );
87
-
88
- elseif ( isset( $settings['content_permissions_error'] ) )
89
- $settings['content_permissions_error'] = $settings['content_permissions_error'];
90
-
91
- /* Check if the login form and users widgets are active. */
92
- $settings['login_form_widget'] = ( isset( $settings['login_form_widget'] ) ? 1 : 0 );
93
- $settings['users_widget'] = ( isset( $settings['users_widget'] ) ? 1 : 0 );
94
-
95
- /* Check if the private blog and private feed features are active. */
96
- $settings['private_blog'] = ( isset( $settings['private_blog'] ) ? 1 : 0 );
97
- $settings['private_feed'] = ( isset( $settings['private_feed'] ) ? 1 : 0 );
98
-
99
- /* Set the private feed error text and kill evil scripts. */
100
- if ( current_user_can( 'unfiltered_html' ) && isset( $settings['private_feed_error'] ) )
101
- $settings['private_feed_error'] = stripslashes( wp_filter_post_kses( addslashes( $settings['private_feed_error'] ) ) );
102
-
103
- elseif ( isset( $settings['private_feed_error'] ) )
104
- $settings['private_feed_error'] = $settings['private_feed_error'];
105
-
106
- /* Return the validated/sanitized settings. */
107
- return $settings;
108
- }
109
-
110
- /**
111
- * Displays the HTML and meta boxes for the plugin settings page.
112
- *
113
- * @since 0.2.0
114
- */
115
- function members_settings_page() {
116
- global $members; ?>
117
-
118
- <div class="wrap">
119
-
120
- <?php screen_icon(); ?>
121
-
122
- <h2><?php _e( 'Members Plugin Settings', 'members' ); ?></h2>
123
-
124
- <div id="poststuff">
125
-
126
- <form method="post" action="options.php">
127
-
128
- <?php settings_fields( 'members_settings' ); ?>
129
- <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
130
- <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
131
-
132
- <div class="metabox-holder">
133
- <div class="post-box-container column-1 normal"><?php do_meta_boxes( $members->settings_page, 'normal', null ); ?></div>
134
- <div class="post-box-container column-2 side"><?php do_meta_boxes( $members->settings_page, 'side', null ); ?></div>
135
- </div>
136
-
137
- <?php submit_button( esc_attr__( 'Update Settings', 'members' ) ); ?>
138
-
139
- </form>
140
-
141
- </div><!-- #poststuff -->
142
-
143
- </div><!-- .wrap --><?php
144
- }
145
-
146
- /**
147
- * Loads needed JavaScript files for handling the meta boxes on the settings page.
148
- *
149
- * @since 0.2.0
150
- * @param string $hook_suffix The hook for the current page in the admin.
151
- */
152
- function members_settings_page_media( $hook_suffix ) {
153
- global $members;
154
-
155
- if ( isset( $members->settings_page ) && $hook_suffix == $members->settings_page ) {
156
- wp_enqueue_script( 'common' );
157
- wp_enqueue_script( 'wp-lists' );
158
- wp_enqueue_script( 'postbox' );
159
- }
160
- }
161
-
162
- /**
163
- * Loads JavaScript for handling the open/closed state of each meta box.
164
- *
165
- * @since 0.2.0
166
- * @global $members The path of the settings page.
167
- */
168
- function members_settings_page_scripts() {
169
- global $members; ?>
170
- <script type="text/javascript">
171
- //<![CDATA[
172
- jQuery(document).ready( function($) {
173
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
174
- postboxes.add_postbox_toggles( '<?php echo $members->settings_page; ?>' );
175
- });
176
- //]]>
177
- </script>
178
- <?php }
179
-
180
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/tmpl/cap-control.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Underscore JS template for edit capabilities tab section controls.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+ ?>
13
+ <tr class="members-cap-checklist">
14
+ <td class="column-cap">
15
+ <button type="button"><strong>{{ data.cap }}</strong></button>
16
+ <i class="dashicons <?php echo is_rtl() ? 'dashicons-arrow-left' : 'dashicons-arrow-right'; ?>"></i>
17
+ </td>
18
+
19
+ <td class="column-grant">
20
+ <span class="screen-reader-text">{{{ data.label.grant }}}</span>
21
+ <input {{{ data.readonly }}} type="checkbox" name="{{ data.name.grant }}" data-grant-cap="{{ data.cap }}" value="{{ data.cap }}" <# if ( data.is_granted_cap ) { #>checked="checked"<# } #> />
22
+ </td>
23
+
24
+ <td class="column-deny">
25
+ <span class="screen-reader-text">{{{ data.label.deny }}}</span>
26
+ <input {{{ data.readonly }}} type="checkbox" name="{{ data.name.deny }}" data-deny-cap="{{ data.cap }}" value="{{ data.cap }}" <# if ( data.is_denied_cap ) { #>checked="checked"<# } #> />
27
+ </td>
28
+ </tr>
admin/tmpl/cap-section.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Underscore JS template for edit capabilities tab sections.
4
+ *
5
+ * @package Members
6
+ * @subpackage Admin
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+ ?>
13
+ <div id="members-tab-{{ data.id }}" class="{{ data.class }}">
14
+
15
+ <table class="wp-list-table widefat fixed members-roles-select">
16
+
17
+ <thead>
18
+ <tr>
19
+ <th class="column-cap"><?php esc_html_e( 'Capability', 'members' ); ?></th>
20
+ <th class="column-grant"><?php esc_html_e( 'Grant', 'members' ); ?></th>
21
+ <th class="column-deny"><?php esc_html_e( 'Deny', 'members' ); ?></th>
22
+ </tr>
23
+ </thead>
24
+
25
+ <tfoot>
26
+ <tr>
27
+ <th class="column-cap"><?php esc_html_e( 'Capability', 'members' ); ?></th>
28
+ <th class="column-grant"><?php esc_html_e( 'Grant', 'members' ); ?></th>
29
+ <th class="column-deny"><?php esc_html_e( 'Deny', 'members' ); ?></th>
30
+ </tr>
31
+ </tfoot>
32
+
33
+ <tbody></tbody>
34
+ </table>
35
+ </div>
changelog.md ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Change Log
2
+
3
+ ## [1.0.0] - 2015-09-13
4
+
5
+ ### Added
6
+
7
+ * Ability to clone existing roles.
8
+ * Add multiple roles per user.
9
+ * Ability to explicitly deny capabilities to roles.
10
+ * Capability groups to find related caps when editing a role.
11
+ * Role groups to group related roles together.
12
+ * Content Permissions handles HTML, shortcodes, and auto-embeds.
13
+ * Disabled capabilities (via `wp-config.php` settings) no longer show cap lists.
14
+ * Additional role and capability functions to extend WP's existing APIs.
15
+ * Role translation filters so that plugin authors can make role names translatable.
16
+ * Uneditable roles are now shown in the UI. They can be viewed but not edited.
17
+ * `Members_Role` object and API to extend WP's existing Roles API.
18
+ * Plugin authors can now add meta boxes to the edit role screen.
19
+ * Underscore JS based capabilities editing box for roles.
20
+
21
+ ### Changed
22
+
23
+ * Complete UI overhaul for all user-facing components in the plugin.
24
+ * Overhaul of all text strings in the plugin.
25
+ * Shortcodes are now prefixed with `members_`. Old shortcodes will continue to work.
26
+ * Overhauled the widgets code with new text strings and general code cleanup.
27
+ * Using the newer WP help tab functionality with custom tabs.
28
+
29
+ ### Deprecated
30
+
31
+ * `members_get_active_roles()`. Replaced by `members_get_active_role_names()`.
32
+ * `members_get_inactive_roles()`. Replaced by `members_get_inactive_role_names()`.
33
+ * `members_count_roles()`. Replaced by `members_get_role_count()`.
34
+ * `members_get_default_capabilities()`. Replaced by `members_get_wp_capabilities()`.
35
+ * `members_get_additional_capabilities()`. Replaced by `members_get_plugin_capabilities()`.
36
+
37
+ ### Removed
38
+
39
+ * Upgrade routine.
40
+ * All old translation files since the text strings were overhauled.
41
+ * Plugin constants in favor of `Members_Plugin` properties.
42
+ * `$members` global in favor of `Members_Plugin` properties.
43
+
44
+ ### Fixed
45
+
46
+ * Content Permissions meta box now accepts HTML on the edit post screen.
47
+ * User levels are now hidden from the role capability count.
48
+ * Uses the proper path for translation files in case plugin folder name changes.
49
+ * An "Are you sure?" (AYS) popup prevents users from inadvertently deleting roles.
50
+ * Added missing `export` and `delete_themes` caps to the core caps backup function.
51
+ * Removed CSS code that was hiding the "collapse menu" button for the admin menu.
52
+
53
+ ### Security
54
+
55
+ * Added the `members_sanitize_role()` function.
56
+ * Added the `members_sanitize_cap()` function.
57
+ * Security hardening by making sure all URLs are escaped.
58
+ * Security hardening by making sure all dynamic data is escaped.
59
+ * Security hardening by escaping translated text.
60
+
61
+ ## [0.2.5] - 2015-07-09
62
+
63
+ ### Fixed
64
+
65
+ * Deprecated old widget constructor method in favor of using `__construct()` in preparation for WP 4.3.
66
+ * Removed old `/components` folder and files that's not used.
67
+
68
+ ## [0.2.4]
69
+
70
+ * Fixed content permissions not saving for attachments. Note that this only protects **content** and not media files.
71
+ * No longer runs the upgrade script when `WP_INSTALLING` is `TRUE`.
72
+
73
+ ## [0.2.3]
74
+
75
+ * Fixes the strict standards notice "Redefining already defined constructor for class Members_Load".
76
+ * No longer uses `&` for passing the role name by reference on plugin activation.
77
+ * Fixes the `[feed]` shortcode, which was using the wrong callback function.
78
+
79
+ ## [0.2.2]
80
+
81
+ * No longer displays non-editable roles on the edit roles screen.
82
+
83
+ ## [0.2.1]
84
+
85
+ * Fixes the " Creating default object from empty value" error.
86
+
87
+ ## [0.2.0]
88
+
89
+ * Updated everything. Nearly all the code was rewritten from the ground up to make for a better user experience.
90
+ * Plugin users should check their plugin settings.
91
+
92
+ ## [0.1.1]
93
+
94
+ * Fixed a bug with the Content Permissions component that restricted access to everyone.
95
+ * Added missing internationalization function call: `load_plugin_textdomain()`.
96
+ * Added new `/languages` folder for holding translations.
97
+ * Added `members-en_EN.po`, `members-en_EN.mo`, and `members.pot` to the `/languages` folder.
98
+ * Updated some non-internationalized strings.
99
+
100
+ ## [0.1.0]
101
+
102
+ * Plugin launch. Everything's new!
contributing.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing
2
+
3
+ The code for the project is handled via its [GitHub Repository](https://github.com/justintadlock/members). You can open tickets, create patches, and send pull requests there.
4
+
5
+ ## Pull requests
6
+
7
+ Problem first. Solution second.
8
+
9
+ Pull requests should have a ticket open for discussion first. I rarely accept pull requests that aren't for a specific issue for various reasons. It's far better to post an issue and let me or the community provide feedback prior to creating a pull request.
10
+
11
+ Please don't make pull requests against the `master` branch. This is the latest, stable code. You can make a pull request against one of the point branches or the `dev` (future release) branch.
12
+
13
+ ## Coding standards
14
+
15
+ In general, the project follows all WordPress [coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards). There are instances where it doesn't, opting for personal choices of my own, but in terms of contributing, following the WordPress standards is best practice.
16
+
17
+ ## Script and style files
18
+
19
+ The project consists of several script and style files. When making patches or pull requests with changes to these files, only do so to the primary file. Don't create patches for the minified (`.min`) versions of the files. Those will be minified after a patch is merged into the code base.
20
+
21
+ ## Language
22
+
23
+ All text strings follow U.S. English by default. While such guides are generally unneeded, in cases where style considerations are necessary, these will typically follow conventions laid out in *Elements of Style* or the *AP Stylebook*.
24
+
25
+ ## Licensing
26
+
27
+ Any code contributed to the project via patches, pull requests, or other means will be licensed under the [GPL version 2](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) or later. By contributing code to the project, you provide consent to use such code under this license. The exception to this rule is when bringing in third-party code with an alternate open source license.
28
+
29
+ ## Versioning
30
+
31
+ The project uses [semantic versioning](http://semver.org). Version numbers will look like `3.2.1` where `3` is the "major" release, `2` is the minor release, and `1` is the patch release.
css/admin.css CHANGED
@@ -1,86 +1,262 @@
1
- /* Plugin settings page. */
2
- .settings_page_members-settings .form-table th {
3
- width: 20%;
4
- font-weight: bold;
5
- }
6
- .settings_page_members-settings .metabox-holder .column-1 {
7
- float: left;
8
- width: 66%;
9
- }
10
- .settings_page_members-settings .metabox-holder .column-2 {
11
- float: right;
12
- width: 32%;
13
- }
14
- .settings_page_members-settings .hook-editor {
15
- overflow: hidden;
16
- }
17
- .settings_page_members-settings p.submit {
18
- clear: both;
19
- }
20
- .settings_page_members-settings textarea {
21
- width: 99.5%;
22
  }
23
- .settings_page_members-settings .postbox .inside p,
24
- .settings_page_members-settings .postbox .inside li {
25
- font-size: 11px;
26
- line-height: 175%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
- .settings_page_members-settings .postbox form {
29
- line-height: 150%;
 
 
30
  }
31
- .settings_page_members-settings div.inside ul {
32
- margin-left: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
- .settings_page_members-settings div.inside ul li {
35
- list-style: square;
36
- line-height:16px;
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
- .settings_page_members-settings div.inside .alignleft {
39
- width: 45%;
40
- float: left;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
- .settings_page_members-settings div.inside .alignright {
43
- width: 45%;
44
- float: right;
45
- text-align: right;
 
 
 
46
  }
47
 
48
- /* Role management pages. */
49
- .users_page_roles .members-role-checkbox,
50
- .users_page_role-new .members-role-checkbox {
51
- overflow: hidden;
52
- margin: 0 0 5px 0;
53
- float: left;
54
- width: 32.67%;
55
  }
56
- .users_page_roles .clear,
57
- .users_page_role-new .clear {
58
- clear: both;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
- .users_page_roles .members-role-checkbox .has-cap,
61
- .users_page_role-new .members-role-checkbox .has-cap {
62
- font-weight: bold;
 
 
 
 
 
 
 
 
 
 
63
  }
64
- .users_page_roles a#members-add-new-cap {
65
- cursor: pointer;
 
 
 
 
 
 
 
66
  }
67
 
68
- .users_page_roles p.members-add-new-cap-wrap {
69
- float: left;
70
- width: 20%;
71
- margin-right: 2%;
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
- .users_page_roles p.new-cap-holder {
74
- float: left;
75
- width: 78%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
- .users_page_roles input.new-cap {
79
- float: left;
80
- width: 30%;
81
- margin: 0 3.3% 10px 0;
 
82
  }
83
 
84
- .users_page_roles .hide-if-no-js {
85
- display: none;
86
- }
 
 
 
 
 
 
 
 
 
1
+ /* ====== Manage Roles Screen. ====== */
2
+
3
+ @media only screen and ( min-width: 783px ) {
4
+
5
+ .users_page_roles .column-users,
6
+ .users_page_roles .column-granted_caps,
7
+ .users_page_roles .column-denied_caps {
8
+ width: 100px;
9
+ text-align: center;
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
+ }
12
+
13
+ /* ====== Edit/New Role Screen. ====== */
14
+
15
+ /* === Role and Role Name === */
16
+
17
+ .members-title-div #titlewrap input {
18
+ padding: 0 8px;
19
+ font-size: 1.7em;
20
+ line-height: normal;
21
+ height: 1.7em;
22
+ width: 100%;
23
+ outline: none;
24
+ margin: 0 0 3px;
25
+ background-color: #fff;
26
+ }
27
+
28
+ .members-title-div input[name="role"] {
29
+ font-size: 13px;
30
+ height: 22px;
31
+ margin: 0;
32
+ width: 16em;
33
+ }
34
+
35
+ /* === Edit Capabilities Tabs === */
36
+
37
+ /* Wrapper box */
38
+
39
+ #tabcapsdiv { margin-top: 1em; }
40
+
41
+ #tabcapsdiv > h3 {
42
+ padding: 10px;
43
+ border-bottom: 1px solid #eee;
44
  }
45
+
46
+ #tabcapsdiv .inside {
47
+ margin: 0;
48
+ padding: 0;
49
  }
50
+
51
+ /* Tabs wrapper. */
52
+
53
+ .members-cap-tabs {
54
+ overflow: hidden;
55
+ background: #fff;
56
+ background: linear-gradient( 90deg, #fafafa 0%, #fafafa 20%, #fff 20%, #fff 100% );
57
+ }
58
+
59
+ @media only screen and ( max-width: 782px ) {
60
+
61
+ .members-cap-tabs {
62
+ background: linear-gradient( 90deg, #fafafa 0%, #fafafa 48px, #fff 48px, #fff 100% );
63
+ }
64
  }
65
+
66
+ /* Tab nav. */
67
+
68
+ .members-cap-tabs .members-tab-nav {
69
+ position: relative;
70
+ float: left;
71
+ list-style: none;
72
+ width: 20%;
73
+ line-height: 1em;
74
+ margin: 0 0 -1px 0;
75
+ padding: 0;
76
+ background-color: #fafafa;
77
+ border-right: 1px solid #eee;
78
+ box-sizing: border-box;
79
  }
80
+
81
+ .members-cap-tabs .members-tab-nav li {
82
+ display: block;
83
+ position: relative;
84
+ margin: 0;
85
+ padding: 0;
86
+ line-height: 20px;
87
+ }
88
+
89
+ .members-cap-tabs .members-tab-nav li a {
90
+ display: block;
91
+ margin: 0;
92
+ padding: 10px;
93
+ line-height: 20px !important;
94
+ text-decoration: none;
95
+ border-bottom: 1px solid #eee;
96
+ box-shadow: none;
97
+ }
98
+
99
+ .members-cap-tabs .members-tab-nav li a .dashicons {
100
+ line-height: 20px;
101
+ margin-right: 3px;
102
+ }
103
+
104
+ .members-cap-tabs .members-tab-nav li[aria-selected="true"] a {
105
+ position: relative;
106
+ font-weight: bold;
107
+ color: #555;
108
+ background-color: #e0e0e0;
109
+ }
110
+
111
+ @media only screen and ( max-width: 782px ) {
112
+
113
+ .members-cap-tabs .members-tab-nav { width: 48px; }
114
+
115
+ .members-cap-tabs .members-tab-nav li a .dashicons {
116
+ width: 24px;
117
+ height: 24px;
118
+ font-size: 24px;
119
+ line-height: 24px;
120
+ }
121
+
122
+ .members-tab-nav li .dashicons::before {
123
+ width: 24px;
124
+ height: 24px;
125
+ }
126
+
127
+ .members-tab-nav li .label {
128
+ overflow: hidden;
129
+ position: absolute;
130
+ top: -1000em;
131
+ left: -1000em;
132
+ width: 1px;
133
+ height: 1px;
134
+ }
135
  }
136
+
137
+ /* Tab content wrapper */
138
+
139
+ .members-cap-tabs .members-tab-wrap {
140
+ float: left;
141
+ width: 80%;
142
+ margin-left: -1px;
143
  }
144
 
145
+ @media only screen and ( max-width: 782px ) {
146
+
147
+ .members-cap-tabs .members-tab-wrap {
148
+ width: calc( 100% - 48px );
149
+ }
 
 
150
  }
151
+
152
+ /* Tab tables. */
153
+
154
+ #tabcapsdiv table {
155
+ border-right: none;
156
+ border-top: none;
157
+ border-bottom: none;
158
+ }
159
+
160
+ /* Tabs table columns. */
161
+
162
+ #tabcapsdiv table td,
163
+ #tabcapsdiv table th {
164
+ padding: 10px;
165
+ padding-bottom: 10px;
166
+ border-bottom: 1px solid #eee;
167
+ font-size: 13px;
168
+ line-height: 20px;
169
  }
170
+
171
+ #tabcapsdiv table td { padding: 9px; }
172
+
173
+ #tabcapsdiv tbody tr:last-of-type td { border-bottom: none; }
174
+
175
+ #tabcapsdiv tfoot th { border-color: #eee; }
176
+
177
+ @media only screen and ( max-width: 782px ) {
178
+
179
+ #tabcapsdiv table td,
180
+ #tabcapsdiv table th {
181
+ line-height: 24px;
182
+ }
183
  }
184
+
185
+ /* Grant/Deny columns. */
186
+
187
+ .members-roles-select .column-grant,
188
+ .members-roles-select .column-deny {
189
+ width: 70px !important;
190
+ text-align: center;
191
+ display: table-cell !important;
192
+ clear: none !important;
193
  }
194
 
195
+ /* Cap grant/deny button. */
196
+
197
+ .members-cap-tabs button {
198
+ display: inline;
199
+ margin: -4px;
200
+ line-height: inherit;
201
+ padding: 4px 8px;
202
+ border: 1px solid transparent;
203
+ background: transparent;
204
+ border-radius: 0;
205
+ outline: none;
206
+
207
+ -webkit-transition: all 0.25s ease-out;
208
+ -moz-transition: all 0.25s ease-out;
209
+ -o-transition: all 0.25s ease-out;
210
+ transition: all 0.25s ease-out;
211
  }
212
+
213
+ .members-cap-tabs button:hover,
214
+ .members-cap-tabs button:focus {
215
+ border-color: #eee;
216
+ background: #fafafa;
217
+ cursor: pointer;
218
+ }
219
+
220
+ .members-cap-tabs button:active {
221
+ color: #0073aa;
222
+ border-color: #0073aa;
223
+ }
224
+
225
+ .members-cap-tabs button + .dashicons {
226
+ display: none;
227
+ margin-top: 1px;
228
+ margin-bottom: -1px;
229
+ line-height: inherit;
230
+ }
231
+
232
+ .members-cap-tabs button:hover + .dashicons,
233
+ .members-cap-tabs button:focus + .dashicons {
234
+ display: inline-block;
235
+ }
236
+
237
+
238
+ /* New cap highlight */
239
+
240
+ .members-tab-content .members-highlight {
241
+ background-color: rgba( 0, 115, 170, 0.05 );
242
  }
243
 
244
+ .members-tab-content tbody {
245
+ -webkit-transition: all 2s ease-in-out;
246
+ -moz-transition: all 2s ease-in-out;
247
+ -o-transition: all 2s ease-in-out;
248
+ transition: all 2s ease-in-out;
249
  }
250
 
251
+ /* ====== Edit Post ====== */
252
+
253
+ /* Role checkboxes in the Content Permissions meta box. */
254
+
255
+ .members-cp-role-list-wrap {
256
+ overflow: auto;
257
+ min-height: 42px;
258
+ max-height: 200px;
259
+ padding: 0 0.9em;
260
+ border: solid 1px rgb(223, 223, 223);
261
+ background-color: rgb(253, 253, 253);
262
+ }
css/admin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ @media only screen and (min-width:783px){.users_page_roles .column-users,.users_page_roles .column-granted_caps,.users_page_roles .column-denied_caps{width:125px;text-align:center}}.members-title-div #titlewrap input{padding:0 8px;font-size:1.7em;line-height:normal;height:1.7em;width:100%;outline:0;margin:0 0 3px;background-color:#fff}.members-title-div input[name=role]{font-size:13px;height:22px;margin:0;width:16em}#tabcapsdiv{margin-top:1em}#tabcapsdiv>h3{padding:10px;border-bottom:1px solid #eee}#tabcapsdiv .inside{margin:0;padding:0}.members-cap-tabs{overflow:hidden;background:#fff;background:linear-gradient(90deg,#fafafa 0,#fafafa 20%,#fff 20%,#fff 100%)}@media only screen and (max-width:782px){.members-cap-tabs{background:linear-gradient(90deg,#fafafa 0,#fafafa 48px,#fff 48px,#fff 100%)}}.members-cap-tabs .members-tab-nav{position:relative;float:left;list-style:none;width:20%;line-height:1em;margin:0 0 -1px 0;padding:0;background-color:#fafafa;border-right:1px solid #eee;box-sizing:border-box}.members-cap-tabs .members-tab-nav li{display:block;position:relative;margin:0;padding:0;line-height:20px}.members-cap-tabs .members-tab-nav li a{display:block;margin:0;padding:10px;line-height:20px!important;text-decoration:none;border-bottom:1px solid #eee;box-shadow:none}.members-cap-tabs .members-tab-nav li a .dashicons{line-height:20px;margin-right:3px}.members-cap-tabs .members-tab-nav li[aria-selected=true] a{position:relative;font-weight:700;color:#555;background-color:#e0e0e0}@media only screen and (max-width:782px){.members-cap-tabs .members-tab-nav{width:48px}.members-cap-tabs .members-tab-nav li a .dashicons{width:24px;height:24px;font-size:24px;line-height:24px}.members-tab-nav li .dashicons::before{width:24px;height:24px}.members-tab-nav li .label{overflow:hidden;position:absolute;top:-1000em;left:-1000em;width:1px;height:1px}}.members-cap-tabs .members-tab-wrap{float:left;width:80%;margin-left:-1px}@media only screen and (max-width:782px){.members-cap-tabs .members-tab-wrap{width:calc(100% - 48px)}}#tabcapsdiv table{border-right:0;border-top:0;border-bottom:0}#tabcapsdiv table td,#tabcapsdiv table th{padding:10px;padding-bottom:10px;border-bottom:1px solid #eee;font-size:13px;line-height:20px}#tabcapsdiv table td{padding:9px}#tabcapsdiv tbody tr:last-of-type td{border-bottom:0}#tabcapsdiv tfoot th{border-color:#eee}@media only screen and (max-width:782px){#tabcapsdiv table td,#tabcapsdiv table th{line-height:24px}}.members-roles-select .column-grant,.members-roles-select .column-deny{width:70px!important;text-align:center;display:table-cell!important;clear:none!important}.members-cap-tabs button{display:inline;margin:-4px;line-height:inherit;padding:4px 8px;border:1px solid transparent;background:transparent;border-radius:0;outline:0;-webkit-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-o-transition:all .25s ease-out;transition:all .25s ease-out}.members-cap-tabs button:hover,.members-cap-tabs button:focus{border-color:#eee;background:#fafafa;cursor:pointer}.members-cap-tabs button:active{color:#0073aa;border-color:#0073aa}.members-cap-tabs button+.dashicons{display:none;margin-top:1px;margin-bottom:-1px;line-height:inherit}.members-cap-tabs button:hover+.dashicons,.members-cap-tabs button:focus+.dashicons{display:inline-block}.members-tab-content .members-highlight{background-color:rgba(0,115,170,.05)}.members-tab-content tbody{-webkit-transition:all 2s ease-in-out;-moz-transition:all 2s ease-in-out;-o-transition:all 2s ease-in-out;transition:all 2s ease-in-out}.members-cp-role-list-wrap{overflow:auto;min-height:42px;max-height:200px;padding:0 .9em;border:solid 1px #dfdfdf;background-color:#fdfdfd}
docs/readme.css DELETED
@@ -1,77 +0,0 @@
1
- /* Reset values */
2
- html,body,div,span,object,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;background:transparent;border:none;text-decoration:none}b,i,hr,u,center,menu,layer,s,strike,font,xmp{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;font-weight:normal;font-style:normal;background:transparent;border:none;text-decoration:none}font{color:#333}center{text-align:left}body{line-height:25px;font-family:Cambria,Georgia,Times,"Times New Roman",serif;color:#333;background:#fff}h1,h2,h3,h4,h5,h6{font-style:normal;font-weight:normal;margin:0 0 25px 0}h1{font-size:1.8em}h2{font-size:1.7em}h3{font-size:1.55em;}h4{font-size:1.4em}h5{font-size:1.25em}h6{font-size:1.1em}p{margin:0 0 25px 0}ol,ul{list-style:none}ul{list-style:disc;margin:0 0 25px 2.5em}ol{list-style-type:decimal;margin:0 0 25px 3em}ol ol{list-style:upper-roman}ol ol ol{list-style:lower-roman}ol ol ol ol{list-style:upper-alpha}ol ol ol ol ol{list-style:lower-alpha}ul ul,ol ol,ul ol,ol ul{margin-bottom:0}dl{margin:0 0 25px 5px}dl dt{font-weight:bold;margin:10px 0 0 0}dl dd{margin:5px 0 0 1.5em}strong{font-weight:bold}strong strong{font-weight:normal}em,cite{font-style:italic}em em,cite cite{font-style:normal}abbr{cursor:help}acronym{text-transform:uppercase;border-bottom:1px dashed #666;cursor:help}big{font-size:120%}small,sup,sub{font-size:80%}sup{vertical-align:baseline;position:relative;bottom:0.3em}sub{vertical-align:baseline;position:relative;top:0.3em}address{font-style:italic;margin:0 0 25px 0}li address,dd address{margin:0}blockquote{margin:0 25px;font-style:normal}blockquote em,blockquote cite{font-style:italic}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}a{cursor:pointer}a img{border:none}pre{overflow:auto;font:.9em Monaco,monospace,Courier,"Courier New";line-height:25px;margin-bottom:25px;padding:10px}code{font:.9em Monaco,monospace,Courier,"Courier New"}pre code{font-size:1em}ins,dfn{font-style:italic;text-decoration:none;border-bottom:1px solid #666}del{text-decoration:line-through}object{margin-bottom:25px}input,textarea{font-size:1em;font-family:Cambria,Georgia,Times,"Times New Roman",serif;padding:3px}:focus{outline:none}form label{cursor:pointer}option{padding:1px 2px}table{border-collapse:collapse;border-spacing:0;margin-bottom:25px}th,td{text-align:left}hr{margin-bottom:25px}img.wp-smiley{max-height:12px;margin:0;padding:0;border:none}.gallery{display:block;text-align:center;margin-bottom:25px !important}.alignleft,.left{float:left;margin-right:20px}.alignright,.right{float:right;margin-left:20px}.aligncenter,.center{display:block;margin:0 auto 25px auto}.alignnone,.block{clear:both;margin:0 0 25px 0}.clear{clear:both}img.alignleft,img.alignright{display:inline}
3
-
4
- body {
5
- width: 750px;
6
- margin: 36px auto 60px auto;
7
- font: 15px/21px Arial, 'Helvetica Neue', Helvetica, sans-serif;
8
- font: 16px/25px Georgia, Times, 'Times New Roman', serif;
9
- }
10
- /* Links */
11
- a:link, a:visited {
12
- color: #2f6eb9;
13
- text-decoration: none;
14
- }
15
- a:hover, a:active {
16
- text-decoration: underline;
17
- }
18
- /* Headers */
19
- h1, h2, h3, h4, h5, h6 {
20
- margin: 40px 0 30px 0;
21
- color: #000;
22
- font-weight: bold;
23
- font-family: Arial, sans-serif;
24
- }
25
- h3 {
26
- font-weight: normal;
27
- font-style: italic;
28
- font-family: Georgia, Times, 'Times New Roman', serif;
29
- }
30
- h1 {
31
- margin-top: 80px;
32
- font-size: 2.2em;
33
- }
34
- code {
35
- padding: 0 3px;
36
- background: #eee;
37
- }
38
- pre code {
39
- padding: 0;
40
- }
41
- pre {
42
- padding: 9px;
43
- background: #eee;
44
- border: 1px solid #ccc;
45
- }
46
- ul {
47
- list-style: square;
48
- }
49
- p.first {
50
- font-size: 21px;
51
- }
52
- p.second {
53
- font-size: 15px;
54
- }
55
- ul.space li {
56
- margin-bottom: 10px;
57
- }
58
- .section {
59
- overflow: hidden;
60
- }
61
-
62
- .columns-2 {
63
- float: left;
64
- width: 350px;
65
- margin: 0 0 21px 25px;
66
- }
67
- .columns-3 {
68
- float: left;
69
- width: 230px;
70
- margin: 0 0 21px 20px;
71
- }
72
- /* Warnings/Alerts */
73
- .warning, .alert {
74
- padding: 6px 9px;
75
- background: #fffbbc;
76
- border: 1px solid #E6DB55;
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/readme.html DELETED
@@ -1,250 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
5
- <title>A guide to the Members plugin</title>
6
-
7
- <link rel="stylesheet" href="readme.css" type="text/css" media="screen" />
8
-
9
- </head>
10
- <body>
11
-
12
- <h1>A guide to the Members plugin</h1>
13
-
14
- <p class="first">The <em>Members</em> plugin is meant to be a complete user, role, and content management plugin for WordPress. Its purpose is to give you fine-grained control over who has access to what.</p>
15
-
16
- <p class="second">Right now, it's only in its second generation of development. It's my hope that this plugin provides that true <acronym title="Content Management System">CMS</acronym> experience that many users long for in WordPress. There's a long road ahead, and I hope you join me for the ride.</p>
17
-
18
- <h2>The plugin documentation</h2>
19
-
20
- <p>Use the links below to navigate to a specific section in the documentation:</p>
21
-
22
- <ul>
23
- <li><a href="#users-roles-caps">The relationship of users, roles, and capabilities</a></li>
24
- <li><a href="#install">How to install the plugin</a></li>
25
- <li><a href="#how-to">How to use the plugin</a></li>
26
- <li>Plugin features
27
- <ul>
28
- <li><a href="#role-manager">Role management</a>
29
- <ul>
30
- <li><a href="#edit-roles">Editing roles</a></li>
31
- <li><a href="#new-roles">Adding new roles</a></li>
32
- </ul>
33
- </li>
34
- <li><a href="#content-permissions">Content permissions</a></li>
35
- <li><a href="#shortcodes">Shortcodes component</a>
36
- <ul>
37
- <li><a href="#access">[access]</a></li>
38
- <li><a href="#is-user-logged-in">[is_user_logged_in]</a></li>
39
- <li><a href="#feed">[feed]</a></li>
40
- </ul>
41
- </li>
42
- <li><a href="#widgets">Widgets</a>
43
- <ul>
44
- <li><a href="#login-widget">Login Form widget</a></li>
45
- <li><a href="#users-widget">Users widget</a></li>
46
- </ul>
47
- </li>
48
- <li><a href="#private-blog">Private site</a></li>
49
- </ul>
50
- </li>
51
- <li><a href="#capability-check">Checking if the current user has a capability/role</a></li>
52
- <li>Plugin/theme integration for developers
53
- <ul>
54
- <li><a href="#filter-caps">Adding new capabilities</a></li>
55
- <li><a href="#cap-check">Checking for capabilities</a></li>
56
- </ul>
57
- </li>
58
- <li><a href="#old-levels">Need the old user levels system?</a></li>
59
- <li><a href="#plugin-support">Plugin support</a></li>
60
- <li><a href="#copyright">Copyright &amp; License</a></li>
61
- </ul>
62
-
63
- <h2 id="users-roles-caps">The relationship of users, roles, and capabilities</h2>
64
-
65
- <p>This is the most important thing to understand with this plugin. It's so important that I took the time out of my day to write a complete tutorial on understanding this: <a href="http://justintadlock.com/archives/2009/08/30/users-roles-and-capabilities-in-wordpress" title="Users, roles, and capabilities in WordPress">Users, roles, and capabilities in WordPress</a>. If you don't understand this concept, you won't understand what this plugin does. This is not a concept created by the plugin. This is how it's done in WordPress.</p>
66
-
67
- <p>I highly recommend reading that blog post, but here's the short version:</p>
68
-
69
- <ul>
70
- <li><strong>Users</strong> are people that have registered on your site. I'm sure you already knew that. In WordPress, users are assigned a specific role. This role defines what the user can/can't do.</li>
71
- <li><strong>Roles</strong> are a way of grouping users. Each user on your site will have a specific role. Roles are a set of capabilities. It is important to note that <strong>roles are not hierarchical</strong>. For example, "Administrator" is not higher than "Subscriber" in WordPress. You could literally give the Subscriber role more capabilities than the Administrator role. It's very important that you grasp this concept.</li>
72
- <li><strong>Capabilities</strong> give meaning to roles. It's a permissions system. They're a way of saying a role <em>can</em> do something or a role <em>can't</em> do something (e.g., Role A can <code>edit_posts</code>, Role B can't <code>activate_plugins</code>, etc.).</li>
73
- </ul>
74
-
75
- <h2 id="install">How to install the plugin</h2>
76
-
77
- <ol>
78
- <li>Uzip the <code>members.zip</code> folder.</li>
79
- <li>Upload the <code>members</code> folder to your <code>/wp-content/plugins</code> directory.</li>
80
- <li>In your WordPress dashboard, head over to the <em>Plugins</em> section.</li>
81
- <li>Activate <em>Members</em>.</li>
82
- </ol>
83
-
84
- <h2 id="how-to">How to use the plugin</h2>
85
-
86
- <p>This plugin is set up to have a components-based system. The reason for this is that I don't want to stick everyone with a bunch of features they don't need. There's no point in using the Role Manger feature if all you need is just a login widget and some shortcodes. So, it's a <em>use-only-what-you-want</em> system.</p>
87
-
88
- <p>To activate certain features, look for the <em>Members</em> link under your <em>Settings</em> menu while in your WordPress admin. When on the new page, you'll be able to select the features you want to use.</p>
89
-
90
- <p>I recommend at least activating Role Manager feature. It is at the heart of this plugin, and many other features will likely require its use in some form.</p>
91
-
92
- <h2 id="role-manager">Role management</h2>
93
-
94
- <p>The Role Manager feature allows you to edit and add new roles as well as add and remove both default capabilities and custom capabilities from roles. It is an extremely powerful system.</p>
95
-
96
- <p class="alert">Any changes you make to users and roles using this feature are permanent changes. What I mean by this is that if you deactivate or uninstall this plugin, the changes won't revert to their previous state. This plugin merely provides a user interface for you to make changes directly to your WordPress database. Please use this feature wisely.</p>
97
-
98
- <h3 id="edit-roles">Editing existing roles</h3>
99
-
100
- <p>This feature can be both a blessing and a curse, so I'm going to ask that you use it wisely. Use extreme caution when assigning new capabilities to roles. You wouldn't want to give Average Joe the <code>edit_plugins</code> capability, for example.</p>
101
-
102
- <p>You can find the settings page for this feature under the <em>Users</em> menu. It will be labeled <em>Roles</em>. When clicking on the menu item, you'll get a list of all the available roles. From there, you can select a role to edit.</p>
103
-
104
- <p>When selecting a role to edit, you will be taken to a new screen that lists all of the available capabilities you can add to a role. You simply have to tick the checkbox next to the capability you want to add/remove for a particular role and save.</p>
105
-
106
- <h3 id="new-roles">Adding new roles</h3>
107
-
108
- <p>The menu item for adding new roles is located under the <em>Users</em> menu and is labeled <em>Add New Role</em>.</p>
109
-
110
- <p>Adding new roles is pretty straightforward. You need to input a <em>Role Name</em> (only use letters, numbers, and underscores), <em>Role Label</em>, and select which capabilities the new role should have. You can later edit this role.</p>
111
-
112
- <p>You can assign new roles to users from the <em>Users</em> screen in WordPress. This is nothing particular to the plugin and is a default part of WordPress. I believe you need the <code>edit_users</code> capability to do this.</p>
113
-
114
- <h2 id="content-permissions">Content permissions feature</h2>
115
-
116
- <p>The <em>Content Permissions</em> feature will be the heart and soul of this plugin in the future. Right now, it only adds an additional meta box on the post editing screen.</p>
117
-
118
- <p>For any public post type (posts, pages, etc.), you'll see a "Content Permissions" meta box on the post editing screen. This meta box allows you to select which roles can view the content of the post/page. If no roles are selected, anyone can view the content. The post author, users that can edit the post, and any users of roles with the <code>restrict_content</code> capability can <strong>always</strong> view the post, regardless of their role.</p>
119
-
120
- <p>You can add a custom error message for individual posts. Otherwise, the error message will default to whatever you have set under the <em>Members</em> plugin settings.</p>
121
-
122
- <h2 id="shortcodes">Shortcodes</h2>
123
-
124
- <p>There are several shortcodes that you can use in your post editor or any shortcode-ready area..</p>
125
-
126
- <h3 id="access">[access]</h3>
127
-
128
- <p>The <code>[access]</code> shortcode is for hiding content from particular roles and capabilities. You need to wrap your content when using this shortcode:</p>
129
-
130
- <pre><code>[access role="editor"]Hide this content from everyone but editors.[/access]</code></pre>
131
-
132
- <p><strong>Parameters:</strong></p>
133
-
134
- <ul>
135
- <li><code>capability</code>: A capability that has been assigned to a role.</li>
136
- <li><code>role</code>: A user role from WordPress or one that you've created.</li>
137
- <li><code>feed</code>: Set to <code>true</code> if you'd like to show the content in feeds.</li>
138
- </ul>
139
-
140
- <p>Note that <code>capability</code> and <code>role</code> parameters aren't used in conjunction. The code first checks for the capability (if input) then checks for the role (if input).</p>
141
-
142
- <p>To check for multiple capabilities or multiple roles, simply add a comma between each capability/role. For example, the following code checks for an editor or administrator:</p>
143
-
144
- <pre><code>[access role="administrator,editor"]Hide this content from everyone but administrators and editors.[/access]</code></pre>
145
-
146
- <h3 id="is-user-logged-in">[is_user_logged_in]</h3>
147
-
148
- <p>The <code>[is_user_logged_in]</code> shortcode should be used to check if a user is currently logged into the site. If not, the content will be hidden.</p>
149
-
150
- <pre><code>[is_user_logged_in]This content is only shown to logged-in users.[/is_user_logged_in]</code></pre>
151
-
152
- <p>This shortcode has no parameters.</p>
153
-
154
- <h3 id="feed">[feed]</h3>
155
-
156
- <p>If you have content you only want to show to subscribers of your feed, wrap it in this shortcode:</p>
157
-
158
- <pre><code>[feed]This content will only be shown in feeds.[/feed]</code></pre>
159
-
160
- <p>This shortcode has no parameters.</p>
161
-
162
- <h2 id="widgets">Widgets</h2>
163
-
164
- <p>The widgets component provides easy-to-use widgets for your site. They can be used in any WordPress widget area (provided by your theme). Currently, there's the <em>Login Form</em> and <em>Users</em> widgets.</p>
165
-
166
- <h3 id="login-widget">Login Form widget</h3>
167
-
168
- <p>The <em>Login Form</em> gives you a login form. It's a mixture of a text widget and login form. It can also show your avatar.</p>
169
-
170
- <p>It's pretty straightforward, but I'll provide more documentation later.</p>
171
-
172
- <h3 id="users-widget">Users widget</h3>
173
-
174
- <p>The <em>Users</em> widget allows you to list users in any widget area. It's based off the <code>get_users()</code> function, so all of the <a href="http://codex.wordpress.org/Function_Reference/get_users" title="WordPress Codex: get_users()">parameters are the same</a>.</p>
175
-
176
- <h2 id="private-blog">Private site</h2>
177
-
178
- <p>The Private Site features makes sure that only logged-in users can see anything on your site. If a user visits your site and is not logged in, they are immediately redirected to your <code>wp-login.php</code> (WordPress login) page.</p>
179
-
180
- <p>You also have the option of disabling the viewing of feed content and setting an error message for feed items.</p>
181
-
182
- <h2 id="capability-check">Checking if the current user has a capability/role</h2>
183
-
184
- <p>In plugins and your theme template files, you might sometimes need to check if the currently logged in user has permission to do something. We do this by using the WordPress function <code>current_user_can()</code>. The basic format looks like this:</p>
185
-
186
- <pre><code>&lt;?php if ( current_user_can( 'capability_name' ) ) echo 'This user can do something'; ?></code></pre>
187
-
188
- <p>For a more practical situation, let's say you created a new capability called <code>read_pages</code>. Well, you might want to hide the content within your <code>page.php</code> template by adding this:</p>
189
-
190
- <pre><code>&lt;?php if ( current_user_can( 'read_pages ' ) ) { ?>
191
- &lt;?php the_content(); ?>
192
- &lt;?php } ?></code></pre>
193
-
194
- <p>Only users with a role that has the <code>read_pages</code> capability will be able to see the content.</p>
195
-
196
- <p>You can check for a specific role by inputting the role name instead of the capability name. It works the same way.</p>
197
-
198
- <h2 id="filter-caps">Adding new default capabilities</h2>
199
-
200
- <p>Your plugin/theme can add new capabilities to the <em>Edit Roles</em> component if needed. This will allow users to easily select the additional capabilities for whichever roles they choose.</p>
201
-
202
- <pre><code>add_filter( 'members_get_capabilities', 'my_plugin_new_caps' );
203
-
204
- function my_plugin_new_caps( $capabilities ) {
205
-
206
- $capabilities[] = 'cap_name_1';
207
- $capabilities[] = 'cap_name_2';
208
- $capabilities[] = 'cap_name_3';
209
-
210
- return $capabilities;
211
- }</code></pre>
212
-
213
- <p>Note that you need to respect the existing capabilities and return the original array.</p>
214
-
215
- <h2 id="cap-check">Checking for capabilities</h2>
216
-
217
- <p>In WordPress, you can use the <code>current_user_can()</code> function to check if the current user has a particular capability. Since you don't know whether a user has this plugin installed, you might want to check first.</p>
218
-
219
- <p>The <code>members_check_for_cap()</code> function (only use in admin) checks if any role has a particular capability. This can be useful in setting up something like admin menus. For example, you can set up a theme settings menu for users that have the <code>edit_themes</code> capability. But, if this plugin is installed and a user has the <code>edit_my_theme</code> capability, that'll be used instead.</p>
220
-
221
- <pre><code>if ( function_exists( 'members_check_for_cap' ) &amp;&amp; members_check_for_cap( 'some_cap' ) ) {
222
- /* Do something if any role has the 'some_cap' capability. */
223
- else {
224
- /* Do something for people without the plugin. */
225
- }</code></pre>
226
-
227
- <h2 id="old-levels">Need the old user levels system?</h2>
228
-
229
- <p>Some plugins and themes might rely on the old user level system in WordPress. These were deprecated in WordPress version 2.1 and should not be used at all. WordPress still has minimal legacy support for these, but I highly suggest contacting your theme/plugin author if user levels are being used.</p>
230
-
231
- <p>By default, the levels aren't shown. They still exist, but are tucked away behind the scenes. While not recommended, if you need to control who has what level (levels are just capabilities), add this to your plugin or your theme's <code>functions.php</code>:</p>
232
-
233
- <pre><code>remove_filter( 'members_get_capabilities', 'members_remove_old_levels' );</code></pre>
234
-
235
- <h2 id="plugin-support">Plugin support</h2>
236
-
237
- <p>I run a WordPress community called <a href="http://themehybrid.com" title="Theme Hybrid">Theme Hybrid</a>, which is where I fully support all of my WordPress projects, including plugins. You can sign up for an account to get plugin support for a small yearly fee ($29 <acronym title="United States Dollars">USD</acronym> at the time of writing).</p>
238
-
239
- <p>I know. I know. You might not want to pay for support, but just consider it a donation to the project. To continue making cool, <acronym title="GNU General Public License">GPL</acronym>-licensed plugins and having the time to support them, I must pay the bills.</p>
240
-
241
- <h2 id="copyright">Copyright &amp; license</h2>
242
-
243
- <p><em>Members</em> is licensed under the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" title="GNU GPL">GNU General Public License</a>, version 2 (<acronym title="GNU General Public License">GPL</acronym>).</p>
244
-
245
- <p>This plugin is copyrighted to <a href="http://justintadlock.com" title="Justin Tadlock">Justin Tadlock</a>.</p>
246
-
247
- <p>2009&thinsp;&ndash;&thinsp;2012 &copy; Justin Tadlock</p>
248
-
249
- </body>
250
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/class-role-factory.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress' `WP_Roles` and the global `$wp_roles` array don't really cut it. So, this is a
4
+ * singleton factory class for storing role objects and information that we need.
5
+ *
6
+ * @package Members
7
+ * @subpackage Includes
8
+ * @author Justin Tadlock <justin@justintadlock.com>
9
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
10
+ * @link http://themehybrid.com/plugins/members
11
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12
+ */
13
+
14
+ /**
15
+ * Role factory class.
16
+ *
17
+ * @since 1.0.0
18
+ * @access public
19
+ */
20
+ final class Members_Role_Factory {
21
+
22
+ /**
23
+ * Array of roles added.
24
+ *
25
+ * @since 1.0.0
26
+ * @access public
27
+ * @var array
28
+ */
29
+ public $roles = array();
30
+
31
+ /**
32
+ * Array of editable roles.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ * @var array
37
+ */
38
+ public $editable = array();
39
+
40
+ /**
41
+ * Array of uneditable roles.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var array
46
+ */
47
+ public $uneditable = array();
48
+
49
+ /**
50
+ * Array of core WordPress roles.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var array
55
+ */
56
+ public $wordpress = array();
57
+
58
+ /**
59
+ * Private constructor method to prevent a new instance of the object.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @return void
64
+ */
65
+ private function __construct() {}
66
+
67
+ /**
68
+ * Adds a role object.
69
+ *
70
+ * @since 1.0.0
71
+ * @access public
72
+ * @param string $role
73
+ * @return object
74
+ */
75
+ public function add_role( $role ) {
76
+
77
+ // If the role exists with WP but hasn't been added.
78
+ if ( members_role_exists( $role ) ) {
79
+
80
+ // Get the role object.
81
+ $this->roles[ $role ] = new Members_Role( $role );
82
+
83
+ // Check if role is editable.
84
+ if ( $this->roles[ $role ]->is_editable )
85
+ $this->editable[ $role ] = $this->roles[ $role ];
86
+ else
87
+ $this->uneditable[ $role ] = $this->roles[ $role ];
88
+
89
+ // Is WP role?
90
+ if ( members_is_wordpress_role( $role ) )
91
+ $this->wordpress[ $role ] = $this->roles[ $role ];
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Returns a single role object.
97
+ *
98
+ * @since 1.0.0
99
+ * @access public
100
+ * @param string $role
101
+ * @return object
102
+ */
103
+ public function get_role( $role ) {
104
+
105
+ return isset( $this->roles[ $role ] ) ? $this->roles[ $role ] : false;
106
+ }
107
+
108
+ /**
109
+ * Returns an array of role objects.
110
+ *
111
+ * @since 1.0.0
112
+ * @access public
113
+ * @return array
114
+ */
115
+ public function get_roles() {
116
+ return $this->roles;
117
+ }
118
+
119
+ /**
120
+ * Adds all the WP roles as role objects. Rather than running this elsewhere, we're just
121
+ * going to call this directly within the class when it is first constructed.
122
+ *
123
+ * @since 1.0.0
124
+ * @access public
125
+ * @return void
126
+ */
127
+ protected function setup_roles() {
128
+
129
+ foreach ( $GLOBALS['wp_roles']->role_names as $role => $name )
130
+ $this->add_role( $role );
131
+ }
132
+
133
+ /**
134
+ * Returns the instance.
135
+ *
136
+ * @since 3.0.0
137
+ * @access public
138
+ * @return object
139
+ */
140
+ public static function get_instance() {
141
+
142
+ static $instance = null;
143
+
144
+ if ( is_null( $instance ) ) {
145
+ $instance = new Members_Role_Factory;
146
+ $instance->setup_roles();
147
+ }
148
+
149
+ return $instance;
150
+ }
151
+ }
inc/class-role.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Creates a new role object. This is an extension of the core `get_role()` functionality. It's
4
+ * just been beefed up a bit to provide more useful info for our plugin.
5
+ *
6
+ * @package Members
7
+ * @subpackage Includes
8
+ * @author Justin Tadlock <justin@justintadlock.com>
9
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
10
+ * @link http://themehybrid.com/plugins/members
11
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12
+ */
13
+
14
+ /**
15
+ * Role class.
16
+ *
17
+ * @since 1.0.0
18
+ * @access public
19
+ */
20
+ class Members_Role {
21
+
22
+ /**
23
+ * The role/slug.
24
+ *
25
+ * @since 1.0.0
26
+ * @access public
27
+ * @var string
28
+ */
29
+ public $slug = '';
30
+
31
+ /**
32
+ * The role name.
33
+ *
34
+ * @since 1.0.0
35
+ * @access public
36
+ * @var string
37
+ */
38
+ public $name = '';
39
+
40
+ /**
41
+ * Whether the role can be edited.
42
+ *
43
+ * @since 1.0.0
44
+ * @access public
45
+ * @var bool
46
+ */
47
+ public $is_editable = false;
48
+
49
+ /**
50
+ * Whether the role is a core WP role.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @var bool
55
+ */
56
+ public $is_wordpress_role = false;
57
+
58
+ /**
59
+ * Whether the role has caps (granted).
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @var bool
64
+ */
65
+ public $has_caps = false;
66
+
67
+ /**
68
+ * Capability count for the role.
69
+ *
70
+ * @since 1.0.0
71
+ * @access public
72
+ * @var int
73
+ */
74
+ public $granted_cap_count = 0;
75
+
76
+ /**
77
+ * Capability count for the role.
78
+ *
79
+ * @since 1.0.0
80
+ * @access public
81
+ * @var int
82
+ */
83
+ public $denied_cap_count = 0;
84
+
85
+ /**
86
+ * Array of capabilities that the role has.
87
+ *
88
+ * @since 1.0.0
89
+ * @access public
90
+ * @var array
91
+ */
92
+ public $caps = array();
93
+
94
+ /**
95
+ * Array of granted capabilities that the role has.
96
+ *
97
+ * @since 1.0.0
98
+ * @access public
99
+ * @var array
100
+ */
101
+ public $granted_caps = array();
102
+
103
+ /**
104
+ * Array of denied capabilities that the role has.
105
+ *
106
+ * @since 1.0.0
107
+ * @access public
108
+ * @var array
109
+ */
110
+ public $denied_caps = array();
111
+
112
+ /**
113
+ * Return the role string in attempts to use the object as a string.
114
+ *
115
+ * @since 1.0.0
116
+ * @access public
117
+ * @return string
118
+ */
119
+ public function __toString() {
120
+ return $this->slug;
121
+ }
122
+
123
+ /**
124
+ * Creates a new role object.
125
+ *
126
+ * @since 1.0.0
127
+ * @access public
128
+ * @global object $wp_roles
129
+ * @param string $role
130
+ * @return void
131
+ */
132
+ public function __construct( $role ) {
133
+ global $wp_roles;
134
+
135
+ // Get the WP role object.
136
+ $_role = get_role( $role );
137
+
138
+ // Set the slug.
139
+ $this->slug = $_role->name;
140
+
141
+ // Set the role name.
142
+ if ( isset( $wp_roles->role_names[ $role ] ) )
143
+ $this->name = members_translate_role( $role );
144
+
145
+ // Check whether the role is editable.
146
+ $editable_roles = function_exists( 'get_editable_roles' ) ? get_editable_roles() : apply_filters( 'editable_roles', $wp_roles->roles );
147
+ $this->is_editable = array_key_exists( $role, $editable_roles );
148
+
149
+ // Loop through the role's caps.
150
+ foreach ( (array) $_role->capabilities as $cap => $grant ) {
151
+
152
+ // Validate any boolean grant/denied in case they are stored as strings.
153
+ $grant = members_validate_boolean( $grant );
154
+
155
+ // Add to all caps array.
156
+ $this->caps[ $cap ] = $grant;
157
+
158
+ // If a granted cap.
159
+ if ( true === $grant )
160
+ $this->granted_caps[] = $cap;
161
+
162
+ // If a denied cap.
163
+ elseif ( false === $grant )
164
+ $this->denied_caps[] = $cap;
165
+ }
166
+
167
+ // Remove user levels from granted/denied caps.
168
+ $this->granted_caps = members_remove_old_levels( $this->granted_caps );
169
+ $this->denied_caps = members_remove_old_levels( $this->denied_caps );
170
+
171
+ // Remove hidden caps from granted/denied caps.
172
+ $this->granted_caps = members_remove_hidden_caps( $this->granted_caps );
173
+ $this->denied_caps = members_remove_hidden_caps( $this->denied_caps );
174
+
175
+ // Set the cap count.
176
+ $this->granted_cap_count = count( $this->granted_caps );
177
+ $this->denied_cap_count = count( $this->denied_caps );
178
+
179
+ // Check if we have caps.
180
+ $this->has_caps = 0 < $this->granted_cap_count;
181
+ }
182
+ }
inc/class-widget-login.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Creates a widget that allows users to add a login form to a widget area.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Login form widget class.
15
+ *
16
+ * @since 0.1.0
17
+ * @access public
18
+ */
19
+ class Members_Widget_Login extends WP_Widget {
20
+
21
+ /**
22
+ * Set up the widget's unique name, ID, class, description, and other options.
23
+ *
24
+ * @since 0.2.5
25
+ * @access public
26
+ * @return void
27
+ */
28
+ public function __construct() {
29
+
30
+ // Set up the widget options.
31
+ $widget_options = array(
32
+ 'classname' => 'login',
33
+ 'description' => esc_html__( 'A widget that allows users to log into your site.', 'members' )
34
+ );
35
+
36
+ // Set up the widget control options.
37
+ $control_options = array(
38
+ 'width' => 800,
39
+ 'height' => 350,
40
+ 'id_base' => 'members-widget-login'
41
+ );
42
+
43
+ // Create the widget.
44
+ parent::__construct( 'members-widget-login', esc_attr__( 'Members: Login Form', 'members' ), $widget_options, $control_options );
45
+ }
46
+
47
+ /**
48
+ * Outputs the widget based on the arguments input through the widget controls.
49
+ *
50
+ * @since 0.1.0
51
+ * @access public
52
+ * @param array $sidebar
53
+ * @param array $instance
54
+ * @return void
55
+ */
56
+ function widget( $sidebar, $instance ) {
57
+ global $user_identity, $user_ID;
58
+
59
+ // Set up the arguments for wp_login_form().
60
+ $args = array(
61
+ 'form_id' => ! empty( $instance['form_id'] ) ? esc_attr( $instance['form_id'] ) : 'loginform',
62
+
63
+ 'label_username' => esc_html( $instance['label_username'] ),
64
+ 'label_password' => esc_html( $instance['label_password'] ),
65
+ 'label_remember' => esc_html( $instance['label_remember'] ),
66
+ 'label_log_in' => esc_html( $instance['label_log_in'] ),
67
+ 'id_username' => esc_attr( $instance['id_username'] ),
68
+ 'id_password' => esc_attr( $instance['id_password'] ),
69
+ 'id_remember' => esc_attr( $instance['id_submit'] ),
70
+ 'id_submit' => esc_attr( $instance['remember'] ),
71
+ 'value_username' => esc_attr( $instance['value_username'] ),
72
+
73
+ 'remember' => ! empty( $instance['remember'] ) ? true : false,
74
+ 'value_remember' => ! empty( $instance['value_remember'] ) ? true : false,
75
+ 'echo' => false,
76
+ );
77
+
78
+ if ( ! empty( $instance['redirect'] ) )
79
+ $args['redirect'] = esc_url( $instance['redirect'] );
80
+
81
+ // Get the logged in/out text.
82
+ $logged_in_text = apply_filters( 'widget_text', $instance['logged_in_text'] );
83
+ $logged_out_text = apply_filters( 'widget_text', $instance['logged_out_text'] );
84
+
85
+ // Output the theme's $before_widget wrapper.
86
+ echo $sidebar['before_widget'];
87
+
88
+ // If a title was input by the user, display it.
89
+ if ( $instance['title'] )
90
+ echo $sidebar['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $sidebar['after_title'];
91
+
92
+ // If the current user is logged in.
93
+ if ( is_user_logged_in() ) {
94
+
95
+ // Show avatar if enabled.
96
+ if ( ! empty( $instance['show_avatar'] ) )
97
+ echo get_avatar( $user_ID );
98
+
99
+ // Show logged in text if any is written.
100
+ if ( $logged_in_text )
101
+ echo do_shortcode( shortcode_unautop( wpautop( $logged_in_text ) ) );
102
+ }
103
+
104
+ // If the current user is not logged in.
105
+ else {
106
+
107
+ // Show avatar if enabled.
108
+ if ( ! empty( $instance['show_avatar'] ) )
109
+ echo get_avatar( $user_ID );
110
+
111
+ // Show logged out text if any is written.
112
+ if ( $logged_out_text )
113
+ echo do_shortcode( shortcode_unautop( wpautop( $logged_out_text ) ) );
114
+
115
+ // Output the login form.
116
+ echo '<div class="members-login-form">' . wp_login_form( $args ) . '</div>';
117
+ }
118
+
119
+ // Close the theme's widget wrapper.
120
+ echo $sidebar['after_widget'];
121
+ }
122
+
123
+ /**
124
+ * Sanitizes/Validates widget options before being saved.
125
+ *
126
+ * @since 0.1.0
127
+ * @access public
128
+ * @param array $new_instance
129
+ * @param array $old_instance
130
+ * @return array
131
+ */
132
+ function update( $new_instance, $old_instance ) {
133
+
134
+ $instance['title'] = strip_tags( $new_instance['title'] );
135
+ $instance['label_username'] = strip_tags( $new_instance['label_username'] );
136
+ $instance['label_password'] = strip_tags( $new_instance['label_password'] );
137
+ $instance['label_remember'] = strip_tags( $new_instance['label_remember'] );
138
+ $instance['label_log_in'] = strip_tags( $new_instance['label_log_in'] );
139
+ $instance['id_username'] = strip_tags( $new_instance['id_username'] );
140
+ $instance['id_password'] = strip_tags( $new_instance['id_password'] );
141
+ $instance['id_remember'] = strip_tags( $new_instance['id_remember'] );
142
+ $instance['id_submit'] = strip_tags( $new_instance['id_submit'] );
143
+ $instance['value_username'] = strip_tags( $new_instance['value_username'] );
144
+
145
+ $instance['remember'] = isset( $new_instance['remember'] ) ? 1 : 0;
146
+ $instance['value_remember'] = isset( $new_instance['value_remember'] ) ? 1 : 0;
147
+ $instance['show_avatar'] = isset( $new_instance['show_avatar'] ) ? 1 : 0;
148
+
149
+ if ( current_user_can( 'unfiltered_html' ) ) {
150
+ $instance['logged_in_text'] = $new_instance['logged_in_text'];
151
+ $instance['logged_out_text'] = $new_instance['logged_out_text'];
152
+ } else {
153
+ $instance['logged_in_text'] = wp_filter_post_kses( $new_instance['logged_in_text'] );
154
+ $instance['logged_out_text'] = wp_filter_post_kses( $new_instance['logged_out_text'] );
155
+ }
156
+
157
+ return $instance;
158
+ }
159
+
160
+ /**
161
+ * Displays the widget control options in the Widgets admin screen.
162
+ *
163
+ * @since 0.1.0
164
+ * @access public
165
+ * @param array $instance
166
+ * @return void
167
+ */
168
+ function form( $instance ) {
169
+
170
+ // Set up the default form values. */
171
+ $defaults = array(
172
+ 'title' => esc_attr__( 'Log In', 'members' ),
173
+ 'label_username' => esc_attr__( 'Username', 'members' ),
174
+ 'label_password' => esc_attr__( 'Password', 'members' ),
175
+ 'label_log_in' => esc_attr__( 'Log In', 'members' ),
176
+ 'label_remember' => esc_attr__('Remember Me', 'members' ),
177
+ 'form_id' => 'loginform',
178
+ 'id_username' => 'user_login',
179
+ 'id_password' => 'user_pass',
180
+ 'id_remember' => 'rememberme',
181
+ 'id_submit' => 'wp-submit',
182
+ 'remember' => true,
183
+ 'value_remember' => false,
184
+ 'value_username' => '',
185
+ 'show_avatar' => true,
186
+ 'logged_out_text' => esc_html__( 'Please log into the site.', 'members' ),
187
+ 'logged_in_text' => esc_html__( 'You are currently logged in.', 'members' )
188
+ );
189
+
190
+ // Merge the user-selected arguments with the defaults.
191
+ $instance = wp_parse_args( (array) $instance, $defaults );
192
+
193
+ $logged_in_text = format_to_edit( $instance['logged_in_text'] );
194
+ $logged_out_text = format_to_edit( $instance['logged_out_text'] ); ?>
195
+
196
+ <div style="float: left; width: 31%; margin-right: 3.5%;">
197
+
198
+ <p>
199
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'members' ); ?></label>
200
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
201
+ </p>
202
+ <p>
203
+ <label for="<?php echo $this->get_field_id( 'label_username' ); ?>"><?php esc_html_e( 'Username Label:', 'members' ); ?></label>
204
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_username' ); ?>" name="<?php echo $this->get_field_name( 'label_username' ); ?>" value="<?php echo esc_attr( $instance['label_username'] ); ?>" />
205
+ </p>
206
+ <p>
207
+ <label for="<?php echo $this->get_field_id( 'label_password' ); ?>"><?php esc_html_e( 'Password Label:', 'members' ); ?></label>
208
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_password' ); ?>" name="<?php echo $this->get_field_name( 'label_password' ); ?>" value="<?php echo esc_attr( $instance['label_password'] ); ?>" />
209
+ </p>
210
+ <p>
211
+ <label for="<?php echo $this->get_field_id( 'label_log_in' ); ?>"><?php esc_html_e( 'Log In Label:', 'members' ); ?></label>
212
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_log_in' ); ?>" name="<?php echo $this->get_field_name( 'label_log_in' ); ?>" value="<?php echo esc_attr( $instance['label_log_in'] ); ?>" />
213
+ </p>
214
+ <p>
215
+ <label for="<?php echo $this->get_field_id( 'label_remember' ); ?>"><?php esc_html_e( 'Remember Me Label:', 'members' ); ?></label>
216
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_remember' ); ?>" name="<?php echo $this->get_field_name( 'label_remember' ); ?>" value="<?php echo esc_attr( $instance['label_remember'] ); ?>" />
217
+ </p>
218
+
219
+ </div>
220
+ <div style="float: left; width: 31%; margin-right: 3.5%;">
221
+
222
+ <p>
223
+ <label for="<?php echo $this->get_field_id( 'value_username' ); ?>"><?php esc_html_e( 'Username Value:', 'members' ); ?></label>
224
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'value_username' ); ?>" name="<?php echo $this->get_field_name( 'value_username' ); ?>" value="<?php echo esc_attr( $instance['value_username'] ); ?>" />
225
+ </p>
226
+ <p>
227
+ <label for="<?php echo $this->get_field_id( 'id_username' ); ?>"><?php esc_html_e( 'Username Field ID:', 'members' ); ?></label>
228
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_username' ); ?>" name="<?php echo $this->get_field_name( 'id_username' ); ?>" value="<?php echo esc_attr( $instance['id_username'] ); ?>" />
229
+ </p>
230
+ <p>
231
+ <label for="<?php echo $this->get_field_id( 'id_remember' ); ?>"><?php esc_html_e( 'Remember Me Field ID:', 'members' ); ?></label>
232
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_remember' ); ?>" name="<?php echo $this->get_field_name( 'id_remember' ); ?>" value="<?php echo esc_attr( $instance['id_remember'] ); ?>" />
233
+ </p>
234
+ <p>
235
+ <label for="<?php echo $this->get_field_id( 'id_password' ); ?>"><?php esc_html_e( 'Password Field ID:', 'members' ); ?></label>
236
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_password' ); ?>" name="<?php echo $this->get_field_name( 'id_password' ); ?>" value="<?php echo esc_attr( $instance['id_password'] ); ?>" />
237
+ </p>
238
+ <p>
239
+ <label for="<?php echo $this->get_field_id( 'id_submit' ); ?>"><?php esc_html_e( 'Submit Button ID:', 'members' ); ?></label>
240
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_submit' ); ?>" name="<?php echo $this->get_field_name( 'id_submit' ); ?>" value="<?php echo esc_attr( $instance['id_submit'] ); ?>" />
241
+ </p>
242
+
243
+ </div>
244
+
245
+ <div style="float: right; width: 31%;">
246
+
247
+ <p>
248
+ <label>
249
+ <input class="checkbox" type="checkbox" <?php checked( $instance['remember'] ); ?> name="<?php echo $this->get_field_name( 'remember' ); ?>" />
250
+ <?php _e( '"Remember me" checkbox?', 'members' ); ?>
251
+ </label>
252
+ </p>
253
+ <p>
254
+ <label>
255
+ <input class="checkbox" type="checkbox" <?php checked( $instance['value_remember'] ); ?> name="<?php echo $this->get_field_name( 'value_remember' ); ?>" />
256
+ <?php _e( 'Check "remember me"?', 'members' ); ?>
257
+ </label>
258
+ </p>
259
+ <p>
260
+ <label>
261
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_avatar'], true ); ?> name="<?php echo $this->get_field_name( 'show_avatar' ); ?>" />
262
+ <?php esc_html_e( 'Display avatar?', 'members' ); ?>
263
+ </label>
264
+ </p>
265
+ <p>
266
+ <label for="<?php echo $this->get_field_id( 'logged_out_text' ); ?>"><?php _e( 'Logged out text:', 'members' ); ?></label>
267
+ <textarea class="widefat" rows="4" cols="20" id="<?php echo $this->get_field_id( 'logged_out_text' ); ?>" name="<?php echo $this->get_field_name( 'logged_out_text' ); ?>" style="width:100%;"><?php echo esc_textarea( $logged_out_text ); ?></textarea>
268
+ </p>
269
+
270
+ <p>
271
+ <label for="<?php echo $this->get_field_id( 'logged_in_text' ); ?>"><?php _e( 'Logged in text:', 'members' ); ?></label>
272
+ <textarea class="widefat" rows="4" cols="20" id="<?php echo $this->get_field_id( 'logged_in_text' ); ?>" name="<?php echo $this->get_field_name( 'logged_in_text' ); ?>" style="width:100%;"><?php echo esc_textarea( $logged_in_text ); ?></textarea>
273
+ </p>
274
+
275
+ </div>
276
+
277
+ <div style="clear:both;">&nbsp;</div>
278
+ <?php
279
+ }
280
+ }
inc/class-widget-users.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Creates a widget that allows users to list users of their site.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Users widget archive class.
15
+ *
16
+ * @since 0.1.0
17
+ * @access public
18
+ */
19
+ class Members_Widget_Users extends WP_Widget {
20
+
21
+ /**
22
+ * Set up the widget's unique name, ID, class, description, and other options.
23
+ *
24
+ * @since 0.2.5
25
+ * @access public
26
+ * @return void
27
+ */
28
+ public function __construct() {
29
+
30
+ // Set up the widget options.
31
+ $widget_options = array(
32
+ 'classname' => 'users',
33
+ 'description' => esc_html__( 'Provides the ability to list the users of the site.', 'members' )
34
+ );
35
+
36
+ // Set up the widget control options.
37
+ $control_options = array(
38
+ 'width' => 525,
39
+ 'height' => 350,
40
+ 'id_base' => 'members-widget-users'
41
+ );
42
+
43
+ // Create the widget.
44
+ parent::__construct( 'members-widget-users', esc_html__( 'Members: Users', 'members' ), $widget_options, $control_options );
45
+ }
46
+
47
+ /**
48
+ * Outputs the widget based on the arguments input through the widget controls.
49
+ *
50
+ * @since 0.1.0
51
+ * @access public
52
+ * @param array $sidebar
53
+ * @param array $instance
54
+ * @return void
55
+ */
56
+ function widget( $sidebar, $instance ) {
57
+
58
+ // Set up the arguments for get_users().
59
+ $args = array(
60
+ 'role' => $instance['role'],
61
+ 'meta_key' => $instance['meta_key'],
62
+ 'meta_value' => $instance['meta_value'],
63
+ 'include' => ! empty( $instance['include'] ) ? explode( ',', $instance['include'] ) : '',
64
+ 'exclude' => ! empty( $instance['exclude'] ) ? explode( ',', $instance['exclude'] ) : '',
65
+ 'search' => $instance['search'],
66
+ 'orderby' => $instance['orderby'],
67
+ 'order' => $instance['order'],
68
+ 'offset' => ! empty( $instance['offset'] ) ? intval( $instance['offset'] ) : '',
69
+ 'number' => ! empty( $instance['number'] ) ? intval( $instance['number'] ) : '',
70
+ );
71
+
72
+ // Output the theme's $before_widget wrapper.
73
+ echo $sidebar['before_widget'];
74
+
75
+ // If a title was input by the user, display it.
76
+ if ( $instance['title'] )
77
+ echo $sidebar['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $sidebar['after_title'];
78
+
79
+ // Get users.
80
+ $users = get_users( $args );
81
+
82
+ // If users were found.
83
+ if ( ! empty( $users ) ) {
84
+
85
+ echo '<ul class="xoxo users">';
86
+
87
+ // Loop through each available user, creating a list item with a link to the user's archive.
88
+ foreach ( $users as $user ) {
89
+
90
+ $class = sanitize_html_class( "user-{$user->ID}" );
91
+
92
+ if ( is_author( $user->ID ) )
93
+ $class .= ' current-user';
94
+
95
+ printf(
96
+ '<li class="%s"><a href="%s">%s</a>',
97
+ esc_attr( $class ),
98
+ esc_url( get_author_posts_url( $user->ID, $user->user_nicename ) ),
99
+ esc_html( $user->display_name )
100
+ );
101
+ }
102
+
103
+ echo '</ul>';
104
+ }
105
+
106
+ // Close the theme's widget wrapper.
107
+ echo $sidebar['after_widget'];
108
+ }
109
+
110
+ /**
111
+ * Sanitizes/Validates widget options before being saved.
112
+ *
113
+ * @since 0.1.0
114
+ * @access public
115
+ * @param array $new_instance
116
+ * @param array $old_instance
117
+ * @return array
118
+ */
119
+ function update( $new_instance, $old_instance ) {
120
+
121
+ // Text fields.
122
+ $instance['title'] = sanitize_text_field( $new_instance['title'] );
123
+ $instance['order'] = sanitize_text_field( $new_instance['order'] );
124
+ $instance['orderby'] = sanitize_text_field( $new_instance['orderby'] );
125
+ $instance['meta_key'] = sanitize_text_field( $new_instance['meta_key'] );
126
+ $instance['meta_value'] = sanitize_text_field( $new_instance['meta_value'] );
127
+ $instance['search'] = sanitize_text_field( $new_instance['search'] );
128
+
129
+ // Roles.
130
+ $instance['role'] = members_role_exists( $new_instance['role'] ) ? $new_instance['role'] : '';
131
+
132
+ // ID lists.
133
+ $instance['include'] = $new_instance['include'] ? join( ',', wp_parse_id_list( $new_instance['include'] ) ) : '';
134
+ $instance['exclude'] = $new_instance['exclude'] ? join( ',', wp_parse_id_list( $new_instance['exclude'] ) ) : '';
135
+
136
+ // Integers.
137
+ $instance['offset'] = absint( $new_instance['offset'] );
138
+ $instance['number'] = absint( $new_instance['number'] ) > 0 ? absint( $new_instance['number'] ) : '';
139
+
140
+ return $instance;
141
+ }
142
+
143
+ /**
144
+ * Displays the widget control options in the Widgets admin screen.
145
+ *
146
+ * @since 0.1.0
147
+ * @access public
148
+ * @param array $instance
149
+ * @return void
150
+ */
151
+ function form( $instance ) {
152
+
153
+ // Set up the default form values.
154
+ $defaults = array(
155
+ 'title' => esc_attr__( 'Users', 'members' ),
156
+ 'order' => 'ASC',
157
+ 'orderby' => 'login',
158
+ 'role' => '',
159
+ 'meta_key' => '',
160
+ 'meta_value' => '',
161
+ 'include' => '',
162
+ 'exclude' => '',
163
+ 'search' => '',
164
+ 'offset' => '',
165
+ 'number' => ''
166
+ );
167
+
168
+ // Merge the user-selected arguments with the defaults.
169
+ $instance = wp_parse_args( (array) $instance, $defaults );
170
+
171
+ $order = array(
172
+ 'ASC' => esc_attr__( 'Ascending', 'members' ),
173
+ 'DESC' => esc_attr__( 'Descending', 'members' )
174
+ );
175
+
176
+ $orderby = array(
177
+ 'display_name' => esc_attr__( 'Display Name', 'members' ),
178
+ 'email' => esc_attr__( 'Email', 'members' ),
179
+ 'ID' => esc_attr__( 'ID', 'members' ),
180
+ 'nicename' => esc_attr__( 'Nice Name', 'members' ),
181
+ 'post_count' => esc_attr__( 'Post Count', 'members' ),
182
+ 'registered' => esc_attr__( 'Registered', 'members' ),
183
+ 'url' => esc_attr__( 'URL', 'members' ),
184
+ 'user_login' => esc_attr__( 'Login', 'members' )
185
+ );
186
+
187
+ $meta_key = array_merge( array( '' ), (array) members_get_user_meta_keys() );
188
+
189
+ $roles = members_get_role_names();
190
+ asort( $roles );
191
+ $roles = array_merge( array( '' => '' ), $roles ); ?>
192
+
193
+ <div style="float: left;width: 48%;">
194
+
195
+ <p>
196
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'members' ); ?></label>
197
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
198
+ </p>
199
+ <p>
200
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php esc_html_e( 'Order By:', 'members' ); ?></label>
201
+ <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>">
202
+ <?php foreach ( $orderby as $option_value => $option_label ) : ?>
203
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['orderby'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
204
+ <?php endforeach; ?>
205
+ </select>
206
+ </p>
207
+ <p>
208
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php esc_html_e( 'Order:', 'members' ); ?></label>
209
+ <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>">
210
+ <?php foreach ( $order as $option_value => $option_label ) : ?>
211
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['order'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
212
+ <?php endforeach; ?>
213
+ </select>
214
+ </p>
215
+ <p>
216
+ <label for="<?php echo $this->get_field_id( 'role' ); ?>"><?php esc_html_e( 'Role:', 'members' ); ?></label>
217
+ <select class="widefat" id="<?php echo $this->get_field_id( 'role' ); ?>" name="<?php echo $this->get_field_name( 'role' ); ?>">
218
+ <?php foreach ( $roles as $role => $name ) : ?>
219
+ <option value="<?php echo esc_attr( $role ); ?>" <?php selected( $instance['role'], $role ); ?>><?php echo esc_html( $name ); ?></option>
220
+ <?php endforeach; ?>
221
+ </select>
222
+ </p>
223
+ <p>
224
+ <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php esc_html_e( 'Limit:', 'members' ); ?></label>
225
+ <input type="number" min="0" class="widefat code" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo esc_attr( $instance['number'] ); ?>" />
226
+ </p>
227
+ <p>
228
+ <label for="<?php echo $this->get_field_id( 'offset' ); ?>"><?php esc_html_e( 'Offset:', 'members' ); ?></label>
229
+ <input type="number" min="1" class="widefat code" id="<?php echo $this->get_field_id( 'offset' ); ?>" name="<?php echo $this->get_field_name( 'offset' ); ?>" value="<?php echo esc_attr( $instance['offset'] ); ?>" />
230
+ </p>
231
+
232
+ </div>
233
+ <div style="float: right; width: 48%;">
234
+
235
+ <p>
236
+ <label for="<?php echo $this->get_field_id( 'include' ); ?>"><?php esc_html_e( 'Include:', 'members' ); ?></label>
237
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'include' ); ?>" name="<?php echo $this->get_field_name( 'include' ); ?>" value="<?php echo esc_attr( $instance['include'] ); ?>" />
238
+ </p>
239
+ <p>
240
+ <label for="<?php echo $this->get_field_id( 'exclude' ); ?>"><?php esc_html_e( 'Exclude:', 'members' ); ?></label>
241
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'exclude' ); ?>" name="<?php echo $this->get_field_name( 'exclude' ); ?>" value="<?php echo esc_attr( $instance['exclude'] ); ?>" />
242
+ </p>
243
+ <p>
244
+ <label for="<?php echo $this->get_field_id( 'search' ); ?>"><?php esc_html_e( 'Search:', 'members' ); ?></label>
245
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'search' ); ?>" name="<?php echo $this->get_field_name( 'search' ); ?>" value="<?php echo esc_attr( $instance['search'] ); ?>" />
246
+ </p>
247
+ <p>
248
+ <label for="<?php echo $this->get_field_id( 'meta_key' ); ?>"><?php esc_html_e( 'Meta Key:', 'members' ); ?></label>
249
+ <select class="widefat" id="<?php echo $this->get_field_id( 'meta_key' ); ?>" name="<?php echo $this->get_field_name( 'meta_key' ); ?>">
250
+ <?php foreach ( $meta_key as $meta ) { ?>
251
+ <option value="<?php echo esc_attr( $meta ); ?>" <?php selected( $instance['meta_key'], $meta ); ?>><?php echo esc_html( $meta ); ?></option>
252
+ <?php } ?>
253
+ </select>
254
+ </p>
255
+ <p>
256
+ <label for="<?php echo $this->get_field_id( 'meta_value' ); ?>"><?php esc_html_e( 'Meta Value:', 'members' ); ?></label>
257
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'meta_value' ); ?>" name="<?php echo $this->get_field_name( 'meta_value' ); ?>" value="<?php echo esc_attr( $instance['meta_value'] ); ?>" />
258
+ </p>
259
+
260
+ </div>
261
+
262
+ <div style="clear:both;">&nbsp;</div>
263
+ <?php
264
+ }
265
+ }
inc/functions-admin-bar.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions for modifying the WordPress admin bar.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Hook the members admin bar to 'wp_before_admin_bar_render'.
14
+ add_action( 'wp_before_admin_bar_render', 'members_admin_bar' );
15
+
16
+ /**
17
+ * Adds new menu items to the WordPress admin bar.
18
+ *
19
+ * @since 0.2.0
20
+ * @access public
21
+ * @global object $wp_admin_bar
22
+ * @return void
23
+ */
24
+ function members_admin_bar() {
25
+ global $wp_admin_bar;
26
+
27
+ // Check if the current user can 'create_roles'.
28
+ if ( current_user_can( 'create_roles' ) ) {
29
+
30
+ // Add a 'Role' menu item as a sub-menu item of the new content menu.
31
+ $wp_admin_bar->add_menu(
32
+ array(
33
+ 'id' => 'members-new-role',
34
+ 'parent' => 'new-content',
35
+ 'title' => esc_attr__( 'Role', 'members' ),
36
+ 'href' => esc_url( members_get_new_role_url() )
37
+ )
38
+ );
39
+ }
40
+ }
inc/functions-capabilities.php ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions related to capabilities.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Disables the old user levels from capabilities array.
14
+ add_filter( 'members_get_capabilities', 'members_remove_old_levels' );
15
+ add_filter( 'members_get_capabilities', 'members_remove_hidden_caps' );
16
+
17
+ /**
18
+ * Function for sanitizing a capability.
19
+ *
20
+ * @since 1.0.0
21
+ * @access public
22
+ * @param string $cap
23
+ * @return string
24
+ */
25
+ function members_sanitize_cap( $cap ) {
26
+ return apply_filters( 'members_sanitize_cap', sanitize_key( $cap ) );
27
+ }
28
+
29
+ /**
30
+ * Conditional tag for checking whether a capability exists.
31
+ *
32
+ * @since 1.0.0
33
+ * @access public
34
+ * @param string $cap
35
+ * @return bool
36
+ */
37
+ function members_cap_exists( $cap ) {
38
+ return in_array( $cap, members_get_capabilities() );
39
+ }
40
+
41
+ /**
42
+ * Checks if a capability is editable. A capability is editable if it's not one of the core WP
43
+ * capabilities and doesn't belong to an uneditable role.
44
+ *
45
+ * @since 1.0.0
46
+ * @access public
47
+ * @param string $cap
48
+ * @return bool
49
+ */
50
+ function members_is_cap_editable( $cap ) {
51
+
52
+ $uneditable = array_keys( members_get_uneditable_role_names() );
53
+
54
+ return ! in_array( $cap, members_get_wp_capabilities() ) && ! array_intersect( $uneditable, members_get_cap_roles( $cap ) );
55
+ }
56
+
57
+ /**
58
+ * Returns an array of roles that have a capability.
59
+ *
60
+ * @since 1.0.0
61
+ * @access public
62
+ * @param string $cap
63
+ * @return array
64
+ */
65
+ function members_get_cap_roles( $cap ) {
66
+ global $wp_roles;
67
+
68
+ $_roles = array();
69
+
70
+ foreach ( $wp_roles->role_objects as $role ) {
71
+
72
+ if ( $role->has_cap( $cap ) )
73
+ $_roles[] = $role->name;
74
+ }
75
+
76
+ return $_roles;
77
+ }
78
+
79
+ /**
80
+ * The function that makes this plugin what it is. It returns all of our capabilities in a
81
+ * nicely-formatted, alphabetized array with no duplicate capabilities. It pulls from three
82
+ * different functions to make sure we get all of the capabilities that we need for use in the
83
+ * plugin components.
84
+ *
85
+ * @since 0.1.0
86
+ * @access public
87
+ * @return array
88
+ */
89
+ function members_get_capabilities() {
90
+
91
+ // Merge the default WP, role, and plugin caps together.
92
+ $capabilities = array_merge(
93
+ members_get_wp_capabilities(),
94
+ members_get_role_capabilities(),
95
+ members_get_plugin_capabilities()
96
+ );
97
+
98
+ // Apply filters to the array of capabilities.
99
+ $capabilities = apply_filters( 'members_get_capabilities', $capabilities );
100
+
101
+ // Sort the capabilities alphabetically.
102
+ sort( $capabilities );
103
+
104
+ // Discard duplicates and return.
105
+ return array_unique( $capabilities );
106
+ }
107
+
108
+ /**
109
+ * Gets an array of capabilities according to each user role. Each role will return its caps,
110
+ * which are then added to the overall `$capabilities` array.
111
+ *
112
+ * Note that if no role has the capability, it technically no longer exists. Since this could be
113
+ * a problem with folks accidentally deleting the default WordPress capabilities, the
114
+ * `members_get_plugin_capabilities()` will return all the defaults.
115
+ *
116
+ * @since 0.1.0
117
+ * @global object $wp_roles
118
+ * @return array
119
+ */
120
+ function members_get_role_capabilities() {
121
+ global $wp_roles;
122
+
123
+ // Set up an empty capabilities array.
124
+ $capabilities = array();
125
+
126
+ // Loop through each role object because we need to get the caps.
127
+ foreach ( $wp_roles->role_objects as $key => $role ) {
128
+
129
+ // Make sure that the role has caps.
130
+ if ( is_array( $role->capabilities ) ) {
131
+
132
+ // Add each of the role's caps (both granted and denied) to the array.
133
+ foreach ( $role->capabilities as $cap => $grant )
134
+ $capabilities[ $cap ] = $cap;
135
+ }
136
+ }
137
+
138
+ // Return the capabilities array, making sure there are no duplicates.
139
+ return array_unique( $capabilities );
140
+ }
141
+
142
+ /**
143
+ * Additional capabilities provided by the Members plugin that gives users permissions to handle
144
+ * certain features of the plugin.
145
+ *
146
+ * @since 1.0.0
147
+ * @access public
148
+ * @return array
149
+ */
150
+ function members_get_plugin_capabilities() {
151
+
152
+ return array(
153
+ 'list_roles', // View roles list.
154
+ 'create_roles', // Create new roles.
155
+ 'delete_roles', // Delete roles.
156
+ 'edit_roles', // Edit a role's caps.
157
+ 'restrict_content' // Restrict content (content permissions component).
158
+ );
159
+ }
160
+
161
+ /**
162
+ * Make sure we keep the default capabilities in case users screw 'em up. A user could easily
163
+ * remove a useful WordPress capability from all roles. When this happens, the capability is no
164
+ * longer stored in any of the roles, so it basically doesn't exist. This function will house
165
+ * all of the default WordPress capabilities in case this scenario comes into play.
166
+ *
167
+ * For those reading this note, yes, I did "accidentally" remove all capabilities from my
168
+ * administrator account when developing this plugin. And yes, that was fun putting back
169
+ * together. ;)
170
+ *
171
+ * @link http://codex.wordpress.org/Roles_and_Capabilities#Capabilities
172
+ * @since 1.0.0
173
+ * @access public
174
+ * @return array
175
+ */
176
+ function members_get_wp_capabilities() {
177
+
178
+ return array(
179
+ 'activate_plugins',
180
+ 'add_users',
181
+ 'create_users',
182
+ 'delete_others_pages',
183
+ 'delete_others_posts',
184
+ 'delete_pages',
185
+ 'delete_plugins',
186
+ 'delete_posts',
187
+ 'delete_private_pages',
188
+ 'delete_private_posts',
189
+ 'delete_published_pages',
190
+ 'delete_published_posts',
191
+ 'delete_themes',
192
+ 'delete_users',
193
+ 'edit_dashboard',
194
+ 'edit_files',
195
+ 'edit_others_pages',
196
+ 'edit_others_posts',
197
+ 'edit_pages',
198
+ 'edit_plugins',
199
+ 'edit_posts',
200
+ 'edit_private_pages',
201
+ 'edit_private_posts',
202
+ 'edit_published_pages',
203
+ 'edit_published_posts',
204
+ 'edit_theme_options',
205
+ 'edit_themes',
206
+ 'edit_users',
207
+ 'export',
208
+ 'import',
209
+ 'install_plugins',
210
+ 'install_themes',
211
+ 'list_users',
212
+ 'manage_categories',
213
+ 'manage_links',
214
+ 'manage_options',
215
+ 'moderate_comments',
216
+ 'promote_users',
217
+ 'publish_pages',
218
+ 'publish_posts',
219
+ 'read',
220
+ 'read_private_pages',
221
+ 'read_private_posts',
222
+ 'remove_users',
223
+ 'switch_themes',
224
+ 'unfiltered_html',
225
+ 'unfiltered_upload',
226
+ 'update_core',
227
+ 'update_plugins',
228
+ 'update_themes',
229
+ 'upload_files'
230
+ );
231
+ }
232
+
233
+ /**
234
+ * Checks if a specific capability has been given to at least one role. If it has, return true.
235
+ * Else, return false.
236
+ *
237
+ * @since 0.1.0
238
+ * @access public
239
+ * @param string $cap
240
+ * @return bool
241
+ */
242
+ function members_check_for_cap( $cap = '' ) {
243
+
244
+ // Without a capability, we have nothing to check for. Just return false.
245
+ if ( ! $cap )
246
+ return false;
247
+
248
+ // Check if the cap is assigned to any role.
249
+ return in_array( $cap, members_get_role_capabilities() );
250
+ }
251
+
252
+ /**
253
+ * Return an array of capabilities that are not allowed on this installation.
254
+ *
255
+ * @since 1.0.0
256
+ * @access public
257
+ * @return array
258
+ */
259
+ function members_get_hidden_caps() {
260
+
261
+ $caps = array();
262
+
263
+ // Unfiltered uploads.
264
+ if ( is_multisite() || ! defined( 'ALLOW_UNFILTERED_UPLOADS' ) || ! ALLOW_UNFILTERED_UPLOADS )
265
+ $caps[] = 'unfiltered_upload';
266
+
267
+ // Unfiltered HTML.
268
+ if ( is_multisite() || ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML ) )
269
+ $caps[] = 'unfiltered_html';
270
+
271
+ // File editing.
272
+ if ( is_multisite() || ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) ) {
273
+ $caps[] = 'edit_files';
274
+ $caps[] = 'edit_plugins';
275
+ $caps[] = 'edit_themes';
276
+ }
277
+
278
+ // File mods.
279
+ if ( is_multisite() || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) ) {
280
+ $caps[] = 'edit_files';
281
+ $caps[] = 'edit_plugins';
282
+ $caps[] = 'edit_themes';
283
+ $caps[] = 'update_plugins';
284
+ $caps[] = 'delete_plugins';
285
+ $caps[] = 'install_plugins';
286
+ $caps[] = 'upload_plugins';
287
+ $caps[] = 'update_themes';
288
+ $caps[] = 'delete_themes';
289
+ $caps[] = 'install_themes';
290
+ $caps[] = 'upload_themes';
291
+ $caps[] = 'update_core';
292
+ }
293
+
294
+ return array_unique( $caps );
295
+ }
296
+
297
+ /**
298
+ * Get rid of hidden capabilities.
299
+ *
300
+ * @since 1.0.0
301
+ * @access public
302
+ * @param array $caps
303
+ * @return array
304
+ */
305
+ function members_remove_hidden_caps( $caps ) {
306
+ return apply_filters( 'members_remove_hidden_caps', true ) ? array_diff( $caps, members_get_hidden_caps() ) : $caps;
307
+ }
308
+
309
+ /**
310
+ * Old WordPress levels system. This is mostly useful for filtering out the levels when shown
311
+ * in admin screen. Plugins shouldn't rely on these levels to create permissions for users.
312
+ * They should move to the newer system of checking for a specific capability instead.
313
+ *
314
+ * @since 0.1.0
315
+ * @access public
316
+ * @return array
317
+ */
318
+ function members_get_old_levels() {
319
+
320
+ return array(
321
+ 'level_0',
322
+ 'level_1',
323
+ 'level_2',
324
+ 'level_3',
325
+ 'level_4',
326
+ 'level_5',
327
+ 'level_6',
328
+ 'level_7',
329
+ 'level_8',
330
+ 'level_9',
331
+ 'level_10'
332
+ );
333
+ }
334
+
335
+ /**
336
+ * Get rid of levels since these are mostly useless in newer versions of WordPress. Devs should
337
+ * add the `__return_false` filter to the `members_remove_old_levels` hook to utilize user levels.
338
+ *
339
+ * @since 0.1.0
340
+ * @access public
341
+ * @param array $caps
342
+ * @return array
343
+ */
344
+ function members_remove_old_levels( $caps ) {
345
+ return apply_filters( 'members_remove_old_levels', true ) ? array_diff( $caps, members_get_old_levels() ) : $caps;
346
+ }
347
+
348
+ /**
349
+ * Returns an array of capabilities that should be set on the New Role admin screen. By default,
350
+ * the only capability checked is 'read' because it's needed for users of the role to view their
351
+ * profile in the admin.
352
+ *
353
+ * @since 0.1.0
354
+ * @access public
355
+ * @return array
356
+ */
357
+ function members_new_role_default_capabilities() {
358
+
359
+ return apply_filters( 'members_new_role_default_capabilities', array( 'read' ) );
360
+ }
361
+
362
+ /**
363
+ * Returns an array of capabilities that should be set on the New Role admin screen. By default,
364
+ * the only capability checked is 'read' because it's needed for users of the role to view their
365
+ * profile in the admin.
366
+ *
367
+ * @since 1.0.0
368
+ * @access public
369
+ * @return array
370
+ */
371
+ function members_new_role_default_caps() {
372
+
373
+ return apply_filters( 'members_new_role_default_caps', array( 'read' => true ) );
374
+ }
inc/functions-content-permissions.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles permissions for post content, post excerpts, and post comments. This is based on whether a user
4
+ * has permission to view a post according to the settings provided by the plugin.
5
+ *
6
+ * @package Members
7
+ * @subpackage Functions
8
+ */
9
+
10
+ # Enable the content permissions features.
11
+ add_action( 'after_setup_theme', 'members_enable_content_permissions', 0 );
12
+
13
+ /**
14
+ * Returns an array of the roles for a given post.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ * @param int $post_id
19
+ * @return array
20
+ */
21
+ function members_get_post_roles( $post_id ) {
22
+ return get_post_meta( $post_id, '_members_access_role', false );
23
+ }
24
+
25
+ /**
26
+ * Adds a single role to a post's access roles.
27
+ *
28
+ * @since 1.0.0
29
+ * @access public
30
+ * @param int $post_id
31
+ * @param string $role
32
+ * @return int|false
33
+ */
34
+ function members_add_post_role( $post_id, $role ) {
35
+ return add_post_meta( $post_id, '_members_access_role', $role, false );
36
+ }
37
+
38
+ /**
39
+ * Removes a single role from a post's access roles.
40
+ *
41
+ * @since 1.0.0
42
+ * @access public
43
+ * @param int $post_id
44
+ * @param string $role
45
+ * @return bool
46
+ */
47
+ function members_remove_post_role( $post_id, $role ) {
48
+ return delete_post_meta( $post_id, '_members_access_role', $role );
49
+ }
50
+
51
+ /**
52
+ * Sets a post's access roles given an array of roles.
53
+ *
54
+ * @since 1.0.0
55
+ * @access public
56
+ * @param int $post_id
57
+ * @param array $roles
58
+ * @global object $wp_roles
59
+ * @return void
60
+ */
61
+ function members_set_post_roles( $post_id, $roles ) {
62
+ global $wp_roles;
63
+
64
+ // Get the current roles.
65
+ $current_roles = get_post_meta( $post_id, '_members_access_role', false );
66
+
67
+ // Loop through new roles.
68
+ foreach ( $roles as $role ) {
69
+
70
+ // If new role is not already one of the current roles, add it.
71
+ if ( ! in_array( $role, $current_roles ) )
72
+ members_add_post_role( $post_id, $role );
73
+ }
74
+
75
+ // Loop through all WP roles.
76
+ foreach ( $wp_roles->role_names as $role => $name ) {
77
+
78
+ // If the WP role is one of the current roles but not a new role, remove it.
79
+ if ( ! in_array( $role, $roles ) && in_array( $role, $current_roles ) )
80
+ members_remove_post_role( $post_id, $role );
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Deletes all of a post's access roles.
86
+ *
87
+ * @since 1.0.0
88
+ * @access public
89
+ * @param int $post_id
90
+ * @return bool
91
+ */
92
+ function members_delete_post_roles( $post_id ) {
93
+ return delete_post_meta( $post_id, '_members_access_role' );
94
+ }
95
+
96
+ /**
97
+ * Adds required filters for the content permissions feature if it is active.
98
+ *
99
+ * @since 0.2.0
100
+ * @access public
101
+ * @global object $wp_embed
102
+ * @return void
103
+ */
104
+ function members_enable_content_permissions() {
105
+ global $wp_embed;
106
+
107
+ // Only add filters if the content permissions feature is enabled and we're not in the admin.
108
+ if ( members_content_permissions_enabled() && !is_admin() ) {
109
+
110
+ // Filter the content and exerpts.
111
+ add_filter( 'the_content', 'members_content_permissions_protect', 95 );
112
+ add_filter( 'get_the_excerpt', 'members_content_permissions_protect', 95 );
113
+ add_filter( 'the_excerpt', 'members_content_permissions_protect', 95 );
114
+ add_filter( 'the_content_feed', 'members_content_permissions_protect', 95 );
115
+ add_filter( 'comment_text_rss', 'members_content_permissions_protect', 95 );
116
+
117
+ // Filter the comments template to make sure comments aren't shown to users without access.
118
+ add_filter( 'comments_template', 'members_content_permissions_comments', 95 );
119
+
120
+ // Use WP formatting filters on the post error message.
121
+ add_filter( 'members_post_error_message', array( $wp_embed, 'run_shortcode' ), 5 );
122
+ add_filter( 'members_post_error_message', array( $wp_embed, 'autoembed' ), 5 );
123
+ add_filter( 'members_post_error_message', 'wptexturize', 10 );
124
+ add_filter( 'members_post_error_message', 'convert_smilies', 15 );
125
+ add_filter( 'members_post_error_message', 'convert_chars', 20 );
126
+ add_filter( 'members_post_error_message', 'wpautop', 25 );
127
+ add_filter( 'members_post_error_message', 'do_shortcode', 30 );
128
+ add_filter( 'members_post_error_message', 'shortcode_unautop', 35 );
129
+ }
130
+ }
131
+
132
+ /**
133
+ * Denies/Allows access to view post content depending on whether a user has permission to
134
+ * view the content.
135
+ *
136
+ * @since 0.1.0
137
+ * @access public
138
+ * @param string $content
139
+ * @return string
140
+ */
141
+ function members_content_permissions_protect( $content ) {
142
+
143
+ $post_id = get_the_ID();
144
+
145
+ return members_can_current_user_view_post( $post_id ) ? $content : members_get_post_error_message( $post_id );
146
+ }
147
+
148
+ /**
149
+ * Disables the comments template if a user doesn't have permission to view the post the
150
+ * comments are associated with.
151
+ *
152
+ * @since 0.1.0
153
+ * @param string $template
154
+ * @return string
155
+ */
156
+ function members_content_permissions_comments( $template ) {
157
+
158
+ // Check if the current user has permission to view the comments' post.
159
+ if ( ! members_can_current_user_view_post( get_the_ID() ) ) {
160
+
161
+ // Look for a 'comments-no-access.php' template in the parent and child theme.
162
+ $has_template = locate_template( array( 'comments-no-access.php' ) );
163
+
164
+ // If the template was found, use it. Otherwise, fall back to the Members comments.php template.
165
+ $template = $has_template ? $has_template : members_plugin()->templates_dir . 'comments.php';
166
+
167
+ // Allow devs to overwrite the comments template.
168
+ $template = apply_filters( 'members_comments_template', $template );
169
+ }
170
+
171
+ // Return the comments template filename.
172
+ return $template;
173
+ }
174
+
175
+ /**
176
+ * Gets the error message to display for users who do not have access to view the given post.
177
+ * The function first checks to see if a custom error message has been written for the
178
+ * specific post. If not, it loads the error message set on the plugins settings page.
179
+ *
180
+ * @since 0.2.0
181
+ * @access public
182
+ * @param int $post_id
183
+ * @return string
184
+ */
185
+ function members_get_post_error_message( $post_id ) {
186
+
187
+ // Get the error message for the specific post.
188
+ $message = members_get_post_access_message( $post_id );
189
+
190
+ // Use default error message if we don't have one for the post.
191
+ if ( ! $message )
192
+ $message = members_get_setting( 'content_permissions_error' );
193
+
194
+ // Return the error message.
195
+ return apply_filters( 'members_post_error_message', sprintf( '<div class="members-access-error">%s</div>', $message ) );
196
+ }
197
+
198
+ /**
199
+ * Returns the post access message.
200
+ *
201
+ * @since 1.0.0
202
+ * @access public
203
+ * @param int $post_id
204
+ * @return string
205
+ */
206
+ function members_get_post_access_message( $post_id ) {
207
+ return get_post_meta( $post_id, '_members_access_error', true );
208
+ }
209
+
210
+ /**
211
+ * Sets the post access message.
212
+ *
213
+ * @since 1.0.0
214
+ * @access public
215
+ * @param int $post_id
216
+ * @param string $message
217
+ * @return bool
218
+ */
219
+ function members_set_post_access_message( $post_id, $message ) {
220
+ return update_post_meta( $post_id, '_members_access_error', $message );
221
+ }
222
+
223
+ /**
224
+ * Deletes the post access message.
225
+ *
226
+ * @since 1.0.0
227
+ * @access public
228
+ * @param int $post_id
229
+ * @return bool
230
+ */
231
+ function members_delete_post_access_message( $post_id ) {
232
+ return delete_post_meta( $post_id, '_members_access_error' );
233
+ }
234
+
235
+ /**
236
+ * Converts the meta values of the old '_role' post meta key to the newer '_members_access_role' meta
237
+ * key. The reason for this change is to avoid any potential conflicts with other plugins/themes. We're
238
+ * now using a meta key that is extremely specific to the Members plugin.
239
+ *
240
+ * @since 0.2.0
241
+ * @access public
242
+ * @param int $post_id
243
+ * @return array|bool
244
+ */
245
+ function members_convert_old_post_meta( $post_id ) {
246
+
247
+ // Check if there are any meta values for the '_role' meta key.
248
+ $old_roles = get_post_meta( $post_id, '_role', false );
249
+
250
+ // If roles were found, let's convert them.
251
+ if ( !empty( $old_roles ) ) {
252
+
253
+ // Delete the old '_role' post meta.
254
+ delete_post_meta( $post_id, '_role' );
255
+
256
+ // Check if there are any roles for the '_members_access_role' meta key.
257
+ $new_roles = get_post_meta( $post_id, '_members_access_role', false );
258
+
259
+ // If new roles were found, don't do any conversion.
260
+ if ( empty( $new_roles ) ) {
261
+
262
+ // Loop through the old meta values for '_role' and add them to the new '_members_access_role' meta key.
263
+ foreach ( $old_roles as $role )
264
+ add_post_meta( $post_id, '_members_access_role', $role, false );
265
+
266
+ // Return the array of roles.
267
+ return $old_roles;
268
+ }
269
+ }
270
+
271
+ // Return false if we get to this point.
272
+ return false;
273
+ }
inc/functions-deprecated.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * @since 0.2.0
15
+ * @deprecated 1.0.0
16
+ */
17
+ function members_get_active_roles() {
18
+ _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_active_role_names' );
19
+ return members_get_active_role_names();
20
+ }
21
+
22
+ /**
23
+ * @since 0.2.0
24
+ * @deprecated 1.0.0
25
+ */
26
+ function members_get_inactive_roles() {
27
+ _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_inactive_role_names' );
28
+ return members_get_inactive_role_names();
29
+ }
30
+
31
+ /**
32
+ * @since 0.2.0
33
+ * @deprecated 1.0.0
34
+ */
35
+ function members_count_roles() {
36
+ _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_role_count' );
37
+ return members_get_role_count();
38
+ }
39
+
40
+ /**
41
+ * @since 0.1.0
42
+ * @deprecated 1.0.0
43
+ */
44
+ function members_get_default_capabilities() {
45
+ _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_wp_capabilities' );
46
+ return members_get_wp_capabilities();
47
+ }
48
+
49
+ /**
50
+ * @since 0.1.0
51
+ * @deprecated 1.0.0
52
+ */
53
+ function members_get_additional_capabilities() {
54
+ _deprecated_function( __FUNCTION__, '1.0.0', 'members_get_plugin_capabilities' );
55
+ return members_get_plugin_capabilities();
56
+ }
57
+
58
+ /* ====== Functions removed in the 1.0 branch. ====== */
59
+
60
+ if ( ! function_exists( 'has_role' ) ) { function has_role() {} }
61
+ if ( ! function_exists( 'current_user_has_role' ) ) { function current_user_has_role() {} }
62
+
63
+ function members_author_profile() {}
64
+ function members_login_form() {}
65
+ function members_get_login_form() {}
66
+ function members_get_avatar_shortcode() {}
67
+ function members_version_check() {}
68
+ function members_install() {}
69
+ function members_update() {}
70
+ function members_edit_roles_page() {}
71
+ function members_edit_capabilities_page() {}
72
+ function members_new_role_page() {}
73
+ function members_new_capability_page() {}
74
+ function members_message_role_deleted() {}
75
+ function members_message_roles_deleted() {}
76
+ function members_admin_message() {}
77
+ function members_admin_enqueue_scripts() {}
78
+ function members_admin_enqueue_style() {}
79
+ function members_get_nonce() {}
80
+ function members_admin_load_post_meta_boxes() {}
81
+ function members_content_permissions_create_meta_box() {}
82
+ function members_content_permissions_meta_box() {}
83
+ function members_content_permissions_save_meta() {}
84
+ function members_admin_setup() {}
85
+ function members_admin_contextual_help() {}
inc/functions-options.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions for handling plugin options.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Conditional check to see if the role manager is enabled.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ * @return bool
19
+ */
20
+ function members_role_manager_enabled() {
21
+ return apply_filters( 'members_role_manager_enabled', members_get_setting( 'role_manager' ) );
22
+ }
23
+
24
+ /**
25
+ * Conditional check to see if denied capabilities should overrule granted capabilities when
26
+ * a user has multiple roles with conflicting cap definitions.
27
+ *
28
+ * @since 1.0.0
29
+ * @access public
30
+ * @return bool
31
+ */
32
+ function members_explicitly_deny_caps() {
33
+ return apply_filters( 'members_explicitly_deny_caps', members_get_setting( 'explicit_denied_caps' ) );
34
+ }
35
+
36
+ /**
37
+ * Conditional check to see if the role manager is enabled.
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ * @return bool
42
+ */
43
+ function members_multiple_user_roles_enabled() {
44
+ return apply_filters( 'members_multiple_roles_enabled', members_get_setting( 'multi_roles' ) );
45
+ }
46
+
47
+ /**
48
+ * Conditional check to see if content permissions are enabled.
49
+ *
50
+ * @since 1.0.0
51
+ * @access public
52
+ * @return bool
53
+ */
54
+ function members_content_permissions_enabled() {
55
+ return apply_filters( 'members_content_permissions_enabled', members_get_setting( 'content_permissions' ) );
56
+ }
57
+
58
+ /**
59
+ * Conditional check to see if login widget is enabled.
60
+ *
61
+ * @since 1.0.0
62
+ * @access public
63
+ * @return bool
64
+ */
65
+ function members_login_widget_enabled() {
66
+ return apply_filters( 'members_login_widget_enabled', members_get_setting( 'login_form_widget' ) );
67
+ }
68
+
69
+ /**
70
+ * Conditional check to see if users widget is enabled.
71
+ *
72
+ * @since 1.0.0
73
+ * @access public
74
+ * @return bool
75
+ */
76
+ function members_users_widget_enabled() {
77
+ return apply_filters( 'members_users_widget_enabled', members_get_setting( 'users_widget' ) );
78
+ }
79
+
80
+ /**
81
+ * Gets a setting from from the plugin settings in the database.
82
+ *
83
+ * @since 0.2.0
84
+ * @access public
85
+ * @return mixed
86
+ */
87
+ function members_get_setting( $option = '' ) {
88
+
89
+ $defaults = members_get_default_settings();
90
+
91
+ $settings = wp_parse_args( get_option( 'members_settings', $defaults ), $defaults );
92
+
93
+ return isset( $settings[ $option ] ) ? $settings[ $option ] : false;
94
+ }
95
+
96
+ /**
97
+ * Returns an array of the default plugin settings.
98
+ *
99
+ * @since 0.2.0
100
+ * @access public
101
+ * @return array
102
+ */
103
+ function members_get_default_settings() {
104
+
105
+ return array(
106
+
107
+ // @since 0.1.0
108
+ 'role_manager' => 1,
109
+ 'content_permissions' => 1,
110
+ 'private_blog' => 0,
111
+
112
+ // @since 0.2.0
113
+ 'private_feed' => 0,
114
+ 'login_form_widget' => 0,
115
+ 'users_widget' => 0,
116
+ 'content_permissions_error' => esc_html__( 'Sorry, but you do not have permission to view this content.', 'members' ),
117
+ 'private_feed_error' => esc_html__( 'You must be logged into the site to view this content.', 'members' ),
118
+
119
+ // @since 1.0.0
120
+ 'explicit_denied_caps' => true,
121
+ 'multi_roles' => true,
122
+ );
123
+ }
inc/functions-private-site.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handles the private site and private feed features of the plugin. If private site is
4
+ * selected in the plugin settings, the plugin will redirect all non-logged-in users to the
5
+ * login page. If private feed is selected, all content is blocked from feeds from the site.
6
+ *
7
+ * @package Members
8
+ * @subpackage Includes
9
+ * @author Justin Tadlock <justin@justintadlock.com>
10
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
11
+ * @link http://themehybrid.com/plugins/members
12
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
+ */
14
+
15
+ # Redirects users to the login page.
16
+ add_action( 'template_redirect', 'members_please_log_in', 0 );
17
+
18
+ # Disable content in feeds if the feed should be private.
19
+ add_filter( 'the_content_feed', 'members_private_feed', 95 );
20
+ add_filter( 'the_excerpt_rss', 'members_private_feed', 95 );
21
+ add_filter( 'comment_text_rss', 'members_private_feed', 95 );
22
+
23
+ # Filters for the feed error message.
24
+ add_filter( 'members_feed_error_message', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 5 );
25
+ add_filter( 'members_feed_error_message', array( $GLOBALS['wp_embed'], 'autoembed' ), 5 );
26
+ add_filter( 'members_feed_error_message', 'wptexturize', 10 );
27
+ add_filter( 'members_feed_error_message', 'convert_smilies', 15 );
28
+ add_filter( 'members_feed_error_message', 'convert_chars', 20 );
29
+ add_filter( 'members_feed_error_message', 'wpautop', 25 );
30
+ add_filter( 'members_feed_error_message', 'do_shortcode', 30 );
31
+ add_filter( 'members_feed_error_message', 'shortcode_unautop', 35 );
32
+
33
+ /**
34
+ * Conditional tag to see if we have a private blog.
35
+ *
36
+ * @since 1.0.0
37
+ * @access public
38
+ * @return bool
39
+ */
40
+ function members_is_private_blog() {
41
+ return members_get_setting( 'private_blog' );
42
+ }
43
+
44
+ /**
45
+ * Conditional tag to see if we have a private feed.
46
+ *
47
+ * @since 1.0.0
48
+ * @access public
49
+ * @return bool
50
+ */
51
+ function members_is_private_feed() {
52
+ return members_get_setting( 'private_feed' );
53
+ }
54
+
55
+ /**
56
+ * Redirects users that are not logged in to the 'wp-login.php' page.
57
+ *
58
+ * @since 0.1.0
59
+ * @access public
60
+ * @return void
61
+ */
62
+ function members_please_log_in() {
63
+
64
+ // Check if the private blog feature is active and if the user is not logged in.
65
+ if ( members_is_private_blog() && ! is_user_logged_in() ) {
66
+
67
+ // If using BuddyPress and on the register page, don't do anything.
68
+ if ( function_exists( 'bp_is_current_component' ) && bp_is_current_component( 'register' ) )
69
+ return;
70
+
71
+ // Redirect to the login page.
72
+ auth_redirect();
73
+ exit;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Blocks feed items if the user has selected the private feed feature.
79
+ *
80
+ * @since 0.2.0
81
+ * @access public
82
+ * @param string $content
83
+ * @return string
84
+ */
85
+ function members_private_feed( $content ) {
86
+
87
+ return members_is_private_feed() ? members_get_private_feed_message() : $content;
88
+ }
89
+
90
+ /**
91
+ * Returns the private feed error message.
92
+ *
93
+ * @since 1.0.0
94
+ * @access public
95
+ * @return string
96
+ */
97
+ function members_get_private_feed_message() {
98
+
99
+ return apply_filters( 'members_feed_error_message', members_get_setting( 'private_feed_error' ) );
100
+ }
inc/functions-roles.php ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Role-related functions that extend the built-in WordPress Roles API.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Returns the instance of the `Members_Role_Factory`.
15
+ *
16
+ * @since 1.0.0
17
+ * @access public
18
+ * @param string
19
+ * @return bool
20
+ */
21
+ function members_role_factory() {
22
+ return Members_Role_Factory::get_instance();
23
+ }
24
+
25
+ /* ====== Multiple Role Functions ====== */
26
+
27
+ /**
28
+ * Returns a count of all the available roles for the site.
29
+ *
30
+ * @since 1.0.0
31
+ * @access public
32
+ * @return int
33
+ */
34
+ function members_get_role_count() {
35
+ return count( $GLOBALS['wp_roles']->role_names );
36
+ }
37
+
38
+ /**
39
+ * Returns an array of `Members_Role` objects.
40
+ *
41
+ * @since 1.0.0
42
+ * @access public
43
+ * @return array
44
+ */
45
+ function members_get_roles() {
46
+ return members_role_factory()->roles;
47
+ }
48
+
49
+ /**
50
+ * Returns an array of role names.
51
+ *
52
+ * @since 1.0.0
53
+ * @access public
54
+ * @return array
55
+ */
56
+ function members_get_role_names() {
57
+ $roles = array();
58
+
59
+ foreach ( members_role_factory()->roles as $role )
60
+ $roles[ $role->slug ] = $role->name;
61
+
62
+ return $roles;
63
+ }
64
+
65
+ /**
66
+ * Returns an array of roles.
67
+ *
68
+ * @since 1.0.0
69
+ * @access public
70
+ * @return array
71
+ */
72
+ function members_get_role_slugs() {
73
+ return array_keys( members_role_factory()->roles );
74
+ }
75
+
76
+ /**
77
+ * Returns an array of the role names of roles that have users.
78
+ *
79
+ * @since 1.0.0
80
+ * @access public
81
+ * @return array
82
+ */
83
+ function members_get_active_role_names() {
84
+ $has_users = array();
85
+
86
+ foreach ( members_get_active_role_slugs() as $role )
87
+ $has_users[ $role ] = members_get_role_name( $role );
88
+
89
+ return $has_users;
90
+ }
91
+
92
+ /**
93
+ * Returns an array of the roles that have users.
94
+ *
95
+ * @since 1.0.0
96
+ * @access public
97
+ * @return array
98
+ */
99
+ function members_get_active_role_slugs() {
100
+
101
+ $has_users = array();
102
+
103
+ foreach ( members_get_role_user_count() as $role => $count ) {
104
+
105
+ if ( 0 < $count )
106
+ $has_users[] = $role;
107
+ }
108
+
109
+ return $has_users;
110
+ }
111
+
112
+ /**
113
+ * Returns an array of the role names of roles that do not have users.
114
+ *
115
+ * @since 1.0.0
116
+ * @access public
117
+ * @return array
118
+ */
119
+ function members_get_inactive_role_names() {
120
+ return array_diff( members_get_role_names(), members_get_active_role_names() );
121
+ }
122
+
123
+ /**
124
+ * Returns an array of the roles that have no users.
125
+ *
126
+ * @since 1.0.0
127
+ * @access public
128
+ * @return array
129
+ */
130
+ function members_get_inactive_role_slugs() {
131
+ return array_diff( members_get_role_slugs(), members_get_active_role_slugs() );
132
+ }
133
+
134
+ /**
135
+ * Returns an array of editable role names.
136
+ *
137
+ * @since 1.0.0
138
+ * @access public
139
+ * @return array
140
+ */
141
+ function members_get_editable_role_names() {
142
+ $editable = array();
143
+
144
+ foreach ( members_role_factory()->editable as $role )
145
+ $editable[ $role->slug ] = $role->name;
146
+
147
+ return $editable;
148
+ }
149
+
150
+ /**
151
+ * Returns an array of editable roles.
152
+ *
153
+ * @since 1.0.0
154
+ * @access public
155
+ * @return array
156
+ */
157
+ function members_get_editable_role_slugs() {
158
+ return array_keys( members_role_factory()->editable );
159
+ }
160
+
161
+ /**
162
+ * Returns an array of uneditable role names.
163
+ *
164
+ * @since 1.0.0
165
+ * @access public
166
+ * @return array
167
+ */
168
+ function members_get_uneditable_role_names() {
169
+ $uneditable = array();
170
+
171
+ foreach ( members_role_factory()->uneditable as $role )
172
+ $uneditable[ $role->slug ] = $role->name;
173
+
174
+ return $uneditable;
175
+ }
176
+
177
+ /**
178
+ * Returns an array of uneditable roles.
179
+ *
180
+ * @since 1.0.0
181
+ * @access public
182
+ * @return array
183
+ */
184
+ function members_get_uneditable_role_slugs() {
185
+ return array_keys( members_role_factory()->uneditable );
186
+ }
187
+
188
+ /**
189
+ * Returns an array of core WordPress role names.
190
+ *
191
+ * @since 1.0.0
192
+ * @access public
193
+ * @return array
194
+ */
195
+ function members_get_wordpress_role_names() {
196
+ $names = array();
197
+
198
+ foreach ( members_role_factory()->wordpress as $role )
199
+ $names[ $role->slug ] = $role->name;
200
+
201
+ return $names;
202
+ }
203
+
204
+ /**
205
+ * Returns an array of core WP roles.
206
+ *
207
+ * @since 1.0.0
208
+ * @access public
209
+ * @return array
210
+ */
211
+ function members_get_wordpress_role_slugs() {
212
+ return array_keys( members_role_factory()->wordpress );
213
+ }
214
+
215
+ /* ====== Single Role Functions ====== */
216
+
217
+ /**
218
+ * Conditional tag to check if a role exists.
219
+ *
220
+ * @since 1.0.0
221
+ * @access public
222
+ * @param string
223
+ * @return bool
224
+ */
225
+ function members_role_exists( $role ) {
226
+ return $GLOBALS['wp_roles']->is_role( $role );
227
+ }
228
+
229
+ /**
230
+ * Gets a Members role object.
231
+ *
232
+ * @see Members_Role
233
+ * @since 1.0.0
234
+ * @access public
235
+ * @param string
236
+ * @return object
237
+ */
238
+ function members_get_role( $role ) {
239
+ return members_role_factory()->get_role( $role );
240
+ }
241
+
242
+ /**
243
+ * Sanitizes a role name. This is a wrapper for the `sanitize_key()` WordPress function. Only
244
+ * alphanumeric characters and underscores are allowed. Hyphens are also replaced with underscores.
245
+ *
246
+ * @since 1.0.0
247
+ * @access public
248
+ * @return int
249
+ */
250
+ function members_sanitize_role( $role ) {
251
+ $_role = strtolower( $role );
252
+ $_role = preg_replace( '/[^a-z0-9_\-\s]/', '', $_role );
253
+ return apply_filters( 'members_sanitize_role', str_replace( array( '-', ' ' ), '_', $_role ), $role );
254
+ }
255
+
256
+ /**
257
+ * WordPress provides no method of translating custom roles other than filtering the
258
+ * `translate_with_gettext_context` hook, which is very inefficient and is not the proper
259
+ * method of translating. This is a method that allows plugin authors to hook in and add
260
+ * their own translations.
261
+ *
262
+ * Note the core WP `translate_user_role()` function only translates core user roles.
263
+ *
264
+ * @since 1.0.0
265
+ * @access public
266
+ * @param string $role
267
+ * @return string
268
+ */
269
+ function members_translate_role( $role ) {
270
+ global $wp_roles;
271
+
272
+ return apply_filters( 'members_translate_role', translate_user_role( $wp_roles->role_names[ $role ] ), $role );
273
+ }
274
+
275
+ /**
276
+ * Conditional tag to check if a role has any users.
277
+ *
278
+ * @since 1.0.0
279
+ * @access public
280
+ * @return bool
281
+ */
282
+ function members_role_has_users( $role ) {
283
+ return in_array( $role, members_get_active_role_slugs() );
284
+ }
285
+
286
+ /**
287
+ * Conditional tag to check if a role has any capabilities.
288
+ *
289
+ * @since 1.0.0
290
+ * @access public
291
+ * @return bool
292
+ */
293
+ function members_role_has_caps( $role ) {
294
+ return members_role_factory()->get_role( $role )->has_caps;
295
+ }
296
+
297
+ /**
298
+ * Counts the number of users for all roles on the site and returns this as an array. If
299
+ * the `$role` parameter is given, the return value will be the count just for that particular role.
300
+ *
301
+ * @since 0.2.0
302
+ * @access public
303
+ * @param string $role
304
+ * @return int|array
305
+ */
306
+ function members_get_role_user_count( $role = '' ) {
307
+
308
+ // If the count is not already set for all roles, let's get it.
309
+ if ( empty( members_plugin()->role_user_count ) ) {
310
+
311
+ // Count users.
312
+ $user_count = count_users();
313
+
314
+ // Loop through the user count by role to get a count of the users with each role.
315
+ foreach ( $user_count['avail_roles'] as $_role => $count )
316
+ members_plugin()->role_user_count[ $_role ] = $count;
317
+ }
318
+
319
+ // Return the role count.
320
+ if ( $role )
321
+ return isset( members_plugin()->role_user_count[ $role ] ) ? members_plugin()->role_user_count[ $role ] : 0;
322
+
323
+ // If the `$role` parameter wasn't passed into this function, return the array of user counts.
324
+ return members_plugin()->role_user_count;
325
+ }
326
+
327
+ /**
328
+ * Returns the number of granted capabilities that a role has.
329
+ *
330
+ * @since 1.0.0
331
+ * @access public
332
+ * @param string
333
+ * @return int
334
+ */
335
+ function members_get_role_granted_cap_count( $role ) {
336
+ return members_role_factory()->get_role( $role )->granted_cap_count;
337
+ }
338
+
339
+ /**
340
+ * Returns the number of denied capabilities that a role has.
341
+ *
342
+ * @since 1.0.0
343
+ * @access public
344
+ * @param string
345
+ * @return int
346
+ */
347
+ function members_get_role_denied_cap_count( $role ) {
348
+ return members_role_factory()->get_role( $role )->denied_cap_count;
349
+ }
350
+
351
+ /**
352
+ * Returns the human-readable role name.
353
+ *
354
+ * @since 1.0.0
355
+ * @access public
356
+ * @param string $role
357
+ * @return string
358
+ */
359
+ function members_get_role_name( $role ) {
360
+ return members_role_factory()->get_role( $role )->name;
361
+ }
362
+
363
+ /**
364
+ * Conditional tag to check whether a role can be edited.
365
+ *
366
+ * @since 1.0.0
367
+ * @access public
368
+ * @param string $role
369
+ * @return bool
370
+ */
371
+ function members_is_role_editable( $role ) {
372
+ return members_role_factory()->get_role( $role )->is_editable;
373
+ }
374
+
375
+ /**
376
+ * Conditional tag to check whether a role is a core WordPress URL.
377
+ *
378
+ * @since 1.0.0
379
+ * @access public
380
+ * @param string $role
381
+ * @return bool
382
+ */
383
+ function members_is_wordpress_role( $role ) {
384
+ return in_array( $role, array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ) );
385
+ }
386
+
387
+ /* ====== URLs ====== */
388
+
389
+ /**
390
+ * Returns the URL for the add-new role admin screen.
391
+ *
392
+ * @since 1.0.0
393
+ * @access public
394
+ * @return string
395
+ */
396
+ function members_get_new_role_url() {
397
+ return add_query_arg( 'page', 'role-new', admin_url( 'users.php' ) );
398
+ }
399
+
400
+ /**
401
+ * Returns the URL for the clone role admin screen.
402
+ *
403
+ * @since 1.0.0
404
+ * @access public
405
+ * @param string $role
406
+ * @return string
407
+ */
408
+ function members_get_clone_role_url( $role ) {
409
+ return add_query_arg( 'clone', $role, members_get_new_role_url() );
410
+ }
411
+
412
+ /**
413
+ * Returns the URL for the edit roles admin screen.
414
+ *
415
+ * @since 1.0.0
416
+ * @access public
417
+ * @return string
418
+ */
419
+ function members_get_edit_roles_url() {
420
+ return add_query_arg( 'page', 'roles', admin_url( 'users.php' ) );
421
+ }
422
+
423
+ /**
424
+ * Returns the URL for the edit "mine" roles admin screen.
425
+ *
426
+ * @since 1.0.0
427
+ * @access public
428
+ * @param string $view
429
+ * @return string
430
+ */
431
+ function members_get_role_view_url( $view ) {
432
+ return add_query_arg( 'role_view', $view, members_get_edit_roles_url() );
433
+ }
434
+
435
+ /**
436
+ * Returns the URL for the edit role admin screen.
437
+ *
438
+ * @since 1.0.0
439
+ * @access public
440
+ * @param string $role
441
+ * @return string
442
+ */
443
+ function members_get_edit_role_url( $role ) {
444
+ return add_query_arg( array( 'action' => 'edit', 'role' => $role ), members_get_edit_roles_url() );
445
+ }
446
+
447
+ /**
448
+ * Returns the URL to permanently delete a role (edit roles screen).
449
+ *
450
+ * @since 1.0.0
451
+ * @access public
452
+ * @param string $role
453
+ * @return string
454
+ */
455
+ function members_get_delete_role_url( $role ) {
456
+ $url = add_query_arg( array( 'action' => 'delete', 'role' => $role ), members_get_edit_roles_url() );
457
+
458
+ return wp_nonce_url( $url, 'delete_role', 'members_delete_role_nonce' );
459
+ }
460
+
461
+ /**
462
+ * Returns the URL for the users admin screen specific to a role.
463
+ *
464
+ * @since 1.0.0
465
+ * @access public
466
+ * @param string $role
467
+ * @return string
468
+ */
469
+ function members_get_role_users_url( $role ) {
470
+ return admin_url( add_query_arg( 'role', $role, 'users.php' ) );
471
+ }
inc/functions-shortcodes.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcodes for use within posts and other shortcode-aware areas.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Add shortcodes.
14
+ add_action( 'init', 'members_register_shortcodes' );
15
+
16
+ /**
17
+ * Registers shortcodes.
18
+ *
19
+ * @since 0.2.0
20
+ * @access public
21
+ * @return void
22
+ */
23
+ function members_register_shortcodes() {
24
+
25
+ // Add the `[members_login_form]` shortcode.
26
+ add_shortcode( 'members_login_form', 'members_login_form_shortcode' );
27
+ add_shortcode( 'login-form', 'members_login_form_shortcode' ); // @deprecated 1.0.0
28
+
29
+ // Add the `[members_access]` shortcode.
30
+ add_shortcode( 'members_access', 'members_access_check_shortcode' );
31
+ add_shortcode( 'access', 'members_access_check_shortcode' ); // @deprecated 1.0.0
32
+
33
+ // Add the `[members_feed]` shortcode.
34
+ add_shortcode( 'members_feed', 'members_feed_shortcode' );
35
+ add_shortcode( 'feed', 'members_feed_shortcode' ); // @deprecated 1.0.0
36
+
37
+ // Add the `[members_logged_in]` shortcode.
38
+ add_shortcode( 'members_logged_in', 'members_is_user_logged_in_shortcode' );
39
+ add_shortcode( 'is_user_logged_in', 'members_is_user_logged_in_shortcode' ); // @deprecated 1.0.0
40
+
41
+ // @deprecated 0.2.0.
42
+ add_shortcode( 'get_avatar', 'members_get_avatar_shortcode' );
43
+ add_shortcode( 'avatar', 'members_get_avatar_shortcode' );
44
+ }
45
+
46
+ /**
47
+ * Displays content if the user viewing it is currently logged in. This also blocks content
48
+ * from showing in feeds.
49
+ *
50
+ * @since 0.1.0
51
+ * @access public
52
+ * @param array $attr
53
+ * @param string $content
54
+ * @return string
55
+ */
56
+ function members_is_user_logged_in_shortcode( $attr, $content = null ) {
57
+
58
+ return is_feed() || ! is_user_logged_in() || is_null( $content ) ? '' : do_shortcode( $content );
59
+ }
60
+
61
+ /**
62
+ * Content that should only be shown in feed readers. Can be useful for displaying
63
+ * feed-specific items.
64
+ *
65
+ * @since 0.1.0
66
+ * @access public
67
+ * @param array $attr
68
+ * @param string $content
69
+ * @return string
70
+ */
71
+ function members_feed_shortcode( $attr, $content = null ) {
72
+
73
+ return ! is_feed() || is_null( $content ) ? '' : do_shortcode( $content );
74
+ }
75
+
76
+ /**
77
+ * Provide/restrict access to specific roles or capabilities. This content should not be shown
78
+ * in feeds. Note that capabilities are checked first. If a capability matches, any roles
79
+ * added will *not* be checked. Users should choose between using either capabilities or roles
80
+ * for the check rather than both. The best option is to always use a capability.
81
+ *
82
+ * @since 0.1.0
83
+ * @access public
84
+ * @param array $attr
85
+ * @param string $content
86
+ * @return string
87
+ */
88
+ function members_access_check_shortcode( $attr, $content = null ) {
89
+
90
+ // If there's no content or if viewing a feed, return an empty string.
91
+ if ( is_null( $content ) || is_feed() )
92
+ return '';
93
+
94
+ // Set up the default attributes.
95
+ $defaults = array(
96
+ 'capability' => '', // Single capability or comma-separated multiple capabilities.
97
+ 'role' => '', // Single role or comma-separated multiple roles.
98
+ );
99
+
100
+ // Merge the input attributes and the defaults.
101
+ shortcode_atts( $defaults, $attr, 'members_access' );
102
+
103
+ // If the current user has the capability, show the content.
104
+ if ( $attr['capability'] ) {
105
+
106
+ // Get the capabilities.
107
+ $caps = explode( ',', $attr['capability'] );
108
+
109
+ // Loop through each capability.
110
+ foreach ( $caps as $cap ) {
111
+
112
+ // If the current user can perform the capability, return the content.
113
+ if ( current_user_can( trim( $cap ) ) )
114
+ return do_shortcode( $content );
115
+ }
116
+ }
117
+
118
+ // If the current user has the role, show the content.
119
+ if ( $attr['role'] ) {
120
+
121
+ // Get the roles.
122
+ $roles = explode( ',', $attr['role'] );
123
+
124
+ // Loop through each of the roles.
125
+ foreach ( $roles as $role ) {
126
+
127
+ // If the current user has the role, return the content.
128
+ if ( members_user_has_role( trim( $role ) ) )
129
+ return do_shortcode( $content );
130
+ }
131
+ }
132
+
133
+ // Return an empty string if we've made it to this point.
134
+ return '';
135
+ }
136
+
137
+ /**
138
+ * Displays a login form.
139
+ *
140
+ * @since 0.1.0
141
+ * @access public
142
+ * @return string
143
+ */
144
+ function members_login_form_shortcode() {
145
+ return wp_login_form( array( 'echo' => false ) );
146
+ }
inc/functions-users.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User-related functions and filters.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ // Filter `user_has_cap` if denied caps should take precedence.
14
+ if ( members_explicitly_deny_caps() ) {
15
+ add_filter( 'user_has_cap', 'members_user_has_cap_filter', 10, 4 );
16
+ }
17
+
18
+ /**
19
+ * Filter on `user_has_cap` to explicitly deny caps if there are conflicting caps when a
20
+ * user has multiple roles. WordPress doesn't consistently handle two or more roles that
21
+ * have the same capability but a conflict between being granted or denied. Core WP
22
+ * merges the role caps so that the last role the user has will take precedence. This
23
+ * has the potential for granting permission for things that a user shouldn't have
24
+ * permission to do.
25
+ *
26
+ * @since 1.0.0
27
+ * @access public
28
+ * @param array $allcaps
29
+ * @param array $caps
30
+ * @param array $args
31
+ * @param object $user
32
+ * @return array
33
+ */
34
+ function members_user_has_cap_filter( $allcaps, $caps, $args, $user ) {
35
+
36
+ // If the user doesn't have more than one role, bail.
37
+ if ( 1 >= count( (array) $user->roles ) )
38
+ return $allcaps;
39
+
40
+ // Get the denied caps.
41
+ $denied_caps = array_keys( $allcaps, false );
42
+
43
+ // Loop through the user's roles and find any denied caps.
44
+ foreach ( (array) $user->roles as $role ) {
45
+ $denied_caps = array_merge( $denied_caps, array_keys( get_role( $role )->capabilities, false ) );
46
+ }
47
+
48
+ // If there are any denied caps, make sure they take precedence.
49
+ if ( $denied_caps ) {
50
+
51
+ foreach ( $denied_caps as $denied_cap ) {
52
+ $allcaps[ $denied_cap ] = false;
53
+ }
54
+ }
55
+
56
+ // Return all the user caps.
57
+ return $allcaps;
58
+ }
59
+
60
+ /**
61
+ * Conditional tag to check whether a user has a specific role.
62
+ *
63
+ * @since 1.0.0
64
+ * @access public
65
+ * @param int $user_id
66
+ * @param string $role
67
+ * @return bool
68
+ */
69
+ function members_user_has_role( $user_id, $role ) {
70
+
71
+ $user = new WP_User( $user_id );
72
+
73
+ return in_array( $role, (array) $user->roles );
74
+ }
75
+
76
+ /**
77
+ * Conditional tag to check whether the currently logged-in user has a specific role.
78
+ *
79
+ * @since 1.0.0
80
+ * @access public
81
+ * @param string $role
82
+ * @return bool
83
+ */
84
+ function members_current_user_has_role( $role ) {
85
+
86
+ return is_user_logged_in() ? members_user_has_role( get_current_user_id(), $role ) : false;
87
+ }
88
+
89
+ /**
90
+ * Returns an array of the role names a user has.
91
+ *
92
+ * @since 1.0.0
93
+ * @access public
94
+ * @param int $user_id
95
+ * @return array
96
+ */
97
+ function members_get_user_role_names( $user_id ) {
98
+
99
+ $user = new WP_User( $user_id );
100
+
101
+ $names = array();
102
+
103
+ foreach ( $user->roles as $role )
104
+ $names[ $role ] = members_get_role_name( $role );
105
+
106
+ return $names;
107
+ }
inc/functions-widgets.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loads and enables the widgets for the plugin.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ # Hook widget registration to the 'widgets_init' hook.
14
+ add_action( 'widgets_init', 'members_register_widgets' );
15
+
16
+ /**
17
+ * Registers widgets for the plugin.
18
+ *
19
+ * @since 0.2.0
20
+ * @access public
21
+ * @return void
22
+ */
23
+ function members_register_widgets() {
24
+
25
+ // If the login form widget is enabled.
26
+ if ( members_login_widget_enabled() ) {
27
+
28
+ require_once( members_plugin()->inc_dir . 'class-widget-login.php' );
29
+
30
+ register_widget( 'Members_Widget_Login' );
31
+ }
32
+
33
+ // If the users widget is enabled.
34
+ if ( members_users_widget_enabled() ) {
35
+
36
+ require_once( members_plugin()->inc_dir . 'class-widget-users.php' );
37
+
38
+ register_widget( 'Members_Widget_users' );
39
+ }
40
+ }
inc/functions.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * General functions file for the plugin.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Validates a value as a boolean. This way, strings such as "true" or "false" will be converted
15
+ * to their correct boolean values.
16
+ *
17
+ * @since 1.0.0
18
+ * @access public
19
+ * @param mixed $val
20
+ * @return bool
21
+ */
22
+ function members_validate_boolean( $val ) {
23
+ return filter_var( $val, FILTER_VALIDATE_BOOLEAN );
24
+ }
inc/template.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template-related functions for theme authors.
4
+ *
5
+ * @package Members
6
+ * @subpackage Includes
7
+ * @author Justin Tadlock <justin@justintadlock.com>
8
+ * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
9
+ * @link http://themehybrid.com/plugins/members
10
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+ */
12
+
13
+ /**
14
+ * Conditional tag to check if a user can view a specific post. A user cannot view a post if their
15
+ * user role has not been selected in the 'Content Permissions' meta box on the edit post screen in
16
+ * the admin. Non-logged in site visitors cannot view posts if roles were selected. If no roles
17
+ * were selected, all users and site visitors can view the content.
18
+ *
19
+ * There are exceptions to this rule though. The post author, any user with the `restrict_content`
20
+ * capability, and users that have the ability to edit the post can always view the post, even if
21
+ * their role was not granted permission to view it.
22
+ *
23
+ * @since 0.2.0
24
+ * @access public
25
+ * @param int $user_id
26
+ * @param int $post_id
27
+ * @return bool
28
+ */
29
+ function members_can_user_view_post( $user_id, $post_id = '' ) {
30
+
31
+ // If no post ID is given, assume we're in The Loop and get the current post's ID.
32
+ if ( ! $post_id )
33
+ $post_id = get_the_ID();
34
+
35
+ // Assume the user can view the post at this point. */
36
+ $can_view = true;
37
+
38
+ // The plugin is only going to handle permissions if the 'content permissions' feature
39
+ // is active. If not active, the user can always view the post. However, developers
40
+ // can roll their own handling of this and filter `members_can_user_view_post`.
41
+ if ( members_content_permissions_enabled() ) {
42
+
43
+ // Get the roles selected by the user.
44
+ $roles = members_get_post_roles( $post_id );
45
+
46
+ // Check if there are any old roles with the '_role' meta key.
47
+ if ( empty( $roles ) )
48
+ $roles = members_convert_old_post_meta( $post_id );
49
+
50
+ // If we have an array of roles, let's get to work.
51
+ if ( ! empty( $roles ) && is_array( $roles ) ) {
52
+
53
+ // Since specific roles were given, let's assume the user can't view
54
+ // the post at this point. The rest of this functionality should try
55
+ // to disprove this.
56
+ $can_view = false;
57
+
58
+ // Get the post object.
59
+ $post = get_post( $post_id );
60
+
61
+ // Get the post type object.
62
+ $post_type = get_post_type_object( $post->post_type );
63
+
64
+ // If viewing a feed or if the user's not logged in, assume it's blocked at this point.
65
+ if ( is_feed() || ! is_user_logged_in() ) {
66
+ $can_view = false;
67
+ }
68
+
69
+ // If the post author, the current user can edit the post, or the current user can 'restrict_content', return true.
70
+ elseif ( $post->post_author == $user_id || user_can( $user_id, 'restrict_content' ) || user_can( $user_id, $post_type->cap->edit_post, $post_id ) ) {
71
+ $can_view = true;
72
+ }
73
+
74
+ // Else, let's check the user's role against the selected roles.
75
+ else {
76
+
77
+ // Loop through each role and set $can_view to true if the user has one of the roles.
78
+ foreach ( $roles as $role ) {
79
+
80
+ if ( members_user_has_role( $user_id, $role ) ) {
81
+ $can_view = true;
82
+ break;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ // Set the check for the parent post based on whether we have permissions for this post.
90
+ $check_parent = empty( $roles ) && $can_view;
91
+
92
+ // Set to `FALSE` to avoid hierarchical checking.
93
+ if ( apply_filters( 'members_check_parent_post_permission', $check_parent, $post_id, $user_id ) ) {
94
+
95
+ $parent_id = get_post( $post_id )->post_parent;
96
+
97
+ // If the post has a parent, check if the user has permission to view it.
98
+ if ( 0 < $parent_id )
99
+ $can_view = members_can_user_view_post( $user_id, $parent_id );
100
+ }
101
+
102
+ // Allow developers to overwrite the final return value.
103
+ return apply_filters( 'members_can_user_view_post', $can_view, $user_id, $post_id );
104
+ }
105
+
106
+ /**
107
+ * Wrapper function for the members_can_user_view_post() function. This function checks if the
108
+ * currently logged-in user can view the content of a specific post.
109
+ *
110
+ * @since 0.2.0
111
+ * @access public
112
+ * @param int $post_id
113
+ * @return bool
114
+ */
115
+ function members_can_current_user_view_post( $post_id = '' ) {
116
+
117
+ return members_can_user_view_post( get_current_user_id(), $post_id );
118
+ }
119
+
120
+ /**
121
+ * Function for listing users like the WordPress function currently uses for authors.
122
+ *
123
+ * @link http://core.trac.wordpress.org/ticket/15145
124
+ * @since 0.1.0
125
+ * @access public
126
+ * @param array $args
127
+ * @return string
128
+ */
129
+ function members_list_users( $args = array() ) {
130
+
131
+ $output = '';
132
+ $users = get_users( $args );
133
+
134
+ if ( ! empty( $users ) ) {
135
+
136
+ foreach ( $users as $user ) {
137
+
138
+ $url = get_author_posts_url( $author->ID, $author->user_nicename );
139
+
140
+ $class = sanitize_html_class( "user-{$user->ID}" );
141
+
142
+ if ( is_author( $user->ID ) )
143
+ $class .= ' current-user';
144
+
145
+ $output .= sprintf( '<li class="%s"><a href="%s">%s</a></li>', esc_attr( $class ), esc_url( $url ), esc_html( $user->display_name ) );
146
+ }
147
+
148
+ $output = sprintf( '<ul class="xoxo members-list-users">%s</ul>', $output );
149
+ }
150
+
151
+ $output = apply_filters( 'members_list_users', $output );
152
+
153
+ if ( empty( $args['echo'] ) )
154
+ return $output;
155
+
156
+ echo $output;
157
+ }
includes/admin-bar.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- /**
3
- * Functions for modifying the WordPress admin bar.
4
- *
5
- * @package Members
6
- * @subpackage Functions
7
- */
8
-
9
- /* Hook the members admin bar to 'wp_before_admin_bar_render'. */
10
- add_action( 'wp_before_admin_bar_render', 'members_admin_bar' );
11
-
12
- /**
13
- * Adds new menu items to the WordPress admin bar.
14
- *
15
- * @since 0.2.0
16
- * @global object $wp_admin_bar
17
- */
18
- function members_admin_bar() {
19
- global $wp_admin_bar;
20
-
21
- /* Check if the current user can 'create_roles'. */
22
- if ( current_user_can( 'create_roles' ) ) {
23
-
24
- /* Add a 'Role' menu item as a sub-menu item of the new content menu. */
25
- $wp_admin_bar->add_menu(
26
- array(
27
- 'id' => 'members-new-role',
28
- 'parent' => 'new-content',
29
- 'title' => esc_attr__( 'Role', 'members' ),
30
- 'href' => admin_url( 'users.php?page=role-new' )
31
- )
32
- );
33
- }
34
- }
35
-
36
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/capabilities.php DELETED
@@ -1,245 +0,0 @@
1
- <?php
2
- /**
3
- * @package Members
4
- * @subpackage Includes
5
- */
6
-
7
- /* Disables the old levels from being seen. If you need them, use remove_filter() to add display back. */
8
- add_filter( 'members_get_capabilities', 'members_remove_old_levels' );
9
-
10
- /**
11
- * The function that makes this plugin what it is. It returns all of our capabilities in a nicely-formatted,
12
- * alphabetized array with no duplicate capabilities. It pulls from three different functions to make sure
13
- * we get all of the capabilities that we need for use in the plugin components.
14
- *
15
- * @since 0.1.0
16
- * @uses members_get_default_capabilities() Gets an array of WP's default capabilities.
17
- * @uses members_get_role_capabilities() Gets an array of all the capabilities currently mapped to a role.
18
- * @uses members_get_additional_capabilities() Gets an array of capabilities added by the plugin.
19
- * @return array $capabilities An array containing all of the capabilities.
20
- */
21
- function members_get_capabilities() {
22
-
23
- /* Capabilities array. */
24
- $capabilities = array();
25
-
26
- /* Grab the default capabilities (these are set by the plugin so the user doesn't lose them). */
27
- $default_caps = members_get_default_capabilities();
28
-
29
- /* Get the user capabilities that are already set. */
30
- $role_caps = members_get_role_capabilities();
31
-
32
- /* Gets capabilities added by the plugin. */
33
- $plugin_caps = members_get_additional_capabilities();
34
-
35
- /* Merge all the capability arrays (current role caps, plugin caps, and default WP caps) together. */
36
- $capabilities = array_merge( $default_caps, $role_caps, $plugin_caps );
37
-
38
- /* Apply filters to the array of capabilities. Devs should respect the available capabilities and return an array. */
39
- $capabilities = apply_filters( 'members_get_capabilities', $capabilities );
40
-
41
- /* Sort the capabilities by name so they're easier to read when shown on the screen. */
42
- sort( $capabilities );
43
-
44
- /* Return the array of capabilities, making sure we have no duplicates. */
45
- return array_unique( $capabilities );
46
- }
47
-
48
- /**
49
- * Gets an array of capabilities according to each user role. Each role will return its caps, which are then
50
- * added to the overall $capabilities array.
51
- *
52
- * Note that if no role has the capability, it technically no longer exists. Since this could be a problem with
53
- * folks accidentally deleting the default WordPress capabilities, the members_default_capabilities() will
54
- * return all the defaults.
55
- *
56
- * @since 0.1.0
57
- * @return array $capabilities All the capabilities of all the user roles.
58
- * @global array $wp_roles Holds all the roles for the installation.
59
- */
60
- function members_get_role_capabilities() {
61
- global $wp_roles;
62
-
63
- /* Set up an empty capabilities array. */
64
- $capabilities = array();
65
-
66
- /* Loop through each role object because we need to get the caps. */
67
- foreach ( $wp_roles->role_objects as $key => $role ) {
68
-
69
- /* Roles without capabilities will cause an error, so we need to check if $role->capabilities is an array. */
70
- if ( is_array( $role->capabilities ) ) {
71
-
72
- /* Loop through the role's capabilities and add them to the $capabilities array. */
73
- foreach ( $role->capabilities as $cap => $grant )
74
- $capabilities[$cap] = $cap;
75
- }
76
- }
77
-
78
- /* Return the capabilities array, making sure there are no duplicates. */
79
- return array_unique( $capabilities );
80
- }
81
-
82
- /**
83
- * Additional capabilities provided by the Members plugin that gives users permissions to handle certain features
84
- * of the plugin.
85
- *
86
- * @todo Integrate 'edit_roles' into the settings. It should be a priority on initial setup.
87
- * @todo Move each capability within its component. Use the 'members_get_capabilities' filter hook to add them.
88
- *
89
- * @since 0.1.0
90
- * @return array $capabilities
91
- */
92
- function members_get_additional_capabilities() {
93
-
94
- $capabilities = array(
95
- 'list_roles', // Ability to view roles list
96
- 'create_roles', // Ability to create new roles
97
- 'delete_roles', // Ability to delete roles
98
- 'edit_roles', // Ability to edit a role's caps
99
- 'restrict_content' // Ability to restrict content (content permissions component)
100
- );
101
-
102
- return $capabilities;
103
- }
104
-
105
- /**
106
- * Make sure we keep the default capabilities in case users screw 'em up. A user could easily remove a
107
- * useful WordPress capability from all roles. When this happens, the capability is no longer stored in any of
108
- * the roles, so it basically doesn't exist. This function will house all of the default WordPress capabilities in
109
- * case this scenario comes into play.
110
- *
111
- * For those reading this note, yes, I did "accidentally" remove all capabilities from my administrator account
112
- * when developing this plugin. And yes, that was fun putting back together. ;)
113
- *
114
- * The Codex has a list of all the defaults:
115
- * @link http://codex.wordpress.org/Roles_and_Capabilities#Capabilities
116
- *
117
- * @since 0.1
118
- * @return array $defaults All the default WordPress capabilities.
119
- */
120
- function members_get_default_capabilities() {
121
-
122
- /* Create an array of all the default WordPress capabilities so the user doesn't accidentally get rid of them. */
123
- $defaults = array(
124
- 'activate_plugins',
125
- 'add_users',
126
- 'create_users',
127
- 'delete_others_pages',
128
- 'delete_others_posts',
129
- 'delete_pages',
130
- 'delete_plugins',
131
- 'delete_posts',
132
- 'delete_private_pages',
133
- 'delete_private_posts',
134
- 'delete_published_pages',
135
- 'delete_published_posts',
136
- 'delete_users',
137
- 'edit_dashboard',
138
- 'edit_files',
139
- 'edit_others_pages',
140
- 'edit_others_posts',
141
- 'edit_pages',
142
- 'edit_plugins',
143
- 'edit_posts',
144
- 'edit_private_pages',
145
- 'edit_private_posts',
146
- 'edit_published_pages',
147
- 'edit_published_posts',
148
- 'edit_theme_options',
149
- 'edit_themes',
150
- 'edit_users',
151
- 'import',
152
- 'install_plugins',
153
- 'install_themes',
154
- 'list_users',
155
- 'manage_categories',
156
- 'manage_links',
157
- 'manage_options',
158
- 'moderate_comments',
159
- 'promote_users',
160
- 'publish_pages',
161
- 'publish_posts',
162
- 'read',
163
- 'read_private_pages',
164
- 'read_private_posts',
165
- 'remove_users',
166
- 'switch_themes',
167
- 'unfiltered_html',
168
- 'unfiltered_upload',
169
- 'update_core',
170
- 'update_plugins',
171
- 'update_themes',
172
- 'upload_files'
173
- );
174
-
175
- /* Return the array of default capabilities. */
176
- return $defaults;
177
- }
178
-
179
- /**
180
- * Checks if a specific capability has been given to at least one role. If it has, return true. Else, return false.
181
- *
182
- * @since 0.1.0
183
- * @uses members_get_role_capabilities() Checks for capability in array of role caps.
184
- * @param string $cap Name of the capability to check for.
185
- * @return true|false bool Whether the capability has been given to a role.
186
- */
187
- function members_check_for_cap( $cap = '' ) {
188
-
189
- /* Without a capability, we have nothing to check for. Just return false. */
190
- if ( !$cap )
191
- return false;
192
-
193
- /* Gets capabilities that are currently mapped to a role. */
194
- $caps = members_get_role_capabilities();
195
-
196
- /* If the capability has been given to at least one role, return true. */
197
- if ( in_array( $cap, $caps ) )
198
- return true;
199
-
200
- /* If no role has been given the capability, return false. */
201
- return false;
202
- }
203
-
204
- /**
205
- * Old WordPress levels system. This is mostly useful for filtering out the levels when shown in admin
206
- * screen. Plugins shouldn't rely on these levels to create permissions for users. They should move to the
207
- * newer system of checking for a specific capability instead.
208
- *
209
- * @since 0.1.0
210
- * @return array Old user levels.
211
- */
212
- function members_get_old_levels() {
213
- return array( 'level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', 'level_6', 'level_7', 'level_8', 'level_9', 'level_10' );
214
- }
215
-
216
- /**
217
- * Get rid of levels since these are mostly useless in newer versions of WordPress.
218
- *
219
- * To remove this filter:
220
- * remove_filter( 'members_get_capabilities', 'members_remove_old_levels' );
221
- *
222
- * @since 0.1.0
223
- * @param $capabilities array All of the combined capabilities.
224
- * @return $capabilities array Capabilities with old user levels removed.
225
- */
226
- function members_remove_old_levels( $capabilities ) {
227
- return array_diff( $capabilities, members_get_old_levels() );
228
- }
229
-
230
- /**
231
- * Returns an array of capabilities that should be set on the New Role admin screen. By default, the only
232
- * capability checked is 'read' because it's needed for users of the role to view their profile in the admin.
233
- *
234
- * @since 0.1.0
235
- * @return $capabilities array Default capabilities for new roles.
236
- */
237
- function members_new_role_default_capabilities() {
238
-
239
- $capabilities = array( 'read' );
240
-
241
- /* Filters should return an array. */
242
- return apply_filters( 'members_new_role_default_capabilities', $capabilities );
243
- }
244
-
245
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/content-permissions.php DELETED
@@ -1,152 +0,0 @@
1
- <?php
2
- /**
3
- * Handles permissions for post content, post excerpts, and post comments. This is based on whether a user
4
- * has permission to view a post according to the settings provided by the plugin.
5
- *
6
- * @package Members
7
- * @subpackage Functions
8
- */
9
-
10
- /* Enable the content permissions features. */
11
- add_action( 'after_setup_theme', 'members_enable_content_permissions', 1 );
12
-
13
- /**
14
- * Adds required filters for the content permissions feature if it is active.
15
- *
16
- * @since 0.2.0
17
- */
18
- function members_enable_content_permissions() {
19
-
20
- /* Only add filters if the content permissions feature is enabled and we're not in the admin. */
21
- if ( members_get_setting( 'content_permissions' ) && !is_admin() ) {
22
-
23
- /* Filter the content and exerpts. */
24
- add_filter( 'the_content', 'members_content_permissions_protect' );
25
- add_filter( 'get_the_excerpt', 'members_content_permissions_protect' );
26
- add_filter( 'the_excerpt', 'members_content_permissions_protect' );
27
- add_filter( 'the_content_feed', 'members_content_permissions_protect' );
28
- add_filter( 'comment_text_rss', 'members_content_permissions_protect' );
29
-
30
- /* Filter the comments template to make sure comments aren't shown to users without access. */
31
- add_filter( 'comments_template', 'members_content_permissions_comments' );
32
-
33
- /* Use WP formatting filters on the post error message. */
34
- add_filter( 'members_post_error_message', 'wptexturize' );
35
- add_filter( 'members_post_error_message', 'convert_smilies' );
36
- add_filter( 'members_post_error_message', 'convert_chars' );
37
- add_filter( 'members_post_error_message', 'wpautop' );
38
- add_filter( 'members_post_error_message', 'shortcode_unautop' );
39
- add_filter( 'members_post_error_message', 'do_shortcode' );
40
- }
41
- }
42
-
43
- /**
44
- * Denies/Allows access to view post content depending on whether a user has permission to view the content.
45
- *
46
- * @since 0.1.0
47
- * @param string $content The content of a post.
48
- * @param string $content The content of a post or an error message.
49
- */
50
- function members_content_permissions_protect( $content ) {
51
-
52
- /* If the current user can view the post, return the post content. */
53
- if ( members_can_current_user_view_post( get_the_ID() ) )
54
- return $content;
55
-
56
- /* Return an error message at this point. */
57
- return members_get_post_error_message( get_the_ID() );
58
- }
59
-
60
- /**
61
- * Disables the comments template if a user doesn't have permission to view the post the comments are
62
- * associated with.
63
- *
64
- * @since 0.1.0
65
- * @param string $template The Comments template.
66
- * @return string $template
67
- */
68
- function members_content_permissions_comments( $template ) {
69
-
70
- /* Check if the current user has permission to view the comments' post. */
71
- if ( !members_can_current_user_view_post( get_queried_object_id() ) ) {
72
-
73
- /* Look for a 'comments-no-access.php' template in the parent and child theme. */
74
- $has_template = locate_template( array( 'comments-no-access.php' ) );
75
-
76
- /* If the template was found, use it. Otherwise, fall back to the Members comments.php template. */
77
- $template = ( !empty( $has_template ) ? $has_template : MEMBERS_INCLUDES . 'comments.php' );
78
-
79
- /* Allow devs to overwrite the comments template. */
80
- $template = apply_filters( 'members_comments_template', $template );
81
- }
82
-
83
- /* Return the comments template filename. */
84
- return $template;
85
- }
86
-
87
- /**
88
- * Gets the error message to display for users who do not have access to view the given post. The function first
89
- * checks to see if a custom error message has been written for the specific post. If not, it loads the error
90
- * message set on the plugins settings page.
91
- *
92
- * @since 0.2.0
93
- * @param int $post_id The ID of the post to get the error message for.
94
- * @return string $return The error message.
95
- */
96
- function members_get_post_error_message( $post_id ) {
97
-
98
- /* Get the error message for the specific post. */
99
- $error_message = get_post_meta( $post_id, '_members_access_error', true );
100
-
101
- /* If an error message is found, return it. */
102
- if ( !empty( $error_message ) )
103
- $return = $error_message;
104
-
105
- /* If no error message is found, return the default message. */
106
- else
107
- $return = members_get_setting( 'content_permissions_error' );
108
-
109
- /* Return the error message. */
110
- return apply_filters( 'members_post_error_message', $return );
111
- }
112
-
113
- /**
114
- * Converts the meta values of the old '_role' post meta key to the newer '_members_access_role' meta
115
- * key. The reason for this change is to avoid any potential conflicts with other plugins/themes. We're
116
- * now using a meta key that is extremely specific to the Members plugin.
117
- *
118
- * @since 0.2.0
119
- * @param int $post_id The ID of the post to convert the post meta for.
120
- * @return array|bool $old_roles|false Returns the array of old roles or false for everything else.
121
- */
122
- function members_convert_old_post_meta( $post_id ) {
123
-
124
- /* Check if there are any meta values for the '_role' meta key. */
125
- $old_roles = get_post_meta( $post_id, '_role', false );
126
-
127
- /* If roles were found, let's convert them. */
128
- if ( !empty( $old_roles ) ) {
129
-
130
- /* Delete the old '_role' post meta. */
131
- delete_post_meta( $post_id, '_role' );
132
-
133
- /* Check if there are any roles for the '_members_access_role' meta key. */
134
- $new_roles = get_post_meta( $post_id, '_members_access_role', false );
135
-
136
- /* If new roles were found, don't do any conversion. */
137
- if ( empty( $new_roles ) ) {
138
-
139
- /* Loop through the old meta values for '_role' and add them to the new '_members_access_role' meta key. */
140
- foreach ( $old_roles as $role )
141
- add_post_meta( $post_id, '_members_access_role', $role, false );
142
-
143
- /* Return the array of roles. */
144
- return $old_roles;
145
- }
146
- }
147
-
148
- /* Return false if we get to this point. */
149
- return false;
150
- }
151
-
152
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/deprecated.php DELETED
@@ -1,98 +0,0 @@
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 Functions
7
- */
8
-
9
- /**
10
- * @since 0.1.0
11
- * @deprecated 0.2.0 This is theme functionality. Let's just leave it to themes.
12
- */
13
- function members_author_profile() {
14
- _deprecated_function( __FUNCTION__, '0.2.0', '' ); ?>
15
-
16
- <div class="author-profile vcard">
17
- <?php echo get_avatar( get_the_author_meta( 'user_email' ), '100', '', get_the_author_meta( 'display_name' ) ); ?>
18
- <h4 class="author-name fn n"><?php the_author_posts_link(); ?></h4>
19
- <p class="author-description author-bio">
20
- <?php echo the_author_meta( 'description' ); ?>
21
- </p>
22
- </div>
23
- <?php
24
- }
25
-
26
- /**
27
- * @since 0.1.0
28
- * @deprecated 0.2.0 Use wp_login_form() instead.
29
- */
30
- function members_login_form() {
31
- _deprecated_function( __FUNCTION__, '0.2.0', 'wp_login_form' );
32
-
33
- wp_login_form( array( 'echo' => true ) );
34
- }
35
-
36
- /**
37
- * @since 0.1.0
38
- * @deprecated 0.2.0
39
- */
40
- function members_get_login_form() {
41
- _deprecated_function( __FUNCTION__, '0.2.0', 'wp_login_form' );
42
-
43
- wp_login_form( array( 'echo' => false ) );
44
- }
45
-
46
- if ( !function_exists( 'has_role' ) ) {
47
-
48
- /**
49
- * @since 0.1.0
50
- * @deprecated 0.2.0
51
- */
52
- function has_role( $role, $user_id ) {
53
- _deprecated_function( __FUNCTION__, '0.2.0', 'user_can' );
54
-
55
- return user_can( $user_id, $role );
56
- }
57
- }
58
-
59
- if ( !function_exists( 'current_user_has_role' ) ) {
60
-
61
- /**
62
- * @since 0.1.0
63
- * @deprecated 0.2.0
64
- */
65
- function current_user_has_role() {
66
- _deprecated_function( __FUNCTION__, '0.2.0', 'current_user_can' );
67
-
68
- return current_user_can( $role );
69
- }
70
- }
71
-
72
- /**
73
- * @since 0.1.0
74
- * @deprecated 0.2.0
75
- */
76
- function members_get_avatar_shortcode( $attr ) {
77
- _deprecated_function( __FUNCTION__, '0.2.0', '' );
78
-
79
- /* Set up our default attributes. */
80
- $defaults = array(
81
- 'id' => '',
82
- 'email' => '',
83
- 'size' => 96,
84
- 'default' => '',
85
- 'alt' => ''
86
- );
87
-
88
- /* Merge the input attributes and the defaults. */
89
- extract( shortcode_atts( $defaults, $attr ) );
90
-
91
- /* If an email was input, use it. Else, use the ID. */
92
- $id_or_email = ( !empty( $email ) ? $email : $id );
93
-
94
- /* Return the avatar. */
95
- return get_avatar( $id_or_email, $size, $default, $alt );
96
- }
97
-
98
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- /**
3
- * General functions file for the plugin.
4
- *
5
- * @package Members
6
- * @subpackage Functions
7
- */
8
-
9
- /**
10
- * Gets a setting from from the plugin settings in the database.
11
- *
12
- * @since 0.2.0
13
- */
14
- function members_get_setting( $option = '' ) {
15
- global $members;
16
-
17
- if ( !$option )
18
- return false;
19
-
20
- if ( !isset( $members->settings ) )
21
- $members->settings = get_option( 'members_settings' );
22
-
23
- if ( !is_array( $members->settings ) || empty( $members->settings[$option] ) )
24
- return false;
25
-
26
- return $members->settings[$option];
27
- }
28
-
29
- /**
30
- * Counts the number of roles the site has.
31
- *
32
- * @since 0.2.0
33
- */
34
- function members_count_roles() {
35
- global $wp_roles;
36
-
37
- if ( !empty( $wp_roles->role_names ) )
38
- return count( apply_filters( 'editable_roles', $wp_roles->role_names ) );
39
-
40
- return false;
41
- }
42
-
43
- /**
44
- * Gets all the roles that have users for the site.
45
- *
46
- * @since 0.2.0
47
- */
48
- function members_get_active_roles() {
49
- global $wp_roles, $members;
50
-
51
- if ( !isset( $members->active_roles ) ) {
52
-
53
- $active = array();
54
-
55
- foreach ( apply_filters( 'editable_roles', $wp_roles->role_names ) as $role => $name ) {
56
-
57
- $count = members_get_role_user_count( $role );
58
-
59
- if ( !empty( $count ) )
60
- $active[$role] = $name;
61
- }
62
-
63
- $members->active_roles = $active;
64
- }
65
-
66
- return $members->active_roles;
67
- }
68
-
69
- /**
70
- * Gets all the roles that do not have users for the site.
71
- *
72
- * @since 0.2.0
73
- */
74
- function members_get_inactive_roles() {
75
- global $wp_roles, $members;
76
-
77
- if ( !isset( $members->inactive_roles ) ) {
78
-
79
- $inactive = array();
80
-
81
- foreach ( apply_filters( 'editable_roles', $wp_roles->role_names ) as $role => $name ) {
82
-
83
- $count = members_get_role_user_count( $role );
84
-
85
- if ( empty( $count ) )
86
- $inactive[$role] = $name;
87
- }
88
-
89
- $members->inactive_roles = $inactive;
90
- }
91
-
92
- return $members->inactive_roles;
93
- }
94
-
95
- /**
96
- * Counts the number of users for all roles on the site and returns this as an array. If the $user_role is input,
97
- * the return value will be the count just for that particular role.
98
- *
99
- * @todo Use WP's cache API to cache this data.
100
- *
101
- * @since 0.2.0
102
- * @param string $user_role The role to get the user count for.
103
- */
104
- function members_get_role_user_count( $user_role = '' ) {
105
- global $members;
106
-
107
- /* If the count is not already set for all roles, let's get it. */
108
- if ( !isset( $members->role_user_count ) ) {
109
-
110
- $avail_roles = array();
111
-
112
- /* Count users */
113
- $user_count = count_users();
114
-
115
- /* Loop through the user count by role to get a count of the users with each role. */
116
- foreach ( $user_count['avail_roles'] as $role => $count )
117
- $avail_roles[$role] = $count;
118
-
119
- $members->role_user_count = $avail_roles;
120
- }
121
-
122
- /* If the $user_role parameter wasn't passed into this function, return the array of user counts. */
123
- if ( empty( $user_role ) )
124
- return $members->role_user_count;
125
-
126
- /* If the role has no users, we need to set it to '0'. */
127
- if ( !isset( $members->role_user_count[$user_role] ) )
128
- $members->role_user_count[$user_role] = 0;
129
-
130
- /* Return the user count for the given role. */
131
- return $members->role_user_count[$user_role];
132
- }
133
-
134
- /**
135
- * Function for listing users like the WordPress function currently uses for authors.
136
- *
137
- * Eventually, I hope to remove this function in favor of wp_list_users():
138
- * @link http://core.trac.wordpress.org/ticket/15145
139
- *
140
- * @since 0.1.0
141
- * @uses get_users()
142
- */
143
- function members_list_users( $args = array() ) {
144
-
145
- $output = '';
146
- $users = get_users( $args );
147
-
148
- if ( !empty( $users ) ) {
149
-
150
- $output .= '<ul class="xoxo members-list-users">';
151
-
152
- foreach ( $users as $user ) {
153
-
154
- $url = get_author_posts_url( $author->ID, $author->user_nicename );
155
-
156
- $class = esc_attr( "user-{$user->ID}" );
157
- if ( is_author( $user->ID ) )
158
- $class .= ' current-user';
159
-
160
- $output .= "<li class='{$class}'><a href='{$url}' title='" . esc_attr( $user->display_name ) . "'>{$user->display_name}</a></li>\n";
161
- }
162
-
163
- $output .= '</ul>';
164
- }
165
-
166
- $output = apply_filters( 'members_list_users', $output );
167
-
168
- if ( empty( $args['echo'] ) )
169
- return $output;
170
-
171
- echo $output;
172
- }
173
-
174
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/private-site.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
- /**
3
- * Handles the private site and private feed features of the plugin. If private site is selected in the plugin settings,
4
- * the plugin will redirect all non-logged-in users to the login page. If private feed is selected, all content is blocked
5
- * from feeds from the site.
6
- *
7
- * @package Members
8
- * @subpackage Functions
9
- */
10
-
11
- /* Redirects users to the login page. */
12
- add_action( 'template_redirect', 'members_please_log_in', 1 );
13
-
14
- /* Disable content in feeds if the feed should be private. */
15
- add_filter( 'the_content_feed', 'members_private_feed' );
16
- add_filter( 'the_excerpt_rss', 'members_private_feed' );
17
- add_filter( 'comment_text_rss', 'members_private_feed' );
18
-
19
- /**
20
- * Redirects users that are not logged in to the 'wp-login.php' page.
21
- *
22
- * @since 0.1.0
23
- * @uses is_user_logged_in() Checks if the current user is logged in.
24
- * @uses auth_redirect() Redirects people that are not logged in to the login page.
25
- */
26
- function members_please_log_in() {
27
-
28
- /* Check if the private blog feature is active. */
29
- if ( members_get_setting( 'private_blog' ) ) {
30
-
31
- /* If using BuddyPress and on the register page, don't do anything. */
32
- if ( function_exists( 'bp_is_current_component' ) && bp_is_current_component( 'register' ) )
33
- return;
34
-
35
- /* Else, if the user is not logged in, redirect to the login page. */
36
- elseif ( !is_user_logged_in() )
37
- auth_redirect();
38
- }
39
- }
40
-
41
- /**
42
- * Blocks feed items if the user has selected the private feed feature.
43
- *
44
- * @since 0.2.0
45
- * @param string $content The post or comment feed content.
46
- * @return string $content Returns either the content or an error message.
47
- */
48
- function members_private_feed( $content ) {
49
-
50
- if ( members_get_setting( 'private_feed' ) )
51
- $content = members_get_setting( 'private_feed_error' );
52
-
53
- return $content;
54
- }
55
-
56
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/shortcodes.php DELETED
@@ -1,144 +0,0 @@
1
- <?php
2
- /**
3
- * Shortcodes for use within posts and other shortcode-aware areas.
4
- *
5
- * @package Members
6
- * @subpackage Functions
7
- */
8
-
9
- /* Add shortcodes. */
10
- add_action( 'init', 'members_register_shortcodes' );
11
-
12
- /**
13
- * Registers shortcodes.
14
- *
15
- * @since 0.2.0
16
- */
17
- function members_register_shortcodes() {
18
-
19
- /* Add the [login-form] shortcode. */
20
- add_shortcode( 'login-form', 'members_login_form_shortcode' );
21
-
22
- /* Add the [access] shortcode. */
23
- add_shortcode( 'access', 'members_access_check_shortcode' );
24
-
25
- /* Add the [feed] shortcode. */
26
- add_shortcode( 'feed', 'members_feed_shortcode' );
27
-
28
- /* Add the [is_user_logged_in] shortcode. */
29
- add_shortcode( 'is_user_logged_in', 'members_is_user_logged_in_shortcode' );
30
-
31
- /* @deprecated 0.2.0. */
32
- add_shortcode( 'get_avatar', 'members_get_avatar_shortcode' );
33
- add_shortcode( 'avatar', 'members_get_avatar_shortcode' );
34
- /* === */
35
- }
36
-
37
- /**
38
- * Displays content if the user viewing it is currently logged in. This also blocks content from showing
39
- * in feeds.
40
- *
41
- * @since 0.1.0
42
- * @param $attr array Attributes for the shortcode (not used).
43
- * @param $content string The content located between the opening and closing of the shortcode.
44
- * @return $content string The content to be shown.
45
- */
46
- function members_is_user_logged_in_shortcode( $attr, $content = null ) {
47
-
48
- /* If it is a feed or the user is not logged in, return nothing. */
49
- if ( is_feed() || !is_user_logged_in() || is_null( $content ) )
50
- return '';
51
-
52
- /* Return the content. */
53
- return do_shortcode( $content );
54
- }
55
-
56
- /**
57
- * Content that should only be shown in feed readers. Can be useful for displaying feed-specific items.
58
- *
59
- * @since 0.1.0
60
- * @param $attr array Attributes for the shortcode (not used).
61
- * @param $content string The content located between the opening and closing of the shortcode.
62
- * @return $content string The content to be shown.
63
- */
64
- function members_feed_shortcode( $attr, $content = null ) {
65
-
66
- /* If not feed or no content exists, return nothing. */
67
- if ( !is_feed() || is_null( $content ) )
68
- return '';
69
-
70
- /* Return the content. */
71
- return do_shortcode( $content );
72
- }
73
-
74
- /**
75
- * Provide/restrict access to specific roles or capabilities. This content should not be shown in feeds. Note that
76
- * capabilities are checked first. If a capability matches, any roles added will *not* be checked. Users should
77
- * choose between using either capabilities or roles for the check rather than both. The best option is to always
78
- * use a capability
79
- *
80
- * @since 0.1.0
81
- * @param $attr array The shortcode attributes.
82
- * @param $content string The content that should be shown/restricted.
83
- * @return $content string The content if it should be shown. Else, return nothing.
84
- */
85
- function members_access_check_shortcode( $attr, $content = null ) {
86
-
87
- /* Set up the default attributes. */
88
- $defaults = array(
89
- 'capability' => '', // Single capability or comma-separated multiple capabilities
90
- 'role' => '', // Single role or comma-separated multiple roles
91
- );
92
-
93
- /* Merge the input attributes and the defaults. */
94
- extract( shortcode_atts( $defaults, $attr ) );
95
-
96
- /* If there's no content or if viewing a feed, return an empty string. */
97
- if ( is_null( $content ) || is_feed() )
98
- return '';
99
-
100
- /* If the current user has the capability, show the content. */
101
- if ( !empty( $capability ) ) {
102
-
103
- /* Get the capabilities. */
104
- $caps = explode( ',', $capability );
105
-
106
- /* Loop through each capability. */
107
- foreach ( $caps as $cap ) {
108
-
109
- /* If the current user can perform the capability, return the content. */
110
- if ( current_user_can( trim( $cap ) ) )
111
- return do_shortcode( $content );
112
- }
113
- }
114
-
115
- /* If the current user has the role, show the content. */
116
- if ( !empty( $role ) ) {
117
-
118
- /* Get the roles. */
119
- $roles = explode( ',', $role );
120
-
121
- /* Loop through each of the roles. */
122
- foreach ( $roles as $role ) {
123
-
124
- /* If the current user has the role, return the content. */
125
- if ( current_user_can( trim( $role ) ) )
126
- return do_shortcode( $content );
127
- }
128
- }
129
-
130
- /* Return an empty string if we've made it to this point. */
131
- return '';
132
- }
133
-
134
- /**
135
- * Displays a login form.
136
- *
137
- * @since 0.1.0
138
- * @uses wp_login_form() Displays the login form.
139
- */
140
- function members_login_form_shortcode() {
141
- return wp_login_form( array( 'echo' => false ) );
142
- }
143
-
144
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/template.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /**
3
- * @package Members
4
- * @subpackage Functions
5
- */
6
-
7
- /**
8
- * Conditional tag to check if a user can view a specific post. A user cannot view a post if their user role has
9
- * not been selected in the 'Content Permissions' meta box on the edit post screen in the admin. Non-logged in
10
- * site visitors cannot view posts if roles were seletected. If no roles were selected, all users and site visitors
11
- * can view the content.
12
- *
13
- * There are exceptions to this rule though. The post author, any user with the 'restrict_content' capability,
14
- * and users that have the ability to edit the post can always view the post, even if their role was not granted
15
- * permission to view it.
16
- *
17
- * @todo See how feasible it is to just use the normal user_can() WordPress function to check against a meta
18
- * capability such as 'members_view_post' while hooking into 'map_meta_cap' or 'user_has_cap' to roll custom
19
- * plugin handling for this. This would just be a wrapper tag.
20
- *
21
- * @since 0.2.0
22
- * @param int $user_id The ID of the user to check.
23
- * @param int $post_id The ID of the post to check.
24
- * @return bool True if the user can view the post. False if the user cannot view the post.
25
- */
26
- function members_can_user_view_post( $user_id, $post_id = '' ) {
27
-
28
- /* If no post ID is given, assume we're in The Loop and get the current post's ID. */
29
- if ( empty( $post_id ) )
30
- $post_id = get_the_ID();
31
-
32
- /* Assume the user can view the post at this point. */
33
- $can_view = true;
34
-
35
- /**
36
- * The plugin is only going to handle permissions if the 'content permissions' feature is active. If
37
- * not active, the user can always view the post. However, developers can roll their own handling of
38
- * this and filter 'members_can_user_view_post'.
39
- */
40
- if ( members_get_setting( 'content_permissions' ) ) {
41
-
42
- /* Get the roles selected by the user. */
43
- $roles = get_post_meta( $post_id, '_members_access_role', false );
44
-
45
- /* Check if there are any old roles with the '_role' meta key. */
46
- if ( empty( $roles ) )
47
- $roles = members_convert_old_post_meta( $post_id );
48
-
49
- /* If we have an array of roles, let's get to work. */
50
- if ( !empty( $roles ) && is_array( $roles ) ) {
51
-
52
- /**
53
- * Since specific roles were given, let's assume the user can't view the post at
54
- * this point. The rest of this functionality should try to disprove this.
55
- */
56
- $can_view = false;
57
-
58
- /* Get the post object. */
59
- $post = get_post( $post_id );
60
-
61
- /* Get the post type object. */
62
- $post_type = get_post_type_object( $post->post_type );
63
-
64
- /* If viewing a feed or if the user's not logged in, assume it's blocked at this point. */
65
- if ( is_feed() || !is_user_logged_in() ) {
66
- $can_view = false;
67
- }
68
-
69
- /* If the post author, the current user can edit the post, or the current user can 'restrict_content', return true. */
70
- elseif ( $post->post_author == $user_id || user_can( $user_id, 'restrict_content' ) || user_can( $user_id, $post_type->cap->edit_post, $post_id ) ) {
71
- $can_view = true;
72
- }
73
-
74
- /* Else, let's check the user's role against the selected roles. */
75
- else {
76
-
77
- /* Loop through each role and set $can_view to true if the user has one of the roles. */
78
- foreach ( $roles as $role ) {
79
- if ( user_can( $user_id, $role ) )
80
- $can_view = true;
81
- }
82
- }
83
- }
84
- }
85
-
86
- /* Allow developers to overwrite the final return value. */
87
- return apply_filters( 'members_can_user_view_post', $can_view, $user_id, $post_id );
88
- }
89
-
90
- /**
91
- * Wrapper function for the members_can_user_view_post() function. This function checks if the currently
92
- * logged-in user can view the content of a specific post.
93
- *
94
- * @since 0.2.0
95
- * @param int $post_id The ID of the post to check.
96
- * @return bool True if the user can view the post. False if the user cannot view the post.
97
- */
98
- function members_can_current_user_view_post( $post_id = '' ) {
99
-
100
- /* Get the current user object. */
101
- $current_user = wp_get_current_user();
102
-
103
- /* Return the members_can_user_view_post() function, which returns true/false. */
104
- return members_can_user_view_post( $current_user->ID, $post_id );
105
- }
106
-
107
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/update.php DELETED
@@ -1,111 +0,0 @@
1
- <?php
2
- /**
3
- * Version check and update functionality.
4
- *
5
- * @package Members
6
- * @subpackage Includes
7
- */
8
-
9
- /* Don't run when installing. */
10
- if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
11
- return;
12
-
13
- /* Hook our version check to 'init'. */
14
- add_action( 'init', 'members_version_check' );
15
-
16
- /**
17
- * Checks the version number and runs install or update functions if needed.
18
- *
19
- * @since 0.2.0
20
- */
21
- function members_version_check() {
22
-
23
- /* Get the old database version. */
24
- $old_db_version = get_option( 'members_db_version' );
25
-
26
- /* Get the theme settings. */
27
- $settings = get_option( 'members_settings' );
28
-
29
- /* If there is no old database version, run the install. */
30
- if ( empty( $old_db_version ) && false === $settings )
31
- members_install();
32
-
33
- /* Temporary check b/c version 0.1.0 didn't have an upgrade path. */
34
- elseif ( empty( $old_db_version ) && !empty( $settings ) )
35
- members_update();
36
-
37
- /* If the old version is less than the new version, run the update. */
38
- elseif ( intval( $old_db_version ) < intval( MEMBERS_DB_VERSION ) )
39
- members_update();
40
- }
41
-
42
- /**
43
- * Adds the plugin settings on install.
44
- *
45
- * @since 0.2.0
46
- */
47
- function members_install() {
48
-
49
- /* Add the database version setting. */
50
- add_option( 'members_db_version', MEMBERS_DB_VERSION );
51
-
52
- /* Add the default plugin settings. */
53
- add_option( 'members_settings', members_get_default_settings() );
54
- }
55
-
56
- /**
57
- * Updates plugin settings if there are new settings to add.
58
- *
59
- * @since 0.2.0
60
- */
61
- function members_update() {
62
-
63
- /* Update the database version setting. */
64
- update_option( 'members_db_version', MEMBERS_DB_VERSION );
65
-
66
- /* Get the settings from the database. */
67
- $settings = get_option( 'members_settings' );
68
-
69
- /* Get the default plugin settings. */
70
- $default_settings = members_get_default_settings();
71
-
72
- /* Loop through each of the default plugin settings. */
73
- foreach ( $default_settings as $setting_key => $setting_value ) {
74
-
75
- /* If the setting didn't previously exist, add the default value to the $settings array. */
76
- if ( !isset( $settings[$setting_key] ) )
77
- $settings[$setting_key] = $setting_value;
78
- }
79
-
80
- /* Update the plugin settings. */
81
- update_option( 'members_settings', $settings );
82
- }
83
-
84
- /**
85
- * Returns an array of the default plugin settings. These are only used on initial setup.
86
- *
87
- * @since 0.2.0
88
- */
89
- function members_get_default_settings() {
90
-
91
- /* Set up the default plugin settings. */
92
- $settings = array(
93
-
94
- // Version 0.1.0
95
- 'role_manager' => 1,
96
- 'content_permissions' => 1,
97
- 'private_blog' => 0,
98
-
99
- // Version 0.2.0
100
- 'private_feed' => 0,
101
- 'login_form_widget' => 0,
102
- 'users_widget' => 0,
103
- 'content_permissions_error' => '<p class="restricted">' . __( 'Sorry, but you do not have permission to view this content.', 'members' ) . '</p>',
104
- 'private_feed_error' => '<p class="restricted">' . __( 'You must be logged into the site to view this content.', 'members' ) . '</p>',
105
- );
106
-
107
- /* Return the default settings. */
108
- return $settings;
109
- }
110
-
111
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/widget-login-form.php DELETED
@@ -1,272 +0,0 @@
1
- <?php
2
- /**
3
- * Creates a widget that allows users to add a login form to a widget area.
4
- *
5
- * @package Members
6
- * @subpackage Includes
7
- */
8
-
9
- /**
10
- * Login form widget class.
11
- *
12
- * @since 0.1.0
13
- */
14
- class Members_Widget_Login extends WP_Widget {
15
-
16
- /**
17
- * Set up the widget's unique name, ID, class, description, and other options.
18
- *
19
- * @since 0.2.5
20
- */
21
- public function __construct() {
22
-
23
- /* Set up the widget options. */
24
- $widget_options = array(
25
- 'classname' => 'login',
26
- 'description' => esc_html__( 'A widget that allows users to log into your site.', 'members' )
27
- );
28
-
29
- /* Set up the widget control options. */
30
- $control_options = array(
31
- 'width' => 800,
32
- 'height' => 350,
33
- 'id_base' => 'members-widget-login'
34
- );
35
-
36
- /* Create the widget. */
37
- parent::__construct( 'members-widget-login', esc_attr__( 'Login Form', 'members' ), $widget_options, $control_options );
38
- }
39
-
40
- /**
41
- * Set up the widget's unique name, ID, class, description, and other options.
42
- *
43
- * @since 0.1.0
44
- * @deprecated 0.2.5
45
- */
46
- function Members_Widget_Login() {
47
- $this->__construct();
48
- }
49
-
50
- /**
51
- * Outputs the widget based on the arguments input through the widget controls.
52
- *
53
- * @since 0.1.0
54
- */
55
- function widget( $args, $instance ) {
56
- global $user_identity, $user_ID;
57
-
58
- extract( $args );
59
-
60
- /* Set up the arguments for wp_login_form(). */
61
- $args = array(
62
- 'form_id' => !empty( $instance['form_id'] ) ? esc_attr( $instance['form_id'] ) : 'loginform',
63
- 'label_username' => esc_html( $instance['label_username'] ),
64
- 'label_password' => esc_html( $instance['label_password'] ),
65
- 'label_remember' => esc_html( $instance['label_remember'] ),
66
- 'label_log_in' => esc_html( $instance['label_log_in'] ),
67
- 'id_username' => esc_attr( $instance['id_username'] ),
68
- 'id_password' => esc_attr( $instance['id_password'] ),
69
- 'id_remember' => esc_attr( $instance['id_submit'] ),
70
- 'id_submit' => esc_attr( $instance['remember'] ),
71
- 'remember' => !empty( $instance['remember'] ) ? true : false,
72
- 'value_username' => esc_attr( $instance['value_username'] ),
73
- 'value_remember' => !empty( $instance['value_remember'] ) ? true : false,
74
- 'echo' => false,
75
- );
76
-
77
- if ( !empty( $instance['redirect'] ) )
78
- $args['redirect'] = esc_url( $instance['redirect'] );
79
-
80
- /* Get the logged in/out text. */
81
- $logged_in_text = apply_filters( 'widget_text', $instance['logged_in_text'] );
82
- $logged_out_text = apply_filters( 'widget_text', $instance['logged_out_text'] );
83
-
84
- $show_avatar = !empty( $instance['show_avatar'] ) ? true : false;
85
-
86
- /* Output the theme's $before_widget wrapper. */
87
- echo $before_widget;
88
-
89
- /* If a title was input by the user, display it. */
90
- if ( !empty( $instance['title'] ) )
91
- echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
92
-
93
- /* If the current user is logged in. */
94
- if ( is_user_logged_in() ) {
95
-
96
- /* Show avatar if enabled. */
97
- if ( !empty( $show_avatar ) )
98
- echo get_avatar( $user_ID );
99
-
100
- /* Show logged in text if any is written. */
101
- if ( !empty( $logged_in_text ) )
102
- echo do_shortcode( shortcode_unautop( wpautop( $logged_in_text ) ) );
103
- }
104
-
105
- /* If the current user is not logged in. */
106
- else {
107
-
108
- /* Show avatar if enabled. */
109
- if ( $show_avatar )
110
- echo get_avatar( $user_ID );
111
-
112
- /* Show logged out text if any is written. */
113
- if ( $logged_out_text )
114
- echo do_shortcode( shortcode_unautop( wpautop( $logged_out_text ) ) );
115
-
116
- /* Output the login form. */
117
- echo '<div class="members-login-form">' . wp_login_form( $args ) . '</div>';
118
- }
119
-
120
- /* Close the theme's widget wrapper. */
121
- echo $after_widget;
122
- }
123
-
124
- /**
125
- * Updates the widget control options for the particular instance of the widget.
126
- *
127
- * @since 0.1.0
128
- */
129
- function update( $new_instance, $old_instance ) {
130
- $instance = $old_instance;
131
-
132
- $instance['title'] = strip_tags( $new_instance['title'] );
133
- $instance['label_username'] = strip_tags( $new_instance['label_username'] );
134
- $instance['label_password'] = strip_tags( $new_instance['label_password'] );
135
- $instance['label_remember'] = strip_tags( $new_instance['label_remember'] );
136
- $instance['label_log_in'] = strip_tags( $new_instance['label_log_in'] );
137
- $instance['id_username'] = strip_tags( $new_instance['id_username'] );
138
- $instance['id_password'] = strip_tags( $new_instance['id_password'] );
139
- $instance['id_remember'] = strip_tags( $new_instance['id_remember'] );
140
- $instance['id_submit'] = strip_tags( $new_instance['id_submit'] );
141
- $instance['value_username'] = strip_tags( $new_instance['value_username'] );
142
-
143
- $instance['remember'] = ( isset( $new_instance['remember'] ) ? 1 : 0 );
144
- $instance['value_remember'] = ( isset( $new_instance['value_remember'] ) ? 1 : 0 );
145
- $instance['show_avatar'] = ( isset( $new_instance['show_avatar'] ) ? 1 : 0 );
146
-
147
- if ( current_user_can('unfiltered_html') ) {
148
- $instance['logged_in_text'] = $new_instance['logged_in_text'];
149
- $instance['logged_out_text'] = $new_instance['logged_out_text'];
150
- }
151
- else {
152
- $instance['logged_in_text'] = wp_filter_post_kses( $new_instance['logged_in_text'] );
153
- $instance['logged_out_text'] = wp_filter_post_kses( $new_instance['logged_out_text'] );
154
- }
155
-
156
- return $instance;
157
- }
158
-
159
- /**
160
- * Displays the widget control options in the Widgets admin screen.
161
- *
162
- * @since 0.1.0
163
- */
164
- function form( $instance ) {
165
-
166
- /* Set up the default form values. */
167
- $defaults = array(
168
- 'title' => esc_attr__( 'Log In', 'members' ),
169
- 'label_username' => esc_attr__( 'Username', 'members' ),
170
- 'label_password' => esc_attr__( 'Password', 'members' ),
171
- 'label_log_in' => esc_attr__( 'Log In', 'members' ),
172
- 'label_remember' => esc_attr__('Remember Me', 'members' ),
173
- 'form_id' => 'loginform',
174
- 'id_username' => 'user_login',
175
- 'id_password' => 'user_pass',
176
- 'id_remember' => 'rememberme',
177
- 'id_submit' => 'wp-submit',
178
- 'remember' => true,
179
- 'value_remember' => false,
180
- 'value_username' => '',
181
- 'show_avatar' => true,
182
- 'logged_out_text' => esc_html__( 'Please log into the site.', 'members' ),
183
- 'logged_in_text' => esc_html__( 'You are currently logged in.', 'members' )
184
- );
185
-
186
- /* Merge the user-selected arguments with the defaults. */
187
- $instance = wp_parse_args( (array) $instance, $defaults );
188
-
189
- $logged_in_text = format_to_edit( $instance['logged_in_text'] );
190
- $logged_out_text = format_to_edit( $instance['logged_out_text'] ); ?>
191
-
192
- <div style="float: left; width: 31%; margin-right: 3.5%;">
193
-
194
- <p>
195
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'members' ); ?></label>
196
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
197
- </p>
198
- <p>
199
- <label for="<?php echo $this->get_field_id( 'label_username' ); ?>"><code>label_username</code></label>
200
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_username' ); ?>" name="<?php echo $this->get_field_name( 'label_username' ); ?>" value="<?php echo $instance['label_username']; ?>" />
201
- </p>
202
- <p>
203
- <label for="<?php echo $this->get_field_id( 'label_password' ); ?>"><code>label_password</code></label>
204
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_password' ); ?>" name="<?php echo $this->get_field_name( 'label_password' ); ?>" value="<?php echo $instance['label_password']; ?>" />
205
- </p>
206
- <p>
207
- <label for="<?php echo $this->get_field_id( 'label_log_in' ); ?>"><code>label_log_in</code></label>
208
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_log_in' ); ?>" name="<?php echo $this->get_field_name( 'label_log_in' ); ?>" value="<?php echo $instance['label_log_in']; ?>" />
209
- </p>
210
- <p>
211
- <label for="<?php echo $this->get_field_id( 'label_remember' ); ?>"><code>label_remember</code></label>
212
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'label_remember' ); ?>" name="<?php echo $this->get_field_name( 'label_remember' ); ?>" value="<?php echo $instance['label_remember']; ?>" />
213
- </p>
214
-
215
- </div>
216
- <div style="float: left; width: 31%; margin-right: 3.5%;">
217
-
218
- <p>
219
- <label for="<?php echo $this->get_field_id( 'value_username' ); ?>"><code>value_username</code></label>
220
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'value_username' ); ?>" name="<?php echo $this->get_field_name( 'value_username' ); ?>" value="<?php echo $instance['value_username']; ?>" />
221
- </p>
222
- <p>
223
- <label for="<?php echo $this->get_field_id( 'id_username' ); ?>"><code>id_username</code></label>
224
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_username' ); ?>" name="<?php echo $this->get_field_name( 'id_username' ); ?>" value="<?php echo $instance['id_username']; ?>" />
225
- </p>
226
- <p>
227
- <label for="<?php echo $this->get_field_id( 'id_remember' ); ?>"><code>id_remember</code></label>
228
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_remember' ); ?>" name="<?php echo $this->get_field_name( 'id_remember' ); ?>" value="<?php echo $instance['id_remember']; ?>" />
229
- </p>
230
- <p>
231
- <label for="<?php echo $this->get_field_id( 'id_password' ); ?>"><code>id_password</code></label>
232
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_password' ); ?>" name="<?php echo $this->get_field_name( 'id_password' ); ?>" value="<?php echo $instance['id_password']; ?>" />
233
- </p>
234
- <p>
235
- <label for="<?php echo $this->get_field_id( 'id_submit' ); ?>"><code>id_submit</code></label>
236
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'id_submit' ); ?>" name="<?php echo $this->get_field_name( 'id_submit' ); ?>" value="<?php echo $instance['id_submit']; ?>" />
237
- </p>
238
-
239
- </div>
240
-
241
- <div style="float: right; width: 31%;">
242
-
243
- <p>
244
- <input class="checkbox" type="checkbox" <?php checked( $instance['remember'], true ); ?> id="<?php echo $this->get_field_id( 'remember' ); ?>" name="<?php echo $this->get_field_name( 'remember' ); ?>" />
245
- <label for="<?php echo $this->get_field_id( 'remember' ); ?>"><?php _e( '"Remember me" checkbox?', 'members' ); ?> <code>remember</code></label>
246
- </p>
247
- <p>
248
- <input class="checkbox" type="checkbox" <?php checked( $instance['value_remember'], true ); ?> id="<?php echo $this->get_field_id( 'value_remember' ); ?>" name="<?php echo $this->get_field_name( 'value_remember' ); ?>" />
249
- <label for="<?php echo $this->get_field_id( 'value_remember' ); ?>"><?php _e( 'Check "remember me"?', 'members' ); ?> <code>value_remember</code></label>
250
- </p>
251
- <p>
252
- <label for="<?php echo $this->get_field_id( 'show_avatar' ); ?>">
253
- <input class="checkbox" type="checkbox" <?php checked( $instance['show_avatar'], true ); ?> id="<?php echo $this->get_field_id( 'show_avatar' ); ?>" name="<?php echo $this->get_field_name( 'show_avatar' ); ?>" /> <?php _e('Display avatar?', 'widgets-reloaded'); ?></label>
254
- </p>
255
- <p>
256
- <label for="<?php echo $this->get_field_id( 'logged_out_text' ); ?>"><?php _e( 'Logged out text:', 'members' ); ?></label>
257
- <textarea class="widefat" rows="2" cols="20" id="<?php echo $this->get_field_id( 'logged_out_text' ); ?>" name="<?php echo $this->get_field_name('logged_out_text'); ?>" style="width:100%;"><?php echo $logged_out_text; ?></textarea>
258
- </p>
259
-
260
- <p>
261
- <label for="<?php echo $this->get_field_id( 'logged_in_text' ); ?>"><?php _e( 'Logged in text:', 'members' ); ?></label>
262
- <textarea class="widefat" rows="2" cols="20" id="<?php echo $this->get_field_id( 'logged_in_text' ); ?>" name="<?php echo $this->get_field_name('logged_in_text'); ?>" style="width:100%;"><?php echo $logged_in_text; ?></textarea>
263
- </p>
264
-
265
- </div>
266
-
267
- <div style="clear:both;">&nbsp;</div>
268
- <?php
269
- }
270
- }
271
-
272
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/widget-users.php DELETED
@@ -1,238 +0,0 @@
1
- <?php
2
- /**
3
- * Creates a widget that allows users to list users of their site.
4
- *
5
- * @package Members
6
- * @subpackage Includes
7
- */
8
-
9
- /**
10
- * Users widget archive class.
11
- *
12
- * @since 0.1.0
13
- */
14
- class Members_Widget_Users extends WP_Widget {
15
-
16
- /**
17
- * Set up the widget's unique name, ID, class, description, and other options.
18
- *
19
- * @since 0.2.5
20
- */
21
- public function __construct() {
22
-
23
- /* Set up the widget options. */
24
- $widget_options = array(
25
- 'classname' => 'users',
26
- 'description' => esc_html__( 'Provides the ability to list the users of the site.', 'members' )
27
- );
28
-
29
- /* Set up the widget control options. */
30
- $control_options = array(
31
- 'width' => 525,
32
- 'height' => 350,
33
- 'id_base' => 'members-widget-users'
34
- );
35
-
36
- /* Create the widget. */
37
- parent::__construct( 'members-widget-users', esc_attr__( 'Users', 'members' ), $widget_options, $control_options );
38
- }
39
-
40
- /**
41
- * Set up the widget's unique name, ID, class, description, and other options.
42
- *
43
- * @since 0.1.0
44
- * @deprecated 0.2.5
45
- */
46
- function Members_Widget_Users() {
47
- $this->__construct();
48
- }
49
-
50
- /**
51
- * Outputs the widget based on the arguments input through the widget controls.
52
- *
53
- * @since 0.1.0
54
- */
55
- function widget( $args, $instance ) {
56
-
57
- extract( $args, EXTR_SKIP );
58
-
59
- /* Set up the arguments for get_users(). */
60
- $args = array(
61
- 'role' => $instance['role'],
62
- 'meta_key' => $instance['meta_key'],
63
- 'meta_value' => $instance['meta_value'],
64
- 'include' => ( !empty( $instance['include'] ) ? explode( ',', $instance['include'] ) : '' ),
65
- 'exclude' => ( !empty( $instance['exclude'] ) ? explode( ',', $instance['exclude'] ) : '' ),
66
- 'search' => $instance['search'],
67
- 'orderby' => $instance['orderby'],
68
- 'order' => $instance['order'],
69
- 'offset' => ( !empty( $instance['offset'] ) ? intval( $instance['offset'] ) : '' ),
70
- 'number' => ( !empty( $instance['number'] ) ? intval( $instance['number'] ) : '' ),
71
- );
72
-
73
- /* Output the theme's $before_widget wrapper. */
74
- echo $before_widget;
75
-
76
- /* If a title was input by the user, display it. */
77
- if ( !empty( $instance['title'] ) )
78
- echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
79
-
80
- /* Get users. */
81
- $users = get_users( $args );
82
-
83
- /* If users were found. */
84
- if ( !empty( $users ) ) {
85
-
86
- echo '<ul class="xoxo users">';
87
-
88
- /* Loop through each available user, creating a list item with a link to the user's archive. */
89
- foreach ( $users as $user ) {
90
- $url = get_author_posts_url( $user->ID, $user->user_nicename );
91
-
92
- $class = "user-{$user->ID}";
93
- if ( is_author( $user->ID ) )
94
- $class .= ' current-user';
95
-
96
- echo "<li class='{$class}'><a href='{$url}' title='" . esc_attr( $user->display_name ) . "'>{$user->display_name}</a></li>\n";
97
- }
98
-
99
- echo '</ul>';
100
- }
101
-
102
- /* Close the theme's widget wrapper. */
103
- echo $after_widget;
104
- }
105
-
106
- /**
107
- * Updates the widget control options for the particular instance of the widget.
108
- *
109
- * @since 0.1.0
110
- */
111
- function update( $new_instance, $old_instance ) {
112
- $instance = $old_instance;
113
-
114
- $instance['title'] = strip_tags( $new_instance['title'] );
115
- $instance['order'] = strip_tags( $new_instance['order'] );
116
- $instance['orderby'] = strip_tags( $new_instance['orderby'] );
117
- $instance['number'] = strip_tags( $new_instance['number'] );
118
- $instance['offset'] = strip_tags( $new_instance['offset'] );
119
- $instance['meta_key'] = strip_tags( $new_instance['meta_key'] );
120
- $instance['meta_value'] = strip_tags( $new_instance['meta_value'] );
121
- $instance['role'] = strip_tags( $new_instance['role'] );
122
- $instance['include'] = strip_tags( $new_instance['include'] );
123
- $instance['exclude'] = strip_tags( $new_instance['exclude'] );
124
- $instance['search'] = strip_tags( $new_instance['search'] );
125
-
126
- return $instance;
127
- }
128
-
129
- /**
130
- * Displays the widget control options in the Widgets admin screen.
131
- *
132
- * @since 0.1.0
133
- */
134
- function form( $instance ) {
135
- global $wp_roles;
136
-
137
- /* Set up the default form values. */
138
- $defaults = array(
139
- 'title' => esc_attr__( 'Users', 'members' ),
140
- 'order' => 'ASC',
141
- 'orderby' => 'login',
142
- 'role' => '',
143
- 'meta_key' => '',
144
- 'meta_value' => '',
145
- 'include' => '',
146
- 'exclude' => '',
147
- 'search' => '',
148
- 'offset' => '',
149
- 'number' => ''
150
- );
151
-
152
- /* Merge the user-selected arguments with the defaults. */
153
- $instance = wp_parse_args( (array) $instance, $defaults );
154
-
155
- $order = array( 'ASC' => esc_attr__( 'Ascending', 'members' ), 'DESC' => esc_attr__( 'Descending', 'members' ) );
156
- $orderby = array( 'display_name' => esc_attr__( 'Display Name', 'members' ), 'email' => esc_attr__( 'Email', 'members' ), 'ID' => esc_attr__( 'ID', 'members' ), 'nicename' => esc_attr__( 'Nice Name', 'members' ), 'post_count' => esc_attr__( 'Post Count', 'members' ), 'registered' => esc_attr__( 'Registered', 'members' ), 'url' => esc_attr__( 'URL', 'members' ), 'user_login' => esc_attr__( 'Login', 'members' ) );
157
- $meta_key = array_merge( array( '' ), (array) members_get_user_meta_keys() );
158
- $roles = array( '' => '' );
159
-
160
- foreach ( $wp_roles->role_names as $role => $name )
161
- $roles[$role] = $name;
162
- ?>
163
-
164
- <div style="float: left;width: 48%;">
165
-
166
- <p>
167
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'members' ); ?></label>
168
- <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
169
- </p>
170
- <p>
171
- <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><code>orderby</code></label>
172
- <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>">
173
- <?php foreach ( $orderby as $option_value => $option_label ) { ?>
174
- <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['orderby'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
175
- <?php } ?>
176
- </select>
177
- </p>
178
- <p>
179
- <label for="<?php echo $this->get_field_id( 'order' ); ?>"><code>order</code></label>
180
- <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>">
181
- <?php foreach ( $order as $option_value => $option_label ) { ?>
182
- <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['order'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
183
- <?php } ?>
184
- </select>
185
- </p>
186
- <p>
187
- <label for="<?php echo $this->get_field_id( 'role' ); ?>"><code>role</code></label>
188
- <select class="widefat" id="<?php echo $this->get_field_id( 'role' ); ?>" name="<?php echo $this->get_field_name( 'role' ); ?>">
189
- <?php foreach ( $roles as $role => $name ) { ?>
190
- <option value="<?php echo esc_attr( $role ); ?>" <?php selected( $instance['role'], $role ); ?>><?php echo esc_html( $name ); ?></option>
191
- <?php } ?>
192
- </select>
193
- </p>
194
- <p>
195
- <label for="<?php echo $this->get_field_id( 'number' ); ?>"><code>number</code></label>
196
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo esc_attr( $instance['number'] ); ?>" />
197
- </p>
198
- <p>
199
- <label for="<?php echo $this->get_field_id( 'offset' ); ?>"><code>offset</code></label>
200
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'offset' ); ?>" name="<?php echo $this->get_field_name( 'offset' ); ?>" value="<?php echo esc_attr( $instance['offset'] ); ?>" />
201
- </p>
202
-
203
- </div>
204
- <div style="float: right; width: 48%;">
205
-
206
- <p>
207
- <label for="<?php echo $this->get_field_id( 'include' ); ?>"><code>include</code></label>
208
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'include' ); ?>" name="<?php echo $this->get_field_name( 'include' ); ?>" value="<?php echo esc_attr( $instance['include'] ); ?>" />
209
- </p>
210
- <p>
211
- <label for="<?php echo $this->get_field_id( 'exclude' ); ?>"><code>exclude</code></label>
212
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'exclude' ); ?>" name="<?php echo $this->get_field_name( 'exclude' ); ?>" value="<?php echo esc_attr( $instance['exclude'] ); ?>" />
213
- </p>
214
- <p>
215
- <label for="<?php echo $this->get_field_id( 'search' ); ?>"><code>search</code></label>
216
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'search' ); ?>" name="<?php echo $this->get_field_name( 'search' ); ?>" value="<?php echo esc_attr( $instance['search'] ); ?>" />
217
- </p>
218
- <p>
219
- <label for="<?php echo $this->get_field_id( 'meta_key' ); ?>"><code>meta_key</code></label>
220
- <select class="widefat" id="<?php echo $this->get_field_id( 'meta_key' ); ?>" name="<?php echo $this->get_field_name( 'meta_key' ); ?>">
221
- <?php foreach ( $meta_key as $meta ) { ?>
222
- <option value="<?php echo esc_attr( $meta ); ?>" <?php selected( $instance['meta_key'], $meta ); ?>><?php echo esc_html( $meta ); ?></option>
223
- <?php } ?>
224
- </select>
225
- </p>
226
- <p>
227
- <label for="<?php echo $this->get_field_id( 'meta_value' ); ?>"><code>meta_value</code></label>
228
- <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'meta_value' ); ?>" name="<?php echo $this->get_field_name( 'meta_value' ); ?>" value="<?php echo esc_attr( $instance['meta_value'] ); ?>" />
229
- </p>
230
-
231
- </div>
232
-
233
- <div style="clear:both;">&nbsp;</div>
234
- <?php
235
- }
236
- }
237
-
238
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/widgets.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
- /**
3
- * Loads and enables the widgets for the plugin.
4
- *
5
- * @package Members
6
- * @subpackage Functions
7
- */
8
-
9
- /* Hook widget registration to the 'widgets_init' hook. */
10
- add_action( 'widgets_init', 'members_register_widgets' );
11
-
12
- /**
13
- * Registers widgets for the plugin.
14
- *
15
- * @since 0.2.0
16
- */
17
- function members_register_widgets() {
18
-
19
- /* If the login form widget is enabled. */
20
- if ( members_get_setting( 'login_form_widget' ) ) {
21
-
22
- /* Load the login form widget file. */
23
- require_once( MEMBERS_INCLUDES . 'widget-login-form.php' );
24
-
25
- /* Register the login form widget. */
26
- register_widget( 'Members_Widget_Login' );
27
- }
28
-
29
- /* If the users widget is enabled. */
30
- if ( members_get_setting( 'users_widget' ) ) {
31
-
32
- /* Load the users widget file. */
33
- require_once( MEMBERS_INCLUDES . 'widget-users.php' );
34
-
35
- /* Register the users widget. */
36
- register_widget( 'Members_Widget_users' );
37
- }
38
- }
39
-
40
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/admin.js DELETED
@@ -1,25 +0,0 @@
1
- $j = jQuery.noConflict();
2
-
3
- $j(document).ready(
4
- function() {
5
-
6
- $j( '.hide-if-no-js' ).show();
7
-
8
- $j( '#members-add-new-cap' ).click(
9
- function() {
10
- $j( 'p.new-cap-holder' ).append( '<input type="text" class="new-cap" name="new-cap[]" value="" size="20" />' );
11
- }
12
- );
13
-
14
- $j( 'div.members-role-checkbox input[type="checkbox"]' ).click(
15
- function() {
16
- if ( $j( this ).is( ':checked' ) ) {
17
- $j( this ).next( 'label' ).addClass( 'has-cap' );
18
- }
19
- else {
20
- $j( this ).next( 'label' ).removeClass( 'has-cap' );
21
- }
22
- }
23
- );
24
- }
25
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/edit-role.js ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+
3
+ /* ====== Delete Role Link (on Roles and Edit Role screens) ====== */
4
+
5
+ // When the delete role link is clicked, give a "AYS?" popup to confirm.
6
+ jQuery( '.members-delete-role-link' ).click(
7
+ function() {
8
+ return window.confirm( members_i18n.ays_delete_role );
9
+ }
10
+ );
11
+
12
+ /* ====== Role Name and Slug ====== */
13
+
14
+ /**
15
+ * Takes the given text and copies it to the role slug `<span>` after sanitizing it
16
+ * as a role.
17
+ *
18
+ * @since 1.0.0
19
+ * @access public
20
+ * @param string $slug
21
+ * @return void
22
+ */
23
+ function members_print_role_slug( slug ) {
24
+
25
+ // Sanitize the role.
26
+ slug = slug.toLowerCase().trim().replace( /<.*?>/g, '' ).replace( /\s/g, '_' ).replace( /[^a-zA-Z0-9_]/g, '' );
27
+
28
+ // Add the text.
29
+ jQuery( '.role-slug' ).text( slug );
30
+ }
31
+
32
+ // Check the role name input box for key presses.
33
+ jQuery( 'input[name="role_name"]' ).keyup(
34
+ function() {
35
+
36
+ // If there's no value stored in the role input box, print this input's
37
+ // value in the role slug span.
38
+ if ( ! jQuery( 'input[name="role"]' ).val() )
39
+ members_print_role_slug( this.value );
40
+ }
41
+ ); // .keyup
42
+
43
+ // Hide the role input box and role OK button.
44
+ jQuery( 'input[name="role"], .role-ok-button' ).hide();
45
+
46
+ // When the role edit button is clicked.
47
+ jQuery( document ).on( 'click', '.role-edit-button.closed',
48
+ function() {
49
+
50
+ // Toggle the button class and change the text.
51
+ jQuery( this ).removeClass( 'closed' ).addClass( 'open' ).text( members_i18n.button_role_ok );
52
+
53
+ // Show role input.
54
+ jQuery( 'input[name="role"]' ).show();
55
+
56
+ // Focus on the role input.
57
+ jQuery( 'input[name="role"]' ).trigger( 'focus' );
58
+
59
+ // Copy the role slug to the role input edit value.
60
+ jQuery( 'input[name="role"]' ).attr( 'value', jQuery( '.role-slug' ).text() );
61
+ }
62
+ );
63
+
64
+ // When the role OK button is pressed.
65
+ jQuery( document ).on( 'click', '.role-edit-button.open',
66
+ function() {
67
+
68
+ // Toggle the button class and change the text.
69
+ jQuery( this ).removeClass( 'open' ).addClass( 'closed' ).text( members_i18n.button_role_edit );
70
+
71
+ // Hide role input.
72
+ jQuery( 'input[name="role"]' ).hide();
73
+
74
+ // Get the role input value.
75
+ var role = jQuery( 'input[name="role"]' ).val();
76
+
77
+ // If we have a value, print the slug.
78
+ if ( role )
79
+ members_print_role_slug( role );
80
+
81
+ // Else, use the role name input value.
82
+ else
83
+ members_print_role_slug( jQuery( 'input[name="role_name"]' ).val() );
84
+ }
85
+ ); // .click()
86
+
87
+ // Simulate clicking the OK button if the user presses "Enter" in the role field.
88
+ jQuery( 'input[name="role"]' ).keypress(
89
+ function( e ) {
90
+
91
+ // 13 is the key code for "Enter".
92
+ if ( 13 === e.keyCode ) {
93
+
94
+ // Click the edit role button and trigger a focus.
95
+ jQuery( '.role-edit-button' ).click().trigger( 'focus' );
96
+
97
+ // Prevent default behavior and return false.
98
+ e.preventDefault();
99
+ return false;
100
+ }
101
+ }
102
+ ); // .keypress()
103
+
104
+ // Hide the add new role button if we don't at least have a role name.
105
+ if ( ! jQuery( '.users_page_role-new input[name="role_name"]' ).val() )
106
+ jQuery( '.users_page_role-new #publish' ).prop( 'disabled', true );
107
+
108
+ // Look for changes to the role name input.
109
+ jQuery( '.users_page_role-new input[name="role_name"]' ).on( 'input',
110
+ function() {
111
+
112
+ // If there's a role name, enable the add new role button.
113
+ if ( jQuery( this ).val() )
114
+ jQuery( '.users_page_role-new #publish' ).prop( 'disabled', false );
115
+
116
+ // Else, disable the button.
117
+ else
118
+ jQuery( '.users_page_role-new #publish' ).prop( 'disabled', true );
119
+ }
120
+ );
121
+
122
+ /* ====== Tab Sections and Controls ====== */
123
+
124
+ // Create Underscore templates.
125
+ var section_template = wp.template( 'members-cap-section' );
126
+ var control_template = wp.template( 'members-cap-control' );
127
+
128
+ // Check that the `members_sections` and `members_controls` variables were
129
+ // passed in via `wp_localize_script()`.
130
+ if ( typeof members_sections !== 'undefined' && typeof members_controls !== 'undefined' ) {
131
+
132
+ // Loop through the sections and append the template for each.
133
+ _.each( members_sections, function( data ) {
134
+ jQuery( '.members-tab-wrap' ).append( section_template( data ) );
135
+ } );
136
+
137
+ // Loop through the controls and append the template for each.
138
+ _.each( members_controls, function( data ) {
139
+ jQuery( '#members-tab-' + data.section + ' tbody' ).append( control_template( data ) );
140
+ } );
141
+ }
142
+
143
+ /* ====== Tabs ====== */
144
+
145
+ // Hides the tab content.
146
+ jQuery( '.members-cap-tabs .members-tab-content' ).hide();
147
+
148
+ // Shows the first tab's content.
149
+ jQuery( '.members-cap-tabs .members-tab-content:first-child' ).show();
150
+
151
+ // Makes the 'aria-selected' attribute true for the first tab nav item.
152
+ jQuery( '.members-tab-nav :first-child' ).attr( 'aria-selected', 'true' );
153
+
154
+ // Copies the current tab item title to the box header.
155
+ jQuery( '.members-which-tab' ).text( jQuery( '.members-tab-nav :first-child a' ).text() );
156
+
157
+ // When a tab nav item is clicked.
158
+ jQuery( '.members-tab-nav li a' ).click(
159
+ function( j ) {
160
+
161
+ // Prevent the default browser action when a link is clicked.
162
+ j.preventDefault();
163
+
164
+ // Get the `href` attribute of the item.
165
+ var href = jQuery( this ).attr( 'href' );
166
+
167
+ // Hide all tab content.
168
+ jQuery( this ).parents( '.members-cap-tabs' ).find( '.members-tab-content' ).hide();
169
+
170
+ // Find the tab content that matches the tab nav item and show it.
171
+ jQuery( this ).parents( '.members-cap-tabs' ).find( href ).show();
172
+
173
+ // Set the `aria-selected` attribute to false for all tab nav items.
174
+ jQuery( this ).parents( '.members-cap-tabs' ).find( '.members-tab-title' ).attr( 'aria-selected', 'false' );
175
+
176
+ // Set the `aria-selected` attribute to true for this tab nav item.
177
+ jQuery( this ).parent().attr( 'aria-selected', 'true' );
178
+
179
+ // Copy the current tab item title to the box header.
180
+ jQuery( '.members-which-tab' ).text( jQuery( this ).text() );
181
+ }
182
+ ); // click()
183
+
184
+ /* ====== Capability Checkboxes (inside tab content) ====== */
185
+
186
+ /**
187
+ * Counts the number of granted and denied capabilities that are checked and updates
188
+ * the count in the submit role meta box.
189
+ *
190
+ * @since 1.0.0
191
+ * @access public
192
+ * @return void
193
+ */
194
+ function members_count_caps() {
195
+
196
+ // Count the granted and denied caps that are checked.
197
+ var granted_count = jQuery( "#members-tab-all input[data-grant-cap]:checked" ).length;
198
+ var denied_count = jQuery( "#members-tab-all input[data-deny-cap]:checked" ).length;
199
+
200
+ // Count the new (added from new cap meta box) granted and denied caps that are checked.
201
+ var new_granted_count = jQuery( '#members-tab-custom input[name="grant-new-caps[]"]:checked' ).length;
202
+ var new_denied_count = jQuery( '#members-tab-custom input[name="deny-new-caps[]"]:checked' ).length;
203
+
204
+ // Update the submit meta box cap count.
205
+ jQuery( '#submitdiv .granted-count' ).text( granted_count + new_granted_count );
206
+ jQuery( '#submitdiv .denied-count' ).text( denied_count + new_denied_count );
207
+ }
208
+
209
+ /**
210
+ * When a grant/deny checkbox has a change, this function makes sure that any duplicates
211
+ * also receive that change. It also unchecks the grant/deny opposite checkbox if needed.
212
+ *
213
+ * @since 1.0.0
214
+ * @access public
215
+ * @param object $checkbox
216
+ * @return void
217
+ */
218
+ function members_check_uncheck( checkbox ) {
219
+
220
+ var type = 'grant';
221
+ var opposite = 'deny';
222
+
223
+ // If this is a deny checkbox.
224
+ if ( jQuery( checkbox ).attr( 'data-deny-cap' ) ) {
225
+
226
+ type = 'deny';
227
+ opposite = 'grant';
228
+ }
229
+
230
+ // Get the capability for this checkbox.
231
+ var cap = jQuery( checkbox ).attr( 'data-' + type + '-cap' );
232
+
233
+ // If the checkbox is checked.
234
+ if ( jQuery( checkbox ).prop( 'checked' ) ) {
235
+
236
+ // Check any duplicate checkboxes.
237
+ jQuery( 'input[data-' + type + '-cap="' + cap + '"]' ).not( checkbox ).prop( 'checked', true );
238
+
239
+ // Uncheck any deny checkboxes with the same cap.
240
+ jQuery( 'input[data-' + opposite + '-cap="' + cap + '"]' ).prop( 'checked', false );
241
+
242
+ // If the checkbox is not checked.
243
+ } else {
244
+
245
+ // Uncheck any duplicate checkboxes.
246
+ jQuery( 'input[data-' + type + '-cap="' + cap + '"]' ).not( checkbox ).prop( 'checked', false );
247
+ }
248
+ }
249
+
250
+ // Count the granted and denied caps that are checked.
251
+ members_count_caps();
252
+
253
+ // When a change is triggered for any grant/deny checkbox. Note that we're using `.on()`
254
+ // here because we're dealing with dynamically-generated HTML.
255
+ jQuery( document ).on( 'change',
256
+ '.members-cap-checklist input[data-grant-cap], .members-cap-checklist input[data-deny-cap]',
257
+ function() {
258
+
259
+ // Check/Uncheck boxes.
260
+ members_check_uncheck( this );
261
+
262
+ // Count the granted and denied caps that are checked.
263
+ members_count_caps();
264
+ }
265
+ ); // .on( 'change' )
266
+
267
+ // When a cap button is clicked. Note that we're using `.on()` here because we're dealing
268
+ // with dynamically-generated HTML.
269
+ //
270
+ // Note that we only need to trigger `change()` once for our functionality.
271
+ jQuery( document ).on( 'click', '.editable-role .members-cap-checklist button',
272
+ function() {
273
+
274
+ // Get the button parent element.
275
+ var parent = jQuery( this ).closest( '.members-cap-checklist' );
276
+
277
+ // Find the grant and deny checkbox inputs.
278
+ var grant = jQuery( parent ).find( 'input[data-grant-cap]' );
279
+ var deny = jQuery( parent ).find( 'input[data-deny-cap]' );
280
+
281
+ // If the grant checkbox is checked.
282
+ if ( jQuery( grant ).prop( 'checked' ) ) {
283
+
284
+ jQuery( grant ).prop( 'checked', false );
285
+ jQuery( deny ).prop( 'checked', true ).change();
286
+
287
+ // If the deny checkbox is checked.
288
+ } else if ( jQuery( deny ).prop( 'checked' ) ) {
289
+
290
+ jQuery( grant ).prop( 'checked', false );
291
+ jQuery( deny ).prop( 'checked', false ).change();
292
+
293
+ // If neither checkbox is checked.
294
+ } else {
295
+
296
+ jQuery( grant ).prop( 'checked', true ).change();
297
+ }
298
+ }
299
+ ); // on()
300
+
301
+ // Remove focus from button when hovering another button.
302
+ jQuery( document ).on( 'hover', '.editable-role .members-cap-checklist button',
303
+ function() {
304
+ jQuery( '.members-cap-checklist button:focus' ).not( this ).blur();
305
+ }
306
+ );
307
+
308
+ /* ====== Meta Boxes ====== */
309
+
310
+ // Add the postbox toggle functionality.
311
+ // Note: `pagenow` is a global variable set by WordPress.
312
+ postboxes.add_postbox_toggles( pagenow );
313
+
314
+ /* ====== New Cap Meta Box ====== */
315
+
316
+ // Give the meta box toggle button a type of `button` so that it doesn't submit the form
317
+ // when we hit the "Enter" key in our input or toggle open/close the meta box.
318
+ jQuery( '#newcapdiv button.handlediv' ).attr( 'type', 'button' );
319
+
320
+ // Disable the new cap button so that it's not clicked until there's a cap.
321
+ jQuery( '#members-add-new-cap' ).prop( 'disabled', true );
322
+
323
+ // When the user starts typing a new cap.
324
+ jQuery( '#members-new-cap-field' ).on( 'input',
325
+ function() {
326
+
327
+ // If there's a value in the input, enable the add new button.
328
+ if ( jQuery( this ).val() ) {
329
+
330
+ jQuery( '#members-add-new-cap' ).prop( 'disabled', false );
331
+
332
+ // If there's no value, disable the button.
333
+ } else {
334
+ jQuery( '#members-add-new-cap' ).prop( 'disabled', true );
335
+ }
336
+ }
337
+ ); // .on( 'input' )
338
+
339
+ // Simulate clicking the add new cap button if the user presses "Enter" in the new cap field.
340
+ jQuery( '#members-new-cap-field' ).keypress(
341
+ function( e ) {
342
+
343
+ // 13 is the key code for "Enter".
344
+ if ( 13 === e.keyCode ) {
345
+ jQuery( '#members-add-new-cap' ).click();
346
+ e.preventDefault();
347
+ return false;
348
+ }
349
+ }
350
+ ); // .keypress()
351
+
352
+ // When the new cap button is clicked.
353
+ jQuery( '#members-add-new-cap' ).click(
354
+ function() {
355
+
356
+ // Get the new cap value.
357
+ var new_cap = jQuery( '#members-new-cap-field' ).val();
358
+
359
+ // Sanitize the new cap.
360
+ // Note that this will be sanitized on the PHP side as well before save.
361
+ new_cap = new_cap.trim().replace( /<.*?>/g, '' ).replace( /\s/g, '_' ).replace( /[^a-zA-Z0-9_]/g, '' );
362
+
363
+ // If there's a new cap value.
364
+ if ( new_cap ) {
365
+
366
+ // Trigger a click event on the "custom" tab in the edit caps box.
367
+ jQuery( 'a[href="#members-tab-custom"]' ).trigger( 'click' );
368
+
369
+ // Replace text placeholder with cap.
370
+ members_i18n.label_grant_cap = members_i18n.label_grant_cap.replace( /%s/g, '<code>' + new_cap + '</code>' );
371
+ members_i18n.label_deny_cap = members_i18n.label_deny_cap.replace( /%s/g, '<code>' + new_cap + '</code>' );
372
+
373
+ // Set up some data to pass to our Underscore template.
374
+ var data = {
375
+ cap : new_cap,
376
+ readonly : '',
377
+ name : { grant : 'grant-new-caps[]', deny : 'deny-new-caps[]' },
378
+ is_granted_cap : true,
379
+ is_denied_cap : false,
380
+ label : { grant : members_i18n.label_grant_cap, deny : members_i18n.label_deny_cap }
381
+ };
382
+
383
+ // Prepend our template to the "custom" edit caps tab content.
384
+ jQuery( '#members-tab-custom tbody' ).prepend( control_template( data ) );
385
+
386
+ // Get the new cap table row.
387
+ var parent = jQuery( '[data-grant-cap="' + new_cap + '"]' ).parents( '.members-cap-checklist' );
388
+
389
+ // Add the highlight class.
390
+ jQuery( parent ).addClass( 'members-highlight' );
391
+
392
+ // Remove the class after a set time for a highlight effect.
393
+ setTimeout( function() {
394
+ jQuery( parent ).removeClass( 'members-highlight' );
395
+ }, 500 );
396
+
397
+ // Set the new cap input value to an empty string.
398
+ jQuery( '#members-new-cap-field' ).val( '' );
399
+
400
+ // Disable the add new cap button.
401
+ jQuery( '#members-add-new-cap' ).prop( 'disabled', true );
402
+
403
+ // Trigger a change on our new grant cap checkbox.
404
+ jQuery( '.members-cap-checklist input[data-grant-cap="' + new_cap + '"]' ).trigger( 'change' );
405
+ }
406
+ }
407
+ ); // .click()
408
+
409
+ } ); // ready()
js/edit-role.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){function e(e){e=e.toLowerCase().trim().replace(/<.*?>/g,"").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,""),jQuery(".role-slug").text(e)}function r(){var e=jQuery("#members-tab-all input[data-grant-cap]:checked").length,r=jQuery("#members-tab-all input[data-deny-cap]:checked").length,t=jQuery('#members-tab-custom input[name="grant-new-caps[]"]:checked').length,a=jQuery('#members-tab-custom input[name="deny-new-caps[]"]:checked').length;jQuery("#submitdiv .granted-count").text(e+t),jQuery("#submitdiv .denied-count").text(r+a)}function t(e){var r="grant",t="deny";jQuery(e).attr("data-deny-cap")&&(r="deny",t="grant");var a=jQuery(e).attr("data-"+r+"-cap");jQuery(e).prop("checked")?(jQuery("input[data-"+r+'-cap="'+a+'"]').not(e).prop("checked",!0),jQuery("input[data-"+t+'-cap="'+a+'"]').prop("checked",!1)):jQuery("input[data-"+r+'-cap="'+a+'"]').not(e).prop("checked",!1)}jQuery(".members-delete-role-link").click(function(){return window.confirm(members_i18n.ays_delete_role)}),jQuery('input[name="role_name"]').keyup(function(){jQuery('input[name="role"]').val()||e(this.value)}),jQuery('input[name="role"], .role-ok-button').hide(),jQuery(document).on("click",".role-edit-button.closed",function(){jQuery(this).removeClass("closed").addClass("open").text(members_i18n.button_role_ok),jQuery('input[name="role"]').show(),jQuery('input[name="role"]').trigger("focus"),jQuery('input[name="role"]').attr("value",jQuery(".role-slug").text())}),jQuery(document).on("click",".role-edit-button.open",function(){jQuery(this).removeClass("open").addClass("closed").text(members_i18n.button_role_edit),jQuery('input[name="role"]').hide();var r=jQuery('input[name="role"]').val();r?e(r):e(jQuery('input[name="role_name"]').val())}),jQuery('input[name="role"]').keypress(function(e){return 13===e.keyCode?(jQuery(".role-edit-button").click().trigger("focus"),e.preventDefault(),!1):void 0}),jQuery('.users_page_role-new input[name="role_name"]').val()||jQuery(".users_page_role-new #publish").prop("disabled",!0),jQuery('.users_page_role-new input[name="role_name"]').on("input",function(){jQuery(this).val()?jQuery(".users_page_role-new #publish").prop("disabled",!1):jQuery(".users_page_role-new #publish").prop("disabled",!0)});var a=wp.template("members-cap-section"),n=wp.template("members-cap-control");"undefined"!=typeof members_sections&&"undefined"!=typeof members_controls&&(_.each(members_sections,function(e){jQuery(".members-tab-wrap").append(a(e))}),_.each(members_controls,function(e){jQuery("#members-tab-"+e.section+" tbody").append(n(e))})),jQuery(".members-cap-tabs .members-tab-content").hide(),jQuery(".members-cap-tabs .members-tab-content:first-child").show(),jQuery(".members-tab-nav :first-child").attr("aria-selected","true"),jQuery(".members-which-tab").text(jQuery(".members-tab-nav :first-child a").text()),jQuery(".members-tab-nav li a").click(function(e){e.preventDefault();var r=jQuery(this).attr("href");jQuery(this).parents(".members-cap-tabs").find(".members-tab-content").hide(),jQuery(this).parents(".members-cap-tabs").find(r).show(),jQuery(this).parents(".members-cap-tabs").find(".members-tab-title").attr("aria-selected","false"),jQuery(this).parent().attr("aria-selected","true"),jQuery(".members-which-tab").text(jQuery(this).text())}),r(),jQuery(document).on("change",".members-cap-checklist input[data-grant-cap], .members-cap-checklist input[data-deny-cap]",function(){t(this),r()}),jQuery(document).on("click",".editable-role .members-cap-checklist button",function(){var e=jQuery(this).closest(".members-cap-checklist"),r=jQuery(e).find("input[data-grant-cap]"),t=jQuery(e).find("input[data-deny-cap]");jQuery(r).prop("checked")?(jQuery(r).prop("checked",!1),jQuery(t).prop("checked",!0).change()):jQuery(t).prop("checked")?(jQuery(r).prop("checked",!1),jQuery(t).prop("checked",!1).change()):jQuery(r).prop("checked",!0).change()}),jQuery(document).on("hover",".editable-role .members-cap-checklist button",function(){jQuery(".members-cap-checklist button:focus").not(this).blur()}),postboxes.add_postbox_toggles(pagenow),jQuery("#newcapdiv button.handlediv").attr("type","button"),jQuery("#members-add-new-cap").prop("disabled",!0),jQuery("#members-new-cap-field").on("input",function(){jQuery(this).val()?jQuery("#members-add-new-cap").prop("disabled",!1):jQuery("#members-add-new-cap").prop("disabled",!0)}),jQuery("#members-new-cap-field").keypress(function(e){return 13===e.keyCode?(jQuery("#members-add-new-cap").click(),e.preventDefault(),!1):void 0}),jQuery("#members-add-new-cap").click(function(){var e=jQuery("#members-new-cap-field").val();if(e=e.trim().replace(/<.*?>/g,"").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"")){jQuery('a[href="#members-tab-custom"]').trigger("click"),members_i18n.label_grant_cap=members_i18n.label_grant_cap.replace(/%s/g,"<code>"+e+"</code>"),members_i18n.label_deny_cap=members_i18n.label_deny_cap.replace(/%s/g,"<code>"+e+"</code>");var r={cap:e,readonly:"",name:{grant:"grant-new-caps[]",deny:"deny-new-caps[]"},is_granted_cap:!0,is_denied_cap:!1,label:{grant:members_i18n.label_grant_cap,deny:members_i18n.label_deny_cap}};jQuery("#members-tab-custom tbody").prepend(n(r));var t=jQuery('[data-grant-cap="'+e+'"]').parents(".members-cap-checklist");jQuery(t).addClass("members-highlight"),setTimeout(function(){jQuery(t).removeClass("members-highlight")},500),jQuery("#members-new-cap-field").val(""),jQuery("#members-add-new-cap").prop("disabled",!0),jQuery('.members-cap-checklist input[data-grant-cap="'+e+'"]').trigger("change")}})});
js/settings.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function() {
2
+
3
+ /* ====== Plugin Settings ====== */
4
+
5
+ // Hide content permissions message if disabled.
6
+ if ( false === jQuery( '[name="members_settings[content_permissions]"]' ).prop( 'checked' ) ) {
7
+
8
+ jQuery( '[name="members_settings[content_permissions]"]' ).parents( 'tr' ).next( 'tr' ).hide();
9
+ }
10
+
11
+ // Hide private feed message if private feed disabled.
12
+ if ( false === jQuery( '[name="members_settings[private_feed]"]' ).prop( 'checked' ) ) {
13
+
14
+ jQuery( '[name="members_settings[private_feed]"]' ).parents( 'tr' ).next( 'tr' ).hide();
15
+ }
16
+
17
+ // Show above hidden items if feature becomes enabled.
18
+ jQuery( '[name="members_settings[content_permissions]"], [name="members_settings[private_feed]"]' ).on( 'change',
19
+ function() {
20
+
21
+ if ( jQuery( this ).prop( 'checked' ) ) {
22
+
23
+ jQuery( this ).parents( 'tr' ).next( 'tr' ).show( 'slow' );
24
+ } else {
25
+
26
+ jQuery( this ).parents( 'tr' ).next( 'tr' ).hide( 'slow' );
27
+ }
28
+ }
29
+ );
30
+ } );
js/settings.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){!1===jQuery('[name="members_settings[content_permissions]"]').prop("checked")&&jQuery('[name="members_settings[content_permissions]"]').parents("tr").next("tr").hide(),!1===jQuery('[name="members_settings[private_feed]"]').prop("checked")&&jQuery('[name="members_settings[private_feed]"]').parents("tr").next("tr").hide(),jQuery('[name="members_settings[content_permissions]"], [name="members_settings[private_feed]"]').on("change",function(){jQuery(this).prop("checked")?jQuery(this).parents("tr").next("tr").show("slow"):jQuery(this).parents("tr").next("tr").hide("slow")})});
languages/members-en_EN.mo DELETED
Binary file
languages/members-en_EN.po DELETED
@@ -1,1573 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Members WordPress Plugin\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-06-03 12:36-0600\n"
6
- "PO-Revision-Date: 2011-06-03 12:38-0600\n"
7
- "Last-Translator: Justin Tadlock <justin@justintadlock.com>\n"
8
- "Language-Team: <justin@justintadlock.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-Language: English\n"
13
- "X-Poedit-Country: UNITED STATES\n"
14
- "X-Poedit-KeywordsList: _e;__;esc_attr__;esc_attr_e;_n;_x;esc_html__;esc_html_e\n"
15
- "X-Poedit-Basepath: ../\n"
16
- "X-Poedit-SearchPath-0: .\n"
17
-
18
- #: members.php:191
19
- #: admin/meta-box-plugin-settings.php:30
20
- #, fuzzy
21
- msgid "Role Manager"
22
- msgstr "Naam"
23
-
24
- #: admin/admin.php:44
25
- #: admin/roles-list-table.php:57
26
- #, fuzzy
27
- msgid "Roles"
28
- msgstr "Reset"
29
-
30
- #: admin/admin.php:47
31
- #: admin/role-new.php:44
32
- #, fuzzy
33
- msgid "Add New Role"
34
- msgstr "Voeg gebruiker toe"
35
-
36
- #: admin/admin.php:135
37
- msgid "<strong>Role Manager:</strong> This feature allows you to manage roles on your site by giving you the ability to create, edit, and delete any role. Note that changes to roles do not change settings for the Members plugin. You are literally changing data in your WordPress database. This plugin feature merely provides an interface for you to make these changes."
38
- msgstr ""
39
-
40
- #: admin/admin.php:136
41
- msgid "<strong>Content Permissions:</strong> This feature adds a meta box to the post edit screen that allows you to grant permissions for who can read the post content based on the user's role. Only users of roles with the <code>restrict_content</code> capability will be able to use this component."
42
- msgstr ""
43
-
44
- #: admin/admin.php:137
45
- msgid "<strong>Sidebar Widgets:</strong> This feature creates additional widgets for use in your theme's sidebars. You can access them by clicking Widgets in the menu."
46
- msgstr ""
47
-
48
- #: admin/admin.php:138
49
- msgid "<strong>Private Site:</strong> This feature allows you to redirect all users who are not logged into the site to the login page, creating an entirely private site. You may also replace your feed content with a custom error message."
50
- msgstr ""
51
-
52
- #: admin/admin.php:140
53
- #: admin/admin.php:167
54
- #: admin/admin.php:183
55
- msgid "For more information:"
56
- msgstr ""
57
-
58
- #: admin/admin.php:143
59
- #: admin/admin.php:171
60
- #: admin/admin.php:187
61
- #, fuzzy
62
- msgid "Documentation"
63
- msgstr "Thema Documentatie"
64
-
65
- #: admin/admin.php:144
66
- #: admin/admin.php:172
67
- #: admin/admin.php:188
68
- #, fuzzy
69
- msgid "Support Forums"
70
- msgstr "Bezoek de support forums."
71
-
72
- #: admin/admin.php:156
73
- msgid "This screen allows you to edit the capabilities given to the role. You can tick the checkbox next to a capability to add the capability to the role. You can untick the checkbox next to a capability to remove a capability from the role. You can also add as many custom capabilities as you need in the Custom Capabilities section."
74
- msgstr ""
75
-
76
- #: admin/admin.php:157
77
- msgid "Capabilities are both powerful and dangerous tools. You should not add or remove a capability to a role unless you understand what permission you are granting or removing."
78
- msgstr ""
79
-
80
- #: admin/admin.php:162
81
- msgid "This screen lists all the user roles available on this site. Roles are given to users as a way to \"group\" them. Roles are made up of capabilities (permissions), which decide what functions users of each role can perform on the site. From this screen, you can manage these roles and their capabilities."
82
- msgstr ""
83
-
84
- #: admin/admin.php:163
85
- msgid "To add a role to a user, click Users in the menu. To create a new role, click the Add New button at the top of the screen or Add New Role under the Users menu."
86
- msgstr ""
87
-
88
- #: admin/admin.php:170
89
- #: admin/admin.php:186
90
- msgid "Users, Roles, and Capabilities"
91
- msgstr ""
92
-
93
- #: admin/admin.php:180
94
- msgid "This screen allows you to create a new user role for your site. You must input a unique role name and role label. You can also grant capabilities (permissions) to the new role. Capabilities are both powerful and dangerous tools. You should not add a capability to a role unless you understand what permission you are granting."
95
- msgstr ""
96
-
97
- #: admin/admin.php:181
98
- msgid "To add a role to a user, click Users in the menu. To edit roles, click Roles under the Users menu."
99
- msgstr ""
100
-
101
- #: admin/admin.php:202
102
- msgid "Role deleted."
103
- msgstr ""
104
-
105
- #: admin/admin.php:211
106
- msgid "Selected roles deleted."
107
- msgstr ""
108
-
109
- #: admin/meta-box-plugin-settings.php:21
110
- msgid "About"
111
- msgstr ""
112
-
113
- #: admin/meta-box-plugin-settings.php:24
114
- msgid "Like this plugin?"
115
- msgstr ""
116
-
117
- #: admin/meta-box-plugin-settings.php:27
118
- #, fuzzy
119
- msgid "Support"
120
- msgstr "Thema Ondersteuning:"
121
-
122
- #: admin/meta-box-plugin-settings.php:33
123
- #: admin/meta-box-post-content-permissions.php:28
124
- msgid "Content Permissions"
125
- msgstr ""
126
-
127
- #: admin/meta-box-plugin-settings.php:36
128
- #, fuzzy
129
- msgid "Sidebar Widgets"
130
- msgstr "Widgets invoegen:"
131
-
132
- #: admin/meta-box-plugin-settings.php:39
133
- #, fuzzy
134
- msgid "Private Site"
135
- msgstr "Primaire EnkelvoudigBericht"
136
-
137
- #: admin/meta-box-plugin-settings.php:52
138
- #, fuzzy
139
- msgid "Version:"
140
- msgstr "Thema versie:"
141
-
142
- #: admin/meta-box-plugin-settings.php:55
143
- #, fuzzy
144
- msgid "Description:"
145
- msgstr "Beschrijving"
146
-
147
- #: admin/meta-box-plugin-settings.php:69
148
- msgid "Here's how you can give back:"
149
- msgstr ""
150
-
151
- #: admin/meta-box-plugin-settings.php:72
152
- msgid "Members on the WordPress plugin repository"
153
- msgstr ""
154
-
155
- #: admin/meta-box-plugin-settings.php:72
156
- msgid "Give the plugin a good rating."
157
- msgstr ""
158
-
159
- #: admin/meta-box-plugin-settings.php:73
160
- msgid "Donate via PayPal"
161
- msgstr ""
162
-
163
- #: admin/meta-box-plugin-settings.php:73
164
- msgid "Donate a few dollars."
165
- msgstr ""
166
-
167
- #: admin/meta-box-plugin-settings.php:74
168
- msgid "Justin Tadlock's Amazon Wish List"
169
- msgstr ""
170
-
171
- #: admin/meta-box-plugin-settings.php:74
172
- msgid "Get me something from my wish list."
173
- msgstr ""
174
-
175
- #: admin/meta-box-plugin-settings.php:86
176
- #, php-format
177
- msgid "Support for this plugin is provided via the support forums at %1$s. If you need any help using it, please ask your support questions there."
178
- msgstr ""
179
-
180
- #: admin/meta-box-plugin-settings.php:86
181
- #, fuzzy
182
- msgid "Theme Hybrid Support Forums"
183
- msgstr "Thema Ondersteuning:"
184
-
185
- #: admin/meta-box-plugin-settings.php:86
186
- #, fuzzy
187
- msgid "Theme Hybrid"
188
- msgstr "Hybrid"
189
-
190
- #: admin/meta-box-plugin-settings.php:99
191
- msgid "Enable the role manager."
192
- msgstr ""
193
-
194
- #: admin/meta-box-plugin-settings.php:102
195
- msgid "Your roles and capabilities will not revert back to their previous settings after deactivating or uninstalling this plugin, so use this feature wisely."
196
- msgstr ""
197
-
198
- #: admin/meta-box-plugin-settings.php:116
199
- msgid "Enable the content permissions feature."
200
- msgstr ""
201
-
202
- #: admin/meta-box-plugin-settings.php:120
203
- msgid "Default post error message:"
204
- msgstr ""
205
-
206
- #: admin/meta-box-plugin-settings.php:122
207
- msgid "You can use <abbr title=\"Hypertext Markup Language\">HTML</abbr> and/or shortcodes to create a custom error message for users that don't have permission to view posts."
208
- msgstr ""
209
-
210
- #: admin/meta-box-plugin-settings.php:136
211
- msgid "Enable the login form widget."
212
- msgstr ""
213
-
214
- #: admin/meta-box-plugin-settings.php:141
215
- msgid "Enable the users widget."
216
- msgstr ""
217
-
218
- #: admin/meta-box-plugin-settings.php:155
219
- msgid "Redirect all logged-out users to the login page before allowing them to view the site."
220
- msgstr ""
221
-
222
- #: admin/meta-box-plugin-settings.php:160
223
- msgid "Show error message for feed items."
224
- msgstr ""
225
-
226
- #: admin/meta-box-plugin-settings.php:164
227
- #, fuzzy
228
- msgid "Feed error message:"
229
- msgstr "Feed afbeelding:"
230
-
231
- #: admin/meta-box-plugin-settings.php:167
232
- msgid "You can use <abbr title=\"Hypertext Markup Language\">HTML</abbr> and/or shortcodes to create a custom error message to display instead of feed item content."
233
- msgstr ""
234
-
235
- #: admin/meta-box-post-content-permissions.php:51
236
- msgid "Limit access to this post's content to users of the selected roles."
237
- msgstr ""
238
-
239
- #: admin/meta-box-post-content-permissions.php:75
240
- #, php-format
241
- msgid "If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role."
242
- msgstr ""
243
-
244
- #: admin/meta-box-post-content-permissions.php:79
245
- msgid "Custom error messsage:"
246
- msgstr ""
247
-
248
- #: admin/meta-box-post-content-permissions.php:82
249
- msgid "Message shown to users that do no have permission to view the post."
250
- msgstr ""
251
-
252
- #: admin/role-edit.php:67
253
- #, fuzzy
254
- msgid "Edit Role"
255
- msgstr "Bewerk"
256
-
257
- #: admin/role-edit.php:68
258
- #: admin/roles-list-table.php:58
259
- msgid "Add New"
260
- msgstr ""
261
-
262
- #: admin/role-edit.php:71
263
- #, fuzzy
264
- msgid "Role updated."
265
- msgstr "Aanpassingen tonen?"
266
-
267
- #: admin/role-edit.php:71
268
- msgid "&larr; Back to Roles"
269
- msgstr ""
270
-
271
- #: admin/role-edit.php:85
272
- #: admin/role-new.php:60
273
- #: admin/roles-list-table.php:111
274
- #, fuzzy
275
- msgid "Role Name"
276
- msgstr "Naam"
277
-
278
- #: admin/role-edit.php:94
279
- #: admin/roles-list-table.php:113
280
- #: admin/roles-list-table.php:123
281
- msgid "Capabilities"
282
- msgstr ""
283
-
284
- #: admin/role-edit.php:112
285
- msgid "Custom Capabilities"
286
- msgstr ""
287
-
288
- #: admin/role-edit.php:117
289
- msgid "Add New Capability"
290
- msgstr ""
291
-
292
- #: admin/role-edit.php:127
293
- #, fuzzy
294
- msgid "Update Role"
295
- msgstr "Bewerk"
296
-
297
- #: admin/role-new.php:46
298
- #, fuzzy, php-format
299
- msgid "The %s role has been created."
300
- msgstr "Er is een gebruikersaccount aangemaakt voor %1$s."
301
-
302
- #: admin/role-new.php:65
303
- msgid "<strong>Required:</strong> The role name should be unique and contain only alphanumeric characters and underscores."
304
- msgstr ""
305
-
306
- #: admin/role-new.php:71
307
- #: admin/roles-list-table.php:110
308
- #: admin/roles-list-table.php:120
309
- #, fuzzy
310
- msgid "Role Label"
311
- msgstr "Zoek label:"
312
-
313
- #: admin/role-new.php:76
314
- msgid "<strong>Required:</strong> The role label is used to represent your role in the WordPress admin."
315
- msgstr ""
316
-
317
- #: admin/role-new.php:82
318
- #, fuzzy
319
- msgid "Role Capabilities"
320
- msgstr "Aanpassingen tonen?"
321
-
322
- #: admin/role-new.php:86
323
- msgid "<strong>Optional:</strong> Select the capabilities this role should have. These may be updated later."
324
- msgstr ""
325
-
326
- #: admin/role-new.php:102
327
- #, fuzzy
328
- msgid "Add Role"
329
- msgstr "Bewerk"
330
-
331
- #: admin/roles-list-table.php:70
332
- msgid "All"
333
- msgstr ""
334
-
335
- #: admin/roles-list-table.php:71
336
- #, fuzzy
337
- msgid "Has Users"
338
- msgstr "Gebruikersnaam"
339
-
340
- #: admin/roles-list-table.php:72
341
- #, fuzzy
342
- msgid "No Users"
343
- msgstr "Gebruikersnaam"
344
-
345
- #: admin/roles-list-table.php:83
346
- #: admin/roles-list-table.php:215
347
- msgid "Bulk Actions"
348
- msgstr ""
349
-
350
- #: admin/roles-list-table.php:86
351
- #: admin/roles-list-table.php:158
352
- #: admin/roles-list-table.php:218
353
- msgid "Delete"
354
- msgstr ""
355
-
356
- #: admin/roles-list-table.php:91
357
- #: admin/roles-list-table.php:223
358
- #, fuzzy
359
- msgid "Apply"
360
- msgstr "Reageer"
361
-
362
- #: admin/roles-list-table.php:98
363
- #: admin/roles-list-table.php:230
364
- #, php-format
365
- msgid "%s item"
366
- msgstr ""
367
-
368
- #: admin/roles-list-table.php:112
369
- #: admin/roles-list-table.php:122
370
- #, fuzzy
371
- msgid "Users"
372
- msgstr "Gebruikersnaam"
373
-
374
- #: admin/roles-list-table.php:121
375
- #: includes/admin-bar.php:29
376
- msgid "Role"
377
- msgstr ""
378
-
379
- #: admin/roles-list-table.php:146
380
- #: admin/roles-list-table.php:154
381
- #, fuzzy, php-format
382
- msgid "Edit the %s role"
383
- msgstr "Bewerk"
384
-
385
- #: admin/roles-list-table.php:154
386
- msgid "Edit"
387
- msgstr "Bewerk"
388
-
389
- #: admin/roles-list-table.php:158
390
- #, php-format
391
- msgid "Delete the %s role"
392
- msgstr ""
393
-
394
- #: admin/roles-list-table.php:162
395
- msgid "Change default role"
396
- msgstr ""
397
-
398
- #: admin/roles-list-table.php:162
399
- msgid "Default Role"
400
- msgstr ""
401
-
402
- #: admin/roles-list-table.php:166
403
- #: admin/roles-list-table.php:182
404
- #, php-format
405
- msgid "View all users with the %s role"
406
- msgstr ""
407
-
408
- #: admin/roles-list-table.php:166
409
- msgid "View Users"
410
- msgstr ""
411
-
412
- #: admin/roles-list-table.php:182
413
- #: admin/roles-list-table.php:184
414
- #, fuzzy, php-format
415
- msgid "%s User"
416
- msgstr "Voeg gebruiker toe"
417
-
418
- #: admin/roles-list-table.php:194
419
- #, php-format
420
- msgid "%s Capability"
421
- msgstr ""
422
-
423
- #: admin/settings.php:28
424
- #, fuzzy
425
- msgid "Members Settings"
426
- msgstr "Hybrid Settings"
427
-
428
- #: admin/settings.php:28
429
- #, fuzzy
430
- msgid "Members"
431
- msgstr "Hybrid Settings"
432
-
433
- #: admin/settings.php:66
434
- msgid "Sorry, but you do not have permission to view this content."
435
- msgstr ""
436
-
437
- #: admin/settings.php:67
438
- msgid "You must be logged into the site to view this content."
439
- msgstr ""
440
-
441
- #: admin/settings.php:145
442
- #, fuzzy
443
- msgid "Members Plugin Settings"
444
- msgstr "Hybrid Settings"
445
-
446
- #: admin/settings.php:160
447
- #, fuzzy
448
- msgid "Update Settings"
449
- msgstr "Footer Settings:"
450
-
451
- #: includes/widget-login-form.php:26
452
- msgid "A widget that allows users to log into your site."
453
- msgstr ""
454
-
455
- #: includes/widget-login-form.php:37
456
- #, fuzzy
457
- msgid "Login Form"
458
- msgstr "Aanmelden"
459
-
460
- #: includes/widget-login-form.php:158
461
- #: includes/widget-login-form.php:161
462
- #, fuzzy
463
- msgid "Log In"
464
- msgstr "Aanmelden"
465
-
466
- #: includes/widget-login-form.php:159
467
- #, fuzzy
468
- msgid "Username"
469
- msgstr "Gebruikersnaam"
470
-
471
- #: includes/widget-login-form.php:160
472
- msgid "Password"
473
- msgstr "Wachtwoord"
474
-
475
- #: includes/widget-login-form.php:162
476
- #, fuzzy
477
- msgid "Remember Me"
478
- msgstr "Herinner deze gegevens."
479
-
480
- #: includes/widget-login-form.php:172
481
- msgid "Please log into the site."
482
- msgstr ""
483
-
484
- #: includes/widget-login-form.php:173
485
- msgid "You are currently logged in."
486
- msgstr ""
487
-
488
- #: includes/widget-login-form.php:185
489
- #: includes/widget-users.php:157
490
- msgid "Title:"
491
- msgstr "Titel"
492
-
493
- #: includes/widget-login-form.php:235
494
- #, fuzzy
495
- msgid "\"Remember me\" checkbox?"
496
- msgstr "Herinner deze gegevens."
497
-
498
- #: includes/widget-login-form.php:239
499
- #, fuzzy
500
- msgid "Check \"remember me\"?"
501
- msgstr "Herinner deze gegevens."
502
-
503
- #: includes/widget-login-form.php:243
504
- msgid "Display avatar?"
505
- msgstr ""
506
-
507
- #: includes/widget-login-form.php:246
508
- msgid "Logged out text:"
509
- msgstr ""
510
-
511
- #: includes/widget-login-form.php:251
512
- msgid "Logged in text:"
513
- msgstr ""
514
-
515
- #: includes/widget-users.php:26
516
- msgid "Provides the ability to list the users of the site."
517
- msgstr ""
518
-
519
- #: includes/widget-users.php:145
520
- msgid "Ascending"
521
- msgstr ""
522
-
523
- #: includes/widget-users.php:145
524
- msgid "Descending"
525
- msgstr ""
526
-
527
- #: includes/widget-users.php:146
528
- #, fuzzy
529
- msgid "Display Name"
530
- msgstr "Voornaam"
531
-
532
- #: includes/widget-users.php:146
533
- msgid "Email"
534
- msgstr "Email"
535
-
536
- #: includes/widget-users.php:146
537
- msgid "ID"
538
- msgstr ""
539
-
540
- #: includes/widget-users.php:146
541
- #, fuzzy
542
- msgid "Nice Name"
543
- msgstr "Naam"
544
-
545
- #: includes/widget-users.php:146
546
- #, fuzzy
547
- msgid "Post Count"
548
- msgstr "Niet gevonden"
549
-
550
- #: includes/widget-users.php:146
551
- #, fuzzy
552
- msgid "Registered"
553
- msgstr "Registreer"
554
-
555
- #: includes/widget-users.php:146
556
- msgid "URL"
557
- msgstr ""
558
-
559
- #: includes/widget-users.php:146
560
- #, fuzzy
561
- msgid "Login"
562
- msgstr "Aanmelden"
563
-
564
- #, fuzzy
565
- #~ msgid "Welcome, %1$s!"
566
- #~ msgstr "Week %1$s"
567
-
568
- #, fuzzy
569
- #~ msgid "Password:"
570
- #~ msgstr "Wachtwoord"
571
-
572
- #, fuzzy
573
- #~ msgid "Select Components"
574
- #~ msgstr "Selecteer maand"
575
-
576
- #, fuzzy
577
- #~ msgid "Component"
578
- #~ msgstr "Reactie"
579
-
580
- #, fuzzy
581
- #~ msgid "Activate"
582
- #~ msgstr "Archieven"
583
-
584
- #, fuzzy
585
- #~ msgid "Active"
586
- #~ msgstr "Archieven"
587
-
588
- #, fuzzy
589
- #~ msgid "Inactive"
590
- #~ msgstr "Archieven"
591
-
592
- #, fuzzy
593
- #~ msgid "Username Label:"
594
- #~ msgstr "Gebruikersnaam*"
595
-
596
- #, fuzzy
597
- #~ msgid "Password Label:"
598
- #~ msgstr "Wachtwoord*"
599
-
600
- #~ msgid "Submit Text:"
601
- #~ msgstr "Verstuur tekst:"
602
-
603
- #, fuzzy
604
- #~ msgid "Remember User Text:"
605
- #~ msgstr "Herinner deze gegevens."
606
-
607
- #, fuzzy
608
- #~ msgid ""
609
- #~ "An advanced widget that gives you total control over the output of your "
610
- #~ "user lists."
611
- #~ msgstr ""
612
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
613
- #~ "van je pagina-links."
614
-
615
- #~ msgid "Limit:"
616
- #~ msgstr "Limiet:"
617
-
618
- #~ msgid "Order:"
619
- #~ msgstr "Volgorde:"
620
-
621
- #~ msgid "Order By:"
622
- #~ msgstr "Sorteer op:"
623
-
624
- #~ msgid "Include:"
625
- #~ msgstr "Omvat:"
626
-
627
- #~ msgid "Exclude:"
628
- #~ msgstr "Sluit uit:"
629
-
630
- #, fuzzy
631
- #~ msgid "Show full name?"
632
- #~ msgstr "Aanpassingen tonen?"
633
-
634
- #~ msgid "Save Changes"
635
- #~ msgstr "Bewaren"
636
-
637
- #, fuzzy
638
- #~ msgid "New user role has been added."
639
- #~ msgstr "Er is een gebruikersaccount aangemaakt voor %1$s."
640
-
641
- #~ msgid ""
642
- #~ "You tried going to %1$s, and it doesn't exist. All is not lost! You can "
643
- #~ "search for what you're looking for."
644
- #~ msgstr ""
645
- #~ "Je wilde naar %1$s gaan, maar dit bestaat niet. Geen nood! Zoek hier "
646
- #~ "wat je zocht:"
647
-
648
- #~ msgid "Possibly Related"
649
- #~ msgstr "Mogelijk gerelateerd"
650
-
651
- #~ msgid "Continue reading"
652
- #~ msgstr "Lees hier verder"
653
-
654
- #~ msgid "Download &quot;%1$s&quot;"
655
- #~ msgstr "Download &quot;%1$s&quot;"
656
-
657
- #~ msgid "Pages:"
658
- #~ msgstr "Pagina's:"
659
-
660
- #~ msgid "Sorry, no applications matched your criteria."
661
- #~ msgstr "Sorry, er zijn geen toepassingen die met je criteria overeenkomen."
662
-
663
- #~ msgid "You are browsing the archive for %1$s."
664
- #~ msgstr "Je bladert nu door het archief voor %1$s."
665
-
666
- #~ msgid "By"
667
- #~ msgstr "Door"
668
-
669
- #~ msgid "on"
670
- #~ msgstr "op"
671
-
672
- #~ msgid "l, F jS, Y, g:i a"
673
- #~ msgstr "l, j F, Y, G:i"
674
-
675
- #~ msgid "F j, Y"
676
- #~ msgstr "j F, Y"
677
-
678
- #~ msgid "Posted in"
679
- #~ msgstr "Gepost in"
680
-
681
- #~ msgid "Tagged"
682
- #~ msgstr "Tags:"
683
-
684
- #~ msgid "Leave a response"
685
- #~ msgstr "Reageer"
686
-
687
- #~ msgid "1 Response"
688
- #~ msgstr "1 Reactie"
689
-
690
- #~ msgid "% Responses"
691
- #~ msgstr "% Reacties"
692
-
693
- #~ msgid "Sorry, there are no posts in this archive."
694
- #~ msgstr "Sorry, dit archief bevat geen berichten."
695
-
696
- #~ msgid "Archives by category"
697
- #~ msgstr "Archieven per rubriek"
698
-
699
- #~ msgid "Archives by month"
700
- #~ msgstr "Archieven per maand"
701
-
702
- #~ msgid "Sorry, no page matched your criteria."
703
- #~ msgstr "Sorry, er bestaat geen pagina die aan je criteria voldoet."
704
-
705
- #~ msgid "Sorry, no attachments matched your criteria."
706
- #~ msgstr "Sorry, er zijn geen bijlages die aan je criteria voldoen."
707
-
708
- #~ msgid "Sorry, no audio files matched your criteria."
709
- #~ msgstr "Sorry, er zijn geen geluidsbestanden die aan je criteria voldoen."
710
-
711
- #~ msgid "Send an email to %1$s"
712
- #~ msgstr "Stuur een email aan %1$s"
713
-
714
- #~ msgid "Email %1$s"
715
- #~ msgstr "Email %1$s"
716
-
717
- #~ msgid "%1$s hasn't written any posts yet."
718
- #~ msgstr "%1$s heeft nog geen berichten geschreven."
719
-
720
- #~ msgid "Nickname:"
721
- #~ msgstr "Bijnaam:"
722
-
723
- #~ msgid "Email:"
724
- #~ msgstr "Email:"
725
-
726
- #~ msgid "Website:"
727
- #~ msgstr "Website:"
728
-
729
- #~ msgid "AIM:"
730
- #~ msgstr "AIM:"
731
-
732
- #~ msgid "IM with %1$s"
733
- #~ msgstr "IM met %1$s"
734
-
735
- #~ msgid "Jabber:"
736
- #~ msgstr "Jabber:"
737
-
738
- #~ msgid "Yahoo:"
739
- #~ msgstr "Yahoo:"
740
-
741
- #~ msgid "Sorry, there are no posts in the %1$s category."
742
- #~ msgstr "Sorry, er zijn geen berichten in de rubriek %1$s. "
743
-
744
- #~ msgid "Please do not load this page directly. Thanks!"
745
- #~ msgstr "Gelieve deze pagina niet rechtstreeks te laden. Dankjewel!"
746
-
747
- #~ msgid "No Responses"
748
- #~ msgstr "Geen reacties"
749
-
750
- #~ msgid "One Response"
751
- #~ msgstr "Een reactie"
752
-
753
- #~ msgid "Responses"
754
- #~ msgstr "Reacties"
755
-
756
- #~ msgid "to"
757
- #~ msgstr "naar"
758
-
759
- #~ msgid "%1$s at %2$s"
760
- #~ msgstr "%1$s op %2$s"
761
-
762
- #~ msgid "Permalink to comment"
763
- #~ msgstr "Permalink naar reactie"
764
-
765
- #~ msgid "Permalink"
766
- #~ msgstr "Permalink"
767
-
768
- #~ msgid "Your comment is awaiting moderation."
769
- #~ msgstr "Je reactie wacht op moderatie."
770
-
771
- #~ msgid ""
772
- #~ "Comments are closed, but <a href=\"%1$s\" title=\"Trackback URL for this "
773
- #~ "post\">trackbacks</a> and pingbacks are open."
774
- #~ msgstr ""
775
- #~ "Reageren is niet mogelijk, maar <a href=\"%1$s\" title=\"Trackback URL "
776
- #~ "for this post\">trackbacks</a> en pingbacks blijven open."
777
-
778
- #~ msgid "Comments are closed."
779
- #~ msgstr "Reageren is niet mogelijk."
780
-
781
- #~ msgid "Leave a Reply"
782
- #~ msgstr "Reageer"
783
-
784
- #~ msgid ""
785
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> to post a "
786
- #~ "comment."
787
- #~ msgstr ""
788
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn om te "
789
- #~ "reageren."
790
-
791
- #~ msgid "Logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
792
- #~ msgstr "Ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
793
-
794
- #~ msgid "Log out of this account"
795
- #~ msgstr "Afmelden."
796
-
797
- #~ msgid "Logout &raquo;"
798
- #~ msgstr "Afmelden &raquo;"
799
-
800
- #~ msgid "*"
801
- #~ msgstr "*"
802
-
803
- #~ msgid "Website"
804
- #~ msgstr "Website"
805
-
806
- #~ msgid "Submit"
807
- #~ msgstr "Verstuur"
808
-
809
- #~ msgid "Password Protected"
810
- #~ msgstr "Beveiligd met wachtwoord"
811
-
812
- #~ msgid "Enter the password to view comments."
813
- #~ msgstr "Voer wachtwoord in om reacties te lezen."
814
-
815
- #~ msgid "Leave a Reply to %s"
816
- #~ msgstr "Reageer op %s"
817
-
818
- #~ msgid "Click here to cancel reply."
819
- #~ msgstr "Klik hier om de reactie te annuleren."
820
-
821
- #~ msgid "F jS, Y"
822
- #~ msgstr "j F, Y"
823
-
824
- #~ msgid "Week %1$s of %2$s"
825
- #~ msgstr "Week %1$s van %2$s"
826
-
827
- #~ msgid "W"
828
- #~ msgstr "W"
829
-
830
- #~ msgid "Y"
831
- #~ msgstr "Y"
832
-
833
- #~ msgid "You are browsing the archive for week %1$s of %2$s."
834
- #~ msgstr "Je bekijkt het archief voor week %1$s van %2$s."
835
-
836
- #~ msgid "Sorry, there are no posts for %1$s."
837
- #~ msgstr "Sorry, maar er zijn geen berichten voor %1$s."
838
-
839
- #~ msgid "Sorry, no posts matched your criteria."
840
- #~ msgstr "Sorry, er zijn geen berichten die met je criteria overeenkomen."
841
-
842
- #~ msgid "Sorry, no images matched your criteria."
843
- #~ msgstr "Sorry, er zijn geen afbeeldingen die met je criteria overeenkomen."
844
-
845
- #~ msgid ""
846
- #~ "You are currently logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
847
- #~ msgstr ""
848
- #~ "Je bent momenteel ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
849
-
850
- #~ msgid ""
851
- #~ "You have successfully logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</"
852
- #~ "a>."
853
- #~ msgstr ""
854
- #~ "Je bent succesvol ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
855
-
856
- #~ msgid ""
857
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> to view the "
858
- #~ "content of this page."
859
- #~ msgstr ""
860
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn om de inhoud "
861
- #~ "van deze pagina te bekijken."
862
-
863
- #~ msgid ""
864
- #~ "If you're not currently a member, please take a moment to <a href=\"%1$s"
865
- #~ "\" title=\"Register\">register</a>."
866
- #~ msgstr ""
867
- #~ "Als je momenteel nog geen lid bent, neem dan een ogenblikje tijd om je te "
868
- #~ "<a href=\"%1$s\" title=\"Register\">registreren</a>."
869
-
870
- #~ msgid "You must enter a post title."
871
- #~ msgstr "Je moet een titel voor het bericht invoeren."
872
-
873
- #~ msgid "You must write something."
874
- #~ msgstr "Je moet hier iets schrijven."
875
-
876
- #~ msgid "Title"
877
- #~ msgstr "Titel"
878
-
879
- #~ msgid "Write"
880
- #~ msgstr "Schrijf"
881
-
882
- #~ msgid "Tags"
883
- #~ msgstr "Tags"
884
-
885
- #~ msgid "Publish"
886
- #~ msgstr "Publiceer"
887
-
888
- #~ msgid "You don't have the appropriate capabilities to publish posts."
889
- #~ msgstr "Je hebt niet de nodige rechten om berichten te publiceren."
890
-
891
- #~ msgid ""
892
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> with "
893
- #~ "appropriate user capabilities to publish posts."
894
- #~ msgstr ""
895
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn met de nodige "
896
- #~ "gebruikersrechten om berichten te kunnen publiceren."
897
-
898
- #~ msgid "A username is required for registration."
899
- #~ msgstr "Om te registreren is een gebruikersnaam nodig."
900
-
901
- #~ msgid "You must enter an email address."
902
- #~ msgstr "Je moet een email-adres invoeren."
903
-
904
- #~ msgid "You must enter a password."
905
- #~ msgstr "Je moet een wachtwoord invoeren."
906
-
907
- #~ msgid "You must enter your password twice."
908
- #~ msgstr "Je moet je wachtwoord tweemaal invoeren."
909
-
910
- #~ msgid "You must enter the same password twice."
911
- #~ msgstr "Je moet tweemaal hetzelfde wachtwoord invoeren."
912
-
913
- #~ msgid "User registration failed. Please try again."
914
- #~ msgstr "Gebruikersregistratie mislukt. Probeer opnieuw."
915
-
916
- #~ msgid ""
917
- #~ "You are logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>. You don't "
918
- #~ "need another account."
919
- #~ msgstr ""
920
- #~ "Je bent ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>. Je hebt "
921
- #~ "geen bijkomend account nodig."
922
-
923
- #~ msgid "Thank you for registering, %1$s."
924
- #~ msgstr "Bedankt voor je registratie, %1$s."
925
-
926
- #~ msgid "Users can register themselves or you can manually create users here."
927
- #~ msgstr ""
928
- #~ "Gebruikers kunnen zichzelf registreren of je kan hier handmatig "
929
- #~ "gebruikersaccounts aanmaken."
930
-
931
- #~ msgid ""
932
- #~ "Users cannot currently register themselves, but you can manually create "
933
- #~ "users here."
934
- #~ msgstr ""
935
- #~ "Gebruikers kunnen zichzelf niet registreren, maar je kan hier wel "
936
- #~ "handmatig gebruikersaccounts aanmaken."
937
-
938
- #~ msgid "Required fields are marked <span class=\"required\">*</span>"
939
- #~ msgstr ""
940
- #~ "Verplichte velden zijn aangeduid met <span class=\"required\">*</span>."
941
-
942
- #~ msgid "Last Name"
943
- #~ msgstr "Naam"
944
-
945
- #~ msgid "E-mail *"
946
- #~ msgstr "E-mail *"
947
-
948
- #~ msgid "Repeat Password *"
949
- #~ msgstr "Herhaal je wachtwoord*"
950
-
951
- #~ msgid "Biographical Information"
952
- #~ msgstr "Biografische informatie"
953
-
954
- #~ msgid "You are browsing the search results for &quot;%1$s&quot;"
955
- #~ msgstr "Je bekijkt hier de zoekresultaten voor &quot;%1$s&quot;"
956
-
957
- #~ msgid "Maybe you'd like to try inputting different search terms."
958
- #~ msgstr "Misschien wil je andere zoektermen invoeren."
959
-
960
- #~ msgid "You are browsing the %1$s tag archive."
961
- #~ msgstr "Je bekijkt het archief voor de tag %1$s"
962
-
963
- #~ msgid "Sorry, there are no posts tagged %1$s."
964
- #~ msgstr "Sorry, er zijn geen berichten met de tag %1$s."
965
-
966
- #~ msgid "Sorry, no documents matched your criteria."
967
- #~ msgstr "Sorry, er zijn geen documenten die met je criteria overeenkomen."
968
-
969
- #~ msgid "Sorry, no videos matched your criteria."
970
- #~ msgstr "Sorry, er zijn geen video's die met je criteria overeenkomen."
971
-
972
- #~ msgid "Widget Template"
973
- #~ msgstr "Widget Template"
974
-
975
- #~ msgid "About This Theme"
976
- #~ msgstr "Over dit Thema"
977
-
978
- #~ msgid "Theme Description:"
979
- #~ msgstr "Thema Beschrijving:"
980
-
981
- #~ msgid "Theme Documentation:"
982
- #~ msgstr "Thema Documentatie:"
983
-
984
- #~ msgid "Get support for this theme"
985
- #~ msgstr "Ondersteuning voor dit thema"
986
-
987
- #~ msgid "Select your theme settings"
988
- #~ msgstr "Selecteer de settings voor je thema"
989
-
990
- #, fuzzy
991
- #~ msgid ""
992
- #~ "Select this if you want your primary widget inserts to default to the "
993
- #~ "home insert when nothing else is selected."
994
- #~ msgstr ""
995
- #~ "Selecteer dit als je wenst dat je primaire widgets standaard geladen "
996
- #~ "worden op de home-pagina als niet anders geselecteerd is."
997
-
998
- #, fuzzy
999
- #~ msgid ""
1000
- #~ "Select this if you want your secondary widget inserts to default to the "
1001
- #~ "home insert when nothing else is selected."
1002
- #~ msgstr ""
1003
- #~ "Selecteer dit als je wenst dat je secundaire widgets standaard geladen "
1004
- #~ "worden op de home-pagina als niet anders geselecteerd is."
1005
-
1006
- #~ msgid "Stylesheets:"
1007
- #~ msgstr "Stijlbladen (CSS)"
1008
-
1009
- #~ msgid ""
1010
- #~ "Select this to have the theme automatically include a print stylesheet."
1011
- #~ msgstr ""
1012
- #~ "Selecteer dit als je wil dat het thema automatisch een 'print' stijlblad "
1013
- #~ "insluit."
1014
-
1015
- #~ msgid "JavaScript:"
1016
- #~ msgstr "JavaScript:"
1017
-
1018
- #~ msgid "Include the pull quote JavaScript."
1019
- #~ msgstr "Inclusief pull quote JavaScript."
1020
-
1021
- #~ msgid "Feeds:"
1022
- #~ msgstr "Feeds:"
1023
-
1024
- #~ msgid ""
1025
- #~ "If you have a an alternate feed address, such as one from <a href="
1026
- #~ "\"http://feedburner.com\" title=\"Feedburner\">Feedburner</a>, you can "
1027
- #~ "enter it here to have the theme set your feed URL link. If blank, the "
1028
- #~ "theme will default to your WordPress RSS feed."
1029
- #~ msgstr ""
1030
- #~ "Wanneer je over een alternatief feed-adres beschikt, zoals van <a href="
1031
- #~ "\"http://feedburner.com\" title=\"Feedburner\">Feedburner</a>, kan je dat "
1032
- #~ "hier invoeren om het door het thema te laten gebruiken. Als je dit "
1033
- #~ "blanco laat, wordt de standaard WordPress RSS feed gebruikt."
1034
-
1035
- #~ msgid "Title &amp; Meta:"
1036
- #~ msgstr "Titel &amp; Meta"
1037
-
1038
- #~ msgid "Use category slugs on single posts for your meta keywords?"
1039
- #~ msgstr ""
1040
- #~ "Gebruik categorie 'slug' als meta keywoord voor afzonderlijke berichten."
1041
-
1042
- #~ msgid "Use tag slugs on single posts for your meta keywords?"
1043
- #~ msgstr "Gebruik tag 'slug' als meta keywoord voor afzonderlijke berichten."
1044
-
1045
- #~ msgid "Use the excerpt on single posts for your meta description?"
1046
- #~ msgstr ""
1047
- #~ "Uittreksel als meta-omschrijving gebruiken voor afzonderlijke berichten?"
1048
-
1049
- #~ msgid "Use the author bio on author archives for your meta description?"
1050
- #~ msgstr ""
1051
- #~ "Auteurs biografie als meta-omschrijving gebruiken voor afzonderlijke "
1052
- #~ "berichten?"
1053
-
1054
- #~ msgid ""
1055
- #~ "Use the category description on category archives for your meta "
1056
- #~ "description?"
1057
- #~ msgstr ""
1058
- #~ "Rubriek-omschrijving als meta-omschrijving gebruiken voor afzonderlijke "
1059
- #~ "berichten?"
1060
-
1061
- #~ msgid "Use the author's name on pages and posts as the meta author?"
1062
- #~ msgstr ""
1063
- #~ "Naam van de auteur als meta-auteur gebruiken op pagina's en berichten?"
1064
-
1065
- #~ msgid "Append site title to the end of the page name?"
1066
- #~ msgstr "Site-naam toevoegen aan het eind van de pagina-naam?"
1067
-
1068
- #~ msgid ""
1069
- #~ "You can change these settings in the box labeled <em>Hybrid Settings</em> "
1070
- #~ "when writing a post or page."
1071
- #~ msgstr ""
1072
- #~ "Je kan deze settings aanpassen in het vak <em>Hybrid Settings</em> "
1073
- #~ "wanneer je een bericht of pagina bewerkt."
1074
-
1075
- #~ msgid ""
1076
- #~ "The <a href=\"%1$s\" title=\"All-In-One SEO Pack\">All-In-One SEO Pack</"
1077
- #~ "a> and <a href=\"%2$s\" title=\"Headspace2\">Headspace2</a> plugins will "
1078
- #~ "override these settings and the Indexing settings."
1079
- #~ msgstr ""
1080
- #~ "De <a href=\"%1$s\" title=\"All-In-One SEO Pack\">All-In-One SEO Pack</a> "
1081
- #~ "en <a href=\"%2$s\" title=\"Headspace2\">Headspace2</a> plugins zullen "
1082
- #~ "deze en de indexeringssettings overschrijven."
1083
-
1084
- #~ msgid "Indexing:"
1085
- #~ msgstr "Indexeren:"
1086
-
1087
- #~ msgid ""
1088
- #~ "Choose which pages of your blog get indexed by the search engines. Only "
1089
- #~ "selected pages will be indexed. If not selected, those pages will be "
1090
- #~ "blocked."
1091
- #~ msgstr ""
1092
- #~ "Kies welke pagina's van je blog door zoekmachines kunnen ge&iuml;ndexeerd "
1093
- #~ "worden. Alleen de geselecteerde pagina's worden ge&iuml;ndexeerd. Niet "
1094
- #~ "geselecteerde pagina's worden geblokkeerd."
1095
-
1096
- #~ msgid ""
1097
- #~ "Note: Some of these settings will render the Title &amp; Meta settings "
1098
- #~ "moot. Also, setting your site to privacy mode will override these "
1099
- #~ "controls."
1100
- #~ msgstr ""
1101
- #~ "Let op: Sommige van deze settings kunnen conflicteren met de Titel &amp; "
1102
- #~ "Meta settings. Ook wanneer je je site in een beveiligde modus omzet, "
1103
- #~ "worden deze settings overschreven."
1104
-
1105
- #~ msgid "Home page"
1106
- #~ msgstr "Homepage"
1107
-
1108
- #~ msgid "Single posts"
1109
- #~ msgstr "Afzonderlijke berichten"
1110
-
1111
- #~ msgid "Attachments"
1112
- #~ msgstr "Bijlages"
1113
-
1114
- #~ msgid "Pages"
1115
- #~ msgstr "Pagina's"
1116
-
1117
- #~ msgid "Date-based archives"
1118
- #~ msgstr "Datum-gebaseerd archief"
1119
-
1120
- #~ msgid "Category archives"
1121
- #~ msgstr "Archief per rubriek"
1122
-
1123
- #~ msgid "Tag archives"
1124
- #~ msgstr "Archief op tags"
1125
-
1126
- #~ msgid "Author archives"
1127
- #~ msgstr "Archief op auteur"
1128
-
1129
- #~ msgid "Search"
1130
- #~ msgstr "Zoek"
1131
-
1132
- #~ msgid "404"
1133
- #~ msgstr "404"
1134
-
1135
- #~ msgid "Avatars:"
1136
- #~ msgstr "Avatars:"
1137
-
1138
- #~ msgid ""
1139
- #~ "You can set a default avatar for users without one if you don't like the "
1140
- #~ "choices WordPress offers you. Simply add the full path to the image file."
1141
- #~ msgstr ""
1142
- #~ "Je kan een standaard-avatar instellen voor gebruikers zonder avatar, "
1143
- #~ "wanneer de keuze van WordPress je niet bevalt. Voer daartoe hier het "
1144
- #~ "complete pad naar de afbeelding in."
1145
-
1146
- #~ msgid "Comments:"
1147
- #~ msgstr "Reacties:"
1148
-
1149
- #~ msgid "Check to use the comments popup window instead of regular comments."
1150
- #~ msgstr ""
1151
- #~ "Aanvinken om een popup-scherm voor reacties te gebruiken in plaats van "
1152
- #~ "het gebruikelijke commentaarscherm."
1153
-
1154
- #~ msgid "WP 2.7+ only."
1155
- #~ msgstr "Enkel voor WP 2.7+"
1156
-
1157
- #~ msgid "Footer Insert:"
1158
- #~ msgstr "Inserts voor Footer:"
1159
-
1160
- #~ msgid ""
1161
- #~ "You can place XHTML and JavaScript here to have it inserted automatically "
1162
- #~ "into your theme. If you have a script, such as one from Google "
1163
- #~ "Analytics, this could be useful."
1164
- #~ msgstr ""
1165
- #~ "Je kan hier XHTML en Javascript plaatsen dat automatisch in de footer van "
1166
- #~ "je thema wordt ingevoerd. Dit kan van pas komen als je een script hebt "
1167
- #~ "zoals dat van Google Analytics."
1168
-
1169
- #~ msgid ""
1170
- #~ "Check this if you want the theme to auto-generate your site's copyright "
1171
- #~ "and title in the footer."
1172
- #~ msgstr ""
1173
- #~ "Aanvinken wanneer je wil dat het thema automatisch een copyright voor je "
1174
- #~ "site in de footer invoert."
1175
-
1176
- #~ msgid ""
1177
- #~ "Want to show your love of WordPress? Check this and a link will be added "
1178
- #~ "to your footer back to WordPress.org."
1179
- #~ msgstr ""
1180
- #~ "Wil je laten zien hoezeer je WordPress waardeert? Vink dit aan om "
1181
- #~ "automatisch een link naar WordPress.org aan de footer toe te voegen."
1182
-
1183
- #~ msgid ""
1184
- #~ "Check this to have a link back to Theme Hybrid automatically appended to "
1185
- #~ "your footer. This is totally optional. Really."
1186
- #~ msgstr ""
1187
- #~ "Aanvinken om automatisch een link naar Theme Hybrid aan je footer toe te "
1188
- #~ "voegen. Dit volkomen vrijwillig, echt waar!"
1189
-
1190
- #~ msgid ""
1191
- #~ "For testing purposes, this will append a database query counter and page "
1192
- #~ "load timer to your footer."
1193
- #~ msgstr ""
1194
- #~ "Voor test-doeleinden wordt hiermee een database-query teller en de "
1195
- #~ "laadtijd van de pagina aan je footer toegevoegd."
1196
-
1197
- #~ msgid "Add a title that will be seen by search engines."
1198
- #~ msgstr "Voeg een titel toe die door zoekmachines gezien wordt."
1199
-
1200
- #~ msgid "Add a description that will be seen by search engines."
1201
- #~ msgstr "Voeg een beschrijving toe die door zoekmachines gezien wordt."
1202
-
1203
- #~ msgid "Keywords:"
1204
- #~ msgstr "Trefwoorden:"
1205
-
1206
- #~ msgid "Add keywords that will be seen by search engines."
1207
- #~ msgstr "Voeg trefwoorden toe die door zoekmachines gezien worden."
1208
-
1209
- #~ msgid "Series:"
1210
- #~ msgstr "Series:"
1211
-
1212
- #~ msgid "Post the title of your series of articles here."
1213
- #~ msgstr "Post hier de titel van je artikelseries."
1214
-
1215
- #~ msgid "Thumbnail:"
1216
- #~ msgstr "Thumbnail:"
1217
-
1218
- #~ msgid "Add an image URL here."
1219
- #~ msgstr "Voeg hier de URL van een afbeelding toe."
1220
-
1221
- #~ msgid "Page Navigation:"
1222
- #~ msgstr "Pagina Navigatie:"
1223
-
1224
- #~ msgid "Hybrid Theme Settings"
1225
- #~ msgstr "Hybrid Theme Settings"
1226
-
1227
- #~ msgid "Settings saved."
1228
- #~ msgstr "Settings opgeslagen."
1229
-
1230
- #~ msgid "Browse:"
1231
- #~ msgstr "Blader:"
1232
-
1233
- #~ msgid "Home"
1234
- #~ msgstr "Home"
1235
-
1236
- #~ msgid "Search results for &quot;%1$s&quot"
1237
- #~ msgstr "Zoekresultaten voor &quot;%1$s&quot"
1238
-
1239
- #~ msgid "m"
1240
- #~ msgstr "m"
1241
-
1242
- #~ msgid "F"
1243
- #~ msgstr "F"
1244
-
1245
- #~ msgid "j"
1246
- #~ msgstr "j"
1247
-
1248
- #~ msgid "404 Not Found"
1249
- #~ msgstr "404 Niet Gevonden"
1250
-
1251
- #~ msgid "Log in to reply."
1252
- #~ msgstr "Log in op te reageren."
1253
-
1254
- #~ msgid "This function has been removed or replaced by another function."
1255
- #~ msgstr "Deze functie is verwijderd of vervangen door een andere functie."
1256
-
1257
- #~ msgid ""
1258
- #~ "You can use these <acronym title=\"Extensible Hypertext Markup Language"
1259
- #~ "\">XHTML</acronym> tags&#58;"
1260
- #~ msgstr ""
1261
- #~ "Je kan deze <acronym title=\"Extensible Hypertext Markup Language"
1262
- #~ "\">XHTML</acronym> tags&#58; gebruiken."
1263
-
1264
- #~ msgid "Search this site..."
1265
- #~ msgstr "Doorzoek deze site"
1266
-
1267
- #~ msgid "Copyright"
1268
- #~ msgstr "Copyright"
1269
-
1270
- #~ msgid "Powered by"
1271
- #~ msgstr "Aangedreven door "
1272
-
1273
- #~ msgid ""
1274
- #~ "Powered by WordPress, state-of-the-art semantic personal publishing "
1275
- #~ "platform"
1276
- #~ msgstr ""
1277
- #~ "Aangedreven door WordPress, het state-of-the-art semantische platform "
1278
- #~ "voor iedereen."
1279
-
1280
- #~ msgid "WordPress"
1281
- #~ msgstr "WordPress"
1282
-
1283
- #~ msgid "and"
1284
- #~ msgstr "en"
1285
-
1286
- #~ msgid "Hybrid Theme Framework"
1287
- #~ msgstr "Hybrid Theme Framework"
1288
-
1289
- #~ msgid "Articles in this series"
1290
- #~ msgstr "Artikelen in deze serie"
1291
-
1292
- #~ msgid ""
1293
- #~ "You have encountered an error. This is usually because you've changed "
1294
- #~ "something in the core Hybrid theme files. Try undoing your last edit to "
1295
- #~ "correct this issue. If this doesn't resolve it, head over to the support "
1296
- #~ "forums for help."
1297
- #~ msgstr ""
1298
- #~ "Er is een fout opgetreden. Dit gebeurt gewoonlijk nadat je iets hebt "
1299
- #~ "gewijzigd in de kernbestanden van het Hybrid-thema. Probeer je laatste "
1300
- #~ "wijzigingen ongedaan te maken om dit op te lossen. Als dat niet lukt, "
1301
- #~ "kan je je tot de support forums richten voor hulp."
1302
-
1303
- #~ msgid "This page loaded in %1$s seconds with %2$s database queries."
1304
- #~ msgstr "Deze pagina laadde in %1$s seconden met %2$s database queries."
1305
-
1306
- #~ msgid ": Page %1$s"
1307
- #~ msgstr ":Pagina %1$s"
1308
-
1309
- #~ msgid "Search results for &quot;%1$s.&quot;"
1310
- #~ msgstr "Zoekresultaten voor &quot;%1$s.&quot;"
1311
-
1312
- #~ msgid "Archive for %1$s"
1313
- #~ msgstr "Archief voor %1$s"
1314
-
1315
- #~ msgid "Archive for week %1$s of %2$s"
1316
- #~ msgstr "Archief voor week %1$s van %2$s"
1317
-
1318
- #~ msgid "Comment on &quot;%1$s&quot;"
1319
- #~ msgstr "Reactie op &quot;%1$s&quot;"
1320
-
1321
- #~ msgid "Primary Home"
1322
- #~ msgstr "Primair Home"
1323
-
1324
- #~ msgid "Primary Author"
1325
- #~ msgstr "Primaire Auteur"
1326
-
1327
- #~ msgid "Primary Category"
1328
- #~ msgstr "Primaire Rubriek"
1329
-
1330
- #~ msgid "Primary Date"
1331
- #~ msgstr "Primaire Datum"
1332
-
1333
- #~ msgid "Primary Page"
1334
- #~ msgstr "Primaire Pagina"
1335
-
1336
- #~ msgid "Primary Search"
1337
- #~ msgstr "Primaire Zoekresultaten"
1338
-
1339
- #~ msgid "Primary Tag"
1340
- #~ msgstr "Primaire Tag"
1341
-
1342
- #~ msgid "Primary 404"
1343
- #~ msgstr "Primaire 404"
1344
-
1345
- #~ msgid "Secondary Home"
1346
- #~ msgstr "Secundaire Home"
1347
-
1348
- #~ msgid "Secondary Author"
1349
- #~ msgstr "Secundaire Auteur"
1350
-
1351
- #~ msgid "Secondary Category"
1352
- #~ msgstr "Secundaire Rubriek"
1353
-
1354
- #~ msgid "Secondary Date"
1355
- #~ msgstr "Secundaire Datum "
1356
-
1357
- #~ msgid "Secondary Page"
1358
- #~ msgstr "Secundaire Pagina"
1359
-
1360
- #~ msgid "Secondary Search"
1361
- #~ msgstr "Secundaire Zoekresultaten"
1362
-
1363
- #~ msgid "Secondary Single"
1364
- #~ msgstr "Secundaire EnkelvoudigBericht"
1365
-
1366
- #~ msgid "Secondary Tag"
1367
- #~ msgstr "Secundaire Tag"
1368
-
1369
- #~ msgid "Secondary 404"
1370
- #~ msgstr "Secundaire 404"
1371
-
1372
- #~ msgid "Subsidiary Default"
1373
- #~ msgstr "Bijkomende Standaard"
1374
-
1375
- #~ msgid "RSS 2.0"
1376
- #~ msgstr "RSS 2.0"
1377
-
1378
- #~ msgid "RSS .92"
1379
- #~ msgstr "RSS .92"
1380
-
1381
- #~ msgid "Atom 0.3"
1382
- #~ msgstr "Atom 0.3"
1383
-
1384
- #~ msgid "Subsidiary Home"
1385
- #~ msgstr "Subsidiair Home"
1386
-
1387
- #~ msgid "Previous Page"
1388
- #~ msgstr "Vorige pagina"
1389
-
1390
- #~ msgid "Next Page"
1391
- #~ msgstr "Volgende pagina"
1392
-
1393
- #~ msgid "Related Posts"
1394
- #~ msgstr "Gerelateerde berichten"
1395
-
1396
- #~ msgid "Logout"
1397
- #~ msgstr "Afmelden"
1398
-
1399
- #~ msgid "Select Year"
1400
- #~ msgstr "Selecteer jaar"
1401
-
1402
- #~ msgid "Select Week"
1403
- #~ msgstr "Selecteer week"
1404
-
1405
- #~ msgid "Select Day"
1406
- #~ msgstr "Selecteer dag"
1407
-
1408
- #~ msgid "Select Post"
1409
- #~ msgstr "Selecteer bericht"
1410
-
1411
- #~ msgid "Type:"
1412
- #~ msgstr "Type:"
1413
-
1414
- #~ msgid "Format:"
1415
- #~ msgstr "Format:"
1416
-
1417
- #~ msgid "Before:"
1418
- #~ msgstr "Voor:"
1419
-
1420
- #~ msgid "After:"
1421
- #~ msgstr "Na:"
1422
-
1423
- #~ msgid "Show post count?"
1424
- #~ msgstr "Toon aantal berichten?"
1425
-
1426
- #~ msgid ""
1427
- #~ "An advanced widget that gives you total control over the output of your "
1428
- #~ "archives."
1429
- #~ msgstr ""
1430
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1431
- #~ "van je archieven."
1432
-
1433
- #~ msgid "Bookmarks"
1434
- #~ msgstr "Favorieten"
1435
-
1436
- #~ msgid "Categories:"
1437
- #~ msgstr "Rubrieken:"
1438
-
1439
- #~ msgid "Exclude Categories:"
1440
- #~ msgstr "Uit te sluiten rubrieken:"
1441
-
1442
- #~ msgid "Category:"
1443
- #~ msgstr "Rubriek:"
1444
-
1445
- #~ msgid "Category Order:"
1446
- #~ msgstr "Rubriek volgorde:"
1447
-
1448
- #~ msgid "Order Categories By:"
1449
- #~ msgstr "Sorteer rubrieken op:"
1450
-
1451
- #~ msgid "Include Bookmarks:"
1452
- #~ msgstr "Inclusief favorieten:"
1453
-
1454
- #~ msgid "Exclude Bookmarks:"
1455
- #~ msgstr "Exclusief favorieten:"
1456
-
1457
- #~ msgid "Bookmarks Order:"
1458
- #~ msgstr "Favorieten volgorde:"
1459
-
1460
- #~ msgid "Order Bookmarks By:"
1461
- #~ msgstr "Sorteer favorieten op:"
1462
-
1463
- #~ msgid "Between (Bookmark/Description):"
1464
- #~ msgstr "Tussen (Favoriet/beschrijving)"
1465
-
1466
- #~ msgid "Categorize?"
1467
- #~ msgstr "Rubriceer?"
1468
-
1469
- #~ msgid "Show description?"
1470
- #~ msgstr "Beschrijving tonen?"
1471
-
1472
- #~ msgid "Hide invisible bookmarks?"
1473
- #~ msgstr "Onzichtbare favorieten verbergen?"
1474
-
1475
- #~ msgid "Show private categories?"
1476
- #~ msgstr "Private rubrieken tonen?"
1477
-
1478
- #~ msgid "Show rating?"
1479
- #~ msgstr "Waardering tonen?"
1480
-
1481
- #~ msgid "Show images?"
1482
- #~ msgstr "Afbeeldingen tonen?"
1483
-
1484
- #~ msgid ""
1485
- #~ "An advanced widget that gives you total control over the output of your "
1486
- #~ "bookmarks (links)."
1487
- #~ msgstr ""
1488
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1489
- #~ "van je favorieten (links)."
1490
-
1491
- #~ msgid "RSS"
1492
- #~ msgstr "RSS"
1493
-
1494
- #~ msgid "Depth:"
1495
- #~ msgstr "Diepte:"
1496
-
1497
- #~ msgid "Number:"
1498
- #~ msgstr "Aantal:"
1499
-
1500
- #~ msgid "Child Of:"
1501
- #~ msgstr "'Child' van :"
1502
-
1503
- #~ msgid "Hierarchical?"
1504
- #~ msgstr "Hierarchisch?"
1505
-
1506
- #~ msgid "Show RSS feed?"
1507
- #~ msgstr "Toon RSS feed?"
1508
-
1509
- #~ msgid "Use description for title?"
1510
- #~ msgstr "Omschrijving gebruiken voor de titel?"
1511
-
1512
- #~ msgid "Show last updated?"
1513
- #~ msgstr "Toon laatste aanpassing?"
1514
-
1515
- #~ msgid "Show count?"
1516
- #~ msgstr "Toon aantal?"
1517
-
1518
- #~ msgid "Hide empty?"
1519
- #~ msgstr "Lege verbergen?"
1520
-
1521
- #~ msgid ""
1522
- #~ "An advanced widget that gives you total control over the output of your "
1523
- #~ "category links."
1524
- #~ msgstr ""
1525
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1526
- #~ "van je rubrieken."
1527
-
1528
- #~ msgid "Categories"
1529
- #~ msgstr "Rubrieken"
1530
-
1531
- #~ msgid "Sort Order:"
1532
- #~ msgstr "Sorteervolgorde"
1533
-
1534
- #~ msgid "Meta Key:"
1535
- #~ msgstr "Meta Key:"
1536
-
1537
- #~ msgid "Meta Value:"
1538
- #~ msgstr "Meta Value:"
1539
-
1540
- #~ msgid "Show home?"
1541
- #~ msgstr "Toon home?"
1542
-
1543
- #~ msgid "Show date?"
1544
- #~ msgstr "Toon datum?"
1545
-
1546
- #~ msgid "Search Text:"
1547
- #~ msgstr "Zoek tekst:"
1548
-
1549
- #~ msgid "Use theme's search form?"
1550
- #~ msgstr "Zoekformulier van thema gebruiken?"
1551
-
1552
- #~ msgid ""
1553
- #~ "An advanced widget that gives you total control over the output of your "
1554
- #~ "search form."
1555
- #~ msgstr ""
1556
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1557
- #~ "van je zoekformulier."
1558
-
1559
- #~ msgid "Largest:"
1560
- #~ msgstr "Grootste:"
1561
-
1562
- #~ msgid "Smallest:"
1563
- #~ msgstr "Kleinste:"
1564
-
1565
- #~ msgid "Unit:"
1566
- #~ msgstr "Eenheid:"
1567
-
1568
- #~ msgid ""
1569
- #~ "An advanced widget that gives you total control over the output of your "
1570
- #~ "tags."
1571
- #~ msgstr ""
1572
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1573
- #~ "van je tags."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/members.pot CHANGED
@@ -1,1573 +1,830 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Members WordPress Plugin\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-06-03 12:36-0600\n"
6
- "PO-Revision-Date: 2011-06-03 12:38-0600\n"
7
- "Last-Translator: Justin Tadlock <justin@justintadlock.com>\n"
8
- "Language-Team: <justin@justintadlock.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-Language: English\n"
13
- "X-Poedit-Country: UNITED STATES\n"
14
- "X-Poedit-KeywordsList: _e;__;esc_attr__;esc_attr_e;_n;_x;esc_html__;esc_html_e\n"
15
- "X-Poedit-Basepath: ../\n"
16
- "X-Poedit-SearchPath-0: .\n"
17
-
18
- #: members.php:191
19
- #: admin/meta-box-plugin-settings.php:30
20
- #, fuzzy
21
- msgid "Role Manager"
22
- msgstr "Naam"
23
-
24
- #: admin/admin.php:44
25
- #: admin/roles-list-table.php:57
26
- #, fuzzy
27
- msgid "Roles"
28
- msgstr "Reset"
29
-
30
- #: admin/admin.php:47
31
- #: admin/role-new.php:44
32
- #, fuzzy
33
- msgid "Add New Role"
34
- msgstr "Voeg gebruiker toe"
35
-
36
- #: admin/admin.php:135
37
- msgid "<strong>Role Manager:</strong> This feature allows you to manage roles on your site by giving you the ability to create, edit, and delete any role. Note that changes to roles do not change settings for the Members plugin. You are literally changing data in your WordPress database. This plugin feature merely provides an interface for you to make these changes."
38
- msgstr ""
39
-
40
- #: admin/admin.php:136
41
- msgid "<strong>Content Permissions:</strong> This feature adds a meta box to the post edit screen that allows you to grant permissions for who can read the post content based on the user's role. Only users of roles with the <code>restrict_content</code> capability will be able to use this component."
42
- msgstr ""
43
-
44
- #: admin/admin.php:137
45
- msgid "<strong>Sidebar Widgets:</strong> This feature creates additional widgets for use in your theme's sidebars. You can access them by clicking Widgets in the menu."
46
- msgstr ""
47
-
48
- #: admin/admin.php:138
49
- msgid "<strong>Private Site:</strong> This feature allows you to redirect all users who are not logged into the site to the login page, creating an entirely private site. You may also replace your feed content with a custom error message."
50
- msgstr ""
51
-
52
- #: admin/admin.php:140
53
- #: admin/admin.php:167
54
- #: admin/admin.php:183
55
- msgid "For more information:"
56
- msgstr ""
57
-
58
- #: admin/admin.php:143
59
- #: admin/admin.php:171
60
- #: admin/admin.php:187
61
- #, fuzzy
62
- msgid "Documentation"
63
- msgstr "Thema Documentatie"
64
-
65
- #: admin/admin.php:144
66
- #: admin/admin.php:172
67
- #: admin/admin.php:188
68
- #, fuzzy
69
- msgid "Support Forums"
70
- msgstr "Bezoek de support forums."
71
-
72
- #: admin/admin.php:156
73
- msgid "This screen allows you to edit the capabilities given to the role. You can tick the checkbox next to a capability to add the capability to the role. You can untick the checkbox next to a capability to remove a capability from the role. You can also add as many custom capabilities as you need in the Custom Capabilities section."
74
- msgstr ""
75
-
76
- #: admin/admin.php:157
77
- msgid "Capabilities are both powerful and dangerous tools. You should not add or remove a capability to a role unless you understand what permission you are granting or removing."
78
- msgstr ""
79
-
80
- #: admin/admin.php:162
81
- msgid "This screen lists all the user roles available on this site. Roles are given to users as a way to \"group\" them. Roles are made up of capabilities (permissions), which decide what functions users of each role can perform on the site. From this screen, you can manage these roles and their capabilities."
82
- msgstr ""
83
-
84
- #: admin/admin.php:163
85
- msgid "To add a role to a user, click Users in the menu. To create a new role, click the Add New button at the top of the screen or Add New Role under the Users menu."
86
- msgstr ""
87
-
88
- #: admin/admin.php:170
89
- #: admin/admin.php:186
90
- msgid "Users, Roles, and Capabilities"
91
- msgstr ""
92
-
93
- #: admin/admin.php:180
94
- msgid "This screen allows you to create a new user role for your site. You must input a unique role name and role label. You can also grant capabilities (permissions) to the new role. Capabilities are both powerful and dangerous tools. You should not add a capability to a role unless you understand what permission you are granting."
95
- msgstr ""
96
-
97
- #: admin/admin.php:181
98
- msgid "To add a role to a user, click Users in the menu. To edit roles, click Roles under the Users menu."
99
- msgstr ""
100
-
101
- #: admin/admin.php:202
102
- msgid "Role deleted."
103
- msgstr ""
104
-
105
- #: admin/admin.php:211
106
- msgid "Selected roles deleted."
107
- msgstr ""
108
-
109
- #: admin/meta-box-plugin-settings.php:21
110
- msgid "About"
111
- msgstr ""
112
-
113
- #: admin/meta-box-plugin-settings.php:24
114
- msgid "Like this plugin?"
115
- msgstr ""
116
-
117
- #: admin/meta-box-plugin-settings.php:27
118
- #, fuzzy
119
- msgid "Support"
120
- msgstr "Thema Ondersteuning:"
121
-
122
- #: admin/meta-box-plugin-settings.php:33
123
- #: admin/meta-box-post-content-permissions.php:28
124
- msgid "Content Permissions"
125
- msgstr ""
126
-
127
- #: admin/meta-box-plugin-settings.php:36
128
- #, fuzzy
129
- msgid "Sidebar Widgets"
130
- msgstr "Widgets invoegen:"
131
-
132
- #: admin/meta-box-plugin-settings.php:39
133
- #, fuzzy
134
- msgid "Private Site"
135
- msgstr "Primaire EnkelvoudigBericht"
136
-
137
- #: admin/meta-box-plugin-settings.php:52
138
- #, fuzzy
139
- msgid "Version:"
140
- msgstr "Thema versie:"
141
-
142
- #: admin/meta-box-plugin-settings.php:55
143
- #, fuzzy
144
- msgid "Description:"
145
- msgstr "Beschrijving"
146
-
147
- #: admin/meta-box-plugin-settings.php:69
148
- msgid "Here's how you can give back:"
149
- msgstr ""
150
-
151
- #: admin/meta-box-plugin-settings.php:72
152
- msgid "Members on the WordPress plugin repository"
153
- msgstr ""
154
-
155
- #: admin/meta-box-plugin-settings.php:72
156
- msgid "Give the plugin a good rating."
157
- msgstr ""
158
-
159
- #: admin/meta-box-plugin-settings.php:73
160
- msgid "Donate via PayPal"
161
- msgstr ""
162
-
163
- #: admin/meta-box-plugin-settings.php:73
164
- msgid "Donate a few dollars."
165
- msgstr ""
166
-
167
- #: admin/meta-box-plugin-settings.php:74
168
- msgid "Justin Tadlock's Amazon Wish List"
169
- msgstr ""
170
-
171
- #: admin/meta-box-plugin-settings.php:74
172
- msgid "Get me something from my wish list."
173
- msgstr ""
174
-
175
- #: admin/meta-box-plugin-settings.php:86
176
- #, php-format
177
- msgid "Support for this plugin is provided via the support forums at %1$s. If you need any help using it, please ask your support questions there."
178
- msgstr ""
179
-
180
- #: admin/meta-box-plugin-settings.php:86
181
- #, fuzzy
182
- msgid "Theme Hybrid Support Forums"
183
- msgstr "Thema Ondersteuning:"
184
-
185
- #: admin/meta-box-plugin-settings.php:86
186
- #, fuzzy
187
- msgid "Theme Hybrid"
188
- msgstr "Hybrid"
189
-
190
- #: admin/meta-box-plugin-settings.php:99
191
- msgid "Enable the role manager."
192
- msgstr ""
193
-
194
- #: admin/meta-box-plugin-settings.php:102
195
- msgid "Your roles and capabilities will not revert back to their previous settings after deactivating or uninstalling this plugin, so use this feature wisely."
196
- msgstr ""
197
-
198
- #: admin/meta-box-plugin-settings.php:116
199
- msgid "Enable the content permissions feature."
200
- msgstr ""
201
-
202
- #: admin/meta-box-plugin-settings.php:120
203
- msgid "Default post error message:"
204
- msgstr ""
205
-
206
- #: admin/meta-box-plugin-settings.php:122
207
- msgid "You can use <abbr title=\"Hypertext Markup Language\">HTML</abbr> and/or shortcodes to create a custom error message for users that don't have permission to view posts."
208
- msgstr ""
209
-
210
- #: admin/meta-box-plugin-settings.php:136
211
- msgid "Enable the login form widget."
212
- msgstr ""
213
-
214
- #: admin/meta-box-plugin-settings.php:141
215
- msgid "Enable the users widget."
216
- msgstr ""
217
-
218
- #: admin/meta-box-plugin-settings.php:155
219
- msgid "Redirect all logged-out users to the login page before allowing them to view the site."
220
- msgstr ""
221
-
222
- #: admin/meta-box-plugin-settings.php:160
223
- msgid "Show error message for feed items."
224
- msgstr ""
225
-
226
- #: admin/meta-box-plugin-settings.php:164
227
- #, fuzzy
228
- msgid "Feed error message:"
229
- msgstr "Feed afbeelding:"
230
-
231
- #: admin/meta-box-plugin-settings.php:167
232
- msgid "You can use <abbr title=\"Hypertext Markup Language\">HTML</abbr> and/or shortcodes to create a custom error message to display instead of feed item content."
233
- msgstr ""
234
-
235
- #: admin/meta-box-post-content-permissions.php:51
236
- msgid "Limit access to this post's content to users of the selected roles."
237
- msgstr ""
238
-
239
- #: admin/meta-box-post-content-permissions.php:75
240
- #, php-format
241
- msgid "If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role."
242
- msgstr ""
243
-
244
- #: admin/meta-box-post-content-permissions.php:79
245
- msgid "Custom error messsage:"
246
- msgstr ""
247
-
248
- #: admin/meta-box-post-content-permissions.php:82
249
- msgid "Message shown to users that do no have permission to view the post."
250
- msgstr ""
251
-
252
- #: admin/role-edit.php:67
253
- #, fuzzy
254
- msgid "Edit Role"
255
- msgstr "Bewerk"
256
-
257
- #: admin/role-edit.php:68
258
- #: admin/roles-list-table.php:58
259
- msgid "Add New"
260
- msgstr ""
261
-
262
- #: admin/role-edit.php:71
263
- #, fuzzy
264
- msgid "Role updated."
265
- msgstr "Aanpassingen tonen?"
266
-
267
- #: admin/role-edit.php:71
268
- msgid "&larr; Back to Roles"
269
- msgstr ""
270
-
271
- #: admin/role-edit.php:85
272
- #: admin/role-new.php:60
273
- #: admin/roles-list-table.php:111
274
- #, fuzzy
275
- msgid "Role Name"
276
- msgstr "Naam"
277
-
278
- #: admin/role-edit.php:94
279
- #: admin/roles-list-table.php:113
280
- #: admin/roles-list-table.php:123
281
- msgid "Capabilities"
282
- msgstr ""
283
-
284
- #: admin/role-edit.php:112
285
- msgid "Custom Capabilities"
286
- msgstr ""
287
-
288
- #: admin/role-edit.php:117
289
- msgid "Add New Capability"
290
- msgstr ""
291
-
292
- #: admin/role-edit.php:127
293
- #, fuzzy
294
- msgid "Update Role"
295
- msgstr "Bewerk"
296
-
297
- #: admin/role-new.php:46
298
- #, fuzzy, php-format
299
- msgid "The %s role has been created."
300
- msgstr "Er is een gebruikersaccount aangemaakt voor %1$s."
301
-
302
- #: admin/role-new.php:65
303
- msgid "<strong>Required:</strong> The role name should be unique and contain only alphanumeric characters and underscores."
304
- msgstr ""
305
-
306
- #: admin/role-new.php:71
307
- #: admin/roles-list-table.php:110
308
- #: admin/roles-list-table.php:120
309
- #, fuzzy
310
- msgid "Role Label"
311
- msgstr "Zoek label:"
312
-
313
- #: admin/role-new.php:76
314
- msgid "<strong>Required:</strong> The role label is used to represent your role in the WordPress admin."
315
- msgstr ""
316
-
317
- #: admin/role-new.php:82
318
- #, fuzzy
319
- msgid "Role Capabilities"
320
- msgstr "Aanpassingen tonen?"
321
-
322
- #: admin/role-new.php:86
323
- msgid "<strong>Optional:</strong> Select the capabilities this role should have. These may be updated later."
324
- msgstr ""
325
-
326
- #: admin/role-new.php:102
327
- #, fuzzy
328
- msgid "Add Role"
329
- msgstr "Bewerk"
330
-
331
- #: admin/roles-list-table.php:70
332
- msgid "All"
333
- msgstr ""
334
-
335
- #: admin/roles-list-table.php:71
336
- #, fuzzy
337
- msgid "Has Users"
338
- msgstr "Gebruikersnaam"
339
-
340
- #: admin/roles-list-table.php:72
341
- #, fuzzy
342
- msgid "No Users"
343
- msgstr "Gebruikersnaam"
344
-
345
- #: admin/roles-list-table.php:83
346
- #: admin/roles-list-table.php:215
347
- msgid "Bulk Actions"
348
- msgstr ""
349
-
350
- #: admin/roles-list-table.php:86
351
- #: admin/roles-list-table.php:158
352
- #: admin/roles-list-table.php:218
353
- msgid "Delete"
354
- msgstr ""
355
-
356
- #: admin/roles-list-table.php:91
357
- #: admin/roles-list-table.php:223
358
- #, fuzzy
359
- msgid "Apply"
360
- msgstr "Reageer"
361
-
362
- #: admin/roles-list-table.php:98
363
- #: admin/roles-list-table.php:230
364
- #, php-format
365
- msgid "%s item"
366
- msgstr ""
367
-
368
- #: admin/roles-list-table.php:112
369
- #: admin/roles-list-table.php:122
370
- #, fuzzy
371
- msgid "Users"
372
- msgstr "Gebruikersnaam"
373
-
374
- #: admin/roles-list-table.php:121
375
- #: includes/admin-bar.php:29
376
- msgid "Role"
377
- msgstr ""
378
-
379
- #: admin/roles-list-table.php:146
380
- #: admin/roles-list-table.php:154
381
- #, fuzzy, php-format
382
- msgid "Edit the %s role"
383
- msgstr "Bewerk"
384
-
385
- #: admin/roles-list-table.php:154
386
- msgid "Edit"
387
- msgstr "Bewerk"
388
-
389
- #: admin/roles-list-table.php:158
390
- #, php-format
391
- msgid "Delete the %s role"
392
- msgstr ""
393
-
394
- #: admin/roles-list-table.php:162
395
- msgid "Change default role"
396
- msgstr ""
397
-
398
- #: admin/roles-list-table.php:162
399
- msgid "Default Role"
400
- msgstr ""
401
-
402
- #: admin/roles-list-table.php:166
403
- #: admin/roles-list-table.php:182
404
- #, php-format
405
- msgid "View all users with the %s role"
406
- msgstr ""
407
-
408
- #: admin/roles-list-table.php:166
409
- msgid "View Users"
410
- msgstr ""
411
-
412
- #: admin/roles-list-table.php:182
413
- #: admin/roles-list-table.php:184
414
- #, fuzzy, php-format
415
- msgid "%s User"
416
- msgstr "Voeg gebruiker toe"
417
-
418
- #: admin/roles-list-table.php:194
419
- #, php-format
420
- msgid "%s Capability"
421
- msgstr ""
422
-
423
- #: admin/settings.php:28
424
- #, fuzzy
425
- msgid "Members Settings"
426
- msgstr "Hybrid Settings"
427
-
428
- #: admin/settings.php:28
429
- #, fuzzy
430
- msgid "Members"
431
- msgstr "Hybrid Settings"
432
-
433
- #: admin/settings.php:66
434
- msgid "Sorry, but you do not have permission to view this content."
435
- msgstr ""
436
-
437
- #: admin/settings.php:67
438
- msgid "You must be logged into the site to view this content."
439
- msgstr ""
440
-
441
- #: admin/settings.php:145
442
- #, fuzzy
443
- msgid "Members Plugin Settings"
444
- msgstr "Hybrid Settings"
445
-
446
- #: admin/settings.php:160
447
- #, fuzzy
448
- msgid "Update Settings"
449
- msgstr "Footer Settings:"
450
-
451
- #: includes/widget-login-form.php:26
452
- msgid "A widget that allows users to log into your site."
453
- msgstr ""
454
-
455
- #: includes/widget-login-form.php:37
456
- #, fuzzy
457
- msgid "Login Form"
458
- msgstr "Aanmelden"
459
-
460
- #: includes/widget-login-form.php:158
461
- #: includes/widget-login-form.php:161
462
- #, fuzzy
463
- msgid "Log In"
464
- msgstr "Aanmelden"
465
-
466
- #: includes/widget-login-form.php:159
467
- #, fuzzy
468
- msgid "Username"
469
- msgstr "Gebruikersnaam"
470
-
471
- #: includes/widget-login-form.php:160
472
- msgid "Password"
473
- msgstr "Wachtwoord"
474
-
475
- #: includes/widget-login-form.php:162
476
- #, fuzzy
477
- msgid "Remember Me"
478
- msgstr "Herinner deze gegevens."
479
-
480
- #: includes/widget-login-form.php:172
481
- msgid "Please log into the site."
482
- msgstr ""
483
-
484
- #: includes/widget-login-form.php:173
485
- msgid "You are currently logged in."
486
- msgstr ""
487
-
488
- #: includes/widget-login-form.php:185
489
- #: includes/widget-users.php:157
490
- msgid "Title:"
491
- msgstr "Titel"
492
-
493
- #: includes/widget-login-form.php:235
494
- #, fuzzy
495
- msgid "\"Remember me\" checkbox?"
496
- msgstr "Herinner deze gegevens."
497
-
498
- #: includes/widget-login-form.php:239
499
- #, fuzzy
500
- msgid "Check \"remember me\"?"
501
- msgstr "Herinner deze gegevens."
502
-
503
- #: includes/widget-login-form.php:243
504
- msgid "Display avatar?"
505
- msgstr ""
506
-
507
- #: includes/widget-login-form.php:246
508
- msgid "Logged out text:"
509
- msgstr ""
510
-
511
- #: includes/widget-login-form.php:251
512
- msgid "Logged in text:"
513
- msgstr ""
514
-
515
- #: includes/widget-users.php:26
516
- msgid "Provides the ability to list the users of the site."
517
- msgstr ""
518
-
519
- #: includes/widget-users.php:145
520
- msgid "Ascending"
521
- msgstr ""
522
-
523
- #: includes/widget-users.php:145
524
- msgid "Descending"
525
- msgstr ""
526
-
527
- #: includes/widget-users.php:146
528
- #, fuzzy
529
- msgid "Display Name"
530
- msgstr "Voornaam"
531
-
532
- #: includes/widget-users.php:146
533
- msgid "Email"
534
- msgstr "Email"
535
-
536
- #: includes/widget-users.php:146
537
- msgid "ID"
538
- msgstr ""
539
-
540
- #: includes/widget-users.php:146
541
- #, fuzzy
542
- msgid "Nice Name"
543
- msgstr "Naam"
544
-
545
- #: includes/widget-users.php:146
546
- #, fuzzy
547
- msgid "Post Count"
548
- msgstr "Niet gevonden"
549
-
550
- #: includes/widget-users.php:146
551
- #, fuzzy
552
- msgid "Registered"
553
- msgstr "Registreer"
554
-
555
- #: includes/widget-users.php:146
556
- msgid "URL"
557
- msgstr ""
558
-
559
- #: includes/widget-users.php:146
560
- #, fuzzy
561
- msgid "Login"
562
- msgstr "Aanmelden"
563
-
564
- #, fuzzy
565
- #~ msgid "Welcome, %1$s!"
566
- #~ msgstr "Week %1$s"
567
-
568
- #, fuzzy
569
- #~ msgid "Password:"
570
- #~ msgstr "Wachtwoord"
571
-
572
- #, fuzzy
573
- #~ msgid "Select Components"
574
- #~ msgstr "Selecteer maand"
575
-
576
- #, fuzzy
577
- #~ msgid "Component"
578
- #~ msgstr "Reactie"
579
-
580
- #, fuzzy
581
- #~ msgid "Activate"
582
- #~ msgstr "Archieven"
583
-
584
- #, fuzzy
585
- #~ msgid "Active"
586
- #~ msgstr "Archieven"
587
-
588
- #, fuzzy
589
- #~ msgid "Inactive"
590
- #~ msgstr "Archieven"
591
-
592
- #, fuzzy
593
- #~ msgid "Username Label:"
594
- #~ msgstr "Gebruikersnaam*"
595
-
596
- #, fuzzy
597
- #~ msgid "Password Label:"
598
- #~ msgstr "Wachtwoord*"
599
-
600
- #~ msgid "Submit Text:"
601
- #~ msgstr "Verstuur tekst:"
602
-
603
- #, fuzzy
604
- #~ msgid "Remember User Text:"
605
- #~ msgstr "Herinner deze gegevens."
606
-
607
- #, fuzzy
608
- #~ msgid ""
609
- #~ "An advanced widget that gives you total control over the output of your "
610
- #~ "user lists."
611
- #~ msgstr ""
612
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
613
- #~ "van je pagina-links."
614
-
615
- #~ msgid "Limit:"
616
- #~ msgstr "Limiet:"
617
-
618
- #~ msgid "Order:"
619
- #~ msgstr "Volgorde:"
620
-
621
- #~ msgid "Order By:"
622
- #~ msgstr "Sorteer op:"
623
-
624
- #~ msgid "Include:"
625
- #~ msgstr "Omvat:"
626
-
627
- #~ msgid "Exclude:"
628
- #~ msgstr "Sluit uit:"
629
-
630
- #, fuzzy
631
- #~ msgid "Show full name?"
632
- #~ msgstr "Aanpassingen tonen?"
633
-
634
- #~ msgid "Save Changes"
635
- #~ msgstr "Bewaren"
636
-
637
- #, fuzzy
638
- #~ msgid "New user role has been added."
639
- #~ msgstr "Er is een gebruikersaccount aangemaakt voor %1$s."
640
-
641
- #~ msgid ""
642
- #~ "You tried going to %1$s, and it doesn't exist. All is not lost! You can "
643
- #~ "search for what you're looking for."
644
- #~ msgstr ""
645
- #~ "Je wilde naar %1$s gaan, maar dit bestaat niet. Geen nood! Zoek hier "
646
- #~ "wat je zocht:"
647
-
648
- #~ msgid "Possibly Related"
649
- #~ msgstr "Mogelijk gerelateerd"
650
-
651
- #~ msgid "Continue reading"
652
- #~ msgstr "Lees hier verder"
653
-
654
- #~ msgid "Download &quot;%1$s&quot;"
655
- #~ msgstr "Download &quot;%1$s&quot;"
656
-
657
- #~ msgid "Pages:"
658
- #~ msgstr "Pagina's:"
659
-
660
- #~ msgid "Sorry, no applications matched your criteria."
661
- #~ msgstr "Sorry, er zijn geen toepassingen die met je criteria overeenkomen."
662
-
663
- #~ msgid "You are browsing the archive for %1$s."
664
- #~ msgstr "Je bladert nu door het archief voor %1$s."
665
-
666
- #~ msgid "By"
667
- #~ msgstr "Door"
668
-
669
- #~ msgid "on"
670
- #~ msgstr "op"
671
-
672
- #~ msgid "l, F jS, Y, g:i a"
673
- #~ msgstr "l, j F, Y, G:i"
674
-
675
- #~ msgid "F j, Y"
676
- #~ msgstr "j F, Y"
677
-
678
- #~ msgid "Posted in"
679
- #~ msgstr "Gepost in"
680
-
681
- #~ msgid "Tagged"
682
- #~ msgstr "Tags:"
683
-
684
- #~ msgid "Leave a response"
685
- #~ msgstr "Reageer"
686
-
687
- #~ msgid "1 Response"
688
- #~ msgstr "1 Reactie"
689
-
690
- #~ msgid "% Responses"
691
- #~ msgstr "% Reacties"
692
-
693
- #~ msgid "Sorry, there are no posts in this archive."
694
- #~ msgstr "Sorry, dit archief bevat geen berichten."
695
-
696
- #~ msgid "Archives by category"
697
- #~ msgstr "Archieven per rubriek"
698
-
699
- #~ msgid "Archives by month"
700
- #~ msgstr "Archieven per maand"
701
-
702
- #~ msgid "Sorry, no page matched your criteria."
703
- #~ msgstr "Sorry, er bestaat geen pagina die aan je criteria voldoet."
704
-
705
- #~ msgid "Sorry, no attachments matched your criteria."
706
- #~ msgstr "Sorry, er zijn geen bijlages die aan je criteria voldoen."
707
-
708
- #~ msgid "Sorry, no audio files matched your criteria."
709
- #~ msgstr "Sorry, er zijn geen geluidsbestanden die aan je criteria voldoen."
710
-
711
- #~ msgid "Send an email to %1$s"
712
- #~ msgstr "Stuur een email aan %1$s"
713
-
714
- #~ msgid "Email %1$s"
715
- #~ msgstr "Email %1$s"
716
-
717
- #~ msgid "%1$s hasn't written any posts yet."
718
- #~ msgstr "%1$s heeft nog geen berichten geschreven."
719
-
720
- #~ msgid "Nickname:"
721
- #~ msgstr "Bijnaam:"
722
-
723
- #~ msgid "Email:"
724
- #~ msgstr "Email:"
725
-
726
- #~ msgid "Website:"
727
- #~ msgstr "Website:"
728
-
729
- #~ msgid "AIM:"
730
- #~ msgstr "AIM:"
731
-
732
- #~ msgid "IM with %1$s"
733
- #~ msgstr "IM met %1$s"
734
-
735
- #~ msgid "Jabber:"
736
- #~ msgstr "Jabber:"
737
-
738
- #~ msgid "Yahoo:"
739
- #~ msgstr "Yahoo:"
740
-
741
- #~ msgid "Sorry, there are no posts in the %1$s category."
742
- #~ msgstr "Sorry, er zijn geen berichten in de rubriek %1$s. "
743
-
744
- #~ msgid "Please do not load this page directly. Thanks!"
745
- #~ msgstr "Gelieve deze pagina niet rechtstreeks te laden. Dankjewel!"
746
-
747
- #~ msgid "No Responses"
748
- #~ msgstr "Geen reacties"
749
-
750
- #~ msgid "One Response"
751
- #~ msgstr "Een reactie"
752
-
753
- #~ msgid "Responses"
754
- #~ msgstr "Reacties"
755
-
756
- #~ msgid "to"
757
- #~ msgstr "naar"
758
-
759
- #~ msgid "%1$s at %2$s"
760
- #~ msgstr "%1$s op %2$s"
761
-
762
- #~ msgid "Permalink to comment"
763
- #~ msgstr "Permalink naar reactie"
764
-
765
- #~ msgid "Permalink"
766
- #~ msgstr "Permalink"
767
-
768
- #~ msgid "Your comment is awaiting moderation."
769
- #~ msgstr "Je reactie wacht op moderatie."
770
-
771
- #~ msgid ""
772
- #~ "Comments are closed, but <a href=\"%1$s\" title=\"Trackback URL for this "
773
- #~ "post\">trackbacks</a> and pingbacks are open."
774
- #~ msgstr ""
775
- #~ "Reageren is niet mogelijk, maar <a href=\"%1$s\" title=\"Trackback URL "
776
- #~ "for this post\">trackbacks</a> en pingbacks blijven open."
777
-
778
- #~ msgid "Comments are closed."
779
- #~ msgstr "Reageren is niet mogelijk."
780
-
781
- #~ msgid "Leave a Reply"
782
- #~ msgstr "Reageer"
783
-
784
- #~ msgid ""
785
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> to post a "
786
- #~ "comment."
787
- #~ msgstr ""
788
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn om te "
789
- #~ "reageren."
790
-
791
- #~ msgid "Logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
792
- #~ msgstr "Ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
793
-
794
- #~ msgid "Log out of this account"
795
- #~ msgstr "Afmelden."
796
-
797
- #~ msgid "Logout &raquo;"
798
- #~ msgstr "Afmelden &raquo;"
799
-
800
- #~ msgid "*"
801
- #~ msgstr "*"
802
-
803
- #~ msgid "Website"
804
- #~ msgstr "Website"
805
-
806
- #~ msgid "Submit"
807
- #~ msgstr "Verstuur"
808
-
809
- #~ msgid "Password Protected"
810
- #~ msgstr "Beveiligd met wachtwoord"
811
-
812
- #~ msgid "Enter the password to view comments."
813
- #~ msgstr "Voer wachtwoord in om reacties te lezen."
814
-
815
- #~ msgid "Leave a Reply to %s"
816
- #~ msgstr "Reageer op %s"
817
-
818
- #~ msgid "Click here to cancel reply."
819
- #~ msgstr "Klik hier om de reactie te annuleren."
820
-
821
- #~ msgid "F jS, Y"
822
- #~ msgstr "j F, Y"
823
-
824
- #~ msgid "Week %1$s of %2$s"
825
- #~ msgstr "Week %1$s van %2$s"
826
-
827
- #~ msgid "W"
828
- #~ msgstr "W"
829
-
830
- #~ msgid "Y"
831
- #~ msgstr "Y"
832
-
833
- #~ msgid "You are browsing the archive for week %1$s of %2$s."
834
- #~ msgstr "Je bekijkt het archief voor week %1$s van %2$s."
835
-
836
- #~ msgid "Sorry, there are no posts for %1$s."
837
- #~ msgstr "Sorry, maar er zijn geen berichten voor %1$s."
838
-
839
- #~ msgid "Sorry, no posts matched your criteria."
840
- #~ msgstr "Sorry, er zijn geen berichten die met je criteria overeenkomen."
841
-
842
- #~ msgid "Sorry, no images matched your criteria."
843
- #~ msgstr "Sorry, er zijn geen afbeeldingen die met je criteria overeenkomen."
844
-
845
- #~ msgid ""
846
- #~ "You are currently logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
847
- #~ msgstr ""
848
- #~ "Je bent momenteel ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
849
-
850
- #~ msgid ""
851
- #~ "You have successfully logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</"
852
- #~ "a>."
853
- #~ msgstr ""
854
- #~ "Je bent succesvol ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>."
855
-
856
- #~ msgid ""
857
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> to view the "
858
- #~ "content of this page."
859
- #~ msgstr ""
860
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn om de inhoud "
861
- #~ "van deze pagina te bekijken."
862
-
863
- #~ msgid ""
864
- #~ "If you're not currently a member, please take a moment to <a href=\"%1$s"
865
- #~ "\" title=\"Register\">register</a>."
866
- #~ msgstr ""
867
- #~ "Als je momenteel nog geen lid bent, neem dan een ogenblikje tijd om je te "
868
- #~ "<a href=\"%1$s\" title=\"Register\">registreren</a>."
869
-
870
- #~ msgid "You must enter a post title."
871
- #~ msgstr "Je moet een titel voor het bericht invoeren."
872
-
873
- #~ msgid "You must write something."
874
- #~ msgstr "Je moet hier iets schrijven."
875
-
876
- #~ msgid "Title"
877
- #~ msgstr "Titel"
878
-
879
- #~ msgid "Write"
880
- #~ msgstr "Schrijf"
881
-
882
- #~ msgid "Tags"
883
- #~ msgstr "Tags"
884
-
885
- #~ msgid "Publish"
886
- #~ msgstr "Publiceer"
887
-
888
- #~ msgid "You don't have the appropriate capabilities to publish posts."
889
- #~ msgstr "Je hebt niet de nodige rechten om berichten te publiceren."
890
-
891
- #~ msgid ""
892
- #~ "You must be <a href=\"%1$s\" title=\"Log in\">logged in</a> with "
893
- #~ "appropriate user capabilities to publish posts."
894
- #~ msgstr ""
895
- #~ "Je moet <a href=\"%1$s\" title=\"Log in\">ingelogd</a> zijn met de nodige "
896
- #~ "gebruikersrechten om berichten te kunnen publiceren."
897
-
898
- #~ msgid "A username is required for registration."
899
- #~ msgstr "Om te registreren is een gebruikersnaam nodig."
900
-
901
- #~ msgid "You must enter an email address."
902
- #~ msgstr "Je moet een email-adres invoeren."
903
-
904
- #~ msgid "You must enter a password."
905
- #~ msgstr "Je moet een wachtwoord invoeren."
906
-
907
- #~ msgid "You must enter your password twice."
908
- #~ msgstr "Je moet je wachtwoord tweemaal invoeren."
909
-
910
- #~ msgid "You must enter the same password twice."
911
- #~ msgstr "Je moet tweemaal hetzelfde wachtwoord invoeren."
912
-
913
- #~ msgid "User registration failed. Please try again."
914
- #~ msgstr "Gebruikersregistratie mislukt. Probeer opnieuw."
915
-
916
- #~ msgid ""
917
- #~ "You are logged in as <a href=\"%1$s\" title=\"%2$s\">%2$s</a>. You don't "
918
- #~ "need another account."
919
- #~ msgstr ""
920
- #~ "Je bent ingelogd als <a href=\"%1$s\" title=\"%2$s\">%2$s</a>. Je hebt "
921
- #~ "geen bijkomend account nodig."
922
-
923
- #~ msgid "Thank you for registering, %1$s."
924
- #~ msgstr "Bedankt voor je registratie, %1$s."
925
-
926
- #~ msgid "Users can register themselves or you can manually create users here."
927
- #~ msgstr ""
928
- #~ "Gebruikers kunnen zichzelf registreren of je kan hier handmatig "
929
- #~ "gebruikersaccounts aanmaken."
930
-
931
- #~ msgid ""
932
- #~ "Users cannot currently register themselves, but you can manually create "
933
- #~ "users here."
934
- #~ msgstr ""
935
- #~ "Gebruikers kunnen zichzelf niet registreren, maar je kan hier wel "
936
- #~ "handmatig gebruikersaccounts aanmaken."
937
-
938
- #~ msgid "Required fields are marked <span class=\"required\">*</span>"
939
- #~ msgstr ""
940
- #~ "Verplichte velden zijn aangeduid met <span class=\"required\">*</span>."
941
-
942
- #~ msgid "Last Name"
943
- #~ msgstr "Naam"
944
-
945
- #~ msgid "E-mail *"
946
- #~ msgstr "E-mail *"
947
-
948
- #~ msgid "Repeat Password *"
949
- #~ msgstr "Herhaal je wachtwoord*"
950
-
951
- #~ msgid "Biographical Information"
952
- #~ msgstr "Biografische informatie"
953
-
954
- #~ msgid "You are browsing the search results for &quot;%1$s&quot;"
955
- #~ msgstr "Je bekijkt hier de zoekresultaten voor &quot;%1$s&quot;"
956
-
957
- #~ msgid "Maybe you'd like to try inputting different search terms."
958
- #~ msgstr "Misschien wil je andere zoektermen invoeren."
959
-
960
- #~ msgid "You are browsing the %1$s tag archive."
961
- #~ msgstr "Je bekijkt het archief voor de tag %1$s"
962
-
963
- #~ msgid "Sorry, there are no posts tagged %1$s."
964
- #~ msgstr "Sorry, er zijn geen berichten met de tag %1$s."
965
-
966
- #~ msgid "Sorry, no documents matched your criteria."
967
- #~ msgstr "Sorry, er zijn geen documenten die met je criteria overeenkomen."
968
-
969
- #~ msgid "Sorry, no videos matched your criteria."
970
- #~ msgstr "Sorry, er zijn geen video's die met je criteria overeenkomen."
971
-
972
- #~ msgid "Widget Template"
973
- #~ msgstr "Widget Template"
974
-
975
- #~ msgid "About This Theme"
976
- #~ msgstr "Over dit Thema"
977
-
978
- #~ msgid "Theme Description:"
979
- #~ msgstr "Thema Beschrijving:"
980
-
981
- #~ msgid "Theme Documentation:"
982
- #~ msgstr "Thema Documentatie:"
983
-
984
- #~ msgid "Get support for this theme"
985
- #~ msgstr "Ondersteuning voor dit thema"
986
-
987
- #~ msgid "Select your theme settings"
988
- #~ msgstr "Selecteer de settings voor je thema"
989
-
990
- #, fuzzy
991
- #~ msgid ""
992
- #~ "Select this if you want your primary widget inserts to default to the "
993
- #~ "home insert when nothing else is selected."
994
- #~ msgstr ""
995
- #~ "Selecteer dit als je wenst dat je primaire widgets standaard geladen "
996
- #~ "worden op de home-pagina als niet anders geselecteerd is."
997
-
998
- #, fuzzy
999
- #~ msgid ""
1000
- #~ "Select this if you want your secondary widget inserts to default to the "
1001
- #~ "home insert when nothing else is selected."
1002
- #~ msgstr ""
1003
- #~ "Selecteer dit als je wenst dat je secundaire widgets standaard geladen "
1004
- #~ "worden op de home-pagina als niet anders geselecteerd is."
1005
-
1006
- #~ msgid "Stylesheets:"
1007
- #~ msgstr "Stijlbladen (CSS)"
1008
-
1009
- #~ msgid ""
1010
- #~ "Select this to have the theme automatically include a print stylesheet."
1011
- #~ msgstr ""
1012
- #~ "Selecteer dit als je wil dat het thema automatisch een 'print' stijlblad "
1013
- #~ "insluit."
1014
-
1015
- #~ msgid "JavaScript:"
1016
- #~ msgstr "JavaScript:"
1017
-
1018
- #~ msgid "Include the pull quote JavaScript."
1019
- #~ msgstr "Inclusief pull quote JavaScript."
1020
-
1021
- #~ msgid "Feeds:"
1022
- #~ msgstr "Feeds:"
1023
-
1024
- #~ msgid ""
1025
- #~ "If you have a an alternate feed address, such as one from <a href="
1026
- #~ "\"http://feedburner.com\" title=\"Feedburner\">Feedburner</a>, you can "
1027
- #~ "enter it here to have the theme set your feed URL link. If blank, the "
1028
- #~ "theme will default to your WordPress RSS feed."
1029
- #~ msgstr ""
1030
- #~ "Wanneer je over een alternatief feed-adres beschikt, zoals van <a href="
1031
- #~ "\"http://feedburner.com\" title=\"Feedburner\">Feedburner</a>, kan je dat "
1032
- #~ "hier invoeren om het door het thema te laten gebruiken. Als je dit "
1033
- #~ "blanco laat, wordt de standaard WordPress RSS feed gebruikt."
1034
-
1035
- #~ msgid "Title &amp; Meta:"
1036
- #~ msgstr "Titel &amp; Meta"
1037
-
1038
- #~ msgid "Use category slugs on single posts for your meta keywords?"
1039
- #~ msgstr ""
1040
- #~ "Gebruik categorie 'slug' als meta keywoord voor afzonderlijke berichten."
1041
-
1042
- #~ msgid "Use tag slugs on single posts for your meta keywords?"
1043
- #~ msgstr "Gebruik tag 'slug' als meta keywoord voor afzonderlijke berichten."
1044
-
1045
- #~ msgid "Use the excerpt on single posts for your meta description?"
1046
- #~ msgstr ""
1047
- #~ "Uittreksel als meta-omschrijving gebruiken voor afzonderlijke berichten?"
1048
-
1049
- #~ msgid "Use the author bio on author archives for your meta description?"
1050
- #~ msgstr ""
1051
- #~ "Auteurs biografie als meta-omschrijving gebruiken voor afzonderlijke "
1052
- #~ "berichten?"
1053
-
1054
- #~ msgid ""
1055
- #~ "Use the category description on category archives for your meta "
1056
- #~ "description?"
1057
- #~ msgstr ""
1058
- #~ "Rubriek-omschrijving als meta-omschrijving gebruiken voor afzonderlijke "
1059
- #~ "berichten?"
1060
-
1061
- #~ msgid "Use the author's name on pages and posts as the meta author?"
1062
- #~ msgstr ""
1063
- #~ "Naam van de auteur als meta-auteur gebruiken op pagina's en berichten?"
1064
-
1065
- #~ msgid "Append site title to the end of the page name?"
1066
- #~ msgstr "Site-naam toevoegen aan het eind van de pagina-naam?"
1067
-
1068
- #~ msgid ""
1069
- #~ "You can change these settings in the box labeled <em>Hybrid Settings</em> "
1070
- #~ "when writing a post or page."
1071
- #~ msgstr ""
1072
- #~ "Je kan deze settings aanpassen in het vak <em>Hybrid Settings</em> "
1073
- #~ "wanneer je een bericht of pagina bewerkt."
1074
-
1075
- #~ msgid ""
1076
- #~ "The <a href=\"%1$s\" title=\"All-In-One SEO Pack\">All-In-One SEO Pack</"
1077
- #~ "a> and <a href=\"%2$s\" title=\"Headspace2\">Headspace2</a> plugins will "
1078
- #~ "override these settings and the Indexing settings."
1079
- #~ msgstr ""
1080
- #~ "De <a href=\"%1$s\" title=\"All-In-One SEO Pack\">All-In-One SEO Pack</a> "
1081
- #~ "en <a href=\"%2$s\" title=\"Headspace2\">Headspace2</a> plugins zullen "
1082
- #~ "deze en de indexeringssettings overschrijven."
1083
-
1084
- #~ msgid "Indexing:"
1085
- #~ msgstr "Indexeren:"
1086
-
1087
- #~ msgid ""
1088
- #~ "Choose which pages of your blog get indexed by the search engines. Only "
1089
- #~ "selected pages will be indexed. If not selected, those pages will be "
1090
- #~ "blocked."
1091
- #~ msgstr ""
1092
- #~ "Kies welke pagina's van je blog door zoekmachines kunnen ge&iuml;ndexeerd "
1093
- #~ "worden. Alleen de geselecteerde pagina's worden ge&iuml;ndexeerd. Niet "
1094
- #~ "geselecteerde pagina's worden geblokkeerd."
1095
-
1096
- #~ msgid ""
1097
- #~ "Note: Some of these settings will render the Title &amp; Meta settings "
1098
- #~ "moot. Also, setting your site to privacy mode will override these "
1099
- #~ "controls."
1100
- #~ msgstr ""
1101
- #~ "Let op: Sommige van deze settings kunnen conflicteren met de Titel &amp; "
1102
- #~ "Meta settings. Ook wanneer je je site in een beveiligde modus omzet, "
1103
- #~ "worden deze settings overschreven."
1104
-
1105
- #~ msgid "Home page"
1106
- #~ msgstr "Homepage"
1107
-
1108
- #~ msgid "Single posts"
1109
- #~ msgstr "Afzonderlijke berichten"
1110
-
1111
- #~ msgid "Attachments"
1112
- #~ msgstr "Bijlages"
1113
-
1114
- #~ msgid "Pages"
1115
- #~ msgstr "Pagina's"
1116
-
1117
- #~ msgid "Date-based archives"
1118
- #~ msgstr "Datum-gebaseerd archief"
1119
-
1120
- #~ msgid "Category archives"
1121
- #~ msgstr "Archief per rubriek"
1122
-
1123
- #~ msgid "Tag archives"
1124
- #~ msgstr "Archief op tags"
1125
-
1126
- #~ msgid "Author archives"
1127
- #~ msgstr "Archief op auteur"
1128
-
1129
- #~ msgid "Search"
1130
- #~ msgstr "Zoek"
1131
-
1132
- #~ msgid "404"
1133
- #~ msgstr "404"
1134
-
1135
- #~ msgid "Avatars:"
1136
- #~ msgstr "Avatars:"
1137
-
1138
- #~ msgid ""
1139
- #~ "You can set a default avatar for users without one if you don't like the "
1140
- #~ "choices WordPress offers you. Simply add the full path to the image file."
1141
- #~ msgstr ""
1142
- #~ "Je kan een standaard-avatar instellen voor gebruikers zonder avatar, "
1143
- #~ "wanneer de keuze van WordPress je niet bevalt. Voer daartoe hier het "
1144
- #~ "complete pad naar de afbeelding in."
1145
-
1146
- #~ msgid "Comments:"
1147
- #~ msgstr "Reacties:"
1148
-
1149
- #~ msgid "Check to use the comments popup window instead of regular comments."
1150
- #~ msgstr ""
1151
- #~ "Aanvinken om een popup-scherm voor reacties te gebruiken in plaats van "
1152
- #~ "het gebruikelijke commentaarscherm."
1153
-
1154
- #~ msgid "WP 2.7+ only."
1155
- #~ msgstr "Enkel voor WP 2.7+"
1156
-
1157
- #~ msgid "Footer Insert:"
1158
- #~ msgstr "Inserts voor Footer:"
1159
-
1160
- #~ msgid ""
1161
- #~ "You can place XHTML and JavaScript here to have it inserted automatically "
1162
- #~ "into your theme. If you have a script, such as one from Google "
1163
- #~ "Analytics, this could be useful."
1164
- #~ msgstr ""
1165
- #~ "Je kan hier XHTML en Javascript plaatsen dat automatisch in de footer van "
1166
- #~ "je thema wordt ingevoerd. Dit kan van pas komen als je een script hebt "
1167
- #~ "zoals dat van Google Analytics."
1168
-
1169
- #~ msgid ""
1170
- #~ "Check this if you want the theme to auto-generate your site's copyright "
1171
- #~ "and title in the footer."
1172
- #~ msgstr ""
1173
- #~ "Aanvinken wanneer je wil dat het thema automatisch een copyright voor je "
1174
- #~ "site in de footer invoert."
1175
-
1176
- #~ msgid ""
1177
- #~ "Want to show your love of WordPress? Check this and a link will be added "
1178
- #~ "to your footer back to WordPress.org."
1179
- #~ msgstr ""
1180
- #~ "Wil je laten zien hoezeer je WordPress waardeert? Vink dit aan om "
1181
- #~ "automatisch een link naar WordPress.org aan de footer toe te voegen."
1182
-
1183
- #~ msgid ""
1184
- #~ "Check this to have a link back to Theme Hybrid automatically appended to "
1185
- #~ "your footer. This is totally optional. Really."
1186
- #~ msgstr ""
1187
- #~ "Aanvinken om automatisch een link naar Theme Hybrid aan je footer toe te "
1188
- #~ "voegen. Dit volkomen vrijwillig, echt waar!"
1189
-
1190
- #~ msgid ""
1191
- #~ "For testing purposes, this will append a database query counter and page "
1192
- #~ "load timer to your footer."
1193
- #~ msgstr ""
1194
- #~ "Voor test-doeleinden wordt hiermee een database-query teller en de "
1195
- #~ "laadtijd van de pagina aan je footer toegevoegd."
1196
-
1197
- #~ msgid "Add a title that will be seen by search engines."
1198
- #~ msgstr "Voeg een titel toe die door zoekmachines gezien wordt."
1199
-
1200
- #~ msgid "Add a description that will be seen by search engines."
1201
- #~ msgstr "Voeg een beschrijving toe die door zoekmachines gezien wordt."
1202
-
1203
- #~ msgid "Keywords:"
1204
- #~ msgstr "Trefwoorden:"
1205
-
1206
- #~ msgid "Add keywords that will be seen by search engines."
1207
- #~ msgstr "Voeg trefwoorden toe die door zoekmachines gezien worden."
1208
-
1209
- #~ msgid "Series:"
1210
- #~ msgstr "Series:"
1211
-
1212
- #~ msgid "Post the title of your series of articles here."
1213
- #~ msgstr "Post hier de titel van je artikelseries."
1214
-
1215
- #~ msgid "Thumbnail:"
1216
- #~ msgstr "Thumbnail:"
1217
-
1218
- #~ msgid "Add an image URL here."
1219
- #~ msgstr "Voeg hier de URL van een afbeelding toe."
1220
-
1221
- #~ msgid "Page Navigation:"
1222
- #~ msgstr "Pagina Navigatie:"
1223
-
1224
- #~ msgid "Hybrid Theme Settings"
1225
- #~ msgstr "Hybrid Theme Settings"
1226
-
1227
- #~ msgid "Settings saved."
1228
- #~ msgstr "Settings opgeslagen."
1229
-
1230
- #~ msgid "Browse:"
1231
- #~ msgstr "Blader:"
1232
-
1233
- #~ msgid "Home"
1234
- #~ msgstr "Home"
1235
-
1236
- #~ msgid "Search results for &quot;%1$s&quot"
1237
- #~ msgstr "Zoekresultaten voor &quot;%1$s&quot"
1238
-
1239
- #~ msgid "m"
1240
- #~ msgstr "m"
1241
-
1242
- #~ msgid "F"
1243
- #~ msgstr "F"
1244
-
1245
- #~ msgid "j"
1246
- #~ msgstr "j"
1247
-
1248
- #~ msgid "404 Not Found"
1249
- #~ msgstr "404 Niet Gevonden"
1250
-
1251
- #~ msgid "Log in to reply."
1252
- #~ msgstr "Log in op te reageren."
1253
-
1254
- #~ msgid "This function has been removed or replaced by another function."
1255
- #~ msgstr "Deze functie is verwijderd of vervangen door een andere functie."
1256
-
1257
- #~ msgid ""
1258
- #~ "You can use these <acronym title=\"Extensible Hypertext Markup Language"
1259
- #~ "\">XHTML</acronym> tags&#58;"
1260
- #~ msgstr ""
1261
- #~ "Je kan deze <acronym title=\"Extensible Hypertext Markup Language"
1262
- #~ "\">XHTML</acronym> tags&#58; gebruiken."
1263
-
1264
- #~ msgid "Search this site..."
1265
- #~ msgstr "Doorzoek deze site"
1266
-
1267
- #~ msgid "Copyright"
1268
- #~ msgstr "Copyright"
1269
-
1270
- #~ msgid "Powered by"
1271
- #~ msgstr "Aangedreven door "
1272
-
1273
- #~ msgid ""
1274
- #~ "Powered by WordPress, state-of-the-art semantic personal publishing "
1275
- #~ "platform"
1276
- #~ msgstr ""
1277
- #~ "Aangedreven door WordPress, het state-of-the-art semantische platform "
1278
- #~ "voor iedereen."
1279
-
1280
- #~ msgid "WordPress"
1281
- #~ msgstr "WordPress"
1282
-
1283
- #~ msgid "and"
1284
- #~ msgstr "en"
1285
-
1286
- #~ msgid "Hybrid Theme Framework"
1287
- #~ msgstr "Hybrid Theme Framework"
1288
-
1289
- #~ msgid "Articles in this series"
1290
- #~ msgstr "Artikelen in deze serie"
1291
-
1292
- #~ msgid ""
1293
- #~ "You have encountered an error. This is usually because you've changed "
1294
- #~ "something in the core Hybrid theme files. Try undoing your last edit to "
1295
- #~ "correct this issue. If this doesn't resolve it, head over to the support "
1296
- #~ "forums for help."
1297
- #~ msgstr ""
1298
- #~ "Er is een fout opgetreden. Dit gebeurt gewoonlijk nadat je iets hebt "
1299
- #~ "gewijzigd in de kernbestanden van het Hybrid-thema. Probeer je laatste "
1300
- #~ "wijzigingen ongedaan te maken om dit op te lossen. Als dat niet lukt, "
1301
- #~ "kan je je tot de support forums richten voor hulp."
1302
-
1303
- #~ msgid "This page loaded in %1$s seconds with %2$s database queries."
1304
- #~ msgstr "Deze pagina laadde in %1$s seconden met %2$s database queries."
1305
-
1306
- #~ msgid ": Page %1$s"
1307
- #~ msgstr ":Pagina %1$s"
1308
-
1309
- #~ msgid "Search results for &quot;%1$s.&quot;"
1310
- #~ msgstr "Zoekresultaten voor &quot;%1$s.&quot;"
1311
-
1312
- #~ msgid "Archive for %1$s"
1313
- #~ msgstr "Archief voor %1$s"
1314
-
1315
- #~ msgid "Archive for week %1$s of %2$s"
1316
- #~ msgstr "Archief voor week %1$s van %2$s"
1317
-
1318
- #~ msgid "Comment on &quot;%1$s&quot;"
1319
- #~ msgstr "Reactie op &quot;%1$s&quot;"
1320
-
1321
- #~ msgid "Primary Home"
1322
- #~ msgstr "Primair Home"
1323
-
1324
- #~ msgid "Primary Author"
1325
- #~ msgstr "Primaire Auteur"
1326
-
1327
- #~ msgid "Primary Category"
1328
- #~ msgstr "Primaire Rubriek"
1329
-
1330
- #~ msgid "Primary Date"
1331
- #~ msgstr "Primaire Datum"
1332
-
1333
- #~ msgid "Primary Page"
1334
- #~ msgstr "Primaire Pagina"
1335
-
1336
- #~ msgid "Primary Search"
1337
- #~ msgstr "Primaire Zoekresultaten"
1338
-
1339
- #~ msgid "Primary Tag"
1340
- #~ msgstr "Primaire Tag"
1341
-
1342
- #~ msgid "Primary 404"
1343
- #~ msgstr "Primaire 404"
1344
-
1345
- #~ msgid "Secondary Home"
1346
- #~ msgstr "Secundaire Home"
1347
-
1348
- #~ msgid "Secondary Author"
1349
- #~ msgstr "Secundaire Auteur"
1350
-
1351
- #~ msgid "Secondary Category"
1352
- #~ msgstr "Secundaire Rubriek"
1353
-
1354
- #~ msgid "Secondary Date"
1355
- #~ msgstr "Secundaire Datum "
1356
-
1357
- #~ msgid "Secondary Page"
1358
- #~ msgstr "Secundaire Pagina"
1359
-
1360
- #~ msgid "Secondary Search"
1361
- #~ msgstr "Secundaire Zoekresultaten"
1362
-
1363
- #~ msgid "Secondary Single"
1364
- #~ msgstr "Secundaire EnkelvoudigBericht"
1365
-
1366
- #~ msgid "Secondary Tag"
1367
- #~ msgstr "Secundaire Tag"
1368
-
1369
- #~ msgid "Secondary 404"
1370
- #~ msgstr "Secundaire 404"
1371
-
1372
- #~ msgid "Subsidiary Default"
1373
- #~ msgstr "Bijkomende Standaard"
1374
-
1375
- #~ msgid "RSS 2.0"
1376
- #~ msgstr "RSS 2.0"
1377
-
1378
- #~ msgid "RSS .92"
1379
- #~ msgstr "RSS .92"
1380
-
1381
- #~ msgid "Atom 0.3"
1382
- #~ msgstr "Atom 0.3"
1383
-
1384
- #~ msgid "Subsidiary Home"
1385
- #~ msgstr "Subsidiair Home"
1386
-
1387
- #~ msgid "Previous Page"
1388
- #~ msgstr "Vorige pagina"
1389
-
1390
- #~ msgid "Next Page"
1391
- #~ msgstr "Volgende pagina"
1392
-
1393
- #~ msgid "Related Posts"
1394
- #~ msgstr "Gerelateerde berichten"
1395
-
1396
- #~ msgid "Logout"
1397
- #~ msgstr "Afmelden"
1398
-
1399
- #~ msgid "Select Year"
1400
- #~ msgstr "Selecteer jaar"
1401
-
1402
- #~ msgid "Select Week"
1403
- #~ msgstr "Selecteer week"
1404
-
1405
- #~ msgid "Select Day"
1406
- #~ msgstr "Selecteer dag"
1407
-
1408
- #~ msgid "Select Post"
1409
- #~ msgstr "Selecteer bericht"
1410
-
1411
- #~ msgid "Type:"
1412
- #~ msgstr "Type:"
1413
-
1414
- #~ msgid "Format:"
1415
- #~ msgstr "Format:"
1416
-
1417
- #~ msgid "Before:"
1418
- #~ msgstr "Voor:"
1419
-
1420
- #~ msgid "After:"
1421
- #~ msgstr "Na:"
1422
-
1423
- #~ msgid "Show post count?"
1424
- #~ msgstr "Toon aantal berichten?"
1425
-
1426
- #~ msgid ""
1427
- #~ "An advanced widget that gives you total control over the output of your "
1428
- #~ "archives."
1429
- #~ msgstr ""
1430
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1431
- #~ "van je archieven."
1432
-
1433
- #~ msgid "Bookmarks"
1434
- #~ msgstr "Favorieten"
1435
-
1436
- #~ msgid "Categories:"
1437
- #~ msgstr "Rubrieken:"
1438
-
1439
- #~ msgid "Exclude Categories:"
1440
- #~ msgstr "Uit te sluiten rubrieken:"
1441
-
1442
- #~ msgid "Category:"
1443
- #~ msgstr "Rubriek:"
1444
-
1445
- #~ msgid "Category Order:"
1446
- #~ msgstr "Rubriek volgorde:"
1447
-
1448
- #~ msgid "Order Categories By:"
1449
- #~ msgstr "Sorteer rubrieken op:"
1450
-
1451
- #~ msgid "Include Bookmarks:"
1452
- #~ msgstr "Inclusief favorieten:"
1453
-
1454
- #~ msgid "Exclude Bookmarks:"
1455
- #~ msgstr "Exclusief favorieten:"
1456
-
1457
- #~ msgid "Bookmarks Order:"
1458
- #~ msgstr "Favorieten volgorde:"
1459
-
1460
- #~ msgid "Order Bookmarks By:"
1461
- #~ msgstr "Sorteer favorieten op:"
1462
-
1463
- #~ msgid "Between (Bookmark/Description):"
1464
- #~ msgstr "Tussen (Favoriet/beschrijving)"
1465
-
1466
- #~ msgid "Categorize?"
1467
- #~ msgstr "Rubriceer?"
1468
-
1469
- #~ msgid "Show description?"
1470
- #~ msgstr "Beschrijving tonen?"
1471
-
1472
- #~ msgid "Hide invisible bookmarks?"
1473
- #~ msgstr "Onzichtbare favorieten verbergen?"
1474
-
1475
- #~ msgid "Show private categories?"
1476
- #~ msgstr "Private rubrieken tonen?"
1477
-
1478
- #~ msgid "Show rating?"
1479
- #~ msgstr "Waardering tonen?"
1480
-
1481
- #~ msgid "Show images?"
1482
- #~ msgstr "Afbeeldingen tonen?"
1483
-
1484
- #~ msgid ""
1485
- #~ "An advanced widget that gives you total control over the output of your "
1486
- #~ "bookmarks (links)."
1487
- #~ msgstr ""
1488
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1489
- #~ "van je favorieten (links)."
1490
-
1491
- #~ msgid "RSS"
1492
- #~ msgstr "RSS"
1493
-
1494
- #~ msgid "Depth:"
1495
- #~ msgstr "Diepte:"
1496
-
1497
- #~ msgid "Number:"
1498
- #~ msgstr "Aantal:"
1499
-
1500
- #~ msgid "Child Of:"
1501
- #~ msgstr "'Child' van :"
1502
-
1503
- #~ msgid "Hierarchical?"
1504
- #~ msgstr "Hierarchisch?"
1505
-
1506
- #~ msgid "Show RSS feed?"
1507
- #~ msgstr "Toon RSS feed?"
1508
-
1509
- #~ msgid "Use description for title?"
1510
- #~ msgstr "Omschrijving gebruiken voor de titel?"
1511
-
1512
- #~ msgid "Show last updated?"
1513
- #~ msgstr "Toon laatste aanpassing?"
1514
-
1515
- #~ msgid "Show count?"
1516
- #~ msgstr "Toon aantal?"
1517
-
1518
- #~ msgid "Hide empty?"
1519
- #~ msgstr "Lege verbergen?"
1520
-
1521
- #~ msgid ""
1522
- #~ "An advanced widget that gives you total control over the output of your "
1523
- #~ "category links."
1524
- #~ msgstr ""
1525
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1526
- #~ "van je rubrieken."
1527
-
1528
- #~ msgid "Categories"
1529
- #~ msgstr "Rubrieken"
1530
-
1531
- #~ msgid "Sort Order:"
1532
- #~ msgstr "Sorteervolgorde"
1533
-
1534
- #~ msgid "Meta Key:"
1535
- #~ msgstr "Meta Key:"
1536
-
1537
- #~ msgid "Meta Value:"
1538
- #~ msgstr "Meta Value:"
1539
-
1540
- #~ msgid "Show home?"
1541
- #~ msgstr "Toon home?"
1542
-
1543
- #~ msgid "Show date?"
1544
- #~ msgstr "Toon datum?"
1545
-
1546
- #~ msgid "Search Text:"
1547
- #~ msgstr "Zoek tekst:"
1548
-
1549
- #~ msgid "Use theme's search form?"
1550
- #~ msgstr "Zoekformulier van thema gebruiken?"
1551
-
1552
- #~ msgid ""
1553
- #~ "An advanced widget that gives you total control over the output of your "
1554
- #~ "search form."
1555
- #~ msgstr ""
1556
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1557
- #~ "van je zoekformulier."
1558
-
1559
- #~ msgid "Largest:"
1560
- #~ msgstr "Grootste:"
1561
-
1562
- #~ msgid "Smallest:"
1563
- #~ msgstr "Kleinste:"
1564
-
1565
- #~ msgid "Unit:"
1566
- #~ msgstr "Eenheid:"
1567
-
1568
- #~ msgid ""
1569
- #~ "An advanced widget that gives you total control over the output of your "
1570
- #~ "tags."
1571
- #~ msgstr ""
1572
- #~ "Een geavanceerde widget die je de totale controle geeft over de output "
1573
- #~ "van je tags."
1
+ # Copyright (C) 2015 Members
2
+ # This file is distributed under the same license as the Members package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Members 1.0.0-alpha-1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/members\n"
7
+ "POT-Creation-Date: 2015-09-14 00:40:53+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: _assets/class-cap-new.php:64 _assets/class-cap-new.php:158
16
+ msgid "Add New Capability"
17
+ msgstr ""
18
+
19
+ #: _assets/class-cap-new.php:102
20
+ msgid "Please input a valid capability."
21
+ msgstr ""
22
+
23
+ #: _assets/class-cap-new.php:106
24
+ msgid "The %s capability already exists."
25
+ msgstr ""
26
+
27
+ #: _assets/class-cap-new.php:110
28
+ msgid "Please select at least one role."
29
+ msgstr ""
30
+
31
+ #: _assets/class-cap-new.php:123
32
+ msgid "The %s capability has been created."
33
+ msgstr ""
34
+
35
+ #: _assets/class-cap-new.php:172 admin/tmpl/cap-section.php:19
36
+ #: admin/tmpl/cap-section.php:27
37
+ msgid "Capability"
38
+ msgstr ""
39
+
40
+ #: _assets/class-cap-new.php:178
41
+ msgid "The capability should be unique and contain only alphanumeric characters and underscores."
42
+ msgstr ""
43
+
44
+ #: _assets/class-cap-new.php:185 admin/class-manage-roles.php:84
45
+ #: admin/class-manage-roles.php:90 admin/class-roles.php:168
46
+ #: admin/class-user-edit.php:87 admin/functions-admin.php:148
47
+ msgid "Roles"
48
+ msgstr ""
49
+
50
+ #: _assets/class-cap-new.php:189
51
+ msgid "Select at least one role. Because of the way capabilities work in WordPress, they can only exist if assigned to a role."
52
+ msgstr ""
53
+
54
+ #: _assets/class-cap-new.php:209
55
+ msgid "Add Capability"
56
+ msgstr ""
57
+
58
+ #: _assets/class-capability-list-table.php:264
59
+ #: _assets/class-capability-list-table.php:387
60
+ #: admin/class-role-list-table.php:322 admin/class-role-list-table.php:447
61
+ msgid "Delete"
62
+ msgstr ""
63
+
64
+ #: _assets/class-capability-list-table.php:319
65
+ #: admin/class-role-list-table.php:392
66
+ msgid "All %s"
67
+ msgid_plural "All %s"
68
+ msgstr[0] ""
69
+ msgstr[1] ""
70
+
71
+ #: _assets/class-capability-list-table.php:320
72
+ #: admin/functions-role-groups.php:112
73
+ msgid "Mine %s"
74
+ msgid_plural "Mine %s"
75
+ msgstr[0] ""
76
+ msgstr[1] ""
77
+
78
+ #: _assets/class-capability-list-table.php:321
79
+ #: admin/functions-role-groups.php:158
80
+ msgid "WordPress %s"
81
+ msgid_plural "WordPress %s"
82
+ msgstr[0] ""
83
+ msgstr[1] ""
84
+
85
+ #: _assets/class-capability-list-table.php:322
86
+ msgid "Members %s"
87
+ msgid_plural "Members %s"
88
+ msgstr[0] ""
89
+ msgstr[1] ""
90
+
91
+ #: _assets/class-capability-list-table.php:349
92
+ msgid "View all roles"
93
+ msgstr ""
94
+
95
+ #: _assets/class-capability-list-table.php:359
96
+ msgid "Filter"
97
+ msgstr ""
98
+
99
+ #: _assets/page-capabilities.php:45 _assets/page-capabilities.php:93
100
+ #: admin/class-settings.php:133
101
+ msgid "Capabilities"
102
+ msgstr ""
103
+
104
+ #: _assets/page-capabilities.php:69
105
+ msgid "%s capability deleted. Not really. This is just a message to output until the functionality is working."
106
+ msgstr ""
107
+
108
+ #: _assets/page-capabilities.php:73
109
+ msgid "No capability selected to delete."
110
+ msgstr ""
111
+
112
+ #: _assets/page-capabilities.php:96 admin/class-meta-box-custom-cap.php:88
113
+ #: admin/class-role-edit.php:248 admin/class-roles.php:171
114
+ msgid "Add New"
115
+ msgstr ""
116
+
117
+ #: _assets/page-capabilities.php:116
118
+ msgid "Are you sure you want to delete this capability? This is a permanent action and cannot be undone."
119
+ msgstr ""
120
+
121
+ #: admin/class-cap-control.php:115 admin/functions-admin.php:51
122
+ msgid "Grant %s capability"
123
+ msgstr ""
124
+
125
+ #: admin/class-cap-control.php:116 admin/functions-admin.php:52
126
+ msgid "Deny %s capability"
127
+ msgstr ""
128
+
129
+ #: admin/class-cap-tabs.php:174
130
+ msgid "Edit Capabilities: %s"
131
+ msgstr ""
132
+
133
+ #: admin/class-manage-roles.php:87 admin/class-role-edit.php:245
134
+ msgid "Edit Role"
135
+ msgstr ""
136
+
137
+ #: admin/class-meta-box-content-permissions.php:96 admin/class-settings.php:125
138
+ #: admin/class-settings.php:398
139
+ msgid "Content Permissions"
140
+ msgstr ""
141
+
142
+ #: admin/class-meta-box-content-permissions.php:125
143
+ msgid "Limit access to this post's content to users of the selected roles."
144
+ msgstr ""
145
+
146
+ #: admin/class-meta-box-content-permissions.php:145
147
+ msgid "If no roles are selected, everyone can view the content. The post author, any users who can edit this post, and users with the %s capability can view the content regardless of role."
148
+ msgstr ""
149
+
150
+ #: admin/class-meta-box-content-permissions.php:149
151
+ msgid "Custom error messsage:"
152
+ msgstr ""
153
+
154
+ #: admin/class-meta-box-content-permissions.php:151
155
+ msgid "Message shown to users that do no have permission to view the post."
156
+ msgstr ""
157
+
158
+ #: admin/class-meta-box-custom-cap.php:71 admin/functions-help.php:94
159
+ msgid "Custom Capability"
160
+ msgstr ""
161
+
162
+ #: admin/class-meta-box-publish-role.php:65 admin/class-roles.php:66
163
+ #: inc/functions-admin-bar.php:35
164
+ msgid "Role"
165
+ msgstr ""
166
+
167
+ #: admin/class-meta-box-publish-role.php:98
168
+ msgid "Users:"
169
+ msgstr ""
170
+
171
+ #: admin/class-meta-box-publish-role.php:104
172
+ msgid "Granted:"
173
+ msgstr ""
174
+
175
+ #: admin/class-meta-box-publish-role.php:110
176
+ msgid "Denied:"
177
+ msgstr ""
178
+
179
+ #: admin/class-meta-box-publish-role.php:121
180
+ msgctxt "delete role"
181
+ msgid "Delete"
182
+ msgstr ""
183
+
184
+ #: admin/class-meta-box-publish-role.php:128
185
+ msgid "Update"
186
+ msgstr ""
187
+
188
+ #: admin/class-meta-box-publish-role.php:128
189
+ msgid "Add Role"
190
+ msgstr ""
191
+
192
+ #: admin/class-role-edit.php:90 members.php:163 members.php:174
193
+ msgid "Whoah, partner!"
194
+ msgstr ""
195
+
196
+ #: admin/class-role-edit.php:97
197
+ msgid "The requested role to edit does not exist."
198
+ msgstr ""
199
+
200
+ #: admin/class-role-edit.php:177
201
+ msgid "%s role updated."
202
+ msgstr ""
203
+
204
+ #: admin/class-role-edit.php:181
205
+ msgid "The %s role is not editable. This means that it is most likely added via another plugin for a special use or that you do not have permission to edit it."
206
+ msgstr ""
207
+
208
+ #: admin/class-role-edit.php:185 admin/class-role-new.php:213
209
+ msgid "The %s role has been created."
210
+ msgstr ""
211
+
212
+ #: admin/class-role-edit.php:267 admin/class-role-new.php:314
213
+ #: admin/class-roles.php:65 admin/functions-help.php:62
214
+ msgid "Role Name"
215
+ msgstr ""
216
+
217
+ #: admin/class-role-edit.php:273 admin/class-role-new.php:320
218
+ #: inc/class-widget-users.php:216
219
+ msgid "Role:"
220
+ msgstr ""
221
+
222
+ #: admin/class-role-list-table.php:213
223
+ msgid "Default Role"
224
+ msgstr ""
225
+
226
+ #: admin/class-role-list-table.php:217
227
+ msgid "Your Role"
228
+ msgstr ""
229
+
230
+ #: admin/class-role-list-table.php:318 admin/class-role-new.php:322
231
+ #: admin/functions-admin.php:49
232
+ msgid "Edit"
233
+ msgstr ""
234
+
235
+ #: admin/class-role-list-table.php:328
236
+ msgid "View"
237
+ msgstr ""
238
+
239
+ #: admin/class-role-list-table.php:333
240
+ msgid "Clone"
241
+ msgstr ""
242
+
243
+ #: admin/class-role-list-table.php:337
244
+ msgid "Change Default"
245
+ msgstr ""
246
+
247
+ #: admin/class-role-list-table.php:341 admin/class-roles.php:67
248
+ #: admin/functions-cap-groups.php:193 inc/class-widget-users.php:155
249
+ msgid "Users"
250
+ msgstr ""
251
+
252
+ #: admin/class-role-new.php:107 admin/class-role-new.php:297
253
+ msgid "Add New Role"
254
+ msgstr ""
255
+
256
+ #: admin/class-role-new.php:222
257
+ msgid "You must enter a valid role."
258
+ msgstr ""
259
+
260
+ #: admin/class-role-new.php:226
261
+ msgid "The %s role already exists."
262
+ msgstr ""
263
+
264
+ #: admin/class-role-new.php:230
265
+ msgid "You must enter a valid role name."
266
+ msgstr ""
267
+
268
+ #: admin/class-role-new.php:297
269
+ msgid "Clone Role"
270
+ msgstr ""
271
+
272
+ #: admin/class-role-new.php:315
273
+ msgid "%s Clone"
274
+ msgstr ""
275
+
276
+ #: admin/class-role-new.php:315
277
+ msgid "Enter role name"
278
+ msgstr ""
279
+
280
+ #: admin/class-roles.php:68
281
+ msgid "Granted"
282
+ msgstr ""
283
+
284
+ #: admin/class-roles.php:69
285
+ msgid "Denied"
286
+ msgstr ""
287
+
288
+ #: admin/class-roles.php:110
289
+ msgid "Selected roles deleted."
290
+ msgstr ""
291
+
292
+ #: admin/class-roles.php:129
293
+ msgid "%s role deleted."
294
+ msgstr ""
295
+
296
+ #: admin/class-roles.php:208 admin/functions-help.php:46
297
+ msgid "Overview"
298
+ msgstr ""
299
+
300
+ #: admin/class-roles.php:217
301
+ msgid "Screen Content"
302
+ msgstr ""
303
+
304
+ #: admin/class-roles.php:226
305
+ msgid "Available Actions"
306
+ msgstr ""
307
+
308
+ #: admin/class-roles.php:235
309
+ msgid "Bulk Actions"
310
+ msgstr ""
311
+
312
+ #: admin/class-roles.php:254
313
+ msgid "This screen provides access to all of your user roles. Roles are a method of grouping users. They are made up of capabilities (caps), which give permission to users to perform specific actions on the site."
314
+ msgstr ""
315
+
316
+ #: admin/class-roles.php:268
317
+ msgid "You can customize the display of this screen&#8216;s contents in a number of ways:"
318
+ msgstr ""
319
+
320
+ #: admin/class-roles.php:272
321
+ msgid "You can hide/display columns based on your needs and decide how many roles to list per screen using the Screen Options tab."
322
+ msgstr ""
323
+
324
+ #: admin/class-roles.php:273
325
+ msgid "You can filter the list of roles by types using the text links in the upper left. The default view is to show all roles."
326
+ msgstr ""
327
+
328
+ #: admin/class-roles.php:287
329
+ msgid "Hovering over a row in the roles list will display action links that allow you to manage your role. You can perform the following actions:"
330
+ msgstr ""
331
+
332
+ #: admin/class-roles.php:291
333
+ msgid "<strong>Edit</strong> takes you to the editing screen for that role. You can also reach that screen by clicking on the role name."
334
+ msgstr ""
335
+
336
+ #: admin/class-roles.php:292
337
+ msgid "<strong>Delete</strong> removes your role from this list and permanently deletes it."
338
+ msgstr ""
339
+
340
+ #: admin/class-roles.php:293
341
+ msgid "<strong>Clone</strong> copies the role and takes you to the new role screen to further edit it."
342
+ msgstr ""
343
+
344
+ #: admin/class-roles.php:294
345
+ msgid "<strong>Users</strong> takes you to the users screen and lists the users that have that role."
346
+ msgstr ""
347
+
348
+ #: admin/class-roles.php:308
349
+ msgid "You can permanently delete multiple roles at once. Select the roles you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply."
350
+ msgstr ""
351
+
352
+ #: admin/class-settings.php:70 admin/class-settings.php:362
353
+ msgid "Members Settings"
354
+ msgstr ""
355
+
356
+ #: admin/class-settings.php:71
357
+ msgctxt "admin screen"
358
+ msgid "Members"
359
+ msgstr ""
360
+
361
+ #: admin/class-settings.php:124
362
+ msgid "Roles and Capabilities"
363
+ msgstr ""
364
+
365
+ #: admin/class-settings.php:126 admin/class-settings.php:407
366
+ msgid "Sidebar Widgets"
367
+ msgstr ""
368
+
369
+ #: admin/class-settings.php:127 admin/class-settings.php:416
370
+ msgid "Private Site"
371
+ msgstr ""
372
+
373
+ #: admin/class-settings.php:132
374
+ msgid "Role Manager"
375
+ msgstr ""
376
+
377
+ #: admin/class-settings.php:134
378
+ msgid "Multiple User Roles"
379
+ msgstr ""
380
+
381
+ #: admin/class-settings.php:137
382
+ msgid "Enable Permissions"
383
+ msgstr ""
384
+
385
+ #: admin/class-settings.php:138
386
+ msgid "Error Message"
387
+ msgstr ""
388
+
389
+ #: admin/class-settings.php:141
390
+ msgid "Login Widget"
391
+ msgstr ""
392
+
393
+ #: admin/class-settings.php:142
394
+ msgid "Users Widget"
395
+ msgstr ""
396
+
397
+ #: admin/class-settings.php:145
398
+ msgid "Enable Private Site"
399
+ msgstr ""
400
+
401
+ #: admin/class-settings.php:146
402
+ msgid "Disable Feed"
403
+ msgstr ""
404
+
405
+ #: admin/class-settings.php:147
406
+ msgid "Feed Error Message"
407
+ msgstr ""
408
+
409
+ #: admin/class-settings.php:188
410
+ msgid "Your roles and capabilities will not revert back to their previous settings after deactivating or uninstalling this plugin, so use this feature wisely."
411
+ msgstr ""
412
+
413
+ #: admin/class-settings.php:203
414
+ msgid "Enable the role manager."
415
+ msgstr ""
416
+
417
+ #: admin/class-settings.php:218
418
+ msgid "Denied capabilities should always overrule granted capabilities."
419
+ msgstr ""
420
+
421
+ #: admin/class-settings.php:233
422
+ msgid "Allow users to be assigned more than a single role."
423
+ msgstr ""
424
+
425
+ #: admin/class-settings.php:248
426
+ msgid "Enable the content permissions feature."
427
+ msgstr ""
428
+
429
+ #: admin/class-settings.php:283
430
+ msgid "Enable the login form widget."
431
+ msgstr ""
432
+
433
+ #: admin/class-settings.php:298
434
+ msgid "Enable the users widget."
435
+ msgstr ""
436
+
437
+ #: admin/class-settings.php:313
438
+ msgid "Redirect all logged-out users to the login page before allowing them to view the site."
439
+ msgstr ""
440
+
441
+ #: admin/class-settings.php:328
442
+ msgid "Show error message for feed items."
443
+ msgstr ""
444
+
445
+ #: admin/class-settings.php:367
446
+ msgid "Update Settings"
447
+ msgstr ""
448
+
449
+ #: admin/class-settings.php:389
450
+ msgid "Role and Capabilities"
451
+ msgstr ""
452
+
453
+ #: admin/class-settings.php:422 admin/functions-help.php:23
454
+ msgid "Documentation"
455
+ msgstr ""
456
+
457
+ #: admin/class-settings.php:423 admin/functions-help.php:24
458
+ msgid "Support Forums"
459
+ msgstr ""
460
+
461
+ #: admin/class-settings.php:424
462
+ msgid "Users, Roles, and Capabilities"
463
+ msgstr ""
464
+
465
+ #: admin/class-settings.php:440
466
+ msgid "The role manager allows you to manage roles on your site by giving you the ability to create, edit, and delete any role. Note that changes to roles do not change settings for the Members plugin. You are literally changing data in your WordPress database. This plugin feature merely provides an interface for you to make these changes."
467
+ msgstr ""
468
+
469
+ #: admin/class-settings.php:444
470
+ msgid "Tick the checkbox for denied capabilities to always take precedence over granted capabilities when there is a conflict. This is only relevant when using multiple roles per user."
471
+ msgstr ""
472
+
473
+ #: admin/class-settings.php:448
474
+ msgid "The multiple user roles feature allows you to assign more than one role to each user from the edit user screen."
475
+ msgstr ""
476
+
477
+ #: admin/class-settings.php:462
478
+ msgid "The content permissions features adds a meta box to the edit post screen that allows you to grant permissions for who can read the post content based on the user's role. Only users of roles with the %s capability will be able to use this component."
479
+ msgstr ""
480
+
481
+ #: admin/class-settings.php:476
482
+ msgid "The sidebar widgets feature adds additional widgets for use in your theme's sidebars."
483
+ msgstr ""
484
+
485
+ #: admin/class-settings.php:490
486
+ msgid "The private site feature redirects all users who are not logged into the site to the login page, creating an entirely private site. You may also replace your feed content with a custom error message."
487
+ msgstr ""
488
+
489
+ #: admin/class-user-edit.php:92
490
+ msgid "User Roles"
491
+ msgstr ""
492
+
493
+ #: admin/functions-admin.php:50
494
+ msgid "OK"
495
+ msgstr ""
496
+
497
+ #: admin/functions-admin.php:53
498
+ msgid "Are you sure you want to delete this role? This is a permanent action and cannot be undone."
499
+ msgstr ""
500
+
501
+ #: admin/functions-admin.php:177
502
+ msgid "None"
503
+ msgstr ""
504
+
505
+ #: admin/functions-cap-groups.php:106
506
+ msgid "All"
507
+ msgstr ""
508
+
509
+ #: admin/functions-cap-groups.php:116
510
+ msgid "General"
511
+ msgstr ""
512
+
513
+ #: admin/functions-cap-groups.php:165
514
+ msgid "Taxonomies"
515
+ msgstr ""
516
+
517
+ #: admin/functions-cap-groups.php:175
518
+ msgid "Appearance"
519
+ msgstr ""
520
+
521
+ #: admin/functions-cap-groups.php:184
522
+ msgid "Plugins"
523
+ msgstr ""
524
+
525
+ #: admin/functions-cap-groups.php:202
526
+ msgid "Custom"
527
+ msgstr ""
528
+
529
+ #: admin/functions-help.php:29
530
+ msgid "For more information:"
531
+ msgstr ""
532
+
533
+ #: admin/functions-help.php:78
534
+ msgid "Edit Capabilities"
535
+ msgstr ""
536
+
537
+ #: admin/functions-help.php:109
538
+ msgid "This screen allows you to edit an individual role and its capabilities."
539
+ msgstr ""
540
+
541
+ #: admin/functions-help.php:123
542
+ msgid "The role name field allows you to enter a human-readable name for your role."
543
+ msgstr ""
544
+
545
+ #: admin/functions-help.php:127
546
+ msgid "The machine-readable version of the role appears below the name field, which you can edit. This can only have lowercase letters, numbers, or underscores."
547
+ msgstr ""
548
+
549
+ #: admin/functions-help.php:141
550
+ msgid "The capabilities edit box is made up of tabs that separate capabilities into groups. You may take the following actions for each capability:"
551
+ msgstr ""
552
+
553
+ #: admin/functions-help.php:145
554
+ msgid "<strong>Grant</strong> allows you to grant the role a capability."
555
+ msgstr ""
556
+
557
+ #: admin/functions-help.php:146
558
+ msgid "<strong>Deny</strong> allows you to explicitly deny the role a capability."
559
+ msgstr ""
560
+
561
+ #: admin/functions-help.php:147
562
+ msgid "You may also opt to neither grant nor deny the role a capability."
563
+ msgstr ""
564
+
565
+ #: admin/functions-help.php:161
566
+ msgid "The custom capability box allows you to create a custom capability for the role. After hitting the Add New button, it will add the capability to the Custom tab in the Edit Capabilities box."
567
+ msgstr ""
568
+
569
+ #: admin/functions-role-groups.php:111
570
+ msgid "Mine"
571
+ msgstr ""
572
+
573
+ #: admin/functions-role-groups.php:121
574
+ msgid "Has Users"
575
+ msgstr ""
576
+
577
+ #: admin/functions-role-groups.php:122
578
+ msgid "Has Users %s"
579
+ msgid_plural "Has Users %s"
580
+ msgstr[0] ""
581
+ msgstr[1] ""
582
+
583
+ #: admin/functions-role-groups.php:130
584
+ msgid "No Users"
585
+ msgstr ""
586
+
587
+ #: admin/functions-role-groups.php:131
588
+ msgid "No Users %s"
589
+ msgid_plural "No Users %s"
590
+ msgstr[0] ""
591
+ msgstr[1] ""
592
+
593
+ #: admin/functions-role-groups.php:139
594
+ msgid "Editable"
595
+ msgstr ""
596
+
597
+ #: admin/functions-role-groups.php:140
598
+ msgid "Editable %s"
599
+ msgid_plural "Editable %s"
600
+ msgstr[0] ""
601
+ msgstr[1] ""
602
+
603
+ #: admin/functions-role-groups.php:148
604
+ msgid "Uneditable"
605
+ msgstr ""
606
+
607
+ #: admin/functions-role-groups.php:149
608
+ msgid "Uneditable %s"
609
+ msgid_plural "Uneditable %s"
610
+ msgstr[0] ""
611
+ msgstr[1] ""
612
+
613
+ #: admin/functions-role-groups.php:157
614
+ msgid "WordPress"
615
+ msgstr ""
616
+
617
+ #: admin/tmpl/cap-section.php:20 admin/tmpl/cap-section.php:28
618
+ msgid "Grant"
619
+ msgstr ""
620
+
621
+ #: admin/tmpl/cap-section.php:21 admin/tmpl/cap-section.php:29
622
+ msgid "Deny"
623
+ msgstr ""
624
+
625
+ #: inc/class-widget-login.php:33
626
+ msgid "A widget that allows users to log into your site."
627
+ msgstr ""
628
+
629
+ #: inc/class-widget-login.php:44
630
+ msgid "Members: Login Form"
631
+ msgstr ""
632
+
633
+ #: inc/class-widget-login.php:172 inc/class-widget-login.php:175
634
+ msgid "Log In"
635
+ msgstr ""
636
+
637
+ #: inc/class-widget-login.php:173
638
+ msgid "Username"
639
+ msgstr ""
640
+
641
+ #: inc/class-widget-login.php:174
642
+ msgid "Password"
643
+ msgstr ""
644
+
645
+ #: inc/class-widget-login.php:176
646
+ msgid "Remember Me"
647
+ msgstr ""
648
+
649
+ #: inc/class-widget-login.php:186
650
+ msgid "Please log into the site."
651
+ msgstr ""
652
+
653
+ #: inc/class-widget-login.php:187
654
+ msgid "You are currently logged in."
655
+ msgstr ""
656
+
657
+ #: inc/class-widget-login.php:199 inc/class-widget-users.php:196
658
+ msgid "Title:"
659
+ msgstr ""
660
+
661
+ #: inc/class-widget-login.php:203
662
+ msgid "Username Label:"
663
+ msgstr ""
664
+
665
+ #: inc/class-widget-login.php:207
666
+ msgid "Password Label:"
667
+ msgstr ""
668
+
669
+ #: inc/class-widget-login.php:211
670
+ msgid "Log In Label:"
671
+ msgstr ""
672
+
673
+ #: inc/class-widget-login.php:215
674
+ msgid "Remember Me Label:"
675
+ msgstr ""
676
+
677
+ #: inc/class-widget-login.php:223
678
+ msgid "Username Value:"
679
+ msgstr ""
680
+
681
+ #: inc/class-widget-login.php:227
682
+ msgid "Username Field ID:"
683
+ msgstr ""
684
+
685
+ #: inc/class-widget-login.php:231
686
+ msgid "Remember Me Field ID:"
687
+ msgstr ""
688
+
689
+ #: inc/class-widget-login.php:235
690
+ msgid "Password Field ID:"
691
+ msgstr ""
692
+
693
+ #: inc/class-widget-login.php:239
694
+ msgid "Submit Button ID:"
695
+ msgstr ""
696
+
697
+ #: inc/class-widget-login.php:250
698
+ msgid "\"Remember me\" checkbox?"
699
+ msgstr ""
700
+
701
+ #: inc/class-widget-login.php:256
702
+ msgid "Check \"remember me\"?"
703
+ msgstr ""
704
+
705
+ #: inc/class-widget-login.php:262
706
+ msgid "Display avatar?"
707
+ msgstr ""
708
+
709
+ #: inc/class-widget-login.php:266
710
+ msgid "Logged out text:"
711
+ msgstr ""
712
+
713
+ #: inc/class-widget-login.php:271
714
+ msgid "Logged in text:"
715
+ msgstr ""
716
+
717
+ #: inc/class-widget-users.php:33
718
+ msgid "Provides the ability to list the users of the site."
719
+ msgstr ""
720
+
721
+ #: inc/class-widget-users.php:44
722
+ msgid "Members: Users"
723
+ msgstr ""
724
+
725
+ #: inc/class-widget-users.php:172
726
+ msgid "Ascending"
727
+ msgstr ""
728
+
729
+ #: inc/class-widget-users.php:173
730
+ msgid "Descending"
731
+ msgstr ""
732
+
733
+ #: inc/class-widget-users.php:177
734
+ msgid "Display Name"
735
+ msgstr ""
736
+
737
+ #: inc/class-widget-users.php:178
738
+ msgid "Email"
739
+ msgstr ""
740
+
741
+ #: inc/class-widget-users.php:179
742
+ msgid "ID"
743
+ msgstr ""
744
+
745
+ #: inc/class-widget-users.php:180
746
+ msgid "Nice Name"
747
+ msgstr ""
748
+
749
+ #: inc/class-widget-users.php:181
750
+ msgid "Post Count"
751
+ msgstr ""
752
+
753
+ #: inc/class-widget-users.php:182
754
+ msgid "Registered"
755
+ msgstr ""
756
+
757
+ #: inc/class-widget-users.php:183
758
+ msgid "URL"
759
+ msgstr ""
760
+
761
+ #: inc/class-widget-users.php:184
762
+ msgid "Login"
763
+ msgstr ""
764
+
765
+ #: inc/class-widget-users.php:200
766
+ msgid "Order By:"
767
+ msgstr ""
768
+
769
+ #: inc/class-widget-users.php:208
770
+ msgid "Order:"
771
+ msgstr ""
772
+
773
+ #: inc/class-widget-users.php:224
774
+ msgid "Limit:"
775
+ msgstr ""
776
+
777
+ #: inc/class-widget-users.php:228
778
+ msgid "Offset:"
779
+ msgstr ""
780
+
781
+ #: inc/class-widget-users.php:236
782
+ msgid "Include:"
783
+ msgstr ""
784
+
785
+ #: inc/class-widget-users.php:240
786
+ msgid "Exclude:"
787
+ msgstr ""
788
+
789
+ #: inc/class-widget-users.php:244
790
+ msgid "Search:"
791
+ msgstr ""
792
+
793
+ #: inc/class-widget-users.php:248
794
+ msgid "Meta Key:"
795
+ msgstr ""
796
+
797
+ #: inc/class-widget-users.php:256
798
+ msgid "Meta Value:"
799
+ msgstr ""
800
+
801
+ #: inc/functions-options.php:116
802
+ msgid "Sorry, but you do not have permission to view this content."
803
+ msgstr ""
804
+
805
+ #: inc/functions-options.php:117
806
+ msgid "You must be logged into the site to view this content."
807
+ msgstr ""
808
+
809
+ #: members.php:185
810
+ msgid "Method does not exist."
811
+ msgstr ""
812
+ #. Plugin Name of the plugin/theme
813
+ msgid "Members"
814
+ msgstr ""
815
+
816
+ #. Plugin URI of the plugin/theme
817
+ msgid "http://themehybrid.com/plugins/members"
818
+ msgstr ""
819
+
820
+ #. Description of the plugin/theme
821
+ msgid "A user and role management plugin that puts you in full control of your site's permissions. This plugin allows you to edit your roles and their capabilities, clone existing roles, assign multiple roles per user, block post content, or even make your site completely private."
822
+ msgstr ""
823
+
824
+ #. Author of the plugin/theme
825
+ msgid "Justin Tadlock"
826
+ msgstr ""
827
+
828
+ #. Author URI of the plugin/theme
829
+ msgid "http://themehybrid.com"
830
+ msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
docs/license.txt → license.md RENAMED
File without changes
members.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Plugin Name: Members
4
- * Plugin URI: http://themehybrid.com/plugins/members
5
- * Description: A user, role, and content management plugin for controlling permissions and access. A plugin for making WordPress a more powerful <acronym title="Content Management System">CMS</acronym>.
6
- * Version: 0.2.5
7
- * Author: Justin Tadlock
8
- * Author URI: http://justintadlock.com
9
  *
10
  * The members plugin was created because the WordPress community is lacking a solid permissions
11
  * plugin that is both open source and works completely within the confines of the APIs in WordPress.
@@ -13,192 +13,333 @@
13
  * WordPress by making user, role, and content management as simple as using WordPress itself.
14
  *
15
  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
16
- * General Public License version 2, as published by the Free Software Foundation. You may NOT assume
17
- * that you can use any other version of the GPL.
18
  *
19
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
20
  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
  *
22
- * @package Members
23
- * @version 0.2.5
24
- * @author Justin Tadlock <justin@justintadlock.com>
 
 
 
25
  * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
26
- * @link http://justintadlock.com/archives/2009/09/17/members-wordpress-plugin
27
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
28
  */
29
 
30
  /**
31
- * @since 0.2.0
 
 
 
32
  */
33
- class Members_Load {
34
 
35
  /**
36
- * PHP5 constructor method.
37
  *
38
- * @since 0.2.0
 
 
39
  */
40
- function __construct() {
41
- global $members;
42
-
43
- /* Set up an empty class for the global $members object. */
44
- $members = new stdClass;
45
 
46
- /* Set the constants needed by the plugin. */
47
- add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
48
-
49
- /* Internationalize the text strings used. */
50
- add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
 
 
 
51
 
52
- /* Load the functions files. */
53
- add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
 
 
 
 
 
 
54
 
55
- /* Load the admin files. */
56
- add_action( 'plugins_loaded', array( &$this, 'admin' ), 4 );
 
 
 
 
 
 
57
 
58
- /* Register activation hook. */
59
- register_activation_hook( __FILE__, array( &$this, 'activation' ) );
60
- }
 
 
 
 
 
61
 
62
  /**
63
- * Defines constants used by the plugin.
64
  *
65
- * @since 0.2.0
 
 
66
  */
67
- function constants() {
68
 
69
- /* Set the version number of the plugin. */
70
- define( 'MEMBERS_VERSION', '0.2.5' );
 
 
 
 
 
 
71
 
72
- /* Set the database version number of the plugin. */
73
- define( 'MEMBERS_DB_VERSION', 2 );
 
 
 
 
 
 
 
74
 
75
- /* Set constant path to the members plugin directory. */
76
- define( 'MEMBERS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
 
 
 
 
 
 
77
 
78
- /* Set constant path to the members plugin URL. */
79
- define( 'MEMBERS_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
80
 
81
- /* Set the constant path to the members includes directory. */
82
- define( 'MEMBERS_INCLUDES', MEMBERS_DIR . trailingslashit( 'includes' ) );
 
 
 
 
83
 
84
- /* Set the constant path to the members admin directory. */
85
- define( 'MEMBERS_ADMIN', MEMBERS_DIR . trailingslashit( 'admin' ) );
86
  }
87
 
88
  /**
89
- * Loads the initial files needed by the plugin.
90
  *
91
- * @since 0.2.0
 
 
92
  */
93
- function includes() {
94
-
95
- /* Load the plugin functions file. */
96
- require_once( MEMBERS_INCLUDES . 'functions.php' );
97
-
98
- /* Load the update functionality. */
99
- require_once( MEMBERS_INCLUDES . 'update.php' );
100
 
101
- /* Load the deprecated functions file. */
102
- require_once( MEMBERS_INCLUDES . 'deprecated.php' );
 
 
 
 
 
 
 
 
103
 
104
- /* Load the admin bar functions. */
105
- require_once( MEMBERS_INCLUDES . 'admin-bar.php' );
 
 
 
 
 
 
 
 
106
 
107
- /* Load the functions related to capabilities. */
108
- require_once( MEMBERS_INCLUDES . 'capabilities.php' );
 
 
 
 
 
 
 
 
109
 
110
- /* Load the content permissions functions. */
111
- require_once( MEMBERS_INCLUDES . 'content-permissions.php' );
 
 
 
 
 
 
 
 
 
 
112
 
113
- /* Load the private site functions. */
114
- require_once( MEMBERS_INCLUDES . 'private-site.php' );
 
 
 
 
 
 
115
 
116
- /* Load the shortcodes functions file. */
117
- require_once( MEMBERS_INCLUDES . 'shortcodes.php' );
 
118
 
119
- /* Load the template functions. */
120
- require_once( MEMBERS_INCLUDES . 'template.php' );
 
 
121
 
122
- /* Load the widgets functions file. */
123
- require_once( MEMBERS_INCLUDES . 'widgets.php' );
 
124
  }
125
 
126
  /**
127
- * Loads the translation files.
128
  *
129
- * @since 0.2.0
 
 
130
  */
131
- function i18n() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
- /* Load the translation of the plugin. */
134
- load_plugin_textdomain( 'members', false, 'members/languages' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
  /**
138
- * Loads the admin functions and files.
139
  *
140
- * @since 0.2.0
 
 
141
  */
142
- function admin() {
143
 
144
- /* Only load files if in the WordPress admin. */
145
- if ( is_admin() ) {
146
 
147
- /* Load the main admin file. */
148
- require_once( MEMBERS_ADMIN . 'admin.php' );
 
149
 
150
- /* Load the plugin settings. */
151
- require_once( MEMBERS_ADMIN . 'settings.php' );
152
- }
 
 
 
 
 
 
153
  }
154
 
155
  /**
156
  * Method that runs only when the plugin is activated.
157
  *
158
- * @since 0.2.0
 
 
159
  */
160
- function activation() {
161
 
162
- /* Get the administrator role. */
163
  $role = get_role( 'administrator' );
164
 
165
- /* If the administrator role exists, add required capabilities for the plugin. */
166
- if ( !empty( $role ) ) {
167
-
168
- /* Role management capabilities. */
169
- $role->add_cap( 'list_roles' );
170
- $role->add_cap( 'create_roles' );
171
- $role->add_cap( 'delete_roles' );
172
- $role->add_cap( 'edit_roles' );
173
-
174
- /* Content permissions capabilities. */
175
- $role->add_cap( 'restrict_content' );
176
- }
177
 
178
- /**
179
- * If the administrator role does not exist for some reason, we have a bit of a problem
180
- * because this is a role management plugin and requires that someone actually be able to
181
- * manage roles. So, we're going to create a custom role here. The site administrator can
182
- * assign this custom role to any user they wish to work around this problem. We're only
183
- * doing this for single-site installs of WordPress. The 'super admin' has permission to do
184
- * pretty much anything on a multisite install.
185
- */
186
- elseif ( empty( $role ) && !is_multisite() ) {
187
-
188
- /* Add the 'members_role_manager' role with limited capabilities. */
189
- add_role(
190
- 'members_role_manager',
191
- _x( 'Role Manager', 'role', 'members' ),
192
- array(
193
- 'read' => true,
194
- 'list_roles' => true,
195
- 'edit_roles' => true
196
- )
197
- );
198
  }
199
  }
200
  }
201
 
202
- $members_load = new Members_Load();
 
 
 
 
 
 
 
 
 
 
203
 
204
- ?>
 
1
  <?php
2
  /**
3
  * Plugin Name: Members
4
+ * Plugin URI: http://themehybrid.com/plugins/members
5
+ * Description: A user and role management plugin that puts you in full control of your site's permissions. This plugin allows you to edit your roles and their capabilities, clone existing roles, assign multiple roles per user, block post content, or even make your site completely private.
6
+ * Version: 1.0.0
7
+ * Author: Justin Tadlock
8
+ * Author URI: http://themehybrid.com
9
  *
10
  * The members plugin was created because the WordPress community is lacking a solid permissions
11
  * plugin that is both open source and works completely within the confines of the APIs in WordPress.
13
  * WordPress by making user, role, and content management as simple as using WordPress itself.
14
  *
15
  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
16
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
17
+ * or (at your option) any later version.
18
  *
19
  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
20
  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21
  *
22
+ * You should have received a copy of the GNU General Public License along with this program; if not,
23
+ * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
+ *
25
+ * @package Members
26
+ * @version 1.0.0
27
+ * @author Justin Tadlock <justin@justintadlock.com>
28
  * @copyright Copyright (c) 2009 - 2015, Justin Tadlock
29
+ * @link http://themehybrid.com/plugins/members
30
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
31
  */
32
 
33
  /**
34
+ * Singleton class for setting up the plugin.
35
+ *
36
+ * @since 1.0.0
37
+ * @access public
38
  */
39
+ final class Members_Plugin {
40
 
41
  /**
42
+ * Plugin directory path.
43
  *
44
+ * @since 1.0.0
45
+ * @access public
46
+ * @var string
47
  */
48
+ public $dir_path = '';
 
 
 
 
49
 
50
+ /**
51
+ * Plugin directory URI.
52
+ *
53
+ * @since 1.0.0
54
+ * @access public
55
+ * @var string
56
+ */
57
+ public $dir_uri = '';
58
 
59
+ /**
60
+ * Plugin admin directory path.
61
+ *
62
+ * @since 1.0.0
63
+ * @access public
64
+ * @var string
65
+ */
66
+ public $admin_dir = '';
67
 
68
+ /**
69
+ * Plugin includes directory path.
70
+ *
71
+ * @since 1.0.0
72
+ * @access public
73
+ * @var string
74
+ */
75
+ public $inc_dir = '';
76
 
77
+ /**
78
+ * Plugin templates directory path.
79
+ *
80
+ * @since 1.0.0
81
+ * @access public
82
+ * @var string
83
+ */
84
+ public $templates_dir = '';
85
 
86
  /**
87
+ * Plugin CSS directory URI.
88
  *
89
+ * @since 1.0.0
90
+ * @access public
91
+ * @var string
92
  */
93
+ public $css_uri = '';
94
 
95
+ /**
96
+ * Plugin JS directory URI.
97
+ *
98
+ * @since 1.0.0
99
+ * @access public
100
+ * @var string
101
+ */
102
+ public $js_uri = '';
103
 
104
+ /**
105
+ * User count of all roles.
106
+ *
107
+ * @see members_get_role_user_count()
108
+ * @since 1.0.0
109
+ * @access public
110
+ * @var array
111
+ */
112
+ public $role_user_count = array();
113
 
114
+ /**
115
+ * Returns the instance.
116
+ *
117
+ * @since 1.0.0
118
+ * @access public
119
+ * @return object
120
+ */
121
+ public static function get_instance() {
122
 
123
+ static $instance = null;
 
124
 
125
+ if ( is_null( $instance ) ) {
126
+ $instance = new Members_Plugin;
127
+ $instance->setup();
128
+ $instance->includes();
129
+ $instance->setup_actions();
130
+ }
131
 
132
+ return $instance;
 
133
  }
134
 
135
  /**
136
+ * Constructor method.
137
  *
138
+ * @since 1.0.0
139
+ * @access private
140
+ * @return void
141
  */
142
+ private function __construct() {}
 
 
 
 
 
 
143
 
144
+ /**
145
+ * Magic method to output a string if trying to use the object as a string.
146
+ *
147
+ * @since 1.0.0
148
+ * @access public
149
+ * @return void
150
+ */
151
+ public function __toString() {
152
+ return 'members';
153
+ }
154
 
155
+ /**
156
+ * Magic method to keep the object from being cloned.
157
+ *
158
+ * @since 1.0.0
159
+ * @access public
160
+ * @return void
161
+ */
162
+ public function __clone() {
163
+ _doing_it_wrong( __FUNCTION__, esc_html__( 'Whoah, partner!', 'members' ), '1.0.0' );
164
+ }
165
 
166
+ /**
167
+ * Magic method to keep the object from being unserialized.
168
+ *
169
+ * @since 1.0.0
170
+ * @access public
171
+ * @return void
172
+ */
173
+ public function __wakeup() {
174
+ _doing_it_wrong( __FUNCTION__, esc_html__( 'Whoah, partner!', 'members' ), '1.0.0' );
175
+ }
176
 
177
+ /**
178
+ * Magic method to prevent a fatal error when calling a method that doesn't exist.
179
+ *
180
+ * @since 1.0.0
181
+ * @access public
182
+ * @return null
183
+ */
184
+ public function __call( $method = '', $args = array() ) {
185
+ _doing_it_wrong( "Members_Plugin::{$method}", esc_html__( 'Method does not exist.', 'members' ), '1.0.0' );
186
+ unset( $method, $args );
187
+ return null;
188
+ }
189
 
190
+ /**
191
+ * Sets up globals.
192
+ *
193
+ * @since 1.0.0
194
+ * @access public
195
+ * @return void
196
+ */
197
+ private function setup() {
198
 
199
+ // Main plugin directory path and URI.
200
+ $this->dir_path = trailingslashit( plugin_dir_path( __FILE__ ) );
201
+ $this->dir_uri = trailingslashit( plugin_dir_url( __FILE__ ) );
202
 
203
+ // Plugin directory paths.
204
+ $this->inc_dir = trailingslashit( $this->dir_path . 'inc' );
205
+ $this->admin_dir = trailingslashit( $this->dir_path . 'admin' );
206
+ $this->templates_dir = trailingslashit( $this->dir_path . 'templates' );
207
 
208
+ // Plugin directory URIs.
209
+ $this->css_uri = trailingslashit( $this->dir_uri . 'css' );
210
+ $this->js_uri = trailingslashit( $this->dir_uri . 'js' );
211
  }
212
 
213
  /**
214
+ * Loads files needed by the plugin.
215
  *
216
+ * @since 1.0.0
217
+ * @access public
218
+ * @return void
219
  */
220
+ private function includes() {
221
+
222
+ // Load class files.
223
+ require_once( $this->inc_dir . 'class-role.php' );
224
+ require_once( $this->inc_dir . 'class-role-factory.php' );
225
+
226
+ // Load includes files.
227
+ require_once( $this->inc_dir . 'functions.php' );
228
+ require_once( $this->inc_dir . 'functions-admin-bar.php' );
229
+ require_once( $this->inc_dir . 'functions-capabilities.php' );
230
+ require_once( $this->inc_dir . 'functions-content-permissions.php' );
231
+ require_once( $this->inc_dir . 'functions-deprecated.php' );
232
+ require_once( $this->inc_dir . 'functions-options.php' );
233
+ require_once( $this->inc_dir . 'functions-private-site.php' );
234
+ require_once( $this->inc_dir . 'functions-roles.php' );
235
+ require_once( $this->inc_dir . 'functions-shortcodes.php' );
236
+ require_once( $this->inc_dir . 'functions-users.php' );
237
+ require_once( $this->inc_dir . 'functions-widgets.php' );
238
+
239
+ // Load template files.
240
+ require_once( $this->inc_dir . 'template.php' );
241
+
242
+ // Load admin files.
243
+ if ( is_admin() ) {
244
 
245
+ // General admin functions.
246
+ require_once( $this->admin_dir . 'functions-admin.php' );
247
+ require_once( $this->admin_dir . 'functions-help.php' );
248
+
249
+ // Plugin settings.
250
+ require_once( $this->admin_dir . 'class-settings.php' );
251
+
252
+ // Edit users.
253
+ require_once( $this->admin_dir . 'class-user-edit.php' );
254
+
255
+ // Edit posts.
256
+ require_once( $this->admin_dir . 'class-meta-box-content-permissions.php' );
257
+
258
+ // Role management.
259
+ require_once( $this->admin_dir . 'class-manage-roles.php' );
260
+ require_once( $this->admin_dir . 'class-roles.php' );
261
+ require_once( $this->admin_dir . 'class-role-edit.php' );
262
+ require_once( $this->admin_dir . 'class-role-new.php' );
263
+ require_once( $this->admin_dir . 'class-meta-box-publish-role.php' );
264
+ require_once( $this->admin_dir . 'class-meta-box-custom-cap.php' );
265
+
266
+ // Role groups.
267
+ require_once( $this->admin_dir . 'class-role-group.php' );
268
+ require_once( $this->admin_dir . 'class-role-group-factory.php' );
269
+ require_once( $this->admin_dir . 'functions-role-groups.php' );
270
+
271
+ // Edit capabilities tabs and groups.
272
+ require_once( $this->admin_dir . 'class-cap-tabs.php' );
273
+ require_once( $this->admin_dir . 'class-cap-section.php' );
274
+ require_once( $this->admin_dir . 'class-cap-control.php' );
275
+ require_once( $this->admin_dir . 'class-cap-group.php' );
276
+ require_once( $this->admin_dir . 'class-cap-group-factory.php' );
277
+ require_once( $this->admin_dir . 'functions-cap-groups.php' );
278
+ }
279
  }
280
 
281
  /**
282
+ * Sets up main plugin actions and filters.
283
  *
284
+ * @since 1.0.0
285
+ * @access public
286
+ * @return void
287
  */
288
+ private function setup_actions() {
289
 
290
+ // Internationalize the text strings used.
291
+ add_action( 'plugins_loaded', array( $this, 'i18n' ), 2 );
292
 
293
+ // Register activation hook.
294
+ register_activation_hook( __FILE__, array( $this, 'activation' ) );
295
+ }
296
 
297
+ /**
298
+ * Loads the translation files.
299
+ *
300
+ * @since 1.0.0
301
+ * @access public
302
+ * @return void
303
+ */
304
+ public function i18n() {
305
+ load_plugin_textdomain( 'members', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ). 'languages' );
306
  }
307
 
308
  /**
309
  * Method that runs only when the plugin is activated.
310
  *
311
+ * @since 1.0.0
312
+ * @access public
313
+ * @return void
314
  */
315
+ public function activation() {
316
 
317
+ // Get the administrator role.
318
  $role = get_role( 'administrator' );
319
 
320
+ // If the administrator role exists, add required capabilities for the plugin.
321
+ if ( ! empty( $role ) ) {
 
 
 
 
 
 
 
 
 
 
322
 
323
+ $role->add_cap( 'list_roles' ); // View roles in backend.
324
+ $role->add_cap( 'create_roles' ); // Create new roles.
325
+ $role->add_cap( 'delete_roles' ); // Delete existing roles.
326
+ $role->add_cap( 'edit_roles' ); // Edit existing roles/caps.
327
+ $role->add_cap( 'restrict_content' ); // Edit per-post content permissions.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  }
329
  }
330
  }
331
 
332
+ /**
333
+ * Gets the instance of the `Members_Plugin` class. This function is useful for quickly grabbing data
334
+ * used throughout the plugin.
335
+ *
336
+ * @since 1.0.0
337
+ * @access public
338
+ * @return object
339
+ */
340
+ function members_plugin() {
341
+ return Members_Plugin::get_instance();
342
+ }
343
 
344
+ // Let's roll!
345
+ members_plugin();
readme.md ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Members
2
+
3
+ Members is a plugin that extends your control over your blog. It's a user, role, and capability management plugin that was created to make WordPress a more powerful CMS.
4
+
5
+ It puts you in control over permissions on your site by providing a user interface (UI) for WordPress' powerful role and cap system, which is traditionally only available to developers who know how to code this by hand.
6
+
7
+ ## Plugin Features
8
+
9
+ * **Role Manager:** Allows you to edit, create, and delete roles as well as capabilities for these roles.
10
+ * **Multiple User Roles:** Give one, two, or even more roles to any user.
11
+ * **Explicitly Deny Capabilities:** Deny specific caps to specific user roles.
12
+ * **Clone Roles:** Build a new role by cloning an existing role.
13
+ * **Content Permissions:** Gives you control over which users (by role) have access to post content.
14
+ * **Shortcodes:** Shortcodes to control who has access to content.
15
+ * **Widgets:** A login form widget and users widget to show in your theme's sidebars.
16
+ * **Private Site:** You can make your site and its feed completely private if you want.
17
+
18
+ ## Professional Support
19
+
20
+ If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/board/topics), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing).
21
+
22
+ ## Copyright and License
23
+
24
+ This project is licensed under the [GNU GPL](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html), version 2 or later.
25
+
26
+ 2009&thinsp;&ndash;&thinsp;2015 &copy; [Justin Tadlock](http://justintadlock.com).
27
+
28
+ ## Documentation
29
+
30
+ ### The relationship of users, roles, and capabilities
31
+
32
+ This is the most important thing to understand with this plugin. It's so important that I took the time out of my day to write a complete tutorial on understanding this: [Users, roles, and capabilities in WordPress](http://justintadlock.com/archives/2009/08/30/users-roles-and-capabilities-in-wordpress). If you don't understand this concept, you won't understand what this plugin does. This is not a concept created by the plugin. This is how it's done in WordPress.
33
+
34
+ I highly recommend reading that blog post, but here's the short version:
35
+
36
+ * **Users** are people that have registered on your site. I'm sure you already knew that. In WordPress, users are assigned a specific role. This role defines what the user can/can't do.
37
+ * **Roles** are a way of grouping users. Each user on your site will have a specific role. Roles are a set of capabilities. It is important to note that **roles are not hierarchical**. For example, "Administrator" is not higher than "Subscriber" in WordPress. You could literally give the Subscriber role more capabilities than the Administrator role. It's very important that you grasp this concept.
38
+ * **Capabilities** give meaning to roles. It's a permissions system. They're a way of saying a role *can* do something or a role *can't* do something (e.g., Role A can `edit_posts`, Role B can't `activate_plugins`, etc.).
39
+
40
+ ### How to use the plugin
41
+
42
+ This plugin is set up to have a components-based system. The reason for this is that I don't want to stick everyone with a bunch of features they don't need. There's no point in using the Role Manger feature if all you need is just a login widget and some shortcodes. So, it's a *use-only-what-you-want* system.
43
+
44
+ To activate certain features, look for the "Members" link under your "Settings" menu while in your WordPress admin. When on the new page, you'll be able to select the features you want to use.
45
+
46
+ I recommend at least activating Role Manager feature. It is at the heart of this plugin, and many other features will likely require its use in some form.
47
+
48
+ ### Role management
49
+
50
+ The Role Manager feature allows you to edit and add new roles as well as add and remove both default capabilities and custom capabilities from roles. It is an extremely powerful system.
51
+
52
+ Any changes you make to users and roles using this feature are permanent changes. What I mean by this is that if you deactivate or uninstall this plugin, the changes won't revert to their previous state. This plugin merely provides a user interface for you to make changes directly to your WordPress database. Please use this feature wisely.
53
+
54
+ #### Editing/Adding Roles
55
+
56
+ This feature can be both a blessing and a curse, so I'm going to ask that you use it wisely. Use extreme caution when assigning new capabilities to roles. You wouldn't want to grant Average Joe the `edit_plugins` capability, for example.
57
+
58
+ You can find the settings page for this feature under the "Users" menu. It will be labeled "Roles". When clicking on the menu item, you'll be take to a screen similar to the edit post/page screen, only it'll be for editing a role.
59
+
60
+ In the "Edit Capabilities" box on that screen, you simply have to tick the checkbox next to the capability you want to grant or deny.
61
+
62
+ #### Grant, deny, or neither?
63
+
64
+ Every capability can have one of three "states" for a role. The role can be *granted*, *denied*, or simply not have a capability.
65
+
66
+ * **Granting** a capability to a role means that users of that role will have permission to perform the given capability.
67
+ * **Denying** a capability means that the role's users are explicitly denied permission.
68
+ * A role that is neither granted nor denied a capability simply doesn't have that capability.
69
+
70
+ **Note #1:** If you were using a pre-1.0.0 version of Members, the concept of denied capabilities was not built in. In those versions, you could only grant or remove a capability.
71
+
72
+ **Note #2:** When assigning multiple roles to a single user that have a conflicting capability (e.g., granted `publish_posts` and denied `published_posts` cap), it's best to enable the denied capabilities override via the Members Settings screen. This will consistently make sure that denied capabilities always overrule granted capabilities. With this setting disabled, WordPress will decide based on the *last* role given to the user, which can mean for extremely inconsistent behavior depending on the roles a user has.
73
+
74
+ ### Multiple user roles
75
+
76
+ You can assign a user more than one role by going to that edit user screen in the admin and locating the "Roles" section. There will be a checkbox for every role.
77
+
78
+ Note that the roles dropdown on the "Users" screen in the admin will overwrite all roles with a single role. So, you'll need to edit the individual users to give them multiple roles.
79
+
80
+ ### Content permissions feature
81
+
82
+ The Content Permissions feature adds an additional meta box on the post editing screen.
83
+
84
+ For any public post type (posts, pages, etc.), you'll see a "Content Permissions" meta box on the post editing screen. This meta box allows you to select which roles can view the content of the post/page. If no roles are selected, anyone can view the content. The post author, users that can edit the post, and any users of roles with the `restrict_content` capability can **always** view the post, regardless of their role.
85
+
86
+ You can add a custom error message for individual posts. Otherwise, the error message will default to whatever you have set under the plugin settings.
87
+
88
+ **Big important note:** This feature only blocks the post content (that's what you write in the post editor), post excerpt, and post comments. It does not block anything else.
89
+
90
+ ### Shortcodes
91
+
92
+ There are several shortcodes that you can use in your post editor or any shortcode-ready area..
93
+
94
+ #### [members_access]
95
+
96
+ The `[members_access]` shortcode is for hiding content from particular roles and capabilities. You need to wrap your content when using this shortcode:
97
+
98
+ [members_access role="editor"]Hide this content from everyone but editors.[/members_access]
99
+
100
+ **Parameters:**
101
+
102
+ * `capability`: A capability that has been assigned to a role.
103
+ * `role`: A user role from WordPress or one that you've created.
104
+
105
+ Note that `capability` and `role` parameters aren't used in conjunction. The code first checks for the capability (if input) then checks for the role (if input).
106
+
107
+ To check for multiple capabilities or multiple roles, simply add a comma between each capability/role. For example, the following code checks for an editor or administrator:
108
+
109
+ [members_access role="administrator,editor"]Hide this content from everyone but administrators and editors.[/members_access]
110
+
111
+ #### [members_logged_in]
112
+
113
+ The `[members_logged_in]` shortcode should be used to check if a user is currently logged into the site. If not, the content will be hidden.
114
+
115
+ [members_logged_in]This content is only shown to logged-in users.[/members_logged_in]
116
+
117
+ This shortcode has no parameters.
118
+
119
+ #### [members_login_form]
120
+
121
+ The `[members_login_form]` shortcode is used to show a login form on the page.
122
+
123
+ [members_login_form /]
124
+
125
+ This shortcode has no parameters.
126
+
127
+ ### Widgets
128
+
129
+ The widgets component provides easy-to-use widgets for your site. They can be used in any WordPress widget area (provided by your theme). Currently, there's the Login Form and Users widgets.
130
+
131
+ #### Login Form widget
132
+
133
+ The Login Form gives you a login form. It's a mixture of a text widget and login form. It can also show your avatar.
134
+
135
+ #### Users widget
136
+
137
+ The Users widget allows you to list users in any widget area. It's based off the `get_users()` function, so all of the [parameters are the same](http://codex.wordpress.org/Function_Reference/get_users).
138
+
139
+ ### Private site
140
+
141
+ The Private Site features makes sure that only logged-in users can see anything on your site. If a user visits your site and is not logged in, they are immediately redirected to your `wp-login.php` (WordPress login) page.
142
+
143
+ You also have the option of disabling the viewing of feed content and setting an error message for feed items.
144
+
145
+ ### Checking if the current user has a capability
146
+
147
+ In plugins and your theme template files, you might sometimes need to check if the currently logged in user has permission to do something. We do this by using the WordPress function `current_user_can()`. The basic format looks like this:
148
+
149
+ <?php if ( current_user_can( 'capability_name' ) ) echo 'This user can do something'; ?>
150
+
151
+ For a more practical situation, let's say you created a new capability called `read_pages`. Well, you might want to hide the content within your `page.php` template by adding this:
152
+
153
+ <?php if ( current_user_can( 'read_pages ' ) ) : ?>
154
+ <?php the_content(); ?>
155
+ <?php endif; ?>
156
+
157
+ Only users with a role that has the `read_pages` capability will be able to see the content.
158
+
159
+ ### Checking if a user has a role
160
+
161
+ Before beginning, I want to note that you really shouldn't do this. It's better to check against capabilities. However, for those times when you need to break the rules, you can do so like:
162
+
163
+ if ( members_user_has_role( $user_id, $role ) )
164
+
165
+ Or, you can check against the current user:
166
+
167
+ if ( members_current_user_has_role( $role ) )
168
+
169
+ ### Need the old user levels system?
170
+
171
+ Some plugins and themes might rely on the old user level system in WordPress. These were deprecated in WordPress version 2.1 and should not be used at all. WordPress still has minimal legacy support for these, but I highly suggest contacting your theme/plugin author if user levels are being used.
172
+
173
+ By default, the levels aren't shown. They still exist, but are tucked away behind the scenes. While not recommended, if you need to control who has what level (levels are just capabilities), add this to your plugin or your theme's `functions.php`:
174
+
175
+ add_filter( 'members_remove_old_levels', '__return_false' );
readme.txt CHANGED
@@ -3,42 +3,52 @@
3
  Contributors: greenshady
4
  Donate link: http://themehybrid.com/donate
5
  Tags: admin, role, roles, member, members, profile, shortcode, user, users, widget, widgets
6
- Requires at least: 3.4
7
- Stable tag: 0.2.5
8
 
9
- A user, role, and content management plugin that makes WordPress a more powerful CMS.
10
 
11
  == Description ==
12
 
13
- Members is a plugin that extends your control over your blog. It's a user, role, and content management plugin that was created to make WordPress a more powerful CMS.
14
 
15
- The foundation of the plugin is its extensive role and capability management system. This is the backbone of all the current features and planned future features.
16
 
17
- ### Plugin Features:
18
 
19
- * Role Manager: Allows you to edit, create, and delete roles as well as capabilities for these roles.
20
- * Content Permissions: Gives you control over which users (by role) have access to post content.
21
- * Shortcodes: Shortcodes to control who has access to content.
22
- * Widgets: A login form widget and users widget to show in your theme's sidebars.
23
- * Private Site: You can make your site and its feed completely private if you want.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  ### Professional Support
26
 
27
- If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/support), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing).
28
 
29
  ### Plugin Development
30
 
31
  If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/members).
32
 
33
- ### Donations
34
-
35
- Yes, I do accept donations. If you want to buy me a beer or whatever, you can do so from my [donations page](http://themehybrid.com/donate). I appreciate all donations, no matter the size. Further development of this plugin is not contingent on donations, but they are always a nice incentive.
36
-
37
  == Installation ==
38
 
39
  1. Upload `members` to the `/wp-content/plugins/` directory.
40
  2. Activate the plugin through the 'Plugins' menu in WordPress.
41
- 3. Go to <em>Settings > Members</em> to select which settings you'd like to use.
42
 
43
  More detailed instructions are included in the plugin's `readme.html` file.
44
 
@@ -48,15 +58,13 @@ More detailed instructions are included in the plugin's `readme.html` file.
48
 
49
  I wasn't satisfied with the current user, role, and permissions plugins available. Yes, some of them are good, but nothing fit what I had in mind perfectly. Some offered few features. Some worked completely outside of the WordPress APIs. Others lacked the GPL license.
50
 
51
- This plugin is still a long way away from my goals, but it'll get there eventually.
52
 
53
  ### How do I use it?
54
 
55
- Most things should be fairly straightforward, but I've included an in-depth guide in the plugin download. It's a file called `readme.html` in the `/docs` folder.
56
-
57
- You'll want to look over that. It's probably the most in-depth plugin documentation you'll ever read. ;)
58
 
59
- Now, open up the `/docs/readme.html` file included in the plugin download and read the documentation.
60
 
61
  ### I can't access the "Role Manager" features.
62
 
@@ -66,63 +74,18 @@ If, for some reason, you do have the administrator role and the role manager is
66
 
67
  ### Help! I've locked myself out of my site!
68
 
69
- Well, that's why you really need to read the documentation for the plugin before actually using it, especially a plugin that controls permissions for your site.
 
 
70
 
71
  == Screenshots ==
72
 
73
- 1. Members plugin settings
74
- 2. Role management screen
75
- 3. Edit role screen
76
- 4. Members settings help tab
77
- 5. Content permissions on the edit post screen
78
 
79
  == Changelog ==
80
 
81
- ### Version 0.2.5 - 2015-07-09
82
-
83
- #### Fixed
84
-
85
- * Deprecated old widget constructor method in favor of using `__construct()` in preparation for WP 4.3.
86
- * Removed old `/components` folder and files that's not used.
87
-
88
- ### Version 0.2.4
89
-
90
- * Fixed content permissions not saving for attachments. Note that this only protects **content** and not media files.
91
- * No longer runs the upgrade script when `WP_INSTALLING` is `TRUE`.
92
-
93
- ### Version 0.2.3
94
-
95
- * Fixes the strict standards notice "Redefining already defined constructor for class Members_Load".
96
- * No longer uses `&` for passing the role name by reference on plugin activation.
97
- * Fixes the `[feed]` shortcode, which was using the wrong callback function.
98
-
99
- ### Version 0.2.2
100
-
101
- * No longer displays non-editable roles on the edit roles screen.
102
-
103
- ### Version 0.2.1
104
-
105
- * Fixes the " Creating default object from empty value" error.
106
-
107
- ### Version 0.2.0
108
-
109
- * Updated everything. Nearly all the code was rewritten from the ground up to make for a better user experience.
110
- * Plugin users should check their plugin settings.
111
-
112
- ### Version 0.1.1
113
-
114
- * Fixed a bug with the Content Permissions component that restricted access to everyone.
115
- * Added missing internationalization function call: `load_plugin_textdomain()`.
116
- * Added new `/languages` folder for holding translations.
117
- * Added `members-en_EN.po`, `members-en_EN.mo`, and `members.pot` to the `/languages` folder.
118
- * Updated some non-internationalized strings.
119
-
120
- ### Version 0.1.0
121
-
122
- * Plugin launch. Everything's new!
123
-
124
- == Upgrade Notice ==
125
-
126
- ### If upgrading from a version earlier than 0.2.0
127
-
128
- Version 0.2.0 included a complete overhaul of the plugin. Please check your plugin and widget settings.
3
  Contributors: greenshady
4
  Donate link: http://themehybrid.com/donate
5
  Tags: admin, role, roles, member, members, profile, shortcode, user, users, widget, widgets
6
+ Requires at least: 4.3
7
+ Stable tag: 1.0.0
8
 
9
+ The most powerful user, role, and capability management plugin for WordPress.
10
 
11
  == Description ==
12
 
13
+ Members is a plugin that extends your control over your blog. It's a user, role, and capability management plugin that was created to make WordPress a more powerful CMS.
14
 
15
+ It puts you in control over permissions on your site by providing a user interface (UI) for WordPress' powerful role and cap system, which is traditionally only available to developers who know how to code this by hand.
16
 
17
+ ### Plugin Features
18
 
19
+ * **Role Manager:** Allows you to edit, create, and delete roles as well as capabilities for these roles.
20
+ * **Multiple User Roles:** Give one, two, or even more roles to any user.
21
+ * **Explicitly Deny Capabilities:** Deny specific caps to specific user roles.
22
+ * **Clone Roles:** Build a new role by cloning an existing role.
23
+ * **Content Permissions:** Gives you control over which users (by role) have access to post content.
24
+ * **Shortcodes:** Shortcodes to control who has access to content.
25
+ * **Widgets:** A login form widget and users widget to show in your theme's sidebars.
26
+ * **Private Site:** You can make your site and its feed completely private if you want.
27
+ * **Plugin Integration:** Members is highly recommended by other WordPress developers. Many existing plugins integrate their custom roles and caps directly into it.
28
+
29
+ For more info, vist the [Members plugin home page](http://themehybrid.com/plugin/members).
30
+
31
+ ### Like this plugin?
32
+
33
+ The Members plugin is a massive project with 1,000s of lines of code to maintain. A major update can take weeks or months of work. I don't make any money directly from this plugin while other, similar plugins charge substantial fees to even download them or get updates. Please consider helping the cause by:
34
+
35
+ * [Making a donation](http://themehybrid.com/donate).
36
+ * [Signing up at my site](http://themehybrid.com/club).
37
+ * [Rating the plugin](https://wordpress.org/support/view/plugin-reviews/members?rate=5#postform).
38
 
39
  ### Professional Support
40
 
41
+ If you need professional plugin support from me, the plugin author, you can access the support forums at [Theme Hybrid](http://themehybrid.com/board/topics), which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 60,000+ users (and growing).
42
 
43
  ### Plugin Development
44
 
45
  If you're a theme author, plugin author, or just a code hobbyist, you can follow the development of this plugin on it's [GitHub repository](https://github.com/justintadlock/members).
46
 
 
 
 
 
47
  == Installation ==
48
 
49
  1. Upload `members` to the `/wp-content/plugins/` directory.
50
  2. Activate the plugin through the 'Plugins' menu in WordPress.
51
+ 3. Go to "Settings > Members" to select which settings you'd like to use.
52
 
53
  More detailed instructions are included in the plugin's `readme.html` file.
54
 
58
 
59
  I wasn't satisfied with the current user, role, and permissions plugins available. Yes, some of them are good, but nothing fit what I had in mind perfectly. Some offered few features. Some worked completely outside of the WordPress APIs. Others lacked the GPL license.
60
 
61
+ So, I just built something I actually enjoyed using.
62
 
63
  ### How do I use it?
64
 
65
+ Most things should be fairly straightforward, but I've included an in-depth guide in the plugin download. It's a file called `readme.md` in the plugin folder.
 
 
66
 
67
+ You can also [view the readme](https://github.com/justintadlock/members/blob/master/readme.md) online.
68
 
69
  ### I can't access the "Role Manager" features.
70
 
74
 
75
  ### Help! I've locked myself out of my site!
76
 
77
+ Please read the documentation for the plugin before actually using it, especially a plugin that controls permissions for your site. I cannot stress this enough. This is a powerful plugin that allows you to make direct changes to roles and capabilities in the database.
78
+
79
+ You'll need to stop by my [support forums](http://themehybrid.com/board/topics) to see if we can get your site fixed if you managed to lock yourself out. I know that this can be a bit can be a bit scary, but it's not that tough to fix with a little custom code.
80
 
81
  == Screenshots ==
82
 
83
+ 1. Role management screen
84
+ 2. Edit role screen
85
+ 3. Content permissions meta box (edit post/page screen)
86
+ 4. Plugin settings screen
87
+ 5. Select multiple roles per user (edit user screen)
88
 
89
  == Changelog ==
90
 
91
+ The change log is located in the `changelog.md` file in the plugin folder. You may also [view the change log](https://github.com/justintadlock/members/blob/master/changelog.md) online.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
{includes → templates}/comments.php RENAMED
@@ -1,12 +1,9 @@
1
  <?php
2
  /**
3
  * This file is used to disable the comments and comments form from showing comments on posts that a user
4
- * doesn't have access to. The use of this file assumes that the theme properly uses the comments_template()
5
- * function. This is required because the plugin hooks into the 'comments_template' filter hook to load this
6
  * empty file.
7
  *
8
- * @since 0.1.0
9
- * @package Members
10
- * @subpackage Template
11
  */
12
- ?>
1
  <?php
2
  /**
3
  * This file is used to disable the comments and comments form from showing comments on posts that a user
4
+ * doesn't have access to. The use of this file assumes that the theme properly uses the comments_template()
5
+ * function. This is required because the plugin hooks into the 'comments_template' filter hook to load this
6
  * empty file.
7
  *
8
+ * Theme authors can overwrite this with a `comments-no-access.php` template in their themes.
 
 
9
  */