1

I am trying to create a functionality in Craft where the user enter an email and the system is able to tell the user if the user exists or not similar to the attached screen: enter image description here

I am very new to plugin development, and I am not even sure if I need one, I found this post, which looks very helpful, only thing is I really don't know how to implement it. How to tell if user exists

Should I develop a plugin? And I don't understand the information on plugin website and I can't find an example where there is an input field on the front end.

3

If you are creating these as actual users in Craft, it should be possible to do it straight from the template without the need for a plugin, as long as you have Craft PRO (without PRO you anyways wouldn't be able to create more than one "admin" user, and one "client" user anyways):

See the documentation here: https://craftcms.com/docs/templating/craft.users#email

Basically, you should be able to call craft.users.email('your.email@address.com') to check if it exists. Again, I haven't tested this myself, but it will then return the user if it exists, and otherwise I assume it will return null.

  • this worked!... only thing is now I dont know how to add a template dynamically with js to run this {% set users = craft.users.email('users@yahoo.com') %} {% for user in users %} <li>{{ user.name }}</li> {% else %} <li>not!</li> {% endfor %} – MariaZ Jul 30 '17 at 1:02
  • Maybe a way to go would be to build on the examples for login/registration pages. I'm not sure if they specifically give you feedback on whether the email exists (often this is left out for security reasons – if you know an email exists, it can be targeted for trying to hack that user). But it should be possible to extend the code for an unsuccessful login to check if the user exists. See craftcms.com/docs/templating/user-registration-form and craftcms.com/docs/templating/login-form – KSP Jul 30 '17 at 11:04

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.