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 extra settings to flatpickr calendar
function bleye_ff_custom_calendar_settings( $config, $settings, $form ) {
$start_of_week = get_option('start_of_week'); // get the option from the WP settings
$config['locale'] = ['firstDayOfWeek' => $start_of_week]; // add the config to flatpickr
return $config;
}
add_filter('fluentform/frontend_date_format', 'bleye_ff_custom_calendar_settings', 10, 3);
{
onChange: function(selectedDate, dateString) {
var birthDate = selectedDate[0] ;
birthDate.setDate(birthDate.getDate() +1);
var today = new Date();
var age = today.getTime() - birthDate.getTime();
var inYears = age/(1000*60*60*24*365);
@aimahdi
aimahdi / Recurring subscription.js
Created September 16, 2022 03:59
Recurring subscription.js
let calculatedValue = document.getElementById('ff_495_numeric-field_2');
let subscriptionValue = document.getElementById('payment_input_1_custom_0');
subscriptionValue.disabled = true;
calculatedValue.onchange = function(){
subscriptionValue.value = calculatedValue.value;
jQuery('#payment_input_1_custom_0').trigger('change');
@aimahdi
aimahdi / fluentform_login_with_username_or_email.php
Last active July 8, 2024 08:48
Login with User Name Or Email
add_action('fluentform/before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 557) { // 557 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 / Change press to select text
Created October 8, 2022 05:21
Change press to select text
add_filter('fluentform_global_form_vars', function ($arr) {
$target_form_id = 170;
$arr['choice_js_vars']['itemSelectText'] = 'drücken, um auszuwählen';
return $arr;
});
@aimahdi
aimahdi / ff_unique_dropdown.php
Created October 22, 2022 08:29
make the dropdown field unique
add_filter('fluentform_validate_input_item_select', function ($errorMessage, $field, $formData, $fields, $form) {
$fieldName = 'dropdown'; //name attribute of the dropdown field
$target_form_id = 597; //change the form id
if($target_form_id != $form->id){ return $errorMessage; }
if ($inputValue = \FluentForm\Framework\Helpers\ArrayHelper::get($formData, $fieldName)) {
add_action('fluentform_before_insert_submission', 'validate_email_reoon', 10, 3);
function validate_email_reoon($insertData, $data, $form)
{
if($form->id != 633) { //change the form id with your form id
return;
}
$apiKey = 'lYlSwj3Uxt5iGecFTHYdqKC4xBQYaClf'; //put your api key here
add_filter('fluent_crm/theme_pref', 'changeColorPalette', 10, 1);
function changeColorPalette(){
$color_palette = [
[
"name" => __("MyBlue", "fluent-crm"),
"slug" => "myblue",
"color" => "#336699"
],
add_filter('fluentform_rendering_field_data_select', function ($data, $form) {
$targetFormID = 15;
//google sheet shared as CSV link
$csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vT-mQ_isy2CXOi70SjjbNaCPbmhmshikUS8o3nEthE2N-6NsqdABnW6Crlmb2DegaO6IsM9QcjlWPz4/pub?output=csv';
$columName = 'Processos ativos'; // 'Players' is the column name
$uniqueData = true; // remove duplicate values
if ($form->id != $targetFormID) {
let rangeSliderOne = document.querySelector("#ff_798_rangeslider");
let rangeSliderTwo = document.querySelector("#ff_798_rangeslider_1");
let rangeSliderThree = document.querySelector("#ff_798_rangeslider_2");
let rangeValues = document.querySelectorAll(".ff_range_value");
rangeSliderOne.onchange = function(event){
let commaValue = event.target.value.replace(/\B(?=(\d{3})+(?!\d))/g, ",");