Skip to content

Instantly share code, notes, and snippets.

View techjewel's full-sized avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile
@techjewel
techjewel / FluentFormCustomImporter.php
Created October 23, 2021 12:55
Fluent Form Importer PHP Class
<?php
class FluentFormCustomImporter
{
protected function getDemoForms()
{
return [
'[{"id":"9","title":"Contact Form Demo","status":"published","appearance_settings":null,"form_fields":{"fields":[{"index":0,"element":"input_name","attributes":{"name":"names","data-type":"name-element"},"settings":{"container_class":"","admin_field_label":"Name","conditional_logics":[]},"fields":{"first_name":{"element":"input_text","attributes":{"type":"text","name":"first_name","value":"","id":"","class":"","placeholder":"First Name"},"settings":{"container_class":"","label":"First Name","help_message":"","visible":true,"validation_rules":{"required":{"value":false,"message":"This field is required"}},"conditional_logics":[]},"editor_options":{"template":"inputText"}},"middle_name":{"element":"input_text","attributes":{"type":"text","name":"middle_name","value":"","id":"","class":"","placeholder":"","required":false},"settings":{"container_class":"","label":"Middle Name","help_message":"","error
@techjewel
techjewel / add_own_custom_forms_demo.php
Created October 21, 2021 13:35
Fluent Forms add custom Demo Forms
<?php
add_filter('fluentform_predefined_forms', function ($demoForms) {
$demoForms['nicolas_form_1'] = array(
'screenshot' => '', // You may add your form screenshot here
'createable' => true,
'title' => 'Form 1 by Nicolas',
'tag' => ["nicolas form"],
<?php
/*
* If you want to return raw provided url without any sanitization and security check then you can use this snippet.
*/
add_filter('fluentform_submission_confirmation', function ($returnData, $form, $confirmation) {
if(empty($returnData['redirectUrl'])) {
return $returnData;
}
@techjewel
techjewel / fluentform-extra-form-settings.php
Created September 13, 2021 08:37
Extra Form Settings for Fluent Forms
<?php
// Inject Link Form Settings Menu
add_filter('fluentform_form_settings_menu', function ($items) {
$items['my_menu_slug'] = [
'title' => 'My Menu Title',
'slug' => 'my_settings_slug'
];
return $items;
@techjewel
techjewel / brpwser-smartcode-fluentform.php
Last active December 16, 2021 16:37
Add Browser Language smartcode on Fluent Forms Editor
<?php
/*
* Add Browser Language smartcode on Fluent Forms Editor
*/
add_filter('fluentform_editor_shortcodes', function ($groups) {
$groups[0]['shortcodes']['{browser_lang}'] = 'Browser Language';
return $groups;
});
add_filter('fluentform_editor_shortcode_callback_browser_lang', function ($val) {
@techjewel
techjewel / fluentform-bulk-option-hook.php
Created August 27, 2021 07:24
Add your own options group for Fluent Forms Editor for Bulk Options
<?php
add_filter('fluentform_editor_vars', function($vars) {
$bulkOptionsJson = $vars['bulk_options_json'];
$arrays = json_decode($bulkOptionsJson, true);
$arrays['New Option Group'] = ['Option 1', 'Option 2'];
$vars['bulk_options_json'] = json_encode($arrays);
return $vars;
});
// required css
<style>
span.ff_submitting {
display: none;
}
.ff-working span.ff_submitting {
display: block;
}
// required css
<style>
span.ff_submitting {
display: none;
}
.ff-working span.ff_submitting {
display: block;
}
<?php
function myFluentCrmTagIdBySlug($slug) {
$tag = \FluentCrm\App\Models\Tag::where('slug', $slug)->first();
if($tag) {
$tagId = $tag->id;
}
<?php
add_action('fluentcrm_confirmation_head', function ($subscriber) {
$redirectUrl = 'https://google.com'; // Change this url;
echo '<meta http-equiv="refresh" content="0; URL='.$redirectUrl.'" />';
});