1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Implemented Allow the creator to rate the item?

Discussion in 'Showcase Closed Suggestions' started by Russ, Nov 12, 2012.

  1. Russ

    Russ New Member AMS Premium RMS Premium SC Premium UBS Premium

    Am I missing an option or is it not built it but is there a way to allow whoever creates the item can put a star rating on it?

    If not is it an easy fix by chance?
     
  2. Bob

    Bob Developer Staff Member

    Its done that way on purpose... just like you can't rate your own Resource. Its meant for others to Rate your item.

    Its driven off the method NFLJ_Showcase_Model_Item::canRateItem

    If you want Item Owners to be able to rate their own item you'll need to replace this method.

    edit the file /library/NFLJ/Showcase/Model/Item.php

    find this (around line 1013)
    PHP:
        public function canRateItem(array $item, array $viewingUser null)
        {
            
    $this->standardizeViewingUserReference($viewingUser);
           
            if (
    $item['user_id'] == $viewingUser['user_id'])
            {
                return 
    false;
            }
           
            if (
    XenForo_Permission::hasPermission($viewingUser['permissions'], 'nfljsc''canRateItem'))
            {
                
    $hasRated $this->hasRated($viewingUser['user_id'], $item['item_id']);
               
                if (
    $hasRated)
                {
                    return 
    false;
                }   
               
                return 
    true;
            }
           
            return 
    false;
        }
    Replace the above method with this one:
    PHP:
        public function canRateItem(array $item, array $viewingUser null)
        {
            
    $this->standardizeViewingUserReference($viewingUser);
           
            if (
    XenForo_Permission::hasPermission($viewingUser['permissions'], 'nfljsc''canRateItem'))
            {
                
    $hasRated $this->hasRated($viewingUser['user_id'], $item['item_id']);
               
                if (
    $hasRated)
                {
                    return 
    false;
                }   
               
                return 
    true;
            }
           
            return 
    false;
        }
     
  3. Bob

    Bob Developer Staff Member

    I've moved this into suggestions and marked it "Considered" as I think it would be useful to some people if I added in another permission 'Can Rate Own Item" which I will then integrate into the above method. That way those that want to have that option can not only have it, but it also gives them the option to enable/disable per user group as well. Also means you won't have to modify any code in future releases ;)
     
  4. Russ

    Russ New Member AMS Premium RMS Premium SC Premium UBS Premium

    Thanks, the thought of it from my perspective would be I think the owner should have a say in what he thinks the item should be rated as(in his/her opinion). Thanks for the fix though :)
     
  5. Bob

    Bob Developer Staff Member

    agreed...Its already done and will be included in the next release :)
     
    Russ likes this.
  6. Bob

    Bob Developer Staff Member

    I actually made it so that Item Owners are able to rate their own Item but others cant (in case of wanting to do review style rating).

    Two permissions now drive the system:

    Rate Items
    Rate Own Item

    If Rate Items is set to no and Rate Own Item is set to Allow, then the Item Owner can rate the item once.
    If Rate Items is set to Allow and Rate Own Item is set to no, then members can rate, by the item owner can not.
    If both are set to allow, then both the Item Owner and members can Rate the item.
    If neither are set, then neither can rate.
     
    Russ likes this.
  7. Russ

    Russ New Member AMS Premium RMS Premium SC Premium UBS Premium

    Awesome Bob, that will help so much, thanks for being on top of this!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.