The MU forums have moved to WordPress.org

Change upload directory Structured Blogging? (4 posts)

  1. jalien
    Member
    Posted 16 years ago #

    I'm not sure how to go about changing the upload path of the plugin. I would like to change the upload path to the default path so that students can delete images that they mistakenly upload or for posts they want to delete. After a bit of research I think I need to call wp_upload_dir(), but I'm not sure if this is correct, and how I would work this into the plugin.

    I'm thinking to just to hardwire the upload path into sb-options.php, that way I don't have to worry about finding out what other functions call it. Of course this upload path needs to be a relative path (I'm not sure if that's the right way to say it) so that it is correct for every blog. Thanks in advance for any help.

    For your information, the install was fairly straight forward. Everything seems to mostly be working. I put the plugin into mu-plugins, and only edited files to remove the plugin tags (since these don't work with the site tags); removed any references to Outputthis.org; and deleted the description files of structures (like club reviews) that I didn't want students to access.

    As to the tags, at this point they are stripped if the post is edited, and have to be retyped, but this is a minor annoyance that I can live with for now (another battle for another day).

    Oh, by the way added the plugin after seeing comments from dsader. Great for book reviews/reports. Thanks.

  2. dsader
    Member
    Posted 16 years ago #

    I commented out the upload form on the sb pages and left the Enter url as the only choice. URLs are copy'npasted from usual upload method.

    Multiple input areas in sb-posts bork the idea of including the usual upload methods, though.

    '$path = '/home/USER/public_html/DOMAIN/wp-content/blogs.dir/' . $blog_id . '/files/';' Gets the images uploaded but . . .

    But then upload subfolders aren't date based, images here don't appear in the normal upload pages.

  3. lunabyte
    Member
    Posted 16 years ago #

    IIRC, there's a defined constant for the upload path that is for that particular blog being loaded.

  4. jalien
    Member
    Posted 16 years ago #

    Sorry I haven't had time to say thank to both of you.

    dsader, my kids are elementary students so even copying and pasting of urls is a bit of a challenge to some of the younger ones at first, so if possible I'd like to see if I can work out an easier solution for them.

    It seems from further investigation that the upload path is divided (as far as I can tell) into two pieces sb_file_upload_directory and sb_file_upload_url, and these are only used in two other files sb-posts and sb-edit-form, and both only get these values a couple of times.

    It seems that wp_upload_dir() returns the full upload path with date based folders. Could the path returned by wp_upload_dir be broken up again into url and directory because then the calls to sb_file_upload_directory and _url could be hard coded to call the correct directory - assuming I'm not way off in my reading of the code (a good possibility however). What do you think? Thanks again for any pointers in the right direction.

About this Topic