Skip to content

Instantly share code, notes, and snippets.


Shahjahan Jewel techjewel

View GitHub Profile
techjewel / fluentform-submission-success.js
Last active September 14, 2023 13:42
Form submission success JS Event in Fluent Forms
View fluentform-submission-success.js
// 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 / fluentform-checkbox-max-restriction.js
Last active June 21, 2023 23:45
prevent users to check max 3/x items from a checkbox group - Fluent Forms
View fluentform-checkbox-max-restriction.js
* 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
View fluentform-login-form.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
techjewel / sream_function.php
Created June 25, 2016 22:15
Stream a mp3 file using php when you need to protect the file
View sream_function.php
function zcast_stream($file, $content_type = 'application/octet-stream') {
// Make sure the files exists, otherwise we are wasting our time
if (!file_exists($file)) {
header("HTTP/1.1 404 Not Found");
techjewel / Convert Numbers to Words - Bangladesh.php
Last active April 14, 2023 20:51
Convert Numbers to Words - for Bangladeshi counting system
View Convert Numbers to Words - Bangladesh.php
* Function: convert_number
* Description:
* Converts a given integer (in range [0..1T-1], inclusive) into
* alphabetical format ("one", "two", etc.)
* @int
View fluent-forms-learndash-course-enrollment.php
* This snippet is assuming the user already logged in or the provided email address is available in users
* After the form submission the user will be added to the course.
add_action( 'fluentform_submission_inserted', 'ff_register_user_to_learndash_course', 100, 3 );
function ff_register_user_to_learndash_course( $entryId, $formData, $form ) {
// Check if the form is the one we want
View ninja_tables_json_data_api.php
* Code snippet to expose ninja tables data as JSON via URL
* Example URL:
* In this url 1463 is the table ID that you want to access the data using JSON
* You should change the key 'your_security_key' in the url as well in the code
* to protect the endpoint
add_action('init', function() {
techjewel / fluentform-radio-as-button.css
Created May 25, 2020 23:10
Fluent Forms Radio as Buttons
View fluentform-radio-as-button.css
// You can make the inline radio button look like button switch
// Steps:
// Add container class of the element "ff_button_style"
// Select Layout: Inline Layout
// Lastly add this css to custom css of the form
.ff-el-group.ff_list_inline.ff_button_style .ff-el-form-check {
background: #d2d2d2;
margin: 0 !important;
padding: 0 !important;
techjewel / event-for-all-forms.js
Created August 6, 2020 11:27
Track Google Analytics event for all fluent forms in your site
View event-for-all-forms.js
if(typeof gtag != 'function') {
var fluentForms = $('form.frm-fluent-form');
fluentForms.each(function() {
var $form = $(this);
var formId = $form.attr('data-form_id');
gtag('event', 'ViewForm', {
techjewel / NinjaTablesShortcodeUsage.php
Last active December 10, 2022 02:27
Ninja Tables Advanced Shortcode Usage
View NinjaTablesShortcodeUsage.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]