Support » Plugins » Plugin not working when moved to new site

  • Resolved jrm213



    I wrote a custom plugin and I created a test wordpress installation to develop it on. I got it working and moved it to my live site. It displays just fine using my custom template files for the pages I needed. But all of the administration functionality I created is not working properly.

    They are on the same version of wordpress so I don’t understand what is going on.

    When I activate the plugin it correctly creates the database tables, makes an administration menu for the plugin under options, and when I click the administration menu it displays the administration screen.

    However, when I try to add new records through the admin interface it fails. I don’t understand what is going wrong.

    It doesn’t throw an error in javascript and my webserver error log is empty. Usually if I have a php error it is listed in the error log. The browser makes the call to admin-ajax.php but has a response of -1.

    I am running the database inserts and deletes through wp_ajax

    in the admin page the submit button is this:
    It works in the test setup, but does not work on my live site. Any help is greatly appreciated, it is driving me up the wall.

Viewing 4 replies - 1 through 4 (of 4 total)
  • It didn’t seem to want to let me post with this in the original so here is the rest of what I wanted to post:

    <input id="add_loc_submit" type="button" onclick="sec_add_new_loc()" value="Add Location" name="add_loc_submit"/>
    in my admin page I have:
    this javascript:
    function sec_add_new_loc()
    var locname = document.getElementById("sec_add_loc").value;
    var mysack = new sack("<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php" );
    mysack.execute = 1;
    mysack.method = 'POST';
    mysack.setVar( "action", "sec_add_new_location" );
    mysack.setVar( "new_loc", locname);
    mysack.onError = function() { alert('Error Contacting Server' )};
    and in the php I have this:
    function sec_save_new_event()
    global $wpdb;
    //query info here

    Also just noticed this, it does throw an error when I click my delete links, but still no error on my submit buttons.

    uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLTableSectionElement.removeChild]"  nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"  location: "JS frame :: :: sec_del_location :: line 155"  data: no]
    Line 0

    Well I am not sure why…

    I replaced the admin-ajax.php page from my live site with the one from my test site and now the plugin works. If they are the same wordpress versions shouldn’t those files have been the same anyway?

    ok I figured out why now, so I will resolve this.

    the ajax_check_referer function was commented out in the one file and not in the other.

    In the plugin tutorial for AJAX I missed that you need to send
    mysack.encVar( "cookie", document.cookie, false );

    with the sack call or it will fail authentication for admin modules.

    so that resolved it for me. Hope this helps someone else out in the future.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin not working when moved to new site’ is closed to new replies.