Skip to:
Content
Pages
Categories
Search
Top
Bottom

User profile link in post – replacement link


  • michael3185
    Member

    @michael3185

    I’m trying to change the post author link which is displayed as ‘Key Master’ (for example) to ‘User profile’. Tried lots of variations having looked through the bbPress template functions file, but can’t get it to work. The top part of my post.php code is this at present;

    <div class="threadauthor">
    <?php avatarupload_display(get_post_author_id()); ?>
    <p>
    <strong><?php post_author_link(); ?></strong><br />
    <small><?php post_author_title(); ?></small>
    </p>
    </div>

    The post_author_link() line becomes;

    <a href="http://mbforum.letsdoo.org/profile/michael">Key Master</a>

    I realise I’m just not grasping how the PHP code/functions work, so if anyone thinks, “Oh yeah, all you do is…” I’d be very grateful for an answer.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You just want to change the output from <a href="http://mbforum.letsdoo.org/profile/michael">Key Master</a> to <a href="http://mbforum.letsdoo.org/profile/michael">Profile</a>?

    Try this:

    <div class="threadauthor">
    <?php avatarupload_display(get_post_author_id()); ?>
    <p>
    <strong><?php post_author_link(); ?></strong><br />
    <small><a href="/profile/<?php post_author(); ?>">User Profile</a></small>
    </p>
    </div>


    michael3185
    Member

    @michael3185

    That works great. Thanks Ipstenu.

    My only problem now is that bbPM filters (changes) the post_author_title_link and post_author_title, so I’m currently battling to try and make that behave. If I change to the line you provide above, it misses the link/title and doesn’t add a ‘PM this user’ link, but if I leave it in, it adds it back as well as ‘PM this user’. Grrr…

    I’m also curious about this. Using

    <a href="/profile/<?php post_author(); ?>">User Profile</a>

    doesn’t work for me since some users have display names that aren’t their user name. Is there not a simple bbPress template tag for calling the link to the user profile?

    Y’know, most of my users never realize they can change that so it’s never come up before. That’s a good point! You used to be able to use post_author_id(), but that stopped working in the 1.0 series.

    Its gotta be possible, these forums are doing it now. Under each username is a link to the user profile. If only I could figure out how they were doing it…


    chrishajer
    Participant

    @chrishajer

    In the 1.0 release it’s something like this, isn’t it?

    <a href="<?php user_profile_link( $user_id ); ?>"><?php echo get_user_display_name( $user_id
    ); ?></a>

    That would link the Display Name to the user’s profile. You’d have to have the $user_id first to use this, I think.


    michael3185
    Member

    @michael3185

    I’ve ‘unresolved’ this thread again, as I’d like to get it working in 0.9.0.5

    By Display Name, am I right in assuming you guys mean the ‘Custom Title’ in a member’s profile? If I set this, then the link under the avatar changes (obviously), but also, bbPM in creating its ‘PM this user’ link replaces the Display Name with what it should be. Changing the link ‘manually’ by altering the template causes bbPM to make a mess of the link, or not replace it at all, thereby creating 3 links; my hard-coded on, the expected profile link, and the ‘PM this user’ link.

    I just wussed out on a real fix and started using _ck_’s plugin, ‘Post Count Plus’ ( https://bbpress.org/plugins/topic/post-count-plus/ )

    One of its options is lets you select where the username link points to. Aside from that its got a handful of other useful options. Good stuff.


    Duke
    Member

    @dukessa

    I only know how to do it in the forum view, for the latest post author (in every topic)… but I dont know how to make it work for single posts inside the topics…

    Latest poster in a topic, points to profile:

    <a href="<?php user_profile_link($topic->topic_last_poster) ?>"><?php topic_last_poster(); ?></a>

    Come on, there must be a way to link each post author name (inside a topic) to their profile….

    The solution posted by Sam Bauers here works:

    https://bbpress.org/forums/topic/control-post-gravatar-link

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