0

I'm looking to add a link to buddypress profiles on author pages - the page that displays all posts by an individual author. The link would need to direct to the individuals buddypress profile, so need to call for author meta and replace the normal author link with bp_core_get_user_domain to grab the buddypress profile.

I have a description box at the top of the author page, with links to their social media accounts (see below) and would like to add this new link in line with that.

Any help would be appreciated.

<p class="desc"><?php echo esc_html( $curauth->description ); ?></p>
                <p class="follow">
                <?php
                    if ( get_the_author_meta('user_url', $curauth->ID) ) echo '<a class="home" href="'. esc_url(get_the_author_meta('user_url', $curauth->ID)) .'"><i class="fa fa-home"></i></a>';
                    if ( get_the_author_meta('facebook', $curauth->ID) ) echo '<a class="facebook" href="'. esc_url(get_the_author_meta('facebook', $curauth->ID)) .'"><i class="fa fa-facebook"></i></a>';
                    if ( get_the_author_meta('twitter', $curauth->ID) ) echo '<a class="twitter" href="'. esc_url(get_the_author_meta('twitter', $curauth->ID)) .'"><i class="fa fa-twitter"></i></a>';
                    if ( get_the_author_meta('gplus', $curauth->ID) ) echo '<a class="google-plus" href="'. esc_url(get_the_author_meta('gplus', $curauth->ID)) .'"><i class="fa fa-google-plus"></i></a>';
                    if ( get_the_author_meta('linkedin', $curauth->ID) ) echo '<a class="linkedin" href="'. esc_url(get_the_author_meta('linkedin', $curauth->ID)) .'"><i class="fa fa-linkedin"></i></a>';
                ?>
                </p>
            </div>
            <!-- end:author-box -->
0

Did you try using bp_core_get_user_domain() ?

For example:

echo '<a class="linkedin" href="'. bp_core_get_user_domain( $curauth->ID ) .'">Profile</a>'
  • That worked. Yes I was testing out the bp_core_get_user_domain options, but mine varied slightly from your suggestion. Thanks! – Haazna Dec 17 '18 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.