1

This is the first time in a while that I'm developing a site in EE2 that will use a moderated comment system. I'd like to make it really clear for the moderators when there are comments pending, but I'm struggling with how to do so.

The only place I can find in EE2 that indicates the number of pending comments is the CP Home dashboard, on the fourth line under "Modify or delete." That's not really as clear as I'd hoped. Plus, I was planning to show Structure on login for moderators, rather than the dashboard.

I'd love to be able to have a badge in the top nav of the CP that would show how many comments are pending. Or an accessory in the footer. But I can't find a supported add-on that serves this function. (Two possibilities in devot-ee — Comment Badge or Mini CP — are defunct.)

Any suggestions?

4
  • Have you considered just crafting your own Accessory? They are very easy: docs.expressionengine.com/v2/development/accessories.html you can then just use one of these functions (add_js_script) and use jQuery to insert your data somewhere in the page. Just a thought!
    – jrothafer
    Dec 16 '15 at 17:09
  • Thanks for the suggestion! I'm not opposed to learning, and maybe this is a simple way to get my feet wet with add-on development. But my relative lack of PHP skills is one of the many reasons I use EE. So I thought I'd check to see if someone with more chops had tackled this.
    – Matt V
    Dec 16 '15 at 19:18
  • Also bear in mind that Accessories were discontinued starting with EE 3. Not necessarily an issue as such, of course, if you intend to stay on EE 2 for a while.
    – Ingmar
    Dec 16 '15 at 19:43
  • Good to know. I'm not quite ready to make the move to EE3, but I'll keep that in mind.
    – Matt V
    Dec 16 '15 at 20:17
0

I am afraid you'd need a custom SQL query for that. Try this:

{exp:query 
    sql=" SELECT COUNT(*) AS pending FROM `exp_comments` WHERE status = 'p' "}
    There are {pending} comments pending.
{/exp:query}
4
  • Thanks, Ingmar. That's helpful. Maybe if I can't figure out how to highlight it in the CP, the next best solution will be to add a notification to the frontend for logged-in moderators. And I assume this will be much less heavy than calling the {exp:comments:entries} loop.
    – Matt V
    Dec 16 '15 at 19:23
  • Sorry, I thought you were building an admin landing page for your editors. In the backend, an accessory will be the way to go, as suggested. Even there you'll eventually need the query, though :)
    – Ingmar
    Dec 16 '15 at 19:42
  • I've built a lot of EE sites, but I never considered creating an admin landing page. That's a clever idea. I'll have to give that some more thought.
    – Matt V
    Dec 16 '15 at 20:16
  • When I say landing page it might sound more elaborate than it normally is, but I usually include some front-end editing capabilities in my sites (you know, "edit this" links etc.) and a few menu items (like "new article" or "activate pending members") only shown to admins with the proper permissions. I don't keep people actively out of the CP, but try to make their stay there as short as possible.
    – Ingmar
    Dec 16 '15 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.