-
- 60 Posts
Hi All,
Can anyone tell me if its possible and how to set a default resource group for a newly created resource to belong to in settings? I cant find any options to do this in Site/Context Settings.
Regards
Ash Finlayson
-
- 60 Posts
Anyone have an answer for this?
-
- 338 Posts
Maybe you could write a Plugin that allocates the resource to the resource group OnDocFormPrerender or similar.
Mike
-
- 24,544 Posts
I think you can use Form Customization to set a default value for the resource group field.
As thingstodo suggests, there's probably a way to do it with a plugin tied to OnDocFormPrerender,
or you could use a plugin tied to OnBeforeDocFormSave. I think this would work:
<?php
/* Default group plugin */
if ($mode === modSystemEvent::MODE_NEW) {
$modx->resource->joinGroup('resource_group_name_or_id');
}
-
- 60 Posts
Cheers guys, I hadn't realised a plugin could do the job. Sounds perfect
Ash
-
- 24,544 Posts
Duh. I forget to mention this (which I wrote):
DefaultResourceGroup.