General developer forum

Sharing files between users

 
Picture of Luis de la Torre
Sharing files between users
Plugin developers

Hi all,


I'm working on a modification of the Private Files Repository block to allow users to share their private files so that they could appear in other users' private files repositories.


I already have a beta implementation. You can see it in work in the next video.


SharePrivateFiles


However, the way I'm doing this right now is creating a copy of User1's file in the files table for User2. What I'd really like is to create an alias of User1's file for User2. Is that possible? Can I have alias files in the Private Files Repository?  https://docs.moodle.org/34/en/Working_with_files#Areas_in_which_aliases_cannot_be_made doesn't seem to specify this is not possible, but I have tried something like 

$result = $fs->create_file_from_reference($fileinfo, $usersrepositoryid, $file->id);

instead of 

$result = $fs->create_file_from_storedfile($fileinfo, $file->id);

and this is giving some problems.


Any tips?


Next thing I'll do is to first send a notification to User2 when User1 chooses to share a file with him. Then, User2 will decide whether he wants to receive the file or not (and confirm it or decline it) and last, User1 will receive a notification saying if User2 accepted the file or not.

 
Average of ratings: -
Picture of Luis de la Torre
Re: Sharing files between users
Plugin developers

Updated video on how it works at the moment.


FileSharing

 
Average of ratings: -