Hi everyone, i need to add a custom action with relative callback. Here's a piece of the code of my controller:
function myFunction() {
..code before
// Setting custom actions.
$crud->add_action('Approva', '', '','ui-icon-image', array($this,'approve_submission'));
.. code after
}
function approve_submission($primary_key, $row) {
// Update authorization.
$data = array('auth' => 1);
$this->db->where('ID', $row->ID);
$this->db->update('segnalazioni', $data);
}
The problem is that all the code enclosed in the "approve_submission" function is executed at every controller load, and not when i click on the new action button (Approva).
It's like if the "add_action" method triggers its callback before any user click.
How could it be possible?
Thank you.
add_action triggers callback on init
Started by Gianni Pinotto, 16 October 2012 - 12:58 PM
- Single Page
Posted 16 October 2012 - 12:58 PM
Posted 17 October 2012 - 09:45 AM
HI! You have a problem because this function use to create a link!