I am trying to replicate specific functionality from my vb forums in my wordpress install. Specifically I can create ‘user notices’ that are displayed on the front end of the website.
Basically I can create a post that only displays to non-logged in users, moderators, admins, etc.
My plan of attack is to create a custom post-type so that I can easily organize my notices. I am very comfortable working with post-types, and it seems logical.
2) When I create a new ‘notice post’ what would be the best way to ‘categorize’ it to target a specific group, i.e. – not-logged-in, moderator, subscriber, etc?
I was thinking about using a custom taxonomy so that I would select a term like ‘moderator’ in order to categorize the posts.
Where I get a bit stuck is how to best call the post on the front-end without resorting to a ton of if/else statements. (there can and will be about 20 conditions on a pretty high traffic site)
if tax_term = moderator then display x, else if not_logged_in display y, else…
2) One important condition is to be able to display the notices to users that have not posted a specific post-type ‘forum-topic’ within the last 30 days.
*Can someone provide me with a function that meets this specific condition?
If there is a better way to approach this, I am very open to other ideas. I did search the plugin directory for inspiration but really didn’t find anything.
I don’t see this as excessively heavy. Just use
current_user_can(). Obviously if user isn’t logged in then you can skip checking for any roles. I am not sure, but user data is probably held in memory so there will be no extra database calls and such.