1 Reply Latest reply on May 5, 2008 12:35 PM by Günter Schenk

    Creating a folder based on registation info?

      I'm creating a user and want to add a feature where when their account is created, automatically a subfolder with their username is created and they are assigned that folder (for viewing images), any ideas on how I would do this in ADDT? I know how to display it once I get this done, but creating the folder (server side) is what I am stumped on. Thanks. -Aaron
        • 1. Re: Creating a folder based on registation info?
          Günter Schenk Level 4
          Hi Aaron,

          here´s a quick´n dirty function (in fact a Custom AFTER Trigger) I´m using to create a directory after inserting a new record:

          mkdir ("../../user_directories/".KT_escapeForSql($tNG->getPrimaryKeyValue(),$tNG->getColumnType ($tNG->getPrimaryKey()))."", 0755);

          This sample code will actually create a directory (plus give it a 755 permission) that´s named according to the newly inserted record´s Primary Key rather than the user name.

          You could also use $tNG->getColumnValue() to set it to the user´s name, but I personally strongly prefer the "Primary Key" method, as this value will never change, but user names might possibly -- and for retrieving the current user´s "my directory" in whatever page, you´d simply have to use the Session variable kt_login_id.

          Günter Schenk
          Adobe Community Expert, Dreamweaver