diff --git a/src/Plugin/Condition/PageUserIsCurrentUser.php b/src/Plugin/Condition/PageUserIsCurrentUser.php index 8770acc..edefed7 100644 --- a/src/Plugin/Condition/PageUserIsCurrentUser.php +++ b/src/Plugin/Condition/PageUserIsCurrentUser.php @@ -7,6 +7,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\node\NodeInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -89,7 +90,13 @@ class PageUserIsCurrentUser extends ConditionPluginBase implements ContainerFact $page_uid = (int) $param; } else { - return FALSE; + // Rotas sem parâmetro 'user' (e.g., nós do microsite em /user/{id}/...): + // usa o autor do nó como usuário da página. + $node = $this->routeMatch->getParameter('node'); + if (!($node instanceof NodeInterface)) { + return FALSE; + } + $page_uid = (int) $node->getOwnerId(); } return $page_uid === (int) $this->currentUser->id();