How to refer to a given user?

Created on 27 June 2024, 5 months ago
Updated 15 July 2024, 5 months ago

Problem/Motivation

I am trying to do this (pseudo code coming up) -

{% If the user being viewed (NOT the current user) has role x %}
<div>field y</div>
{% endif %}

Bamboo Twig docs say, "if the current|given user has the requested role" but I can't see how to write the twig.

Please could you give a code example of how to refer to a given user in twig?

Steps to reproduce

I have a preprocess function which provides a $uid variable to my twig template for the user being viewed (NOT the current user) but I can't find a way to use that variable in the if condition.

I've tried loads things but most of the tips and snippets are for the current user.

Thank you

💬 Support request
Status

Fixed

Version

6.0

Component

Documentation

Created by

🇬🇧United Kingdom nigelwhite Marsden

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

Comments & Activities

Production build 0.71.5 2024