This is the problem. You need to find a diff way of doing this
Darn, I was very much hoping that wouldn’t be the answer. Alright, thanks for that, better to know that struggling with it .
I’m using that plugin as well and I’ve asked that same question here on the forum with no success. However, whether you’re using that sidebar plugin or not, I’m still having trouble getting a clear answer on how to replace WP code linking to the author in your custom theme to the profile page in Buddypress.
In other words, how do I change <?php the_author_posts_link(); ?> from my custom home theme to <‘author’s buddypress profile link’> in order to reach that author’s profile page?
If you have a user id then bp_core_get_userlink() in bp-core.php has lots of options. Check out all the functions in there that are bp_core_get_[something]().
I’m trying to add a link to the Buddypress profile for each author on the author page of my custom home theme. I’m trying:
<?php echo bp_core_get_userlink( $user->user_id ) ?>
This simply takes me to the same author page found by the existing:
<?php the_author_posts_link(); ?>
What am i missing?
I dunno guy. The fn bp_core_get_userlink() really just wraps fancy stuff around this fn: function bp_core_get_userurl( $uid ) in bp-core.php. If you look in there, you can see what that does. Direct to the member profile page.
Hi Burt. Sorry for cross post but I’m under the gun. I’m trying bp_core_get_userlink() with submitting the_auhtor_id() as the argument and it returns the integer author id. If I submit the author ID as a simple string as in bp_core_get_userlink(6) I get the right link to the profile. What am I missing?
I’ve inserted this:
<?php the_author_posts_link(); ?>
to my templates.. it seems to work..
anythoughts on this..?
@Scotm – I’m trying to do the exact same thing – did you ever get this resolved?
God damn! I’ve been trying to do this now and I really cant figure out how to get this done. Shame that its been a year since this was posted and yet no solution.
what i did was copy the bp_core_get_userlink function in bp-core.php and copy and paste it again as bp_core_get_userlinkurl replacing all instances of “bp_core_get_userlink” with “bp_core_get_userlinkurl” and set display only url parameter to “true”.
Works like a charm
late to the party but I think $bp->loggedin_user->domain will do it if you global $bp;
I saw this @ https://codex.buddypress.org/developer-docs/the-bp-global/ FYI
I didn’t like the the plugin solution since it wasn’t quite what I wanted so I created my own. I wanted to be able to put a link to a user profile where ever I want by displaying the users name. You could hard code this if you know the users name but what if you want it to be dynamic and work for any user? I came up with this simple solution which is easy even if you don’t know php.
In the functions.php file add the following to the bottom.
/* Return authors profile link*/
echo( ‘‘); echo get_the_author(); echo(‘‘);
Then simply include the following php line of code any where in loop-index.php where you’d like the current posts users name displayed as a link linking to their profile. It knows what post it’s referring to based on each one it’s printed in as it goes through the loop. I’m using it in the following code in loop-index.php
<div id="post-” >
<a href="” title=”” rel=”bookmark”>
Live long and prosper.
Use BP Redirect to Profile for Buddypress plugin to redirect users to their profile page after login.
I was able to get this (create a link to the post author’s BP profile) to work using Boones suggestion here http://wordpress.stackexchange.com/questions/43528/how-to-get-a-buddypress-user-profile-link-and-a-certain-user-profile-field-for-t
To get it to work in the sidebar (running Genesis and the Content Aware Sidebar plugin) I had to use the code below to pull the author id outside the loop. I am strictly an amateur but this may be where folks are having trouble adding a link in sidebars, plugins or widgets?
If you are like me, and not a coder, below is the exact code I used:
$temp_post = get_post($post_id);
$user_id = $temp_post->post_author;
$author_bp_profile = bp_core_get_user_domain( $user_id );
?><a href="<?php echo $author_bp_profile;?>">View the author's profile</a>