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

Adding an image under custom title for each user group??

Discussion in 'Styling and Customization Questions' started by Ranger375, Oct 12, 2010.

  1. Ranger375

    Ranger375 Well-Known Member

    How can I add an image under the custom title area in the post bit. I am trying to do this so it is user group based, so essentially each usergroup would have its own image.

    Thx
     
    DEiMOS likes this.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> message_user_info

    Add this code:

    Code:
                    <xen:if is="{$user.user_group_id} == 2">
    		    <img src="PATH/TO/image.gif" />
                    </xen:if>
    
    ...as shown below:

    Code:
    <xen:require css="message_user_info.css" />
    
    <div class="messageUserInfo" itemscope itemtype="http://data-vocabulary.org/Person">
    	<div class="messageUserBlock">
    		<div class="avatarHolder"><xen:avatar user="$user" size="m" itemprop="photo" /></div>
    
    <xen:if is="!{$isQuickReply}">
    	<h3 class="userText">
    		<a {xen:if $user.user_id, 'href="{xen:link members, $user}" '}class="username" itemprop="name">{xen:helper richUserName, $user}</a>
    		<xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
    
                    <xen:if is="{$user.user_group_id} == 2">
    		    <img src="PATH/TO/image.gif" />
                    </xen:if>
    
    	</h3>
    
    	<xen:if hascontent="true">
    
    Change the image location and usergroupid number appropriately. You can add more instances of that code to cover other groups.

    edit - this only checks the primary usergroup.
     
    CapnLuffy and DEiMOS like this.
  3. Ranger375

    Ranger375 Well-Known Member

    So basically to get this to work how I want it to is to make several primary usergroups, rather than having everyone as registered with a subgroup?
     
  4. Ranger375

    Ranger375 Well-Known Member

    I just tried and I couldn't get the image to appear
     
  5. Ranger375

    Ranger375 Well-Known Member

    One of the posts in the tips and tricks forum shows that you can add an image to the side of your user name with the following code:

    font-family: "Lucida Grande" ,Helvetica,Arial,sans-serif;
    font-weight: bold;
    color: #73427c;
    background-image: url(styles/default/xenforo/smilies/admin.png);
    background-repeat: no-repeat;
    padding-left: 13px;

    Is there a way to modify this code to have the image appear below, rather that to the side? The above
    code is placed in the usergroup css section, and would solve my problem.
     
  6. account8226

    account8226 Guest

    Doesn't works for me. The image is fine but the if doesn't works now.
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    My code is wrong. Use this:

    Code:
                    <xen:if is="{$user.user_group_id} == 2">
    		    <img src="PATH/TO/image.gif" />
                    </xen:if>
    
    I have updated my original post.
     
    DEiMOS likes this.
  8. CaptainMorgan

    CaptainMorgan Active Member

    How would I get this to work for secondary groups?
     
  9. CaptainMorgan

    CaptainMorgan Active Member

    No love, eh?
     

Share This Page