0

Users are required to login to my site. They are redirected to the login page and not allowed past the login page until they authenticate. Once authenticated, they can access most of the website. However, there are going to be about 100 users who I want to tag as being special members. I'm currently following the bad practice of hard-coding their emails in a global array within my functions.php file.

It works but I'm looking for a more practical solution. I would like the community's expertise on how to define boolean fields on the User table (e.g. is_favorite_member) More specifically, I want control over who can read and write to this field. At a bare minimum, I want Users with Admin capabilities (such as Install Plugins permission) to be able to read/write to this field, and no one else.

If the logged-in users' is_favorite_member field is TRUE, then I want to display (append) a menu item to the twentysixteen menu bar "Content for Favorite Member Menu Item". Furthermore, when clicked, the href value of this appended menu item would direct the user to a standard page "Content for Favorite Member Page" that i will build using Add Pages. If a user is not logged in or their is_favorite_member field is FALSE, then the "Content for Favorite Member Menu Item" should not be appended to my menu items, and any attempt to directly access the "Content for Favorite Member Page" should be handled by redirecting the user to the homepage.

Thank you so much!

0

To store user–specific information WordPress has a user meta, pretty much identical to post meta (also known as custom fields). See get_user_meta() and related functions.

Unfortunately WP doesn't provide any interface or interface helpers for it. You would have to implement that yourself, probably hooking into user profile screen.

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.