set_events not working after upgrading phpgrid. the fields modifier and modified are not updating now. Can you please help
<?php
// include db config
include_once("../config.php");
if (!$user->checkMembership("1,2,4,6,8,11"))redirect_to("/accessDenied.php");
// include and create object
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
$g = new jqgrid();
// set few params
$grid["caption"] = "Front Sheet 3G";
$grid["shrinkToFit"] = false;
$grid["autowidth"] = true; // expand grid to screen width
//$grid["width"] = "1200";
$grid["multiselect"] = true;
$grid["ignoreCase"] = true; // do case insensitive sorting
$grid["altRows"] = true;
$grid["altclass"] = "myAltRowClass";
$grid["sortname"] = 'id';
$grid["sortorder"] = "desc";
$grid["toolbar"] = "bottom";
// export XLS file
// export to excel parameters
$grid["export"] = array("format"=>"pdf", "filename"=>"my-file", "sheetname"=>"test");
$grid["reloadedit"] = true;
$g->set_options($grid);
$e["on_after_insert"] = array("add_modifier", null, true);
$e["on_after_update"] = array("update_modifier", null, true);
$g->set_events($e);
function update_modifier($data)
{
require("../init.php");
mysqli_query($con,"UPDATE mytable SET Modified= DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s') WHERE id = {$data["id"]}");
mysqli_query($con,"UPDATE mytable SET Modifier= ' " . $user->name . " ' WHERE id = {$data["id"]}");
}
//This is not used as we want users to only submit data using the form
function add_modifier($data)
{
require("../init.php");
mysqli_query($con,"UPDATE mytable SET Submitted= DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s') WHERE id = {$data["id"]}");
mysqli_query($con,"UPDATE mytable SET Submitter= ' " . $user->name . " ' WHERE id = {$data["id"]}");
mysqli_query($con,"UPDATE mytable SET Status= 'New' WHERE id = {$data["id"]}");
}
// you can provide custom SQL query to display data
$g->select_command = "select * from mytable";
// this db table will be used for add,edit,delete
$g->table = "mytable";
//Data for export// Create view with above sql
$_SESSION['selection']= "mytable";
$cols = array();
// you can customize your own columns …
$col = array();
$col["name"] = "id";
$col["dbname"] = "frontSheet4g.id";
$col["title"] = "id";
$col["width"] = "50";
if (editGrid != 'NO'){
$col["editable"] = false;
}
$cols[] = $col;
$col = array();
$col["name"] = "Modifier";
$col["dbname"] = "frontSheet4g.Modifier";
$col["title"] = "Modified By";
$col["editable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "Modified";
$col["dbname"] = "frontSheet4g.Modified";
$col["title"] = "Modified On";
$col["editable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "Submitter";
$col["dbname"] = "frontSheet4g.Submitter";
$col["title"] = "Submitted By";
$col["editable"] = false;
$cols[] = $col;
$col = array();
$col["name"] = "Submitted";
$col["dbname"] = "frontSheet4g.Submitted";
$col["title"] = "Submitted On";
$col["editable"] = false;
$cols[] = $col;
// pass the cooked columns to grid
$g->set_columns($cols);
// generate grid output, with unique grid name as 'list1'
$out = $g->render("list1");
?>
<?php include("../header.php");?>
<div id="wrap" class="top-space">
<div class="screen-95 tablet-90 phone-100 push-center">
<div class="wojo form">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="/grid/lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="/grid/lib/js/jqgrid/css/ui.jqgrid.css"></link>
<script src="/grid/lib/js/jquery.min.js" type="text/javascript"></script>
<script src="/grid/lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="/grid/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="/grid/lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div style="margin:10px">
<?php echo $out?>
<br>
<button onclick='downloadRecord()' class="btn waves-effect waves-light">Download Scripts<i class="material-icons right">file_download</i></button>
<a href="/grid/export.php">
<button class="btn waves-effect waves-light">Download Table<i class="material-icons right">file_download</i></button>
</div>
</body>
</html>
</div>
</div>
</div>
<?php include("../footer.php");?>
Apparently it looks like $con is not defined inside callback function.
You can put phpgrid_error("test"); inside function to see if it is executing.