Thanks Dimmy, that did work but only for the bottom document. When I tried applying it to the others it caused as error.
if($mode=="new"){
$wuid = '-'.$user['internalKey'];
$table_name = $modx->getFullTableName( 'site_content' );
$fields = array(
'type' => 'document',
'contentType' => 'text/html',
'content' => '[!sitemap_exclude!]
<div class="contentcontainer" style="text-align:left; background-color:#444; padding:40px 0 40px 20%">
[!Ditto? &tpl=`clientTpl` &summarize=`15` &total=`9` &sortBy=`createdon` &sortDir=`ASC` &descendentDepth=`3` !]
</div>
',
'pagetitle' => '[*tvname*]Clan Pages',
'longtitle' => 'Main Clan Pages Area',
'published' => '1', //is the page published?
'parent' => '38', //what is the parent of this new page?
'isfolder' => '1', // lets make this a folder
'template' => '4', //type template id here
'cacheable' => '0',
'createdby' => $wuid,
'createdon' => time(),
'editedon' => time(),
'publishedon' => time(),
'hidemenu' => '0',
'privateweb' => '1',
);
$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
/* grab the last inserted ID so we can set the document group and page id it belongs to*/
$last_inserted_id = mysql_insert_id();
$table_name = $modx->getFullTableName( 'document_groups' );
$fields = array(
'document_group' => '2',
'document' => $last_inserted_id,
);
$modx->db->insert( $fields, $table_name);
//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.
//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',
'content' => '[!sitemap_exclude!]<div class="contentcontainer">
[!Ditto? &tpl=`clientTpl` &parents=`[*parent*]` &summarize=`15` &total=`9` &sortBy=`createdon` &sortDir=`ASC` &descendentDepth=`3` !]
[[Jot? &pagination=`10` &captcha=`1` &action=`form,comments` &subjectModerate=`0` &tplComments=`ERRbloghistory` &tplForm=`ERRblog` ]]</div>',
'pagetitle' => 'Blog',
'longtitle' => 'Members Blog',
'published' => '1', //is the page published?
'parent' => $parent, //here we go create a doc in the first doc
'isfolder' => '0',
'template' => '4', //type template id here
'cacheable' => '0',
'createdby' => $wuid,
'createdon' => time(),
'editedon' => time(),
'publishedon' => time(),
'hidemenu' => '0',
'privateweb' => '1',
);
$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
//end of page creation
/* grab the last inserted ID so we can set the document group and page id it belongs to*/
$last_inserted_id = mysql_insert_id();
$table_name = $modx->getFullTableName( 'document_groups' );
$fields = array(
'document_group' => '2',
'document' => $last_inserted_id,
);
$modx->db->insert( $fields, $table_name);
//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',
'content' => '<div class="contentcontainer"><div style="margin:0 auto">{{FDMbuttons}}</div>
<div style="line-height: 30px">
<ul style="list-style-type: none; list-style-image: none; list-style-position: outside; margin-left: 20px; font-weight: bold">
<li style="text-align: center; font-size: x-large; margin-bottom: 20px">[*tvpagetitle*]</li>
<li>Real Name : [*tvname*]</li>
<li>In-game Name : [*tvingamename*]</li>
<li>Age : [*tvage*]</li>
<li>Country : [*tvcountry*]</li>
<li>Games I Play : [*tvgames*]</li>
</ul>
</div>
<hr />
<div style="line-height: 30px">
<h2>My Story</h2>
[*tvaboutme*]
</div>
<hr />
<div style="margin-top: 20px">
[*tvcontent*]
</div>
</div>
<div style="background-color:#444444; min-height:200px">
[!MaxiGallery? &admin_webusers=`[[galleryowner]]` &display=`embedded` &disable_js_libs=`0` &embedtype=`smoothgallery` &smoothgallery_width=`640` &pics_per_row=`4` &max_thumb_size =`125` !]</div>',
'pagetitle' => 'ERR-Space',
'longtitle' => 'ERR-Space',
'published' => '1', //is the page published?
'parent' => $parent, //here we go create a doc in the first doc
'isfolder' => '0',
'template' => '4', //type template id here
'cacheable' => '0',
'createdby' => $wuid,
'createdon' => time(),
'editedon' => time(),
'publishedon' => time(),
'hidemenu' => '0',
'privateweb' => '1',
);
$modx->db->insert( $fields, $table_name); // put the fields in the db (id wil be created incremental.)
//end of page creation
/* grab the last inserted ID so we can set the document group and page id it belongs to*/
$last_inserted_id = mysql_insert_id();
$table_name = $modx->getFullTableName( 'document_groups' );
$fields = array(
'document_group' => '2',
'document' => $last_inserted_id,
);
$modx->db->insert( $fields, $table_name);
return;
}