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 / fluentform_get_approved_entries_rest_api.php
Created November 28, 2024 07:02
Get Fluent Forms approved entries via REST-API
add_action('rest_api_init', function () {
register_rest_route('fluentform/v1', '/approved-entries/(?P<form_id>\d+)', array(
'methods' => 'GET',
'callback' => 'get_fluent_form_approved_entries',
'permission_callback' => '__return_true'
));
});
function get_fluent_form_approved_entries($request) {
window.onload = function() {
// Only 10 characters can be added. Change this value to apply more characters.
let textAreaCharsLimit = 10;
//find the specific text area field using the classname
let textAreaField = document.querySelector('.haslimit');
// Create a new div to display the remaining characters
let newDiv = document.createElement("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
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>';
}
@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;
}