comments in gallery - Page 2 comments in gallery - Page 2
 

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]

Main Menu

comments in gallery

Started by heavensportal, January 25, 2014, 03:20:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

heavensportal

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

Αndré

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
".$cpg_udb->field['usertbl_group_id']." NOT IN (".implode(', ', $cpg_udb->admingroups).")
and replace with something like
".$cpg_udb->field['usertbl_group_id']." != 123
where "123" is the group ID.

heavensportal

the 123=admin 1 admin2 admin3?

Αndré

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

heavensportal

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

heavensportal

my code now looks like this

<?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.

Αndré

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.

heavensportal

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

Αndré

Quote from: heavensportal 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
Have you verified that in the database via e.g. phpMyAdmin?

heavensportal

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

Αndré

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
$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
$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");

heavensportal

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.

heavensportal

My line now reads


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

Αndré

Please enable debug mode to get the extended error message. Priorly, try if it works when you replace
group_id
with
u.group_id

heavensportal

code used:

$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

Αndré

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.

heavensportal

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.

heavensportal

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

<?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'

Αndré

Replace
group_id
with
id_group

Sorry, my mistake.

heavensportal

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