See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
add_filter('fluentform/submission_resources',function ($resources){ | |
$resources['labels'] = [ | |
'my-label' => 'Label Value' | |
]; | |
return $resources; | |
}); |
INITIALISATION | |
============== | |
load wp-config.php | |
set up default constants | |
load wp-content/advanced-cache.php if it exists | |
load wp-content/db.php if it exists | |
connect to mysql, select db | |
load object cache (object-cache.php if it exists, or wp-include/cache.php if not) | |
load wp-content/sunrise.php if it exists (multisite only) |
(function($){ | |
const $root = $( '#root' ); | |
const $stage1 = $( '.stage-1', $root ); | |
const $stage2 = $( '.stage-2', $root ); | |
// If there's no GET string, then no credentials have been passed back. Let's get them. | |
if ( ! window.location.href.includes('?') ) { | |
// Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow | |
const $urlInput = $( 'input[type=url]', $stage1 ); |
/* | |
* Fluent Form : Creating a Number field with + / - Button embeded with the input field | |
* Take a Numeric Field then add element class 'incremental-input', thats it | |
*/ | |
add_filter('fluentform/rendering_field_data_input_number', function ($data) { | |
if ($data['attributes']['class'] == 'incremental-input') { | |
$data['settings']['prefix_label'] = '<button class="ff-btn-step-plus">+</button>'; | |
$data['settings']['suffix_label'] = '<button class="ff-btn-step-minus">-</button>'; | |
} | |
return $data; |
add_filter('fluentform/validate_input_item_input_email', function ($default, $field, $formData, $fields, $form) { | |
// You may change the following 3 lines | |
$targetFormIds = [140,141]; | |
$errorMessage = 'Looks like email is not correct'; // You may change here | |
$emailableApiKey = 'live_b67c9cb0585e27dd256c'; | |
if (!in_array($form->id, $targetFormIds)){ | |
return $default; | |
} |
<!-- | |
hero: https://bulma.io/documentation/layout/hero/ | |
section: https://bulma.io/documentation/layout/section/ | |
image: https://bulma.io/documentation/elements/image/ | |
columns: https://bulma.io/documentation/columns/basics/ | |
media: https://bulma.io/documentation/layout/media-object/ | |
icon: https://bulma.io/documentation/elements/icon/ | |
breadcrumb: https://bulma.io/documentation/components/breadcrumb/ | |
level: https://bulma.io/documentation/layout/level/ | |
--> |
// Please remove and add the file input again to work properly. | |
add_filter('fluentform_file_type_options', function ($options) { | |
$options[2]['value'] = 'avi|divx|flv|mov|ogv|mkv|mp4|m4v|divx|mpg|mpeg|mpe|qt'; | |
return $options; | |
}); |
//First Set all permission for the user from the settings | |
add_action('init',function (){ | |
$userId = 18; //Enter User ID (except admin) | |
$formId = 11; //Fluent Form ID | |
customPermissionRule($userId,$formId); | |
}); | |
function customPermissionRule($userId,$formId){ | |
if($userId != get_current_user_id()){ | |
return; |
//adding nonce in extra js inline script | |
add_filter('script_loader_tag', function ($tag, $handle) { | |
if ('script-handler' === $handle) { | |
$nonce = wp_create_nonce(); | |
$tag = str_replace('<script ', "<script nonce='$nonce' ", $tag); | |
} | |
return $tag; | |
}, 10, 2); | |