How to force Author pages for members with (0) zero published posts?

I dont’ know if this is the right forum for this, maybe over in the Multisite forums…but they never respond, so I’ll try my luck here because of the great community of support and feedback that is always present.

I have author.php templates for all authors of posts on sub blogs but they only display for members who have authored a post on the subblog. I’d like to be able to force this template to show the author=member regardless of having a post or not.

Basically all my author pages (subsite.com/author/usersame) on all sites are pseudo BP profiles…I’ve called in the member avatar with `bp_has_members(‘include=’.$post->post_author)` and basically laid out the entire page template like a bp member profile page.

The problem i have, and I don’t know if this is specific the author.php template or what. But if a member doesn’t have published posts on the sublog then they get a blank page with no avatar or member associated components.

How can I force this template to make author pages for all members with zero posts?

First port of call would be the WP codex function reference and a hunt for whatever functions exist for authors, somewhere there is code that is asking how many posts the user has authored? and if > 0 show something actually looking at author.php it queues the wp loop to be able to see if a user has created any posts. I think perhaps more what you want to be doing is to to force create a page for that user if one doesn’t exist using user name to name the page then you can do a !get_page_by_title(‘user_name’) wp_insert_post() you could also then add detail to the page via content parameters in the create post/page array.

@hnla thanks for chiming in. that would be alot of pages to create and manage, no? I think sticking to /author/ would be better off. Something else I’ve thought of is to force a Hello World post for all members. would love to hear suggestions on that approach.

Same principle then, wp_insert_post() creates either a post or a page along with any post/page meta required but you did refer to ‘pages’ however I’m likely not following exactly how this is all working.

” I think perhaps more what you want to be doing is to to force create a page for that user if one doesn’t exist using user name to name the page then you can do a !get_page_by_title(‘user_name’) wp_insert_post()…” — When you referred to “pages” here — I thought you meant creating WP pages for every author using their username…. so then i’d be creating a wp page for every http://www.mysite.com/username1, http://www.mysite.com/username2 is that not what you meant?

@r-a-y thanks…I thought I could squeeze it in here at these forums, since I’m pulling in BP Profile components into the author.php template. These BP elements are what I can not get to show when there are no post existing for that user.

like i said, everything works fine when a post exist by the member.

for example, this is how I have the layout in the author.php on all my subsites, sidebar-left holds BP Avatar and Xprofile info, in the middle column contains the author posts loop, and in the sidebar-right I have BP Activity latest posts by author and BP activity latest comments by author.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘How to force Author pages for members with (0) zero published posts?’ is closed to new replies.