Forum Discussion
Hello heavenerp ,
With JavaScript, able to change the user's language preference using the REST API. Below is the code that demonstrates how to do this:
<script>
const options = {
method: 'PUT',
headers: {accept: 'application/json', 'content-type': 'application/json'},
body: JSON.stringify({
data: {
type: 'user',
personal_data: {
list_item_type: 'personal_datum',
items: [
{type: 'personal_datum', id: 'language', value: 'en'}
]
},
}
})
};
fetch('https://community-domain/api/2.0/users/user-id', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
</script>
Reference Links:
Update user (khoros.com)
GDPR support (khoros.com)
If my response helped you, please give kudo and accept as solution.
Thank you!
Related Content
- 2 months ago
- 10 years ago