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

Let user decide about ads

Discussion in 'Resource and Add-on Discussions' started by archimedes, Jan 5, 2014.

  1. archimedes

    archimedes Member

    I want to give my user the choice to decide if they want to view ads or not.
    Is there an addon to do this?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Do it with a custom user field and conditional statements.
  3. archimedes

    archimedes Member

    Great idea! I have defined two options for a drop down menĂ¼. But there is also a blank default value.
    Can I define the default to one of my field values?
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Use <xen:if is="{$user.customFields.field_id}"> to check if the option has been selected.

    If not, apply the default.
  5. archimedes

    archimedes Member

    Take a look here:

    Bildschirmfoto 2014-01-06 um 13.33.55.png

    There are 3 options: "blank, ja and nein" - but I only want "ja, nein".
  6. Russ

    Russ Well-Known Member

    You could approach it using a simple check box instead of a dropdown

    Then your conditional would simply be:

    <xen:if is="{$visitor.customFields.adsshowing.on} == 'on'">
    ads on
    I think that's right :D
  7. Brogan

    Brogan XenForo Moderator Staff Member

    If it's simple yes/no, why not just do a checkbox?
  8. archimedes

    archimedes Member

    Thank you guys - great support from you!

    Perhaps one last thing:
    Can you help me with a sql-query to count the forumusers who has checked this field?

Share This Page