@michaelpersch
You can try this code snippet
um_fetch_user( $sender_id );
UM()->user()->deactivate();
Plugin Support
Yurii
(@yuriinalivaiko)
Hello @michaelpersch
There is no function um_update_profile in the Ultimate Member plugin. Please don’t call functions that do not exist.
There is a method to change the user status programmatically:
// Change user status.
um_fetch_user( $user_id );
UM()->user()->set_status( $status );
But we don’t recommend using this method directly. Use methods to set a specific status:
// Set the "Approved" status.
UM()->user()->approve();
// Set the "Inactive" status.
UM()->user()->deactivate();
// Set the "Waiting e-mail confirmation" status.
UM()->user()->email_pending();
// Set the "Pending review" status.
UM()->user()->pending();
// Set the "Rejected" status.
UM()->user()->reject();
So, the code to set the “Inactive” status is like @missveronicatv suggested:
// Set the "Inactive" status.
um_fetch_user( $user_id );
UM()->user()->deactivate();
Regards
Thank you this worked great.
Yesterday I tried the method you didn’t suggest.
// Change user status.
um_fetch_user( $user_id );
UM()->user()->set_status( $status );
It disabled my own user instead of the one from the $user_id, that was very strange^^