Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How do I get the link to the last post in helper_functions.php?

edited April 2011 in Vanilla 2.0 - 2.8
I'm trying to add a link to the last post on the "Most Recent" text in the main discussion view. By default there's only a link to the profile of the person who posted the last post but nothing to actually go to that post.

After some digging through the files, I figured out that in order to get to that place in the code, I have to duplicate the helper_functions.php, copy it into themes/THEMENAME/views/helper_functions.php and then edit this line:

echo '<span class="LastCommentBy">'.sprintf(T('Most recent by %1$s'), UserAnchor($Last)).'</span>';

Is the link information for the last post already stored somewhere? Does anyone know how to change that line in order to link "Most Recent" to the last post of that discussion?

thanks in advance


  • Options
    edited April 2011
    echo '<span class="LastCommentBy">'.Anchor('Most Recent', '/discussion/comment/'.$Discussion->LastCommentID.'#Comment_'.$Discussion->LastCommentID).' '.sprintf(T(' by %1$s'), UserAnchor($Last)).'</span>';

    This is where I am so far... But this doesn't seem to work for all discussions (especially closed ones or ones without comments)

    EDIT: the problem with discussions without comments only applies to the ones imported from phpbb
Sign In or Register to comment.