Skip to content

Instantly share code, notes, and snippets.

add_filter('ninja_table_raw_sql_placeholders', function ($value) {
$value['{name}'] = 'kamrul';
return $value;
});
@alex-authlab
alex-authlab / ff-reset-user-pass.php
Created January 23, 2021 09:24
wp fluent form reset user pass
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 8) { // 23 is your form id. Change the 23 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [
@alex-authlab
alex-authlab / fluent-form-address-autcomplete.php
Last active January 13, 2023 15:44
Fluent Form populate address fields from API
add_filter('fluentform_rendering_field_data_address', function ($data,$form)
{
// your form id
if($form->id != 1) {
return $data;
}
// the base adress field name
$addressField = 'address_1';
if( $data['attributes']['name'] != $addressField ){
/*
* The following functions will add additional file types option to your file upload element
* In this case, You can enable .dwg file format
* Just add this snippet to your theme's functions.php file or relevant place.
*/
add_filter('fluentform_file_type_options', function ($types) {
$types[] = [
'label' => __('Autocad Files (dwg)', 'fluentform'),
'value' => 'dwg',
@alex-authlab
alex-authlab / ninja-table-serial.php
Created January 11, 2021 17:04
WP Ninja Table Serial Column
add_filter('ninja_table_rendering_table_vars',function($table_vars, $table_id, $tableArray){
$target_id = 5;
if($tableArray['table_id'] != $target_id) { return $table_vars; }
$counter_column = [
'name' => 'serial',
'key' => 'serial',
'title' => 'Serial',
];
array_unshift($table_vars['columns'], $counter_column);
@alex-authlab
alex-authlab / custom-entry-status.php
Created December 14, 2020 08:03
Custom Entry Status For Fluent Forms
<?php
/*
1. Add this in theme function.php or any PHP snippet plugin
2. Add your own status in the array
*/
add_filter('fluentform_entry_statuses',function($data){
$new_stat = [
'checking'=> 'Checking',
'complete'=>'Completed'
@alex-authlab
alex-authlab / ff-user-email-verification.php
Last active December 15, 2020 21:02
Email verification add-on plugin for user created with Fluent Form Plugin
<?php
/*
Plugin Name: Fluent Form User Email Verification
Description: Fluent Form User Email Verification
Version: 1.0
Author: WPManageNinja Support Team
Author URI: https://wpmanageninja.com
Plugin URI: https://wpmanageninja.com
License: GPLv2 or later
Text Domain: fluentform
@alex-authlab
alex-authlab / ff-dropdown-from-google-sheet.php
Last active December 10, 2021 14:25
Populate WP fluent form dropdown from Google sheet
add_filter('fluenform_rendering_field_data_select', function ($data, $form) {
if ($form->id != 3) {
return $data;
}
// check if the name attriibute is 'dropdown' , it is by default dropdown for the first dropdown input
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'dropdown') {
return $data;
@alex-authlab
alex-authlab / dynamic_data.php
Created December 5, 2020 10:14 — forked from techjewel/dynamic_data.php
Dynamic Data Manipulation in Ninja Tables
<?php
/*
* Say we want to change data of table id 1477 then you can write the following
* code.
* $data is the array of frontend data
*/
add_filter('ninja_tables_get_public_data', function ($data, $tableId) {
if ($tableId == 1477) {
$data[] = [
'name' => 'Dynaic Name',
@alex-authlab
alex-authlab / hide-form-ff-ip.php
Last active December 4, 2020 08:41
Fluent Form : Hide form after submission for the same user using IP
add_action('fluentform_before_form_render', 'ff_single_entry_per_user', 10, 1);
function ff_single_entry_per_user( $form )
{
$target_form_id = 1;
$message = "Submission Done! Thanks.";
$hideForm = true;
if($form->id !=$target_form_id ){
return;