Skip to content

Instantly share code, notes, and snippets.

@annuman97
annuman97 / MaxSpacesperUser.php
Last active December 29, 2025 05:51
Limit how many FluentCommunity Spaces a user can join. Applies to both Active and Pending memberships
<?php
add_filter('rest_pre_dispatch', function ($result, $server, $request) {
// If another handler already returned something, respect it
if (!empty($result)) {
return $result;
}
@annuman97
annuman97 / courses_and_courses?type=enrolled.php
Created November 17, 2025 08:07
All Courses and courses?type=enrolled menu
add_action('template_redirect', function () {
if (!class_exists('\FluentCommunity\App\Services\Helper')) {
return;
}
global $wp;
$req = isset($wp->request)
? $wp->request
: trim(parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH), '/');
@annuman97
annuman97 / enrolledCourse.php
Created November 14, 2025 09:45
Enrolled course tab in Commumity Navbar.
// Put this in: theme's functions.php OR a small custom plugin OR Code Snippets.
add_action('fluent_community/after_header_menu', function ($context) {
?>
<script>
(function () {
// Change this selector if your menu item key is different
const MENU_ITEM_SELECTOR = '.fcom_menu_item_fcom_custom_teset a';
document.addEventListener('click', function (e) {
const link = e.target.closest(MENU_ITEM_SELECTOR);
@annuman97
annuman97 / webhhook-trigger-after-double-opt-in.php
Created October 1, 2025 12:04
Trigger Webhook after confirming the double opt-in in Fluent Forms
<?php
/**
* Handling the fluent form entry confirmation hook that is triggered on double optin confirmation
* for forms that have that option enabled (this part is coded as webhook UI for fluent forms triggers
* upon form submission, before the user as double opted in. This is the only way
* to access the confirmation hook.
*
* This module will trigger 2 webhooks :
* 1-to add the email to the encharge subscriber list
* 2-to create or update a contact in one page CRM for the subcriber
@annuman97
annuman97 / fb_to_ff_duration_timeDate.js
Created September 26, 2025 12:06
Fluent Booking Meeting Duration and Selected Time and Date
let pickedSlot = '';
let pickedDurationNum = '';
function getDurationNumber() {
const sel = document.querySelector('.fcal_multi_duration .fcal_duration.is_selected');
if (sel) {
const txt = sel.textContent.replace(/\s+/g, ' ').trim(); // "45 Minutes"
const m = txt.match(/\d+/);
if (m) return m[0];
@annuman97
annuman97 / booking_dateTime_to_ff_input_field.js
Created September 25, 2025 17:58
Take booking seleccted date and time to the fluent form input field in order to put the value in custom html field.
let pickedSlot = ''; //picked value from calendar
document.addEventListener('click', function (e) {
const spot = e.target.closest('.fcal_spot');
const next = e.target.closest('.ff-btn-next');
if (spot) {
setTimeout(() => {
const el = document.querySelector('.slot_time_range span');
@annuman97
annuman97 / external_scripts_fluent_community.php
Created September 5, 2025 11:17
When you need to add external scripts to the community portal frontend.
add_action('fluent_community/portal_head', function () {
wp_enqueue_script(
'my-ext-on-portal',
'https://cdn.example.com/sdk.min.js',
[],
null,
false
);
@annuman97
annuman97 / custom_ff_userCase.js
Last active August 29, 2025 09:34
Custom Fluent Form use case where if required checkboxes are not selected it will won't go to next step and show a validation error message.
(function () {
var FORM_ID = 47; //Your Form ID
function q(form, sel) { return form.querySelector(sel); }
function qa(form, sel) { return form.querySelectorAll(sel); }
function getErrorStack(form) {
return q(form, '#fluentform_' + FORM_ID + '_errors');
}
@annuman97
annuman97 / ninja_tables_rowspan.js
Created August 28, 2025 11:00
Ninja Tables: JS code for RowSpan. Add the code to the table's custom CSS section and add the class 'combine' to the column advanced setting where you want to add rowspan
/*!
* jQuery Rowspanizer Plugin (Modified) v0.2
* https://github.com/marcosesperon/jquery.rowspanizer.js
*
* Copyright 2011, 2015 Marcos Esperón
* Released under the MIT license
*
* https://github.com/jquery-boilerplate/boilerplate/
*/
;( function( $, window, document, undefined ) {
@annuman97
annuman97 / highlight_words_in_community_post.php
Last active August 13, 2025 09:48
Search and style the Words in the Community Post content
add_action('fluent_community/portal_head', function() {
?>
<style>
.highlighted-day {
background-color: yellow !important;
color: blue !important;
padding: 2px 4px;
border-radius: 3px;
font-weight: bold;
}