WordPress.org

Ready to get started?Download WordPress

Forums

Author profile pages for post-less authors...close to a solution (3 posts)

  1. kalico
    Member
    Posted 6 years ago #

    I am trying to create author pages on http://www.christianbirth.org and I've hit a wall.

    According to http://codex.wordpress.org/Author_Templates I need to create the links first -- that works fine. These links pass the author name to the author.php page -- this works fine too.

    However, I want to have profile pages for folks who have not posted anything yet. So I made some mods (to the core!! ack!) to create the links for post-less authors -- which works, but they don't obey the template hierarchy: they go to the index.php instead of author.php.

    Not understanding exactly how or why the hierarchy works the way it does, I figured the best solution might just be to modify the index.php page with a conditional statement. So I did this (before the Loop):

    <!-- This sets the $curauth variable -->
    <?php
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata(intval($author));
    endif;
    ?>
    
    <?php if (is_author()) : ?>
    <h2 style="background-color:#E0A5BB; padding: 5px"><?php echo $curauth->nickname; ?>'s page</h2>
    <dl>
    <dt>Website</dt>
    <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
    <dt>Profile</dt>
    <dd><?php echo $curauth->user_description; ?></dd>
    </dl>
    
    <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
    <?php endif; ?>
    
    <ul>

    This code works just peachy on my author.php page, but it doesn't do anything on my index.php page, even when author data is being passed to it from the link (and as I understand it, that is the ONLY way to pass that data to the template page....no?)

    Now, if I change the structure of the links to the default, not pretty permalinks, then it works. (Others have the same problem: http://wordpress.org/support/topic/84795)

    Compare:
    http://www.christianbirth.org/author/kikizee/

    to:
    http://www.christianbirth.org/?author=12

    (note: you can see which template is giving the result, by the file name at the end of the "no posts" message.)

    But I'd rather not revert these links to default, so I am looking for a fix, or a workaround. Fixing up the index.php file to accept and parse author data using conditionals would be fine....maybe I just need to get my code right.

    Any help or advice would be appreciated. :)

  2. allyanders
    Member
    Posted 6 years ago #

    I need to do the same thing. Unfortunately, I have no clue how to do it. :( Any luck finding something that works?

  3. Detective
    Member
    Posted 5 years ago #

    My plugin El Aleph does that :) You can have profiles for every user in your site, not just authors.

Topic Closed

This topic has been closed to new replies.

About this Topic