We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I have a site with approx 3,000 resources in 10 or so different resource groups, and nearly 4,000 users in about 15 different user groups. [messy!]

    The site owner wants to simplify things down to 2 user groups and 2 resource groups.

    Is there any way do 'bulk' move things around other than dragging & dropping each resource and/or user from group to group?

    This question has been answered by smashingred. See the first response.

      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 42562
      • 1,145 Posts
      I am also still looking for a way to move them resources in batch.
      But for users in batch, I use
      //[[!joinUsersToGroup? &group=`yourNewGroup`]]
       
      if ($collection = $modx->getCollection('modUser')){
          foreach ($collection as $user){
              $user->joingroup($group,'Member');
          } 
      }
      I am sure it is terribly easy to tweak it to work from usergroup to usergroup
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 26503
        • 620 Posts
        Unfortunately, this is not something that an end user/administrator can implement. sad


        Quote from: donshakespeare at Jun 11, 2013, 12:04 PM
        I am also still looking for a way to move them resources in batch.
        But for users in batch, I use
        //[[!joinUsersToGroup? &group=`yourNewGroup`]]
         
        if ($collection = $modx->getCollection('modUser')){
            foreach ($collection as $user){
                $user->joingroup($group,'Member');
            } 
        }
        I am sure it is terribly easy to tweak it to work from usergroup to usergroup
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
        • discuss.answer
          • 27708 MODX Staff
          • 2,502 Posts
          Oh, it wasn't clear that you wanted to the end user to handle this change. As far as I know there are no tools to make these bulk structural changes. I suppose Batcher could be modified to handle this for the resource groups part. On the user groups, I think merging the groups via script would be the most efficient approach. If they wish to reassign though, it's going to be a pain.
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
            • 26503
            • 620 Posts
            Quote from: smashingred at Jun 11, 2013, 01:43 PM
            Oh, it wasn't clear that you wanted to the end user to handle this change. As far as I know there are no tools to make these bulk structural changes. I suppose Batcher could be modified to handle this for the resource groups part. On the user groups, I think merging the groups via script would be the most efficient approach. If they wish to reassign though, it's going to be a pain.

            Yea, I thought that would be the answer [I went through the Extras directory pretty extensively] with this many users, it's literally going to take them days to move stuff around.
              *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

              Sean Kimball CLP, CLS.
              Technical Director / Sr. Developer | BigBlock Studios
              ._______________________________________________.
              Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
              27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
              phone/fax: 905-426-5525
              • 4172
              • 5,888 Posts
              if it is a one time thing,
              why can't some snippets with something like that from donshakespeare do the stuff?
              If you know the conditions, which users to which group and which resources to which resource-group, put that custom-snippet like that just onto a resource and call that resource.

              If you want to have it a bit more comfortable and flexible, create a little form, which lets you set the conditions.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 27708 MODX Staff
                • 2,502 Posts
                I was thinking this exactly. If your client can tell you what user and resource groups get merged this would be a relatively fast script to write and execute. Origin resource group ->new destination resource group
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                  • 40016
                  • 32 Posts
                  For the ones that found this page and are needing the snippet to batch-update Resources to resourcegroups, I just leave this here smiley :

                  <?php
                  /*	
                  	This snippet updates all resources to join the given resourceGroup
                  	In my example "AllDocs", change this value to use your own resourceGroup
                  	
                  	Usage: [[!resourceGroupBatcher]]
                  	
                  */
                  	
                  if ($collection = $modx->getCollection('modResource')){
                      foreach ($collection as $resource){
                          $resource->joinGroup('AllDocs');
                  		$resource->save();
                  		echo $resource->get('id').' updated<br/>';
                      } 
                  }
                  ?>


                  Github (maybe for future updates):
                  https://github.com/bvandorp/resourceGroupBatcher/blob/master/resourceGroupBatcher.php