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
    there is always a solution, but the time is my problem
    I am rebuilding my house and takes a lot of time and energy. I will have a look later
      follow me on twitter: @dimmy01
      • 12684
      • 118 Posts
      Dimmy,

      Thank you very much. I am sure you are very busy. Good luck with your home.

      I have come across some other issues as well. I will jsut list them all here.

      1. adding the users name to the pages. This way you can see them in the document tree and be able to see who’s pages they are, and to also automatically add the name to the page’s and link.

      2. Public links to these pages if you want them to be public. I really need to be able to auto create public links. As long as others can not edit the pages.

      3. I want to be able to have this plugin work for different groups. When group 1 registers then the auto page generation plugin (named Group1 Plugin) works and puts that new member under the Group1 parent folder. When a new member registers for Group2 then the auto page generation plugin (named Group2 plugin) works and puts them into a seperate parent folder just for them -Group2.



        • 12684
        • 118 Posts
        I have tried adding a few different variables for the issue of the plugin noticing which group the new registering member is joining.

        $groups == "Group2";
        
        $groups = isset($groups) ? Group2: '';


        Group2 being the name of the group I want

        I have 3 groups in total so I duplicated the plugin 3 times. Even though I set the Parent folder, it is obviously adding new documents to each of the 3 parent documents.

        I have also tried a few different system events to see if it would help. Such as OnUserFormSave and OnWUsrFormSave.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Why are you using the comparison operator in the first line?

          Also, why are you using three plugins? Why not use one plugin with a switch structure?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 12684
            • 118 Posts
            Susan,

            Yeah I am not sure why I thought that would work, However I have never claimed to really know what I am doing.

            Are you talking about a switch statement? Like...

            switch (expression)
            {
            case label1:
              code to be executed if expression = label1;
              break;  
            case label2:
              code to be executed if expression = label2;
              break;
            default:
              code to be executed
              if expression is different 
              from both label1 and label2;
            }
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yes, that’s a switch alright wink

              You can even write one plugin to handle different events using a switch structure to determine what gets done at different events.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 12684
                • 118 Posts
                Would it be possible to just turn this into a snippet so it could just be included in a document? This would work for my situation because I have different registration documents and forms for each different group. This way it would not run on every OnWebSaveUser that occurs.
                  • 36571
                  • 145 Posts
                  For some reason the InternalKey is not being passed to the database. My pages get created OK, but the createdby field in the database remains stubbornly as zero.

                  I am using WebSignup, rather than WebLoginPE. Does this make a difference?
                    • 7455
                    • 2,204 Posts
                    Quote from: danielw at Jul 24, 2008, 03:47 AM

                    For some reason the InternalKey is not being passed to the database. My pages get created OK, but the createdby field in the database remains stubbornly as zero.

                    I am using WebSignup, rather than WebLoginPE. Does this make a difference?

                    Yes,

                    change this: $wuid = ’-’.$user[’internalKey’];
                    to this: $wuid = ’-’.$userid;

                    that should work
                      follow me on twitter: @dimmy01
                      • 36571
                      • 145 Posts
                      Brilliant! That worked.

                      Now for the main event...passing TV values to the newly created page from a custom Signup form tongue

                      I guess it would have to include

                      <?php
                      $tmplvarid= $_POST[’tmplvarid’];
                      $value= $_POST[’value’];

                      $table_name = $modx->getFullTableName( ’site_tmplvar_contentvalues’ );
                      $fields = array(
                      ’tmplvarid’ => ’$tmplvarid’, \\set your TV id here. (There must be a better way to do this dynamically)

                      ’value’ => $value,

                      );

                      ?>

                      NOTE: This code is unlikely to work. Presumably, you would also need to set the contentid, depending on the document being created. How would one go about doing that?

                      Or am I simply being an idiot and missing a much easier way to achive posting TV values in the new doc along with a user signup?