Questions tagged [current-user]
The current-user tag has no usage guidance.
30
questions
1
vote
1
answer
81
views
user session for Multi Site
I have a multi-site and they are under 1 root domain and the default site is food.com and bread.food.com is the additional site. How can I share the user session data of food.com to bread.food.com. My ...
1
vote
1
answer
39
views
How can I make an entries query based on currentUser is author or relatedTo currentUser
My project requires a notifications area. I want to list all notification entries that were created by currentUser or sent to currentUser.
I can do created by = craft.entries().section('thename')....
0
votes
1
answer
62
views
currentUser gets cached
I'm having a problem with navigation that seems to get cached.
If the page is loaded by someone who is not logged in, it shows the login button in the navigation (and it should).
Once the user is ...
0
votes
1
answer
57
views
Get entries that aren't related to current user
I am trying to get all the entries that don't related to the current user via a user field.
I have used the following code to fetch all the entries that do related to the current user
{% set entries ...
1
vote
3
answers
252
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
1
answer
32
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
0
answers
250
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
1
answer
32
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
1
answer
416
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
1
answer
29
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
1
answer
81
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
1
answer
190
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
1
answer
456
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
1
answer
759
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
1
answer
181
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
1
answer
181
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 %}
{% ...
2
votes
2
answers
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
1
answer
131
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
1
answer
59
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
2
answers
1k
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
1
answer
678
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
1
answer
850
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
2
answers
1k
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
1
answer
169
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
1
answer
193
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
1
answer
153
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
3
answers
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 ...
5
votes
1
answer
3k
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 ...
14
votes
4
answers
11k
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 ...
18
votes
1
answer
12k
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. ...