Hi wzshop,
To where we should link? If the user has not any post, the author page in 50% of themes shows “Sorry we didn’t find any content”. We think that would be not a good idea.
Thread Starter
wzshop
(@wzshop)
Managed to fix it with some custom coding. It is for a community WP site where every member automatically has a profile page. Might be cool to have this as an option…?
@wzshop, I personally use buddypress profile. You can use any profile plugin and link the comment author to that profile page.
It would be a great idea if you would make a WPDiscuz setting – so we can just set a custom author link in the comments section – eg /author/{display_name} or /anyslug/{user_id} etc..
To get the author archive to show users with no posts is very straightforward, just add this snippet to your author.php
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$curname = $curauth->display_name;
$firstname = $curauth->first_name;
$username = $curauth->username;
$id = $curauth->ID;
and build on the info, by checking if the user has posts or not.
You can do it using wpDiscuz ‘wpdiscuz_profile_url’ hook:
add_filter('wpdiscuz_profile_url', 'wpdiscuz_custom_profile_url', 10, 2);
function wpdiscuz_custom_profile_url($profile_url, $user) {
if ($user) {
//$user is current user object
}
return $profile_url;
}
Thanks! The hook is the best solution.
(@wzshop)
10 years, 6 months ago
Hi,
Currently it is only linking comment authors that have published posts. Is it possible to link all (member) comment authors and not check if they actually have an archive page?
Thanks
Robbert
https://wordpress.org/plugins/wpdiscuz/