Open SteelWagstaff opened 6 years ago
Usually, when creating a WP plugin these things get separated automatically for different subsites. Making the libraries into a shared resource requires an extra effort and lots of testing.
We are open to Pull Requests or you can use the contact form on h5p.org to get an offer on the work.
On this issue, I'm trying to work out a way "for now" to get shared libraries. I was trying to either use symlinks or copy the contents of the root site's uploads/h5p/libraries directory into the a new subsite. This doesn't seem to be enough.
I suspect there's some checking in the database to see which libraries are installed per site, rather than checking the filesystem.
Can anyone point me in the direction of a way to force h5p to check the uploads directory for 'manually installed' libraries?
@richardtape Yes, the files are mostly used for media and hosting the code(.js and .css). All the metadata and the actual "content" is stored in the database. To achieve what you want the h5p_libraries
table would have to be shared, i.e. prefixed with {$wpdb->base_prefix}
instead of {$wpdb->prefix}
.
It looks like both the prefix_h5p_libraries
and prefix_h5p_libraries_libraries
tables are required for each site. It sounds like it would be possible to perhaps filter when WP is looking up the data from those tables and map it to the main site's (or whichever) tables. Then either some symlinks for each site for the files, or perhaps routing WordPress's look-up for these files to be the central location.
I think the ideal scenario here is for such code to detect when the plugin is network activated (or even in must-use) and then allow network administrators to decide if each site should have its own or whether there's a central location for the libraries. Naturally, the content and metadata would still remain on a per-site basis.
It appears that since version 1.7.2 we can now network enable H5P on multisite and allow each individual site to create H5P activities and install libraries on/for their own sites (thank you!). However, it doesn't appear that we can centrally manage and maintain the various H5P libraries we use on that multisite.
Here's our use case: we have a single WP multisite instance and want to make H5P available for all of the many sites on our network. We'd prefer to install and update the various H5P libraries for all the sites from a single place, rather than requiring each site admin to download and update their own individual libraries. Is that possible with the way the H5P for Wordpress plugin is currently written?
For example, here's what the H5P hub looks like on one site on our network:
and here's what the hub looks like on another site:
I can understand that some networks will want to keep content types and updates separate, but for those of us who'd like to manage and update these centrally for many sites, what can we do? Even if we couldn't apply updates and install content types centrally for all sites, I don't know of a way right now to even install all available updates for a single site, meaning that updating available libraries is a particularly laborious process.
If neither central management nor bulk updating of content types for single sites is currently possible, can anyone offer me a few pointers as to how it might be achieved to see whether this is something we could look into funding or contributing a pull request for?