Skip to content

Instantly share code, notes, and snippets.

@ahsannayem
ahsannayem / New Menu for FS
Created April 23, 2025 11:18
Add Menu Item For Fluent Support
add_action('admin_footer', function () {
$screen = get_current_screen();
if (!$screen || strpos($screen->id, 'fluent-support') === false) {
return;
}
?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const checkExist = setInterval(function () {
const menu = document.querySelector('.fframe_menu');
@ahsannayem
ahsannayem / og:image
Last active January 16, 2025 06:32
The featured image is not shown when adding the post link on FluentCommunity or any social platform
function add_open_graph_tags() {
if (is_single() || is_page()) {
global $post;
$featured_image = get_the_post_thumbnail_url($post->ID, 'full');
$default_image = 'https://verenakrone.de/path-to-default-image.jpg'; // Replace with your default image URL
?>
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" />
<meta property="og:image" content="<?php echo $featured_image ? $featured_image : $default_image; ?>" />
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
add_filter('fluent_support/custom_registration_form_fields', function($fields) {
$fields['phone_number'] = [
'required' => false,
'type' => 'number',
'label' => __('Phone Number', 'fluent-support'),
'id' => 'fst_phone_number',
'placeholder' => __('phone_number', 'fluent-support'),
'wrapper_class' => 'fs_half_field',
];
@ahsannayem
ahsannayem / Custom Ticket Status
Created May 2, 2024 06:57
Change Ticket status for Open, Active, Close, New, All
add_filter('fluent_support/ticket_status_groups', function ($statusGroups) {
// Modify the array keys
$statusGroups['khula'] = $statusGroups['open'];
$statusGroups['choler'] = $statusGroups['active'];
$statusGroups['bondo'] = $statusGroups['closed'];
$statusGroups['notun'] = $statusGroups['new'];
$statusGroups['hokol_ticket'] = $statusGroups['all'];
// Remove the old keys if necessary
unset($statusGroups['open']);
@ahsannayem
ahsannayem / Fluent Support Priority
Created April 30, 2024 09:55
Chnage Priority Status For Customer
add_filter('fluent_support/customer_ticket_priorities', function ($priorities) {
// Change 'Normal' to 'priority_1'
$priorities['normal'] = __('priority_1', 'fluent-support');
// Change 'Medium' to 'priority_2'
$priorities['medium'] = __('priority_2', 'fluent-support');
// Change 'Critical' to 'priority_3'
$priorities['critical'] = __('priority_3', 'fluent-support');
@ahsannayem
ahsannayem / gist:199df8c2fe9e963bfeaf35178f71a9eb
Last active March 19, 2024 06:10
Get User Role For Fluent Forms
add_filter('fluentform/rendering_field_data_select', 'populateUserRoleAsDropdownValue', 10, 2);
add_filter('fluentform/editor_init_element_select', 'populateUserRoleAsDropdownValue', 10, 2);
function populateUserRoleAsDropdownValue($data, $form)
{
if ($form->id != '678') {
return $data;
}
// Check if the field name is not what you want
@ahsannayem
ahsannayem / Thank you page delay
Created September 8, 2023 04:50
Fluent Forms' Thank you page delay
$form.on('fluentform_submission_success', function() {
setTimeout(function(){ window.location.assign("http://www.mozilla.org");}, 5000);
});
const textarea = document.getElementById('TextArea_ID'); // Replace the id
textarea.addEventListener('input', function() {
const minTextLength = 10; // Set Minimum required text length
if (textarea.value.length < minTextLength) {
textarea.setCustomValidity('Please enter at least ' + minTextLength + ' characters.');
} else {
textarea.setCustomValidity('');
}
@ahsannayem
ahsannayem / Admin Table For Ninja Table
Last active September 27, 2023 06:01
Show table on the WordPress Deshboard
add_action( 'admin_menu', function () {
add_menu_page( 'Admin View', 'NT Admin', 'manage_options', 'myplugin/myplugin-admin-page.php', function () {
$tableId = 173; // This is ninja table ID;
ninjaRenderTableOnAdmin($tableId);
}, 'dashicons-tickets', 6 );
} );
// Global function to render a table in admin panel
function ninjaRenderTableOnAdmin($tableId)
{