8 – Pre-select a checkbox from an exposed filter

I have a view that lists blog articles. The blog content type has a taxonomy reference field to the ‘tags’ vocabulary, authors can select 1 or multiple tags. The view exposes the ‘Has taxonomy terms (with depth) (exposed)’ filter (as a list of checkboxes) so that users can search for blog articles containing 1 or more tags.

Now, i’m trying to pre-select 1 of the checkboxes that are exposed to the user in the hook_form_FORM_ID_alter() hook. It should be a simple as the code below but it just doesn’t work. The tag i’m trying to pre-select has the ID 288.

What am i doing wrong?

function xtheme_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form('#id') == 'views-exposed-form-vcon-finder-page-1') {
    $form('tags')('#default_value') = (288 => 288);
  }
}

theming – hook_form_FORM_ID_alter: Pre select a checkbox from an exposed filter in a drupal 8 view

I have a view that lists blog articles. The blog content type has a taxonomy reference field to the ‘tags’ vocabulary, authors can select 1 or multiple tags. The view exposes the ‘Has taxonomy terms (with depth) (exposed)’ filter (as a list of checkboxes) so that users can search for blog articles containing 1 or more tags.

Now, i’m trying to pre-select 1 of the checkboxes that are exposed to the user in the hook_form_FORM_ID_alter() hook. It should be a simple as the code below but it just doesn’t work. The tag i’m trying to pre-select has the ID 288.

What am i doing wrong? Thx…

function xtheme_form_views_exposed_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id)
{

    if($form('#id') == 'views-exposed-form-vcon-finder-page-1'){
        $form('tags')('#default_value') = (288 => 288);
    }

}

databases – How to protect PII data from being sold or exposed by employees

For PII, we capture mostly emails, mobile and name of users who signup on our website. Along with this purchases made by users are also a sensitive data. Protecting this data for users privacy is as important as not letting any disgruntled employee from selling this data to our competitors.

This data is stored in MySQL database, and some of employees in Tech department need Read Only access to this production database. Some of the reasons why they need it are:

  • Debugging a issue that is happening with a specific user and non reproducible in local environment
  • Creating one time reports by writing complex MySQL queries
  • Dumping email address or mobile for uploading in a third party communication platform like Twilio for sending a broadcast Email or SMS to users
  • Dumping users data for cleaning and analytics purpose in excel sheets
  • For debugging some high priority issue happening in production environment

While doing these activities, it’s likely that some dump of data may reside in the local computer system, emails etc. And it can be leaked accidentally or deliberately by an employee. We can’t encrypt this data, because various departments in organization need access to it for completing their job effectively.

What are the ways by which we can ensure data safety by taking any technical measures (NDA and legal agreements with employee are already in place)

maintenance – Camera once exposed to high temperature

maintenance – Camera once exposed to high temperature – Photography Stack Exchange

How to make a View only show it results if the last of multiple exposed filters has a value selected?

I have a View with three exposed filters. We do not want to show any results until the user has selected a value for the last filter. Is this possible?

enter image description here

8 – How to get a view result programmatically without exposed filters respected

I have some views of display page which I do not want to show to public if there would not be any result when accessed without any exposed filters set. I have a custom views access plugin and a custom access checking class which can handle the access granting.

My idea so far is that I would like to run the view a first time during access checking without exposed filters. In this way I could find out if the view would ever deliver any results. I tried it in the following way:

  $view = Views::getView($view_id);
  $view->setDisplay($display_id);
  $view->setArguments(($politician_id));
  $view->execute();
  $result = $view->total_rows;

The problem is: as soon as an user comes to this page with query parameters in the url set by exposed filters these exposed filters are used for this view query as well. I did not find any way to tell the class in $view to execute without exposed filters. I even tried to set these exposed filters data in the following ways but even then the filter data in the query parameters is still used to filter the result set:

  $view = Views::getView($view_id);
  $view->setDisplay($display_id);
  $view->setArguments(($politician_id));
  $view->initDisplay();
  $view->initHandlers();
  $view->setExposedInput(());
  $view->exposed_data = ();
  $view->exposed_raw_input = ();
  $view->execute();
  $result = $view->total_rows;

I want to achieve that in this way because I want to use this logic for several views. It would be so smart to simply re-use the arguments and filters set in the views instead of hardcoding a new custom database query as the settings in the views might change. I hope someone can help me.

DigitalOcean Customer Billing Data Exposed in Security Breach

DigitalOcean (DOCN) acknowledged today that it has informed some customers that DO had “confirmed an unauthorized exposure of details associated with the billing profile on your DigitalOcean account.”  The breach apparently affected less than 1% of the company’s users.

DO has since fixed the security flaw that lead to this unauthorized access, which happened between April 9 and April 22.  A copy of the email to customers is available on Twitter.

The information leaked includes

  • Billing names
  • Billing addresses
  • Last four of payment card
  • Payment card expiry date
  • Name of the issuing back
  • Number of servers (droplets in DO parlance) the customer uses
  • User’s bandwidth usage
  • Support notes
  • Total invoices for 2018

Passwords and access credentials were not leaked.

The root cause was an internal document which was accidentally made available online.

DigitalOcean went public in March 2021.

raindog308

I’m Andrew, techno polymath and long-time LowEndTalk community Moderator. My technical interests include all things Unix, perl, python, shell scripting, and relational database systems. I enjoy writing technical articles here on LowEndBox to help people get more out of their VPSes.

8 – View with exposed filters expects search_index table to exist, but there is no such table

I have a view with exposed filters. I am pretty sure it used to work, but now when I submit the form, I see this error…

SQLSTATE(42S02): Base table or view not found: 1146 Table 'my_database.search_index' doesn't exist

Sure enough, there is no such table in the database. Why might this table be missing? What module ordinarily supplies this table?

The site’s main search engine uses the facets module, and apparently does not depend on any search_index table. I am not sure if there is something I can do to trigger creation of a search_index table, or why it disappeared (if it ever existed).

7 – I’ve altered the Views exposed filters how I want them in hook_views_pre_build(). How do I retain those settings after an AJAX filter is used?

In Drupal 7, I have a content type that displays a content view within it. This view display contains 4 exposed filters. On the content type, I have a custom select field which allows the author to choose which exposed filters they want to hide on the embedded view.

I then take these selections from the node. Using hook_views_pre_build(), I’m able to hide (by unsetting) any filter they don’t want. It works great upon initial load of the page.

However, the exposed filters use AJAX. When a visitor uses one of the exposed filters and the view loads the filtered display, it no longer respects my hook_views_pre_build() settings. Any filter I hid in that hook are now exposed again in the AJAX-generated views display.

Which hook (or combination of hooks) can I use to hide filters not only in the initial page load, but also when an AJAX filter is used/loaded and the view refreshes?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123