Last Poster Avatar Variable in Forum Row (& Topic Row!)

Aug 31 2020, 03:05 PM

<!-- |last_poster_avatar| --> <!-- |last_poster_avatar_url| --> variables are now available in Forum Row & Topic Row templates.

This is a small update, but we're making it an announcement because so many are already using a work-around to get this feature.

A common implementation of this is usually the following, is an old method:


background-image: url('path//av-<!-- |last_poster_id| -->.png'), url('path/av-av-<!-- |last_poster_id| -->.gif'), url('path//av-<!-- |last_poster_id| -->.jpg'), url('path/av-<!-- |last_poster_id| -->.jpeg'), url('default');

While this method works, it has two major downsides:

1. It has to try multiple image requests until it reaches the correct one! It can take up to 3 tries to get the working avatar URL. This wastes browser requests and resources.

2. You cannot allow URL avatars, uploaded avatars are required. they won't work. Free and premium service, while allowing generous space, have limitations and this is also not as convenient for users who may wish to link the same URL across many sites.

The variable(s) addresses both issues so you can simply use the following and keep URL avatars enabled! with the new method:

background-image: url('<!-- |last_poster_avatar_url| -->');

And that's it. There are no upload folder paths to consider, no site names or links, the CSS is condensed...the variable handles it all for you.

If you want need to set a default avatar for the url variable, a new macro has also been created called <{AVATAR_URL}> or you are welcome to put the default avatar url at the end as a second request since it defaults to a null url, like this:

background-image: url('<!-- |last_poster_avatar_url| -->'), url('default avatar url');

Let us know if you experience any problems using this new feature!

Best regards,

John & the JFH Team


  1. John Says:

    Update: <!-- |last_poster_avatar_url| --> and <!-- |last_poster_avatar| --> are now available for use in the Topic Row templates

  2. John Says:

    We've added a little notice to the forum row and topic row template in Admin CP.

    This is due to an increase in support queries related to linked avatars not working with the old method, and confusion in how to implement the old method as well which does not need to be used for topic row and forum row templates anymore.

    The notice automatically clears upon reentry into the template whenever a template is updated to use the <!-- |last_poster_avatar_url| --> variable

    If any assistance is required in using these variables or getting your template converted please don't hesitate to ask us for help!