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 / replyPrompt.js
Created August 25, 2023 20:58
Always keep FS reply prompt open on customer end
if (window.location.hash.includes('ticket') && window.fs_customer_portal) {
setTimeout(function(){
jQuery('.fs_reply_text').click();
}, 100);
}
@rafiahmedd
rafiahmedd / StopUserFromTicketCreate.php
Created October 3, 2022 21:28
Stop fluent support user from opening a ticket via email piping if the user not exist in fluent crm
<?php
add_action('fluent_support/before_ticket_create_from_email', function($responseOrTicketData, $customer){
if (function_exists('FluentCrmApi')){
$contactApi = FluentCrmApi('contacts');
$contact = $contactApi->getContact($customer->email);
if (!$contact) {
exit;
}
}
}, 10, 2);
@rafiahmedd
rafiahmedd / characters_frequencies.py
Created April 11, 2022 20:56
Write a program that asks the user to enter a string and prints the string's characters and their frequencies in any order and in the following format
string = input("Enter a string: ")
dictonary = {}
for char in string:
dictonary[char] = dictonary.get(char, 0) + 1
for key, value in dictonary.items():
print(f"{key}: {value}")
@rafiahmedd
rafiahmedd / Send Message to whatsapp after submiting the form
Created March 12, 2022 10:37
Send Message to whatsapp after submiting the form
//Method 1
var form = $('#fluentform_1976'); //YOUR FORM ID HERE
form.on('submit',function(){
var firstName = $('#ff_1976_names_first_name_').val(); // YOUR FORM INPUT NAME ID HERE
var lastName = $('#ff_1976_names_last_name_').val(); // YOUR FORM INPUT NAME ID HERE
window.location = 'http://api.whatsapp.com/send?phone=5521997832127&text=Quero-Desenhar%0A%20'+firstName+'%20'+lastName;
});
//Method 2
var firstNameKey = "first_name"; // give your first name fields Name attributes
[
{
"metadata": {
"id": "d4be9b84-09b5-42d9-83e3-a0135f3a807c",
"publisherId": "anthonydiametrix.ACF-Snippet",
"publisherDisplayName": "anthonydiametrix"
},
"name": "ACF-Snippet",
"publisher": "anthonydiametrix",
"version": "1.9.0"
@rafiahmedd
rafiahmedd / ffbooking.php
Last active October 22, 2022 00:41
FF Booking system
<?php
add_action( 'wp_footer', 'booking', 999999999);
function booking(){
$formId = 43; //Target a specific form here by id
$fields = wpFluent()->table('fluentform_submissions')
->where('form_id', $formId)
->get();
$toDisable = [];
foreach ($fields as $key=>$value) {
$response = json_decode($value->response);
@rafiahmedd
rafiahmedd / Text Counter with word limit
Created September 10, 2021 10:19
Text Counter with word limit
let max = $('.max').val();
$('.text').keydown(count);
function count(event) {
let len = $('.text').val().split(/[\s]+/);
if (len.length > max) {
if ( event.keyCode == 46 || event.keyCode == 8 ) {// Allow backspace and delete buttons
} else if (event.keyCode < 48 || event.keyCode > 57 ) {//all other buttons
event.preventDefault();
@rafiahmedd
rafiahmedd / EmailAttachmentfromAExternalLink.php
Last active September 10, 2021 08:51
EmailAttachmentfromAExternalLink.php
@rafiahmedd
rafiahmedd / Calculate Number in ff
Created September 9, 2021 10:49
Calculate Number in ff
const btn = document.querySelector('.calculate');
btn.type = 'button';
let numbers = document.querySelectorAll('form [type="number"]');
numbers[numbers.length-1].closest('div').parentElement.insertAdjacentHTML('afterend',`<span class="calc"></span>`);
const resultEl = document.querySelector('.calc');
resultEl.style.display = 'none';
@rafiahmedd
rafiahmedd / Delete wp_fluentform_form_analytics data automatically in each month
Created September 2, 2021 17:45
Delete wp_fluentform_form_analytics data automatically in each month
/**
* Use this code only inside the functions.php file
* this method will register event to WordPress init
*/
add_action( 'init', 'registerCronForAutoDeleteDbTable');
function registerCronForAutoDeleteDbTable(){
if( !wp_next_scheduled( 'delete_data_after_month' ) ) {
// schedule an event
wp_schedule_event( time(), 'monthly', 'delete_data_after_month' );