coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: drweb on January 25, 2007, 05:50:14 PM

Title: Remove Rating But Keep Voting
Post by: drweb on January 25, 2007, 05:50:14 PM
Hiya, this was sorted in V1.3 but having got V1.4 it doesn't seem to apply anymore as the code doesn't exist in V1.5 the fix is listed in this topic
http://forum.coppermine-gallery.net/index.php?topic=20068.0 (http://forum.coppermine-gallery.net/index.php?topic=20068.0)

Does anyone know how to just display the number of votes instead of the rating and the number of votes.  I've taken off all my ratings and substituted the 5 rating with a vote button.  This allows the view just to vote for the pic, but when the results are displayed I get a 5/5  5 Votes.  All I want to see is the number of votes.

Can anyone help with this?

Dave
Title: Re: Remove Rating But Keep Voting
Post by: Nibbler on January 25, 2007, 06:02:04 PM
Code moved into the theme system. Add this code into your theme's theme.php near the end, before the closing ?>


function theme_html_rating_box()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
    global $template_image_rating, $lang_rate_pic;

    if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '';

    $votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], $CURRENT_PIC_DATA['votes']) : $lang_rate_pic['no_votes'];
    $pid = $CURRENT_PIC_DATA['pid'];

    if (defined('THEME_HAS_RATING_GRAPHICS')) {
        $location= $THEME_DIR;
    } else {
        $location= '';
    }

    $params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
        '{VOTES}' => $votes,
        '{RATE0}' => "ratepic.php?pic=$pid&rate=0",
        '{RATE1}' => "ratepic.php?pic=$pid&rate=1",
        '{RATE2}' => "ratepic.php?pic=$pid&rate=2",
        '{RATE3}' => "ratepic.php?pic=$pid&rate=3",
        '{RATE4}' => "ratepic.php?pic=$pid&rate=4",
        '{RATE5}' => "ratepic.php?pic=$pid&rate=5",
        '{RUBBISH}' => $lang_rate_pic['rubbish'],
        '{POOR}' => $lang_rate_pic['poor'],
        '{FAIR}' => $lang_rate_pic['fair'],
        '{GOOD}' => $lang_rate_pic['good'],
        '{EXCELLENT}' => $lang_rate_pic['excellent'],
        '{GREAT}' => $lang_rate_pic['great'],
        '{WIDTH}' => $CONFIG['picture_table_width'],
        '{LOCATION}' => $location,        //theme dir or default images directory
        );

    return template_eval($template_image_rating, $params);
}


The change to the language file should be the same as before.