-
Ok basically I want the correct user displayed on author.php even if user has 0 post. I want users to view other user profiles on author.php and not having to be logged in public should be able to view as well. Presently if user A views user B user A is displayed is the problem Why? because user A has 0 post. But when user A makes a post everything works probably.
The problem with this is when a new user registers and click the profile link connected to author.php they won’t see their profile because they haven’t made a post. Not good will confuse the user and not every user will post they may just register to view and follow other users. Basically this is a major function with wordpress and userpro was built around wordpress it should work. Great plugin but without this it can be useless in a lot of projects. Thanks
Thanks for the great support. This fix will allow designers to create very flexible profile pages for authors that you visit where the sidebar and content of a profile will compliment each other nicely.
Can I know one thing? How do you view the author archive of user who have no posts? Cause I tried and it does not show, it gives 404 error if user has no posts (Not author yet). So how were you able to see author page who has 0 posts please?
Hi,
What I did is from the userpro support docs I added the filter:
//Change profile URL to author URL
add_filter(‘userpro_user_profile_url’, ‘userpro_author_url’, 99, 2);
function userpro_author_url($link, $user_id) {
return get_author_posts_url( $user_id );
}Which changed the links to go to the author archives instead of profile.
Then I simply added the shortcode with [template=view user=author] to a sidebar and now when I click on a profile URL in userpro template view it goes to the author url.
But my author urls (for authors without posts show 404 page) Is that normal?
I think this depends on the theme. I did not get a 404 but I am running a magazine theme and the authors link goes to the authors URL /author/alex/ for example which is by default a page containing the author posts if any. With the filter you provided this author page has become my profile user home page.
Yes…no problem. Should I send to you via the deluxetheme email address?
Ahmed thanks for looking into a solution and just as alexwadja said it depends on the theme. The theme I’m using has a default profile that is linked to author.php so I just replaced it with userpro shortcode and used
//Change profile URL to author URL
add_filter(‘userpro_user_profile_url’, ‘userpro_author_url’, 99, 2);
function userpro_author_url($link, $user_id) {
return get_author_posts_url( $user_id );
}As well. Now I can tell you this theme uses the same auth at the top of author.php as userpro and also in the registration form the action=login_post… Which I assume that it is making some sort of default post in the system to activate author from ?author=0 to the correct ?author=1, ?author=2 and so on with the correct id to match new user.
Hi! I have an update, I have made changes to the code to allow the card / profile view to work on AUTHOR ARCHIVES as well as POSTS based on author being viewed even if he has NO POSTS! This fix is now available at customer portal, please get it and try to display the CARD or PROFILE on author.php Archive, keep me posted if it is solved please!
Download the update from here.
I got it to work on Author template :
[userpro template=card user=author]
or
[userpro template=view user=author]
Author will be DYNAMICALLY fetched from author archive.
mediakliqco please try the update, in author archive. user=author and let me know!
Ahmed excellent work thank you all is working so far…. There’s just one small adjustment when you click edit profile that works! great! making changes and updates work great! but when you save then hit view profile… profile goes to a blank profile with ?author=0 if you refresh the page then the profile comes back.
You must be logged in to reply to this topic.