Skip to content
Discussion options

You must be logged in to vote

In case someone finds this later, here is the final solution:

In the controller:

publicfunctionmake_active($id)
{
$user = $this->userModel->withDeleted()->findById($id);
$user->fill(['deleted_at' => null]);
$this->userModel->save($user);
returnredirect()	->to("/admin/users/main")
->with('info', 'User successfully activated.');
}

The custom model:

namespaceApp\Models;
useCodeIgniter\Shield\Models\UserModel;
class Userp42Model extends UserModel
{
protectedfunctioninitialize()
{
$newAllowedFields = [
'fname','lname','user_uid',
'phone_home','phone_cell','phone_ext','phone_desk',
'is_superadmin',
'profile_image',
'calview','homepage',
];
//…

Replies: 4 comments 29 replies

Comment options

You must be logged in to vote
3 replies
@MarcPinnell
Comment options

@datamweb
Comment options

@MarcPinnell
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
26 replies
@datamweb
Comment options

@paulbalandan
Comment options

@kenjis
Comment options

kenjisOct 20, 2022
Maintainer

@MGatner
Comment options

@MarcPinnell
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected byMarcPinnell
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issueGood for newcomers
5 participants
@MarcPinnell@kenjis@datamweb@MGatner@paulbalandan