Hello knowitallninja,
BadgeOS loads two js files on front-end for CKeditor
- Standard CKeditor js file
- Custom js file to call it
Their function is to add valuable formatting options to the user when submitting submission / commenting. See screenshot
Although it is not recommended, you can add below snippet to your active theme’s functions.php file to dequeue it.
function dequeue_ckeditor_front_end() {
if ( is_admin() ) {
return;
}
global $GLOBALS;
$wp_footer = $GLOBALS["wp_filter"]["wp_footer"];
if( is_object( $wp_footer ) && !empty( $wp_footer ) ) {
$new_array = array();
foreach( $wp_footer as $key => $frontend_script ) {
if( $key != 10 ) {
$new_array[$key] = $frontend_script;
}
}
}
$new_data = new WP_Hook;
$new_data->callbacks = $new_array;
$GLOBALS["wp_filter"]["wp_footer"] = $new_data;
$handle = 'custom_script';
$list = 'enqueued';
if ( wp_script_is( $handle, $list ) ) {
wp_dequeue_script( 'custom_script' );
wp_deregister_script( 'custom_script' );
}
$handle = 'ck_editor_cdn';
$list = 'enqueued';
if ( wp_script_is( $handle, $list ) ) {
wp_dequeue_script( 'ck_editor_cdn' );
wp_deregister_script( 'ck_editor_cdn' );
}
}
add_action( 'wp_print_scripts', 'dequeue_ckeditor_front_end', 100 );
When a user submits a badge and uses CKeditor’s features to add formatting, those formats don’t show when I am reviewing badges in the dashbaord – it just shows the HTML code (even if set to the visual editor and not text). They do show if I add a page on the front end to review submissions but I much prefer to review from the back end. Any way to fix this?
Hello @eureka345
Thanks for pointing us to this issue, We are about to release an updated version which will fix this issue.
For now you can add below snippet to your theme’s functions.php file. It will fix the issue for you.
/**
* Fix - HTML escaping issue for badge submission edit page
*/
add_filter( "the_editor_content", function( $data, $postarr ) {
if( is_admin() ) {
global $current_screen;
$post_type = $current_screen->post_type;
if( empty( $post_type ) && is_null( $post_type ) ) {
$post_type = ( isset( $_GET["post_type"] ) ? $_GET["post_type"] : "" );
}
if( $post_type == "submission" ) {
return htmlspecialchars_decode ( $data, ENT_NOQUOTES | ENT_HTML5 );
}
}
return $data;
}, 11, 2);
Awesome – thank you! So excited to see your efforts here to support this plugin.
Hello @eureka345
Glad to hear that. Please add a review here for us and mark the topic as resolved.
Thanks.
Hello @eureka345
We are glad to inform you that we have released a new version 1.4.9 which fixed the html formatting issue on submissions edit page. Please update the plugin and test it.
Changelog for Version 1.4.9
How to update wp plugins?
Please add a review here for us and mark the topic as resolved.
Thanks.