Skip to content

Instantly share code, notes, and snippets.

View techjewel's full-sized avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile
@techjewel
techjewel / fluentform-submission-success.js
Last active September 25, 2024 15:15
Form submission success JS Event in Fluent Forms
// Event on form submission success
// You can paste this script to Form's custom JS Box
$form.on('fluentform_submission_success', function() {
// You can run your own JS and will be run on successful form submission
});
@techjewel
techjewel / fluentform-checkbox-max-restriction.js
Last active August 22, 2024 20:46
prevent users to check max 3/x items from a checkbox group - Fluent Forms
/**
* Function to prevent users mark more than expected items.
* This code must need to be placed in custom JS of your form
* @param: containerClass String - The contaner class of the target checkbox block.
* You can add a custom container class in the form settings
*
* @param: maxChecked Integer - Max Number of items user can mark
* @return: void
*
*/
@techjewel
techjewel / CapFirstLetter.js
Created May 22, 2020 15:35
Capitalize First Letter of Name Input Field in Fluent Forms
/*
* Add this js snippet in Form's JS box
*/
function capitalizeFLetter() {
var $input = $form.find('.ff-name-field-wrapper').find('input');
$input.on('blur', function() {
var string = $(this).val();
if(string) {
string = string[0].toUpperCase() + string.slice(1);
@techjewel
techjewel / tmpl.js
Last active April 26, 2024 08:45
Simple JS Templating
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// source http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
@techjewel
techjewel / fcrm_contact_count.php
Created January 25, 2024 14:57
get contact count by tag ids
<?php
/*
* FluentCRM get contact count by tag ids
* Example Usage: fcrmGetContactCountByTagIds([1,2,4]);
* @param array $tagIds
* @return int
*/
function fcrmGetContactCountByTagIds($tagIds = [])
{
@techjewel
techjewel / fluentform-email-attachment.php
Last active December 31, 2023 15:13
Add Attachment to the email notification programatically in Fluent Forms.
<?php
/*
* Add Attachment to the email notification dynamically.
* @param $attachments array - Array of the attachments.
* @param $notification array - Email Notification array
* @param $form object - The Form Object
* @param $data array - The input submission data
* @return array
*/
@techjewel
techjewel / woo-filter-by-payment-gateway.php
Last active December 21, 2023 05:26
Filter WooCommerce orders by payment gateway
<?php // do not include this line in FluentSnippets
add_action('woocommerce_order_list_table_restrict_manage_orders', function($type) {
if ( 'shop_order' !== $type ) {
return;
}
// get all payment methods, even inactive ones
@media (max-width: 767px) {
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check span {
width: 100% !important;
border-left: 1px solid #dcdfe6 !important;
border-radius: 0 !important;
}
.fluentform .ff-el-group.ff_list_buttons .ff-el-form-check {
margin-top: -1px !important;
display: block !important;
@techjewel
techjewel / NinjaTablesShortcodeUsage.php
Last active November 1, 2023 21:06
Ninja Tables Advanced Shortcode Usage
<?php
// The following Table Shortcode will show 5 rows per page
[ninja_tables id='YOUR TABLE ID HERE' per_page=5]
// The following Table Shortcode will not show search bar
[ninja_tables id='YOUR TABLE ID HERE' search=0]
// The following Table shorcode will disable table sorting
[ninja_tables id='YOUR TABLE ID HERE' sorting=0]
<?php
/*
* Code snippet to make login form with Fluent Forms WordPress Plugins
* Steps:
* 1. make a form with email and password (Make sure the name attribute is 'email' and 'password' for corresponding field)
* 2. Paste the shorcode in a page
* 3. Change the form id in the bellow code (23) with your created fluentform's form id and paste in your theme's functions.php file
* 4. That's it
*