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

    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?
    when using the modx websignup or manager then $username is availible, then just use this in the array:
    'pagetitle'	=> $username,
    or 
    'pagetitle'=> $fullname,
    


    for webloginPE use $user[’username’] or $user[’fullname’]


    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?

    add this just after the page creation:
    $parent= $modx->db->getInsertId();
    $settings_table = $modx->getFullTableName( 'web_user_settings' ); //set the table to use
    $settingsarray = array('webuser' =>  $wuid,'setting_name' => 'login_home','setting_value' => $parent); //set the parameters to insert
    $modx->db->insert( $settingsarray, $settings_table); // insert the parameters in the right table.
    



    Dimmy
      follow me on twitter: @dimmy01
      • 4229
      • 16 Posts
      Thanks!

      Oddly, I can’t get $fullname to work but since $username does work it’s not critical. 

      I spent a few days struggling with what I thought were issues before posting back, and eventually realised the scripts WERE working.  What was happening is that within the manager it wasn’t putting the little padlock on the new client pages, so I was assuming they weren’t secured.

      Like an idiot, I didn’t actually try logging in until after many hours of tweaking and experimenting.  The pages are secured, and simply saving them with new content (which will always be done) reminds the manager to add the padlock.  Duh. There was nothing wrong with your instructions, just the manager being a little quirky.

      Thanks again for your help, this is such a useful feature!  smiley
        • 7455
        • 2,204 Posts
        the pages needs to be set ’private’ => ’1’ that will give you the padlock
          follow me on twitter: @dimmy01
          • 10076
          • 1,024 Posts
          I hope someome can help me here,

          I am using this plugin, modified (thanks bbloke), where the pagetitle etc is build with the username.
          I want to use this to have a page created on userregister.
          Goal is that the user can upload pics to his own area.

          $gallery = isset($gallery) ? $gallery: "47";  // This is the document where you user gallery is stored
          $tmplvar = isset($tmplvar) ? $tmplvar: "11"; // This is the TemplateVariable where the Username is stored.
          $folder = $gallery;
          
          if($mode=="new"){   
          $wuid = '-'.$user['internalKey'];
          	$table_name = $modx->getFullTableName( 'site_content' );
          	
          	// Make the alias for the document
          // remove any unnecessary tags
          $aliasname = $modx->stripTags($user['username']);
          $aliasname = strtolower($aliasname);
          $aliasname = preg_replace('/&.+?;/', '', $aliasname); // kill entities
          $aliasname = preg_replace('/[^\.%a-z0-9 _-]/', '', $aliasname);
          $aliasname = preg_replace('/\s+/', '-', $aliasname);
          $aliasname = preg_replace('|-+|', '-', $aliasname);
          $aliasname = trim($aliasname, '-');			
          $aliasname = $modx->db->escape($aliasname);
          $aliasname = str_replace('.', '', $aliasname); // remove any .'s just incase
          $alias = $aliasname;
          $aliasname = $aliasname."-gallery";
          
          // Make the title for the document
          $title = $alias."'s Gallery";
          	
          	
          	$fields = array(
                                  'type'	=>  'document',
          			'contentType'	=> 'text/html',
          			'content'	=> '<div class="main">[[page_redirect]][!WebLoginPE? &type=`simple`&loHomeId=`46`&disableServices=`profile,login,default,register,forgot`!]{{Screenshots}}</div>
          
          ',
          			'pagetitle'   => mysql_escape_string($modx->stripTags($title)),
          			'longtitle'   => mysql_escape_string($modx->stripTags($title)),
          			'description' => mysql_escape_string($modx->stripTags($title)),
          			'introtext'   => mysql_escape_string($modx->stripTags($title)),
          			'alias'       => $aliasname,
                                  'published'	=> '1', //is the page published?
          			'parent'      => $folder, 
          			'isfolder'	=> '0', // lets make this a folder
          			'template'	=> '6', //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();
                      $settings_table = $modx->getFullTableName( 'web_user_settings' ); //set the table to use
                      $fields2 = array('webuser' =>  $user['internalKey'],'setting_name' => 'login_home','setting_value' => $parent); //set the parameters to insert
                      $modx->db->insert( $fields2, $settings_table); // insert the parameters in the right table.
                     
          
          
          //end of page creation
          
          
             return;
          }
          
          


          Pages are created using the correct title etc. Content is done as is in the snippet.
          On that user page there is a chunk {{screenshots}}
          [!MaxiGallery? &lang=`nl`&upload_field_count=`5`&admin_webusers=`customer`&keep_bigimg=`1` &disable_js_libs=`1`!]


          All the pages are created in a containing folder "incomming (47)" somehow I cant figure out how to have the webusers referred to the created page. WebloginPE has an LiHomeId of 47. On that 47 page I used that [[client_home]].
          Questions:

          Would it be possible to make that link "your page" just directly send people to their page.
          How do I use that ’eigenpaginaid’ to use in eg confirmation emails?

          thanks, Frank