Why user->activate() and deactivate() return null ? #1035
Replies: 6 comments 13 replies
-
See https://codeigniter4.github.io/CodeIgniter4/outgoing/response.html#id9 |
Beta Was this translation helpful? Give feedback.
-
HI , deactivate set deleted_at not active to 0 ,Why? And last_active when is set ? |
Beta Was this translation helpful? Give feedback.
-
public function disattivaUser($id)
{
// Get the User Provider (UserModel by default)
$users_model = auth()->getProvider();
// To get the complete user object with ID, we need to get from the database
$user = $users_model->findById($id);
$res=$user->deactivate();
if($user->isNotActivated()){
session()->setFlashdata('gestisciRecordOK', 'Utente correttamente disattivato');
return redirect()->to('/admin_Users/lista_completa/');
}else{
session()->setFlashdata('gestisciRecordBad', 'Problemi disattivazione Record');
return redirect()->to('/admin_Users/lista_completa/');
}
} active is set to 1 deleted at is set |
Beta Was this translation helpful? Give feedback.
-
```console
+----+-------------+---------+-----------+------------+--------+----------------+--------+-------------+----------------+--------------------+--------------------+------------+
| id | username | nome | cognome | telefono | status | status_message | active | last_active | id_colori_html | created_at | updated_at | deleted_at |
+----+-------------+---------+-----------+------------+--------+----------------+--------+-------------+----------------+--------------------+--------------------+------------+
| 9 | pippuccio76 | xxx | xxx | 3495470197 | | | 1 | | 1 | 2024-01-02 12:0... | 2024-02-17 16:2... | |
| 12 | | pippo | pippo | 34345565 | | | 1 | | 1 | 2024-02-15 18:3... | 2024-02-17 16:1... | |
| 24 | | pluto | pluto | 333333333 | | | 1 | | 1 | 2024-02-16 01:2... | 2024-02-17 16:4... | |
+----+-------------+---------+-----------+------------+--------+----------------+--------+-------------+----------------+--------------------+--------------------+------------+
```
Il domenica 18 febbraio 2024 alle ore 00:59:00 CET, kenjis ***@***.***> ha scritto:
I don't get what you say.
Can you run the following command and show the output?
$ php spark db:table users
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sorry my mistake in route i call another function but $user->deactivate();
if($user->isNotActivated()){ return false , why ? |
Beta Was this translation helpful? Give feedback.
-
This is my function : public function disattivaUser($id)
{
// Get the User Provider (UserModel by default)
$users_model = auth()->getProvider();
// To get the complete user object with ID, we need to get from the database
$user = $users_model->findById($id);
$user->deactivate();
$user = $users_model->findById($id);
if($user->isNotActivated()){
session()->setFlashdata('gestisciRecordOK', 'Utente correttamente disattivato');
return redirect()->to('/admin_Users/lista_completa/');
}else{
session()->setFlashdata('gestisciRecordBad', 'Problemi disattivazione Record');
return redirect()->to('/admin_Users/lista_completa/');
}
} In db active become 0 but i go into else ... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HI , i want show message when a user is activated or deactivated but the functions return null . how can i modify to return true or false ?
this is my code :
Beta Was this translation helpful? Give feedback.
All reactions