# Kirby Ratings - Vote for a page with a 5 star scale

**URL:** <https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166>\
**Category:** Plugins\
**Created:** [September 2, 2016, 1:11pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166 "2016-09-02T13:11:03Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [January 31, 2017, 2:08pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/21 "2017-01-31T14:08:26Z")

</div>

Hello,

is the rating “readable” by google and the stars visible on the search results there?

it seems the snippet in the kirby template need a special format. look at: [http://www.webpagefx.com/blog/seo/how-to-get-stars-search/](http://www.webpagefx.com/blog/seo/how-to-get-stars-search/)

and: [https://schema.org/Rating](https://schema.org/Rating)

Haven’t tested the plugin right now… just want to know if this feature is right there.

beste regards,  
Sven

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [January 31, 2017, 2:25pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/22 "2017-01-31T14:25:22Z")

</div>

Not out of the box. But if you know the syntax you prefer for it you can use these functions:

```php
echo $page->ratingAverage();
echo $page->ratingCount();

```

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [February 15, 2017, 10:46am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/24 "2017-02-15T10:46:42Z")

</div>

@Svnt I read it before you deleted it. Did you solve the assets problem? Often when I have problem with assets I have a route that matches anything and it prevents the assets from loading. I don’t know if that was you problem, but anyway…

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [February 15, 2017, 11:09am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/25 "2017-02-15T11:09:58Z")

</div>

Yes, solved it. Works great now.  
At first it was messed up but after some times i realised the problem was on my side and it worked like described in your docs.

I have found a untranslated text in your _plugins/kirby-ratings/snippets/modal.php_

`<div class="ratings-success-close" href="<?php echo $go; ?>">Stäng</div>`

I added a translation to my de.php file:

```
<?php
l::set('plugin.ratings.success', 'Sie haben den Artikel bewertet!');
l::set('plugin.ratings.vote.for', 'Bewerten sie');
l::set('plugin.ratings.send', 'Bewerten');
l::set('plugin.ratings.not.rated', 'Sie haben den Artikel nicht bewertet!');
l::set('plugin.ratings.average', 'Durchschnittliche Bewertung');
l::set('plugin.ratings.count', 'Bewertungen');
l::set('plugin.ratings.delete.blacklist', 'Blacklist löschen');
l::set('plugin.ratings.delete.votes', 'Bewertungen löschen');
l::set('plugin.ratings.stars', 'Sterne');
l::set('plugin.ratings.already.voted', 'Sie haben diesen Artikel bereits bewertet!');
l::set('plugin.ratings.invalid.ip', 'Die IP ist nicht gültig!');
l::set('plugin.ratings.invalid.secret', 'Die geheime Nummer ist falsch!');
l::set('plugin.ratings.invalid.format', 'Das Eingabeformat ist falsch!');
l::set('plugin.ratings.page.does.not.exist', 'Diese Seite existiert nicht!');
l::set('plugin.ratings.modal.close', 'Schließen');

```

thanks a lot,  
Sven

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [February 15, 2017, 12:12pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/26 "2017-02-15T12:12:06Z")

</div>

Thanks! 🙂  
I see that I have already an issue about german translation. It’s not exactly as yours. Hard to tell which one is most correct. [https://github.com/jenstornell/kirby-ratings/issues/20](https://github.com/jenstornell/kirby-ratings/issues/20)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 15, 2017, 12:25pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/27 "2017-02-15T12:25:06Z")

</div>

@jenstornell: I think the translation you linked to above is a better fit (and more neutral).

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [May 31, 2017, 9:24am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/28 "2017-05-31T09:24:39Z")

</div>

Hello @jenstornell

i have a question: how does the plugin identify users who have already voted?  
A colleague told me he tested it with a “fresh” browser and a VPN and was still  
identified. really good but how you do it? 😃

best regards,  
Svnt

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [May 31, 2017, 2:57pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/29 "2017-05-31T14:57:17Z")

</div>

That sounds strange. I store IP numbers as files, one file for each visitor (IP-number). A VPN should give a new IP which should be seen as a new visitor. Did you try that it’s possible to vote at all? That it’s not blocking all users or anything like that?

> <https://github.com/jenstornell/kirby-ratings/blob/master/core/validate.php#L19>

(I now like this plugin more: [https://github.com/jenstornell/kirby-nja](https://github.com/jenstornell/kirby-nja), but it’s a bit different)

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [May 31, 2017, 4:46pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/30 "2017-05-31T16:46:06Z")

</div>

yes, voting works. i have to check this tomorrow.

Btw, you don’t store ‘ip numbers’… you store md5 hashes of the ip… and this is good because german law is stupid: [https://www.technologylawdispatch.com/2017/05/in-the-courts/german-federal-supreme-court-confirms-dynamic-ip-addresses-may-constitute-personal-data/](https://www.technologylawdispatch.com/2017/05/in-the-courts/german-federal-supreme-court-confirms-dynamic-ip-addresses-may-constitute-personal-data/)

thank you for the plugin! 👍

---

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [June 1, 2017, 8:12am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/31 "2017-06-01T08:12:53Z")

</div>

md5 is not secure, right? switch to something else like [crypt::encode](https://getkirby.com/docs/toolkit/api/crypt/encode)?

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [June 1, 2017, 9:17am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/32 "2017-06-01T09:17:14Z")

</div>

> [@bnomei](#):
>
> md5 is not secure, right?

right, but i don’t see any security issues here.  
ok, you can brute force IPs against the hash and get the ip in max. 4294967295 tries.  
But why somebody should do this here? Dunno…

> [@bnomei](#):
>
> switch to something else like crypt::encode?

Maybe, but this is crypting therefore there is a crypt::decode method… with a password.  
And this password have to be stored on the server somewhere otherwise the plugin  
can’t create ‘hashcrypts’ on it’s own.

So if somebody steal your password: every crypted entry is exposed.

A one way hash is much better in this case.

Svnt

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [June 1, 2017, 10:31am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/33 "2017-06-01T10:31:57Z")

</div>

I feel like using a more advanced hash is a bit overkill. The main reason I use md5 is that it’s a lazy way to create character allowed filenames. But I understand that it can be good for laws to not write the IPs in plain text.

What do you think?

_Poll ([view on site](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/33))_

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [June 1, 2017, 7:37pm UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/34 "2017-06-01T19:37:39Z")

</div>

> [@Svnt](#):
>
> md5 is not secure, right?
> 
> right, but i don’t see any security issues here.  
> ok, you can brute force IPs against the hash and get the ip in max. 4294967295 tries.  
> But why somebody should do this here? Dunno…

Well, no. There are [rainbow tables](https://en.wikipedia.org/wiki/Rainbow_table) that make it _very_ easy to reverse an MD5 hash. So storing an MD5 hash is essentially the same as storing the IP in the first place.

If you really want to avoid storing the IP, use something like PHP’s `password_hash()`. But of course it doesn’t only use characters that are safe in filenames as @jenstornell wrote.

Best compromise: MD5 with a salt. Rainbow tables won’t work with that. And because no one would ever brute-force IP addresses, I think it’s fine (but I’m not a lawyer).

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [June 2, 2017, 5:57am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/35 "2017-06-02T05:57:04Z")

</div>

I agree, it would be a good compromise.

- [https://github.com/jenstornell/kirby-ratings/issues/21](https://github.com/jenstornell/kirby-ratings/issues/21)
- [https://github.com/jenstornell/kirby-nja/issues/12](https://github.com/jenstornell/kirby-nja/issues/12)

If I will add it in the future, it’s most likely that I will add it to [Kirby Nja](https://github.com/jenstornell/kirby-nja). If someone want to be adventurous, the code for it should probably look something like this (untested):

```php
$filename = md5(c::get('nja.salt', u()) . $ip);

```

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [August 31, 2017, 9:04am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/36 "2017-08-31T09:04:12Z")

</div>

I can only vote once per article.  
Changing IP/Browser does not help. I always get “already voted”.

Any idea what’s wrong?

Svnt

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [August 31, 2017, 9:10am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/37 "2017-08-31T09:10:03Z")

</div>

🙂 Doesn’t it what a good vote system must do ? Prevent users to vote mutliple times because if they could, it would be total anarchy ?

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [August 31, 2017, 9:11am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/38 "2017-08-31T09:11:14Z")

</div>

> [@Oziris](#):
>
> 🙂 Doesn’t it what a good vote system must do ? Prevent users to vote mutliple times because if they could, it would be total anarchy ?

But in my case only one user can vote. All others are blocked by the “already voted” message.

---

<div class="post-metadata">

**Author:** ![Oziris](https://avatars.discourse-cdn.com/v4/letter/o/df788c/32.png) [@Oziris](https://forum.getkirby.com/u/Oziris)\
**Post date:** [August 31, 2017, 9:15am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/39 "2017-08-31T09:15:16Z")

</div>

Mhmm ok sorry it wasn’t clear for me but unfortunaly, I don’t know well this plugin, I let the creator answer to you

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [August 31, 2017, 9:16am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/40 "2017-08-31T09:16:32Z")

</div>

How did you test it by another user? Did you walk to another computer, switched browser or something else?

---

<div class="post-metadata">

**Author:** ![Svnt](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/svnt/32/620_2.png) [@Svnt](https://forum.getkirby.com/u/Svnt)\
**Post date:** [August 31, 2017, 9:17am UTC](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166/41 "2017-08-31T09:17:39Z")

</div>

Yes, all of this… switched apartment, browser, ip 😃

[Previous page](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166.md?page=1)

[Next page](https://forum.getkirby.com/t/kirby-ratings-vote-for-a-page-with-a-5-star-scale/5166.md?page=3)
