Oct 19

Hey! Why should Wordpress have all the cool features? I really like seeing the latest comments in a sidebar on blogs that I read and thought why shouldn’t this be something for Coppermine Photo Gallery. If you can leave comments on photos then you should be able to see the latest ones without having to view the “Last Comment” and wait for the images to load. So with that I give you the hack to display the latest comments on your gallery.

This hack is using the i3Theme Classic Center Edition from MangoOrgange that I’ve ported to Coppermine and changed the color scheme. It’s called MellowYellow and it’s really easy on the eyes. The code additions are easy to implement because in most cases all you have to do is copy and paste the below code into your theme.php file. I’ve outlined the specific instructions where this may not be the case.

Copy and paste the below code into your theme.php before the ending “?>” tag.

{code type=php}
// This function is for displaying latest comments in list form in a sidebar.
// Change the number of comments to display by editing “$comment_cnt”.
// Please acknowledge use of this code by including this header.
// Develeoped for Coppermine Photo Gallery by Billy Bullock – www.billygbullock.com
function lastcomments()
{
global $CONFIG;
$comment_cnt = 4; //change this number for comments to display
$select_columns = ‘p.aid, p.*, msg_body, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date’;

if (USER_ID) {
$query = “SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = ‘YES’ AND c.pid = p.pid ORDER by msg_id DESC LIMIT $comment_cnt”;
$result = cpg_db_query($query);
}else{
$query = “SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_ALBUMS']} AS a WHERE c.pid = p.pid AND p.aid = a.aid AND approved = ‘YES’ AND visibility = 0 ORDER by msg_id DESC LIMIT $comment_cnt”;
$result = cpg_db_query($query);
}

while ($row = mysql_fetch_assoc($result)) {
if ($CONFIG['enable_smilies']) { //displays smilies if enabled in configuration. Also need “function process_smilies_custom” & “function get_smilies_table_custom()”.

written by Billy \\ tags: , , , , , , ,


Leave a Reply

i3Theme sponsored by Top 10 Web Hosting, Hosting in Colombia and Web Hosting Reviews