You probably want to see the ratings in the panel. A good use for the page methods.
Antispam
I started a discussion on Github about possible spam from not logged in users:
The result of that question was kind of that IP together together with time is the only protection and that there are no real good solutions (except for captchas that people hates).
But if you have alternative solutions I’m open to suggestions…
Oh, I forgot to write. It does not yet work on multi language sites. I plan to make that work as well, but right now I just wanted it to be released.
This plugin was delayed by the fact that I did not want to use reCaptcha anymore. I have no idea who to blame for that awesome decision. It made me rewrite the plugin from scratch.
Anyway, I’ve tested it on a blank Kirby site with the instructions from my repo and it should work. Good habit: Even if it works on the development site, try it with a fresh install before release.
I have downloaded and installed version 0.5 at a local, new installed Kirby 2.3.2 on XAMPP/Windows (Apache/2.4.9 (Win32) PHP/5.4.27):
If I go to the homepage or to the panel, I now get an error message:
Fatal error: Can’t use function return value in write context in H:\xampp\htdocs\kirby-2.3.2\site\plugins\kirby-ratings\extensions\page-methods.php on line 21
[Added:]
I have no votes or ratings until now. I think but don’t know, whether this is important.
Prior to PHP 5.5, empty() only supports variables;
It seems like it does not work with older PHP versions at the moment. I use 5.5.12. I have two choices:
Try to fix it without be able to test it. (I don’t want to downgrade my environment) Even if I do fix it, maybe there are more cases like it in the code.
PHP 5.4 is only a minimum requirement. We would recommend to always use the latest stable version available to you, Since 5.5 went out of life, that would be 5.6, or ideally PHP 7.
This plugin looks great and I really would like to use it, but I can’t get it to work neither with my current setup nor with a fresh starterkit! In both cases the trigger initially looks like in your video but does not trigger anything and the “modal” gets rendered at the bottom inside the page.
I placed the kirby-ratings-folder in site/plugins/ and followed all your steps (adding css to header, script to footer, fields to blueprint and using the original trigger).
When I looked into the plugin I thought some parts need to be not in the plugin-folder but the coresponding site-folders itself - this is not working either (and of course would confuse plugin parts with everything else).
Then I noticed that the plugin-urls in <?php echo css('assets/plugins/kirby-ratings/css/style.css'); ?> and <?php echo js('assets/plugins/kirby-ratings/js/script.min.js'); ?> seem not right:
Instead of assets/plugins/kirby-ratings/.. a path like plugins/kirby-ratings/assets/.. to point to the plugin assets (and not a plugins/kirby-ratings folder in my assets-folder) would make more sense, but it does not work either.
I’m using PHP 7 which should work, right?
Please help me understand and get this correct, am I missing anything?
I’ve had a few issues reported to me lately that has to do with paths/urls with Kirby 2.4. Can you test it in Kirby 2.3?
The assets url feature with plugins is working in a special way, that might not seem correct at first, but if you read this you can see that it should be correct:
Actually, my current setup uses still Kirby 2.3.2 and only the clean starterkit was 2.4.
And after reading about the plugin-assets structure, that makes sense
Yes I’m working on localhost in Linux (http://localhost:8000/local-test-site-name) but I also copied the 2.4 starterkit with the rating plugin to a live server with the same results where it is working!
In the console I get the following errors:
ERROR: GET http://localhost:8000/kirby-ratings-test/assets/plugins/kirby-ratings/css/style.css @ kirby-ratings-test:12
ERROR: GET http://localhost:8000/kirby-ratings-test/assets/plugins/kirby-ratings/js/script.min.js @ kirby-ratings-test:154
ERROR: GET http://localhost:8000/kirby-ratings-test/assets/plugins/kirby-ratings/js/script.min.js @ kirby-ratings-test:154
ERROR: Uncaught ReferenceError: kirbyRatings is not defined
(anonymous function) @ kirby-ratings-test:155
Because of the first three lines I thought the url to the assets might be wrong.
And the last error (line 155) is the init-function-call in the footer: