the_author_posts_link();
any help here? If member has posts archives page on multiple blogs on the system, how would i link from the member profile directly to the authors archive on specific blogs.
thanks in advance
@nahummadrid – Is this thread similar to what you’re looking for?
@r-a-y is similar because it seems that all links take me to the main blog author template which is cool. but I’d like to keep things as is and be selective with what links i send to the author page so instead, from my profile home, add ‘quicklinks’ to the various subblogs i’ve authored on not only the main blog.
I was able to link to the individual blogs users are admin on, by using bp_has_blogs(‘user_id=’ . $bp->displayed_user->id == $bp->loggedin_user->id) but i guess that only works for being an admin of a blog. what if user has contributed to another blog on the system, how to link over to the author posts template for that user, is the thing
Gotcha… just briefly glanced the post
So you just want to list a bunch of blog links that the displayed user is a contributor to?
Blog roles were removed in BP 1.2.3 due to performance reasons. However, you might want to look for a WPMU-specific function for this.
Try get_blogs_of_user():
https://codex.wordpress.org/WPMU_Functions/get_blogs_of_user
@r-a-y
You can see the way I tried get_blogs_of_user. Any suggestions to get this one to recognize all published posts regardless of membership to a subsite?
Or get the get_blog_details(blog_id) code to work where it only shows if members has posts.
Thanks again
I’m having a hard time understanding your use case.
Maybe because I didn’t get much sleep last night!
If you’re a super admin and you’re posting on someone else’s blog that you’re not a member of, your posts will probably not count (don’t quote me on that!).
Btw, nice BP theme!
@r-a-y i have a tough time understanding it myself! just crazy tinkering I guess, there is probably a simple solution….
I think you’re right about super admin.
I’m talking more about other members, who have posted on other network blogs. If you look at my profile sidebar, you’ll see “my videos” and “my posts” links. Each should take you to the author template page for those members on the corresponding blogs.
My Videos ==> site.com/author/ray
My Posts ==> site2.com/author/ray
get_blogs_of_user method works to display only the sites members have posted on sitewide – it will however show primary site of a member regardless of posts.
get_blog_details method forces all member profiles to display the links regardless of having posts or not. It will just link to the author page with “no posts for this author’ message as part of the author.php template.
the issue i’m having with get_blogs_of user, I have users who make one time posts by way of a frontend form. They own that post but they don’t have a role on the blog. I think that is the reason why on some users, the links don’t display even if they do have posts.
both methods are useful depending on how you want to use them.
i’d like to be able to use the get_blog_details method because it lets me define what links to display. and the issue i have with that is that the links are always present, I’d like for them to only show up if the user has posts.
make less sense now! hehe, anyway it is a very specific feature, some people may like to do something like this.
@nahummadrid – Thanks! That clears up things!
You should preferably add the users to the blog.
Try a plugin like this:
https://wordpress.org/extend/plugins/wpmu-default-user-role/
Or, customize this per blog with:
add_user_to_blog( $key, $user_id, $value );
https://codex.wordpress.org/WPMU_Functions/add_user_to_blog