• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
      • Try XenForo Demo
      • New Posts
      • FAQ
      • Calendar
      • Community
        • Groups
        • Albums
        • Member List
      • Forum Actions
        • Mark Forums Read
      • Quick Links
        • Today's Posts
        • Who's Online
      • Sponsor
        • Sponsor a Feature
        • List of Donors
    • Wiki
    • Support
    • What's New?
    • Buy Now
    • Manual
    • 
    • Forum
    • VaultWiki How-Tos
    • VaultWiki Questions
    • Templates, USER variables and hiding content from guests

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Results 1 to 2 of 2

    Thread: Templates, USER variables and hiding content from guests

    • Thread Tools
      • Show Printable Version
    1. January 2, 2018 #1
      ACL
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • View Articles
      ACL is offline
      Regular Member
      Join Date
      January 30, 2017
      Posts
      72
      Rep Power
      119

      Question Templates, USER variables and hiding content from guests

      I have a bit of a dilemma trying to have part of a template adapt based on if somebody is logged in or not. I want to include a preformated link to create a particular kind of wiki page to logged in users only, and skip over the link when viewing as a guest.

      I thought it would just be a simple matter of using this in an if condition:
      Code:
      [var]USER|id[/var]
      However, using this directly inside the [IF= .... doesn't work at all (probably due to the nested square brackets?).

      So next I tried moving this part of the template into a separate (child) template, and now I can get a person's user id (0 for guest). The issue is this always seems to be validated as true. This means a condition check for !=0 or >1 will be true regardless of whether the ID is 12345 or 0.
      Code:
      in parent template: [template]name-of-child-template|userid=[var]USER|id[/var][/template]
      in child template: [if="{{{userid|}}}>0"]code to run[/if]
      Is there a more reliable way of determining if someone is logged in, within a wiki template page?

      If not, I should be able to hide the link using XenForo's .LoggedOut CSS class.
      Reply With Quote Reply With Quote

    2. January 3, 2018 #2
      pegasus
      • View Profile
      • View Forum Posts
      • View Blog Entries
      • Visit Homepage
      • View Articles
      pegasus is offline
      VaultWiki Team
      Join Date
      March 28, 2004
      Location
      New York, NY
      Posts
      2,959
      Blog Entries
      18
      Rep Power
      688
      Hm... Both variations are working for me on the demo site (tried logged in and guest):
      https://www.vaultwiki.org/xf-wiki/in...=Test-VAR-USER
      Using template:
      https://www.vaultwiki.org/xf-wiki/in...child-template

      As what is occurring on your site is potentially a security issue, violating the privacy of USER or allowing one user to perform actions as a different USER (depending on the template), I would ask that you submit a ticket so that this matter can be investigated fully: https://www.vaultwiki.org/members/?do=newticket
      - lead developer for VaultWiki
      Reply With Quote Reply With Quote

    Similar Threads

    1. Guests cant see the index
      By Alfa1 in forum VaultWiki Questions
      Replies: 1
      Last Post: September 26, 2017, 9:53 AM
    2. How to set it so guests can view namespaces when clicking the wiki tab?
      By CedricFP in forum VaultWiki Questions
      Replies: 6
      Last Post: March 15, 2013, 10:20 AM
    3. Guests able to edit articles
      By ebob in forum VaultWiki Questions
      Replies: 1
      Last Post: March 21, 2011, 12:23 AM
    4. Some suggestions and possible bug regarding hiding chapters.
      By Alfa1 in forum VaultWiki Questions
      Replies: 1
      Last Post: August 6, 2010, 12:18 AM
    5. Replacement Variables like $vboptions[bburl]
      By kmonty1978 in forum VaultWiki Questions
      Replies: 1
      Last Post: December 14, 2008, 11:31 PM

    Tags for this Thread

    condition, link, logged, template

    View Tag Cloud

    Bookmarks

    Bookmarks
    • Submit to Digg Digg
    • Submit to del.icio.us del.icio.us
    • Submit to StumbleUpon StumbleUpon
    • Submit to Google Google

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •  
    • BB code is On
    • Smilies are On
    • [IMG] code is Off
    • [VIDEO] code is
    • HTML code is Off

    Forum Rules

    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 1:56 PM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.