1

I'm using Craft Pro to make a website where users have a private area. Users register and when login happens they are redirected to a page in the private area with respective info about that user.

When i use {% requireLogin %} with {{ currentUser.id }} Craft 3 outputs the ID of the user that has active login in the CP (control panel).

But what I need is the ID of the user that made login in the frontend to access private area and not user ID that is logged in CP.

I'm reading the Craft 3 docs but I didn't find the answer I'm looking for.

Any suggestions?

  • The logged in user on the front and and the control panel are the same - the only difference is whether that user has permission to access the control panel. If I'm reading your question right, are you saying that a user logs in to look at another user's data, not their own? – darylknight Apr 16 '19 at 8:14
  • No. Users can register in the frontend, and then can fill a login form where they will be able to submit PDF files that can be read by the admin in control panel. How can i get that particular just logged in user profile in frontend? – André Castro Apr 16 '19 at 8:23
1

In Craft, there is no difference between the currently logged in user in the CP, and the currently logged in frontend user. Whenever a user logs in (be it through a frontend form, or the CP login page), it results in that user being logged in. Period. There's no 'being logged in in the frontend', as far as Craft is concerned.

| improve this answer | |
  • Thank you. I understand how it works now :) – André Castro Apr 16 '19 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.