Forum Discussion

VikasB's avatar
VikasB
Boss
8 years ago

Exclude message from hidden boards in search results

We are trying to exclude messages from boards which have the setting as "Hide message in this board from the list".  But it includes the hidden board's messages in search results. I assume this setti...
  • satya's avatar
    satya
    8 years ago

    Hi VikasB,

     

    There is a partial solution where you can adjust the default see and read permissions for hidden boards to deny. So, that admins can get the results but not normal/regular users. For more info you can just go through this link

     

    Just sharing my thought :)

     

    Thanks,

    Srujana Satya

  • VikasB's avatar
    VikasB
    8 years ago

    Hi satya Thanks. But yes, it partial solution. It would not work when I want to exclude the messages from some specific boards in recent post widget but want to keep those boards accessible to end users. In such cases I do not think so there would be any other option than manually exclude those boards like below. 

    <#assign excIds = ["Id1", "Id2","Id3"] />  //boards ids from which messages need to be excluded
    <#assign msgs= rest( "2.0", "/search?q=" + "select * from messages order by post_time desc"?url).data />
    <#list msgs.items as msg>
    <#if excIds?seq_index_of(msg.board.id)== -1 >
    //do something here
    </#if>
    </#list>