Need help with CPG database, I'm writing a mod Need help with CPG database, I'm writing a mod
 

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

Need help with CPG database, I'm writing a mod

Started by KotobukiRan, August 31, 2004, 07:47:33 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

KotobukiRan

Hello,

I'm writing/modifying/porting a mod for phpbb so that you can have a gallery button for those who have images uploaded to coppermine. But I'm having trouble figuring out how to identify people who have pictures up in coppermine from those who don't. The cpg131_users doesn't have anything other than the admin in it from the initial setup, and using the forum's userlist just has all of my users with gallery buttons even if they have nothing uploaded. So I'm hoping there's an easy way to tell who has pics up. I've looked through some of the database info for coppermine's entries, and some for phpbb thinking perhaps CPG added extra information to tell who's uploaded. So far nothing. Any help with this would be greatly appreciated.

I'm pretty new to modding and databases, so please go easy on me.

Joachim Müller

do a query (SELECT COUNT should do the trick) on the "owner_id" from coppermine's picture table - the owner_id relates to the user ID

Although I welcome the idea of such a mod, I have a wish: please state clearly in the mod instructions that if anything goes wrong for users applying this mod, they are not meant to look for support on this mod on the coppermine support board, but the phpbb support board - we simply can not support what we don't know. There have been disasters in the past, with other mods and re-rewrites being created as user contributions on the mod pages of other bbs apps, and after applying the mod the coppermine install behaved "funny" (small wonder, as coppermine core files were changed in the process of the modification). The disastrous thing was that all those users who had applied the mod where running to this board, flooding it with complaints and support requests, without us (the coppermine dev team) knowing what was going on. Thanks.

Joachim

KotobukiRan

Thanks for the speedy reply. I'll certainly be sure to mention not to bother the CPG team about the mod once it's complete. =3

It's getting pretty late, and I probably shouldn't be trying to code with heavy lids but just to make sure I'm understanding the mysql code right.... is this correct?

$result = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) FROM cpg131_pictures LIMIT 1"));

The LIMIT 1 was in before so I wasn't sure if it should remain or not. Since I don't want it doing a massive search of the database when it could just find the first instance and stop.

I hope I'm understanding all this right.

Joachim Müller

You will need a WHERE statement to limit the search to the user in question if you're doing this query on a per-user basis. If you want to  do this for a whole array of users, you will have to use a JOIN syntax instead.

Joachim

KotobukiRan

Hopefully I have it this time,

$result = $db->sql_fetchrow($db->sql_query("SELECT COUNT(user_id) FROM cpg131_pictures WHERE user_id == $poster_id"));

Joachim Müller

yes, should be something along these lines...

Joachim