JoshLewis Posted May 14, 2020 at 07:50 AM Share Posted May 14, 2020 at 07:50 AM Trying to figure out the best way to hide listings based on a select field's value of 'private'. The following successfully sets listings as "Pending Moderation" in listings list view: function list_page_hide_listings($listings, $params) { foreach ($listings as & $listing) { if(!empty($listing['Field']['pairs']['jr_authorized']['value'][0])) { if($listing['Field']['pairs']['jr_private']['value'][0] == 'private') { $listing['Listing']['state'] = 0; $listing['Listing']['access'] = 0; } } return $listings; } Clickfwd\Hook\Filter::add('post_get_listings_listpage_query', 'list_page_hide_listings', 10); I'm aware would have to work out other views as well. Alternatively could create a few overrides for list view, research results, and search module that only shows content if it's not set to 'private' by wrapping it with: if($listing['Field']['pairs']['jr_private']['value'][0] != 'private'): Alex.1 1 Link to comment
n00bster Posted May 14, 2020 at 08:58 AM Share Posted May 14, 2020 at 08:58 AM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Alejandro Posted May 14, 2020 at 10:10 AM Share Posted May 14, 2020 at 10:10 AM This section is only visible with a valid subscription. If you have a valid subscription, please login. JoshLewis 1 Link to comment
Recommended Posts