Skip to main content
7 votes
Accepted

Redirecting after login based on user group

To set the setting dynamically, you’ll need to create a new plugin, which just has an init() method with this: public function init() { // Is this a login request? if ( craft()->...
Brandon Kelly's user avatar
6 votes
Accepted

How to list all User Groups and Users

Something like this should work: {% set userGroups = craft.userGroups.getAllGroups() %} {% if userGroups|length %} {% for userGroup in userGroups %} <h2> {{ userGroup....
Brad Bell's user avatar
  • 67.6k
6 votes

/admin/actions/users/login 404

What server provisioner are you using? Forge? Something else? If it's Forge, it's most likely this: https://twitter.com/nystudio107/status/895726366477344772 Also here are some Nginx configs (with ...
andrew.welch's user avatar
  • 11.6k
6 votes

Craft 3 How to get custom user field values

If someone lands here searching for a Twig answer like me. {{ currentUser.customFieldHandle }}
Jessica Talzor's user avatar
6 votes
Accepted

Create a pending user from plugin

Rolling with this does what I need $newUser = new User([ 'firstName' => $submission->firstName->getValue(), 'lastName' => $submission->lastName->getValue(), 'username' => $...
Steven Grant's user avatar
  • 1,855
5 votes
Accepted

Single-sign on for multiple Craft sites

No, Craft doesn't have any native notion of SSO. (You can technically run multiple sites from the same Craft instance. If you had sites sharing the same server, you could run them from the same Craft ...
Michael Rog's user avatar
  • 3,420
5 votes

Recovering (or creating a new) admin account

I'm rusty on MySQL so it took me a while to go through this. I'm leaving this here for future internet travelers. It's based on Brad's solution, so read through that first, then you can use these ...
hisnameisjimmy's user avatar
5 votes

Limit number of sessions per user

Im on Craft v3.4.25, and I've added the following event handler in my module to handle this. There are two scenarios here: either you want the new login to invalidate any existing session, or you want ...
Gary Reckard's user avatar
5 votes

How do I UNLOCK my account?

If you don’t have access to another admin account, you could unlock the account directly in the database. Change the lock value to 0 for the account in the craft_users table.
carlcs's user avatar
  • 36.3k
5 votes
Accepted

/admin/actions/users/login 404

So I looked into this a bunch more tonight to satisfy my curiosity, and here's what is happening. The default rewrite rule that Forge is apparently adding is this: if ($request_uri ~* "^(.*/)index\....
andrew.welch's user avatar
  • 11.6k
5 votes
Accepted

Sending activation emails to all pending users

foreach(\craft\elements\User::find()->status('pending')->all() as $user){ Craft::$app->getUsers()->sendActivationEmail($user); } Fetch all pending users and send them the mail
Robin Schambach's user avatar
5 votes
Accepted

Craft 3 How to get custom user field values

You should be able to access the custom fields on element\user object. Craft::$app->getUser()->getIdentity()->getFieldValue('customfieldname');
Dasun Rathnayake's user avatar
5 votes
Accepted

Protecting public assets

This answer is a bit self-serving, but I'm the author of the Digital Download plugin. It allows you to control how and when assets are downloaded. You can restrict downloads by a time period, maximum ...
Lindsey D's user avatar
  • 24.1k
5 votes
Accepted

Not require password on user signup

What you want is the deferPublicRegistrationPassword config setting. By default, Craft will require a 'password' field to be submitted on front-end, public user registrations. Setting this to true ...
Marion Newlevant's user avatar
5 votes
Accepted

Stay on the same page after logout

Yep, postLogoutRedirect can be set to a function instead of a static value. So for example, in your template you can generate a hidden field in your logout form (or append a querystring parameter to ...
Evan Warner's user avatar
4 votes

Allow user to change or delete their photo for their profile from the front end

FWIW, Niall, I've always just created an additional Profile field for people's images. The weird "not really an asset" aspect of the profile pictures is gone in Craft 3, but I found enough annoyances ...
andrew.welch's user avatar
  • 11.6k
4 votes

Activate Users - privilege

I realise this is an old post but I wrote a plugin to handle exactly this, putting this as an answer instead of a comment since OP asks if there's an override: https://github.com/billythekid/...
billythekid's user avatar
4 votes

Craft constantly logging out from admin area

For me the solution required was 'requireMatchingUserAgentForSession' => false in my config/general.php I was debugging the site in Chrome and it was changing my user agent, which was instantly ...
James Nisbet's user avatar
4 votes
Accepted

Send activation mail from front end

I'll focus on the "sending an activation email from the front end" part of your question, since that seems to be the crux of it: You'd have to write a very simple, custom plugin. For instant success, ...
Mats Mikkel Rummelhoff's user avatar
4 votes
Accepted

Delete a relation in frontend form

I believe you're getting that error because you're supplying an array ([]) for the mother field and the only value in that array would be an empty string ("") if they select the There is no mother ...
Stephen Hamilton's user avatar
4 votes
Accepted

Editing entry in front-end

I managed to find a solution, using hidden input fields :) Thank you for all the help :) Edit: Ended up solving this by using tables and saving the username and ID in that. Used a plugin called Super ...
Filip Iversen's user avatar
4 votes
Accepted

Only allow signups from people with @___.com emails

One way of doing this is to write a custom plugin that intercepts the users.onBeforeSaveUser event. You would check that the submitted email address matched your desired pattern and set $event->...
Steve Rowling's user avatar
4 votes

Change email address on front end

Thanks to billythekid's suggestion, adding a password field creates an elevated session, and solves my problem. <input type="password" name="password" placeholder="Password" required> Actually ...
Ian Ebden's user avatar
  • 894
4 votes
Accepted

Validation on username?

I don't know if there is anything natively in Craft to do this, but you could achieve it quite easily with a single file plugin: public function init() { craft()->on('users.onBeforeSaveUser', ...
Alec Ritson's user avatar
  • 4,539
4 votes
Accepted

How to import user addresses?

Addresses are not Elements, so most import plugins will no support them as an import type. You will need to create a plugin or script that imports the addresses into the commerce_addresses table. You ...
Luke Holder's user avatar
  • 6,897
4 votes

User registration form with checkbox field

Just in case anyone else has this issue i got it working with these modifications. I think the hidden field was required for the possibility of null values. <input type="hidden" name="fields[...
Matt B's user avatar
  • 73
4 votes
Accepted

Missing Users tab in CMS

Based on your screenshot, you're using the Personal version of Craft, which only allows for one user, which is why you won't see a Users section in the sidebar or the Settings screen. If you upgrade ...
Jalen Davenport's user avatar
  • 3,045
4 votes

Craft 3 best way/steps to create a login client area in frontend

I don't know any plugins that do that for you since it's integrated in Craft by default. There are Registration forms as well as Login form examples and you can create Entry forms as well. For gating ...
Robin Schambach's user avatar
4 votes
Accepted

Can I manage/change the default flash message text?

You could for example just edit the translation file with the specific user registered flash message. You can read more about the static translation in the docs.
Christopher Dosin's user avatar
4 votes

How to change the Craft 3 activation email?

Under Settings > Email there is a field called "HTML Email Template" which you can use to point to a single template that handles all of the system emails. It's not very obvious from the Craft UI, but ...
James Smith's user avatar
  • 5,529

Only top scored, non community-wiki answers of a minimum length are eligible