Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • Quintinm
    Participant

    @quintinm

    Hello.

    I am wanting to add a link from the authors page to the member profile, how would i add that?

    Thank you.


    Quintinm
    Participant

    @quintinm

    I just found the answer which works for me:
    I would like to know how I can add the link on the members page to the author’s posts now.

    Thanks.

    /**
     * Filter all instances of the_author_posts_link() so that the "author link"
     * no longer points to the WP author archive at /author/username
     * but instead points to the BuddyPress user profile at /members/username.
     *
     * @param string $link   Calculated link to the author's archive.
     * @param int $author_id ID of the author.
     * @return string Link to the user's BP profile.
     */
    add_filter( 'author_link', 'dc_bp_filter_author_link', 10, 2 );
    function dc_bp_filter_author_link( $link, $author_id ) {
      return bp_core_get_user_domain( $author_id );
    }

    Quintinm
    Participant

    @quintinm

    Hello.
    I am also looking to link the author’s box to the BB profile page instead of the standard authors page.
    I am using buddyboss and the buddyboss child theme.
    I wish i was more proficient at coding, but i am not, so I need advice on how to do this please.

    How would I create the function that will link to the BB profile page?

    // Change Post’s Author URL to Buddypress Profile URL
    add_filter(‘generate_post_author_output’,’generate_post_author_output_buddyprss_url’);

    function generate_post_author_output_buddyprss_url( $post_author_profile_link ){
    $post_author_profile_link = sprintf( ‘ <span class=”byline”>%1$s</span>’,
    sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person&#8221; itemscope=”itemscope” itemprop=”author”>%1$s <span class=”author-name” itemprop=”name”>%4$s</span></span>’,
    __( ‘by’,’generatepress’),
    esc_url( bp_core_get_user_domain( get_the_author_meta( ‘ID’ ) ) ),
    esc_attr( sprintf( __( ‘Know more about %s’, ‘generatepress’ ), get_the_author() ) ),
    esc_html( get_the_author() )
    )
    ) ;
    return $post_author_profile_link;

    }

Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar