Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hyperlink "Last Poster" from Latest Discussions to THEIR Profile Page


  • grassrootspa
    Member

    @grassrootspa

    Hey fellow bbPress enthusiasts,

    I have just spent forever playing with PHP trying to get the name generated by “Last Poster” in Latest Discussions on Forum or Front-Page to link to THAT user’s bbPress profile.

    My apologies if I am missing an easy “<a href=” command to surround the php in:

    <td class="num"><?php topic_last_poster(); ?></td>

    Nothing seems to work.

    Many thanks as my brain has been fried working on this.

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

  • KICKERMAN360
    Member

    @kickerman360

    Maybe this will work:

    <a href='<?php bb_uri(); ?>/profile/<?php topic_last_poster(); ?>"><?php topic_last_poster(); ?></a>

    Not 100% sure it would work since <?php topic_last_poster(); ?> grabs the display name, not the user name I think. Well there’s a start.


    grassrootspa
    Member

    @grassrootspa

    Hmm, this doesn’t seem to work. Anyone else have any ideas?


    Detective
    Member

    @detective

    function gs_get_topic_last_poster_profile_link() {
    global $topic;
    if ($topic)
    return sprintf('<a href="%s">%s</a>', get_user_profile_link($topic->topic_last_poster), get_topic_last_poster($topic->topic_id));
    return false;
    }


    grassrootspa
    Member

    @grassrootspa

    Thanks for your help, Detective. How would I implement your code with:

    <td class="num"><?php topic_last_poster(); ?></td>

    Which is in Forum.php and Front-Page.php


    KICKERMAN360
    Member

    @kickerman360

    <td class="num">
    <?php
    function gs_get_topic_last_poster_profile_link() {
    global $topic;
    if ($topic)
    return sprintf('<a href="%s">%s</a>', get_user_profile_link($topic->topic_last_poster), get_topic_last_poster($topic->topic_id));
    return false;
    }
    ?>
    </td>


    grassrootspa
    Member

    @grassrootspa

    Not sure if its just me but there creates an error.


    anandasama
    Member

    @anandasama

    I posted this elsewhere but this works for me on the frontpage:

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


    grassrootspa
    Member

    @grassrootspa

    anandasama, you are my hero! Thanks…this one works!!!


    anandasama
    Member

    @anandasama

    nice to be able to help. Got any other question (like thread maker profile link) then I know the code for that too.

    You should flag this topic as resolved.

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

You must be logged in to reply to this topic.