User folders distribution by their role, and not there username

Viewing 4 posts - 1 through 4 (of 4 total)
#174333

mihai baranescu
Participant

Hello,
I have many users that there roles define what folder should have access to. So I modified the code in AssetManager.php at line 39 and added

$role = $current_user->roles[0];
        switch ($role) {
            case 'cnsbt':
                $role = 'CNSBT/';
                break;
            case 'renv':
                $role = 'RENV/';
                break;
            case 'uatm':
                $role = 'UATM/';
                break;
            case 'cnscbt':
                $role = 'CNSCBT/';
                break;
            case 'administrator' :
                $role='';
                break;
            default :
                $role=$current_user->roles[0].'/';
                break;
        }

        $root = current_user_can(WPDM_ADMIN_CAP) ? rtrim(get_option('_wpdm_file_browser_root'), '/') .  '/' .$role : UPLOAD_DIR . $role . '/';

it will be awesome if I have this option in admin interface. Where I attribute every role of user there responsible folder, and not having to modify every time there’s an update.

Thank you very much.

#174340

Shahjada
Keymaster

We shall add a hook there to modify user’s base dir, but it will not be possible to add the feature with core, as wp user can have multiple roles.

#174342

mihai baranescu
Participant

Thank you very much.
I will look forward to the hook, in the next update.

#174452

mihai baranescu
Participant

Hello,
And thank you for adding a filter to the root of assets.
It works perfectly.

Thank you.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘User folders distribution by their role, and not there username’ is closed to new replies.