Hide vote counting.. Hide vote counting..
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Hide vote counting..

Started by mr.bena, April 08, 2012, 02:04:00 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mr.bena

Hi, I want to hide the counted votes display inside the bracket just after Rate this file..which is like (No vote yet), (5/5 with 100 votes) etc. I do not want my visitors or users see the no. of votes. Is this possible to remove only for one album having album_id=30?

Αndré

Copy the function theme_html_rating_box from the sample theme to your theme's theme.php file, if it doesn't exist. Then, find
$votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / (5/$rating_stars_amount), 1), $rating_stars_amount, $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
and replace with
$votes = $CURRENT_PIC_DATA['votes'] ? sprintf(($CURRENT_PIC_DATA['aid'] == 30 ? '(Current rating : %s / %s)' : $lang_rate_pic['rating']), round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / (5/$rating_stars_amount), 1), $rating_stars_amount, $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
if you just want to hide the number of votes, or remove that line completely if you want to remove the whole text.

mr.bena

Thank you, Andre. It is solved now..

mr.bena

I may be a little annoying, Andre. I think adjusting the mod we have discussed here would be better again. If that mod could be adjusted to show the Rating only for admin & the picture uploader, it seems better because the uploader will not have to click a link. The show details link we have discussed here would function the same anyway with the request adjustment.

Αndré

Your links both points to this thread (after removing the pointless stuff from the URL)?

Am I right that you want to hide the actual voting for album ID 30, if the current user isn't the uploader or the admin?

mr.bena

You are right, Andre. I want to hide the actual voting for album ID 30, if the current user isn't the uploader or the admin with this mod.

Αndré

This code should work, but I haven't tested that:
$votes = $CURRENT_PIC_DATA['votes'] ? sprintf((($CURRENT_PIC_DATA['aid'] == 30 && !GALLERY_ADMIN_MODE && $CURRENT_PIC_DATA['owner_id'] != USER_ID) ? '(Current rating : %s / %s)' : $lang_rate_pic['rating']), round(($CURRENT_PIC_DATA['pic_rating'] / 2000) / (5/$rating_stars_amount), 1), $rating_stars_amount, $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];

mr.bena

Unfortunately, it does not work. Apart from the file uploader and the admin, all other users still can see the ratings..

Αndré

So it currently does exactly the opposite?

mr.bena

I am sorry.. the mod is working, Andre. I removed '(Current rating : %s / %s)' and replace with '.'

However, since I use 1 star rating for album ID=30, it is not good to show 'Current rating : 1/1 with 5 votes" etc.. That is what it is currently showing.. I prefer to change this as 'Current rating: 5 votes" leaving the 1/1 part. Again, is it possible to show only the total of a unique votes meaning the total of the votes given only by the registered users excluding the votes given by Guests?

When the Admin or the uploader of the picture see "Current rating : 5 votes" that would mean the votes given only by the registered users. Thank you so much for the precious help.


mr.bena

I am sorry for breaking the rule, the mod is working great, Andre. The vote could not be seen other than the admin or the file uploader, however, it is still seen when they click the vote. It says "Your vote was accepted (Current rating : 1/1 with 6 votes)"

Could you please help me to display only "Your vote was accepted" ?

Αndré

Open ratepic.php, find
$new_rating_text = $lang_rate_pic_php['rate_ok'] . ' ' . sprintf($lang_rate_pic['rating'], $new_rating, $rating_stars_amount, $row['votes'] + 1);
and replace with
$new_rating_text = "Your vote was accepted";

mr.bena