CSV link bug (using multisite)
-
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:https://www.website.com/wp-content/uploads/users_csv/user_list_4.csv
it outputshttps://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
withbaseurl
(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 atSUBBLOGURL/files
(public url) which are whatwp_upload_dir()
will return for a specific blog in a multisite install (asbasedir
andbaseurl
)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 concernsamr_users_get_csv_url
where this special directory should be used instead of the blog specific ones.Greetings,
Anders Johansson
- The topic ‘CSV link bug (using multisite)’ is closed to new replies.