We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    Hey, I have a few ideas that I would like to try and setup on my MODx install but was wondering if it’s possible.

    I would like to create a ticket system for a site but the way it would work would be through a person registering with the site. On registering they would be allocated a page that only that account can see and obviously me. It would have a blog or something like JOT so they could post messages. What I wondered is that possible?


    EDIT 16/06/2008

    A simple guide on how to automatically generate pages when a member signs up is included in the text file in this post.
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 25663 MODX Staff
      • 12,272 Posts
      That should be a workable solution. Though I’d question how many tickets you plan to handle and how many users you anticipate having.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 25551 ☆ A M B ☆
        • 1,231 Posts
        Ok how would I go about implementing this? Bit of a newbie in terms of scripting and what not so I need some pointers.

        The ticket support would be for a web design site that shouldn’t be exceptionally busy to be honest. If I can find out how to create a custom page on registering then It would open up ideas I have hiding in my head somewhere.
          Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
          AugmentBLU - MODX Partner

          BLUcart - MODX Revolution E-Commerce & Shopping Cart
          • 25551 ☆ A M B ☆
          • 1,231 Posts
          Has anyone got an answer to how I could have a page auto created when someone registers? Thanks
            Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
            AugmentBLU - MODX Partner

            BLUcart - MODX Revolution E-Commerce & Shopping Cart
            • 7455
            • 2,204 Posts
            I made a plugin that does that:

            <?php //ONLY FOR THE NICE COLORS
            if($mode=="new"){              
            $sql = "INSERT INTO ".$modx->getFullTableName('site_content')." 
            (type,contentType,pagetitle,longtitle,published,parent,isfolder,template,cacheable,createdby,createdon,editedon,publishedon,hidemenu) 
            VALUES ('document','text/html','".$username."','Onze trouwdag','1','9','0','4','0','-".$userid."','".time()."','".time()."','".time()."','1')";
            $result = $modx->db->query($sql);
            
            //maak placeholder en geeft terug voor scherm en mail
            $_SESSION['eigenpaginaid'] =  $modx->db->getInsertId();
            $modx->setPlaceholder('eigenpaginaid', $modx->db->getInsertId());
            return;
            }
            

            you need to change the values for your needs and check the OnWebSaveUser event

            greets Dimmy
              follow me on twitter: @dimmy01
              • 25551 ☆ A M B ☆
              • 1,231 Posts
              hey, thanks for that but I don’t seem to be able to get it to work. Could you give me a little more detail on what I need to do? Thanks!
                Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                AugmentBLU - MODX Partner

                BLUcart - MODX Revolution E-Commerce & Shopping Cart
                • 25551 ☆ A M B ☆
                • 1,231 Posts
                Hey Dimmy could you help me with the plugin you created? Thanks
                  Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                  AugmentBLU - MODX Partner

                  BLUcart - MODX Revolution E-Commerce & Shopping Cart
                  • 7455
                  • 2,204 Posts
                  Ok I used this togetter with the websignup snippet
                  when someone register a new account then this plugin starts. what error do you get?
                  (look in the system-events)

                  maybe the parent is not known (9) in this case change it to 0 for root documents.
                  maybe this makes it more clear: (and better use of the modx dbapi)
                  <?php //only for the nice colors
                  if($mode=="new"){   
                  	$table_name = $modx->getFullTableName( 'site_content' );
                  	$fields = array(
                                          'type'	=>  'document',
                  			'contentType'	=> 'texthtml',
                  			'pagetitle'	=> 'pagetitle',
                  			'longtitle'	=> 'my longtitle goes here',
                  			'published'	=> '1', //is the page published?
                  			'parent'	=> '0', //what is the parent of this new page?
                  			'isfolder'	=> '0',
                  			'template'	=> '1', //type template id here
                  			'cacheable'	=> '0',
                  			'createdby'	=> '-".$userid."', // yes the -# is good there webusers are -# because manager users are +# 
                  			'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());
                  
                     return;
                  }
                  


                  I hope that this clears it up a bit.

                  Dimmy
                    follow me on twitter: @dimmy01
                    • 25551 ☆ A M B ☆
                    • 1,231 Posts
                    The error events showed this

                    Error

                    Event Id: 1 Source: Auto Page - Plugin

                    Date: 28-Apr-2008 04:38 PM User:


                    syntax error, unexpected ’<’


                    Parse error: syntax error, unexpected ’<’ in /home/sites/rossco-designs.com/public_html/manager/includes/document.parser.class.inc.php(745) : eval()’d code on line 1

                    Ok I may need to rethink how I want to do this! I know what I want to do but doing it is another matter.

                    I’ll start again...


                    Customer registers for an account using webloginPE and signs in to the private page welcome area. This is a single document that all registered members arrive at to show that they have signed in successfully. With them signing up I would like a document created that only they can have access to but I would also like the document to be a parent folder so I can drop new documents in there that could be only specifically to do with that client.

                    How would go about creating a parent folder document that only that member can see... how could I create a menu that would navigate them to their private pages?

                    As I will be using this site for web designs, I may want to submit artwork or ideas so ONLY that client would be able to see the documents. I would like these documents being able to be moved in a clients folder for their viewing only.

                    My main quest is how to create a parent document that only viewable to the client but it was auto generated when they registered. I would also need to figure out how they would know where to navigate to as well.

                    Does this make sense at all? I’m confusing myself lol!



                    Here is the code i pasted in to a new plugin


                    <?php //only for the nice colors
                    if($mode=="new"){   
                    	$table_name = $modx->getFullTableName( 'site_content' );
                    	$fields = array(
                                            'type'	=> $data['name'],
                    			'contentType'	=> 'document',
                    			'pagetitle'	=> 'texthtml',
                    			'longtitle'	=> 'my longtitle goes here',
                    			'published'	=> '1', //is the page published?
                    			'parent'	=> '60', //what is the parent of this new page?
                    			'isfolder'	=> '0',
                    			'template'	=> '1', //type template id here
                    			'cacheable'	=> '0',
                    			'createdby'	=> '-".$userid."', // yes the -# is good there webusers are -# because manager users are +# 
                    			'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());
                    
                       return;
                    }


                    It’s exactly the same as your code but I made the parent document 60 which is my parent folder for client pages on my MODx
                      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
                      AugmentBLU - MODX Partner

                      BLUcart - MODX Revolution E-Commerce & Shopping Cart
                      • 25551 ☆ A M B ☆
                      • 1,231 Posts
                      Ok I took out the <?php and it’s worked.

                      Well I have it creating a document that is a folder on register. Only thing is, how do I make it that only that registered person can view the document folder with out me doing it manually? Also how do i specify which template to use? I keeps making documents using blank templates.... I tried changing the template ID to 2 and 3 and it still uses blank even though I have 8 different templates.

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

                        BLUcart - MODX Revolution E-Commerce & Shopping Cart