最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Buddypress profile link on author blogroll page

matteradmin10PV0评论

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

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far