This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Can't filter views according to user roles

I'm developing a Drupal 10 website with the DXPR Builder default theme and have two views that combine Flex Slider with the content events module to display events. My goal is to:

1. Display the first slider for both anonymous users and logged-in users.

2. Display the second slider only for logged-in users who have specific roles (e.g., admin, manager, content creator).

I've attempted to achieve this using Contextual Filters, but I haven't been able to get it to work as expected.

All things Javascript vs jQuery

Hello friends,

This thread may wander a lot, but the original reason for creating this thread today is that I have a .js file with mostly jQuery instructions within it.  This script is supposed to help me re-order a select list on a [Better-Exposed-Filters] form; and, believe it or not, it works!  Except on ONE of my many Drupal 10.3 websites.

[SOLVED] Drush sql-dump results in Error 2013: Lost connection for "key_value" table

I'm getting a new error backing up a site database via Drush. The command I use is:

drush sql-dump --gzip --result-file=/home/my_site/public_html/private/backup_migrate/manual/file_name.sql

But this results in the error:

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `key_value` at row: 105254

This is the case on both the live server and on my local enviroment (I use Lando).

Can someone point me towards how I can debug this?

How to Prevent 404s From Querying the Database

We had to turn on MySQL's general log to satisfy a security requirement. Recently our site was attacked with a zillion bogus requests. 99.99% of these resulted in 404s it caused our disk space to fill up because the general log was recording every query caused by these bogus requests. Why does Drupal do this? 

Is there any way to stop this from happening?

I attempted to implement a "class WhitelistRoutesSubscriber implements EventSubscriberInterface {...}" and redirect the bogus requests with a 403 but that didn't stop Drupal from querying the database.

Custom Block Plugin Get Path Info

Hi,

I'm trying to code a block plugin that will send variable values to the template based on the current URL. I have the block working and displaying for the most part but I'm having trouble getting the path I need to compare to. I've tried looking through the docs and googling but so much of the info is outdated for a Drupal 10 project. My problem is I don't seem to be able to get the services I want via dependency injection in a block and the services I managed to use don't actually give me the path alias that I'm looking for. I'm currently accessing the path info like so:

ajax callback response issue with field in hook_form_alter when field in tabs via form display

I'm in Drupal 10 and have an ajax callback where I need it to return two fields. I've gotten this to partially work, but am running into an inconsistency depending on if the field is at the top level or under a tab via form display. In the below example, field_people in form display is a top level field, and field_featured is nested under a tab via form display.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions