⚠ 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

ask unset delete or exception delete only admin



Dennis Khaizar

Dennis Khaizar
  • profile picture
  • Member

Posted 29 November 2016 - 11:03 AM

Hi guys

 

i want to ask something about function unset delete

 

how iam supposed to do unset delete only admin or make exception delete for admin?

 

thank you very much and sorry for my bad english


semsik

semsik
  • profile picture
  • Member

Posted 03 December 2016 - 14:05 PM

Normally you would have some user information in session.

 

Get the status  (Admin/operator) of the current logged in user form the database with a database call.

 

then in your crud unset delete when not Admin

This will unset delete for all records for logged in users who are not Admin

//Retrieve status of user from db -> and store it in $user_status
//when not Admin in $user_status -> unset delete

if($user_status!='Admin'){
    $crud->unset_delete();
}



if the above doesn't make any sense read the manual of codeigniter

specifically session class and query builder class.


Dennis Khaizar

Dennis Khaizar
  • profile picture
  • Member

Posted 12 January 2017 - 08:43 AM

Normally you would have some user information in session.

 

Get the status  (Admin/operator) of the current logged in user form the database with a database call.

 

then in your crud unset delete when not Admin

This will unset delete for all records for logged in users who are not Admin

//Retrieve status of user from db -> and store it in $user_status
//when not Admin in $user_status -> unset delete

if($user_status!='Admin'){
    $crud->unset_delete();
}



if the above doesn't make any sense read the manual of codeigniter

specifically session class and query builder class.

thank you very much,  that really helpful