-
Notifications
You must be signed in to change notification settings - Fork 52
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
Exclude specific files? #99
Comments
@jockebq Exlude based on which criteria? Or would you like to exclude by defining your criteria via a filter callback? |
@widoz In this case I want to exclude a specific file, with a specific file name. Maybe it is better to exclude it via the ID it has in the database? The reason is because I need to upload a few images used on the site which contains the Global Media. But I don't want to bloat the Global Shared Media for the other users. |
Is it possible to edit this function to exclude a specific media ID? function global_media_user_cap($allcaps, $caps, $args, $user) {
if( !in_array('upload_files', $args) )
return $allcaps;
if( defined('DOING_AJAX') && DOING_AJAX && isset($_POST['action']) && $_POST['action'] == 'query-attachments' ) {
if( function_exists('MultisiteGlobalMedia\getSideId') ) {
if( MultisiteGlobalMedia\getSideId() == get_current_blog_id() ) {
$allcaps['upload_files'] = 1;
}
}
}
return $allcaps;
}
add_filter( 'user_has_cap', 'global_media_user_cap', 99, 4 ); |
Would you define the criteria for an exclude? |
Maybe the criteria could be that the "Caption" of the file has the text "EXCLUDE" or something like that? |
I actually managed to do this with this additional code:
The issue is that I have to manually add all the files I want to be hidden by their filename. I could not really figure out how to utilize one of the existing fields like |
Hi,
I use your plugin to share media from one site in my Multisite network to all the others. It works great! But I would like to exclude a few files from being shared. Is it possible?
I have no problem modifying the source if necessary.
Thank you!
The text was updated successfully, but these errors were encountered: