Ali Khallad
Forum Replies Created
-
Happy to help ??
Hey @aduwow , the iPhone problem has been fixed. It should work with AJAX now in version 1.5.0
Let me know if it’s working as expected.Hey @aduwow , good to hear the “Disabled AJAX” problem is solved. We’ll try to replicate the iPhone issue and release and update once sorted.
Hey @aduwow
The NON-AJAX submission problem is fixed. Regarding the behaviour on iPhone, I haven’t been able to replicate the issue, but I believe it’s related to the other issue, so it should be fixed as well.
Can you test the recent version 1.4.9 and let me know if you’re still having issues?
Thanks,
Ali
Hey @aduwow , thanks for sharing your feedback!
I’ll try to import the form and test it to see where is the issue exactly.
Will let you know once sorted.
Hey @crimsonflash ,
I just integrated reCAPTCHA Enterprise, it looks like Google is probably going to sunset the legacy v2 and v3 recaptcha. They’re basically the same on the frontend, but now you need to get your reCaptcha keys from Google Cloud https://www.google.com/recaptcha/admin/enterprise
The plugin now supports all 3
- Legacy recaptcha v2:?https://www.google.com/recaptcha/admin
- Cloud v2 recaptcha (?Enterprise?)?:?https://www.google.com/recaptcha/admin/enterprise
- Cloud v3 recaptcha? (?Enterprise?)?:?https://www.google.com/recaptcha/admin/enterprise
I suggest you use cloud v2 version. If you use v3, you might still see some spam until Google collects some data about the traffic on your website to be able to determine what’s spam and what’s not spam.
Let me know if you have any questions
Thanks,
AliHey @crimsonflash,
Sure, we’ll make sure to implement reCaptcha V3 in the next few days.
Hello @treylok
Since email field is a compound field ( consisting of more than one input ), it has a different rendering approach. In this case, we can use another hook that allows filtering all types of fields.
The following code should fix both problems for you
add_filter('mf_input_args', 'mf_custom_input_attributes', 10, 1);
function mf_custom_input_attributes($args) {
$traget_form_id = 81;
if ( !isset($args['attributes']['name']) || strpos($args['attributes']['name'], "mform_{$traget_form_id}_mfield_") !== 0 ) {
return $$args;
}
$prefix = "mform_{$traget_form_id}_mfield_";
$email_field_id = 7;
$email_suffix = $email_field_id . '[email]';
$confirm_email_suffix = $email_field_id . '[email_confirmation]';
switch ($args['attributes']['name']) {
case "{$prefix}{$email_field_id}":
$args['attributes']['id'] = $prefix . $email_field_id . '_email';
$args['content'] = str_replace('for="' . $prefix . $email_suffix . '"', 'for="' . $prefix . $email_field_id . '_email"', $args['content']);
$args['content'] = str_replace('for="' . $prefix . $confirm_email_suffix . '"', 'for="' . $prefix . $email_field_id . '_email_confirmation"', $args['content']);
break;
case "{$prefix}{$email_suffix}":
$args['content'] = str_replace('/>', ' autocomplete="email" id="' . $prefix . $email_field_id . '_email"/>', $args['content']);
$args['attributes']['id'] = $prefix . $email_field_id . '_email';
break;
case "{$prefix}{$confirm_email_suffix}":
$args['content'] = str_replace('/>', ' autocomplete="off" id="' . $prefix . $email_field_id . '_email_confirmation"/>', $args['content']);
$args['attributes']['id'] = $prefix . $email_field_id . '_email_confirmation';
break;
default:
break;
}
return $args;
}Make sure to change the form ID and the field ID and it will work as expected.
Note that the [email] part is autogenerated for compound fields, so it is intended.Hey @treylok
This can be achieved with a custom snippet for the time being until we add this feature.
Place this snippet in your child theme’s functions.php file and modify the IDs accordingly.add_filter('mf_field_display_args', 'mf_custom_field_display_attributes', 10, 1);
function mf_custom_field_display_attributes($params) {
$traget_form_id = 80;
if ( strpos($params['id'], "mform_{$traget_form_id}_mfield_") !== 0 ) {
return $params;
}
$prefix = "mform_{$traget_form_id}_mfield_";
$firstname_field_id = 1;
$lastname_field_id = 2;
$email_field_id = 3;
switch ($params['id']) {
case "{$prefix}{$firstname_field_id}":
$params['attributes']['autocomplete'] = 'given-name';
break;
case "{$prefix}{$lastname_field_id}":
$params['attributes']['autocomplete'] = 'family-name';
break;
case "{$prefix}{$email_field_id}":
$params['attributes']['autocomplete'] = 'off';
break;
default:
break;
}
return $params;
}Let me know if you have any additional questions.
It can be cleaner than this, but the quickest way to do it without a lot of work is:
Step 1:?Store all emails inside an option as an array. Let’s name the option “mf_custom_email_list”, make sure it’s not autoloaded and each email has an ID as key. ( make sure the data is saved as a serialized php array ), it’s better to update using WordPress core functions, eg:update_option('mf_custom_email_list', array(
'1' => '[email protected]',
'22' => '[email protected]',
'3' => '[email protected]'
), 'no');Step 2: Update all the mailto links to redirect to a contact page but make sure to add a query param to reflect the email ID, it can be “to” for example, so the url will look something like <a href=”https://yourwebsite.com/contact?to=22″>.
Step 3:?Install?Mega Forms, create your contact form and add a hidden field, set the hidden field value to something like this
{mf:misc get="to"}
as it appears in the screenshot. Then under actions tab, add an “email” action and set the “to” field to pull the email from the hidden field you created, it will look something like this{mf:fields 6}
where number 6 is the ID of the field. See the attached screenshot for examples.Step 4:?Now add a snippet that will replace the provided ID with the actual email server side to make sure emails are not exposed anywhere. Here is the snippet you can use
add_filter('mf_posted_data_before_process', 'mf_modify_email_field', 10, 3);
function mf_modify_email_field($posted, $form, $context) {
$the_hidden_field_id = 6;
// Check if the field with ID 6 exists in the posted data
if (isset($posted['fields'][$the_hidden_field_id])) {
// Get the submitted value
$submitted_value = mfpost($the_hidden_field_id, $posted['fields']);
// Get the custom email list from WordPress options
$custom_email_list = get_option('mf_custom_email_list', array());
// Not valid data format, initialize an empty array
if (!is_array($custom_email_list)) {
$custom_email_list = array();
error_log("mf_custom_email_list option is neither an array nor a valid serialized array.");
}
// Check if the submitted value exists as a key in the custom email list
if (isset($custom_email_list[$submitted_value])) {
// Replace the submitted value with the corresponding email
$posted['fields'][$the_hidden_field_id] = $custom_email_list[$submitted_value];
} else {
// If the key doesn't exist, you might want to handle this case
// For example, you could set a default email or log an error
error_log("No email found for key: " . $submitted_value);
// Optionally set a default email:
// $posted['fields'][$the_hidden_field_id] = '[email protected]';
}
}
return $posted;
}Awesome, good to hear you got it sorted.
Hello,
Please use the shortcode widget from elementor to add the form. Each form has a shortcode that you can find in the list of forms on the right side.
Let me know if that solves your problem!
Forum: Plugins
In reply to: [Plugin Check (PCP)] Not working for any plugin (Windows)Same here, I get this for every plugin ( Even hello dolly can’t pass):
- Failed check_against_phpcs.
- Failed check_against_phpcs_review.
I ran it on a website using LAMP stack.
That’s great, good to hear you were able to fix this issue.
Feel free to open another ticket if you need help with anything else.
Hello Andrew,
May I ask how did you add the shortcode to the footer? was it via a file, or somewhere in the customizer?
Customizer fields don’t usually support shortcodes, but if you use a widget to add it, it should work without a problem.
Just let me know, how it’s being used now and I can help you make it work, should be a simple problem to solve.