No need to apologize, we’re here to help ??
My apologies for knowing nothing of userpro, thanks for bearing with me.
What you plan appears to be workable in a general sense, but I think there is room for improvement. If the first page a user sees is the home page, then that is where notification of a message should appear. It could just be an envelope icon the user clicks on that goes to your message page. It is only displayed to logged in users that have a pending message.
The messages could actually be in usermeta. Doing so could make coding easier, but messages in a custom DB structure will work as well. I urge you to avoid modifying WP tables though. Create your own table if you want to go this route. You’ll need a field to keep track of what messages the user viewed, and probably a date field as well.
The admin interface presents several possibilities. What makes the most sense depends on the expected nature of the messages. Are they mainly personal messages to one or a few users, or are they broadcast type messages that go to a large number of users, or perhaps even all?
I would be inclined to try to leverage the existing user listings to add in an administrative messaging facility. Knowing nothing of userpro, I can’t speak to how that may be achieved. It’s certainly achievable with the default user list tables. Building your own user list is certainly an option, but it’s rather redundant and could confuse new editors.
If you completely develop your own pages to handle this, you can make it be anything you want. For it to be better integrated into the site, you will need to make use of available hooks. The WP core has plenty of hooks, with userpro I have no idea.
I would first strive for what would be the best user experience. If the lack of available hooks makes that unmanageable, then maybe you fall back to a less integrated custom solution.
You’re largely own your own on this, especially the userpro portions. If you do get stuck, we’ll try to help you the best we can, but it may be limited.
One small parting tip. Do not use roles as arguments to current_user_can()
. Only supply capabilities as arguments. Yes, roles do work. This is mainly only for reverse compatibility. It’s intended for only capabilities to be used. Using roles defeats the overall intent of having capabilities separated from roles and limits the options available for managing users.