WordPress.org

Ready to get started?Download WordPress

Forums

[closed] WP 3.5 - any way to default "Add Media" to "Upload Files"? (50 posts)

  1. technabob
    Member
    Posted 1 year ago #

    It seems to me that the most common use case for working with images in wordpress is uploading them. So when I click the new "Add Media" button, it seems counterintuitive that the default view is the "Media Library" tab, instead of "Upload Files".

    It's much less likely that I'm going to use a previously uploaded image from my media library when writing a post, and that I'll be using a newly uploaded image.

    Changing the default here (or allowing it to be a configurable option) would save one click every time you go to upload images.

    Does anyone else out there agree with this? Could a plugin be written to make this an option?

  2. trmash
    Member
    Posted 1 year ago #

    I second your comment... WordPress 3.5 looks great, but the media manager seems to be a step backwards.

    Unfortunately it's not simply a matter of "getting used to it" - the media manager changes have added unnecessary extra steps which have a negative impact on workflow.

    For example, as technabob says, we now have to click to switch to Upload Files instead of having it as the default.

    Featured Images have become less streamlined too, as the media manager closes after I upload and insert an image, so I then have to go back in and select the featured image. Previously I could click it just before I clicked 'Insert into post'.

    Not to mention the now-tiny input boxes for captions, titles and descriptions. For many of us, these are hugely important parts of uploading photos but appear to have been 'downgraded' in terms of their importance to WordPress.

    Personally, I miss the old media manager - everything was where I needed it, and the processes were a lot quicker.

  3. technabob
    Member
    Posted 1 year ago #

    Frankly, I like the old upload process better too, but the gallery management is definitely improved for those of us who use galleries too - especially excluding images and sorting them.

    I just don't see the need to constantly look at my entire media library. We have tens of thousands of images in there, and only once in a very rare blue moon do we reuse an image from a prior post.

  4. technabob
    Member
    Posted 1 year ago #

    I think I figured out a way to do this courtesy of this plugin code that I found here:
    http://wordpress.stackexchange.com/questions/74422/changing-the-media-library-default-tab

    Just had to change the return value to "uploadFiles" and it seems to work like a charm in 3.5. I still think this should be an option on the media manager tab.

    <?php
    /*
    Plugin Name: Default Media Tab
    Plugin URI: http://wordpress.stackexchange.com/q/74422/6035
    Description: Change the default media upload tab in WP < 3.5
    Author: Christopher Davis
    Author URI: http://christopherdavis.me
    License: GPL2
    
        Copyright 2012 Christopher Davis
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License, version 2, as
        published by the Free Software Foundation.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    !defined('ABSPATH') && exit;
    
    add_filter('media_upload_default_tab', 'wpse74422_switch_tab');
    function wpse74422_switch_tab($tab)
    {
        return 'uploadFiles';
    }
    ?>
  5. technabob
    Member
    Posted 1 year ago #

    Strike that. I thought it was working, but it isn't.

    Does anyone on the wordpress team know if the media_upload_default_tab filter still works in 3.5? If so, what are the tab names?

  6. kilwag
    Member
    Posted 1 year ago #

    Adding my voice in agreement.

    99.99% of the time I want to add media to a post, it's brand new. The default library view is slow and necessitates another click through to get to what I want. It should default to post specific images.

    Also, the selection process was a little counterintuitive. I figured it out, but it wasn't immediately obvious what was going on.

    As an aside, the media uploader display is a little buggy in Safari 6, plus a noticeable delay when inserting.

  7. technabob
    Member
    Posted 1 year ago #

    I'm still testing this, but I THINK it'll work with a return value of "type"

    <?php
    /*
    Plugin Name: Default Media Tab
    Plugin URI: http://wordpress.stackexchange.com/q/74422/6035
    Description: Change the default media upload tab in WP < 3.5
    Author: Christopher Davis
    Author URI: http://christopherdavis.me
    License: GPL2
    
        Copyright 2012 Christopher Davis
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License, version 2, as
        published by the Free Software Foundation.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    !defined('ABSPATH') && exit;
    
    add_filter('media_upload_default_tab', 'wpse74422_switch_tab');
    
    function wpse74422_switch_tab($tab)
    {
        return 'type';
    }
    ?>
  8. technabob
    Member
    Posted 1 year ago #

    Nope. That doesn't seem to work either. I thought I had it working, but it's not.

  9. Sapphire
    Member
    Posted 1 year ago #

    Yes, WordPress, please roll this particular change back in the next update. We shouldn't need to add a plugin and slow down our sites to regain lost functionality.

  10. Gunaxin
    Member
    Posted 1 year ago #

    Add me to the list of folks who find this to be a no-brainer, and something that is not properly documented for me to fix. I've spent about 2 hours tonight trying to resolve this problem, as I run a multi-author site, and this one tiny little thing is going to cause tons of problems and time lost.

  11. deepbevel
    Member
    Posted 1 year ago #

    this worked for me
    http://wordpress.stackexchange.com/questions/76125/change-the-default-view-of-media-library-in-3-5

    uploaded to this post is the only sort I wanted, so I removed the selected=0 part of the code, now all sorts force "uploaded to this post". And then I removed the drop down sort selector with css.

  12. adminsave
    Member
    Posted 1 year ago #

    How can I use my old twenty eleven theame version 3.4.2 instead of 3.5

  13. deepbevel
    Member
    Posted 1 year ago #

    @technobob

    Does anyone on the wordpress team know if the media_upload_default_tab filter still works in 3.5? If

    no, it's now javascript. refer to my previous post.

    you also have new css options

    /*wp 3.5 media uploader sidebar*/
    .media-menu a:first-child, /*create gallery*/
    .media-menu a:first-child + a,/*set featured  image*/
    .media-menu a:last-child, /*from url*/
    
    /*wp 3.5 media uploader tabs*/
    .media-frame-router a:first-child /*upload tab*/
    .media-frame-router a:first-child + a /*library tab*/
    
    /*wp 3.5 media uploader drop down selector*/
    .media-frame select
  14. technabob
    Member
    Posted 1 year ago #

    Deepbevel: I'm not sure if that solves the issue I'm talking about. I'm not so worried about the drop-down menu being set to just the current post's images (though that would be nice if it did that once any images are attached) - I want the default screen to be "Upload Files" instead of "Media Library".

    Is this possible through a JS hack?

  15. deepbevel
    Member
    Posted 1 year ago #

    well, it's a start, somethng to work with.. I'm only just begining to experiment.. stay tuned.

    I can't recall at the moment if the dropdown selector has the Upload Files" option, if so you could use the script to force that screen as default. (not really default, rather, it seems to over ride the default and makes the selection automatically)

  16. deepbevel
    Member
    Posted 1 year ago #

    I use it without the if statement, so it forces the view regardless of what is selected. Then I hid the selector with css.

    <?php
    /**
     * Plugin Name: Pre-select post specific attachments
     */
    
    add_action( 'admin_footer-post-new.php', 'wpse_76048_script' );
    add_action( 'admin_footer-post.php', 'wpse_76048_script' );
    
    function wpse_76048_script()
    {
        ?>
    <script>
    jQuery(function($) {
        var called = 0;
        $('#wpcontent').ajaxStop(function() {
    
                $('[value="uploaded"]').attr( 'selected', true ).parent().trigger('change');
                called = 1;
    
        });
    });
    </script>
        <?php
    }
  17. deepbevel
    Member
    Posted 1 year ago #

    I didn't do the css correctly above to hide the selction dropdown , should be:

    .media-frame select.attachment-filters

    otherwise it hides the checkboxes for image link and "image opens in".

  18. deepbevel
    Member
    Posted 1 year ago #

    just tested, if you use

    .media-frame-router a:first-child + a
    {
    display:none;
    }

    it hides the media library tab and the first screen is "Upload" with the "Select Files" button.

    no java-mod required, but behaivior still has to be tested..

  19. hotinthenews
    Member
    Posted 1 year ago #

    Hello;

    Here are my five cents worth:

    Even defaulting to 'Uploaded to this post' isn't good enough, unless you have a site with few images. For sites with lots of images this still slows down the WP operation because that option first looks through articles to see if images already exist in that article before showing the user the 'No Items Find' Select Files option.

    That is still tedious and time consuming. Why change a good thing?

    If you have a site such as mine that you work with lots of images, the new media feature with WP3.5 is a royal pain, sorry .... but it's true.

    Give us the old media insert option back ... please!!!

    Lode

  20. deepbevel
    Member
    Posted 1 year ago #

    good points. The mods ar really limited, not really getting us what we want.

    The best option I've discoverd is that 2 of my plugins which are associated with the media library still use the old ui.
    This includes Inline Attchments and Portfolio Slideshow plugins.

    I'd limit media Library access to those plugins.. except Media Categories plugin doesn't work in the old ui, and I need media categories!

  21. technabob
    Member
    Posted 1 year ago #

    ...and I don't want to completely eliminate or hide the media library tab, as I use it regularly. i just don't want it to be the default. The simplest fix is just for wordpress to add an option to change the default view to upload an image. Then you could choose the appropriate path based on your individual workflow.

  22. Did you guys notice you can drag images into the media uplolder, no matter what page it's on?

  23. Webtaurus
    Member
    Posted 1 year ago #

    I opened a thread with more observations about the new media window: http://wordpress.org/support/topic/new-media-upload-window-could-be-improved and there more people complain about this workflow. I hope the developers see this and take it serious, as its very counter intuitive.

    @Ipstenu drag and drop is very functional for developers (working with large or multiple displays) but many users are on smaller devices where they use full screen.

    for now its an issue that makes me delay the update for less savy users, since I need to have the time available to answer their questions, and to prevent them from falling back into the habit of double uploads for "featured" and inserted images :-)

  24. designlabCPH
    Member
    Posted 1 year ago #

    THANK YOU! :)

    I have spent the last 3 days searching for a snippet that could hide the library images (basically I needed a function so not even editors could see other media than their own uploaded, but this works as well, as they only have acess to their own posts)...

    I just used

    .media-frame-content .attachment-filters:first-child {
    display:none;
    }
    instead, for hiding the "show all images" option.

  25. MrDamasajaga
    Member
    Posted 1 year ago #

    As far as the starting problem of this topic, the "Default to Upload Files Tab" (media_upload_default_tab) won't be supported. See: http://core.trac.wordpress.org/ticket/22186#comment:46

  26. idealien
    Member
    Posted 1 year ago #

    SOLVED!!!!!!

    If you want to have the editor default to the Upload Files tab in the admin editor:

    <?php
    add_action( 'admin_footer-post-new.php', 'idealien_mediaDefault_script' );
    add_action( 'admin_footer-post.php', 'idealien_mediaDefault_script' );
    
    function idealien_mediaDefault_script()
    {
        ?>
    <script type="text/javascript">
    jQuery(document).ready(function($){
    wp.media.controller.Library.prototype.defaults.contentUserSetting=false;
    });
    </script>
    <?php } ?>

    If you just want that to happen on a front-end page - use this in a template or a JS file called from the appropriate template / page.

    <script type="text/javascript">
    jQuery(document).ready(function($){
    wp.media.controller.Library.prototype.defaults.contentUserSetting=false;
    });
    </script>
  27. MrDamasajaga
    Member
    Posted 1 year ago #

    Tested and confirmed!

    Really great idealien, thank you.

  28. idealien
    Member
    Posted 1 year ago #

    Your welcome.

    For anyone else who's not afraid of digging around in the core files of WP to understand / discover such things....This video with Koop was invaluable for getting a good overview of the structure of the new media library and how it is built with underscore and backbone, particularly the second half.

    The two main files where most of the relevant code are located in:

    • /wp-includes/js/media-views.js
    • /wp-includes/js/media-models.js

    Along with Firebug in command line mode to inspect / test set the value of objects / variables that you find via the code.

  29. Alicia1811
    Member
    Posted 1 year ago #

    The unfortunate thing is, if I could do all of THAT I might not be using WP to begin with. As much as I like WP I've been using this new image tool for about two weeks and I much prefer the old way. This new interface is simply not as streamlined or user friendly as the old.

    It most certainly is not more efficient than the old tool.

  30. salromano
    Member
    Posted 1 year ago #

    @idealien

    Where do we apply that code? Theme functions?

Topic Closed

This topic has been closed to new replies.

About this Topic