Disable Masquerade link on node author

Created on 17 August 2022, about 2 years ago
Updated 6 February 2023, over 1 year ago

Problem/Motivation

When a user name is rendered on a node, it's shown as a link "Masquerade as @name". I want to be able to disable this feature and keep the default, plain author name or link, while still allowing the user to use Masquerade.

Steps to reproduce

Enable Masquerade, allow user to use it, go to any node where "Display author and date information" is enabled for the node type.
The function masquerade_user_view() in masquerade.module adds a callback function to the user view, which will use MasqueradeCallbacks::renderCacheLink in masquerade\src\MasqueradeCallbacks.php to change the author link.
Disabling the author name (AKA a byline) in the node type removes it and the date completely.

Proposed resolution

Masquerade has no settings, so I have no idea where to put the control of this. I have tried overriding the function in code in a custom module or theme (like in HOOK_preprocess_node()) to disable it, but Masquerade "wins", and changes the link no matter what I do, since it kicks in later in the render process.

My only solution has been to disable the author display for all node types, and then adding it "manually" for the required ones, which is pretty stupid, since there's a core control of the display of the byline. Theming my way out of this seems stupid - first Drupal makes a byline, then Masquerade changes it and then I change it back. That is just plain dumb, but might be a simple option.

Any advice on how to obtain this is welcome - as a feature in the module or as code implemented in one of my custom modules or themes.

Feature request
Status

Active

Component

User interface

Created by

🇩🇰Denmark Martin Joergensen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Rudi Teschner

    I found it pretty annoying that its hijacking the user links too without an option to prevent that from happening, since I use tabs to structure node content and its rendering into every single tab.

    Guess an config check could be added to renderCacheLink() where the link is rendered but it could probably be solved way earlier.

Production build 0.71.5 2024