Add Author Avatars to List Items

Add Author Avatars to List Items

March 02, 2015

Step-by-step instructions on how to dynamically add author avatars to your SEBLOD list items.

Adding author avatars to your SEBLOD list items isn't immediately obvious, but can be achieved dynamically with the Select Dynamic field and a little bit of SQL Query code. I've stepped through these instructions below to make it easy for you. This is a neat feature to add if you want to give the authors of different content items in your search results some added prominence.

STEP 1: Open the Content Type of the Content you are listing (it is important that you do this in the content type so it is locked to this content type)

STEP 2: Create a new field that is a "select dynamic"

STEP 3: Change the Query to "free"

STEP 4: Enter the following code

SELECT b.avatar AS text, a.id AS value
FROM #__users AS a
LEFT JOIN #__cck_store_form_users AS b ON b.id = a.id

STEP 5: Make sure the storage is Standard > Article > created_by

STEP 6: Save your field.

STEP 7: Add your field to the view you want the Avatar to display on (Content, Item or List).

STEP 8: Apply the "HTML" typography and write the HTML code - remember to replace my_field with your actual field name:

< img src="/$cck->getText('my_field')" alt="Author Avatar" />