Files
pkrstarsbot/client_webapp/code-snippets/hide_mpr_activation_error.php
2021-02-16 23:07:41 +01:00

34 lines
946 B
PHP

<?php
add_action( 'admin_enqueue_scripts', 'my_hide_memberpressactivate' );
function my_hide_memberpressactivate() {
?>
<script>
// START JAVASCRIPT
document.addEventListener("DOMContentLoaded", function(event) {
console.log('executing now');
//wait_for_class('error', 'hide_mbpr_error');
hide_mbpr_error();
});
function hide_mbpr_error() {
if( jQuery('.error').length ) {
if( jQuery('.error')[0].textContent == "MemberPress doesn't have a valid license key installed. Go to the MemberPress activation page to activate your license or go to memberpress.com to get one." ) {
jQuery('.error')[0].outerHTML = '';
}
}
}
function wait_for_class(selector, fnName) {
if (jQuery('.' + selector).length) {
console.log('ready');
window[fnName](selector);
} else {
setTimeout(function() {
wait_for_class(selector, fnName);
}, 100);
}
}
// END JAVASCRIPT
</script>
<?php
}