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 / Email to Admin After User Unsubscribe From CRM With Unsubscribe Reason
Created August 4, 2021 22:53
Email to Admin After User Unsubscribe From CRM With Unsubscribe Reason
add_action('fluentcrm_subscriber_status_to_unsubscribed', 'emailAfterUnsubscribed', 10, 2);
function emailAfterUnsubscribed($subscriber, $oldStatus){
$req = FluentCrm('request');
$reason = sanitize_text_field($req->get('reason'));
if ($reason == 'other') {
if ($otherReason = $req->get('other_reason')) {
$reason = sanitize_text_field($otherReason);
}
} else if($reason){
if ( method_exists('ExternalPages', 'unsubscribeReasons' ) ) {
@rafiahmedd
rafiahmedd / Track disable in CRM
Created August 4, 2021 22:53
Track disable in CRM
add_filter('fluentcrm_disable_email_open_tracking', '__return_true');
add_filter('fluentcrm_track_click', '__return_false');
@rafiahmedd
rafiahmedd / FF nonce verify
Created August 4, 2021 22:54
FF nonce verify
add_filter('fluentform_nonce_verify', '__return_false');
@rafiahmedd
rafiahmedd / Add new number format on fluent form.php
Last active September 9, 2021 13:14
Add new number format on fluent form
add_filter('fluentform_numeric_styles',function($old){
$new['dot_space_style']= array(
'value' => 'dot_space_style',
'label' => __('EU Style with Decimal (Ex: 123 456,00)', 'fluentform'),
'settings' => [
'decimal' => ',',
'separator' => ' ',
'precision' => 2,
'symbol' => ''
]
@rafiahmedd
rafiahmedd / Remove unique hash from image file in FF
Created August 4, 2021 22:55
Remove unique hash from image file in FF
add_filter('fluentform_uploaded_file_name', function($file, $originalArray){
unset($file); //Use to remove the uniqid from the file name don't unset this if you want the file name as a unique one
return $originalArray;
},10,2);
@rafiahmedd
rafiahmedd / Change both GDPR & Terms and Condition Response data
Created August 4, 2021 22:55
Change both GDPR & Terms and Condition Response data
$types = [
'gdpr_agreement',
'terms_and_condition',
];
foreach($types as $type){
add_filter('fluentform_response_render_'.$type,'changeGdprText',20,4);
}
function changeGdprText($response, $field, $form_id, $isLabel){
if($form_id=36){
$response = 'True';
@rafiahmedd
rafiahmedd / Make Entry uppercase on submission Fluent Form
Created August 4, 2021 22:57
Make Entry uppercase on submission Fluent Form
add_filter('fluentform_insert_response_data', 'ff_custom_response_data_filter_function', 10, 3);
function ff_custom_response_data_filter_function($formData, $formId, $inputConfigs)
{
if($formId = 12 || 22) {
$names = $formData['names'] = array_map('strtoupper', $formData['names']);
unset($formData['names']);
$others = $formData = array_map('strtoupper', $formData);
$others['names'] = $names;
return $others;
@rafiahmedd
rafiahmedd / Add more contact type in CRM
Created August 4, 2021 22:57
Add more contact type in CRM
add_filter( 'fluentcrm_contact_types', 'custom_contact_type' );
function custom_contact_type($array) {
return array_merge( $array, array( 'one', 'two' ) );
}
@rafiahmedd
rafiahmedd / Change step status in ff forms
Created August 4, 2021 22:59
Change step status in ff forms
add_filter('fluentform_step_string', function($text){
$text = __('Step %activeStep% of %totalStep%', 'fluentform');
return $text;
});
@rafiahmedd
rafiahmedd / Match two email to in Fluent Forms for multiple forms
Last active August 18, 2021 13:57
Match two email to in Fluent Forms for multiple forms
add_filter('fluentform_validate_input_item_input_email', function($errorMessage, $field, $formData, $fields, $form) {
$targeted_forms =[22,23,24,25];
$target_form_id = 0;
foreach ($targeted_forms as $id){
if($form->id == $id){
$target_form_id = $id;
}
}
if($form->id != $target_form_id ) {