access-editor-template.php
7.26 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
<?php
$ameDialogClasses = array();
if ( isset($GLOBALS['wp_version']) && version_compare($GLOBALS['wp_version'], '5.3-RC1', '>=') ) {
$ameDialogClasses[] = 'ame-is-wp53-plus';
}
?>
<div id="ws_menu_access_editor" title="Permissions" class="<?php echo esc_attr(implode(' ', $ameDialogClasses)); ?>"
style="display: none">
<div class="ws_dialog_panel">
<div class="error inline" id="ws_hardcoded_role_error">
<p>
<strong>Note:</strong>
Only users with the "<span id="ws_hardcoded_role_name">[role]</span>" role
can access this menu. This restriction is hard­coded in the plugin that
created the menu.
</p>
</div>
<div id="ws_role_access_container" class="ws_dialog_subpanel ws_has_extended_permissions">
<div style="float: left; min-width: 352px;">
<strong>Grant access</strong>
<a class="ws_tooltip_trigger" title="
☑ = give access and show the menu.
<br>
☐ = prevent access and hide the menu.
<br><br>
Checking a box will also give that role the required capability (see below).
">[?]</a>
<br>
<div id="ws_role_table_body_container">
<div id="ws_role_access_overlay" class="ws_hide_if_pro"></div>
<div id="ws_role_access_overlay_content" class="ws_hide_if_pro">
Pro only feature.
Use capabilities (below) instead.
</div>
<table class="widefat ws_role_table_body">
<tbody>
<!-- Table contents will be generated by JavaScript. -->
</tbody>
</table>
</div>
</div>
<div id="ws_ext_permissions_container" class="ws_ext_readable_names_enabled">
<div id="ws_ext_permissions_container_caption">
<strong>
<span class="ws_aed_selected_actor_name">Role name</span>
<span class="ws_ame_breadcrumb_separator">»</span>
<span id="ws_ext_selected_object_type_name">Post type or taxonomy</span>
</strong>
<span id="ws_ext_toggle_capability_names" class="dashicons dashicons-editor-code"
title="Toggle capability names"></span>
<br>
</div>
<?php
$cpt_actions = array(
'General' => array(
'edit_posts' => 'Edit',
'publish_posts' => 'Publish',
'delete_posts' => 'Delete',
'create_posts' => 'Create',
),
'Published' => array(
'edit_published_posts' => 'Edit published',
'delete_published_posts' => 'Delete published',
),
'Others' => array(
'edit_others_posts' => 'Edit others',
'delete_others_posts' => 'Delete others',
),
'Private' => array(
'edit_private_posts' => 'Edit private',
'delete_private_posts' => 'Delete private',
'read_private_posts' => 'Read private',
),
);
?>
<table class="widefat ws_ext_permissions_table" id="ws_post_type_permissions_table">
<?php foreach($cpt_actions as $group => $actions): ?>
<tr>
<td class="ws_ext_group_title" colspan="2"><?php echo esc_html($group); ?></td>
</tr>
<?php foreach($actions as $action_key => $readable_name): ?>
<?php $checkbox_id = 'ws_cpt_action-' . $action_key; ?>
<tr class="ws_ext_action-<?php echo esc_attr($action_key); ?>">
<td class="ws_ext_action_check_column">
<input
type="checkbox"
id="<?php echo esc_attr($checkbox_id); ?>"
class="ws_ext_action_allowed"
data-ext_action="<?php echo esc_attr($action_key); ?>">
</td>
<td class="ws_ext_action_name_column">
<label for="<?php echo esc_attr($checkbox_id); ?>" class="ws_ext_action_name">
<?php echo esc_html($readable_name); ?>
</label>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<tr class="ws_ext_padding_row"><td colspan="2"></td></tr>
</table>
<?php
$taxonomy_actions = array(
'manage_terms' => 'Manage',
'edit_terms' => 'Edit',
'delete_terms' => 'Delete',
'assign_terms' => 'Assign',
);
?>
<table class="widefat ws_ext_permissions_table" id="ws_taxonomy_permissions_table">
<?php foreach($taxonomy_actions as $action_key => $readable_name): ?>
<?php $checkbox_id = 'ws_taxonomy_action-' . $action_key; ?>
<tr class="ws_ext_action-<?php echo esc_attr($action_key); ?>">
<td class="ws_ext_action_check_column">
<input
type="checkbox"
id="<?php echo esc_attr($checkbox_id); ?>"
class="ws_ext_action_allowed"
data-ext_action="<?php echo esc_attr($action_key); ?>">
</td>
<td class="ws_ext_action_name_column">
<label for="<?php echo esc_attr($checkbox_id); ?>" class="ws_ext_action_name">
<?php echo esc_html($readable_name); ?>
</label>
</td>
</tr>
<?php endforeach; ?>
<tr class="ws_ext_padding_row"><td colspan="2"></td></tr>
</table>
</div>
</div>
<div class="clear"></div>
<div id="ws_required_cap_container" class="ws_dialog_subpanel">
<strong>Required capability</strong>
<a class="ws_tooltip_trigger" title="
This capability check is hard-coded in WordPress or the plugin that created the menu.
<ul class="ws_tooltip_content_list">
<li>
Only roles with this capability will be able to access this menu.
<li>
Admin Menu Editor will automatically grant the required capability to
all roles you check in the "Roles" list.
<li>
Custom menus have no hard-coded capability requirements.
</ul>
">[?]</a>
<br>
<span id="ws_required_capability">capability_here</span>
</div>
<div id="ws_extra_cap_container" class="ws_dialog_subpanel">
<label for="ws_extra_capability">
<strong>Extra capability</strong>
</label>
<a class="ws_tooltip_trigger" title="
Optional. An additional capability check that will be applied on top of
the "Roles" and "Required capability" settings.
Leave empty to disable.
">[?]</a>
<br>
<input type="text" id="ws_extra_capability" class="ws_has_dropdown" value=""><input type="button" id="ws_trigger_capability_dropdown" value=""
class="button ws_dropdown_button" tabindex="-1">
</div>
<div id="ws_item_restriction_container" class="ws_dialog_subpanel">
<strong>Override submenus</strong>
<a class="ws_tooltip_trigger" title="
☑ = when this menu is hidden from a role or user, all of its submenu items will also be hidden
from that role or user.
<br><br>
☐ = this menu will stay visible as long as it has at least one visible submenu item.
<br><br>
In WordPress, submenu item permissions usually have precedence. Check the box to give this menu
precedence over its submenus (but only when it is hidden).
">[?]</a>
<br>
<label>
<input type="checkbox" id="ws_restrict_access_to_items">
Hide all submenu items when this item is hidden
</label>
</div>
</div>
<div class="ws_dialog_buttons">
<input type="button" class="button-primary" value="Save Changes" id="ws_save_access_settings">
<input type="button" class="button ws_close_dialog" value="Cancel">
</div>
</div>