[wanted] aviod same images in "new comments" [wanted] aviod same images in "new comments"
 

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

Main Menu

[wanted] aviod same images in "new comments"

Started by Bruz, March 08, 2004, 07:59:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bruz

Hi!

I have this problem:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fquestion%2Fquestion.jpg&hash=d034ffa052fd0e08fa013865862a876ab12750db)

I want to avoid the same picture shown up that often, I just need the newest comment with one picture...
Is it possible to do so, if one picture has more than one comment?

THX in advance
Bruz
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Bruz

Is anybody else interested in this feature?

And is it possible?
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Bruz

I really need to geht rid of multiple pictures in the 'last comments', because by now, 12 people gave their comment to one picture...
It doesn't really looks good, if there is only one picture 4 times...(see my screenshot above)

gaugau: is it possible to show a picture only once?
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Joachim Müller

It surely is, but requires looking into it. At the moment, I'm busy to get cpg1.3.0 on the way, so I won't look into this "problem" right now. Maybe someone else is willing to do so?

GauGau

Tarique Sani

Open functions.inc.php somewhere around line 505 will a section like

case 'lastcom': // Last comments

in that section a bit lower down is the SQL query which you will have to modify to get unique pid - fix that query and you will have what you want....

Also IMO this is unlikely to be a main stream feature
SANIsoft PHP applications for E Biz

Bruz

Ok, I took a look - and I managed to solve nearly everything on my own in the past - but this is a little bit to...complex for me :(

       // Meta albums
        switch($album){
        case 'lastcom': // Last comments
                if ($ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $album_name = $lang_meta_album_names['lastcom'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastcom'];
                }
                $result = db_query("SELECT COUNT(*) from {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']}  WHERE approved = 'YES' AND {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid $ALBUM_SET");
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                if($select_columns == '*'){
                        $select_columns = 'p.*';
                } else {
                        $select_columns = str_replace('pid', 'c.pid', $select_columns).', msg_id, author_id, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, aid';
                }

                $result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $ALBUM_SET ORDER by msg_id DESC $limit");
                $rowset = db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) foreach ($rowset as $key => $row){
                        if ($row['author_id']) {
                            $user_link = '<a href ="profile.php?uid='.$row['author_id'].'">'.$row['msg_author'].'</a>';
                        } else {
                                $user_link = $row['msg_author'];
                        }
                        $msg_body = strlen($row['msg_body']) > 50 ? @substr($row['msg_body'],0,50)."...": $row['msg_body'];
                        $caption = '<span class="thumb_title">'.$user_link.'</span>'.'<span class="thumb_caption">'.localised_date($row['msg_date'], $lastcom_date_fmt).'</span>'.'<span class="thumb_caption">'.$msg_body.'</span>';
                        $rowset[$key]['caption_text'] = $caption;
                }
                return $rowset;
                break;


I really dont know how to change this to match what I want...
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Tarique Sani

Which part is complex?

SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $ALBUM_SET ORDER by msg_id DESC $limit

This is the query you need to modify, do something like

echo"SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $ALBUM_SET ORDER by msg_id DESC $limit"
just before or after the db_query

This will show you the expanded / evaluated SQL copy this, Open phpMyAdmin (I presume you have one) and run tthe query there - start tweaking the query till you get one which fits what you want - paste that back into the file and you are done :)

As a bonus you get to learn more SQL than you already know.
SANIsoft PHP applications for E Biz

Bruz

hmm... I've added
echo("$result")

right after
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $ALBUM_SET ORDER by msg_id DESC $limit");

but this gives me only 'Resource id #35' - SQL-querys are not really my thing...
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Tarique Sani

Read what I have ask you to do and compare it to what you have done - If you still can't figure it out then I would suggest - just wait for someone to do it for you OR hire someone to do it for you
SANIsoft PHP applications for E Biz

Bruz

well, I did what you told me - but it just wirtes
"echo"SELECT $select_columns FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE approved = 'YES' AND c.pid = p.pid $ALBUM_SET ORDER by msg_id DESC $limit""
above my "last comments" table
Maybe I understood you wrong?
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.kingbruz.de%2FFotos%2Fsignatur_cpg.php&hash=b7bf1fbae41c2d8c534416d10d32fe51619697d7)

get your statistik-hack here

Joachim Müller

like Tarique said: maybe you should get someone else's help to do this - as neither Tarique nor another dev is going to give you copy'n paste-ready code for your request. If we walked you through each and every step of developing this tiny mod, we could as well do it by ourselves. Learning PHP by looking at other's code and slighty changing it is a great method - if you don't understand a step, you should consult the php documentation. It's fun to find things out step by step, give it a try.

GauGau