1

I'm using the comments plugin (https://plugins.craftcms.com/comments)

I'd like to define the 'permissions' settings via the config/comments.php file but can't find docs on the syntax to use.

The default reads

    // Permissions
   'permissions' => [],

which doesn't give me much to go on.

Could someone please provide an example I could work out the correct syntax from?

Many thanks!

1

I've just updated the docs, but because it uses the UID of element "groups" it might be annoying in practice to use the config file to set this up, as it requires a bit of manual looking-up of these values.

As the plugin settings are stored in Project Config, you'll probably get the same value setting it through the control panel.

'permissions' => [
    'craft\elements\Asset' => [
        // Volume UIDs
        '33974e79-b3b6-47ec-af91-4519fe4985be',
        'c194716f-aa74-40b6-8426-c835599cbe93',
    ],

    'craft\elements\Category' => [
        // Category Group UIDs
        'a27827c8-4810-433c-acb9-261b53d46281',
        '346194f0-6da8-4f46-a20b-795631ee9a5f',
    ],

    'craft\elements\Entry' => [
        // Section UIDs
        'a8d4bdf1-164e-4ddc-aaad-640026b8d3bf',
    ],

    'craft\elements\User' => [
        // User Group UIDs
        'c23a4d8d-47f0-4e71-927c-d5897ec9c9f8',
    ],
],
1
  • Thanks @crawf! Relying on project config makes sense. We like the idea of using the PHP config file though. We are disabling admin setting changes outside local environments (i.e. no UI for comments settings in staging or prod) and think it's easier for devs to lookup configs from the PHP file than the YAML files... May 17 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.