Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Embargo/Expiry module and site search results


Reply


2 Posts   906 Views

Avatar
Bert

Community Member, 19 Posts

22 April 2010 at 5:00am

Is it possible to remove pages that should not be shown (defined by the Embargo/Expiry module) from the site search results? I tried the following, but I am still getting pages that should not be shown:

function results($data, $form)
{
   $results = $form->getResults();
   
   foreach ($results as $result)
   {
      if ($result->Embargo != NULL && $result->Embargo < strftime('now'))
      {
         $results->remove($result);
      }
      
      if ($result->Expiry != NULL && $result->Expiry >= strftime('now'))
      {
         $results->remove($result);
      }
   }

   $data = array(
      'Results' => $results,
      'Query' => $form->getSearchQuery(),
      'Title' => 'Search Results'
   );

   return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}

Avatar
Bert

Community Member, 19 Posts

12 May 2010 at 8:58pm

No one knows how I can use extra fields in the site search? The Embargo and Expiry fields seem to be accessible, but they are returned empty.