Skip to content

Instantly share code, notes, and snippets.

View aimahdi's full-sized avatar
💭
Working on something bigger

Amimul Ihsan aimahdi

💭
Working on something bigger
View GitHub Profile
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 180) { // 180 is your form id. Change the 23 with your own login for ID
return;
}
$redirectUrl = home_url().'/library/shelves/'; // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
add_filter('fluentform_validate_input_item_phone', function($errorMessage, $field, $formData, $fields, $form) {
$target_form_id = 302;
if($form->id != $target_form_id ) {
return $errorMessage ;
}
var_dump($fromData->form_fields);
if( $formData['phone'] != $formData['phone_1'] ){
@aimahdi
aimahdi / fluent_form_lost_password.php
Last active April 9, 2025 10:09
Add a lost password action in Fluent Forms
add_action('fluentform/before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 17) { // 17 is your form id. Change the 17 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
var from = "from"; //change the name attribute of the from date field
var to = "to"; //change the name attribute of the to date field
var showHere = "showHere"; //change the name attribute of show difference field
var daysText = "days";
let fp = flatpickr("#ff_225_from", {}); //change form id with yours
let fp2 = flatpickr("#ff_225_to", {}); //change form id with yours
@aimahdi
aimahdi / rangeslider.js
Created October 5, 2021 10:21
range slider: put comma and a dollar sign before the number
let rangeSlider = document.querySelector("#ff_258_rangeslider");
let rangeValue = document.querySelector(".ff_range_value");
rangeSlider.onchange = function(event){
let commaValue = event.target.value.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
rangeValue.innerText = "$ "+commaValue;
}
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 229) { // 229 is your form id. Change the 229 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
@aimahdi
aimahdi / range_slider_rafi.js
Created August 28, 2021 10:28
This code will customize range slider's value and process
(function(){
let sliderValue = document.querySelector('.ff_range_value');
var number = 0;
sliderValue.insertAdjacentHTML('afterend', `<span class=range_calc style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'>$0</span>`);
document.querySelector('.range_calc').insertAdjacentHTML('afterend', "<span class='text' style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'> Potential Earnings </span>");
number = document.querySelector('.ff_range_value').innerText.split('$');
number = number[0]*15;
document.querySelector('.range_calc').innerText =`$${number}`;
@aimahdi
aimahdi / email_match_check.js
Created August 18, 2021 11:43
This code snippet will check if both email field matched or not.
let emailFieldOne = document.getElementById('ff_156_email');
let emailFieldTwo = document.getElementById('ff_156_email_1');
let submitButton = document.querySelector('.ff-btn-submit');
submitButton.style.display = 'none';
emailFieldTwo.insertAdjacentHTML('afterend', '<div id="customDiv" style="text-align:center; display:none; color:red;"></div>');
let displayed = false;
let customDiv = document.getElementById('customDiv');
@aimahdi
aimahdi / fluent_forms_confirm_email.php
Created August 17, 2021 16:04
The code snippet will check if both email field are matched or not
add_filter('fluentform_validate_input_item_input_email', function($errorMessage, $field, $formData, $fields, $form) {
$target_form_id = 8;
if($form->id != $target_form_id ) {
return $errorMessage ;
}
if( $formData['email'] != $formData['email_1'] ){
$errorMessage= ['Error! Email does not match'];
@aimahdi
aimahdi / fluent_forms_alter_data_before_submission.php
Created August 16, 2021 11:52
Fluent Form alter data before submission
add_filter('fluentform_insert_response_data', 'your_custom_response_data_filter_function', 10, 3);
function your_custom_response_data_filter_function($formData, $formId, $inputConfigs)
{
if($formId != 151) {
return $formData;
}
$formData['email'] = '[email protected]';