modding "enable buddy view of private album" modding "enable buddy view of private album"
 

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

modding "enable buddy view of private album"

Started by giorgio79, February 07, 2007, 05:22:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

giorgio79

Hi Stramm,

Hope you are well.

I am currently integrating your modpack, mainly for the buddies feature. Even though, I decided that for buddy queries I will use my own social network db. (my 'buddy' db stores buddies separated by commas, and does not make a new row for each buddy)

The main feature I would like to use is enabling buddy view of the private album!

I have been analyzing the code, and I think I found where CPG pulls the array of buddies and checks it the current user is a member of the buddy array.
here it is
functions.inc.php
   
line 747

if ($CONFIG['enable_buddy_private_view'] && USER_ID) {
[b]$buddies[/b] = cpg_db_query("SELECT a.aid FROM {$CONFIG['TABLE_ALBUMS']} as a INNER JOIN {$CONFIG['TABLE_BUDDY']} AS b on a.category=b.buddy_id + ". FIRST_USER_CAT ." WHERE b.user_id = ".USER_ID." AND a.visibility = '-1' AND buddy_ok = 'YES' OR category = ".(USER_ID + FIRST_USER_CAT));
while(list($allowed_list[]) = mysql_fetch_row($buddies));



Will the $buddies array contain a list of buddies separated by commas? Looking at the query it seems like it is pulling in some albums as well...
For my db I can pull the same array, it is just called $friends, and I could plug that in here...

Please let me know.

Thank you,

Gyuri

Stramm

The buddy feature is making use of CPGs private album feature and therefore integrating into that system. So it's pulling a list of forbidden albums (comma separated). Few lines below you'll see exactly what it does...

                $FORBIDDEN_SET = "p.aid NOT IN (".substr($set, 0, -1).') ';
                $ALBUM_SET .= 'AND aid NOT IN ('.substr($set, 0, -1).') ';


-> ~ p.aid NOT IN 2,3,19,174

giorgio79

Thanks Stramm!

And as I udnerstand it does so by selecting the albums (a.id) which belong to the buddies (a.category=b.buddy_id) of the current user (b.user_id), right? I am just trying to grasp the flow :)

SELECT a.aid FROM {$CONFIG['TABLE_ALBUMS']} as a INNER JOIN {$CONFIG['TABLE_BUDDY']} AS b on a.category=b.buddy_id + ". FIRST_USER_CAT ." WHERE b.user_id = ".USER_ID." AND a.visibility = '-1' AND buddy_ok = 'YES' OR category = ".(USER_ID + FIRST_USER_CAT))