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

If condition for homepage in members profile

Discussion in 'XenForo Questions and Support' started by Simon, Sep 24, 2011.

  1. Simon

    Simon Active Member

    I would like to keep my members profile pages public in my forum but I would like to disable the view of the members homepage to non members. I guess this is possible using an IF conditional statement.

    Could you please advise me of what template I need to edit and a simple If Statement that I can add. (I have several different registered user groups)

    Many Thanks in advance.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Open the member_list template.

    Look for this line near the top:

    Code:
    <xen:h1>{xen:phrase registered_members}</xen:h1>
    Directly after add this:

    Code:
    <xen:if is="{$visitor.user_id}">
    So it looks like this:

    Code:
    <xen:h1>{xen:phrase registered_members}</xen:h1> <xen:if is="{$visitor.user_id}">
    Then right at the bottom of the same template, look for:

    Code:
    </xen:sidebar>
    Directly after add this:

    Code:
    <xen:else /> This content is visible to members only </xen:if>
    So it looks like this:

    Code:
    </xen:sidebar> <xen:else /> This content is visible to members only </xen:if>
    You can obviously change the text to whatever you wish, or even insert a phrase, template there, etc.
     
    RockyR and Andy.N like this.
  3. Simon

    Simon Active Member

    Thank you Brogan for you quick response and now I understand the IF condition part but perhaps I did not explain very well in regards to where I want it placed.:)

    I have a problem with spammers that join, enter a URL into the homepage field in their profile and never come back. I would like to disable the viewing of that 'Homepage' field in the user profile to guests by using an IF condition.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    In that case edit the member_view page and wrap this in the conditional:

    Code:
    <xen:if is="{$user.homepage}">
    <dt>{xen:phrase home_page}:</dt>
    <dd><a href="{xen:string censor, $user.homepage}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>
    </xen:if>
    The link is nofollow though so it matters very little whether spammers populate that field or not.
     
  5. Simon

    Simon Active Member

    Thank you very much Brogan. Thats exactly what I was after. I appreciate it is a no follow link but just a personal choice.
    :)
     

Share This Page