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: , , , , , , ,

Oct 04


This is the best beer drinking tee shirt!

written by Billy \\ tags: , ,

Sep 28

I’ve been an avid reader every since I was a little rugrat. I was raised on a small farm in southern Illinois before color TV came into our lives and there were only a handful of channels that we could get way out there. I remember walking into town to go to the Grayville Carnegie Public Library to check out books whenever I had time between chores. We were rather poor (6 kids!) and it was a long way to a store that carried books so I spent a lot of time there. I always got books for my birthday and Christmas and remember sitting in an old tree out back reading in the summer heat (who had air conditioning!). I’ve always thought of putting my book (and maybe movies) list up here to share and came across Viitoria’s blog where she displays her library using a really nice WP plugin called “Now Reading“. I have to admit I had some troubles getting the sidebar issues dealt with but maybe if I had read the instructions a bit more carefully (or maybe if they were a bit more clear ;-) ), it wouldn’t have taken most of the day to figure out. These issues will make nice fodder for another article. Once you get the hang of editing the library templates it’s pretty straightforward to make it work with your theme. For me it was understanding the sidebar issues. It’ll take some time to get all my books up on the shelf so check back often to see if anything interests you and if it does, please click through to buy it from Amazon.

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