lesterchan / wp-polls

Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
https://wordpress.org/plugins/wp-polls/
93 stars 78 forks source link

Enable to vote users with a role #101

Closed ambrix closed 6 years ago

ambrix commented 6 years ago

I would like to enable to vote to the registered users with a certain role. Example: non all registered users, only authors can vote. Is that possible? Thanks

lesterchan commented 6 years ago

Sorry the feature doesn’t exist in the plugin. Feel free to fork the plugin and modify it to suit your needs.

jamesg1 commented 6 years ago

This should be possible to do with some changes. I managed to make the polls only allow signed in users to view the questions and submit answers. You would need to add an extra check for the current users role when rendering the form.

https://kellenmace.com/get-current-users-role-in-wordpress/ has a good example of grabbing the user role.