Set up default groups that can create albums in categories Set up default groups that can create albums in 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

Set up default groups that can create albums in categories

Started by Shane, July 24, 2010, 11:52:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Shane

site:  http://troop445.org/cpg

Just upgraded to 1.5.6.

Where in the database is the data kept that tracks which groups can create albums for each category?  Also, what file would I need to change so that these defaults will be included automatically on creation of any new categories?

My gallery is bridged to a Joomla site, and is set up to use the Joomla user groups.  I'd like to set up the default for each new category created so that groups A, B, and C can create albums, but groups D and E cannot.

Any help would be greatly appreciated.  Thanks.

papukaija

You can use the group manager (groupmgr.php) to set permissions for groups. You can also use the documentation if you want to make these changes with phpmyadmin.

ΑndrĂ©

It is stored in the table categorymap.

You have to modify the code in catmgr.php that creates the new cat:
case 'createcat':
    if (!$superCage->post->keyExists('parent') || !$superCage->post->keyExists('name') || !$superCage->post->keyExists('description')) {
        cpg_die(CRITICAL_ERROR, sprintf($lang_catmgr_php['miss_param'], 'createcat'), __FILE__, __LINE__);
    }

    if ($superCage->post->keyExists('name')) {
        $name = $superCage->post->getEscaped('name');
        $name = trim($name);
    }

    if (empty($name)) {
        $name = '<???>';
        break;
    }

    $parent = $superCage->post->getInt('parent');

    $description = $superCage->post->getEscaped('description');

    cpg_db_query("INSERT INTO {$CONFIG['TABLE_CATEGORIES']} (pos, parent, name, description) VALUES (10000, $parent, '$name', '$description')");
   
    //insert in categorymap
    $cid = cpg_db_last_insert_id();
   
    if ($superCage->post->keyExists('user_groups')) {
        foreach ($superCage->post->getInt('user_groups') as $key) {
            cpg_db_query("INSERT INTO {$CONFIG['TABLE_CATMAP']} (cid, group_id) VALUES ($cid, $key)");
        }
    }
   
    break;