dhaigh
Forum Replies Created
-
Your suggested fix worked nearly perfectly. It would have been ideal if it worked prior to submission by leveraging AJAX, or backscrolling to the page with the error through the pagination, but it works well enough for our current purposes and I count that as a win. I’ve included a simplified version of the code I used below, without some of the bells and whistles we added for logging/recording purposes on our site.
add_filter('forminator_custom_form_submit_errors', 'custom_url_validation', 10, 3);
function custom_url_validation($submit_errors, $form_id, $field_data_array) {
// Target specific form by ID
$target_form_id = 140100;
if ($form_id != $target_form_id) {
return $submit_errors; // Exit if it's not the targeted form
}
// Define the fields to validate
$platform_url_fields = array('url-2', 'url-3', 'url-4', 'url-5');
foreach ($platform_url_fields as $field_name) {
$url = '';
// Find the value of the current field in the submitted data
foreach ($field_data_array as $field_data) {
if (isset($field_data['name']) && $field_data['name'] === $field_name) {
$url = $field_data['value'];
break; // Exit inner loop after finding the URL
}
}
if (empty($url)) {
continue; // Skip validation for empty URL fields
}
// Generic URL validation
if (!filter_var($url, FILTER_VALIDATE_URL)) {
$submit_errors[$field_name] = __('Please enter a valid URL.', 'your-text-domain');
continue; // Skip to the next field after validation failure
}
// Platform-specific validation
switch ($field_name) {
case 'url-2':
if (strpos($url, 'instagram.com') === false) {
$submit_errors[][$field_name] = __('Please enter a valid Instagram URL.', 'your-text-domain');
}
break;
case 'url-3':
if (strpos($url, 'facebook.com') === false) {
$submit_errors[][$field_name] = __('Please enter a valid Facebook URL.', 'your-text-domain');
}
break;
case 'url-4':
if (strpos($url, 'linkedin.com') === false) {
$submit_errors[][$field_name] = __('Please enter a valid LinkedIn URL.', 'your-text-domain');
}
break;
case 'url-5':
if (strpos($url, 'x.com') === false) {
$submit_errors[][$field_name] = __('Please enter a valid X URL.', 'your-text-domain');
}
break;
default:
// Optional: Handle unexpected cases (if needed)
break;
}
}
return $submit_errors; // Return all validation errors
}I appreciate it, thanks!
I’d like to add to this request, as we are looking at multiple options for search and information processing and yours appears to be the closest to what we’re looking for besides the lack of vendor search functionality. For now I will be looking at building some kind of custom solution, but in the event that you return to this in the future we will gladly implement your product.
After further testing, the issue seems to be that the my-account page is being replaced with the Dokan login, and redirecting to the dokan dashboard for approved vendors. However, for anyone who is a regular subscriber, their login attempts are going to the my-account page and, after successfully logging in, they just…sit there. They don’t get a redirect, and the usual WooCommerce my-account page never materializes for them. This is fundamentally unaccepteable behavior because it’s locking my users out of core WooCommerce functionality that they are expecting from me.
Nevermind. After resolving the issues inside the Dokan dashboard I went to log out and check everything over again and my initial login errors are back.
I noticed some inconsistencies in the use of aria-hidden=”true” and some formatting choices in products-widget (which was working just fine), orders-widget, and sales-chart-widget. After modifying the widgets php files that were misbehaving to align with the formatting and attributes of products-widget, I was able to resolve my issue almost entirely.
Reinstalling my plugins and meddling with the settings has somehow reverted the issue but I have no idea what caused it in the first place. However, now I have a different problem and I don’t know if this was there before or a result of updating to the new release. On initial page load, the “Orders” widget and the “Sales This Month” widget display the appropriate text, but when the page fully loads it gets replaced with text like class=”fas fa-shopping-cart”>Orders
When I inspect elements after the page load, this is the result:
<div class="widget-title">
::before
<span>
<i< span> class="fas fa-shopping-cart">Orders </i<>
</span>
</div>From what I am able to deduce, the issue is in how the code is being targetted or updated after the initial load. The relevant files that I can pinpoint are sales-chart-widget.php and orders-widget.php, but beyond that I don’t know what is updating them after the fact.