6

How to: Set voting rules

Thumbnail for How to: Set voting rules

GD Star Rating allows you to set rules for voting that can be global, per category and per post. This way you can set very precise rules through out the blog and control the voting process. This post will explain how voting rules work and how to use it.

Voting rules are introduced very early in the plugin development, long before 1.0.0 version. Since then, they have been improved and expanded to allow categories based rules, to support time restrictions and tools for setting the rules. So, right now voting rules can be set for individual posts, for categories and as global.

Voting rules basics

First, here is the list of voting rules:

  • Everyone can vote: both registered users and visitors can vote
  • Only visitors: only visitors (not logged in) can vote
  • Only users: only registered and logged users (or members) can vote
  • Locked: no one can vote, but rating block is visible
  • Locked and hidden: rating block is not even displayed
  • Inherit from Category: rules are inherited from the category the post belongs to
  • Inherit from Parent: this is category only rule, and one category inherits rule from it’s parent

All rules can be applied to posts and comments. Multi ratings and thumbs ratings use these rules also. Right now multi rating and standard rating rules can’t be set separately, but it’s in the plans.

Global rules are not used directly. They are used only when the data for a post is first added to the plugin database. This newly created record will contain duplicated global rules. From that point on, rules for that post are set and will be used in the voting. Changing the global rules will affect only new posts added to the system. Each time a rating block is prepared only rules on the post itself are used.

But there is a special rule that can be applied that will change that.  Inherit from Category rule will tell plugin to use rules from the category the post belongs to. This way, settings rules for category only, all posts in the category (if set to this inherit rule) will use this rules. If a post belongs to more than one category than a plugin will decide what rule to use based on some internal rules. Last special, inherit rule from parent is used only on categories. More on this can be found here. Global rules also applies to categories once the category data is initialized.

Tool for bulk modifications

Tool for bulk modifications

Once you have posts and rules for the posts, you can change rules for each individual post in two ways: using the plugins widget on the post edit panel or using plugin’s Articles panel. But, you can change rules for all posts at once using Tools panel. With this tool, all posts will be set to new rules.

Limit voting to a category

A lot of people were asking about settings voting for posts belonging to only one category or few of them, and it’s not that hard to do at all. So, here are the simple steps to achieve that. You need to modify global rules to point to categories, to execute bulk update so that all existing post are set to new rules and to set categories rules.

  1. On Settings panel, you need to set default voting rules for post (and/or comments) to Inherit From Category.
  2. Go to Tools panel, and using Global Voting Rules Update tool on the Bulk tab and set voting rules again to Inherit From Category. Now, all posts, and all future posts will be set to this rule.
  3. Go to Categories panel. There you see all the categories your blog has. For a category you want votes to be allowed in you change rule(s) to Everyone or users or visitors, and to all other categories you set rules to Locked or Locked and Hidden.

That’s it. All posts (and / or comments) belonging to category you allowed voting from will have working rating stars or thumbs or whatever you use, all other posts will be closed for voting. Last step can be a problem if you have hundreds of categories, and it can take some time to set all of them, and I plan to expand bulk tool to set rules globally for categories too.

Even with rules set the way described there, you can still change rules for individual posts belonging to locked categories to allow ratings. Post rules always override global or categories based rules.

That’s it for now, I hope that this post will help you better understand logic of voting rules plugin implement and that you will be able to use this to better control where the ratings will actually be used.

    GD Star Rating
    loading...
    How to: Set voting rules7.41051

    Share this:

    RSS DiGG Google Buzz Google Technorati StumbleUpon Design Float Microsoft Live PDF Favorites

    6 Responses to “How to: Set voting rules”

    1. AG

      July 22, 2009
      at 4:28 PM

      Thanks for this article about configuration option!

      Maybe for a future release it will be great to have a message for instance notifying visitor that the vote is restricted to registered user only on this article. What do you think?

      GD Star Rating
      loading...
      • MillaN

        July 22, 2009
        at 4:53 PM

        Yes, good idea. I plan to expand templates to support such message. This will be a part of 1.6.0 release.

        GD Star Rating
        loading...
    2. Mark

      July 23, 2009
      at 1:55 PM

      Hi MillaN

      I have tried to find the answer without any luck.

      Is it possible to have only the person making a comment place a rating about the post, and then have the average rating for each comment shown in the post. (Like a product rating site, visitors can comment and rate a product).

      GD Star Rating
      loading...
      • MillaN

        July 23, 2009
        at 2:01 PM

        Yes. There are many methods for this, and all of them are described, and there are tutorials about that.

        GD Star Rating
        loading...
    3. DMAK02

      July 27, 2009
      at 7:49 PM

      Couldn’t seem to find this;

      “On Settings panel, you need to set default voting rules for post (and/or comments) to Inherit From Category.”

      GD Star Rating
      loading...
    4. sabbir

      July 29, 2009
      at 1:25 PM

      Hello

      I am using multirating system on a site. I added a multirating review block and from setting page I enabled multistar rating at post panel. But when I write a post, the rating never saved. and in front end it shows read only blank stars.

      is it a voting rules issue?

      GD Star Rating
      loading...

    Comments are closed.

    Social Networks

    Subscribe via Feedburner Flickr Images

    Feedburner updatesFeedburner

    Sign up to receive all latest news about GD Star Rating directly to your email.