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 / Add more name prefix in Fluent CRM
Created August 16, 2021 05:29
Add more name prefix in Fluent CRM
add_filter('fluentcrm_contact_name_prefixes',function ($title){
$newTitles = ['Ahmed','Md'];
return array_merge($title,$newTitles);
},10,1);
@rafiahmedd
rafiahmedd / Add PSD, AI, EPS file for upload in ff
Created August 16, 2021 05:31
Add PSD, AI, EPS file for upload in ff
add_filter('fluentform_file_type_options', function ($types) {
$types []= [
'label' => __('PSD, AI & EPS Files', 'fluentform'),
'value' => 'psd|ai|eps',
];
return $types;
});
add_action('fluentform_starting_file_upload', function () {
@rafiahmedd
rafiahmedd / Add a preview system in FF file upload field
Created August 17, 2021 10:44
Add a preview system in FF file upload field
$('.ff_file_upload_holder').each(function(){
$(this).change(function(){
let uploadField = $(this).next().children();
let fileLink = uploadField.attr('data-src');
if(fileLink){
uploadField.children('.ff-upload-thumb').click(function(){
window.open(fileLink,'blank');
});
@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')){
@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 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 / 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 / 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 / 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 / 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');