1. 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

Discussion in 'Styling and Customization Questions' started by AwesomeLucky, Jun 8, 2016.

  1. AwesomeLucky

    AwesomeLucky Member

    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: Jun 9, 2016
  2. James

    James Well-Known Member

    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. AwesomeLucky

    AwesomeLucky Member

    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?
     
  4. James

    James Well-Known Member

    Your visitor variable doesn't start with a $?
     
  5. AwesomeLucky

    AwesomeLucky Member

    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>
    
     
  6. James

    James Well-Known Member

    You've closed the conditionals with "" before and after the AND which could be throwing it off.
     
  7. AwesomeLucky

    AwesomeLucky Member

    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!
     
  8. James

    James Well-Known Member

    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: Jun 8, 2016
  9. AwesomeLucky

    AwesomeLucky Member

    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.
     
  10. James

    James Well-Known Member

  11. AwesomeLucky

    AwesomeLucky Member

    I see what I did, I had the UID inside the brackets. My code and yours is identical other than that. I got it working now.
     
  12. James

    James Well-Known Member

    D'oh should've seen that in your code example and saved myself typing that out on mobile! Glad it's working.
     
  13. AwesomeLucky

    AwesomeLucky Member

    Well, it's the smallest things that we often times over look. :whistle: Thanks for your help!
     

Share This Page