Create directory for current user via code

Created on 18 April 2023, over 1 year ago
Updated 30 September 2023, about 1 year ago

Hi,

Within a module I am writing I need to, within an EventSubscriber, create an access restricted directory for the current user where my module will place a file for that user.

What function do I need to call for this, and what variables do I need to add?

I think I need to add:

use Drupal\private_files_download_permission\Form\DirectoryForm;
use Drupal\user\Entity\User;

and then call $pfdp_directory->save(), but I need the $user->id() to be the directory name, with only the same user having access permission.

Help would be appreciated.

Thanks,
Glenn

💬 Support request
Status

Closed: outdated

Version

3.1

Component

Code

Created by

🇳🇿New Zealand glennnz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024