You dont need the action and function at all, the add_db_table_editor call directly is fine (though I think this should work as well and seems to be).
If you have the ability, please try enabling the js debugger and wordpress debugging and see if there is any more information about javascript errors, or error messages in the response to the save ajax call
Looking at the code it seems that $DBTE_CURRENT is not getting set.
What makes you say that? $DBTE_CURRENT is usually being set correctly if its possible to see the table at all (though there is a possibility of something fouled in the ajax save handler).
Hopefully we can find the error and get it fixed. I assume this is through the standard admin interface?
Hello Bobby,
Thanks for the quick reply. I really like the plugin and it will work really well with my user group. I know it is just something simple that I am doing wrong.
Here is the error that I am getting.
Notice: wp_enqueue_script was called incorrectly. Scripts and styles should
not be registered or enqueued until the wp_enqueue_scripts,
admin_enqueue_scripts, or login_enqueue_scripts hooks.
In the source code for export I put a echo $DBTE_CURRENT which printed out an empty string.
Once again thanks for the help.
I will look into this notice, but i dont believe it is related (notices usually do not prevent things from running).
Is it not exporting either? I only ask because all of these things have worked consistently and exporting vs saving are two different code paths which would imply some bug that affects everything but initial rendering (which is pretty weird in itself).
dbte_export_csv has a local variable $cur which whould be equal to the global variable $DBTE_CURRENT. If you didnt declare $DBTE_CURRENT global, it would correctly be a different, uninitialized local variable (not sure you skill level, so apologies if I am telling you things you know).
print_r($cur);
On line 440 of db-table-editor.php should print the current table during export (it will show up in the export csv probably).
Are you getting any javascript errors when clicking save, or export? (f12 in most browsers will bring up the JS console).
Sorry I should have been more explicit. Yes it was $cur that I tried to print out. Here is the code
$cur = dbte_current(@$_REQUEST['table']);
print_r($cur);
I have two rows in the table but all it prints out is a 0 when I do an export.
Although I am a developer not sure how to see if there is a javascript error in a chrome browser. I have opened the developer tool but don’t see any errors.
Once again thanks for the help.
I found the problem. When I installed in a fresh installation everything worked well. Sorry about that and thanks for all your help.
Awesome, I am glad you have resolved the issue 🙂