Limit Translator use to certain groups only

Hi,

I have rather unusual question. Is it possible to make plugin allowed to use to users from specific groups only? Long story short: the community is very big, the demand for translation grows, so do our costs too. In our community, we have paid users which belong to specific groups. The idea is to limit the translator usage to these specific groups if it is possible to do.

I don’t mind converting this request into Marketplace topic, I just want to hear any ideas on where to dig to achieve the desired outcome described above.

3 Likes

There’s not currently a way to limit a plugin to only a specific group, it could be added as a feature to any individual plugin, but would take a little work.

Without adding functionality to the existing plugin, this could be done within a theme…

We have a theme component that adds all of a user’s groups to the body tag: CSS Classes for Current User's Groups

Using this you could hide the translator button for all users that aren’t in a specific group:

body:not(.group-example) {
  .post-controls .translate {
    display: none; 
  }
}

In that example, the translate button below a post would be hidden for anyone not in the “example” group.

A savvy visitor could discover the translate button in their browser’s inspector, so it’s not as comprehensive as a solution directly in the plugin, but it might work well enough for your case.

5 Likes

Hey @awesomerobot

Thank you for your reply. Yes, CSS limitation was the last resort for me, but in the same time, it’s a good way for us to test it. The thing is, we’d like to have functionality, limiting the usage of inline translation with explicit warning that the feature is “premium-only”, which we intended to display when a user outside of specific groups try to use it.

Thank you for your CSS example!

I think we will dive into Our solution for blurring NSFW content idea and combine these two :slight_smile:

1 Like

Hey @kinetiksoft!

Did you figure out how to solve your issue in the end? :slight_smile:

No, not yet :frowning:

Not the first priority for us now, but we thought it should be a bit easier :slight_smile:

1 Like

Found a different approach to limiting from CSS?

That’s absolutely necessary because bots can drain API tokens we need to give good translations.

And I think that LVL1 is OK! We don’t want people read 3 months before translate but just limit bots and trolls :grimacing: