[ad_1] Last week, WPBeginner released Comment Moderation Role to the WordPress plugin directory. The plugin does a simple job of creating a single user role that can only moderate comments. The most common use case for such a role — named “WPB Comment Moderator” in the admin — is for larger teams that need a separate user account to tackle moderation. WordPress has no built-in way of handling this. For one of the most extendable CMSs on the planet, this is one area where it has always fallen short. It almost feels like yesterday. In reality, it was 10 years ago when I stumbled upon a (then) year-old ticket for a bug that was a breaking point in a project I was working on. I needed to grant specific users on a WordPress site permission to moderate comments but not allow them to edit other things in the admin. Some of you may be thinking that the moderate_comments capability should allow that. And, you would be correct in thinking that it should. However, that is not how it works at all. For users to edit comments, they must also be able to edit posts. It is a bit of a convoluted mess if you do a deep dive into the core code only to find hard-coded permissions checks that are impossible to override without rewriting large chunks of code. I would run into the same issue multiple times in the years since. I have built a few hacky, one-off workarounds for specific projects, but they were never ideal. And, I was never interested in maintaining a plugin that solved this problem because I knew it had the potential to be a bit of a pain. While I have seen a few other solutions, each fundamentally flawed, I am happy to see someone tackling this without exposing permissions issues. WPBeginner’s Comment Moderation Role plugin works in the same way that I think such a plugin should work, at least with the roadblocks that WordPress currently puts in the way. Site administrators can add WPB Comment Moderator to any account via the user management admin screen. The process is the same as adding or removing any other role in WordPress. Granting the WPB Comment Moderator role to a user. After adding the role to a user, that user can access the Comments admin screen. They can also see both the Dashboard and their own Profile in the admin. Except in the cases where they have another role added via a different plugin, they will not have permission to access other screens. Comments admin screen for user with the WPB Comment Moderator role Because of core WordPress’s hard-coded permissions check, the plugin must create its own comments management screen. Most users will not notice this because it is all under the hood. The plugin only adds it when necessary, and it does not look or function any differently than the default screen. It is just a lot of code work and duplication to fix an 11-year-old reported bug in WordPress. Until the foundational issue is addressed in core WordPress, Comment Moderation Role is the best plugin for this job. After extensive testing, I can now say that it is now nestled firmly in my toolbox, ready to pull out when needed for a project. Like this: Like Loading… [ad_2] Source link
Continue readingTag Archives: Comment
Add Editor-Only Notes via the Markdown Comment Block WordPress Plugin – WP Tavern
[ad_1] Rich Tabor, the Senior Product Manager of WordPress Experience at GoDaddy, tweeted that he had an idea for a new block at the end of last week. Shortly after, the Markdown Comment Block plugin appeared on WordPress.org. The plugin is a one-off block. It allows users to enter notes directly into the post editor that will not appear on the front end of the site. Tabor said he came up with the idea when working on an article for building single-block plugins. There are few things I love more than simple plugins with a tight focus, performing a single function. Markdown Comment Block lands in this category. The plugin creates a new block that works nearly the same as a typical Paragraph block: Adding inline comments to a post. Users can change the text color, but they will not have access to the typical Rich Text controls. Those should be unnecessary anyway. As someone who does long-form writing almost exclusively in Markdown, the block’s use of the double percent-sign syntax for comments intrigued me. Technically, the Markdown spec does not support any sort of special characters for them. It handles HTML comments. However, those appear in the source code on the front end when the document is rendered. I have only seen the %% mark to denote comments in the Inspire Writer app for Windows. Tabor said he had seen the same in Ulysses. The feature also exists in the Iceberg editor for WordPress, which Tabor created alongside Jeffrey Carandang. The plugin also introduces the %% keyboard shortcut. Typing it directly in the editor will create a new Markdown Comment block. My primary use case for the plugin would be leaving notes for my later self. However, it could also be handy in users’ publishing flows. The block adds a “Resolve” button to the toolbar. Clicking it deletes the comment. Clicking the “Resolve” button will delete the block. The block itself will not likely offer a robust enough feature set for complex workflows. However, pairing it with a plugin like Post Descriptions could round out the experience for larger teams of writers and copyeditors. The Post Descriptions plugin allows users to add notes on the post level. These notes appear on the post-management screen, letting other team members know when to check an article. However, it may be hard to provide the full context of what issues need to be resolved before publishing. Markdown Comment Block adds an inline comments system, letting team members pass in-text notes. Theme developers should appreciate that the block uses CSS custom properties too, which makes it easy to overwrite its default style rules. In moments, I was able to make it match my theme: Custom color, font, and line-height styles. The –markdown-comment-font-size, –markdown-comment-line-height, and –markdown-comment-color variables are available for theme developers who want to add in support. The one complaint I had about the block is its title: “Comment.” It is easy to confuse it with the six other comment-related blocks already in the WordPress block list. And, there will only be more in upcoming versions. Giving it a title of “Markdown Comment” would better distinguish it from others. Like this: Like Loading… [ad_2] Source link
Continue reading