Hi guys,

I've added a Fivestar widget field to Users Account. It all works fine, users can rate each other. Problem is, users are also allowed to rate themselves, which is pretty much the opposite of the main goal on my website.

Any solution to this? Can't see to solve it...

Thanx and great job, guys

Comments

Jawni’s picture

Category: support » task

Anyone to help me out here, guys?

Energyblazar’s picture

hello jawni...

I was just curious you said users can rate each other , is it that users can rate each other multiple times or just once ?

Also to stop user rating himself tryout using rules module.... i too am trying it out, if i figure out a possible solution ill post it, and if u do, please do post it too.

Thanks...

Timon Davis’s picture

Assigned: Timon Davis » Unassigned
Status: Needs review » Active
StatusFileSize
new1.64 KB

Added a permission to rate own content. Granting a role the 'rate own content' permission will allow them to rate their own content - otherwise they will be able to view the rating as normal, but they will not be able to edit it. This applies only to the fivestar widget that captures the votes on the viewing page. I chose this solution because it has a very simple implementation, and because it still gives the site administrator control over whether this functionality is desired or not.

To test this yourself

  1. Add this patch to the latest release of the Fivestar module.
  2. If you have not done so already, enable the fivestar module and add a 'rated by viewing' Fivestar widget to any given content type.
  3. Login as a user who can create content, but does not have the 'rate own content' permission
  4. Create an instance of the content type with the 'rated by viewing' Fivestar field
  5. View the content from the last step. You should not be able to edit the rating field
  6. Log in as a different user with permission to submit rating votes. Visit the same content page from the previous step. You should be able to edit the rating field now
Timon Davis’s picture

Assigned: Unassigned » Timon Davis
Status: Active » Needs review

Updating Status.

Also forgot to mention this was developed against version 7.x-2.x-dev.

Timon Davis’s picture

Status: Active » Needs review
Jawni’s picture

Hi guys, thanks for your answers. I had to solve it quickly at the time, so I ended up hiding, with javascript, the rating from the user's own page... I will test the patch in the next couple of days, thank you Timon Davis

swamiman’s picture

Another work around that doesn't require a patch would be to use the field permissions module.

Energyblazar’s picture

Thanks Sawmiman....

I have just installed this module....and went through this discussion--> http://drupal.org/node/1279712, to understand the working of the module.

But i am still not sure how this module is to be used....to stop user from rating themselves.

Can you please provide more information on how to think this module can stop user from voting/ rating themselves.

Just to let you know

I did this went to structure > content type > manage field > edited the Rate me field and changed the field visiblity and permission to custom.

Then unticked create own value for rate me field.

In comment form, i have added Fivestar field and user ref. field.

Now i dont want the user to comment, rate and reference the points to himself, and hence i wish to disable to user rating himself.

But what i did, would'nt work, am i missing something here ?

rameshbabu.g’s picture

Applied this patch...working fine..great

swamiman’s picture

So I assume you are trying to keep users from rating themselves? I'm not sure how to use field permissions for user accounts instead of content types. You may try looking in Configuration > People > Account Settings > Manage Fields. If that works, otherwise I'm not sure if field permissions will do what you want. I used it to restrict access of a fivestar rating field to specific roles. I apologize if I sent you on a wild goose chase with the suggestion to use field permissions. Perhaps, it would be best to just use the patch submitted last week.

whiteph’s picture

Issue summary: View changes
Status: Needs review » Closed (duplicate)