Support Forum

Supporting Uploads in MU

YS Yellow Swordfish
Yellow Swordfish
Member

Taking a look at the SPF storage locations panel it seems to me that all we really need to do here is substitute the current fixed start location of:

/wp-content/

with:

/wp-content/blogs.dir/blogIDnumber/

as if we went down this route we would need to define all of these.

See any problem with that?

39 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Can you confirm (anyone) that the global variable defined in MU to retrn the blog id is, in fact:

$blog_id

RA -Radio-
-Radio-
Member

using the WPMU specific function: get_blog_details();

http://codex.wordpress.org/WPMU_Functions/get_blog_details

returns

$blog_id (the ID number of the blog being queried)

:

what bothers me is, the ID number is required for the parent function… ???

I code with a brick, FOR JUST THIS REASON!

YS Yellow Swordfish
Yellow Swordfish
Member

Can’t be done. As you point out – you need to pass the blog id to get the rest of the info – none of which believe I need. Can’t have the chicken before the egg….

RA -Radio-
-Radio-
Member

well you may have better luck understanding the codex than I do…

http://codex.wordpress.org/WPMU_Functions

RA -Radio-
-Radio-
Member

that does indeed;

$sf_blog_id = get_current_site()->id;

should return the current blog ID as an integer, into the variable $sf_blog_id for use by SPF

RA -Radio-
-Radio-
Member

ACK… noooo…

SITE should be BLOG… not only does SPF have multiple blogs, but can also host multiple SITES…

example:

  • planetgreencentral.com = SITE #1 & Blog #1
  • affiliates.planetgreencentral.com = site #1 & Blog #2
  • evbid.com = Site #2 & blog #3
  • lovemom.evbid.com = site #2 & blog #6

Although Blogs always increment according to when they were created relative to all other blogs, Sites do not.

you can create blogs as subdomains or sub folders of any site available, and sites can be added after blogs have already been created.

A single installation of WPMU can host hundreds of sites, each with hundreds of blogs, without any increase in file storage.

YS Yellow Swordfish
Yellow Swordfish
Member

Ok this does get a bit more complicated…..

Basically there are two critical constants defined in standard WP. These are 'WP_CONTENT_DIR' and 'WP_CONTENT_URL'.

before I can progress this I need to know if (a) they exist in MU and (b) what they are set to.

Anyone know?

YS Yellow Swordfish
Yellow Swordfish
Member

Sorry wrote that (9) before I realised you had written post #8.

Why does this matter? Surely the site URL and PATH are going to be got from the usual WP type settings. As long as the blog ID is unique it should alll ome out OK.

This actually ties in nicely with my question in post 9 because those constants define both the oath and urls to the wp-content folder. But firstly do they exist in MU (My bettng is yes) and if so are they only the oath to the actual 'wp-content' folder or ae they the oath all the way through to the actual storage location you defined above.

How I hate MU…

RA -Radio-
-Radio-
Member

Yellow Swordfish said:

But firstly do they exist in MU (My bettng is yes) and if so are they only the oath to the actual 'wp-content' folder or ae they the oath all the way through to the actual storage location you defined above.

How I hate MU…


I'd back your bet that yes they do exist.

no idea where they point.

build me a small PHP script to display the results and I'll run it on a custom page template in MU to tell you…

YS Yellow Swordfish
Yellow Swordfish
Member

Open sf-loader-forum.php (SPF root folder)

Scroll down to around line 60 and you should find two rows of dashes. This is the best insertion point to place debug code to check values etc.

Paste the followng code between the two lines:

if(defined('WP_CONTENT_DIR'))
{
    echo 'YES – ';
    echo WP_CONTENT_DIR;
    echo '<br />';
} else echo 'NO<br />';
if(defined('WP_CONTENT_URL'))
{
    echo 'YES – ';
    echo WP_CONTENT_URL;
} else echo 'NO<br />';

Save and run any forum page. The result will be displayed above the forum display.

RA -Radio-
-Radio-
Member

let me look at wpComic to see how they do MU file Storage… see if there is something we've missed

YS Yellow Swordfish
Yellow Swordfish
Member

Well that's a good result. Actually a very helpful result because it means I have less code to change and more code can be shared.