Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding external links within members pages


  • jbboro3
    Participant

    @jbboro3

    I’ve been trying to add external link (sub domain) in the members navigation or any members pages but just not getting it right..

    I tried this one: sub.example.com/wall/<?php echo bp_displayed_user_mentionname(); ?>”>Join me

    However,it returns to page not found because it outputs as sub.example.com/wall/sonia%3Cspan%20id=

    The idea is to generate a link something like http://www.sub.example/wall/$username

    P.s: I’ve domain and sub-domain with shared users db both bp installed..

    Anyone’s help will be great.. Thanks

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

  • danbp
    Moderator

    @danbp

    Hi,

    To get the link to a user profile:
    $link = bp_get_loggedin_user_link();

    Many use examples can be found on the forum. Ie:

    [Resolved] BuddyPress Links URLs

    Is it possible to make Activity and Forum profile tabs private?


    jbboro3
    Participant

    @jbboro3

    Hello danbp, thanks for commenting..

    I’m not looking for loggedin_user_link.. What I’m looking is to generate url of sub-domain with displayed user username like http://www.sub.example.com/$username i.e.. external domain link/ echo the displayed user username..


    danbp
    Moderator

    @danbp

    Hi,

    sorry, less is more ! 😉
    Try something like this within a function. The way to get the user_id depends where you insert the link(ie. in or outside members loop, blog, an so on).

    if( bp_is_user() && ! bp_get_member_user_id() ) {
    	$user_id = 'displayed: '. bp_displayed_user_id();
    } else {
    	$user_id = 'get_member_user: '. bp_get_member_user_id();
    }
    $username = bp_get_displayed_user_fullname( $user_id ); 
    //$username = bp_core_get_username( $user_id );
    
    echo '<a href=" '.wp_nonce_url( bp_core_get_user_domain( $user_id ) ).' " rel="nofollow">@'.$username .'</a>';
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar