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