Hi everyone,
I am thankfull in advance for any help.
I am using MODX Revolution 2.2.4-pl (advanced).
I am trying to create member pages. This issue has been raised many times and several users have suggested working solutions (like Bob Ray's tree_root_id solution and the ACL-based resource and user control).
I have posted my own, ACL-based solution on
gist - "own" is actually a gross exaggeration - it is copied-pasted and adapted from several solutions offered by the community (credited in the gist). Be aware though: errors are entirely mine, and I am a non-coder.
The plugin is fairly simple: on UserFormSave, it creates a corresponding resource, resource group, user group, the necessary access controls and group memberships, and a file directory.
But how do I assign the created User Group to an existing Form Customization Profile?
I have tried
$fields = array( 'usergroup' => 25, 'profile' => 2);
$FCPUG = $modx->newObject('modFormCustomizationProfileUserGroup', $fields);
if($FCPUG->save()) {echo 'Success!';}
It does not work. Is it because I can't modify a relationship table?
Then I tried, without success either:
$FCPUGs = $modx->getCollection('modFormCustomizationProfileUserGroup');
$FCprofile = $modx->getObject('modFormCustomizationProfile', 2);
$FCprofile->addMany($FCPUGs);
if($FCprofile->save()) {echo 'Success!';}
In the
http://bobsguides.com/modx-object-full-reference.html#modFormCustomizationProfile"" target="_blank" rel="nofollow">object reference (thanks to Bob Ray for it) modFormCustomizationProfile objects have a related object UserGroups (from modFormCustomizationProfileUserGroup).
How do I add one or several User Group to this related object?
Thank you in advance for your help!
Update: I see that lukemcd posted the
same question on the forum 4 months ago. But he received no answer and posted no solution.
[ed. note: marcelliru last edited this post 12 years, 3 months ago.]