hello, I am currently making a page that holds info about all my authors and I can use code like this: $curauth->display_name; to get custom information about users, but I am not sure how to display the extra profiel fields your plugin adds 🙁
can you help me out there?
Also I would like to have another type of user defined fields, i.e. I want to let users enter their ZIP code, so instead of text fields, or date fields I’d need to be able to select something like: number field, and also limit the number of digits? maybe even have the feature to say min. 4 chars. max 6 chars? Is that possible?
The user options are pretty well documented. They should all be retrievable with “get_user_option($option_name, $user_id)”.
thx, but I wasn’t referring to the built-in user options but to the fields I can add via the REGISTER PLUS plugin, thats why I tagged this post with it…
Or can I get those similar to the built-in user options?
Try it out, I believe the get_user_option function uses the option name to grab the field from the database. Your fields are named exactly as you created them.
cool, that worked out.
still one more question:
how would I have to do it if I only want to show an options value if it has been entered?
here is what I currently figured out: http://www.die-kellerkinder.eu/about/
you can see that all option fields are displayed for all users although they did not fill the options in..
i.e. not everybody has a skype account… still for those that have I want to show it
just do an if true check like so:
<?php if( get_user_option($option_name, $user_id) ): echo get_user_option($option_name, $user_id); endif; ?>
thx. that really made my day. I now know how to check if a user is logged in and even how to check if the option has been filled in by the user 🙂 wow. I am halfway through designing a really nice all-authors page, still struggling with the design of it – will post here to show what can be done with this information and the register plus plugin.
did it actually work for you?
i’m having problems as all calls to my variables return blank values!
Psycolor: Make sure you’ve got the option name correct. The field name should be exactly as you named it in the plugin. If you’re not 100% sure, check the source code of your registration page for the name.
ok, i banged my head all afternoon with this issue and no matter which form i put it in the
function doesn’t return anything, however the
get_currentuserinfo()returned what i need!
this is the sample code:
<?php get_currentuserinfo(); echo('Username: ' . $userdata->user_login . "\n"); echo('user_ md5: '. $userdata->user_pass . "\n"); echo('User level: ' . $userdata->user_level . "\n"); echo('User ID: ' . $userdata->ID . "\n"); echo('sex: ' . $userdata->gender . "\n"); ?>
i admit that i’m not a php expert and it seems that both the
get_userdata() and get_currentuserinfo() are not very well documented in the codex. hopefully somebody with a better php knowldege will help to fill the gap.
for everyone else just needing to make it work for their use, the $userdata array should do!
This is very odd. I’ve used the get_user_option($option_name, $user_id) function with RegisterPlus options in my own website, without fail.
I would suggest, for future use, to make sure you’ve got the option name properly formatted and are actually showing the user’s id.
yes it worked out perfectly. I use something like this:
echo '<p>Website: '.'<a href="'.get_user_option('user_url', $curauth->ID).'" title="Personal website">'.get_user_option('user_url', $curauth->ID).'</a></p>';
or something like this:
<?php if( get_user_option(description, $curauth->ID) ): echo get_user_option(description, $curauth->ID); endif; ?>
what version of wordpress are you using?
For reference i’m using the latest 2.6.1 and for whatever reason i can’t get the function to work like you, but the format of my previous reply does work fine…
I have used WP 2.5, 2.5.1, 2.6, and 2.6.1 with RegPlus and the option functions discussed above.
to be honest, my tempalte file contains more than this code.. how about this:
// Get the authors from the database ordered by user nicename global $wpdb; $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename"; $author_ids = $wpdb->get_results($query);
and later on:
// Loop through each author foreach($author_ids as $author) : // Get user data $curauth = get_userdata($author->ID);
🙂 there is more to it, but basically I based my all authors page on this tutorial: http://justintadlock.com/archives/2008/06/09/doing-more-with-gravatars-authors-template-page
- The topic ‘[Plugin: Register Plus] making an all authors page’ is closed to new replies.