Buddypress profile link on author blogroll page

admin2025-06-05  2

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 -->

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 -->
Share Improve this question asked Dec 14, 2018 at 20:59 HaaznaHaazna 335 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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>'
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749096604a316333.html

最新回复(0)