I’m needing a little help using the plugin to automatically add the created docs to a webuser group so it’s only accessible to a set group. I took out the clientredirect snippet as this one is for a different site of mine.
I had a look through the tables on the database and I suspect all that needs done is the documents added to the document_group which in this case is document_group 2.
if($mode=="new"){
$wuid = '-'.$user['internalKey'];
$table_name = $modx->getFullTableName( 'site_content' );
$fields = array(
'type' => 'document',
'contentType' => 'text/html',
'content' => 'info text here',
'pagetitle' => 'main page',
'longtitle' => 'Main page',
'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.)
//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' => 'jot call in here',
'pagetitle' => 'Blog',
'longtitle' => '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
return;
}
There is the snippet again in basic form. I did have a shot at it, but it totally didn’t work.
I added the ’privateweb’ => ’1’, which was easy enough to get working but I’m unsure on how to allocate the documents to a group.
Any help would be great.
Ross