Skip to content

Instantly share code, notes, and snippets.

@imath
Created Oct 6, 2015
Embed
What would you like to do?
How to take benefit of #6647
<?php
/**
* Just a quick and dirty example!
*/
function test_attachment_js_actions() {
?>
<script type="text/javascript">
if ( 'undefined' !== typeof window.bp ) {
if ( window.bp.Avatar ) {
bp.Avatar.Attachment.on( 'change:url', function( data ) {
console.log( data.attributes );
} );
}
if ( window.bp.CoverImage ) {
bp.CoverImage.Attachment.on( 'change:url', function( data ) {
console.log( data.attributes );
} );
}
}
</script>
<?php
}
add_action( 'wp_footer', 'test_attachment_js_actions', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment