• Resolved bunterrichten

    (@bunterrichten)


    Hi there,

    found this plugin just yesterday and I like it a ton already, thanks for all that good work – I was impressed it could even handle drag&drop folder dragging, something I’ve been searching for for a while now.

    There’s also one feature that’s almost exactly what I was aiming for when searching for a plugin this time. It’s the ability to give different user roles different root paths.

    What I’m actually aiming for would be to have each user of a certain role have his own root path in a subfolder of the root path of the user role. Like this:

    – root upload path
    – root role path
    – user 1 root
    – user 2 root

    Each should only be able to upload to his own subfolder.

    I guess it can’t be all too different since you already have the option to have different root paths for different user roles. But until now I was unable to find the place where I should change something in the code.

    Since this is a rather new plugin, highly active, I also wonder how to make sure any changes I do will not be overridden by your new developments in time.

    Anyway, if you could give me a hint on where to start experimenting, that would be of great help! I’ll try on my own in the meantime, but one can always try asking ??

    Niklas

    P.S.: Thanks again for developing this, it already saved me quite some work as it is. If I can get that last part working as well, this is going to be a really nice plugin I’ll be going to recommend to others as well ??

Viewing 1 replies (of 1 total)
  • Thread Starter bunterrichten

    (@bunterrichten)

    Hmm seems I can’t delete this myself… I figured it out. Actually had it before already, but for cache reasons it looked as if it didn’t work.

    If anyone else is interested, here’s how easy it was:

    In the file “FileManager.php” I’ve just added the last part to the filepath to work according to user->display_name:

    //Creat root path for user
            if(!empty($this->options['njt_fs_file_manager_settings']['list_user_role_restrictions'][$this->userRole]['private_folder_access'])){
                $opts['roots'][0]['path'] = $this->options['njt_fs_file_manager_settings']['list_user_role_restrictions'][$this->userRole]['private_folder_access'] .'/'.$user->data->display_name;
            }

    Then each user of the user_role one wants (in my case, subscriber) has to have his own folder created when creating the user. So I hooked into the “user_register”-Action and added this one:

    // now create showoff folder for new user
        $folderpath = $_SERVER['DOCUMENT_ROOT']."/wp-content/uploads/showoff/".wp_get_current_user()->data->display_name;
        if (!file_exists($folderpath)) {
            mkdir($folderpath, 0777, true);
        }

    Worked like a charm ??

    Sry to have bothered you in the first place, some strange cache problem had made this look more difficult than it actually was.

    But if you want to include this addition to the plugin as an official feature, I guess a few people might be interested. Feel free to use the above stuff, and thx again for developing this wonderful plugin ??

    Niklas

Viewing 1 replies (of 1 total)
  • The topic ‘Have different users with different root path’ is closed to new replies.