⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Edit default Action



hunterbit
  • profile picture
  • Member

Posted 14 November 2011 - 21:35 PM

[color=#333333][font=arial, sans-serif][size=4]if I want to[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]change the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]action "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]EDIT[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]how can I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do?[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]for me[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is very important[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]because[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to edit[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the table[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do not want[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a particular user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]then[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]when a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]user presses[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]on[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I want to check[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user is[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or not.[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]For[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]example,[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is ADMIN[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]can not be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if it is not[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]otherwise[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]come[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]ADMIN[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]deleted[/size][/font][/color]

hunterbit
  • profile picture
  • Member

Posted 26 November 2011 - 23:10 PM

[color=#333333][font=arial, sans-serif][size=4]can anyone[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]help me solve[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]my problem[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]?[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]as I said[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I would[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]change the behavior[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]of the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE method[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4].[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]how can I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do?[/size][/font][/color]

xxaxxo
  • profile picture
  • Member

Posted 04 December 2011 - 09:44 AM

Check out the delete - callbacks, i'm still waiting for a response on one of my questions about them. But if you find an answer - please post it after so that you can help others.

hunterbit
  • profile picture
  • Member

Posted 04 December 2011 - 10:05 AM

I have not found any answers yet but when I resolv problem or I find solution I post it in this forum

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 04 December 2011 - 23:35 PM

[quote name='hunterbit' timestamp='1321306526' post='44']
[color=#333333][font=arial, sans-serif][size=4]if I want to[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]change the[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]action "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]EDIT[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or "[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]"[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]how can I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do?[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]for me[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is very important[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]because[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to edit[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]the table[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]do not want[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]a particular user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]then[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]it is deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]when a[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]user presses[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]DELETE[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]on[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]I want to check[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user is[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]to be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]or not.[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]For[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]example,[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if the user[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]is ADMIN[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]can not be deleted[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]if it is not[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]otherwise[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]come[/size][/font][/color] [color=#333333][font=arial, sans-serif][size=4]ADMIN[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]deleted[/size][/font][/color]
[/quote]
A simple way to do that is to use the add_action method. First of all don't forget to unset_delete() and have your own action control about delete or everything you like to add at actions column. For more you can see an example at: http://www.grocerycr...mple/add_action
You can also check the parameters that add_action method takes at http://www.grocerycrud.com/crud/function_name/add_action

hunterbit
  • profile picture
  • Member

Posted 04 December 2011 - 23:50 PM

Thanks. Tomorrow I try your suggestion.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 07 December 2011 - 19:26 PM

Also perhaps the getState could help you. http://www.grocerycrud.com/crud/function_name/getState

tanver
  • profile picture
  • Member

Posted 10 December 2011 - 19:06 PM

Think you are better advised to use
$crud->callback_escape_delete(array($this, 'escape_delete'));
instead. Then you can something like this

function escape_delete($PKeyValue)
{
//echo 'In Escape Delete';
echo 'The PKey Value is .. '.$PKeyValue;
$this->db->update('users', array('active' => 0,
'last_edit_user' => $this->session->userdata('username'),
'last_edit_date_time' => standard_date('DATE_ISO8601', time()),
'comments' => 'Deleted'), array('id' => $PKeyValue));
return TRUE;
}
in the actual function which will execute instead of the actual DELETE.
hope this helps.