# Bug Report for Ashan Jay (MyEventON Support)
**Subject:** Regression in EventON 5.1.1: Non-admin backend users cannot assign, create, or edit locations/organizers (`current_user_can('edit_eventon')` called without `$post_id`)
---
Hi Ashan Jay / EventON Support,
Since upgrading from EventON **5.0.13** to **5.1.1** (regression introduced in 5.1 with *"FIXED: taxonomy editing restriction to higher permission level"*), all non-administrator backend users (`author`, `contributor`, and even `editor`) receive `"You do not have permission to perform this action."` whenever they try to assign an existing location/organizer, create a new one, or edit one in the WordPress backend event editor.
## Environment
- WordPress: 7.1.5
- EventON: 5.1.1 (worked in 5.0.13)
- EventON Action User: 2.5.17
- PHP: 8.2
## Root Cause
In `wp-content/plugins/eventON/includes/admin/class-admin-taxonomies_editor.php`, method `EVO_Taxonomies_editor::event_tax_save_changes()` (AJAX action `wp_ajax_eventon_event_tax_save_changes`), lines 152–155:
```php
// permission to save
if ( ! current_user_can('edit_eventon') && ! current_user_can('manage_eventon') ) {
wp_send_json_error( array( 'msg' => __('You do not have permission to perform this action.', 'eventon') ) );
}
```
1. `ajde_events` is registered with `'capability_type' => 'eventon'` and `'map_meta_cap' => true` (`includes/class-evo-post-types.php`, lines 209–210).
2. Because `edit_eventon` (singular) is a **meta capability** (`edit_post`), calling `current_user_can('edit_eventon')` **without passing `$post_id`** causes WordPress core `map_meta_cap()` to always return `['do_not_allow']` (`false`) — even for Administrators who explicitly hold `edit_eventon => true`.
3. Consequently, line 153 effectively checks only `current_user_can('manage_eventon')`. Since only Administrators have `manage_eventon`, every other role (`author`, `contributor`, `editor`) is blocked — even when the role has `edit_eventons`, `assign_eventon_terms`, and `edit_eventon_terms`.
4. Because line 153 runs before `switch ($post_data['type'])`, it blocks all three actions (`type = 'list'`, `type = 'new'`, and `type = 'edit'`) for both `event_location` and `event_organizer`. Opening the dropdown (`eventon_event_tax_list`) and opening the modal (`eventon_get_event_tax_term_section`) both check `edit_eventons` and succeed, so users only hit the permission error when clicking Save.
## Steps to Reproduce
1. Log in as a non-administrator user with `author` or `editor` role that holds `edit_eventons`, `publish_eventons`, and `assign_eventon_terms` (and no `manage_eventon`).
2. Open or create an event in the WordPress backend (`/wp-admin/post-new.php?post_type=ajde_events`).
3. In the Event Location (or Event Organizer) metabox, click **Select** and choose an existing location, or click **Add New** and enter a new location.
4. Click **Save Settings** / **Save Changes**.
**Actual result:** AJAX returns `{"success":false,"data":{"msg":"You do not have permission to perform this action."}}`.
**Expected result:** Users who can edit the specific event (`edit_eventon` with `$event_id`) and hold `assign_eventon_terms` should be able to assign existing locations/organizers to that event, and users with `edit_eventon_terms` (or according to taxonomy permissions) should be able to edit terms.
## Suggested Fix
In `EVO_Taxonomies_editor::event_tax_save_changes()`:
1. Validate `$event_id = absint( $post_data['event_id'] ?? 0 )` first, and check the post-scoped capability instead of calling `edit_eventon` without an ID:
```php
if ( ! current_user_can('manage_eventon') ) {
if ( ! $event_id || ! current_user_can('edit_eventon', $event_id) || ! current_user_can('assign_eventon_terms') ) {
wp_send_json_error( array( 'msg' => __('You do not have permission to perform this action.', 'eventon') ) );
}
}
```
2. Separate permissions per `type` so fixing line 153 does not allow non-editors to overwrite shared locations/organizers used by other events:
- `type = 'list'` (assign existing term): allowed with `edit_eventon` (for `$event_id`) + `assign_eventon_terms`.
- `type = 'edit'` (modify existing term): require `current_user_can('edit_eventon_terms')` (or `manage_eventon`).
- `type = 'new'` (name collision, lines 206–240 / 309 / 325): when `term_exists($term_name, $tax)` finds an existing term, do not overwrite its description or `evo_tax_meta` unless the user has `edit_eventon_terms`.
3. Related note: `event_tax_remove()` (line 348) currently checks only `'read'` via `validate_request()`; adding a per-event `current_user_can('edit_eventon', $event_id)` check there would align it with the same permission model.
Thanks for looking into this!
- Dec 4,2026 AT 10:33AM - 3 hours ago