It would be nice if new user or company gets some folders created for them automatically when new account is created. We'll show you how this can be done. We assume that your project has Registration page turned on.
- Create a project using DocManager template or add DocManager template to existing project. Enable Registration page.
- Open <project folder>\business\DocManager\source\docman_functions.php file in any text editor and add the following function there somewhere at the end of the file:
function createFolder($name, $parentFolderID, $ownerID) {
global $dal;
$tblDocs = $dal->Table("doc_files");
$tblDocs->Value["parent_folder_id"]=$parentFolderID;
$tblDocs->Value["file_type"]="folder";
$tblDocs->Value["file"]=my_json_encode(array($file));
$tblDocs->Value["hash"]=generatePassword(HASH_LENGTH);
$tblDocs->Value["name"]=$name;
$tblDocs->Value["ownerid"]=$ownerID;
$tblDocs->Value["created"]=now();
$tblDocs->Add();
}
This function accepts three parameters:
$name - name of the folder to be created
$parentFolderID - ID of the parent folder, 0 if folder is created on the top level
$ownerID - user id from doc_users table
3. AfterSuccessfulRegistration event
Create some folders automatically.
$id = DBLookup("select id from doc_users where email='".$userdata["email"]."'");
createFolder("tmp",0,$id );
createFolder("public",0,$id );
createFolder("private",0,$id );
This is it.