Skip to Content Skip to Menu

Ability for registred users to rate other users

12 years 3 months ago #204898 by GeniusBrenda


Hello

I need to add the ability for my registred users to rate other registered users
In other words, when other users rate each other, it should then show each
users rating like a score of 9.2 or something like that
(N.B. Please see the attached image)

I do not want to do it via star ratings, so I need a numbered rating system
Please help
(N.B. Please see the attached image)

Thank you
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 3 months ago #204965 by krileon
You could use the existing rating field to allow them to rate the user you could then use CB Query Field to query the database for the ratings and add all the ratings to together, do the math with SQL functions, then display it. This would allow users to easily rate other users with a star system (easy to understand) and have the average displayed as a digit.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • nickr
  • nickr
  • OFFLINE
  • Posts: 49
  • Thanks: 2
  • Karma: 0
12 years 3 months ago #206411 by nickr
Similar to something I've been trying to work out. I have sort of managed it with the following SQL in a CB Query Field:

SELECT ROUND(AVG (rating),2)
FROM `###_comprofiler_ratingfield_log`
WHERE `rateduserid` = [user_id];

The issue I have is that it is just showing an average for the entire table rather than based on the user_id field - am I doing something wrong in my query?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
12 years 2 months ago #206427 by krileon

`###_comprofiler_ratingfield_log`

This isn't correct. Please use the below.
Code:
`#__comprofiler_ratingfield_log`

The rest of the query looks fine. The field for the user already has the average however. You'll just need to apply a round to it so it's rounded properly. Example as follows.
Code:
SELECT ROUND( `MYFIELD` ) FROM `#__comprofiler` WHERE `id` = '[user_id]';

You should be able to just do [FIELDNAME] substitution and it'll give you the digital equivalent of their rating.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum