Use CSS to make things GM only?

Bortas
Bortas
edited June 2015 in Campaign Portal Building
Is there a way to hide certain elements unless the user is logged in as GM?

-bort

Comments

  • GamingMegaverse
    GamingMegaverse
    Posts: 2,999
    The gm only sections work great for me

    Just trying to help out.

  • Bortas
    Bortas
    Posts: 645
    Sorry, let me be clear:

    I have a certain CSS element, say.... .icon-edit, that I want to hide unless the user is a GM... any ideas?

    -bort
  • Unknown
    edited July 2015
    Why not just throw on the already created class for this in your HTML? The class is: post-gm-only

    That is what OP uses on the GM Only sections that is already coded to be able to hide that unless your GM. I don't think that can be accomplished through CSS alone (pretty sure it requires at least some JS which we can't use) so I don't think you'll have much of an option on it.

    --
    Alex
    "Dragon Age: Requiem":https://da-requiem.obsidianportal.com/
    Post edited by Unknown User on
  • Bortas
    Bortas
    Posts: 645
    Ahh, gotcha. It isn't in the post... it's an already existing outside element.... just something I don't want the players messing with, so I thought I could hide it from them ;-)

    -bort
  • Unknown
    Ahh, morbidly curious, what element was it that you were considering hiding. I mean, I might be able to come up with something, just not super confident on it :)
  • Bortas
    Bortas
    Posts: 645
    .adventure-log-new-container .button .adv-new

    -bort
  • Unknown
    edited July 2015
    Gotcha. Well, since we can't apply a Class to the already existing HTML, why not try this:

    .adventure-log-new-container .button .adv-new {
    display:none;
    }

    Then simply place the button again in your own HTML somewhere and just add on the post-gm-only Class to that so that only you as the GM can see it. If you have a Adventure Log Index post (like I have on my DA:R page) that would probably become the best place to post it. Just toss it in as such on that page:

    @Create a New Post@

    If you want to be even more efficient on preventing your players from posting Adventure Logs so easily (they would still be able to do so by manually entering the right address in the address bar) you should also add this to your CSS (should remove the link for Adventure Log under the "New" menu on the top bar of the site if I set it up correctly):

    .dropdown > li:first-child {
    visibility:hidden;
    }

    All of this should help you get things setup closer to what you're intending I think. I forget how your logs are setup, but if you still have them set in a way where the preview of the content is still visible then keeping the button code close to the start of the Log Index Post should make it visible on the main Adventure Logs page as well. Hope this helps.

    --
    Alex
    "Dragon Age: Requiem":https://da-requiem.obsidianportal.com/
    Post edited by Unknown User on
  • Bortas
    Bortas
    Posts: 645
    I didn't remember to say thanks, so... thanks!

    -bort
  • Langy
    Langy
    Posts: 364 edited August 2015
    JSYK, the Body element of the page has the class 'campaign-game-master' in it if you are the GM. Thus, you could hide the button only for non-GMs purely using CSS, something like:

    body:not(.campaign-game-master) .adventure-log-new-container .button .adv-new {
    display:none;
    }
    Post edited by Langy on
  • Unknown
    Oh, nice use of the :not!
  • Bortas
    Bortas
    Posts: 645
    That is fantastic, thank you!

    -bort
    "Morwindl":https://morwindl.obsidianportal.com
    "EIDL":https://eidl.obsidianportal.com
Sign In or Register to comment.

April 2024
Season of Strife

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions