bobbysmith007
Forum Replies Created
-
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Use db table editor in anotherI am confused… What does this accomplish?
Couldn’t your plugin simply hook the init action directly? What would you do differently in a db-table-editor_init action than you would in an init action? I certainly don’t mind adding actions if they are useful, but since this plugin doesn’t actually do anything at init time, I don’t see what a sub action is accomplishing.
Forum: Plugins
In reply to: [WP-DB-Table-Editor] show question number in testUm… I am not sure what you are asking? I don’t know anything about Watu. You will have to either provide more information or work it out on your own. I am happy to provide assistance with wp-db-table-editor, but I need something to go on.
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Capture OLD values before update/deleteIt sounds like you are trying to create a data journal.
* Why not just use the new values? Assuming you are always journaling, the old values will be in the journal?
* You could hookadd_action( 'wp_ajax_dbte_save', 'dbte_save_cb' );
with higher priority than the plugin and then query the database before the change.
* You could submit a patch that adds a “before_save” action, though the plugin never queryies the old values, before saving, so your code would still need to do that (negating much of the benefit the action might provide).
* https://github.com/AccelerationNet/wp-db-table-editorForum: Plugins
In reply to: [WP-DB-Table-Editor] Update problem with update_cb callback functionI just updated the version to 1.3 With the changes you have suggested in place. Thanks for the bug report. In my one case of using the callbacks, I had to recompute the ID anyway, so it was not missed, but it certainly does make sense to pass it.
I think next time I have to change the API of these functions I will change them to using an array of keyword arguments instead so that additive changes to the API are less likely to cause problems.
Added ID to callbacks / actions where it makes sense
* update_cb, delete_cb, dbt_row_updatedForum: Plugins
In reply to: [WP-DB-Table-Editor] Calling a custom function after insert/update/deleteI have added an advanced example which might help you.
Your question implies that this example is a bit overkill, and that maybe I need to add some notification actions as well.
I just released version 1.2.8 which has notification actions in place. From the new readme:
—-
dbte_row_deleted, dbte_row_updated, dbte_row_inserted
Called after a row is deleted, updated, or inserted passes
`
add_action(‘dbte_row_deleted’, ‘my_dbte_row_deleted’, 10, 2);function my_dbte_row_deleted($currentTable, $idRemoved){
// do things
}add_action(‘dbte_row_updated’, ‘my_dbte_row_upserted’, 10, 4);
add_action(‘dbte_row_inserted’, ‘my_dbte_row_upserted’, 10, 4);function my_dbte_row_upserted($currentTable, $values, $columns, $indexedModified){
// do things
}`
Please do let me know if this is not as resolved as I hope
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Editors can't editI am addressing this on github (I like the interface a bit better)
https://github.com/AccelerationNet/wp-db-table-editor/issues/8
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Won't save, edit or delete.Awesome, I am glad you have resolved the issue ??
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Trouble saving to DB using shortcode on protected pageI think that this should be resolved now. Sorry for delaying notification
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Table editor loses NULL valuesThanks for the report, I will try to get this resolved. I think though that then I will be converting empty strings to null (which is better in my mind). Its tricky to get absolutely perfect and probably not needed.
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Variable queries / where clausesOk there are a couple approaches for this.
The first is if you are doing a fairly straightforward filter similar to the filters at the top of the table, you can pass default filters through the query string eg:
https://yoursite.com/wp-admin/admin.php?page=dbte_table&column_name=filter_valueThe other way to handle this is to construct the db-table-editor instance such that the sql passed into your query is already taking into account the filters eg:
$sql="SELECT * FROM mytable"; if(@$_REQUEST['myfilter']){ $sql.=wpdb->prepare(" WHERE mycolumn like %s",@$_REQUEST['myfilter']); } add_db_table_editor(Array('sql'=>$sql, table='mytable'));
Please feel free to ask followups if needed
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Won't save, edit or delete.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).
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Won't save, edit or delete.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?
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Field not savingThis has annoyed me as well, but I have not done the requisite work to find a solution. Presumably on blur of the cell should have a cell submit, but thats not what it currently does. If you do find a solution in the interim, please let me know.
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Hiding ID disables functionality?This is currently the way it works… I think I could change it to actually not render the hidden columns, but that is something I will have to work out. My best suggestion in the mean time is to put that column all the way to the right :/
Forum: Plugins
In reply to: [WP-DB-Table-Editor] Adding multiple tablesI am not sure what you mean, but currently only a single editor can be on the page at a time.
You can have multiple editors configured by calling the
add_db_table_editor
function mulitple times.I hope this answers your question, but if it does not please feel free to reply again