Do NOT Show "Log in to post" Button If User Can't Post to that Category
-
Or maybe make it say, "Login to view..."
-
@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.
-
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.
-
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.
-
@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.
-
@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)
-
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.