Add Editor Role to CSS output in tpl-comment.php
-
Hi – we have a project where there are a handful of users with the Editor role who are moderating comments.
On line 43 of tpl-comment.php – there is a check to determine what kind of user is leaving the comment to apply a css class.
Would you be open to adding “Editor” as a role to check for? Otherwise, I’m not seeing how I could accomplish what I want with a filter/action in my functions.php and so I’ve had to edit tpl-comment.php directly.
// first it checks if ‘administrator’ is in user roles then I added:
} else if (in_array('editor', $user->roles)) { $wc_author_class = 'wc-blog-admin'; $author_title = $this->wc_options_serialized->wc_phrases['wc_user_title_admin_text']; }
In my case I already added CSS to target wc-blog-admin so for me no problem to just copy that over.
I thought of perhaps messing with the $user->roles to make users with the Editor in the roles to also have admin… but decided against it… I think that would cause those users to actually have administrator access, which I don’t want.
Anyhow – if you set $wc_author_class = ‘wc-blog-editor’ on the next update that would be rad. I’d just add that to the CSS.
Or perhaps a UI to allow us to choose what CSS classes will be added for what roles…
OTW with each update, I gotta go in and re-edit tpl-comment.php
Or… if you can give me a hint on what function / action I could add to functions.php to accomplish what I’m doing by editing the plugin directly — I’d be grateful!
- The topic ‘Add Editor Role to CSS output in tpl-comment.php’ is closed to new replies.