Author page broken if blog user has no posts?
I’m working on using a blog for my research group. I’m creating user accounts for all past and present members of the lab, and using the author page for their info. I’m using a combination of the peopleLists plugin (for creating lists of people that link to their author pages) and Advanced Bibliplug (for managing paper lists, and also automatically creating links from authors to their author page).
The problem is that the author page seems to be broken if a user has no posts, because the loop-author.php file is using a bunch of calls that only work in “The Loop” (and there is no “loop” if the author has no posts!). In author.php, the page is explicitly queuing the first post, and then calling
get_template_part( 'loop', 'author' )(acknowledging in the comments this is a hack to get all the info … but clearly assuming there is a post!)
I’m a wordpress hacking novice, so perhaps there is another easy way around this. I hacked it (by creating a subtheme so I could replace the file cleanly) and grabbed code from bibliplug’s author page to get the author information
$curauth = (get_query_var('author_name')) ? get_user_by('slug',get_query_var('author_name')) : get_userdata(get_query_var('author'));
and then used the fields in
$curathto get most of the info that was formerly being gotten by calls to
The one thing I couldn’t figure out, though, is what to do with the call to
post_class(array( 'clearfix', 'page', 'author' ))at the top: it only works in the loop, and relies on their being a current page to get info from. For now, I removed it and put in a fixed list of classes (based on what would show up in a working author page:
class='post type-post status-publish format-standard hentry clearfix page author'
In general, the author page needs to be redone, I think. That’s the one problem I don’t know how to fix!Mod
AnonymousOctober 6, 2012 at 4:58 pm #31385
Yup, I just checked this issue on my test site. We will look into this issue. Thanks for notifying!
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.