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 16271 times)

0 Members and 1 Guest are viewing this topic.

Αndré

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

Your latest code checks for group ID 19, but your admin group ID is probably 1?
Logged

heavensportal

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

eeek, I was still using the group post id number...changed it and now the admins are no longer listed.....happy dance.

Thanks for putting up with this old woman trying to learn stuff.

Have a wonderful Valentine's day.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15760
Re: comments in gallery
« Reply #42 on: February 13, 2014, 11:16:24 am »

It seems the bridge file is documented wrongly, at least from our result here:
Quote
                '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

Basing on that documentation I created my first code, using usertbl_group_id. Instead, it seems we need to use grouptbl_group_id.


Please try if the following code works as expected:
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['grouptbl_group_id']." NOT IN (".implode(', '$cpg_udb->admingroups).") 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();
Logged

heavensportal

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 259
    • The Fantasy Attic
Re: comments in gallery
« Reply #43 on: February 13, 2014, 11:21:54 am »

 :-*

Yes everything is as it was with the last code before this one...replace with this one and admins are still gone, thank you so very much.
Logged
Pages: 1 2 [3]   Go Up
 

Page created in 0.019 seconds with 20 queries.