Skip to content

Instantly share code, notes, and snippets.

@annuman97
annuman97 / fluentCommunitySVGSupport.php
Created August 8, 2025 08:33
By default Wordpress doesn't allow SVG upload for security reason. But if someone wants to support SVG upload in community portal, first it needs to support to the WordPress and then use the fluent community hook
function allow_svg_uploads($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_svg_uploads');
add_filter('fluent_community/support_attachment_types', function($types) {
$types[] = 'image/svg+xml';
return $types;
});
@annuman97
annuman97 / disablePoll.php
Created July 31, 2025 09:05
If someone wants to disable Fluent Community Poll Feature, Use the following code to the functions.php file
add_filter( 'fluent_community/portal_vars', function( $vars ) {
if ( isset( $vars['features'] ) ) {
$vars['features']['has_survey_poll'] = false;
}
return $vars;
}, 20 );
@annuman97
annuman97 / prevent_selecting_a_date_in_calendar.js
Created July 16, 2025 12:03
Use a dropdown field with the class name .evening that includes options like "Noon" and "Evening", and a date/time field with the class name .datee. This form script prevents users from booking appointments on Sundays or during the evening. It shows alerts and disables selections to enforce these scheduling restrictions.
$(document).ready(function () {
var timeDropdown = $('.evening');
var calendarInput = $(".datee");
var fp = flatpickr(calendarInput[0], {
enableTime: true,
dateFormat: "Y-m-d H:i",
minDate: "today",
time_24hr: true,
onChange: function(selectedDates, dateStr, instance) {
@annuman97
annuman97 / ff_country_field_fullValue_inDynamicSmartcode.js
Created July 9, 2025 15:13
In Fluent Forms, Country Field display the Short Value for Dynamic Smartcode in HTML field. Using this JS will replace the Short Value and shows the full country name
(function() {
// Wait for the page and all forms to load (especially if loaded via AJAX)
function ready(fn) {
if (document.readyState != 'loading'){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
@annuman97
annuman97 / clickable_entirer_row.js
Created June 25, 2025 09:47
If a column contains URLs and users want to enable redirection to that link when clicking anywhere on the row,
function runAll(){
$('.footable tbody tr').click( function() {
}).hover( function() {
$(this).toggleClass('hover');
$(this).css('cursor', 'pointer');
});
$(document).on('click', '.footable tbody tr', function(e){
e.preventDefault();
var url = $(this).find('a').attr('href');
window.open(url, '_blank');
@annuman97
annuman97 / hide_left_sidebar_bottom_icons.php
Created June 20, 2025 05:30
Hide Left bottom icons in Fluent Community
add_action('init', function () {
if (current_user_can('manage_options')) {
remove_all_actions('fluent_community/after_portal_sidebar');
//add your own custom content there
add_action('fluent_community/after_portal_sidebar', function () {
echo '<div class="fcom_side_footer"></div>'; // empty footer
});
}
@annuman97
annuman97 / bypassadminapprovalemail.php
Created June 18, 2025 07:37
Sending Email Notification when Fluent Forms Admin Approval is enabled using wp_mail functions
add_action('fluentform/submission_inserted', 'bypass_admin_approval_email', 20, 3);
function bypass_admin_approval_email($entryId, $formData, $form)
{
if($form->id != 7) {
return;
}
$email = isset($formData['email']) ? sanitize_email($formData['email']) : '';
if ($email && is_email($email)) {
@annuman97
annuman97 / autoserialnumber.php
Created May 7, 2024 11:27
Auto Serial Number column to a Table in NT
// Auto serial number
add_filter('ninja_table_rendering_table_vars', function($table_vars, $table_id, $tableArray){
$target_id = 1320;
if ($tableArray['table_id'] != $target_id) {
return $table_vars;
}
$counter_column = [
'name' => 'serial',
'key' => 'serial',
@annuman97
annuman97 / NTReadMoreLessButton.js
Created April 8, 2024 10:09
NTReadMoreLessButtonForMultipleColumns
/*Read More text on a table cell */
$(document).ready(function(){
var maxLength = 15; // give character length here
var colNames = ['title','citation', 'summary']; // give your column key here
var readMoreText = "read more..."; // give read more text here
var readLessText = "read less..."; //give read less text here
function limitChar(){
for(i = 0 ; i<colNames.length; i++){
@annuman97
annuman97 / Fluent Form File Upload extensions
Created April 7, 2024 09:02
Fluent Form File Upload extensions
add_filter('fluentform/file_type_options', function ($types) {
$types[] = [
'label' => __('3d files - DWG, STL, STEP, STP, SKP, MAX, FBX, 3DS, IGES, OBJ', 'fluentform'),
'value' => 'dwg|stp|stl|STEP|skp|max|fbx|3ds|iges|obj',
];
return $types;
});
add_filter('upload_mimes', function ($mime_types) {
$mime_types ['dwg'] = 'image/vnd.dwg';