User folders distribution by their role, and not there username

in Download Manager Pro Feature Request

Viewing 4 posts - 1 through 4 (of 4 total)
Jun 23, 2022 at 5:21 am
#174333
Participant
mihai baranescu
OP

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.

Jun 23, 2022 at 7:06 am
#174340
Keymaster
Shahjada
Staff

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.

Jun 23, 2022 at 7:36 am
#174342
Participant
mihai baranescu
OP

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

Jun 27, 2022 at 6:35 am
#174452
Participant
mihai baranescu
OP

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.