In response to Issue #148 Wrap cmb.js inside namespace object to prevent conflicts #149

wants to merge 4 commits into


None yet
9 participants

This patch just wraps all the functions in cmb.js inside the CMBMeta object to prevent conflicts with other plugins using similar functions. For instance we were declaring some of our variables in the global namespace and it conflicted with the Woo Themes Media Upload js.

Note: The commit I'm sending this pull request for is dacb6d8.

c3mdigital added some commits Jul 3, 2011

@c3mdigital c3mdigital Adds an audio file metabox with audio player and audio shortcode
Uses audio-player.js to add an audio player to sample the file in the metabox.  Also adds an audio shortcode to add the audio file in the post content.
@c3mdigital c3mdigital Added PhpDoc block
Re formatted all comments into PhpDoc blocks for use with IDE's and
better documentation of code
@c3mdigital c3mdigital clean up and sync 4c6ae1e
@c3mdigital c3mdigital Wraps CMBMeta javascript functions inside the CMBMeta object namespace. dacb6d8

jaredatch commented May 31, 2012

Nice work man, plan on looking through it this weekend :)

cmb.js and Woo's media-upload.js both use WordPress's send_to_editor function, I rewrote the send_to_editor function and included it in the latest commit. I also made a few other minor adjustments. Reversed the if(formfield) conditional to return early instead of late, and changed the live() click functions to delegate(). This also required wrapping the file fields in an extra div so the js can pull out the id attr. of the input button to use in delegate().

c3mdigital referenced this pull request Jun 1, 2012


Patch 3 #151

wycks commented Aug 17, 2012

+1 Just had to use this

for media uploader can't you just change window.original_send_to_editor to something else (prefix it). maybe window.cmb_original_send_to_editor ? i think it will fix this. cause woo use the same name.
( it's in line 83 and line 123 in cmb.js )

Thanks! Just saved me on a project.

THANK YOU for this. Was working with PixelPress Wootheme and had the same issue. Implemented Turtlepod's fix. (lines on this version are are: 88 and 128).

ilokano commented Apr 2, 2013

Thanks to turtlepod for the fix.

Thanks! Spent way too long hunting that one.


jtsternberg commented Nov 29, 2013

If this is still an issue post-1.0.0, feel free to submit another PR against the trunk branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment