XF 1.5 UserTitle Questions

EvilGenius

New member
Little introduction for the problem and questions i am gonna have:

Before we go let me give some intro about what i have atm:
I have user groups who are for the main ladder and in their "usertitleOverride" i have given them an image.
I have few extra groups who are called alts for the ladder group so if person wanna be added to them i add them manually.
Which UserTitle to be shown is commanded by the group priority. So when they rank up in the ladder the next group they go to have for sure bigger style priority than the alts of the previous group they were in.

Then i have an custom field where people can tell which ladder they wanna be i have 3 ladders.
And i have written the following code in the view template to give them the corresponding picture depending on the ladder they chose.
Code:
<xen:if is="{$user.customFields.FieldId} == 'Something'">
                 <em class="userTitle" {xen:if $user.user_id, 'itemprop="title"'}>
                        <xen:if is="{xen:helper ismemberof, $user, 12}">
                            <img src="..image">
                        </xen:if>                   

                        <xen:if is="{xen:helper ismemberof, $user, 13}">
                            <img src="..image">
                        </xen:if>

                        <xen:if is="{xen:helper ismemberof, $user, 14}">
                            <img src="..image">
                        </xen:if>

                        <xen:if is="{xen:helper ismemberof, $user, 15}">
                            <img src="..image">
                        </xen:if>

                         and so on
                </em>



<xen:elseif is="{$user.customFields.FieldId} == 'Something'"/>
                <em class="userTitle" {xen:if $user.user_id, 'itemprop="title"'}>

                        <xen:if is="{xen:helper ismemberof, $user, 12}">
                            <img src="..image">
                        </xen:if>

                        <xen:if is="{xen:helper ismemberof, $user, 13}">
                            <img src="..image">
                        </xen:if>                       

                        <xen:if is="{xen:helper ismemberof, $user, 14}">
                            <img src="..image">
                        </xen:if>

                        <xen:if is="{xen:helper ismemberof, $user, 15}">
                            <img src="..image">
                        </xen:if>

                        and so on
                </em>

<xen:else />
                        <xen:if hascontent="true">
                             <em class="userTitle" {xen:if $user.user_id, 'itemprop="title"'}>
                                 <xen:contentcheck>
                                      {xen:helper userTitle, $user, 1, 1}
                                 </xen:contentcheck>
                               </em>
                         </xen:if>
</xen:if>

In there i check what ladder they picked.
Then i check if they are in X ladder or alt group.
If they are i give them a direct picture for the corresponding ladder.
The last else is to give them the default ladder pictures if they are with the default ladder.

The questions i have about it:

1) Can this code be made with foreach where instead of checking group by group i do the following (in the template):
Foreach(group in groups)
if(user is in group) then
usertitle = image(group.id).png


Something along the lines of that or if there is other suggestion that would be fine too.
And if that above can be made can you tell me around how the syntax would look in the template.

2) That's if you can't do the loop is there at least a way to instead of give:

<xen:if is="{xen:helper ismemberof, $user, 15}">
<img src="..image">
</xen:if>

Can i somehow make it:
<xen:if is="{xen:helper ismemberof, $user, 15}">
$user.userTitle = image
</xen:if>

And if i can how do i call that userTitle it can be other way not only as prop of the user class.

Because at the moment i have the issue that if the user is added to 2 groups of those i check he would get 2 pictures which is obvious considering i don't check the style priority in here. So the whole idea is for them to get just 1 UserTitle by me just changing the following user Title but still taking into account the priority.

Aka: The user takes his group with highest display priority and after that i just change what the userTitle of the user to the one i want.


If there is anything that you think i haven't explained properly feel free to ask me to explain it better.

@Mike @Brogan If this thread isn't for this forum can you move it to it's corresponding forum. Thanks beforehand.
 
Top Bottom