Skip to content

Author roles are hardcoded and cannot be adjusted #4

@pmilanowicz-finder

Description

@pmilanowicz-finder

The issue is that you cannot alter the author's roles you would like to cache. It would be helpful if you can do that, for example, when your WP instance has additional roles defined with some custom capabilities.

File: admin10x/admin10x.php:118

Before:

add_action('set_user_role', function($user_id, $role)  {
  $a10x = new Admin10X();
  $author_roles = array('administrator', 'author', 'editor');

  if ( in_array($role, $author_roles)) {
    $a10x->add_author($user_id);
  } else {
    $a10x->del_author($user_id);
  }
}, 10, 3);

After:

add_action('set_user_role', function($user_id, $role)  {
  $a10x = new Admin10X();
  $author_roles = apply_filters('admin10x_author_roles', array('administrator', 'author', 'editor'));

  if ( in_array($role, $author_roles)) {
    $a10x->add_author($user_id);
  } else {
    $a10x->del_author($user_id);
  }
}, 10, 3);

I would love to contribute to the project if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions