Support

  1. Zephyrinus
  2. General
  3. Sunday, July 05 2015, 08:12 PM
I found a lot of people asking for a rating/review function. Writing reviews is easy by implementing Disqus.. One down, one to go.

Maybe we can work towards a simple sollution?

If i add two new field to profiles, let's say alias "ratingavg" and "ratingamount". We need a simple input field, like:

<input type="number" class="uk-form-width-mini" value="8" max="10" min="0" id="rating" name="rating_1">


And a button that starts a php script.

- (( "ratingavg" x "ratingamount" ) + "input" ) / ( "ratingamount + 1" ) ---- save into ---> "ratingavg"
- ("ratingamount" + 1 ) --- save into ---> "ratingamount"

Then we can do all the cool stuff we can do with easy-profile within a HTML delimeter. I just don't know how to php read and write this way...

If you guys help me with that i'll manage, plus i will report back in this topic.

Could you guys please help me (us?) out?

warm regards,

Dennis
Zephyrinus Accepted Answer
Pro
ok,

I started on my own... But i'm no programmer, so i might need some help later on to get this secure and without people voting multiple times.

I created 2 (invisible) EP fields:
- Alias: ratingamount (number)
- Alias: ratingavg (text)

Receive id of displayed profile
Every time somebody votes: ratingamount + 1 and posts back
Every time somebody votes: ratingavg (average) gets updated and posts back
Save dispayed profile

This is the baby-php

<?php
require_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
$id = JFactory::getApplication()->input->getInt('id', 0);
$user=new JsnUser($id);
$user->ratingavg = $user->ratingavg * $user->ratingamount;
$user->ratingamount = $user->ratingamount + $_POST["plus"];
$user->ratingavg = $user->ratingavg + $_POST["rating"];
$user->ratingavg = $user->ratingavg / $user->ratingamount;
$user->save();
?>


And this will be the input field within a module set on a users' profile

Current rating: {user ratingavg displayed}
<span><p style="font-size: 12px">
  {user ratingamount displayed} people voted
</p></span>
<form method="post">
Rating: <input class="uk-form-width-mini" type="number" value="8" max="10" min="0" name="rating"><br>
do count: <input class="uk-form-width-mini" type="number" value="1" max="1" min="0" name="plus">
<input type="submit" value="rate" class="btn btn-primary jsn_search_btn">
</form>


Any tips & tricks?
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
Hi,
I think this is not a good way. For example this not prevent multiple rating from same users

Rating feature needs many checks.

We recommend you to use some system rating plugin (maybe with some code changes)

Quick Example:
- Installed this plugin http://extensions.joomla.org/profile/extension/clients-a-communities/ratings-a-reviews/starsnippets
- Create a HTML delimiter with this code in description: {star-snippet}
- See results in screenshot

NOTE:
- this is only example, this plugins work with external provider (It would be a better thing that would save the data on your database).
- this plugin pass url to external provider to store rating but you need to know that profile have 2 url:
http://1.your-site.com/profile (if you are logged in)
http://2.your-site.com/profile/username
so you need to do some changes to this script to pass also username if missing.
Attachments (1)
  1. more than a month ago
  2. General
  3. # 2
Zephyrinus Accepted Answer
Pro
Yes, but this one works with an external provider. Others only work within com_content.

And we need some simple rating fiels which can be shown also within the userlists... It would be an awesome feature. There must be some work-around or simple sollution?

Please help, i'm guessing everybody would benefit from this

warm regards,
  1. more than a month ago
  2. General
  3. # 3
Zephyrinus Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.