Disable e-mail field check on registration

9 years 3 months ago #257846 by krileon
Replied by krileon on topic Disable e-mail field check on registration

@krileon, do you have some example code i can use in the php to try and see if it works?

First set the field as non-required. Next try the below CB Auto Actions action and see if it'll work.

Triggers: onStartSaveUserRegistration
Action: Code
User: Automatic
Access: Everybody
Conditional: [post_email] Empty
Method: PHP
Code:
global $_POST;

$_POST['email'] = uniqid() . '@cb.invalid';

If the user supplied no email address then the post data for it will be empty. In this case it'll generate a unique id and set the email address to a dummy email address via the post data, which should bind to the user fine.

A note about the above is there is no user object yet. The idea is we're testing the post data only and populating the post data as needed. The reason for this is we need it done before the user object is bound during registration so the post data added by the action will bind to the user.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: technogrid

Please Log in to join the conversation.

9 years 3 months ago #257856 by technogrid
Replied by technogrid on topic Disable e-mail field check on registration
Nope, nothing happens...

it's set up like this:
Triggers: onStartSaveUserRegistration
Action: Code
User: Automatic
Access: Everybody
Conditional: [post_email] Empty
Method: PHP
Code: (the one you've posted)
Return: echo
Parameters: all to no

Please Log in to join the conversation.

9 years 3 months ago - 9 years 3 months ago #257890 by krileon
Replied by krileon on topic Disable e-mail field check on registration
Remove the conditional then retest as this will let us know that doing this will even work. If you've the email verify field enabled you'll need to change the code to the below so both values are populated for validation.

global $_POST;
 
$_POST['email'] = uniqid() . '@cb.invalid';
$_POST['email_verify'] = $_POST['email'];


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: technogrid

Please Log in to join the conversation.

9 years 3 months ago - 9 years 3 months ago #257896 by technogrid
Replied by technogrid on topic Disable e-mail field check on registration
It's working!

i've just removed the conditional, the email verification field it was set to disabled before so i didn't changed the code.

now when user tries to register if the field for email is left empty the user was registered with the email: 54ca403e7edf5@cb.invalid

let me try to register second one to see if it works, and please let me know if theres a way i can scrape the username from the username field so that registered user will be with e-mail "username@mydomain.com"

update: it's working, i can register as many users i want without email :)

Please Log in to join the conversation.

9 years 3 months ago #257903 by krileon
Replied by krileon on topic Disable e-mail field check on registration

i've just removed the conditional, the email verification field it was set to disabled before so i didn't changed the code.

Well you need the conditional. It just needs to be set different. Try the below conditional.

[post_email] Equal To

Leave the right value completely empty. Without the conditional the email field value will always be replaced so they won't be able to supply their own.

let me try to register second one to see if it works, and please let me know if theres a way i can scrape the username from the username field so that registered user will be with e-mail " username@mydomain.com"

The username can have spaces so that's not a good idea unless you add additional PHP to properly clean the username to an email address.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.223 seconds

Facebook Twitter LinkedIn