Hi,
Similar to "Last uploaded file" and "Last comment", I'd like to add into user profile also option for "Last comments on my photos".
Site - http://fotoluzr.net/
Version - 1.4.18 (with sec patch of .19)
I would like it to be added as third option, see pic - http://temp.fotoluzr.net/last_com.jpg
Budget - 50$, paid via paypal or bank transfer
PS - I prefer to make code public once done, is it possible?
thanks,
mahdi
Hi mahdi,
I can do your work. Price seem fair, too. PM or email (get from here (http://forum.coppermine-gallery.net/index.php/topic,39514.0.html) ) me if you interest.
Quote from: foulu on September 18, 2008, 12:38:21 PM
Hi mahdi,
I can do your work. Price seem fair, too. PM or email (get from here (http://forum.coppermine-gallery.net/index.php/topic,39514.0.html) ) me if you interest.
Thanks foulu, I've already received offer couple minutes earlier. Please consider it being taken for the moment. I'll contact you if something changes.
cheers
It's ok, thank your for mention me about it. You seem to be a nice person :)
Job done by eenemeenemuu (http://forum.coppermine-gallery.net/index.php?action=profile;u=24278). I'm very satisfied :)
Here's instructions on what needs to be changed
In 'profile.php' find:
$lastcom = '';
if ($comment_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND c.pid = p.pid";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$row = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($row['filename']);
$lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
$lastcom = '<td width="50%" valign="top" align="center">'
. '<a href="thumbnails.php?album=lastcomby&uid=' . $uid . '">'
. '<span class="thumb_title">' . $lang_register_php['last_comments'] . ' ' . $user_data['user_name'] . '<br /></span>'
. $lastcom
. '</a><br />';
$lastcom .= "<span class=\"thumb_caption\">" . localised_date($row['msg_date'], $lastcom_date_fmt) . '</span>' . "<span class=\"thumb_caption\">" . bb_decode(process_smilies($row['msg_body'])) . '</span></td>';
}
}
$user_thumb = '';
if ($picture_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='" . $thumb_pid . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$picture = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
if (!is_image($picture['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$picture['pwidth'] = $image_info[0];
$picture['pheight'] = $image_info[1];
}
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($picture['filename']);
$user_thumb = '<img src="' . $pic_url . '" class="image"'
. $image_size['geom'] . ' border="0" alt="" />';
$user_thumb = '<td width="50%" valign="top" align="center">'
. '<a href="thumbnails.php?album=lastupby&uid=' . $uid . '">'
. '<span class="thumb_title">' . $lang_register_php['last_uploads'] . ' ' . $user_data['user_name'] . '<br /></span>'
. $user_thumb
. '</a></td>';
}
}
$quick_jump = ($user_thumb . $lastcom) ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . '</tr></table>' : '';
and replace with:
$lastcom = '';
if ($comment_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND c.pid = p.pid";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$row = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($row['filename']);
$lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
$lastcom = '<td width="34%" valign="top" align="center">'
. '<a href="thumbnails.php?album=lastcomby&uid=' . $uid . '">'
. '<span class="thumb_title">' . $lang_register_php['last_comments'] . ' ' . $user_data['user_name'] . '<br /></span>'
. $lastcom
. '</a><br />';
$lastcom .= "<span class=\"thumb_caption\">" . localised_date($row['msg_date'], $lastcom_date_fmt) . '</span>' . "<span class=\"thumb_caption\">" . bb_decode(process_smilies($row['msg_body'])) . '</span></td>';
}
}
$user_thumb = '';
if ($picture_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE pid='" . $thumb_pid . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$picture = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
if (!is_image($picture['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$picture['pwidth'] = $image_info[0];
$picture['pheight'] = $image_info[1];
}
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($picture['filename']);
$user_thumb = '<img src="' . $pic_url . '" class="image"'
. $image_size['geom'] . ' border="0" alt="" />';
$user_thumb = '<td width="33%" valign="top" align="center">'
. '<a href="thumbnails.php?album=lastupby&uid=' . $uid . '">'
. '<span class="thumb_title">' . $lang_register_php['last_uploads'] . ' ' . $user_data['user_name'] . '<br /></span>'
. $user_thumb
. '</a></td>';
}
}
$user_com = '';
if ($picture_count) {
$sql = "
SELECT * FROM {$CONFIG['TABLE_PICTURES']} p
INNER JOIN {$CONFIG['TABLE_COMMENTS']} c
ON c.pid = p.pid
WHERE owner_id ='$uid'
ORDER BY msg_id DESC LIMIT 1
";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$picture = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($picture, 'thumb');
if (!is_image($picture['filename'])) {
$image_info = getimagesize(urldecode($pic_url));
$picture['pwidth'] = $image_info[0];
$picture['pheight'] = $image_info[1];
}
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($picture['filename']);
$user_com = '<img src="' . $pic_url . '" class="image"'
. $image_size['geom'] . ' border="0" alt="" />';
$user_com = '<td width="33%" valign="top" align="center">'
. '<a href="thumbnails.php?album=lastcomon&uid=' . $uid . '">'
. '<span class="thumb_title">Last comment on my photos.<br/ >Click to see all comments on ' . $user_data['user_name'] . '\'s photos<br /></span>'
. $user_com
. '</a></td>';
}
}
$quick_jump = ($user_thumb . $lastcom . $user_com) ? '<table width="100%" border="0" cellspacing="5"><tr>' . $user_thumb . $lastcom . $user_com . '</tr></table>' : '';
In 'include/functions.inc.php', add:
case 'lastcomon': // last comments on my photos
if (isset($_GET['uid'])) {
$uid = (int)$_GET['uid'];
} else {
$uid = -1;
}
$user_name = get_username($uid);
if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = 'Last comments on my photos - '. $CURRENT_CAT_NAME .' - '. $user_name;
} else {
$album_name = 'Last comments on my photos - '. $user_name;
}
$query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} p INNER JOIN {$CONFIG['TABLE_COMMENTS']} c ON c.pid = p.pid WHERE approved = 'YES' AND owner_id = '$uid' $META_ALBUM_SET";
$result = cpg_db_query($query);
$nbEnr = mysql_fetch_array($result);
$count = $nbEnr[0];
mysql_free_result($result);
//if($select_columns != '*' ) $select_columns .= ', owner_id, owner_name, aid';
$select_columns = '*'; //allows building any data into any thumbnail caption
$query = "SELECT $select_columns, UNIX_TIMESTAMP(msg_date) as msg_date FROM {$CONFIG['TABLE_PICTURES']} p INNER JOIN {$CONFIG['TABLE_COMMENTS']} c ON c.pid = p.pid WHERE approved = 'YES' AND owner_id = '$uid' $META_ALBUM_SET ORDER BY msg_id DESC $limit";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
if ($set_caption) build_caption($rowset,array('msg_body','msg_date'));
$rowset = CPGPluginAPI::filter('thumb_caption_lastupby',$rowset);
return $rowset;
break;
just before:
default : // Invalid meta album
cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
}
If you need a title for the meta album, open your appropriate language file (e.g. lang/english.php) and insert:
$lang_meta_album_names['lastcomon'] = 'Last comments on my photos';
just before:
?>
Thank's,
very good added to CPG 1.4.x