WordPress.org

Forums

Custom Upload Dir
Upload from the Media Panel and not from Post (6 posts)

  1. somtam
    Member
    Posted 2 years ago #

    Hello,

    I've tried to make a "per author" directory.
    It works, but only if I upload an image through the post panel.
    Instead if I upload from the Media Panel, it doesn't.
    Is it correct?

    thanks!

    http://wordpress.org/extend/plugins/custom-upload-dir/

  2. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    Yes. Author is post-specific, so obviously it will only work when you're uploading to a post.

  3. somtam
    Member
    Posted 2 years ago #

    But author ( and editor ) can also have access to the media panel...
    So I think it is correct to make it works on the media panel also... because, if not, we have to comunicate to them not to upload and use the media panel.
    This my 2 cents.... anyway thank for the work you've done.

  4. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    That is a valid point. I'll look into it and see if there's a way to get the right info in the context of the media library too.

  5. somtam
    Member
    Posted 2 years ago #

    Right now to solve the problem i use this:

    add_filter('upload_dir', 'my_author_dir');
    function my_author_dir( $param ){
    
        global $current_user;
        $mydir = '/' . $current_user->user_login;
    
        $param['path'] = $param['path'] . $mydir;
        $param['url'] = $param['url'] . $mydir;
    
        error_log("path={$param['path']}");
        error_log("url={$param['url']}");
        error_log("subdir={$param['subdir']}");
        error_log("basedir={$param['basedir']}");
        error_log("baseurl={$param['baseurl']}");
        error_log("error={$param['error']}"); 
    
        return $param;
    }

    thanks!

  6. RonDsy
    Blocked
    Posted 2 years ago #

    I know your plugin is based upon the post filter however I am looking for an application for a shop. The products images need to be in different folder to segregate them. Example:

    Paintings (parent)
    - oil paintings
    - watercolors
    - acrylic

    Is there a plugin to solve this for images?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Upload Dir
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic