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

XF 1.5 Profile Conditionals

#1
I am trying to modify the "member_view" template to display information based on a particular staff position under the "Information" tab on the profile. This is what I have so far:

Code:
Snipped
Doing this will provide the following:



I was trying to play around with the conditionals, however, I am failing. I want the aforementioned code to be displayed on a particular users profiles, based on UID, however, I also want it to be displayed to registered users as well at the same time. I don't want the code to be displayed on all profiles, just ones that fit a particular conditional.

Any help?
 
Last edited:

James

Well-known member
#2
To target the individual user profile that you're on you need to use $user. To target the actual person viewing the profile you need to use $visitor

So, if $user.user_id = x AND $visitor.user_id
 
#3
To target the individual user profile that you're on you need to use $user. To target the actual person viewing the profile you need to use $visitor

So, if $user.user_id = x AND $visitor.user_id
I must be doing something wrong here when trying that, I am sure it's with the code I am using:

Code:
<xen:if is="{$user.user_id == 1716} AND {visitor.user_id}">
blah blah blah
</xen:if>
What am I doing wrong?
 
#5
Your visitor variable doesn't start with a $?
Sorry, that was my fault when I copied the code. The actual code did have it. I am still getting this error. Any ideas as to why?

Code:
<xen:if is="{$user.user_id == 1716}" AND "{$visitor.user_id}">
blah blah blah
</xen:if>
 
#7
That's what I thought it was too, but it's not. I tried it a number of ways and it didn't work. I guess I will wait for others to pitch in as well. Thanks!
 

James

Well-known member
#8
It sounds like the placement may be an issue because the code should work. Is it inside a content check or anything that may be returning false?

Screenshot_20160608-181000.jpg
 
Last edited:
#9
No, it's in-between a closing <div> and an opening <xen:if>. For testing purposes, I added the above code to the very top of the "member_view" template and I got the same syntax error that I have been getting.