• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Do NOT Show "Log in to post" Button If User Can't Post to that Category

Scheduled Pinned Locked Moved Technical Support
11 Posts 5 Posters 2.8k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    c.k. lester
    wrote on last edited by c.k. lester
    #1

    It looks like if a guest is viewing a category that CANNOT be posted to by even registered members, that the button shows, "Log in to post." How do I get rid of that button for categories that registered users can't post to?

    I mean, it would be stupid to show that button and have my user click it, log in, then realize they can't post to the category. 😄

    The highlighted message below the button doesn't need to show either ("There are no topics in this category. Why don't you try posting one?").

    C 1 Reply Last reply
    0
  • C Offline
    C Offline
    c.k. lester
    replied to c.k. lester on last edited by
    #2

    Or maybe make it say, "Login to view..."

    1 Reply Last reply
    0
  • julianJ Online
    julianJ Online
    julian GNU/Linux
    wrote on last edited by
    #3

    See, the tricky part here is that we don't know you can't post topics until you log in and we see that you don't have the necessary privileges to post topics.

    Bit of a catch 22 there...

    JaredBuschJ 1 Reply Last reply
    0
  • JaredBuschJ Offline
    JaredBuschJ Offline
    JaredBusch GNU/Linux
    replied to julian on last edited by
    #4

    @julian well actually, you do in this case. He stated that no one has permission to post. One would insinuate that means no one but admin.

    You can hook the permissions of the category and then unless group X has post permission, then do not show the button whether logged in or not.

    Group X could be selectable and default to registered users.

    1 Reply Last reply
    1
  • julianJ Online
    julianJ Online
    julian GNU/Linux
    wrote on last edited by
    #5

    Yes, but that is unnecessarily restrictive and assumes people will be using the privilege system in a specific way -- that is, nobody can post to it except admins.

    Our privilege system has it's quirks, but it is highly customisable, and we wouldn't be able to know if we should show the button or not given no information.

    For example let's say I want to have a category that only allows posting if you're a member of group A (and not registered users). If we set this "group X" to registered users, then the button won't show... but you DO want the button to show, just in case once you log in, you are in group A.

    Hope that makes sense.

    1 Reply Last reply
    0
  • julianJ Online
    julianJ Online
    julian GNU/Linux
    wrote on last edited by
    #6

    I get what you're saying with the group X logic (even if I can't really put it into words), but if I can't explain it in one sentence, it is too complicated and nobody will use it.

    1 Reply Last reply
    0
  • C Offline
    C Offline
    c.k. lester
    wrote on last edited by c.k. lester
    #7

    It's as simple as this: if only admins can post to the category, don't show the "Log in to post" button. Show, instead, "Log in to view" or somesuch.

    If(only_admins) { "Log in to read" } else { "Log in to post" };

    In fact, if you'll tell me where the code is to draw that button, I can probably do this myself.

    1 Reply Last reply
    0
  • TelokisT Offline
    TelokisT Offline
    Telokis
    wrote on last edited by
    #8

    @c-k-lester What if the current guest is an admin? Then it should be "Log in to post" but he is not connected yet so we don't know.

    julianJ C 2 Replies Last reply
    0
  • julianJ Online
    julianJ Online
    julian GNU/Linux
    replied to Telokis on last edited by julian
    #9

    @Telokis said in Do NOT Show "Log in to post" Button If User Can't Post to that Category:

    @c-k-lester What if the current guest is an admin? Then it should be "Log in to post" but he is not connected yet so we don't know.

    Correct, therein lies the problem.

    If you are using a custom theme, then we can change the button to whatever you want it to say (or even remove it altogether)

    1 Reply Last reply
    0
  • C Offline
    C Offline
    c.k. lester
    replied to Telokis on last edited by
    #10

    @Telokis True. But the conditional as written is how I want it to behave, because the behavior is for the user, not the admin.

    1 Reply Last reply
    0
  • yariplusY Offline
    yariplusY Offline
    yariplus Community Rep
    wrote on last edited by
    #11

    Use custom css in the admin appearance tab like this, using the actual category number you want to hide:

    .page-category-16 [component="category/post/guest"] {
      display: none;
    }
    

    Really, I feel like the Login to Post is for posting to the forum in general, not necessarily to the category being viewed.

    1 Reply Last reply
    2

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development