Forum Discussion

leeclemmer's avatar
2 months ago
Solved

How to retrieve "Internal reason for ban" field

Hi all, 

We are looking to extract some data from the "User bans" report in the (Classic) Community Admin interface, under "Mod Tools" > "User bans". When we go click on "Edit" on a particular user, we see the field "Internal Reason for ban;" how can we get a full list of banned users including the reason for ban? Is that field available via API somehow? I wasn't able to find anything. 

Thanks for any help, 

Lee 

  • I don't think that there's an API that will return you all the banned users, only the ban details for a specific user. 

    When you query the users, you can grab the "banned" and see if it's true. If it's true, you can use the API v1 to see the details. Something like this:

    <#assign banData = restadmin("/users/id/${item.id}/moderation/banned/details").bans.ban>
    <#list banData as ban>
      Banned by: <a href="/t5/user/viewprofilepage/user-id/${ban.banned_by}" target="_blank">${users.firstNameLastInitial(ban.banned_by)}</a><br>
      Ban reason: <#if ban.banned_reason == "">empty<#else>${ban.banned_reason}</#if><br>
      Public ban reason: <#if ban.public_banned_reason == "">empty<#else>${ban.public_banned_reason}</#if><br>
      Banned on: ${ban.date_start?number?number_to_datetime}<br>
      Banned until: <#if ban.date_end == "-1"><b>forever</b><#else>${ban.date_end?number?number_to_datetime}</#if>
    </#list>

     

2 Replies

  • I don't think that there's an API that will return you all the banned users, only the ban details for a specific user. 

    When you query the users, you can grab the "banned" and see if it's true. If it's true, you can use the API v1 to see the details. Something like this:

    <#assign banData = restadmin("/users/id/${item.id}/moderation/banned/details").bans.ban>
    <#list banData as ban>
      Banned by: <a href="/t5/user/viewprofilepage/user-id/${ban.banned_by}" target="_blank">${users.firstNameLastInitial(ban.banned_by)}</a><br>
      Ban reason: <#if ban.banned_reason == "">empty<#else>${ban.banned_reason}</#if><br>
      Public ban reason: <#if ban.public_banned_reason == "">empty<#else>${ban.public_banned_reason}</#if><br>
      Banned on: ${ban.date_start?number?number_to_datetime}<br>
      Banned until: <#if ban.date_end == "-1"><b>forever</b><#else>${ban.date_end?number?number_to_datetime}</#if>
    </#list>