WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Advertising Manager] JS added to admin pages of other plugins (2 posts)

  1. kirilln
    Member
    Posted 4 years ago #

    Hello, I've been approached by a user of my plugin - Tweet Blender - stating that there is an error on the admin setting page: document.getElementById("ed_toolbar") is null

    This error is caused by the following javascript generated by your plugin document.getElementById("ed_toolbar").insertBefore(ed_advman, document.getElementById("ed_spell")); and the error is generated because my admin page does not have an HTML element with id ed_toolbar

    Please do one (or both) of the following:
    1) Modify your JavaScript so it checks for presence of the element with id=ed_toolbar and only then calls insertBefore()

    2) Modify Admin.php on line 28 and instead of blindly adding your javascript to the footer of every admin page check to make sure it's your admin page that's being viewed. Something like this will do:

    if ($_GET['page'] == 'advman-settings' || $_GET['page'] == 'advman-manage' || $_GET['page'] == 'advman-create') {
      add_action('admin_footer', array('Advman_Admin','display_editor'));
    }

    Hope this helps. Please patch your code so our plugins play nice together.

    http://wordpress.org/extend/plugins/advertising-manager/

  2. switzer
    Member
    Posted 4 years ago #

    kirilln: thanks for the catch. This will be included in the next version 3.4.17.

    Cheers,
    Scott

Topic Closed

This topic has been closed to new replies.

About this Topic