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 / fct_can_be_downlaoded.php
Created October 15, 2025 06:22
Filter hook to check whether file can be downloaded or not
add_filter('fluent_cart/product_download/can_be_downloaded', function($canBeDownloaded, $orderInfo){
}, 10, 2);
@aimahdi
aimahdi / paddle_payment_tax_calculator
Created September 19, 2025 04:35
Paddle payment tax calculator when tax is included with the price
<?php
function calculateAmount($subtotal, $discount){
$finalSubtotal = round(($subtotal /1.15), 2);
echo "Subtotal: {$finalSubtotal}\n";
$finalDiscount = round(($discount / 1.15), 2);
echo "Discount: {$finalDiscount}\n";
add_filter('fluentform/validate_input_item_input_checkbox', function($validation, $field, $formData, $fields, $form) {
// Do your stuff here
//
$formId = $form->id;
if($formId != 6) return $validation; // Change the form id here
$count = count($formData['checkbox']); //replace checkbox with the name attribute of the field
add_filter('fluentform/rendering_field_data_input_email', 'add_accessibility_attributes_to_email_field', 10, 2);
function add_accessibility_attributes_to_email_field($data, $form)
{
// Only target a specific form
if ($form->id != 327) {
return $data;
}
$data['attributes']['autocomplete'] = 'email';
window.onload= function () {
flatpickr('.fp', {
enableTime: true,
dateFormat: "Y-m-d H:i",
onReady: updateLimits,
onChange: updateLimits
});
function updateLimits(selectedDates, dateStr, instance) {
function get_fluentform_schedule_dates( $form_id ) {
global $wpdb;
if ( ! $form_id ) {
return 'Invalid form ID.';
}
$table_name = $wpdb->prefix . 'fluentform_form_meta';
// Get all meta for the form
add_action('fluentform/loaded', function ($app) {
$app->router->post('/submit-form', function () use ($app) {
try {
$data = $app->request->get('data');
$data['_wp_http_referer'] = isset($data['_wp_http_referer']) ? sanitize_url(urldecode($data['_wp_http_referer'])) : '';
$app->request->merge(['data' => $data]);
$formId = intval($app->request->get('form_id'));
@aimahdi
aimahdi / gist:5933aee5d138f4d0f895454f109c980d
Last active March 10, 2025 06:01
validate_email_exclude_business.php
add_filter('fluentform/validate_input_item_input_email', function ($errorMessage, $field, $formData, $fields, $form) {
$targetFormId = 15;
if ($form->id != $targetFormId) {
return $errorMessage;
}
add_action('custom_message', 'custom_message_callback', 10, 1);
function custom_message_callback($form) {
echo '<div class="custom-field-container">';
echo '<button type="button" onclick="alert(\'Custom message sent!\')">Send Message</button>';
echo '</div>';
}
jQuery(document).ready(function($) {
$('.fluentform input[name="input_radio"]').click(function() {
if (this.wasChecked) {
$(this).prop('checked', false);
} else {
$(this).prop('checked', true);
}
this.wasChecked = this.checked;
// Forcefully trigger the change event