Okay
  Public Ticket #923589
Null in row_id_value of action wpdatatables_after_frontent_edit_row
Closed

Comments

  •  2
    lennartwittmann started the conversation

    Hi,

    I added this action to my function.php:

    add_action( 'wpdatatables_after_frontent_edit_row', 'authorizeStakeholder' );
    function authorizeStakeholder( $formdata, $row_id_value, $table_id ) {

         print_r($formdata, true);
         print_r($row_id_value, true);
         print_r($table_id);

    }

    I can see the edited data in $formdata array but the fields $row_id_value, $table_id are empty (or null), although, the row appropriate row on the mySQL table has been updated successfully.

    Can you help me on how I can find out the row id which was updated?

    Some facts:
    wpDataTable version: 1.7
    database: mySQL (another then WPs database)

    Best regards and thank you very much!
    Lennart




  • [deleted] replied

    Hi lennartwittmann,
    Thank you for your purchase

    You forgot to add priority and accepted_args in add_action.

    https://developer.wordpress.org/reference/functions/add_action/

    add_action( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )

    You can try with this:

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


  •  2
    lennartwittmann replied

    Thanks Milos!!!

    But after I did this, the value row_id_value is always 0, no matter which row gets updated. 

    Do you have a solution for this one, too?

  • [deleted] replied

    Hi lennartwittmann,

    I have tried your function and I didn't get 0 for row_id and table_id. Are you sure you got 0 always?

  •  2
    lennartwittmann replied

    Hi Milos,

    sadly I am always getting 0. It is exactly like what is described here: http://wpdatatables.com/ticket/wpdatatables_after_frontent_edit_row-is-always-passing-in-0-for-row_id_value/

    But this bug should have been fixed already as it concerned version 1.6

    The table update was successful so the software know the appropriate row id when updating but it doesn't deliver it to the action. 

    add_action( 'wpdatatables_after_frontent_edit_row', 'authorizeStakeholder', 10, 3 );
    function authorizeStakeholder( $formdata, $row_id_value, $table_id ) {

         print_r($table_id, true)); // returns 1, I don't know what 1 means in this case? The mySQL table number ...?
         print_r($row_id_value, true)); // always returns 0 no matter which row gets updated

    }

    I attached the version of wdt_ajax_actions.php which I am using (nothing altered, it is the original version). Maybe this isn't the most recent version or it differs from the version you are testing with?!


  • [deleted] replied

    Hi lennartwittmann,

    What version of the plugin are you using?

    Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials just check PRIVATE so nobody can see it except us.

  •   lennartwittmann replied privately
  • [deleted] replied

    Hi lennartwittmann,

    Did you change any plugin core files or added any function to functions.php because adding new row is not working for me?

  •  2
    lennartwittmann replied

    No, didn't change anything. It is a fresh installation. Maybe I am not querying all fields in the select statement so inserting won't work? You can change anything you like, it is not productive yet and I can build a new table if necessary.

  •  2
    lennartwittmann replied

    Hi Milos,

    I just reinstalled the plugin completely from a fresh download from Envato. Thats why your test table is gone. Nothing changed for the value of row_id_value, though, it is still always 0   ;(

    Have you looked at the code piece of wdt_ajax_actions.php I have sent you? Where the id_val variable should get filled with the right value in line 262?

    Thanks for helping me again!

  •   [deleted] replied privately
  •   lennartwittmann replied privately
  • [deleted] replied

    Hi lennartwittmann,

    Thank you for reporting this issue. I have fixed it on your website and it will be fixed in next version of the plugin.

    $id_val will be 0 when you are adding new row, and when you editing existing row it will be ID of edited row.

  •  2
    lennartwittmann replied

    Thank you very much Milos for investing that much time into my problem!

    Its working now!

    Thanks again very much!


  • [deleted] replied

    Hi Lennart,

    You are welcome. We'd greatly appreciate it if you could take a minute and leave a review on CodeCanyon on this link. Thanks!