chekc if user can delete a collection
This commit is contained in:
parent
2f1b9a3815
commit
3fc7bc00ba
|
@ -169,11 +169,14 @@ class Collections extends Repository {
|
|||
* @return mixed|Collection
|
||||
*/
|
||||
public function delete($args){
|
||||
if(!empty($args[1]) && $args[1]['is_permanently'] === true){
|
||||
return new Entities\Collection(wp_delete_post($args[0], $args[1]['is_permanently']));
|
||||
}
|
||||
|
||||
return new Entities\Collection(wp_trash_post($args[0]));
|
||||
if($this->can_delete($args[0])) {
|
||||
if(!empty($args[1]) && $args[1]['is_permanently'] === true){
|
||||
return new Entities\Collection(wp_delete_post($args[0], $args[1]['is_permanently']));
|
||||
}
|
||||
|
||||
return new Entities\Collection(wp_trash_post($args[0]));
|
||||
}
|
||||
throw new \Exception('This user can not delete the entity');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue