Support » Fixing WordPress » Author profile pages for post-less authors…close to a solution

  • I am trying to create author pages on and I’ve hit a wall.

    According to 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 -->
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata(intval($author));
    <?php if (is_author()) : ?>
    <h2 style="background-color:#E0A5BB; padding: 5px"><?php echo $curauth->nickname; ?>'s page</h2>
    <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
    <dd><?php echo $curauth->user_description; ?></dd>
    <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
    <?php endif; ?>

    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:



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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Author profile pages for post-less authors…close to a solution’ is closed to new replies.