I don’t work with bbPress that much, but when I do – every time I spend most of my time hunting for functions. I wish there was some sort of documentation developed over the years, but it hasn’t, and I know, I know – I haven’t helped either. So at the very least, I decided to write down some of the common things I do with bbPress, starting with getting the moderator role.
It is really that simple:
current_user_can( 'moderate' )
That’s it. There is your answer.
How I found out
I browsed the source for quite a while, until I stumbled on a function called
I would never, ever, ever have discovered that by guessing function names. I had to search files for the word “moderator” to eventually land on this piece of information.
Anyway. Now you know, and so do I. Caps are capabilities, and checking a moderator is as easy as
When you make stuff, please don’t save a few characters in function names by reducing capabilities to caps, unless it’s a standard practice, like “i18n” or “esc”.