I am trying to outline a new project where I want to give my users the ability to customize their ‘profile’ pages in my website theme. Concepts like adding in their own background images, choosing templates etc.
It seemed logical to me to store this information in the author meta, as that seems to be the only table that stores unique information for each user. Once I have input boxes setup then I can easily make the calls in my theme.
Users don’t appear to be post-types, or taxonomies, but I can’t figure out what they ‘really’ are. Could someone take a moment to describe what ‘users’ really are in the eyes of WordPress?
What I was ultimately hoping for is to find a class where I can easily add metaboxes to the edit author profile pages.
I do know how to extend profile fields via forms, but I am looking for something much more flexible.
*I use the farinspace metabox class for my post-types and absolutely love how it works, really hoping I can use something similar for the author pages..
Is any of this possible, or is there a better route I should take?
Authors are rather simple content objects in WordPress. They have roles and capabilities, some basic meta data and their own edit screens. Thatâs it pretty much. If you want to add a custom taxonomy to authors you have to mirror each user with a (hidden) custom post type because the author object doesnât support taxonomies â¦
Anyway ⦠for meta boxes I have written a simple class. I hope it helps to understand how things work and where to hook in.
class T5_User_Profile_Addon
Usage
Example: a checkbox
In some cases you may want to extend the class to change some behavior. Here I built a checkbox:
My primitive template system may not be the best approach. There is no user friendly error handling. I just needed something that works and is easy to understand. 🙂
/wp-admin/user-edit.php
:do_action( 'show_user_profile', $profileuser );
. Try hooking your call to the metabox there. If it doesn’t work, you should take a look on which scripts get added for post edit screens and add them there too.