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()->...
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....
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 ...
6
votes
Craft 3 How to get custom user field values
If someone lands here searching for a Twig answer like me.
{{ currentUser.customFieldHandle }}
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' => $...
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 ...
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 ...
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 ...
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.
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\....
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
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');
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 ...
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 ...
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 ...
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 ...
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/...
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 ...
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, ...
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 ...
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 ...
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->...
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 ...
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', ...
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 ...
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[...
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 ...
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 ...
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.
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
users × 511plugin-development × 75
craft3 × 54
registration × 37
user-profile × 35
user-groups × 35
templating × 30
password × 27
control-panel × 26
emails × 26
permissions × 24
login × 23
activation × 23
form × 22
entries × 21
plugins × 20
current-user × 17
session × 15
relations × 14
admin × 14
usermodel × 14
config × 13
frontend × 12
assets × 11
custom-field × 11