Forum Replies Created
-
@Roman, I’ve seen a similar fix out there on the interwebs, but it didn’t work for me. Yours looks to be tweaked a bit from what I’ve seen, so I’ll give it a go. Where did you put this bit of code?
Good call, @Roman. Defining both fixed one problem, but introduced many more.
Delving deeper, I believe that multisite is designed, on purpose, to keep things separate amongst network sites. That includes avatars, group avatars, etc. That is why each site has a separate upload directory (wp-content/blogs.dir/3/files/avatars, wp-content/blogs.dir/4/files/group-avatars and so on…).
By default, each subsite’s upload path is something like wp-content/blogs.dir/5/files. And the home site’s upload path is wp-content/uploads. If no root blog is set (which @Roman pointed out that we can’t set a root blog AND enable multiblog), then the code will set the current site as the root blog and grab that site’s upload path. For example, if I’m on site 5 of a WPmultisite/BPmultiblog install, the site will look to pull files from the wp-content/blogs.dir/5/files folder. Accordingly, it will find any files that were uploaded to that directory, from site 5. It won’t find your avatar, because you likely uploaded them via the home site, and those avatars reside in the wp-content/uploads folder.
While this design probably works for most implementations, it does not suit my purposes. I need to show avatars and group avatars across all sites (sounds like you both do as well). With that in mind, here is the path I’m heading down:
The Network Admin Sites/Settings page (accessible via wp-admin dashboard at wp-admin/network/site-settings.php?id=4) allows you to update the “Upload Path”, “Upload URL Path”, and “Fileupload URL”. For my project, I modified all subsites to be the same as the home site upload path: “wp-content/uploads”, “http://example.com/wp-content/uploads”, and “http://example.com/wp-content/uploads”, respectively. HOWEVER, you can update them until you are blue in the face, but you will never successfully upload to the directory you update to. This is because WP overwrites these custom upload paths with the default upload paths mentioned above. This is done on the last line of wp-includes/ms-settings.php. As @Andrea Rennick points out on wordpress.org, this was done to protect ourselves from…ourselves by hosing things up in a multisite environment. On that same WP thread, @cooliojones proposed the fix of commenting out the last line in wp-includes/ms-settings.php, which is ms_upload_constants();.
YES, it’s a core hack, and NO it’s not the ideal solution, but I’m plowing forward with it anyway because I don’t want my project to die while I throw on my One Love cape and try to solve all the BP/WP integration problems of the world. I guess you have to ask yourself which is more important to you: common avatars across sites OR maintaining separate upload directories across sites?
Hope that helps.
As a last second, chuck it into the end zone and pray…Since I only need group/avatars to display across the multisites, I’m thinking it would be ideal if there way some way to define separate upload paths for group/avatars from all other uploads. Anyone have the golden ticket for that?
As of writing this, my understanding of the avatar-loading-code-in-question (bp_core_avatars.php) is:
IF in a multisite environment AND current blog is not the root blog THEN grab the upload path from the root blog and store it in the global bp_core_avatar_url variable.
If coding isn’t your thing (like it isn’t mine), the main thing you should take away from this is that you have to define your root blog. This is where I was failing. To set root blog, add
define( 'BP_ROOT_BLOG', 1 );
to wp-config. 1 is the ID of the domain that you installed buddypress on. To find that ID, navigate to My Sites–>Network Admin–>Sites, then hover over the domain URL that you installed buddypress on and look at the URL path in the bottom left of your screen. The end of the path will look something like …/site-info.php?id=1.Give that a go and see what happens. If you’re still SOL, right click on the broken avatar and click “Copy Image URL” and include that URL in your reply back to this thread.
Thanks, Just r-a-y. Very much appreciate you taking the time.
I had a chance to delve a bit deeper and found that this functionality has been requested quite a bit in the BP forums and elsewhere around the web. Sounds like there is hope that this functionality will be built into the BP core at some point. Any confirmation on that from BP brass?
Before I go down the path of training together a bunch of plugins, I was hoping someone could answer a few questions about a single BP network, installed on the mother site and spread across the WPMU:
1. Is it possible to pick and choose what BP data is displayed? Display the whole shebang on the mother site, but only display the Real Estate Investing related data (group/forums) on RealEstateInvesting.com? Save for the network-wide activity stream on the child site, of course.
2. Is there such a thing as subgroups and/or subforums (ability to create forums that only relate to the Real Estate Investing groups, mayhaps?)? I’ve seen outdated forum posts that this functionality isn’t available, but that it’s being worked on as a future release (https://buddypress.org/community/groups/creating-extending/forum/topic/bbpress-and-subforums/ is one example).If both 1 and 2 were possible, I think this would *mostly* eliminate my need to have multiple BP networks.
I apologize that I don’t know the base table/relationship structure of BP. I hope to take a look at that soon, as that knowledge may eliminate some of my questions.