settings-template.php
10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
/*
* User Role Editor WordPress plugin options page
*
* @Author: Vladimir Garagulia
* @URL: https://role-editor.com
*
*/
$tabs_index = array();
?>
<div class="wrap">
<a href="http://role-editor.com">
<div id="ure-icon" class="icon32"><br></div>
</a>
<h1><?php esc_html_e( 'User Role Editor - Options', 'user-role-editor' ); ?></h1>
<div id="ure_tabs" style="clear: left;">
<ul>
<li><a href="#ure_tabs-1"><?php esc_html_e( 'General', 'user-role-editor' );?></a></li>
<?php
$tabs_index['1'] = 0;
if ( ! $license_key_only ) {
if ( $lib->is_pro() || ! $multisite ) {
?>
<li><a href="#ure_tabs-2"><?php esc_html_e( 'Additional Modules', 'user-role-editor' ); ?></a></li>
<?php
$tabs_index['2'] = 1;
}
?>
<li><a href="#ure_tabs-3"><?php esc_html_e( 'Default Roles', 'user-role-editor' ); ?></a></li>
<?php
$tabs_index['3'] = count( $tabs_index );
if ( $multisite && ( $lib->is_pro() || $lib->is_super_admin() ) ) {
?>
<li><a href="#ure_tabs-4"><?php esc_html_e( 'Multisite', 'user-role-editor' ); ?></a></li>
<?php
$tabs_index['4'] = count( $tabs_index );
}
}
?>
<li><a href="#ure_tabs-5"><?php esc_html_e( 'Tools', 'user-role-editor' );?></a></li>
<?php
$tabs_index['5'] = count($tabs_index);
?>
<li><a href="#ure_tabs-6"><?php esc_html_e( 'About', 'user-role-editor' );?></a></li>
</ul>
<div id="ure_tabs-1">
<div id="ure-settings-form">
<form method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_settings">
<?php
if ( ! $license_key_only ) {
?>
<tr>
<td>
<input type="checkbox" name="show_admin_role" id="show_admin_role" value="1" <?php checked( $show_admin_role, 1 ); ?>
<?php echo defined( 'URE_SHOW_ADMIN_ROLE' ) ? 'disabled="disabled" title="Predefined by \'URE_SHOW_ADMIN_ROLE\' constant at wp-config.php"' : ''; ?> />
<label for="show_admin_role"><?php esc_html_e( 'Show Administrator role at User Role Editor', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="caps_readable" id="caps_readable" value="1"
<?php checked( $caps_readable, 1); ?> />
<label for="caps_readable"><?php esc_html_e( 'Show capabilities in the human readable form', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="show_deprecated_caps" id="show_deprecated_caps" value="1" <?php checked( $show_deprecated_caps, 1 ); ?> />
<label for="show_deprecated_caps"><?php esc_html_e( 'Show deprecated capabilities', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="confirm_role_update" id="confirm_role_update" value="1" <?php checked( $confirm_role_update, 1 ); ?> />
<label for="confirm_role_update"><?php esc_html_e( 'Confirm role update', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="edit_user_caps" id="edit_user_caps" value="1" <?php checked( $edit_user_caps, 1 ); ?> />
<label for="edit_user_caps"><?php esc_html_e( 'Edit user capabilities', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<tr>
<td>
<?php esc_html_e( 'Show capabilities in', 'user-role-editor' ); ?>
<select name="caps_columns_quant" id="caps_columns_quant">
<option value="1" <?php selected( $caps_columns_quant, 1 ); ?> >1</option>
<option value="2" <?php selected( $caps_columns_quant, 2 ); ?> >2</option>
<option value="3" <?php selected( $caps_columns_quant, 3 ); ?> >3</option>
</select>
<?php esc_html_e( 'columns', 'user-role-editor' ); ?>
</td>
<td>
</td>
</tr>
<?php
}
do_action( 'ure_settings_show1' );
?>
</table>
<?php wp_nonce_field( 'user-role-editor' ); ?>
<input type="hidden" name="ure_tab_idx" value="0" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_settings_update" value="<?php esc_html_e( 'Save', 'user-role-editor' ) ?>" />
</p>
</form>
</div>
</div> <!-- ure_tabs-1 -->
<?php
if ( ! $license_key_only ) {
if ( $lib->is_pro() || ! $multisite ) {
?>
<div id="ure_tabs-2">
<form name="ure_additional_modules" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_addons">
<?php
if ( ! $multisite ) {
?>
<tr>
<td>
<input type="checkbox" name="count_users_without_role" id="count_users_without_role" value="1" <?php checked( $count_users_without_role, 1 ); ?> />
<label for="count_users_without_role"><?php esc_html_e( 'Count users without role', 'user-role-editor' ); ?></label></td>
<td>
</td>
</tr>
<?php
}
?>
<?php
do_action( 'ure_settings_show2' );
?>
</table>
<?php wp_nonce_field( 'user-role-editor' ); ?>
<input type="hidden" name="ure_tab_idx" value="1" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_addons_settings_update" value="<?php esc_html_e('Save', 'user-role-editor') ?>" />
</form>
</div>
<?php
}
?>
<div id="ure_tabs-3">
<form name="ure_default_roles" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<?php
if ( ! $multisite ) {
esc_html_e( 'Primary default role: ', 'user-role-editor' );
echo $view->role_default_html;
?>
<hr>
<?php
}
?>
<?php esc_html_e( 'Other default roles for new registered user: ', 'user-role-editor' ); ?>
<div id="other_default_roles">
<?php self::show_other_default_roles(); ?>
</div>
<?php
if ( $multisite ) {
echo '<p>'. esc_html__( 'Note for multisite environment: take into account that other default roles should exist at the site, in order to be assigned to the new registered users.', 'user-role-editor' ) .'</p>';
}
?>
<hr>
<?php wp_nonce_field( 'user-role-editor' ); ?>
<input type="hidden" name="ure_tab_idx" value="<?php echo $tabs_index[3]; ?>" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_default_roles_update" value="<?php esc_html_e( 'Save', 'user-role-editor' ) ?>" />
</p>
</form>
</div> <!-- ure_tabs-3 -->
<?php
if ( $multisite && ( $lib->is_pro() || $lib->is_super_admin() ) ) {
?>
<div id="ure_tabs-4">
<div id="ure-settings-form-ms">
<form name="ure_settings_ms" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
<table id="ure_settings_ms">
<?php
if ( $lib->is_super_admin() ) {
?>
<tr>
<td>
<input type="checkbox" name="allow_edit_users_to_not_super_admin" id="allow_edit_users_to_not_super_admin" value="1"
<?php checked( $allow_edit_users_to_not_super_admin, 1 ); ?> />
<label for="allow_edit_users_to_not_super_admin"><?php esc_html_e( 'Allow non super administrators to create, edit, and delete users', 'user-role-editor' ); ?></label>
</td>
<td>
</td>
</tr>
<?php
}
do_action( 'ure_settings_ms_show' );
?>
</table>
<?php wp_nonce_field( 'user-role-editor' ); ?>
<input type="hidden" name="ure_tab_idx" value="<?php echo $tabs_index[4]; ?>" />
<p class="submit">
<input type="submit" class="button-primary" name="ure_settings_ms_update" value="<?php esc_html_e( 'Save', 'user-role-editor' ); ?>" />
</p>
</form>
</div> <!-- ure-settings-form-ms -->
</div> <!-- ure_tabs-4 -->
<?php
}
} // if (!$license_key_only) {
?>
<div id="ure_tabs-5">
<?php
URE_Tools::show( $tabs_index[5] );
?>
</div> <!-- ure_tabs-5 -->
<div id="ure_tabs-6">
<?php
$lib->about();
?>
</div> <!-- ure_tabs-6 -->
</div> <!-- ure_tabs -->
</div>
<?php
URE_View::output_confirmation_dialog();
?>
<script>
jQuery(function($) {
$('#ure_tabs').tabs();
<?php
$ure_tab_idx = (int) $ure_tab_idx;
if ($ure_tab_idx>0 && $ure_tab_idx<=count($tabs_index)) {
?>
$('#ure_tabs').tabs('option', 'active', <?php echo $ure_tab_idx; ?>);
<?php
}
?>
});
</script>