okay, i edited the Snippet code so that only the WebUser who created the gallery is able to edit this particular gallery ( i also changed the class name to "MGnew" ) + added the createdon timestamp + empty cache and mrhaws TransAlias & menuindex solution + after creation a link to the new gallerie is displayed :
<?php
$output='';
class MGnew {
var $db;
function MGnew() {
global $modx;
$this->db = $modx->db;
}
function newDocument($fields=array()) {
global $modx;
if(! $id = $this->db->insert($fields, $modx->getFullTableName('site_content')))
$this->logError('newDocument', $this->db->getLastError(), time());
clearCache();
return $id;
}
}
function clearCache() {
include_once "manager/processors/cache_sync.class.processor.php";
$sync = new synccache();
$sync->setCachepath("assets/cache/");
$sync->setReport(false);
$sync->emptyCache();
}
if(isset($_POST['save_doc'])) {
$MGnew = new MGnew;
$parent = isset( $parent ) ? $parent : '0';
$alias = $modx->stripAlias($_POST['title']);
$timestamp = time();
$webusername = $_SESSION['webShortname'];
$mnuidx = $modx->db->getValue('SELECT MAX(menuindex)+1 as \'mnuidx\' FROM '.$modx->getFullTableName ('site_content').' WHERE parent=\''.$parent.'\'');
if($mnuidx<1) $mnuidx = 0;
$fields = array(
"pagetitle" => $_POST['title'],
"alias" => $alias,
"content" => "[!MaxiGallery? &manager_webusers=`$webusername` !]",
"published" => 1,
"createdon" => $timestamp,
"richtext" => 0,
"template" => 6,
"menuindex" => $mnuidx,
"parent" => $parent
);
if(!empty($_POST['title'])) {
$id = $MGnew->newDocument($fields);
$url = $modx->makeUrl($id, '', '', 'full');
$name = $fields['pagetitle'];
$output .= "upload images: <a href=\"$url\">$name</a>";
}
else {
$output.='Gallery could not be created. Please enter a valid title!';
}
}
else {
$output .= '<form method="post" action="'.$_SERVER['REQUEST_URI'].'">
Gallery Title: <input type="text" name="title" value="'.$pce_ar_charts['title'].'"/>
<input type="submit" name="save_doc" value="create" />
</form>';
}
return $output;
?>
you need to edit the Snippet code under "customize to fit your setup": content ( your snippet parameters) / template id etc. -> "&manager_webusers=`$webusername`" should stay in the MG call if you want to use that feature.
one thing i need to figure out is, how to set the Menu Index, since this is currently 0 for all new galleries ... any ideas, pointers

?
-> call the Snippet like this: [!Snippetname? &parent=`yourparentid`!] if no value for parent is declared, it defaults to "0" and the gallery is created in the site root.
thanks, j