Hi,
Can anybody help me to add OP username as <body>
CSS class?
I need to write some styles and need different attributes for some usernames.
Some users asked us to delete the topic from their profile but did not insist on deleting it completely. That’s why we created an anonymous user to change the ownership of the requested topics.
Now we need to make changes to the page elements if the OP is anonymous. Including hiding quotes and mentions and etc.
<script type="text/discourse-plugin" version="0.8">
api.onPageChange((url, title) => {
if (/^\/\t\/.*$/.test(url)) {
const opUser = API.????? <--------------------------- How to Get OP user object
if (opUser && opUser.id === 1234) {
document.querySelector("body").classList.add("anon");
}
} else {
document.querySelector("body").classList.remove("anon");
}
});
</script>