Howdy! By default the plugin only supports saving to a single table. If all the columns you need to update are on a single table of your multitable query, you can use noedit_columns to prevent it from send certain columns to the database.
EX: SELECT A.id, A.a, A.b, A.c, B.d FROM A JOIN B ON A.id = B.aid
noedit_columns=”d”
Will prevent the B columns from being sent as part of the update.
If you need to update data from multiple tables you will have to write custom form save hooks. There should be both reasonable documentation and examples in the examples dir for setting up custom save hooks. Custom save hooks will allow you to send 2 updates (one to each table).
Thread Starter
jtomte
(@jtomte)
Thanks for swift reply!
[SOLVED]
noedit_columns worked like a charm!
Fortunately I dont need to update those two joined columns. It is only for readability. Meaningful text instead of foreign key indexes.
Here’s what I did:
I have two joined columns, each from separate tables, that needs to be protected from editing.
$noedits = array('join_table_1', 'join_table_2');
add_db_table_editor(
array(
'title' => 'h1_title',
'id' => '1',
'editcap' => 'manage_options',
'id_column' => 'id',
'table' => 'table_name',
'cap' => 'manage_options',
'noedit_columns' => $noedits,
'sql' => $join_sql)
);
Again, thanks for a great plugin! Saves me a lot of work 🙂
-
This reply was modified 9 years, 2 months ago by
jtomte.
-
This reply was modified 9 years, 2 months ago by
jtomte.
-
This reply was modified 9 years, 2 months ago by
jtomte.
Wonderful, glad you could get it working!