1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 Getting the post's author's avatar.

Discussion in 'Styling and Customization Questions' started by shock, Feb 26, 2014.

  1. shock

    shock Member

    Im trying to put the avatar of the author of a post beside the title, and i would like to know how could i make it work.

    i tried to use this line:
    Code:
    <xen:avatar user="$user" size="m" img="true" />
    
    but the variable "$user" doesn't hold any user... i would like to have some help with it :)
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Where exactly? I need to know what page and where so I can check if there is enough information available to display an avatar. If not then an addon will be required.
     
  3. shock

    shock Member

    Beside every thread title, that it's contained within "PAGE_CONTAINER" template.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Is that from an addon? The PAGE_CONTAINER doesn't normally contain thread lists.
     
  5. shock

    shock Member

    No, its a clean installation.
    My intention is to put the avatar beside the title within a thread, no in the thread list.
    The specific part in template:
    Code:
    <!-- h1 title, description -->
                                <div class="titleBar">
                                    {xen:raw $beforeH1}
                                    <h1><xen:if
                                        is="{$h1}">{xen:raw $h1}<xen:elseif
                                        is="{$title}" />{xen:raw $title}<xen:else
                                        />{$xenOptions.boardTitle}</xen:if></h1>
                                   
                                    <xen:if is="{$pageDescription.content}"><p id="pageDescription" class="muted {$pageDescription.class}">{xen:raw $pageDescription.content}</p></xen:if>
                                </div>
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh I understand now.

    Admin CP -> Appearance -> Templates -> thread_view

    Add this to the top:

    Code:
    <xen:container var="$beforeH1">
    	<xen:avatar user="$thread" size="m" img="true" />
    </xen:container>
    
    That will pass the author's avatar to the container var, $beforeH1.
     
    shock likes this.
  7. shock

    shock Member

    thank you, it worked!
     

Share This Page