7 – How do I hide static media file URLs?

I have developed a website in Drupal 7. Right now I have a requirement: A page should display a PDF file (already generated). Only authenticated users should have access to view or download this file, but anyone with direct access to this static file link can view it and download it.

Is there any method I can use to prevent this and redirect them to the login page? What kind of logical programming needs to be applied in this case?

accessibility – Does animated arrow on link hover violate WCAG 2.2.2 Pause, Stop, Hide?

The part of the animation that starts automatically lasts less than 5 seconds. The part that runs indefinitely is controlled by the user (can be stopped by not hovering). It appears to meet the criteria.

The animation is cool, but is it enhancing the usability of the element? Beyond the WCAG guidelines, it’s important to look at whether an animation might be distracting, which could be an obstacle for users with attention-related disabilities. You might consider a Reduced Motion alternative option for users who prefer it.

cmd.exe – Hide PsExec window when starting from cmd

I’m executing a command as another user on the same machine using PsExec from cmd like this:

PsExec.exe -u myuser -p mypass timeout 4

When I do so, a new cmd window opens and stays open until the command passed to PsExec has completed. How do I prevent this new window from opening or showing?

The closest I got was with the following, but this is still unsatisfactory, as the new window is visible for a few moments before minimizing:

PsExec.exe -u myuser -p mypass cmd.exe /c "start /min timeout 4"

The only other question I found regarding this was starting from PowerShell, but I’m in the standard cmd. I’m on Windows 10, PsExec v2.2.

output formatting – Missing toggle button when hide a subsection of code

enter image description here

I created two subsections and hide the code in both of them. However, the hide toggle button (‘the double arrow’) only appears at one of the subsections. I noticed some differences between these two subsections, which is noted in the above picture in blue. But I am still not sure how to fix it and make the toggle button apear for the first subsection.

accessibility – Does animated arrow on link hover violates WCAG 2.2.2 Pause, Stop, Hide?

The part of the animation that starts automatically lasts less than 5 seconds. The part that runs indefinitely is controlled by the user (can be stopped by not hovering). It appears to meet the criteria.

The animation is cool, but is it enhancing the usability of the element? Beyond the WCAG guidelines, it’s important to look at whether an animation might be distracting, which could be an obstacle for users with attention-related disabilities. You might consider a Reduced Motion alternative option for users who prefer it.

forms – Hide field label with hook_form_alter()

In my case I was trying to hide the label on quantity field provided by Drupal Commerce cart module and the following wasn’t working:

$form['my_field']['#title_display'] = 'invisible';

I had to do this inside my hook_form_alter

$form['quantity']['widget'][0]['value']['#title_display'] = 'invisible';

If somebody have an explanation on why the first solution was not working, I’d be glad to learn the difference.

posts – Hide Past Events from Displaying – AIT Themes Events & Events Pro Plugin

I am using AIT Themes City Guide and trying to configure the Events list to make sense. The theme plugin does not age out old events. I assumed this would be the bare minimum a plugin claiming to be an Event manager would offer. However, it seems I have to make this happen myself. Before you suggest it, the theme developer is not likely to be helpful. Despite having a full license, they have no plans to add this simple feature.

So, I would like to code this myself and the code would have universal benefits. Essentially, events in this theme are “formatted posts”. So, writing code to hide past events could be as simple as the code I found on this page:

How can I hide posts that are over 2 years old

Here is the code suggested:

add_action( 'pre_get_posts', 'filter_old_posts' );
function filter_old_posts($query){
    if( !is_admin() && $query->is_main_query()){
         add_filter('posts_where', $callback = function( $where = ''){
             $where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 years')) . "'"; 
             return $where;
         });
         add_filter('getarchives_where', $callback );
    }
}

How can I modify the above to filter out posts older than the current date? How can I filter out just a single category?

Thank you!!

How to hide Azure SSO error message?

I have an SSO integration with a WP site. It is configured to only allow accounts in my directory (on my domain). Whenever an account from a different domain tries to log in, the user is faced with the attached error message. The text is in Swedish, but you get the point.

I don’t want an error page that gives away my Azure application ID etc.

Ideally a customized error message saying “Only users within the organization is allowed, try signing in with a company account” or something, but a standardized stop message will suffice, rather than this technical and revealing message.

Any hints where I can configure that?enter image description here