Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to keep just Display Name which links to Profile in posts

  • The default Kakumei theme shows two variables in the user section of every post, at left.

    You can see them both here as well, in this very post.

    The first one is defined in the profile page as Display name as and links to whatever appears in the Website field.

    The second one is defined in the profile page as User Type (which most often defaults to Member), links to the Profile page of the specific user, and could be changed by the Custom Title field.

    How would it be possible to drop the User Type and just keep the Display name as linking to the user Profile page?

Viewing 19 replies - 1 through 19 (of 19 total)
  • You can edit your theme or use this plugin https://bbpress.org/plugins/topic/post-count-plus/ it will give you teh option to what links to what.

    Plugins are good but as my humble experience goes the less I use of them the better: it is not rare that they conflict with each other. In other cases they also switch unexpected behaviours somewhere. Moreover, that plugin seems to be much more than I need.

    Most probably in this very case a simple code edit in the right template would do, but I do not know where and how to touch. Does anybody have an idea of the needed change, please?

    post.php

    So in post.php there is this code

    <p>
    <strong><?php post_author_link(); ?></strong><br />
    <small><?php post_author_title_link(); ?></small>
    </p>

    which should be changed into…?

    The point is that just dropping the post_author_title_link(); wouldn’t do.

    I need to first have the author display name link to his/her profile page.

    But I have no clue…

    just take out “_link”

    No.

    I need to have the author display name link to his/her profile page.

    <a href="profile.php?id=<?php echo get_post_author_id(); ?>"><?php post_author();?></a>

    Yet something is wrong. It does not work.

    Link should most probably look like

    http://www.example.com/forum/profile/user

    The right code is probably hidden in the header, where it says

    Welcome, User | Log Out

    That User link is the one I’m after, but cannot find out how it is built.

    It’s generated by the template logged-in.php, which in Kakumei looks like:

    <p class="login">
    <?php printf(__('Welcome, %1$s'), bb_get_profile_link(bb_get_current_user_info( 'name' )));?>
    <?php bb_admin_link( 'before= | ' );?>
    | <?php bb_logout_link(); ?>
    </p>

    So you’d want bb_get_profile_link(bb_get_current_user_info( 'name' ))

    So, if I now understand right, I cannot use any piece of it.

    :-(

    Would it really be that hard to get the poster name and link it to his/her profile page, quite simply?

    I cannot find how.

    bb_get_profile_link(post_author()) would probably work

    Yes, this seems to do the trick

    <a href="http://www.example.com/forum/profile/<?php bb_get_profile_link(post_author()); ?>">
    <?php bb_get_profile_link(post_author()); ?>
    </a>

    Hardcoding the path is not nice, but at least it works.

    :-)

    Thank you!

    You shouldn’t need the separate <a> tag, that function should be returning a complete <a> tag with the text passed to it (or using the ID number if one is given)

    sorry about that. I forget people use permalinks.

    Nope, Kawauso.

    <?php bb_get_profile_link(post_author()); ?>

    just renders the poster name, without any link.

    Do this:

    <a href="<?php echo esc_attr( get_user_profile_link( get_post_author_id() ) ); ?>"><?php echo get_post_author(); ?></a>

    <?php bb_profile_link( array( 'id' => get_post_author_id(), 'text' => get_post_author() ) ); ?>

    @bbback: you can avoid echoing get_ functions by dropping the get_, there’s always an echo alias function

    @kirpi.it: my bad, I left it using an echo function rather than returning the output

    Ok, this one works smooth!

    :-)

    Thanks again.


    James Blacker
    Member

    @james-blacker

    Tom also provided the follwing, which worked for me after I couldn’t get any of the above to work.

    https://bbpress.org/forums/topic/are-usernames-with-spaces-sensible

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