WordPress.org

Forums

subscriber profile (13 posts)

  1. tommyill
    Member
    Posted 8 years ago #

    I have added a author template in the hopes of allowing all registered users regardless of role a profile page on the site. Here is the profile page of one of the admin level users: http://www.kixandthecity.com/author/maze

    FYI, here is the code that I have used to do this (in author.php template):

    <?php
    if(get_query_var('author_name')) :
    $curauth = get_userdatabylogin(get_query_var('author_name'));
    else : $curauth = get_userdata(get_query_var('author'));
    endif;
    ?>
    <h3><?php echo $curauth->nickname; ?></h3>
    <h4>Website:</h4>
    <p><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
    <h4>About <?php echo $curauth->nickname; ?></h4>
    <p><?php echo $curauth->user_description; ?></p>
    <h4>Other Users:</h4>
    <ul>
    <?php wp_list_authors('hide_empty=0&exclude_admin=0'); ?>
    </ul>

    I added the wp_list_authors just for testing, this will be removed once (if?) I can get this to work properly.
    As you can see from the list of users, only 2 (both admin level) have links to their profiles. I have tried substituting the username in the url but it just comes up with a 404 page.

    Is there any way that I can override WordPress' restriction limiting profile pages to those of author level or above?

    And a couple of side questions:
    Why does WordPress allow subscribers to fill out the profile at all (as well as see dashboard, etc.) if their profile can never be seen?

    Is the only benefit of registering that you don't have to fill out comment fields (which is also done with cookies for those who aren't registered so its not that much of a benefit)?

    Thanks for your help.

  2. klklaser
    Member
    Posted 8 years ago #

    Registration seems to give admin some control over spammers. See "Users must be registered and logged in to comment" option.

    I'm largely unfamiliar with the newer 2.x+ versions, so can't really help with other questions. Roles came with 2.0, if I recall correctly.

  3. tommyill
    Member
    Posted 8 years ago #

    I'm pretty sure the "Users must be registered and logged in to comment" has no effect on whether profile pages are active or not. I also believe the behavior I have described (no profile output page for lower access levels, but ability to edit profile, see limited areas of admin) was also present before the 2.0 additions of roles and capabilites.

  4. tommyill
    Member
    Posted 8 years ago #

    klklaser - I shouldn't have posted so fast, I understand what you are saying, with that setting, registering offers the benefit of being able to post. Good point.

  5. klklaser
    Member
    Posted 8 years ago #

    About Current Author

    "It is important to know that $curauth is not a WordPress variable, but a variable generated by PHP code and sent via a link as a query. Therefore, the author.php file must be requested via a link to the author page, which specifies an author. If you request the author.php page directly, you'll end up with no data."

  6. klklaser
    Member
    Posted 8 years ago #

    Maybe there are ideas here, or here.

    I have no idea whether that can adapt to your use or not.

  7. AndrewKuo
    Member
    Posted 8 years ago #

    Anyone have an update on this? (For being able to display subscriber profiles with the author.php page)

  8. kalico
    Member
    Posted 7 years ago #

    Same issue here. I can get a nice list of authors and contributors:

    <h2>List of authors:</h2>
    <ul>
    <?php wp_list_authors('hide_empty=0'); ?>
    </ul>

    ...however the only ones that are linked to actual profile pages are the ones who have written a post. It doesn't matter if they are authors or contributors....it just matters if they have posted or not...no posts, no profile. Does anyone know a way around this?

  9. Steven Chang
    Member
    Posted 7 years ago #

    To get around this problem, you'll have to modify wp-include/class.php function handle_404().

    Find this line:
    if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {

    and include negative qualifier for author pages:

    if ( (0 == count($wp_query->posts)) && !is_404() && !is_author() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {

    That should do it for you. Hope that helps.

    [sig moderated]

  10. BrunoAmaral
    Member
    Posted 7 years ago #

    This was very helpful. Thank you!

    Now all I need to do is figure out how to produce the profile links.

  11. Xenuan
    Member
    Posted 7 years ago #

    Thanks codersteve. Thanks thanks thanks thanks :)

  12. analogism
    Member
    Posted 7 years ago #

    This is great. I've started to edit the default Archive page, but what I'd like to do is to include "subscribers" who have posted comments, but I can't figure out how to do that. Anyone feeling clever?

    Thanks

    Oh, and Edit: codersteve, when using that code to get around the 404, my post url's, comments and what nots gets a 404 instead.

  13. analogism
    Member
    Posted 7 years ago #

    OK, never mind that edit, I think I was just sitting up working too late, not realizing my head went to bed hours earlier...

    But in addition to including Subscribers to these author pages, I would like to see this author thing move up a level, to the main "Root Blog" if you will.

    Right now, I have installed my blog under /wpmu. I have one blog as /wpmu/blog1 and another as /wpmu/blog2. So, if admin1 posts an entry under say blog1, you can only access his profile page under /wpmu/blog1 at URL /wpmu/blog1/author/admin1.

    I would love to get his profile page accessible under /wpmu/author/admin1, meaning at "root level". I don't know if this could be achieved by mod_rewrite or something, but I have no idea how.

    Further more, since these author pages are blog dependent as far as posts go, if you visit /wpmu/blog2/author/admin1 there will be no content, since he never posted on blog2. But he, and any subscribers I tested with, have access to post comments on both (I guess ALL) blogs, by signing up.

Topic Closed

This topic has been closed to new replies.

About this Topic