Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image upload folder #570

Open
shakethatweight-simon opened this issue Oct 24, 2023 · 4 comments
Open

Image upload folder #570

shakethatweight-simon opened this issue Oct 24, 2023 · 4 comments

Comments

@shakethatweight-simon
Copy link
Contributor

Is it possible to change the location of the image/progress photo upload so it's not mixed in with the main media folder?
We have other members of the team who may edit and update the site and there is no reason for them to see these images.

@shakethatweight-simon
Copy link
Contributor Author

@alicolville Have you got any ideas how this could be achieved?

@alicolville
Copy link
Owner

Ah not really, I would probably need to build an separate media handler that doesn't use the standard WP library.

I can't find anything around media library permissions (e.g. hide WT images from certain user roles). :(

@shakethatweight-simon
Copy link
Contributor Author

We use this at the moment to hide the images from the media library in grid view, but doesn't work in list view.

add_filter('ajax_query_attachments_args', function($args) {
    if ( $args['post_type'] == 'attachment' ) {
        $args['meta_query']['relation'] = 'OR';
        $args['meta_query'][] = [
            'key' => 'ws-ls-hide-image',
            'compare' => 'NOT EXISTS',
        ];
        $args['meta_query'][] = [
            'key' => 'ws-ls-hide-image',
            'value' => 0,
        ];
    }
    return $args;
}, 10, 1);

I did find some Wordpress hooks that might be useful, but it would mean some updates to the plugin. If I get some spare time I'll take another look at it.

@alicolville
Copy link
Owner

That could be a potential route, but I probably wouldn't do it on ws-ls-hide-image for the general plugin as some want the images in media library. I guess another suitable key could be a solution...

Happy to look into this at some point, so yes, if you find any more good documentation, dump it in here for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants