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

Using Custom User Fields to customise the layout

Allow your members to choose which content they want to see

Tags:
  1. Brogan

    Brogan XenForo Moderator Staff Member

    Brogan submitted a new resource:

    Using Custom User Fields to customise the layout - Allow your members to choose which content they want to see

    Read more about this resource...
     
    dutchbb and Mirovinger like this.
  2. dutchbb

    dutchbb Well-Known Member

    Code:
    <xen:if is="!{$visitor.customFields.profileposts}">
    How can we add another conditional to this, for example usergroup?
     
  3. Brogan

    Brogan XenForo Moderator Staff Member

    You can just use AND to combine conditional statements.

    However, as presumably you want to limit it to 'premium' user groups, your users may question why the customisation isn't being applied, as it won't stop the field appearing on their account preferences page.
     
  4. dutchbb

    dutchbb Well-Known Member

    The goal is to show ads to everyone except premium members who also have checked 'hide ads' in their settings. :)
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, that will work but the checkbox will still be shown to non premium members.

    It also seems odd that premium members would choose to show ads...
     
  6. dutchbb

    dutchbb Well-Known Member

    I know we have it that way in vb, the idea of non premium members seeing it is they will become interested in premium membership (we put these 'premium members only' links below added features). Some premium members actually want to see the sponsor ads to know about the bargains. However Adsense is always hidden for them and everyone over 300 posts.
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Ahh, that makes sense.
     
  8. dutchbb

    dutchbb Well-Known Member

    Does this not work in the template ad_above_content ? I have used this code:

    Code:
    <xen:if is="!{xen:helper ismemberof, $visitor, 3, 5, 6, 7, 13, 15} AND !{$visitor.customFields.advertenties}">
    It's always hiding now.
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    You can dump it in the template to see if it's available.
    Code:
    {xen:helper dump, $visitor.customFields.advertenties}
    It should be as it's part of the $visitor array.
     
    otto and sinucello like this.
  10. dutchbb

    dutchbb Well-Known Member

    For anyone interested, this is the working code:
    Code:
    <xen:if is="{xen:helper ismemberof, $visitor, 3, 5, 6, 7, 13, 15} AND {$visitor.customFields.hide_google_ads}">
    
    *keep empty* (show no banner)
    
    <xen:else />
    
    *put Adsense code here* (show banner)
    
    </xen:if>
    This allows premium members/mods/admins etc to switch off banners or show them. Other user groups still see/can check the checkbox but it will not work until they upgraded their account.
     
  11. Isil`Zha

    Isil`Zha Active Member

    hmm, I'm trying to give users an option for disabling or enabling margins on .pageWidth, but it seems to not be recognizing my custom field ID (in EXTRA.css)

    Code:
    <xen:if is="{$visitor.customFields.noMargins}">
        .pageWidth
        {
            margin: 0px 0%;
        }
    </xen:if>
    [​IMG]

    The option does appear in the preferences, but it's acting as if the custom field ID doesn't exist. Checking the option does nothing, and if I change the conditional to <xen:if is=!... it does what I expected it to do , but the actual preference checkbox continues to do nothing (it would then be stuck with the lack of margins regardless of what's selected.)
     
  12. Andrej

    Andrej Well-Known Member

    EXTRA.css doesn't support such conditional statements. You have to edit the relevant template directly.
     
    Last edited: Feb 22, 2015
  13. Isil`Zha

    Isil`Zha Active Member

    Odd, it says it I can use XenForo template syntax at the bottom. :( I'm not that great with CSS, do you know what template that would be? I already tried inserting it into PAGE_CONTAINER (I didn't see it in forum_list) under <div class="pageWidth"> but it doesn't do anything when placed there.

    EDIT: Whoops, wrong place
     
    Last edited: Feb 22, 2015
  14. htweet

    htweet Member

    I want to create a custom user field but i need to set the field in such a way that once user inputs a value and submit, another user on the website cannot input similar value.

    For example, when user A inputs 'abcd@email.com' in the email field in the contact details, user B cannot use same 'abcd@email.com' in his email field.

    Now, my question is that how do i create a custom field that work in this way
     
  15. Brogan

    Brogan XenForo Moderator Staff Member

    That would require custom development.
     
  16. htweet

    htweet Member

    How do I get a custom development or developer for this
     
  17. whynot

    whynot Well-Known Member

Share This Page