Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Have enabled the Rating feature on the site collection, allowed the items to be rated on the list and added the Rating column.

Enable-spfeature -identity 915c240e-a6cc-49b8-8b2c-0bff8b553ed3 -url http://www.mySitecollectionURL.com

However it does not allow (even with the system account) users to rate the item. Neither able to click on the rating stars, nor hover on it.

When I tried to troubleshoot the issue, I found that the SPAN(“ms-submitRating”) tag is missing completely along with the javascript function “RatingsControlLoader”.

This issue happens with a specific site collection, any help?

share|improve this question
1  
any custom masterpages? –  Mike Aug 7 '12 at 15:08
    
Thank you Mike. –  Karthikeyan Aug 14 '12 at 5:37
    
Was that what was causing the issue? –  Mike Aug 14 '12 at 13:35
    
We have same issue. Any updates on this how to fix? Is it Masterpage issue? –  user17029 May 15 '13 at 17:05

1 Answer 1

I had the same issue. This is what I was able to find out:

  1. This functionality depends on 5 properties in web property bag:
    • ratings_emptyiconurl
    • ratings_featureactivated
    • ratings_imagestriprtlurl
    • ratings_imagestripurl
    • ratings_newratingiconurl

If they are missing, whole thing will not work. But, even if you additionally put them there (directly or be reactivating Ratings feature) it will not help you, because whole process of generating "stars" functionality is depending on one static class (Microsoft.SharePoint.WebPartPages.BaseDdwRuntime.RatingsDataManager) and guess what? These values are taken from the property bag during initialization of this class so you need either to recycle whole web application (tried, it works) or somehow dispose living instance of the whole web and let SP to create it anew after response (never tried, might work too).

  1. Our problem was that we needed this to start working right after site is provisioned. Our solution has this "on demand sites creation" process; so something like "let's recycle web app pool each 10 minutes" (handled by windows task which was running provisioning script) was not acceptable. We didn't wanted to go force dispose either (probably disposing instance of the SPWeb where it is highly not recommended, e.g. from SPContext). Other question was why it is not working. Ratings feature has been activated each time successfully -> reflector. I found this:

    // Microsoft.SharePoint.Portal.RatingsFeatureReceiver
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    SPSite sPSite = (SPSite)properties.Feature.Parent;
    SPWeb rootWeb = sPSite.RootWeb;
    bool allowUnsafeUpdates = rootWeb.AllowUnsafeUpdates;
    try
    {
        rootWeb.AllowUnsafeUpdates = true;
        rootWeb.Properties["Ratings_ImageStripUrl"] = "/_layouts/Images/Ratings.png";
        rootWeb.Properties["Ratings_ImageStripRtlUrl"] = "/_layouts/Images/Ratingsrtl.png";
        rootWeb.Properties["Ratings_EmptyIconUrl"] = "/_layouts/Images/RatingsEmpty.png";
        rootWeb.Properties["Ratings_NewRatingIconUrl"] = "/_layouts/Images/RatingsNew.png";
        rootWeb.Properties["Ratings_FeatureActivated"] = "true";
        rootWeb.Properties.Update();
    }
    finally
    {
        rootWeb.AllowUnsafeUpdates = allowUnsafeUpdates;
    }
}

I was like WTF? What a great idea, put something into the try-finally block! Love you MS :( So no chance of finding out what happened there. No exception, no logging. My only guess is that it failed when code was calling Update method. It will be nothing new for us in our project; exception like "object is already used by another user/thread" or something like that.

Our solution was simple: during our provisioning process we put activation of the Ratings feature and related features after the whole process has been finished at the very end.

I hope this brought some insight to the problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.