EE entry rating module

I finally could force myself to write up at least a rough documentation for an entry rating module I made some time ago. So here it comes.

Features / characteristics are:

  • independent from comments
  • can be restricted to logged-in members only
  • voting results from members and visitors may be shown separately or overall
  • rating-form is either drop-down with configurable options or radio-inputs from 1 to 5
  • result output either with images (like the stars here) or numbers or both - can be defined with variables in the template
  • works on single- and multi-entry pages
  • {exp:weblog:entries} can be used to list entries sorted by highest ratings.
  • one vote per member per entry allowed
  • one vote per IP per entry allowed

You can see it in action over here


Installation:

  1. Upload the entry_rating-folder into the modules folder of your ExpressionEngine system directory.
  2. Upload the ext.entry_rating_ext.php-file into the extensions folder of your ExpressionEngine system directory.
  3. Upload the lang.entry_rating.php-file into the language/english folder of your ExpressionEngine system directory.
  4. Upload the images empty.gif, half.gif & full.gif to any directory you like. You can also use your own set of images as long as you keep the names.
  5. In your Control Panel goto Modules, locate the Entry Rating module and click Install.
    • Now you can click on the Entry Rating module to enter the settings.
    • If you want to use the images to represent the voting result, enter the URL of the folder to which you uploaded the images. If the URL is correct the images will appear instead of the ??? once you clicked update settings.
    • If you want to use the SELECT-input for voting you can edit the options here.
    • You may also change the label of the button used to submit the vote
    • and the text that appears if the user already voted on an entry
  6. In your Control Panel goto Admin > Utilities > Extensions Manager, locate the Entry Rating extension and click Enable?.

The tags:

{exp:entry_rating:show_rating entry_id="{entry_id}"}<br />
{/exp:entry_rating:show_rating}

The show_rating tag is used to output the voting results for an entry. Obviously it has to be placed inside a {exp:weblog:entries}{/exp:weblog:entries} tag-pair. This can be done on a single-entry page as well as on a multientry-page.

Parameters:
entry_id="{entry_id}”
This parameter is mandatory.

Inside the show_rating tag-pair you have access to several variables to output your results.

{overall_votings} The total number of votes
{overall_vote} The numerical value of the average voting result, logged-in users and visitors combined
{overall_vote_symbol}Graphical representation of the average voting result, logged-in users and visitors combined

{visitor_votings} The total number of votes made by visitors
{visitor_vote} The numerical value of the average voting result by visitors
{visitor_vote_symbol} Graphical representation of the average voting result by visitors

{member_votings} The total number of votes made by logged-in users
{member_vote} The numerical value of the average voting result by logged-in users
{member_vote_symbol} Graphical representation of the average voting result by logged-in users


{exp:entry_rating:rating_form entry_id="{entry_id}"}

This tag displays the rating form if the current user has not already voted for this entry. If he has already voted his vote is displayed instead of the form. Note: this tag has no closing tag.

Parameters:
entry_id="{entry_id}”
This parameter is mandatory.

members_only="1”
If this parameter is set, the form will only be displayed to logged-in members.

type="radio”
If this parameter is set, the rating-form is displayed with radio-buttons labels 1-5.

5 4 3 2 1  

otherwise it defaults to a select-list.


 


{exp:entry_rating:order_by_rating type="overall" limit="5"}
{exp
:weblog:entries weblog="testsite" entry_id="{order_by_rating}" sortby="rating" dynamic="off"}
<a href="{path=site/article}">{title}</a>
{exp:entry_rating:show_rating entry_id="{entry_id}"}({overall_vote}){/exp:entry_rating:show_rating}
{
/exp:weblog:entries}
{
/exp:entry_rating:order_by_rating}</p>

To show a list ordered by voting results the {exp:entry_rating:order_by_rating}-tag is wrapped around a {exp:weblog:entries}-tag like shown above.

Parameters:

type="”
Optional. Can be set to “overall”, “members” or “visitors” depending on which wihich result you want to show. Defaults to “overall”.

limit="”
Optional. Limits the number of entries to be shown. Defaults to 10.



Download: ee_entry_rating.zip
10.38 KB

If you found something useful here and want to show your appreciation feel free to

or


Comments:

5 of 6 pages « Erste  <  3 4 5 6 >

I’m still getting the errors from my earlier comment. Any idea what is wrong? Perhaps I installed it incorrecty. Thanks for your help (in advance).

Posted by EFL Geek  on  11/12  at  03:16 AM

Yes it’s inside the entries tag.

Posted by EFL Geek  on  10/07  at  12:47 AM

Do you use the {exp:entry_rating:rating_form entry_id="{entry_id}"} tag inside an exp:weblog:entries tag?

Posted by  on  10/06  at  06:17 PM

I’ve got everything installed and input into my templates without a problem. However when I, as admin, try to vote i get the following error

Notice: Undefined variable: entry_id in /path/to/system/modules/entry_rating/mod.entry_rating.php on line 374

Notice: Undefined variable: entry_id in /path/to/system/modules/entry_rating/mod.entry_rating.php on line 377

Warning: Cannot modify header information - headers already sent by (output started at /path/to/system/modules/entry_rating/mod.entry_rating.php:374) in /path/to/system/core/core.functions.php on line 296

Posted by EFL Geek  on  10/06  at  06:38 AM

Thankx Oliver, that does work indeed, should have thought of that!

I do have another small issue with the list ordered by voting results, using this: {exp:entry_rating:order_by_rating}, the results get ordered based on voting results. Which is good, but I think the list should also be ordered based on the total number of votes.

Right now, if a post gets 5 votes from one user, it can rank higher then a post with 5 votes from 8 users. See my example right here

Posted by Gerard  on  08/21  at  08:45 PM

Thanks Oliver.  Based on what the module does, a mandatory 5 options makes complete sense.  I’ll just have to put “spare time for Oliver” on my already incredibly long wish list.

Posted by Keith Ecklund  on  08/21  at  04:25 PM

5 of 6 pages « Erste  <  3 4 5 6 >