Mind you… this is very easy to bypass for someone with a bit of knowledge.
That being said, if all the people you want to be able to vote are members of a group(s), you can “disable” or hide the vote button from everyone else with CSS.
Note the quote marks on the word disable, you’re not really disabling anything here, this is purely visual.
Discourse adds group classes to the body that match user groups
The class added follows this naming structure:
.primary-group-GROUP_NAME
So .primary-group-
is a prefix added to the group name and spaces in the group name change to underscores.
you can use those as CSS selectors.
For example if the people you want to have the ability to vote all fall under the group name Awesome People
Then the selector would be .primary-group-awesome_people
Now that you know the selector, you need to invert it to hide / disable the button from everyone but those people in that group
So first you select body
Like so:
body {
// styles
}
then qualify it with the group name like so
body:not(.primary-group-awesome_people) {
// styles
}
The you add the vote button to the selector:
body:not(.primary-group-awesome_people) .vote-button {
// styles
}
Then you finally add your styles, you have to options here, either remove the button with display:none
or “disable” clicking it with pointer-events: none;
So the final result would be either:
body:not(.primary-group-awesome_people) .vote-button {
display:none
}
Or
body:not(.primary-group-awesome_people) .vote-button {
pointer-events: none;
user-select: none;
}
You can also use more than one group like so:
body:not(.primary-group-awesome_people):not(.primary-group-car_owners):not(.primary-group-chefs)
.vote-button {
pointer-events: none;
user-select: none;
}
And that would only “allow” members of the Awesome people, Car Owners, and chefs groups to be able to click / see the voting button.
Also, note that I have not tested this extensively but would be happy help if issues come up.