Okay
  Public Ticket #2197758
Changing table field after frontend editing
Closed

Comments

  • Caroline started the conversation

    Hi,

    we have a table within our customer portal, where customers can create new rows in.

    One of the fields within the table is "status" (not visible in frontend) that can have numeric values of 0-9. These values are used for external scripts that query the database on a scheduled base.

    Now, we have two questions:

    • In case, the customer creates a new row in the table, we’d like to programmatically set the value of “status” to “1”.
    • In case, the customer edits an existing row, we’d like to programmatically set the value of “status” to “2”.

    We tried the first part with the following code but with no success:

     

    add_action( 'wpdatatables_after_frontent_edit_row','CKI_edit_passenger', 10, 3);

    function CKI_edit_passenger($formdata, $rowId, $tableId) {

                  if ($rowId = null) {

                                $formdata['status'] = 1;

                  }

    }

  •  2,572
    Aleksandar replied

    Hello Caroline.

    I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.

    You can set the predefined value for a column to be "1", but there's no way of letting the plugin know to change it to "2" when someone edits the row. Not with the built-in features, that is. I see that you already checked our hooks, and that's the correct way to go. Unfortunately something like this would fall under customization of the plugin, and there's nothing I can do to help here.

    It probably can be done with some custom work, but our developers are very busy at the moment, working on some priority tasks and fixing bugs and issues with our plugins, so they won't be having the time for custom work in near future.

    But we can recommend these services for customization:

    https://codeable.io/?ref=l1TW1

    https://wpkraken.io/?tms-plugins

    They do develop such solutions, so can you please send your inquiry to them?

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables