i have been working on a custom system for my site where users can have a seperate account, setting and profile page to make my site a bit more interactive and community type. with some other additional stuff.
I am new to coding, i have managed to make the profile pages etc.
Right now i am stuck in adding a check box list of tags to user settings page. where a user can select multiple tags as interest.. so i can use those to show him recommended posts randomly on his account page .
i was able to add two extra fields (Twitter/facebook) in the settings page with this code :
function add_bkmrks_contactmethod( $bcontactmethods ) {
$bcontactmethods['Twitter'] = 'Twitter';
$bcontactmethods['Facebook'] = 'Facebook';
return $bcontactmethods;
}
add_filter('user_contactmethods','add_bkmrks_contactmethod',10,1);
and tehse can be easily called on pages as well by using $userinfo->Twitter
etc. but i have no clue about the checkboxlist… and calling the array etc.
If you guys came across any article or chunk of code which can help me get this resolved i wil be thankful 🙂
cheers
Ayaz
Justin Tadlock has a good tutorial to get you started:
http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields
There are some specifics to dealing with checkboxes however, and some custom code if you want to make checkboxes that correspond to tags/categories.
To generate the form fields and save the data use the following snippet:
You can then call the
get_the_author_meta()
function to get at your array of tag IDs which can then be used in a query eg: