Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Author roles are hardcoded and cannot be adjusted #4

Open
pmilanowicz-finder opened this issue Oct 23, 2020 · 0 comments
Open

Author roles are hardcoded and cannot be adjusted #4

pmilanowicz-finder opened this issue Oct 23, 2020 · 0 comments

Comments

@pmilanowicz-finder
Copy link

pmilanowicz-finder commented Oct 23, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant