Latest Drupal related questions

Score: 1
Wrong user with currentUser() on prod
kn flag

I'm getting the name of my user that I load from the profile. It's works fine on my local, but on my prod, the firstname displayed is showing the name from the previous user. How do I prevent that ? This is how I get my data.

This is where I don't understand, I'm loading data by current user, but the user isn't the good one...

I have my "new" firstname only after clearing my website cache with drush ...

Score: 1
Lambic avatar
Entity access handler causing "The controller result claims to be providing relevant cache metadata, but leaked metadata was detected."
ph flag

I'm writing a custom entity access handler for a custom entity that checks if a user has access to the underlying node. The checkAccess() code looks like this:

$uuid = $entity->uuid->getString();
if (isset($uuid)) {
  $nodes = $this->node->getQuery()->accessCheck(TRUE)->condition('uuid', $uuid)->execute();
  if (!empty($nodes)) {
    return AccessResult::allowed();
  }
}
return ...
Score: 0
'Aggregate and compress CSS files' and 'Aggregate JavaScript files' don't work
cn flag

Recently selecting Aggregate and compress CSS files or Aggregate JavaScript files in the Performance page stopped working on a Drupal 7 site: When they are selected, the CSS/JavaScript file won't load.

I have cloned the site on another server and the problem doesn't occur there. The PHP version and the Drupal version (7.89) is the same.

How can I debug what is going on here?

Edit: Additional info ...

Score: 0
liquidcms avatar
I can't see custom action
us flag

I am trying to create a custom action for bulk operations on commerce orders.

I am using the following code.

mymodule/src/Plugin/Action/DeleteOrderAndApps.php

namespace Drupal\mymodule\Plugin\Action;
    
use Drupal\commerce_order\Entity\Order;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\node\Entity\Node;
    
/**
 * Delete Order and attached Apps action
 *
 *  ...
Score: 3
pglatz avatar
I'm trying to release a contrib module, but only see the dev version
in flag

I created an 8.x version of a contrib module I own (https://www.drupal.org/project/node_usage). It has a branch (8.x-1.x) and tag (8.x-1.0) and added the release, but the only 8.x one I see is 8.x-1.x-dev. If I click "add new release", it says no valid branches or tags found, but my branch and tag look like the examples they give. What do I have to do to make a non-dev release?

Score: 0
Lambic avatar
Entity caching and computed fields
ph flag

I have a custom entity that I've added some computed fields to, so the classes involved are:

  • class MyEntity extends ContentEntityBase
  • class ComputedFieldA extends FieldItemList
  • class ComputedFieldB extends FieldItemList

My issue is that I want the computed fields to either not be cached at all, or to be cached but with a different invalidation strategy.

Is what I want possible? Or do I just need to inv ...

Score: 0
theme_preprocess_menu is not seeing main menu
in flag

Background: I have an event website where I want to hide the event registration menu item when registration for the event is closed.

theme_preprocess_menu is not triggering on anything except 'menu__toolbar'. The code:

function myTheme_preprocess_menu(&$variables, $hook) {
  dpm($hook);
}

merely gives the result "menu__toolbar" on any page where my theme is active. My theme is based on Bartik.

 ...
Score: 0
How can I encrypt user-submitted content per user for a content type?
cn flag

Let's say I have a website where people keep a personal diary (diary content type). I have configured permissions so that each user can only read, write, and view his/her own diary.

Users can create and submit several different content types on the site; only the diary content type needs to be private.

I would like to encrypt diaries per user, ideally by tying the encryption to the user's name and ...

Score: 0
hockey2112 avatar
Create alternate "View Modes" for Webform Submissions?
tr flag

In a View of type "Webform Submissions", I have added a field called "Webform submission: Rendered entity". This displays the entire webform submission (content from all fields in the webform). My problem is that I have a few field elements in the webform that have create/view/update access permissions set to the Administrator role only. This is important because the webform is used by the Commerce Webf ...

Score: 0
jayaprakash R avatar
"[message] => DB Error: no such table" error after installing civicrm
pk flag

I installed CiviCRM 5.47.3 plugin using composer in the centos 8 server.

my drupal version is 9.3.5

After installing CiviCRM on the server CiviCRM plugin is enabled automatically in admin extension section

But after configuring CiviCRM no page is loading and facing the below error,

Initialization Error

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [ ...
Score: -2
syter avatar
All pages give 404 using nginx
cn flag

I am building a drupal site with drupal 9, and i want to publish it using azure devops.

Only the problem is that every page, except the frontpage, gives a 404 error. I've looked around the internet, and most people say they miss the .htaccess file, it is however included.

I can't edit files directly, and have to change it locally and then commit to change them, but it does somehow work locally.

The dru ...

Score: 0
hockey2112 avatar
How do I print a view field content from Order field in the order receipt email?
tr flag

I have a view field on the Order type that displays content from a webform submission that is associated with the order via the Commerce Webform Order module. This view field successfully displays that view's content on the order details page for both admin and shopper.

I want that webform data to be displayed on the order receipt email. I have found that {{ order_entity|commerce_entity_render }}

Score: 0
frmt avatar
Nested entity reference revisions field breaks paragraph's add bundle drop down
cn flag

TL;DR - Is there anyway to have nested Paragraphs entity reference revisions fields where the child Paragraphs entity reference revisions field has >1 bundle included and keep a functional node edit form?

Drupal: 9.3.9 PHP: 7.4.27

I have a basic page content type and it has a Paragraphs entity reference revisions field that allows users to select different bundles to layout their content. This works ...

Score: 1
Functional Testing - Schema Incomplete Exception missing schema
id flag

I am working on my first functional test for a custom module. Each time I run the functional test I get errors dealing with configuration schema issues. However, I'm confused by the error message.

Command

phpunit modules/custom/worx_blog

Error Message

Schema errors for editor.editor.full_html with the following errors:

editor.editor.full_html:settings.plugins.linkit missing schema

My Module Con ...

The Stunning Power of Questions

Much of an executive’s workday is spent asking others for information—requesting status updates from a team leader, for example, or questioning a counterpart in a tense negotiation. Yet unlike professionals such as litigators, journalists, and doctors, who are taught how to ask questions as an essential part of their training, few executives think of questioning as a skill that can be honed—or consider how their own answers to questions could make conversations more productive.

That’s a missed opportunity. Questioning is a uniquely powerful tool for unlocking value in organizations: It spurs learning and the exchange of ideas, it fuels innovation and performance improvement, it builds rapport and trust among team members. And it can mitigate business risk by uncovering unforeseen pitfalls and hazards.

For some people, questioning comes easily. Their natural inquisitiveness, emotional intelligence, and ability to read people put the ideal question on the tip of their tongue. But most of us don’t ask enough questions, nor do we pose our inquiries in an optimal way.

The good news is that by asking questions, we naturally improve our emotional intelligence, which in turn makes us better questioners—a virtuous cycle. In this article, we draw on insights from behavioral science research to explore how the way we frame questions and choose to answer our counterparts can influence the outcome of conversations. We offer guidance for choosing the best type, tone, sequence, and framing of questions and for deciding what and how much information to share to reap the most benefit from our interactions, not just for ourselves but for our organizations.