Questions tagged [current-user]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
30 views

Commerce: How can I check that a user has bought a product?

I have a digital product, with a landing page, and I want to know if the connected user has already bought the product so I can give him access to the content.
1
vote
1answer
27 views

Craft 3 - Matrix Block for currentUser

I have a Matrix field named -> certificado with block -> certificados and fields -> nomeDoCurso, curso, certificado My Matrix block has no entries but is associated with a user. How can I fetch ...
1
vote
0answers
175 views

User account registration using Craft 3

I wanted to build a commerce website using Craft 3. And I wanted to create parent registration form so each parent will have an account to use on the site. Then after they sign in I want them to be ...
1
vote
1answer
30 views

Else statement outputting three bits of content

I have implemented an if/else statement and when I add the information to the 'else' part it outputs three duplicates of the same content. I am calling the if statement to check if the user is signed ...
1
vote
1answer
323 views

How to compare currentUser with entry.author?

How can I compare the results of currentUser and entry.author on an entry page? I've tried the following, but none of these get a positive result: {% if currentUser == 'entry.author.id' %} Or {% ...
1
vote
1answer
19 views

List users connected to me

I have a relationship field within my member profile. It allows users to connect to each other, i can list those that currentUser is connected to, but i need to list all other members that are ...
1
vote
1answer
55 views

Include user information in html block

I need to pass the logged-in user's email address as a variable to a embedded javascript form. I think the easiest way for me to do this is to dynamically embed the user's email address in the embed ...
1
vote
1answer
171 views

Users are always logged out on front end

Users are always logged out on the front end on my Craft website. Even when logged in as admin I can access the CMS but on the front end user session always returns the following. Craft\...
1
vote
1answer
345 views

Variable for User Field

How do I go about using a dynamic value to access a user field value? I have created a form builder for users and dynamically populate the user field based on the question's associated field. <...
2
votes
1answer
569 views

Change email address on front end

Some similar posts on here already but I'm still struggling. My code looks fine as far as I can tell? Page just reloads with no changes to the email (other fields change fine). I'm missing something ...
1
vote
1answer
121 views

Access logged-in user info when `baseCpUrl` is different than `siteUrl`

Our site's control panel needs to be on a subdomain for security purposes. So our baseCpUrl setting in our general.php file is http://craft-admin.domain.com/ while our siteUrl is set at http://www....
1
vote
1answer
148 views

conditional does not run first in a file that is included using the extends feature for twig

I have this conditional included in a layout file I use within others, using the extends feature in twig. This is at the very top of _layouts/application.twig {% if not currentUser %} {% ...
1
vote
2answers
1k views

Show content if logged in user is in userGroup1 OR userGroup2?

This is so simple in ExpressionEngine and yet I've tried everything for several hours and can't find a way to get it working in Craft??? I have 2 User Groups: userGroup1, userGroup2 If the currently ...
1
vote
1answer
90 views

How do I relate a user to a channel entry from a form?

I have a channel which has a relate to user field, how do I setup the front-end form which is a user details update form so they can select a channel entry from a drop down and when saved, have it ...
0
votes
1answer
55 views

User specific entries (relations)

Does anyone know how I can show a specific entry to a user (frontend)? My user field is called "gebruiker". {# Get current member e.g URL /members/1/ #} {% set currentMember = craft.users.id(craft....
2
votes
2answers
679 views

Using the CP login session expiration for the frontend

I love the session handling on the backend CP. The prompts that come up on session expiration after setting 'userSessionDuration' => 'PT5M', in config/general.php are exactly what I want to use on ...
2
votes
1answer
559 views

currentUser: Impossible to invoke a method (“isInGroup”) on a null variable

I couldn't find this anywhere else, I'm looking up if the currentUser.isInGroup('verified') and if not, display another link. Works fine when logged in but throws a Template and Runtime error when ...
3
votes
1answer
585 views

What does the Timezone in Settings -> General represent?

Should it be set to the timezone of the server Craft is installed on, or the timezone of the current user, or something else? I can find no documentation about these settings anywhere.
2
votes
2answers
968 views

How do I get the current user’s info over Ajax?

I created an Ajax-based login form based on this gist: https://gist.github.com/keithmancuso/29e8446ec5fa66fb2b01. After the user has logged in, how can I get some info about them over Ajax?
2
votes
1answer
160 views

How can I interact with Users via the ElementAPI?

I am attempting to use the ElementAPI to check if a user is logged in or not. I've used the ElementAPI before to check/get entries for a given section, but never for user-based entries. Here is my ...
2
votes
1answer
145 views

User Profile page - one user can only access one page

I'm new to craft, in fact I haven't built a site with it yet, but am looking forward to getting my teeth into this interesting and seemingly very flexible CMS. I am about to embark on a medium sized ...
1
vote
1answer
148 views

sessions being read inconsistently

I've got a navigation bar that displays different links for logged in users using {% if currentUser %}. However, when clicking through links, sometimes it won't pick up that someone is logged in. The ...
2
votes
3answers
1k views

CometChat integration

I need to implement Comet Chat, a facebook-chat-like third-party script, into my Craft project. Comet Chat can connect to most CMS and PHP framework but there is no Craft integration yet, so I tried ...
3
votes
1answer
2k views

What's the difference between 'user', 'currentUser', and 'account'?

I notice in the template examples that user, account and currentUser are all being used, but not seeing clear documentation on these. Can someone perhaps explain the difference? Example User ...
11
votes
3answers
7k views

Check user is in User Group / Custom User Permissions

I'm trying to restrict access to items in a channel using some form of custom user permissions however I don't appear to be able to create or set custom read permissions for a channel using crafts ...
16
votes
1answer
9k views

How can I determine if a user is logged in, and who that user is?

I'm running some checks to see if there is a user logged in, and if that user is someone specific. When accessing user.isCurrent it's returning 1 when I'm logged in, but returns null when I'm not. ...