WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Register Plus] making an all authors page (20 posts)

  1. Ovidiu
    Member
    Posted 5 years ago #

    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?

  2. Ovidiu
    Member
    Posted 5 years ago #

    anyone out there?

  3. Haloscope
    Member
    Posted 5 years ago #

    The user options are pretty well documented. They should all be retrievable with "get_user_option($option_name, $user_id)".

    Good luck.

  4. Ovidiu
    Member
    Posted 5 years ago #

    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?

  5. skullbit
    Member
    Posted 5 years ago #

    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.

  6. Ovidiu
    Member
    Posted 5 years ago #

    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

  7. skullbit
    Member
    Posted 5 years ago #

    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;
    ?>
  8. Ovidiu
    Member
    Posted 5 years ago #

    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.

  9. lorenzo
    Member
    Posted 5 years ago #

    hi Ovidiu,

    did it actually work for you?

    i'm having problems as all calls to my variables return blank values!

  10. Haloscope
    Member
    Posted 5 years ago #

    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.

    - H

  11. lorenzo
    Member
    Posted 5 years ago #

    ok, i banged my head all afternoon with this issue and no matter which form i put it in the

    get_user_option($option_name, $user_id)

    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!

  12. Haloscope
    Member
    Posted 5 years ago #

    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.

    - H

  13. Ovidiu
    Member
    Posted 5 years ago #

    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;
    
    ?>
  14. lorenzo
    Member
    Posted 5 years ago #

    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...

  15. Haloscope
    Member
    Posted 5 years ago #

    I have used WP 2.5, 2.5.1, 2.6, and 2.6.1 with RegPlus and the option functions discussed above.

    - H

  16. Ovidiu
    Member
    Posted 5 years ago #

    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

    Good Luck

  17. Ovidiu
    Member
    Posted 5 years ago #

    and btw. right now Iuse:

    <?php if($user_ID): ?>

    to check if a user is logged on and then show him all details, but what if I would want to show all details only to users that are at least i.e. editors or authors?

  18. temi2004
    Member
    Posted 5 years ago #

    is there any way this register plus plugin could come with an automatic page to display all users (paged) ?

  19. nex2nun
    Member
    Posted 5 years ago #

    This is just what I was looking for, thank you!!!

  20. roughkut
    Member
    Posted 4 years ago #

    I can't get any of this to do what I need. I just don't understand.

    All I want is a member page that contains all the info from Register Plus, mainly the extra fields.

Topic Closed

This topic has been closed to new replies.

About this Topic