Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2] 3   Go Down

Author Topic: comments in gallery  (Read 16280 times)

0 Members and 1 Guest are viewing this topic.

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #20 on: February 11, 2014, 12:23:45 am »

Thank you Andre, but the admins still show in the listing could it be cause it is a bridged gallery?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #21 on: February 11, 2014, 09:17:55 am »

I used the available admin group data from the bridge file. Of course you could replace the following code and insert your actual admin group ID.

Find
Code: [Select]
".$cpg_udb->field['usertbl_group_id']." NOT IN (".implode(', ', $cpg_udb->admingroups).")and replace with something like
Code: [Select]
".$cpg_udb->field['usertbl_group_id']." != 123where "123" is the group ID.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #22 on: February 11, 2014, 03:58:28 pm »

the 123=admin 1 admin2 admin3?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #23 on: February 11, 2014, 04:06:29 pm »

No, you have to insert the group ID of the administrator group.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #24 on: February 11, 2014, 05:55:31 pm »

ok, thanks I shall go hunt up where that is located. most likely in forum since bridged.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #25 on: February 11, 2014, 06:14:36 pm »

my code now looks like this

Code: [Select]
<?php

$min_comments 
25;

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');
$result cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE ".$cpg_udb->field['usertbl_group_id']." != 101 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");
pageheader();
starttable();
echo 
"<tr><td><strong>User name</strong></td><td><strong>Comments</strong></td></tr>";
while (
$row mysql_fetch_assoc($result)) {
    echo 
"<tr><td>{$row['user_name']}</td><td>{$row['num_comments']}</td></tr>";
}
endtable();
pagefooter();

I changed it to the code shown in the cpg database but the admins are still showing:

http://thefantasiesattic.net/attic/cpg/top-comments.php

the very first name is an admin, sorry to be such a bother.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #26 on: February 12, 2014, 09:24:02 am »

Try 1 instead of 101, as Coppermine internally adds +100 to the forum's group IDs to avoid conflicts. Also make sure that "thelufias" is assigned to the admin group as primary group.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #27 on: February 12, 2014, 09:56:20 am »

ok I will try one and in the forum we are all assigned group id as 1

ok I did it and we are all still in the list... I may just have to live with it... :-[

unless I am totally misunderstanding something, which would not surprise me
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #28 on: February 12, 2014, 10:09:58 am »

ok I will try one and in the forum we are all assigned group id as 1
Have you verified that in the database via e.g. phpMyAdmin?
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #29 on: February 12, 2014, 11:36:32 am »

yes sir I surely did here are the images in case I did not verify it right.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #30 on: February 12, 2014, 11:55:09 am »

Is this an SMF1 or SMF2 board? According to the bridge file:
Code: (bridge/smf20.inc.php) [Select]
                'usertbl_group_id' => 'id_post_group', // name of 'group id' field in users table
                'grouptbl_group_id' => 'id_group', // name of 'group id' field in groups table
the column name in the user table (for SMF2) should be "id_post_group".

It should work if you replace
Code: [Select]
$result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE ".$cpg_udb->field['usertbl_group_id']." != 101 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");
with
Code: [Select]
$result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE group_id != 1 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #31 on: February 12, 2014, 09:06:48 pm »

yes like your forum here it is 2.0.6 since 2.0.7 is still not behaving.

I checked and have both columns so since this and the others are updated from within the admin area, they must have been added? I don't know but will try with that number and let you know.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #32 on: February 13, 2014, 01:31:37 am »

My line now reads


Code: [Select]
require('include/init.inc.php');
$result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE group_id != 19 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");pageheader();


am now getting  Critical error
There was an error while processing a database query
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #33 on: February 13, 2014, 09:19:02 am »

Please enable debug mode to get the extended error message. Priorly, try if it works when you replace
Code: [Select]
group_idwith
Code: [Select]
u.group_id
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #34 on: February 13, 2014, 10:26:06 am »

code used:

Code: [Select]
$result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE u.group_id != 19 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");pageheader();



error:

Fatal error: Cannot redeclare cpggetmicrotime() (previously declared in /attic/cpg/include/init.inc.php:25) in attic/cpg/include/init.inc.php on line 27
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #35 on: February 13, 2014, 10:31:01 am »

Something went wrong here. The error message you posted is no database error message and regardless of the query should have happened before (i.e. it's not related to our recent changes).

When I visit http://thefantasiesattic.net/attic/cpg/top-comments.php I just get a blank page.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #36 on: February 13, 2014, 10:41:33 am »

ok, this ishows what I got when I clicked the link in your reply. I had debug turned on and for admins only so bet that is why you did not see anything,


Let me start with a fresh file then do the edit you first gave me with the last additional code also.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #37 on: February 13, 2014, 10:53:30 am »

ok, this is the error (I turned debug back on for everyone this time

Critical error

There was an error while processing a database query.

While executing query 'SELECT real_name AS user_name, COUNT(*) as num_comments FROM `thefanta_attic`.smf8_members AS u INNER JOIN cpg14x_comments AS c ON c.author_id = u.id_member WHERE group_id != 19 GROUP BY user_name HAVING num_comments >= 25 ORDER BY num_comments DESC' in top-comments.php on line 7 mySQL error: Unknown column 'group_id' in 'where clause'


File: attic/cpg/include/functions.inc.php - Line: 272

using this code

Code: [Select]
<?php

$min_comments 
25;

define('IN_COPPERMINE'true);
require(
'include/init.inc.php');
$result cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, COUNT(*) as num_comments FROM ".$cpg_udb->usertable." AS u INNER JOIN {$CONFIG['TABLE_COMMENTS']} AS c ON c.author_id = u.".$cpg_udb->field['user_id']." WHERE group_id != 19 GROUP BY user_name HAVING num_comments >= $min_comments ORDER BY num_comments DESC");pageheader();
starttable();
echo 
"<tr><td><strong>User name</strong></td><td><strong>Comments</strong></td></tr>";
while (
$row mysql_fetch_assoc($result)) {
    echo 
"<tr><td>{$row['user_name']}</td><td>{$row['num_comments']}</td></tr>";
}
endtable();
pagefooter();

after changing to u.group_id the error is:

While executing query 'SELECT real_name AS user_name, COUNT(*) as num_comments FROM `thefanta_attic`.smf8_members AS u INNER JOIN cpg14x_comments AS c ON c.author_id = u.id_member WHERE u.group_id != 19 GROUP BY user_name HAVING num_comments >= 25 ORDER BY num_comments DESC' in top-comments.php on line 7

mySQL error: Unknown column 'u.group_id' in 'where clause'
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #38 on: February 13, 2014, 10:54:40 am »

Replace
Code: [Select]
group_idwith
Code: [Select]
id_group
Sorry, my mistake.
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #39 on: February 13, 2014, 10:59:33 am »

no need to be sorry, you must go through millions of code daily.

well the page is back up and the debug is on bottom of page but admins are still showing, they just don't want to be left out...LOL
Logged
Pages: 1 [2] 3   Go Up
 

Page created in 0.034 seconds with 19 queries.