Show/count only keywords for accessible categories Show/count only keywords for accessible categories
 

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

Show/count only keywords for accessible categories

Started by E. William, November 06, 2013, 10:23:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

E. William

Hi everyone,

First post, so please be gentle :).

I was wondering if it's possible to count only keywords from albums which you have a right to view.

So for instance, a guest will only see keywords from albums available to guests, but not those reserved for registered users, and registered users will see the keywords for all albums except private ones (but including his own private albums).

I'm pretty sure the following section from keyword.inc.php would need some modification, but I'm unsure how to do it:


    while (list($keywords) = mysql_fetch_row($result)) {
        $array = explode($CONFIG['keyword_separator'], html_entity_decode($keywords));

        foreach($array as $word) {
            if (!in_array($word = utf_strtolower($word), $keywords_array)) {
                $keywords_array[] = $word;
                $keyword_count[$word] = 1;
            } else {
                $keyword_count[$word]++;
            }
        }
    }

Αndré

Open include/keyword.inc.php, find
$result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> '' $ALBUM_SET");
and replace with
get_meta_album_set(0);
$result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} AS r $RESTRICTEDWHERE AND keywords <> ''");



It seems that $ALBUM_SET is always empty. It's probably a leftover of cpg1.4.x and not used anymore in cpg1.5.x. I've found two other references to it in sidebar.php which should be replaced accordingly and $ALBUM_SET          = ''; in include/init.inc.php, which should be removed.

Αndré

Fixed clickable keyword list content in SVN revision 8620.

E. William