For item 1, I’ve attached a Ditto extender that I coded up for one of our clients ...
Note: The extender assumes that your star rating TV is called ‘star_rating’ - if it’s different, then the reference will need to be updated in the extender file.
To use the extender, please follow these steps:
- Copy the attached extender file (remove the .txt extension first) into: assets/snippets/ditto/extenders/
- In your snippet call for Ditto, add: &extenders=`star_rating`
The extender does two things. Firstly, it does the sorting and secondly, it sets a
star_rating_val placeholder to use in your Ditto template. For example, you could have this in your Ditto template:
([+star_rating_val+] out of 5 stars)
For item 2, your best bet is to create a wrapper snippet that checks the logged-in user’s group and then, using $modx->runSnippet(), either renders the full voting output or the read-only output depending on if they’re allowed to vote or not.