WordPress.org

Ready to get started?Download WordPress

Forums

amr users
[resolved] CSV link bug (using multisite) (4 posts)

  1. andersjohansson
    Member
    Posted 1 year ago #

    Thanks for a very useful plugin.
    I have unfortunately discovered an annoying bug.
    When using multisite (possibly also on single blog) the link to csv files on public lists has the wrong url.
    Where it should be: http://www.website.com/wp-content/uploads/users_csv/user_list_4.csv it outputs http://www.website.com/LOCAL-FILESYSTEM-PATH/wp-content/uploads/users_csv/user_list_4.csv.

    I did som debugging and localized the bug to amr_users_get_csv_url (amr-users-csv.php:172). Line 175 reads:
    $csvurl = str_replace($upload_dir,$upload_url, $csvfile); // get the part after theupload dir
    this is clearly wrong, since $upload_dir = wp_upload_dir() is an array and $upload_url = $upload_dir['baseurl'] is a string.

    I suppose it should read:
    $csvurl = str_replace($upload_dir['basedir'],$upload_dir['baseurl'], $csvfile); // get the part after theupload dir

    Replacing the basedir (local filesystem path) part of $csvfile with baseurl (url to uploads directory).

    However, also this would fail on multisite, since it appears that csv-files are placed under /wp-content/uploads/users_csv/ and not in the blog-specific upload directories /wp-content/blogs.dir/X/files (actual directory, X is blog id) accessible at SUBBLOGURL/files (public url) which are what wp_upload_dir() will return for a specific blog in a multisite install (as basedir and baseurl)

    Maybe there is a good reason for using this special directory though since four lines in amr_users_get_csv_path (amr-users-csv.php:152-155) specifically rewrites the upload path from blog-specific values to "/wp-content/uploads/users_csv/". In that case, I guess the fix that is needed only concerns amr_users_get_csv_url where this special directory should be used instead of the blog specific ones.

    Greetings,
    Anders Johansson

    http://wordpress.org/extend/plugins/amr-users/

  2. anmari
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Anders

    tack så mycket

    Will have a fix up soon.

  3. anmari
    Member
    Plugin Author

    Posted 1 year ago #

    Meant to have this up soon - had Internet and pc hiccups ... anyway now there - see version 3.5.

    Please let me know asap if you find a problem. I have the link working fine forpublic lists on subsites my local multisite install

  4. andersjohansson
    Member
    Posted 1 year ago #

    It works great on both my local test site and the live site. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic