• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Error when Guests rate media/albums

Martok

Well-known member
#1
Guests should be able to rate media/albums if the appropriate permissions are set in the Unregistered/Unconfirmed user group. However, when this is set, I get an error.

I have "Require comment when rating media or album" unticked.

When rating, I get the rating dialogue box as expected (without the text editor as I have disallowed comments). After submitting the rating I get:

upload_2014-12-5_13-52-9.png

There are server errors in the ACP for each attempt. Here is one:

Code:
XenForo_Exception: An unexpected error occurred - library/XenGallery/DataWriter/Rating.php:73
Generated By: Unknown Account, 11 minutes ago
Stack Trace
#0 /XXXXXXXX/library/XenForo/DataWriter.php(1446): XenGallery_DataWriter_Rating->_preSave()
#1 /XXXXXXXX/library/XenForo/DataWriter.php(1385): XenForo_DataWriter->preSave()
#2 /XXXXXXXX/library/XenGallery/ControllerPublic/Album.php(584): XenForo_DataWriter->save()
#3 /XXXXXXXX/library/XenForo/FrontController.php(347): XenGallery_ControllerPublic_Album->actionRate()
#4 /XXXXXXXX/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /XXXXXXXX/index.php(13): XenForo_FrontController->run()
#6 {main}
Request State
array(3) {
  ["url"] => string(63) "http://www.mysite.com/media/albums/warframe.7/rate"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(6) {
    ["rating"] => string(1) "3"
    ["_xfToken"] => string(8) "********"
    ["_xfConfirm"] => string(1) "1"
    ["_xfRequestUri"] => string(13) "/media/albums"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 

Martok

Well-known member
#2
I've just tested with various other options - requiring a comment, allowing comments in the Unregistered group. Same error each time.

Interestingly I also discovered that trying to make a comment as a guest, with the add comment permission set to Allow, wouldn't let me do this - a pop-up with "you must be logged in to do this" that included the login box appeared when I tried to submit.
 

Mike

XenForo developer
Staff member
#3
Note that there are many things that simply don't apply to guests. That group refers not only to guests but users whose accounts aren't fully valid as well.

Rating would be a good example of something that wouldn't be possible for guests.
 

Martok

Well-known member
#4
Fair enough if the intention is that this can't be used by guests, but I'm sure you would agree that the current error message isn't ideal in this situation. Also there shouldn't be an error recorded in the ACP.
 

Mike

XenForo developer
Staff member
#5
I think the exception in the control panel may actually be related to your opcode cache breaking how the code is supposed to work as what is thrown is designed to be shown to the end user:
Code:
throw new XenForo_Exception(new XenForo_Phrase('xengallery_an_unexpected_error_occurred'));
But the option shouldn't be shown to guests in the first place.