WordPress.org

Forums

[resolved] Author.php just won't work (12 posts)

  1. starry1
    Member
    Posted 9 years ago #

    Try as I might I can not understand how to get a working author profile page. I created author.php but any coding I use within it brings up nothing. I have searched and searched for an answer and came across this:
    http://guff.szub.net/get-author-profile

    But I still do not understand what I am supposed to do once the plugin is installed adding:

    <?php get_author_profile(auth_ID); ?>

    ID being 1, brought up nothing.

    I am currently using this:

    <?php include "header.php"; ?>
    <?php if(isset($_GET['author_name']) || isset($_GET['author'])) :
    if($_GET['author_name']) :
    $curauth = get_userdatabylogin($_GET['author_name']);
    else :
    $curauth = get_userdata($_GET['author']);
    endif;
    ?>

    <h3>You're currently viewing <?php echo $curauth->user_firstname; ?> <?php echo $curauth->user_lastname; ?>'s page of posts:</h3>

    <?php endif; ?>

    With no effect.

    I'd like a page which shows all users. Name, profile, possibly a pic etc on one page. Like this:

    Name: Starry
    Level: 10
    Posts: 50
    AIM: xxx
    Profile: xxxx

    Name: Sam
    Level: 3
    etc...

    I'm very confused and would like a straight forward answer as to where I have gone wrong please.

    Many thanks in advance.

  2. Michael Bishop

    Posted 9 years ago #

    you don't need to create the page, so much as use the write page feature.
    http://codex.wordpress.org/Pages

  3. Michael Bishop

    Posted 9 years ago #

    kafkaesqui is around, and that's his plugin, so I'll let him explain how to utilize it.

  4. starry1
    Member
    Posted 9 years ago #

    I wrote a page to use the feature in which does not work. I forgot to post it sorry.

    http://neo-ilove.com/neopets/?page_id=13

    I do know how to create pages and page templates but this one area is baffling me.

  5. Kafkaesqui

    Posted 9 years ago #

    Paste the source for your author.php template here:

    http://paste.uni.cc

    And reply back with the url you get. We'll go from there.

  6. Kafkaesqui

    Posted 9 years ago #

    Also, just to clarify: are you trying to set up an author.php, or a template for an author Page? They are not the same.

  7. starry1
    Member
    Posted 9 years ago #

    Paste.uni.cc does not work for me I'll post it here seeing as it's short:

    Author.php
    http://paste.uni.cc/7498 [edit] it worked finally

    I am trying do to do both I assume but since I have already created author.php I'm guessing it is the template that is the problem.

  8. Kafkaesqui

    Posted 9 years ago #

    The isset($_GET['author_name']) stuff will not work because you don't pass an author_name/author query to the Page. The posts will also not show up.

    Basically what you have there is for setting up an author.php -- that is a template for author queries. author.php is what you could call a primary template, like archive.php or single.php, and is used when someone queries your blog by author, such as

    site.com/?author=1
    site.com/author/bob/

  9. starry1
    Member
    Posted 9 years ago #

    So if I then create links as such

    neo-ilove.com?author=1

    I will get a profile for my user??

    How do I pass a user name to my profile page? I don't understand that.

  10. Kathy_P
    Member
    Posted 9 years ago #

    The easiest way to pass a user name to the author template is to use one of the following template tags
    <?php the_author_posts_link(); ?>
    <?php wp_list_authors(); ?>
    <?php list_authors(); ?>
    somewhere else on your site, such as in The Loop or on your sidebar. (The first template tag mentioned can only be used in The Loop.)

    However, the author template is only meant to display information for one author at a time. If you want to show all your authors on the same page, I think you will have to do something similar to this thread. I am working on this at the moment. If you want to see what mine looks like, go here. It needs some work with the formatting of it, but it is basically doing what I want it to.

    But I have been having trouble with the same piece of code as you are in my author template, as described in this thread. It works for some authors and not others, and I don't know why.

  11. starry1
    Member
    Posted 9 years ago #

    Oh thank you Kathy! That worked great! It's now working with a list of authors at the top of the page and the current users profile underneath.

    Thanks a bunch :D

  12. Kathy_P
    Member
    Posted 9 years ago #

    Glad to be of help--I've certainly had a lot of help from others myself.

Topic Closed

This topic has been closed to new replies.

About this Topic