Right.
Remember; this is a quick-and-dirty hack made to the Coppermine code on my site to speed up the voting process from a users standpoint.
The problem is that after voting on an image in an album, the resulting page is the same image. The user then have to click the "next" button
to move on to the next image in the album.
Im a bit suprised this isnt an optional feature in Coppermine (afaik).
So to the hack:
Open the include/theme.inc.php file, locate the heme_html_rating_box function.
Replace the theme_html_rating_box function to:
if (!function_exists('theme_html_rating_box')) { //{THEMES}
function theme_html_rating_box()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $THEME_DIR;
global $template_image_rating, $lang_rate_pic, $pos, $album;
if (!(USER_CAN_RATE_PICTURES && $CURRENT_ALBUM_DATA['votes'] == 'YES')) return '';
$votes = $CURRENT_PIC_DATA['votes'] ? sprintf($lang_rate_pic['rating'], round($CURRENT_PIC_DATA['pic_rating'] / 2000, 1), $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= '';
}
if (isset($_GET['autonext'])){
$params = array('{TITLE}' => $lang_rate_pic['rate_this_pic'],
'{VOTES}' => $votes,
'{RATE0}' => "ratepic.php?pic=$pid&rate=0&nextpos=".($pos+1)."&album=$album",
'{RATE1}' => "ratepic.php?pic=$pid&rate=1&nextpos=".($pos+1)."&album=$album",
'{RATE2}' => "ratepic.php?pic=$pid&rate=2&nextpos=".($pos+1)."&album=$album",
'{RATE3}' => "ratepic.php?pic=$pid&rate=3&nextpos=".($pos+1)."&album=$album",
'{RATE4}' => "ratepic.php?pic=$pid&rate=4&nextpos=".($pos+1)."&album=$album",
'{RATE5}' => "ratepic.php?pic=$pid&rate=5&nextpos=".($pos+1)."&album=$album",
'{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
);
}else{
$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);
}
} //{THEMES}
And modify the last part of the ratepic.php
...
$nextposlink = $_GET['nextpos']."&album=".$_GET['album'];
$location = "displayimage.php?pos=";
$location .= isset($_GET['nextpos']) ? $nextposlink : (- $pic);
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $location);
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"1;url=$location\">");
msg_box($lang_info, $lang_rate_pic_php['rate_ok'], $lang_continue, $location);
pagefooter();
ob_end_flush();
?>
Now, for making this work (Coppermine will behave as usual), you must add a query parameter to your link for the album you want your users to vote on.
This is the old type link:
http://www.yoursite.com/album/displayimage.php?album=388&pos=0This, with the extra parameter:
http://www.yoursite.com/album/displayimage.php?album=388&pos=0&autonext=trueAgain, this isnt a study of php code exellence, but a simple walkthrough of a 10 minutes hack to make voting easier for our users.
If wanted, I could sure make this more proper Coppermine style and quality.
(If I've forgotten somthing above, let me know)
/twistah