BuddyDev

Search

[Resolved] Need to Hide MediaPress uploads from Normal WordPress Library & Media up-loader

  • Participant
    Level: Initiated
    Posts: 13
    Christian W Zagarskas on #23390

    Consider the following problem:
    100,000 images have been added by members into the MediaPress system.
    Now, when ADMINS have the task of uploading images, or, browsing the WordPress media library they must sort through MediaPress user uploads and separate them from Admin WordPress uploads.

    Solution – idea:
    1- Is there a way to keep MediaPress->Image uploads out of the WordPress->Media Library?
    2- Is there a way to stop MediaPress->Images from showing up in the “Add Media” button/action when editing a Page or a Post?

    Ideally: the concept here would be to quarantine ALL “non admin” user uploaded MediaPress content into its own area.

    For example:
    WordPress Media Area => /wp-admin/upload.php
    * No MediaPress images should show up here

    MediaPress Gallery Area =>/wp-admin/edit.php?post_type=mpp-gallery
    * This is fine MediaPress->All Galleries

    NEW MediaPress “Media Area” =>/wp-admin/edit.php?post_type=mpp-images
    * New area where all MediaPress images would reside, far away from the WordPress Core
    * New Menu item needed here: MediaPress->Library

    Admin Page/Post editing:
    /wp-admin/post-new.php?post_type=post
    /wp-admin/post-new.php?post_type=page
    Click on “Add Media”
    => No MediaPress items should show up here
    * only Admin uploaded content such as logos, graphics and branding materials should show here

    Any ideas on how to accomplish this easily with a hook or a custom page?

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #23391

    Hi Christian,
    Thank you for the question.
    Both are doable. We left it this way to allow admins see what users are doing on their site. I will add an option in next version to toggle the visibility from the media manager.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Christian W Zagarskas on #23406

    Awesome. Thank you!

    Could you tell us what PHP code is needed here in the forum and explain a bit?
    Maybe just a few functions/actions/hooks so we can get started within our theme to fix the issue at hand.

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #23475

    Hi Christian,
    I am sorry I am replying late.

    Please put this in your bp-custom.php

    
    /**
     * Filter WordPress attachment args to remove MediaPress Media from the list.
     *
     * @param array $args args.
     *
     * @return array
     */
    function mpp_custom_filter_attachment_args( $args ) {
    
    	$args['meta_key']     = '_mpp_is_mpp_media';
    	$args['meta_compare'] = 'NOT EXISTS';
    
    	return $args;
    }
    
    add_filter( 'ajax_query_attachments_args', 'mpp_custom_filter_attachment_args' );
    
    

    That will do it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 13
    Christian W Zagarskas on #23493

    That worked great!
    Thank you, excellent.
    It is now much easier for us to find our company media.

    Is there a way to move the images
    out of the “WP->Media->Library”
    and into a new page called “Media Press->Media->Uploads”?

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #23497

    Hi Christian,
    Thank you for confirming.

    About listing images. Since you have removed them from the WordPress media list, you will need to manage them via MediaPress->All Galleries and going to individual gallery.

    It is possible to add a page to list/manage all media in one place but it is not in our development goals.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 42
    Shannon Belletti on #29018

    I wondered about this same thing… Especially since admins don’t know whether they can use that media on the public part of the website.

    I tried adding this code to bp_custom.php but is it retroactive? I still see all of the MediaPress images in my WordPress Media Library.

    Help?

  • Keymaster
    (BuddyDev Team)
    Posts: 24238
    Brajesh Singh on #29039

    Please name the file bp-custom.php

    For more details, Please see
    https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 42
    Shannon Belletti on #29058

    Yes, I already have a bp_custom.php that I’m using in /wp-content/plugins. I added the code but see no change in my Media Library.

  • Participant
    Level: Enlightened
    Posts: 42
    Shannon Belletti on #29063

    Yes, sorry. Typo. It IS bp-custom.php (not underline). All my other code snippets in that file are working fine. Just not this one.

You must be logged in to reply to this topic.

This topic is: resolved