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
    I’m wondering if it’s possible to make the plugin in to a snippet so you can control the action on registration pages only... I want a registration page for one user group that has 4 pages created and another registration page that only allows new users to created 2 pages within a different webuser group.

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

      BLUcart - MODX Revolution E-Commerce & Shopping Cart
      • 7455
      • 2,204 Posts
      you could post some extra fields that you probebly could grab in the plugin
        follow me on twitter: @dimmy01
        • 4429
        • 429 Posts
        Hi,
        I am very interested in the work done here as it seems like it would be perfect for my plan of a multi-user photo blog site.

        My aim is as follows:
        New user registers and a page is automatically created in Userblogs--->new user name-->new user blog
        Using FDM and Maxigallery the new user will be able to create a blog on his pages only
        The public will be able to view but not edit the blog or gallery.

        I have read through the 9 pages of this thread but not knowing anything more about PHP other than cut and paste I’m not sure where to start.


        Unlike the original poster I will be using the default weblogin rather than webloginPE

        How should the code be modified to work with the default login manager?

        Thanks
          • 7455
          • 2,204 Posts
          Quote from: c-m at Oct 15, 2008, 08:06 AM

          Hi,
          I am very interested in the work done here as it seems like it would be perfect for my plan of a multi-user photo blog site.

          My aim is as follows:
          New user registers and a page is automatically created in Userblogs--->new user name-->new user blog
          Using FDM and Maxigallery the new user will be able to create a blog on his pages only
          The public will be able to view but not edit the blog or gallery.

          I have read through the 9 pages of this thread but not knowing anything more about PHP other than cut and paste I’m not sure where to start.


          Unlike the original poster I will be using the default weblogin rather than webloginPE

          How should the code be modified to work with the default login manager?

          Thanks


          http://modxcms.com/forums/index.php/topic,25087.msg154585.html#msg154585
            follow me on twitter: @dimmy01
            • 4429
            • 429 Posts
            onWebSaveUser event must be selected in the system events!!!

            How do i enable this? I haven’t come across such an option
              • 7455
              • 2,204 Posts
              Quote from: c-m at Oct 15, 2008, 09:35 AM

              onWebSaveUser event must be selected in the system events!!!

              How do i enable this? I haven’t come across such an option

              its the plugin so you have a tab with events in that tab you have that option
                follow me on twitter: @dimmy01
                • 4429
                • 429 Posts
                works now, but I have a couple of issues

                1) The page container is created in the correct place but the supposed sub page is not. Instead it appears in the root document tree.

                2) what is command to have the container page and/or sub page named after the user ID?

                Here is the code below. Thanks

                if($mode=="new"){   
                	$table_name = $modx->getFullTableName( 'site_content' );
                	$fields = array(
                                        'type'	=>  'document',
                			'contentType'	=> 'text/html',
                			'pagetitle'	=> 'pagetitle',
                			'longtitle'	=> 'my longtitle goes here',
                			'published'	=> '0', //is the page published?
                			'parent'	=> '54', //what is the parent of this new page?
                			'isfolder'	=> '1',
                			'template'	=> '4', //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());
                
                   //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',
                			'pagetitle'	=> 'pagetitle',
                			'longtitle'	=> 'my longtitle goes here',
                			'published'	=> '1', //is the page published?
                			'parent'	=> $parent,  //here we go create a doc in the first doc
                			'isfolder'	=> '0',
                			'template'	=> '1', //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;
                }


                This question was asked by Rossco but the solution of adding $parent (which was already in the code) didn’t work for me :-(
                  • 4429
                  • 429 Posts
                  if there anything else at all apart from
                  'parent'	=> $parent,
                  that is needed to create the new page inside the new container and not just placed in the root of the document tree?
                    • 7455
                    • 2,204 Posts
                    you need to define $parent

                    add
                    $parent = $modx->db->getInsertId();
                    just above this line:
                    //Create placeholder and put the id in a session to use for mail or whatever.

                    and it should work
                      follow me on twitter: @dimmy01
                      • 4229
                      • 16 Posts
                      Firstly, many thanks to Dimmy for assisting Rossco so much in making this highly useful feature work.

                      I’m adding it to a site for my uncle’s accountancy firm and it will be used to create individual client pages for him to add links to their tax return PDFs etc.

                      So far it’s working well:

                      Adding Web Users via the Manager triggers the plugin and new pages are added.

                      My only issues have revolved around the login system and getting users to their pages, which is probably best left for another thread and really 99% resolved now anyway.

                      My question:
                      When the plugin is adding the new pages, is there a way of inputting the new users ’Full name’ as the ’pagetitle’ ?  I’m sure it must be a simple call but I’m struggling to find out what it is.  any ideas?  smiley

                      -edit-
                      Also, for some reason I’m having to manually edit the Web User options for each client / user to specify their Login Home Page. Is there a way to have the page creation script do this for me?