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 add users profile avatars on the discussions index?

CodersCoders New
edited October 2010 in Vanilla 2.0 - 2.8
I believe in the discussions helper function is where it's located, but how would I go about doing this so that when someone creates a discussion, on the page, it shows up next to their discussion they started... ?


  • RaizeRaize vancouver ✭✭
    I think the mobile theme does that, take a look at the code for that (it's included with the latest core release)
  • CodersCoders New
    edited October 2010
    Thanks, well screw it! I created my own prototype! Check this out, create a PHP file named class.defaultthemehooks.php and place it in /themes/default/*

    <?php if (!defined('APPLICATION')) exit(); class DefaultThemeHooks implements Gdn_IPlugin { public function Setup() { return TRUE; } public function OnDisable() { return TRUE; } /** * Add Author Icon before discussion title. */ public function Base_BeforeDiscussionContent_Handler($Sender) { $Discussion = GetValue('Discussion', $Sender->EventArguments); $Author = UserBuilder($Discussion, 'First'); echo '<span class="Author">'; echo UserPhoto($Author); echo "</span>"; } }
    Put the above in the .php file, and in the /applications/dashboard/design/style.css,
    find the following:

    ul.DataList li.Item { margin: 0; padding: 4px 0; border-bottom: 1px solid #bec8cc; }
    Under this, add this:

    ul.DataList li.Item span.Author img { background-color: #EEEEEE; border: 0 none; float: left; height: 40px; margin: 0 10px 0 0; overflow: hidden; width: 40px; }
  • Very cool, implemented in my forum. Definitely gives it a bit more character!
  • RaizeRaize vancouver ✭✭
    Cool mod, thanks for sharing
Sign In or Register to comment.