Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: "Last comments on my photos" view  (Read 8628 times)

0 Members and 1 Guest are viewing this topic.

mahdi1234

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
"Last comments on my photos" view
« on: September 18, 2008, 12:29:46 pm »

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

Logged

foulu

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 236
  • uhm
Re: "Last comments on my photos" view
« Reply #1 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 ) me if you interest.

mahdi1234

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: "Last comments on my photos" view
« Reply #2 on: September 18, 2008, 12:42:02 pm »

Hi mahdi,

I can do your work. Price seem fair, too. PM or email (get from here ) 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
Logged

foulu

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 236
  • uhm
Re: "Last comments on my photos" view
« Reply #3 on: September 18, 2008, 12:45:24 pm »

It's ok, thank your for mention me about it. You seem to be a nice person  :)

mahdi1234

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 60
Re: "Last comments on my photos" view
« Reply #4 on: September 18, 2008, 03:10:03 pm »

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:

Code: [Select]
$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&amp;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&amp;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:

Code: [Select]
$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&amp;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&amp;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&amp;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:

Code: [Select]
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:
Code: [Select]
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:

Code: [Select]
$lang_meta_album_names['lastcomon'] = 'Last comments on my photos';

just before:

Code: [Select]
?>
Logged

jManuel

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 46
    • Comunidad de fotografos aficionados
Re: "Last comments on my photos" view
« Reply #5 on: October 03, 2008, 07:03:13 pm »

Thank's,

very good added to CPG 1.4.x
Logged
jManuel - Comunidad de fotografos aficionados
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.