# Manter a exclusão de usuários sincronizada com o SSO

**URL:** <https://meta.discourse.org/t/keeping-user-deletion-in-sync-with-sso/96233>\
**Category:** WordPress\
**Created:** [3 Setembro , 2018 01:48 UTC](https://meta.discourse.org/t/keeping-user-deletion-in-sync-with-sso/96233 "2018-09-03T01:48:15Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)\
**Post date:** [4 Setembro , 2018 16:53 UTC](https://meta.discourse.org/t/keeping-user-deletion-in-sync-with-sso/96233/8 "2018-09-04T16:53:05Z")

</div>

I’m pretty sure you can use the API to mark someone in Discourse as **inactive** kinda like the pseudo-code below.

```
	if ( $wordpress_membership_status == 'inactive' )
		$url = $url_base.'admin/users/'.$discourse_userid.'/deactivate.json?'.$api_auth;
	else if ( $wordpress_membership_status == 'active' )
		$url = $url_base.'admin/users/'.$discourse_userid.'/activate.json?'.$api_auth;
	$ch=curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
	$response = curl_exec($ch);	

```

Disclaimer: There’s probably (usually) is a better way to do things than the way I do them! 😃 But perhaps this is helpful.

We have code in place such as the above but I haven’t checked lately if it’s still working.

---

_[View the full topic](https://meta.discourse.org/t/keeping-user-deletion-in-sync-with-sso/96233)._
