Add OP username into Body Css Classes

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 && === 1234) {
        } else {

Is there a way we can get topic info via JavaScript API?


Calling api.getCurrentUser() method returns the logged-in user. I’m looking for a method to get topic information (including topic owner).

Oh sorry I misread. :confused:

1 Like

You’re welcome, I think this is more complicated than asking a simple question :+1: :sweat_smile:

To solve my problem, I found the following solution by reading this page:

<script type="text/discourse-plugin" version="0.8">
    const specialTopicUserId = 1000;
    api.decorateTopicTitle((topicModel, node, topicTitleType) => {
        if (topicModel && topicModel.user_id === specialTopicUserId) {