Avatar on main index

  • Okays, lets say i want to show the member his avatar on the main page and only a MEMBER.

    So far, I have this in the template:

    {if $this->user->userID != 0}

    What can i add to show the the person with a userid his avatar in the main index.
    This would go on a side bar for http://www.duratecoa.com/forums/

    thank you!

  • Add this between the if clause:

    {if $this->user->getAvatar()}
    								<div class="userAvatar{if $this->getStyle()->getVariable('messages.sidebar.avatar.framed')}Framed{/if}">
    									<a href="index.php?page=User&amp;userID={@$this->user->userID}{@SID_ARG_2ND}" title="{lang username=$this->user->username}wcf.user.viewProfile{/lang}"><img src="{$this->user->getAvatar()->getURL()}" alt=""
    										style="width: {@$this->user->getAvatar()->width}px; height: {@$this->user->getAvatar()->height}px;{if $this->getStyle()->getVariable('messages.sidebar.avatar.framed')} margin-top: -{@$this->user->getAvatar()->height/2|intval}px; margin-left: -{@$this->user->getAvatar()->width/2|intval}px{/if}" /></a>
  • would this go in the index.tpl template? If so, its giving error:

    Fatal error:  Call to undefined method WBBUserSession::getAvatar() in /home/duracoa/public_html/wbb3/wcf/templates/compiled/38_0_1_index.php on line 128

    Im still getting used to the Framework so im not the greatest at this :P

  • Hmm my mistake. I supposed the $this->userObject is related to the UserProfile Object. Well then you have to write an EventListener and assign the UserProfile Object of the current User to the Template.

  • Unfortunately only in german. The English community here is so small that they only get a glimpse of what exists :| There are several tutorials covering some topics of interest.

    As the whole listener system cannot be explaied in 2 sentences I suggest you download a small plugin that contains an easy event listener an study its behaviour.

  • If I ever find out how to make a plugin I will :). But for the meanwhile I will try to study how the board system works, and once i get the hang of it, I will start releasing some plugins.