Hi all! I have three forms, one for vendor registration, another for buyer registration and a RFQ form. The buyer submits a RFQ and the vendors should receive an email notification about it.
I can't seem to get a good solution on how to get the 20+ vendors emails to the BCC Send Email action. One thing that comes to mind is to do a GET request and load them into a hidden field, then just set the BCC to that field, but that request will show on the network tab and anyone with the right knowledge would extract all the vendors emails from there.
If I can't do this using only formidable forms, what integration would you recommend (zapier, hubspot)? Thanks in advance! RBC
See? Victor and I agree so we must be right 🙂
Yes! This! I think this is the way, I'll give it a go later on and report back. In my initial comment I failed to mention that the list was going to be dynamic, but this takes that into consideration. Thanks Rob and Victor!
function getVendorEmails( $atts ) { $users = get_users(); $emails = array(); foreach($users as $user){ if ($user->roles[0] == 'vendor') { $emails[] = $user->user_email; } } return implode( ',', $emails ); } add_shortcode( 'vendor_emails', 'getVendorEmails' );Just inserted the [vendor_emails] to the BCC field and that was it. Thanks again!
This is good looking code and fit for purpose. If I may make a suggestion, it wouldn't be too hard to turn this into a generalized function that can be used for any WordPress user role. All you would have to do is pass a role parameter and then use the parameter as a variable in place of the string 'vendor' in the if statement. You can learn how to process a parameter in the WordPress Shortcode API documentation. Nice job!
I don't even have to go that far away to get the information about the parameter passing as there is a KB article detailing this right here https://formidableforms.com/knowledgebase/php-examples/#kb-show-display-names-from-a-list-of-user-ids
But since my use case only needs the vendor, this would be enough. I may do it for the knowledge but leave it as is for now.
Thanks!
Please login or Register to submit your answer
20 emails isn't really a problem for Formidable. A checkbox or list that is multiselect then using a sep=", " would capture them if they come from a form field. Is there more to it that I don't get from this?
uh.. just add the email addresses in the BCC field in form actions?
When you add emails manually to a send field, they will remain as part of the action for that form until you physically. A more flexible alternative would be to create your own shortcode that receives the RFQ number as a parameter. This way your BCC list is dynamic and will change automatically for any RFQ and list adjustments such as additions or deletions.