Skip to content

Instantly share code, notes, and snippets.

@annuman97
annuman97 / fluent-forms-qa-post-sync.php
Created September 22, 2026 05:48
Automatically sync Question and Answer fields from Fluent Forms entries to WordPress posts created through the Post Creation Feed. Updates the existing post content when an admin edits the entry and adds an answer, without creating duplicate posts.
<?php
/**
* Fluent Forms: Question & Answer Post Sync
*
* Works with the existing Post Creation Feed.
* Replace 123 with your form ID.
*/
if (!defined('ABSPATH')) {
exit;
@annuman97
annuman97 / fluentcommunity-course-reset-action.php
Created August 26, 2026 10:14
It will create a custom FluentCRM Trigger named 'Reset Course Progress' that will reset the course progress for a user
<?php
add_action('init', function () {
if (
!defined('FLUENTCRM') ||
!class_exists('\FluentCrm\App\Services\Funnel\BaseAction') ||
!class_exists('\FluentCommunity\Modules\Course\Services\CourseHelper') ||
!class_exists('\FluentCommunity\Modules\Course\Model\Course') ||
!class_exists('\FluentCommunity\App\Models\User')
@annuman97
annuman97 / fluentcommunity-custom-waitlist-fluentcrm-tagging.php
Created August 7, 2026 13:37
Upon clicking a Gutenberg button from custom lock screen Description section, user will be added to a CRM tag.
<?php
/**
* Add the user to a FluentCRM tag when a private-space request is submitted.
*/
add_action('fluent_community/space/join_requested', function ($space, $userId, $by) {
if (!defined('FLUENTCRM')) {
return;
}
// Space slug => FluentCRM Tag ID
@annuman97
annuman97 / fluentcommunity-friendly-anonymous-usernames.php
Created July 2, 2026 11:47
Temporary FluentCommunity workaround to generate friendly anonymous WordPress usernames during default signup, helping prevent email-derived usernames from being exposed in mentions or profile UI.
<?php
defined('ABSPATH') || exit;
/**
* Modify FluentCommunity signup fields.
*/
add_filter('fluent_community/auth/signup_fields', function ($fields) {
if (isset($fields['full_name'])) {
/**
* Ninja Tables - Current Month Date Range Filter
*
* Automatically applies the current month date range
* to a Ninja Tables custom date range filter on page load.
*
* Date Format: DD/MM/YYYY
*
* Example:
* From Date: 01/06/2026
/*
# Ninja Tables FooTable Pagination at Top
Moves the existing FooTable pagination controls in Ninja Tables / Ninja Tables Pro from the table footer to above the table.
This is intended for Ninja Tables using the default FooTable renderer.
## Usage
1. Add `JS` to the table's Custom JS field.
@annuman97
annuman97 / fluentforms-preserve-plus-email-redirect.php
Created May 20, 2026 05:44
Temporary Fluent Forms workaround to preserve plus-addressed email values in redirect query strings.
<?php
// Temporary Fluent Forms workaround:
// Preserve plus-addressed emails when passing email through redirect query string.
add_filter('fluentform/submission_confirmation', function ($returnData, $form, $confirmation, $insertId = null, $formData = []) {
$sourceFormId = 29; // Form #1 ID
$emailFieldName = 'email'; // Form #1 email field name
$queryKey = 'email'; // Redirect URL query key: ?email=
if ((int) $form->id !== $sourceFormId || empty($returnData['redirectUrl'])) {
@annuman97
annuman97 / fluentcommunity-basic-pwa-snippet.php
Created May 19, 2026 11:51
A basic PWA snippet for FluentCommunity portal that adds a web app manifest, service worker registration, app-like home screen support, and a simple offline fallback. This is a temporary/basic PWA wrapper and does not include FluentCommunity push notification handling.
<?php
if (!function_exists('fcom_snippet_pwa_portal_start_url')) {
add_action('init', function () {
$fcomPwa = isset($_GET['fcom_pwa']) ? sanitize_key($_GET['fcom_pwa']) : '';
if ($fcomPwa === 'manifest') {
fcom_snippet_pwa_serve_manifest();
}
if ($fcomPwa === 'sw') {
@annuman97
annuman97 / ninja-tables-custom-sql-ajax-chunk-fix.php
Created May 8, 2026 11:39
**Gist Name:** `ninja-tables-custom-sql-ajax-chunk-fix.php` **Description:** Fixes Ninja Tables Pro Custom SQL tables loading only the first Ajax chunk by calculating the real SQL row count and setting the missing chunk metadata, scoped only to `raw_sql` Ajax tables.
<?php
add_filter('ninja_table_rendering_table_vars', function ($tableVars, $tableId) {
if (empty($tableVars['provider']) || $tableVars['provider'] !== 'raw_sql') {
return $tableVars;
}
if (empty($tableVars['render_type']) || $tableVars['render_type'] !== 'ajax_table') {
return $tableVars;
}
@annuman97
annuman97 / fluentcommunity-course-toggle-shortcode.php
Last active April 24, 2026 21:13
FluentCommunity Course Toggle (Collapsible Section) – Shortcode Snippet
<?php
/**
* FluentCommunity Course Toggle (Collapsible Section) – Shortcode Snippet
*
* This snippet adds a simple collapsible / toggle (accordion-style) section
* to FluentCommunity course lessons using a shortcode.
*
* ----------------------
* Usage: