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
@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 / 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 / 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');
{
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);
// 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);
add_filter('fluentform_entry_statuses_core', function ($statuses) {
$statuses['important'] = 'Important';
return $statuses;
}, 10, 1);
add_filter('fluentform_rendering_field_data_select', function ($data, $form) {
$targetFormID = 2;
//google sheet shared as CSV link
$csvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSQM0ay3KgEmTp64M7ZZ5n5QXHDsSzaaJcVCuIHBvgMIw32foNpdfd4jNnUMua8b5Mavb6E4jox_nic/pub?output=csv';
$columName = 'Opex Vessel Categories'; // 'Players' is the column name
$uniqueData = false; // remove duplicate values
if ($form->id != $targetFormID) {
add_action('fluentform_before_submission_confirmation', 'your_custom_confirmation_function', 20, 3);
function your_custom_confirmation_function($entryId, $formData, $form)
{
if ($form->id != 207) {
return;
}
sleep(20);
// DO your stuff here
}
function add_login_check()
{
if (is_user_logged_in()) {
if (is_page(200)){
wp_redirect('https://dev-mahdii.pantheonsite.io/');
exit;
}
}
}
function add_login_check()
{
if (is_user_logged_in()) {
if (is_page(200)){
wp_redirect('https://dev-mahdii.pantheonsite.io/');
exit;
}
}
}