• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Omit avatars when appropriate, change user info block

Zak Smith

Member
Here's the substance of a mod I did to do two things:

1. Not litter the discussions with the generic avatars for users who haven't set one, and

2. Change the order of the user title and avatar in the user info box so the user's name is at the top:

message_user_info

Code:
      <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">                                                                  
                <h3 class="userText">                                                                                                                                                 
                        <xen:username user="$user" itemprop="name" rich="true" />                                                                                                     
                        <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>             
                        <!-- slot: message_user_info_text -->                                                                                                                         
                </h3>                                                                                                                                                                 
        </xen:hook>                                                                                                                                                                   
                                                                                                                                                                                      
                                                                                                                                                                                      
<xen:if is="{$user.avatar_width}>0 OR ({$isQuickReply} AND {$account.avatar_width}>0)">                                                                                               
        <xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">                                                                
                <div class="avatarHolder">                                                                                                                                            
                        <xen:avatar user="$user" size="m" />                                                                                                                          
                        <!-- slot: message_user_info_avatar -->                                                                                                                       
                </div>                                                                                                                                                                
        </xen:hook>                                                                                                                                                                   
</xen:if>

Looks like this
avatar.jpg


Note that this also changes what is displayed at the bottom for the quick reply. This displays the user name/title AND the avatar if the user has an avatar, otherwise just the name/title.

I wasn't sure if $visitor or $account was appropriate for the second check, but this does seem to work. ETA: $visitor works as well. I changed mine to use it.
 
I could be wrong, but I was getting an error when trying to save this template, so I had to remove the "</xen:if>" from the last line there to get the template to save. Just in case anyone else has the same issue. Thanks for sharing this - looks a lot cleaner :)
 
Not sure. If you open the if it needs to be closed somewhere... ?

I've ported this mod up to the latest version and it still works fine.
 
The best of both worlds might be that it shows up empty for the person whom didn't choose an avatar.
But ... for everyone else the blank avatar doesn't show up :)
 
Top Bottom