Support Forum

Rating Plugin: How to ONLY display the rating for the topic (not the internal posts)

CC Cringe Channel
Cringe Channel
Member

So at the moment, the displayed ‘star rating’ in the forum includes an average of all of the rated posts within a thread.

I would like to either:

a. Display the rating for the threadstarter post only

b. If this is not possible, to remove the ratings from all posts except the main threadstarter post. 

Any help is appreciated,

thank you

14 Answers

New Answer

MP Mr Papa
Mr Papa
Member

which average?  on forum view (list of topics) or topic view (list of posts)?

not sure what you mean either by rating for the threadstarter???  the rating is on a post, not a user…  are  you trying to say you only want to show the rating on the first post in a topic????

CC Cringe Channel
Cringe Channel
Member

Mr Papa said
which average?  on forum view (list of topics) or topic view (list of posts)?

not sure what you mean either by rating for the threadstarter???  the rating is on a post, not a user…  are  you trying to say you only want to show the rating on the first post in a topic????

Yes correct. I want to disable the ratings for all other posts within the thread. I want to leave the rating just for the very first post. That is one option.

Alternatively, another option, is to simply display the rating for the first post. Here is an image to illustrate what i mean
http://imgur.com/kUojufZ

See the star ratings? That rating represents an average score of ALL of the posts within the thread. NOT just the very first post. Essentially, people are rating eachother’s comments within each thread, then it takes all of the ratings from the entire thread, and creates a new total average rating. That new total average rating is displayed in the forum. I would like for the rating that is displayed to be the one that is for the first post only.

MP Mr Papa
Mr Papa
Member

bump????  after a few hours?  come on now… that wont get you an answer any faster…

to do this, you will have to user our api and filter template function and if its not the first post in a topic, just exit…

the picture you give however, is forum view and not topic view…  if you do the first part on topic view, that forum view will take care of itself…

are you able to handle adding a bit of code?

CC Cringe Channel
Cringe Channel
Member

Sorry! I just noticed that you seem to everyone’s issues in big swooping waves, and I thought you missed mine. Sorry again, i dont mean to be annoying.

I do not know how to do either one of your solutions.

I can add code if you tell me exactly where to put it and what to put.. can you help?

MP Mr Papa
Mr Papa
Member

Its a national holiday here today, so wont have a chance until Monday some time to look at…  If you dont hear back on Tuesday, please tweak us again…

MP Mr Papa
Mr Papa
Member

This should help you do what you want…  Only allows the first post in a topic to be rated… and thus the averages will only be for the first post…

however, it wont (and cannot) go back and take care of already cast votes… so you may want to consider starting the ratings over…  if so, just go to forum – options – display settings and switch the rating style to the other and back… that will reset all rating data…

add_filter('sph_PostIndexRatePost', 'my_rating_check');
function my_rating_check($out) {
    global $spThisPost;
    if ($spThisPost->post_index != 1) $out = '';
    return $out;
}

this code would go in the spFunctions.php file of your sp theme…

AB Andy B
Andy B
Member

This should help you do what you want…  Only allows the first post in a topic to be rated… and thus the averages will only be for the first post… however, it wont (and cannot) go back and take care of already cast votes… so you may want to consider starting the ratings over…  if so, just go to forum – options – display settings and switch the rating style to the other and back… that will reset all rating data…

add_filter('sph_PostIndexRatePost', 'my_rating_check');
function my_rating_check($out) {
    global $spThisPost;
    if ($spThisPost->post_index != 1) $out = '';
    return $out;
}

this code would go in the spFunctions.php file of your sp theme…

 

 

This is a good idea. I just made this adjustment too. Might be nice to add a toggle ‘on/off’ in the settings screen.

MP Mr Papa
Mr Papa
Member

only problem is thats another option…  we have too many options now…  we tend to follow the wp mantra of decisions not options…  folks tend to get lost in the options..  but we do like to provide the hooks so that users can tweak if desired…

AB Andy B
Andy B
Member

Good point. I suppose there is a risk that the forum options menu becomes overwhelming with hundreds of different settings that could be made.

With this ratings tweak – is there a risk that with any forum/plugin updates that the ‘tweak’ becomes lost/broken or worse that it could cause some corruption?

MP Mr Papa
Mr Papa
Member

slim to no chance of losing the change…  Since the tweak uses hooks, there is no modification of the core code so it update proof (except for that very slim chance we have to change the hook structure, but we almost never do that because backwards compat is paramount)…

of course, since you modified spFunctions.php in the sp theme, its assumed that you are already using your own sp theme and not modifying one of our delivered themes…