• Resolved throwaway111

    (@throwaway111)


    Hi, we’re running the current version of BEAF on WP 6.7.1. I know the Shortcode copied! issue was reported previously and marked as resolved, but the message still leaks out if there is a JS error or PHP notice anywhere in the back end. I’ve seen it on post.php, the Dashboard, the Updates page and on other plugin settings pages.

    It also tends to flash up briefly when post.php is loading.

    I wanted to suggest that if you only use this message on certain WP Admin pages, that perhaps you could use the $pagenow and $typenow globals to exit the function without outputting the div containing this message if the current page does not need it. I’ve had content providers reporting this as a bug. Containing the scope would resolve most instances. I do realize that PHP or JS errors in other plugins leading to this div being exposed are not within your ability to control.

    Thanks so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Joynal Abedin

    (@joynalabedin)

    Hello @throwaway111,

    Thank you for bringing this to our attention.

    I have taken note of your observations and suggestions and have forwarded them to the development team for further review.

    We appreciate your feedback and will work towards addressing this issue.

    Thread Starter throwaway111

    (@throwaway111)

    Thank you!

    Another strategy to consider is adding a style with display: none to the div output and adjusting the JS displaying it to change that attribute to display: block or inline-block when activated. I haven’t dug into the JS to see if it’s feasible in this instance, but I’ve used this approach successfully on projects of my own.

    Plugin Author mdashikul

    (@mdashikul)

    @throwaway111 – I hope you’re doing great! Could you please share more details about the style you’re referring to in JS? Regarding the “Shortcode copied!” message, we’ve already fixed the issue, and it’s currently in the testing stage. The fix will be included in an upcoming release.

    Thank you!

    • This reply was modified 2 months, 3 weeks ago by mdashikul.
    Thread Starter throwaway111

    (@throwaway111)

    Hi! Yes, so right now you have the following line of code:

    echo '<div id="bafg_copy">' . esc_html__( 'Shortcode Copied!', 'bafg' ) . '</div>';

    With a corresponding style in bafg-admin-style.css to hide it. The message is displayed using an onclick function in bafg-script.js.

    Actually, as I look at the function in the JS file, I think it already does what you need it to do with:

    function copyAlert() {
    if (time == 200) {
    clearInterval(id);
    elem.style.display = 'none';
    } else {
    time++;
    elem.style.display = 'block';
    }
    }

    In which case, the only changes you may need to make are:

    echo '<div id="bafg_copy" style="display:none;">' . esc_html__( 'Shortcode Copied!', 'bafg' ) . '</div>';

    and then remove the display: none from the style rules for #bafg_copy in the CSS file because it is redundant.

    I hope that helps!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.