Skip to content

Instantly share code, notes, and snippets.

View nkb-bd's full-sized avatar

Lukman Nakib nkb-bd

View GitHub Profile
@nkb-bd
nkb-bd / fluentform-waf-csrf-header.php
Last active July 28, 2026 05:15
Fluent Forms — add a CSRF-style header to admin-ajax submissions (LiteSpeed/ModSecurity/cPGuard 403 WAF workaround)
<?php
/**
* Fluent Forms — fix admin-ajax 403 blocked by a WAF (LiteSpeed / ModSecurity / cPGuard).
*
* Adds a CSRF-style header to Fluent Forms submissions so the WAF rule stops
* flagging them. Cache-safe. Paste into functions.php or a Code Snippets plugin.
*
* Best fix is still to have your host whitelist the specific ModSecurity rule ID
* for POST /wp-admin/admin-ajax.php.
*/
<?php
/**
* Plugin Name: FluentCRM Page Lock
* Description: Protect WordPress pages with FluentCRM contact verification and tag-based access.
* Version: 1.1.0
* Author: lukman
* Usage as Plugin: Just activate
* Usage in functions.php: require_once 'path/to/fc-page-lock.php';
*/
@nkb-bd
nkb-bd / fluentform_submission_resources.php
Created January 15, 2025 05:05
Adding new column in WP Fluent Form Entries Page
add_filter('fluentform/submission_resources',function ($resources){
$resources['labels'] = [
'my-label' => 'Label Value'
];
return $resources;
});
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@nkb-bd
nkb-bd / client.js
Created March 1, 2024 09:12 — forked from georgestephanis/client.js
This is an example client app to integrate with the WordPress 5.6 Application Passwords system. It walks the user through authenticating, and then queries and enumerates all users on the site.
(function($){
const $root = $( '#root' );
const $stage1 = $( '.stage-1', $root );
const $stage2 = $( '.stage-2', $root );
// If there's no GET string, then no credentials have been passed back. Let's get them.
if ( ! window.location.href.includes('?') ) {
// Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow
const $urlInput = $( 'input[type=url]', $stage1 );
@nkb-bd
nkb-bd / semantic-commit-messages.md
Created January 11, 2024 11:48 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@nkb-bd
nkb-bd / ff-numeric-addon-bttns.php
Created October 4, 2023 17:38
Fluent Forms : Number field with buttons
/*
* Fluent Form : Creating a Number field with + / - Button embeded with the input field
* Take a Numeric Field then add element class 'incremental-input', thats it
*/
add_filter('fluentform/rendering_field_data_input_number', function ($data) {
if ($data['attributes']['class'] == 'incremental-input') {
$data['settings']['prefix_label'] = '<button class="ff-btn-step-plus">+</button>';
$data['settings']['suffix_label'] = '<button class="ff-btn-step-minus">-</button>';
}
return $data;
@nkb-bd
nkb-bd / ff_email_validation.php
Last active February 6, 2025 11:53
Email Validation using wp fluent form
add_filter('fluentform/validate_input_item_input_email', function ($default, $field, $formData, $fields, $form) {
// You may change the following 3 lines
$targetFormIds = [140,141];
$errorMessage = 'Looks like email is not correct'; // You may change here
$emailableApiKey = 'live_b67c9cb0585e27dd256c';
if (!in_array($form->id, $targetFormIds)){
return $default;
}
<!--
hero: https://bulma.io/documentation/layout/hero/
section: https://bulma.io/documentation/layout/section/
image: https://bulma.io/documentation/elements/image/
columns: https://bulma.io/documentation/columns/basics/
media: https://bulma.io/documentation/layout/media-object/
icon: https://bulma.io/documentation/elements/icon/
breadcrumb: https://bulma.io/documentation/components/breadcrumb/
level: https://bulma.io/documentation/layout/level/
-->
@nkb-bd
nkb-bd / file-upload-issue.php
Created March 17, 2023 10:38
ff file upload issue fix
// Please remove and add the file input again to work properly.
add_filter('fluentform_file_type_options', function ($options) {
$options[2]['value'] = 'avi|divx|flv|mov|ogv|mkv|mp4|m4v|divx|mpg|mpeg|mpe|qt';
return $options;
});