Skip to:

using bb_get_profile_link

  • How do I make a link that directs the user to their profile?

    The default code in bbPress is

    <?php printf(__('Welcome, %1$s!'), bb_get_profile_link(bb_get_current_user_info( 'name' )));?.

    Yet if I use this, the name of the user will be the linked text. Also, I’m not able to use this code alone. If I try:

    <?php bb_get_profile_link(bb_get_current_user_info( 'name' )); ?>

    …it doesn’t work. I also tried:

    <a href="<?php bb_get_profile_link(); ?>">My Profile</a>

    How can I change the text to My Profile and also let it stand alone? (standalone meaning on its own paragraph and with no Welcome, %1$s!)

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

  • _ck_


    bbPress functions with the word “get” in them do not self-echo, they simply return the string. So you have to add echo. You almost have it, for example, this should work:

    <a href="<?php echo bb_get_profile_link(); ?>">My Profile</a>

    And just to confuse you, there are a couple of legacy functions with the word “get” in them that do echo. But they shouldn’t and are rare so don’t worry too much, lol.

    I tried that and this is what I get as the url of the link:''>View%20your%20profile



    parthatel: can you post your actual HTML from the rendered page in backticks so it doesn’t get rendered as HTML? Like you did in the first post. Thanks.

    This is the warning that appears on the top of the page.

    <b>Warning</b>: parse_url(/%3Ca%20href=%27 [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL in <b>/home/domain/public_html/links/bb-includes/functions.php</b> on line <b>1794</b>

    This is what the My Profile link links to:''>View%20your%20profile</a>

    bb_get_profile_link does self echo, so you could try:

    <a href="<?php echo user_profile_link(bb_get_current_user_info('id')); ?>/">

    …or if you don’t want to use it amongst another href, just use:

    <?php echo bb_profile_link('link text here'); ?>



    no, bb_get_profile_link does not self echo but it does return a full formed url apparently, so I was half wrong to use it inside of a href.

    The direct link is via get_user_profile_link( $id )

    byles, your code is wrong in that it doesn’t need an echo

    <?php bb_profile_link('link text here'); ?>

    I apologise – was writing it from memory and in a rush! :) (excuses excuses ;))

    I personally needed to use href to append more to the end.

    I’ve just noticed that the post prior to mine is months old anyway, I guess he figured it out in the end!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar