We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    but then stil you need to put that user in that usergroup so you need the id of that user. if webloginPE can do that then the id can also be put in the array I mentioned before.
    that way my plugin and snippet are way easier and no need to create a new webgroup for each new ticket.
    Still this the user id needs to be availible when OnWebSaveUser is triggered, now this is not the case.
      follow me on twitter: @dimmy01
      • 25551 ☆ A M B ☆
      • 1,231 Posts
      I know webloingPE can add someone automatically to a usergroup but I don’t think it can generate new usergroups. What you said about still needing the ID of the user makes sense so sticking to the way you originally said would be (hopefully) easier. Fingers crossed!
        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
        AugmentBLU - MODX Partner

        BLUcart - MODX Revolution E-Commerce & Shopping Cart
        • 7455
        • 2,204 Posts
        I took another look at the latest version class and this part:
        $NewUser[’internalKey’] = $key; // pixelchutes
        would put the new id in the array with name internalKey
        Try changing $wuid = ’-’.$user[’id’]; to $wuid = ’-’.$user[’internalKey’]; see if that works.

        its still strange that the internalKey was not in the array you showed me.

        did you use the onWebSaveUser event? and not the OnBeforeWebSaveUser?
          follow me on twitter: @dimmy01
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          Ok the auto generation plugin is as follows now.

          if($mode=="new"){   
          $wuid = '-'.$user['internalKey'];
          	$table_name = $modx->getFullTableName( 'site_content' );
          	$fields = array(
                                  'type'	=>  'document',
          			'contentType'	=> 'text/html',
          			'content'	=> '<div class="contentcontainer">[!WebLoginPE?!]</div>
          <div class="contentcontainer" style="text-align:left; background-color:#444; padding:40px 0 40px 20%">       
          [!Ditto? &tpl=`clientTPL`  &summarize=`15` &total=`9` &sortBy=`createdon` &sortDir=`ASC` &descendentDepth=`3` !]
          </div>
          ',
          			'pagetitle'	=> 'Your Design Pages',
          			'longtitle'	=> 'Main Design Pages Area',
          			'published'	=> '1', //is the page published?
          			'parent'	=> '58', //what is the parent of this new page?
          			'isfolder'	=> '1', // lets make this a folder
          			'template'	=> '21', //type template id here
          			'cacheable'	=> '0',
          			'createdby'	=> $wuid, 
          			'createdon'	=> time(),
          			'editedon'	=> time(),
          			'publishedon'	=> time(),
          			'hidemenu'	=> '1',
          
          			
          			);
          	
          	$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
          
          //Create  placeholder and put the id in a session to use for mail or whatever.
          $_SESSION['eigenpaginaid'] =  $modx->db->getInsertId();
          $modx->setPlaceholder('eigenpaginaid', $modx->db->getInsertId());
          $parent= $modx->db->getInsertId();
          
          //start of page creation, copy this part and past below for as many docs you want (I know we could use a loop but than the logtitle and page title are all the same)
          $fields = array(
                                  'type'	=>  'document',
          			'contentType'	=> 'text/html',
          			'content'	=> '<div class="contentcontainer">[[Jot? &pagination=`10` &captcha=`1` &action=`form,comments` &subjectModerate=`0` &tplComments=`clienttickethistory`  &tplForm=`clientticket` ]]</div>',
          			'pagetitle'	=> 'Ticket System',
          			'longtitle'	=> 'Raise A Ticket',
          			'published'	=> '1', //is the page published?
          			'parent'	=> $parent, //here we go create a doc in the first doc
          			'isfolder'	=> '0',
          			'template'	=> '21', //type template id here
          			'cacheable'	=> '0',
          			'createdby'	=> $wuid,
          			'createdon'	=> time(),
          			'editedon'	=> time(),
          			'publishedon'	=> time(),
          			'hidemenu'	=> '1',
          
          		
          			);
          	
          	$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
          //end of page creation
          
          
             return;
          }


          system event is set to OnWebSaveUser


          Redirect snippet is as follows

          <?php
          if($_SESSION["usertype"] == "manager") {$manager = "1";}
          $wuid  = "-".$modx->getLoginUserID();
          $owner =  $modx->documentObject['createdby'];
          if($wuid == $owner || $manager == "1"){
          return;
          }else{
          $modx->sendRedirect($modx->makeUrl($modx->config['site_start']));
          }
          ?>


          The same thing is happening... when accessing without being signed in, it’s redirecting as it should. Signin with the username that just created the pages, it’s being redirected to the home page. Admin can access the pages. sad
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 25551 ☆ A M B ☆
            • 1,231 Posts
            Anymore on a possible workaround at all? wink
              Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
              AugmentBLU - MODX Partner

              BLUcart - MODX Revolution E-Commerce & Shopping Cart
              • 7455
              • 2,204 Posts
              in de database can you see if the createdby field is set? other then 0
                follow me on twitter: @dimmy01
                • 25551 ☆ A M B ☆
                • 1,231 Posts
                The documents show they were created by 0

                Thanks
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart
                  • 7455
                  • 2,204 Posts
                  that means that
                  1 the internalkey is not passed to the array
                  2 you are using an older version
                  did you grab the latest version? 1.3.1

                  Dimmy
                    follow me on twitter: @dimmy01
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    Hey Dimmy, I haven’t checked out the newer version. Was using 1.30 but I will now. I’ll post the results in 30 mins.

                    cheers
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 25551 ☆ A M B ☆
                      • 1,231 Posts
                      EDITED

                      I think it’s worked! I had some registration problems but it was only happening in IE7 but I think it had to do with the browser cache.

                      I’m going to further test it and then ask you to test it to see how it works.

                      Hopefully it has!
                        Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                        AugmentBLU - MODX Partner

                        BLUcart - MODX Revolution E-Commerce & Shopping Cart