billerickson / Gallery-Metabox

Displays all the post's attached images on the Edit screen.
33 stars 12 forks source link

Thickbox not loading on MS subsites if 'editor' field isn't supported in CPT #3

Closed krogsgard closed 11 years ago

krogsgard commented 11 years ago

Hey Bill,

My coworker ran across a bug where in Multisite - if the site is a subsite, and the Gallery Metabox plugin is hooked up to a CPT that does not support the "editor" field, thickbox will not load when you click the "upload images" button. Apparently, it works in the main site, or if the editor is supported in the CPT.

I have replicated her issue on my personal site w/ a subsite that doesn't have any other plugins installed.

Not sure if this is something known, but I think maybe a check for if editor is supported and subsequent loading of thickbox scripts and styles could resolve the issue. As to why it works on the main site... no idea : )

All of this is on WP 3.4.2, latest Gallery Metabox version, Multisite using subdomains.

Let me know if I can help further!

-brian

billerickson commented 11 years ago

Thanks for finding the issue! I haven't seen this, but I don't work on Multisite installations.

I'll try to get a patch for it soon, but it might take a little while to set up a dev environment (local dev doesn't support Multisite bc of port numbers, localhost:8888; and my dev server isn't configured for multisite so might need to check with my sysadmin to set it up)

If you or your coworker can write a patch I can get this updated much quicker. Without looking into core, my guess is we'll just add something like this after line 45:

if( ! post_type_supports( $post_type, 'editor' ) ) {
    wp_enqueue_script( 'thickbox' );
    wp_enqueue_style( 'thickbox' );
}
krogsgard commented 11 years ago

That was exactly the fix : )

I probably should've gone ahead and done the same... No issues w/ that fix, Bill. Thanks for the speedy reply! I can probably do a pull request later on if you need me to, but I figure there's no need since that's the exact code and you've got your repository set up already : )

-brian