• I see that the Record Edit access level lets users add, edit, and list records, but not delete them. That is restricted to the Plugin Admin access level. So I guess I have two questions:

    1. Why are users with Record Edit access able to add records but not delete them?
    2. Can I edit my site so that users with Record Edit access can do both?

    https://ww.wp.xz.cn/plugins/participants-database/

Viewing 1 replies (of 1 total)
  • Plugin Author Roland Barker

    (@xnau)

    You can use a filter to alter the privileges. This uses the API, so it’s expected you have some technical knowledge.

    The filter is named ‘pdb-access_capability’ which is used to filter all capability checks. The filter receives 2 values: the current capability (according to the plugin settings) and the context. The context tells you which functionality is getting its access controlled. The context value you’re looking for is “delete participants” Here is an example, you’ll need to modify it according to your needs.

    add_filter( 'pdb-access_capability', 'pdb_allow_editors_to_delete_records', 10, 2);
    
    function pdb_allow_editors_to_delete_records($cap, $context) {
      if ($context === 'delete participants') {
        $cap = 'edit_others_posts';
      }
      return $cap;
    }

    You’ll recognize the capability “edit_others_posts” as being one that identifies the user as at least an “editor,” so depending on what role you want to have the ability to delete records, you’ll need to select an appropriate capability for that role.

    Take a look at the WP codex page on roles and capabilities if this doesn’t make sense to you.

Viewing 1 replies (of 1 total)

The topic ‘Record Edit access level does not include delete’ is closed to new replies.