Forums / Setup & design / Help : Private comments implementation

Help : Private comments implementation

Author Message

Roberto Frascarelli

Friday 28 January 2005 1:29:48 am

I extended the default Comment content class adding a checkbox "private" so that, if checked, only admin and owner of that comment can see it.
I fastly made working visualization changes in templates, but now I have the problem that if one user that can't see a private comment searches for words appearing in the same comment contents, the search matches.
I need Comments contents be searchable but I want to inhibit search matches of
content in comments that a user can't see.
Any suggestions ?
Do I have to leave my first simple solution and loose my head into workflow customization?

Roberto Frascarelli

Friday 28 January 2005 6:19:08 am

I found a simple but not elegant solution overriding visualization
of search result template, filtering results:

{let $filtered_search_result=array()}
...
{section loop=$search_result}
  {section show=or( 
    ne($:item.class_identifier,'extcomment'),
    $:item.data_map.private.content|not())}
      
       {set filtered_search_result = $filtered_search_result|append($:item)}
  {/section}
{/section}
{set search_result=$filtered_search_result}
{set search_count=$filtered_search_result|count}
...
{/let}