The MU forums have moved to WordPress.org

Member profile pages -> author.php (5 posts)

  1. modifiedcontent
    Member
    Posted 17 years ago #

    I would like to have cliche member profile pages, with name, location, "hobbies", a picture, etc.

    I'd like to integrate this profile page in either the home page of the member's blog or the member's admin area.

    Visitors should also be able to reach the profile through an member name/author link in the posts.

    Apparently an author template is the way to go. There's a codex page that explains how to do it, but I can't make heads nor tails of it.

    The page is clearly written for people who understand PHP and The Loop. There are lots of code examples, but very few instructions where to put them.

    The codex page also talks a lot about generating lists of authors (or the profile itself?) in a sidebar, which is not what I want to do anyway.

    There's another thread about this issue that goes on forever and in all directions without reaching any clear conclusions.

    To be blunt, as a non-coder I'm not interested in the mechanism behind it and that's what the codex and thread focus on. All I need to know is what code to put where. I only have a general idea of what the code does. To really figure out these instructions and discussions I would have to learn PHP first.

    Can anyone give an example of an author.php that produces a member profile page and how to link to it? This page looks promising, but I have no clue how to use it.

  2. modifiedcontent
    Member
    Posted 17 years ago #

    I've saved the code below as author.php in my theme folder. Does that make sense? How to use/call this page?

    <?php
    if(('admin' != $user->user_login) && ($user->wp_user_level > 0)) :
    // if($user->wp_user_level > 0) :
    ?>

    <h3 id="user-<?php echo $user->ID; ?>" class="author-profile"><?php echo $user->first_name; ?> <?php echo $user->last_name; ?></h3>

    <?php
    $image_dir = 'images'; // directory where author images reside
    $image_file = $user->user_nicename; // format for image name
    $image_ext = 'jpg'; // author image extension

    $image_path = trim($image_dir, '/') . '/' . $image_file . '.' . $image_ext;
    if(file_exists(ABSPATH . $image_path)) :
    $author_image = get_bloginfo('home') . '/' . $image_path;
    ?>
    <img class="user-image" src="<?php echo $author_image; ?>" alt="<?php echo $user->display_name; ?>" title="<?php echo $user->display_name; ?>" />
    <?php endif; ?>

    <?php if($user->description) : ?>

    <strong>Profile:</strong>

    <?php echo $user->description; ?>

    <?php endif; ?>

    <?php if(get_usernumposts($user->ID) > 0) : ?>
    Number of posts: <a>ID, "$user->user_nicename"); ?>"><?php echo get_usernumposts($user->ID); ?></a>

    <?php endif; ?>

    <?php if($user->user_email) : ?>
    Email address:
    <a>user_email, 1); ?>"><?php echo antispambot($user->user_email); ?></a>

    <?php endif; ?>

    <?php if($user->user_url && !('http://' == $user->user_url)) : ?>
    Web site: <a>user_url; ?>"><?php echo $user->user_url; ?></a>
    <?php endif; ?>

    <?php if($user->aim) : ?>
    AIM screen name: <?php echo $user->aim; ?>

    <?php endif; ?>

    <?php if($user->yim) : ?>
    Yahoo ID: <?php echo $user->yim; ?>

    <?php endif; ?>

    <?php if($user->jabber) : ?>
    Jabber/Google ID: <?php echo antispambot($user->jabber); ?>

    <?php endif; ?>

    <?php if($user->msn) : ?>
    MSN ID: <?php echo $user->msn; ?>

    <?php endif; ?>

    <?php if($user->icq) : ?>
    ICQ number: <?php echo $user->icq; ?>

    <?php endif; ?>

    <?php
    endif; // end of admin and user_level test
    endforeach; // end of authors' profile 'loop'
    ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  3. drmike
    Member
    Posted 17 years ago #

    I answered you in the other thread but just in case:

    Is there no such thing as a public profile page in WP?

    Either that or grab the Misty Look theme and see how it's done on that theme.

  4. modifiedcontent
    Member
    Posted 17 years ago #

    Thanks drmike!

    I copied author.php in my theme folder and replaced
    <?php the_author() ?>
    in home.php with
    <?php the_author_posts_link() ?>
    to get a working author link at the posts.

    Still have a lot of customizing to do, but this works. :-)

    Are there more themes with author.php included? Or perhaps themes with interesting alternative uses of Dashboard + profile + home page?

  5. drmike
    Member
    Posted 17 years ago #

    IIRC Regulus does something like this but it has it's own page for that information instead of using the profile

About this Topic

  • Started 17 years ago by modifiedcontent
  • Latest reply from drmike