Requiring guidelines reading before flagging / required badges as part of TL?


(Wolftune) #1

Continuing the discussion from Customized Trust Levels:

We’d like to require reading the guidelines before users are allowed to flag posts.

It seems one way would be to require the read-guidelines badge to reach TL1. Is that possible?

Alternatively, the same action that gets the badge (visiting the guidelines) could be a requirement directly, but that’s an implementation detail.

In general, being able to choose badges as requirementsfor attaining TLs could make TLs very flexible in general for all sorts of uses…


(Wolftune) #2

Bump, still wanting to know if this is possible or what the best workarounds could be… happy to hear from anyone who knows


(Joe) #3

You can try something like this in the </head> section:

<script type="text/discourse-plugin" version="0.8.18">
  const loggedIn = Discourse.User.current();

  if(loggedIn != null) {
    readFaq = loggedIn.read_faq;
    if (readFaq == false) {
      $("html").addClass("no-flag");
    }
  }
</script>

And this in the CSS section:

.no-flag .create-flag {
    display: none;
}

To hide the flag button unless the user read the FAQ page. This is purely visual but should do the trick for most cases.