Skip to content

How can I save the username of the user who modifies the row during edit?

This is a common use case. 

Scenario 1:


If username is in the same table, please see the following KB

Scenario 2:


When username needs to be stored in a separate table, please see the followings:
Basically it would need to use event handler to submit additional data, such as session id or username, when submit changes. 

Here's a sample code: 

//code to save modified_user
$beforeSubmit = <<<BEFORESUBMIT
    function (event, status, postData){
        postData.user = ‘$current_username';
    }
BEFORESUBMIT;
$dg->add_event("jqGridAddEditClickSubmit", $beforeSubmit);

You must change ‘user' to the name of the field in your database where you want to store user.


Feedback and Knowledge Base