Skip to content

Instantly share code, notes, and snippets.

View rafiahmedd's full-sized avatar
💻
def code:

Rafi Ahmed rafiahmedd

💻
def code:
View GitHub Profile
@rafiahmedd
rafiahmedd / Disable stripe connect mode
Created September 2, 2021 10:33
Disable stripe connect mode
add_filter('fluent_form_disable_stripe_connect', '__return_true');
@rafiahmedd
rafiahmedd / doSomethingAfterPaymentStatusChange-in-wppayform.php
Last active May 19, 2022 09:25
doSomethingAfterPaymentStatusChange-in-wppayform
<?php
/**
* doSomethingAfterPaymentStatusChange in wppayform
* please add this code in theme's functions.php file
*/
use WPPayForm\Classes\Models\Submission;
use WPPayForm\Classes\Models\OrderItem;
function doSomethingAfterPaymentStatusChange($submissionId, $newStatus, $payment_status){
$submissionModel = new Submission();
@rafiahmedd
rafiahmedd / Auto click on next button if date is selected FF
Created August 31, 2021 09:48
Auto click on next button if date is selected FF
let dateTimeFields = document.querySelectorAll('[data-type-datepicker]');
dateTimeFields.forEach((dateTimeField) => {
dateTimeField.addEventListener('change', function (e){
if (e.target.value) {
document.querySelector('.ff-btn-next').click();
}
});
});
@rafiahmedd
rafiahmedd / Add users to a list or tag who subscribe last week from today in CRM and trigger an email automation
Last active August 26, 2021 21:51
Add users to a list or tag who subscribe last week from today in CRM and trigger an email automation
/**
* Please use this code inside the theme function.php file
* or it can throw error on your site
*/
/**
* this method will register event to WordPress init
*/
add_action( 'init', 'SendEmailToLastWeekContacts');
@rafiahmedd
rafiahmedd / Add more bulk option in FF radio, dropdown & checkbox field
Last active November 9, 2022 07:08
Add more bulk option in FF radio, dropdown & checkbox field
add_filter('fluentform_editor_vars', function($arr){
$agents['agents'] = '"Agents":["Tahmid","Nayan","Rajon","Numan","Khoyer","Jafor","Kamrul","Mahdi","Rafi","Kamran","Ahsan"],';
$tmp = str_replace(array( '{', '}' ), '', $arr['bulk_options_json']);
$data = $agents['agents'].$tmp;
$arr['bulk_options_json'] = '{' . $data . '}';
return $arr;
}, 10, 1);
@rafiahmedd
rafiahmedd / Make Number Field Unique
Created August 24, 2021 09:12
Make Number Field Unique FF
add_filter('fluentform_validate_input_item_input_number', function ($errorMessage, $field, $formData, $fields, $form) {
$fieldName = 'numeric';
$target_form_id = 13;
if($target_form_id != $form->id){ return $errorMessage; }
if ($inputValue = \FluentForm\Framework\Helpers\ArrayHelper::get($formData, $fieldName)) {
$exist = wpFluent()->table('fluentform_entry_details')
@rafiahmedd
rafiahmedd / Calculate Total Hours Minutes in Ninja Tables
Last active August 31, 2021 12:59
Calculate Total Hours Minutes in Ninja Tables
function calc(){
let time = document.querySelectorAll('td.ninja_clmn_nm_tunnid');
let hours = 0;
let minute = 0;
let second = 0;
let totalHours = 0;
let newMinutes = 0;
for(let temp of time){
let [hh,mm,ss] = temp.innerText.split(':');
@rafiahmedd
rafiahmedd / Add user to a CRM list base on the inputed number in Fluent Forms
Created August 23, 2021 09:54
Add user to a CRM list base on the inputed number in Fluent Forms
add_action('fluentform_submission_inserted', 'addUserToList', 20, 3);
function addUserToList($entryId, $formData, $form)
{
$contactApi = FluentCrmApi('contacts');
$contact = $contactApi->getContact($formData['id_number']); // Finding the contact from form ID field
$list = [3]; // List ID number where you want to assign the user
return $contact->attachLists($list); // Adding the contact to a list
}
@rafiahmedd
rafiahmedd / Block-WpPayForm-submission-if-maximum-quantity-limit-reached.php
Last active May 19, 2022 09:21
Block-WpPayForm-submission-if-maximum-quantity-limit-reached.php
<?php
add_filter('wppayform/validate_data_on_submission_item_quantity',function( $error, $elementId, $element, $form_data){
global $wpdb;
$formId = 46; //Please Add Your Form ID here
$transactions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpf_order_transactions WHERE form_id = {$formId}" );
$orders = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpf_order_items WHERE form_id = {$formId}" );
$orderQuantity = [];
$limit = 10; //Please Add Your Total Limit Here
for ($i = 0; $i < count($transactions); $i++) {
@rafiahmedd
rafiahmedd / Add $ sign to Ninja Tables price columns & No Price text to blank fields
Created August 18, 2021 17:56
Add $ sign to Ninja Tables price columns & No Price text to blank fields
const className = "price_format";
function addSign(){
let val = parseInt(jQuery("td."+className).text());
let value = $("td."+className).html();
if(value.length<1){
jQuery("td."+className).html('No Price');
}
else if($("td."+className).is(':empty')){