### Customize coupon discount text examples
Source: https://formidableforms.com/knowledgebase/frm_coupon_discount_text
Examples showing how to return custom strings or HTML for the coupon discount display.
```php
add_filter(
'frm_coupon_discount_text',
function ( $discount_text, $args ) {
return '[detailed_discount]';
},
10,
2
);
add_filter(
'frm_coupon_discount_text',
function ( $discount_text, $args ) {
return '[code]';
},
10,
2
);
```
--------------------------------
### Shortcode Parameter Examples
Source: https://formidableforms.com/knowledgebase/insert-a-link-to-change-the-value-of-a-single-field
Examples demonstrating the use of various shortcode parameters for dynamic IDs, field selection, and link customization.
```shortcode
[frm-entry-update-field id=[id] field_id=y value="Updated"]
```
```shortcode
[frm-entry-update-field id=x field_id=105 value="Updated"]
```
```shortcode
[frm-entry-update-field id=x field_id=y value="[100]"]
```
```shortcode
[frm-entry-update-field id=x field_id=y value="Updated" label="Update"]
```
```shortcode
[frm-entry-update-field id=x field_id=y value="Updated" class="my_class"]
```
```shortcode
[frm-entry-update-field id=x field_id=y value="Updated" message="The field has been updated"]
```
```shortcode
Usage: [frm-entry-update-field id=x field_id=y value="Updated" title="Click to update"]
```
--------------------------------
### Retrieve Entry Object Example
Source: https://formidableforms.com/knowledgebase/frm_include_meta_keys
Example of how an entry object is retrieved when using the hook.
```php
$entry = FrmEntry::getOne( $id, true)
```
--------------------------------
### Custom Styled Table Example
Source: https://formidableforms.com/knowledgebase/email-styler
A complete example demonstrating how to nest table shortcodes with attributes to create a formatted email table.
```shortcode
[frm_table no_border_bottom="1"]
[frm_tr class="header-row"]
[frm_th no_border_top="1"]Customer Name[/frm_th]
[frm_td no_border_top="1"]Order Total[/frm_td]
[/frm_tr]
[frm_tr]
[frm_th]John Smith[/frm_th]
[frm_td]$150.00[/frm_td]
[/frm_tr]
[/frm_table]
```
--------------------------------
### Coupon Code Entry Example
Source: https://formidableforms.com/knowledgebase/how-to-add-a-coupon-code-field
Example values for the Coupon Code and Discount Amount fields in the management form.
```text
BlackFriday2016
```
```text
.10
```
--------------------------------
### Example of Multiple Search Parameters in Redirect URL
Source: https://formidableforms.com/knowledgebase/create-custom-search-form
This example shows how to construct a redirect URL with multiple search parameters. Ensure parameter names match those used in the Results View filters.
```url
http://yourwebsite.com/results-page/?fname=25&lname=26&state=27
```
--------------------------------
### Input Mask Examples
Source: https://formidableforms.com/knowledgebase/format
Use these examples to set specific formats for fields like phone numbers or social security numbers. The input mask helps users enter data correctly.
```text
(999)999-9999
```
```text
999-99-9999
```
```text
99999?9
```
```text
aaaa*
```
--------------------------------
### Implement frm_export_view_options_saved callback
Source: https://formidableforms.com/knowledgebase/frm_export_view_options_saved
Full example showing both the action registration and the callback function definition.
```php
add_action( 'frm_export_view_options_saved', 'after_export_view_options_saved' );
function after_export_view_options_saved( $settings ) {
// Do something after export view options have been saved.
}
```
--------------------------------
### Example: Change user role on complete payment
Source: https://formidableforms.com/knowledgebase/frm_payment_status_complete
This example shows how to change a user's role to a specified role upon successful payment completion. It handles both one-time and recurring payments.
```APIDOC
## Example: Change user role on complete payment
### Description
Updates a user's role to a new role upon successful payment completion. This hook fires for each payment completion, including recurring ones.
### Method
add_action
### Endpoint
N/A (WordPress Hook)
### Parameters
#### Arguments
- **atts** (array) - An array containing payment details.
- **payment** (object) - Payment information.
- **item_id** (int) - The ID of the item associated with the payment, potentially the entry ID.
- **action_id** (int) - The ID of the payment action.
### Request Example
```php
add_action( 'frm_payment_status_complete', 'frm_change_the_role' );
function frm_change_the_role( $atts ) {
$new_role = 'contributor'; // Set the desired new user role
$entry = isset( $atts['entry'] ) ? $atts['entry'] : $atts['payment']->item_id;
if ( is_numeric( $entry ) ) {
$entry = FrmEntry::getOne( $entry );
}
$user_id = $entry->user_id;
if ( ! empty( $user_id ) ) {
$user = get_userdata($user_id);
if ( ! $user ) {
return; // Exit if user does not exist
}
$updated_user = (array) $user;
// Prevent downgrading administrators
$user_roles = $user->roles;
$user_role = array_shift( $user_roles );
if ( $user_role == 'administrator' ) {
return;
}
$updated_user['role'] = $new_role;
wp_update_user( $updated_user );
}
}
```
### Response
N/A
```
--------------------------------
### Get Support
Source: https://formidableforms.com/knowledgebase-category/customize-the-email-notification
Information on how to get support for Formidable Forms.
```APIDOC
## Get Support
If you can't find what you're looking for, our support team is available to help.
### Contact Customer Support
We have a dedicated team committed to helping you achieve your goals.
### Social Media
- LinkedIn
- Twitter
- Facebook
- YouTube
- Instagram
```
--------------------------------
### Example: Trigger an action on complete payment
Source: https://formidableforms.com/knowledgebase/frm_payment_status_complete
This code example demonstrates how to use the `frm_payment_status_complete` hook to send an email when a payment is marked as 'complete' for a specific payment action ID.
```APIDOC
## Example: Trigger an action on complete payment
### Description
Sends an email notification when a payment is successfully completed for a designated payment action.
### Method
add_action
### Endpoint
N/A (WordPress Hook)
### Parameters
#### Arguments
- **atts** (array) - An array containing payment details, including the `payment` object.
- **payment** (object) - Payment information.
- **status** (string) - The status of the payment.
- **amount** (float) - The amount of the payment.
- **action_id** (int) - The ID of the payment action.
### Request Example
```php
add_action( 'frm_payment_status_complete', 'frm_trigger_action_payment_complete' );
function frm_trigger_action_payment_complete( $atts ) {
$target_action_id = 450; // Replace 450 with your specific payment action ID
if ( $atts['payment']->status == 'complete' && $target_action_id === (int) $atts['payment']->action_id ) {
$to = get_option( 'admin_email' );
$subject = 'Payment complete';
$body = 'Payment made for $' . $atts['payment']->amount;
$headers = array( 'Content-Type: text/html; charset=UTF-8' );
wp_mail( $to, $subject, $body, $headers );
}
}
```
### Response
N/A
```
--------------------------------
### Example: Retrieve a PaymentIntent ID
Source: https://formidableforms.com/knowledgebase/frm_payment_status_complete
This example demonstrates how to retrieve a PaymentIntent ID from the URL parameters when the `frm_payment_status_complete` hook is triggered.
```APIDOC
## Example: Retrieve a PaymentIntent ID
### Description
Retrieves the PaymentIntent ID from the URL query parameters when the payment status is completed.
### Method
add_action
### Endpoint
N/A (WordPress Hook)
### Parameters
#### Arguments
- **atts** (array) - An array containing payment details.
### Request Example
```php
add_action( 'frm_payment_status_complete', function ( $atts ) {
$intent_id = FrmAppHelper::simple_get( 'payment_intent' );
if ( empty( $intent_id ) ) {
return;
}
// Use the $intent_id variable here for further processing
} );
```
### Response
N/A
```
--------------------------------
### Basic frm_custom_html Hook Example
Source: https://formidableforms.com/knowledgebase/frm_custom_html
A simple example demonstrating how to hook into frm_custom_html. This snippet returns the default HTML without modification.
```php
add_filter('frm_custom_html', 'frm_customize_html', 20, 2);
function frm_customize_html($default_html, $field_type){
//$default_html = 'change HTML here';
return $default_html;
}
```
--------------------------------
### Example Email Output
Source: https://formidableforms.com/knowledgebase/email-notifications
The rendered output of the field label and value shortcode combination.
```text
What is your name?: John
```
--------------------------------
### Change the login message
Source: https://formidableforms.com/knowledgebase/frm_global_login_msg
Example showing how to override the default login message string.
```php
add_filter( 'frm_global_login_msg', 'change_message' );
function change_message( $message ) {
$message = 'place new message here';
return $message;
}
```
--------------------------------
### Calculate Days Difference in Views
Source: https://formidableforms.com/knowledgebase/date
Shortcode examples for displaying the difference between dates within a View.
```shortcode
[frm-days-diff start="[100]"]
```
```shortcode
[frm-days-diff start="[100]" finish="[101]"]
```
```shortcode
[frm-days-diff start="[created-at format='d-m-Y']"]
```
--------------------------------
### Reduce the ChatGPT model temperature
Source: https://formidableforms.com/knowledgebase/frm_ai_data
Example of modifying the temperature parameter to achieve a more focused AI response.
```php
add_filter( 'frm_ai_data', 'frm_reduce_ai_temp' );
function frm_reduce_ai_temp( $data ) {
$data['temperature'] = 0.2;
return $data;
}
```
--------------------------------
### Change the initial zoom level on map
Source: https://formidableforms.com/knowledgebase/frm_geo_map_zoom
Example showing how to set the map zoom level to 15.
```php
add_filter('frm_geo_map_zoom','zoom_geo_map');
function zoom_geo_map() {
return 15;
}
```
--------------------------------
### Customize password icons
Source: https://formidableforms.com/knowledgebase/frm_pro_show_password_icons
Example of modifying the show and hide icon HTML by returning a custom array.
```php
add_filter('frm_pro_show_password_icons', 'change_password_icons');
function change_password_icons( $icons ) {
$icons['show'] = 'new show icon';
$icons['hide'] = 'new hide icon';
return $icons;
}
```
--------------------------------
### Add Canonical URL Filter
Source: https://formidableforms.com/knowledgebase/get_canonical_url
This is a basic example of how to add a filter to modify the canonical URL. It serves as a starting point for more complex customizations.
```php
add_filter( 'get_canonical_url', 'filter_canonical_url_for_view_inside_page', 10, 2 );
```
--------------------------------
### Filter by Date - Current Year/Month Start
Source: https://formidableforms.com/knowledgebase/filtering-entries
Get the first day of the current year or month using the [date] shortcode. This avoids needing to specify the exact date.
```shortcode
[date format='Y']-01-01
```
```shortcode
[date format='Y-m']-01
```
--------------------------------
### Pass Form Values to URL Shortcode
Source: https://formidableforms.com/knowledgebase/automatically-populate-fields
Use the [get param] shortcode to include submitted form information directly in the URL. Refer to the linked guide for detailed instructions on how to retrieve parameters from the URL.
```shortcode
[get param]
```
--------------------------------
### Auto Increment ID with Custom Start
Source: https://formidableforms.com/knowledgebase/using-dynamic-default-values-in-fields
Sets a custom starting number for the auto-incrementing ID. The default start is 1.
```shortcode
[auto_id start=2]
```
--------------------------------
### Formidable Forms API - Get Support
Source: https://formidableforms.com/knowledgebase-category/entry-management
Information on how to get support for Formidable Forms.
```APIDOC
## Get Support
### Description
If you can't find the information you need, our support team is available to assist you. You can contact customer support through various channels.
### Contact Options
- LinkedIn
- Twitter
- Facebook
- YouTube
- Instagram
```
--------------------------------
### Prepare Data for REST API Entry Creation
Source: https://formidableforms.com/knowledgebase/frm_api_prepare_data
This example demonstrates how to execute different actions based on field types when preparing data for a new entry via the REST API. It iterates through fields and applies specific formatting or logic.
```php
add_filter( 'frm_api_prepare_data', 'prepare_data' );
function prepare_data( $data, $fields ) {
foreach ( $fields as $k => $field ) {
switch ( $field->type ) {
case 'checkbox':
case 'select':
//do something
break;
case 'file':
//do something
break;
case 'date':
FrmAPIAppHelper::format_date( $field, $data['item_meta'][ $field->id ] );
}
}
return $data;
}
```
--------------------------------
### Implement subject encoding callback
Source: https://formidableforms.com/knowledgebase/frm_encode_subject
Full example showing the filter registration and the callback function to enable subject encoding.
```php
add_filter( 'frm_encode_subject', 'frm_add_subject_encoding', 10, 2);
function frm_add_subject_encoding( $encode, $subject ) {
return true;
}
```
--------------------------------
### Pass Parameters and Set Starting Page
Source: https://formidableforms.com/knowledgebase/publish-a-form
Use these to pass custom values to fields or control the initial page of a multi-page form.
```shortcode
[formidable id=x my_param="value"]
```
```shortcode
[formidable id=x page="2"]
```
```shortcode
[formidable id=x page="start-page"]
```
--------------------------------
### US Phone Number Example
Source: https://formidableforms.com/knowledgebase/twilio-add-on
An example of a US phone number formatted according to E.164 standards.
```text
+14188884567
```
--------------------------------
### Configure Entry Display Parameters
Source: https://formidableforms.com/knowledgebase/show-details-of-a-single-entry
Various parameters to control the output, styling, and content of the displayed entry.
```shortcode
[frm-show-entry id=x plain_text=1]
```
```shortcode
[frm-show-entry id=x user_info=1]
```
```shortcode
[frm-show-entry id=x include_blank=1]
```
```shortcode
[frm-show-entry id=x include_extras="page, section, html"]
```
```shortcode
[frm-show-entry id=x include_fields="10,15"]
```
```shortcode
[frm-show-entry id=x exclude_fields="10,15"]
```
```shortcode
[frm-show-entry id=x show_image=1]
```
```shortcode
[frm-show-entry id=x show_image=1 show_filename=1]
```
```shortcode
[frm-show-entry id=x show_image=1 show_filename=1 add_link=1]
```
```shortcode
[frm-show-entry id=x direction=rtl]
```
```shortcode
[frm-show-entry id=x font_size="25px"]
```
```shortcode
[frm-show-entry id=x text_color="b642f4"]
```
```shortcode
[frm-show-entry id=x border_width="1px"]
```
```shortcode
[frm-show-entry id=x border_color="000000"]
```
```shortcode
[frm-show-entry id=x bg_color="ffffff"]
```
```shortcode
[frm-show-entry id=x alt_bg_color="eeeeee"]
```
```shortcode
[frm-show-entry id=x line_breaks="0"]
```
```shortcode
[frm-show-entry id=x array_separator="
"]
```
--------------------------------
### Add Custom HTML to Conversational Form Start Page
Source: https://formidableforms.com/knowledgebase/frm_chat_start_page_content
Use this hook to add custom HTML to the conversational form start page below the start button. Ensure you change the target form ID to match your specific form.
```php
add_filter('frm_chat_start_page_content', 'frm_chat_add_html', 10, 2);
function frm_chat_add_html( $start_page_content, $args ) {
$target_form_id = 310; // change 310 to your form ID.
if ( $target_form_id === (int) $args['form']->id ) {
$start_page_content .= '
';
$start_page_content .= 'Additional start page content';
}
return $start_page_content;
}
```
--------------------------------
### Calculate Total Time from Start and End Times
Source: https://formidableforms.com/knowledgebase/frm_validate_field_entry
This snippet calculates the duration between a start and end time, typically used for time fields displayed as dropdowns. Update the field IDs for the start and end times, and the target field for the calculation.
```php
add_filter('frm_validate_field_entry', 'calculate_time', 11, 3);
function calculate_time($errors, $field, $value){
if($field->id == 25){ //change 25 to the ID of the hidden or admin only field which will hold the calculation
$start = strtotime($_POST['item_meta'][23]); //change 23 to the ID of the first field
$end = strtotime($_POST['item_meta'][24]); //change 24 to the ID of the second field
$totaltime = ($end - $start);
$hours = intval($totaltime / 3600);
$seconds_remain = ($totaltime - ($hours * 3600));
$minutes = intval($seconds_remain / 60);
//$seconds = ($seconds_remain - ($minutes * 60)); Uncomment this line if you want seconds calculated.
$leading_zero_for_minutes = $minutes < 10 ? '0' : '';
//$leading_zero_for_seconds = $seconds < 10 ? '0' : '';//Uncomment this line if you're including seconds.
$totaltime = $hours . ':' . $leading_zero_for_minutes . $minutes;
//$totaltime = $hours . ':' . $leading_zero_for_minutes . $minutes . ':' . $leading_zero_for_seconds . $seconds;//uncomment this line if you're including seconds
$value = $_POST['item_meta'][ $field->id ] = $totaltime;
}
return $errors;
}
```
--------------------------------
### Enable file protection by default
Source: https://formidableforms.com/knowledgebase/frm_pro_default_form_settings
Example showing how to modify the $defaults array to enable file protection for new forms.
```php
add_filter( 'frm_pro_default_form_settings', 'turn_on_file_protection_by_default' );
function turn_on_file_protection_by_default( $defaults ) {
$defaults['protect_files'] = 1;
return $defaults;
}
```
--------------------------------
### Skip conversational form start page
Source: https://formidableforms.com/knowledgebase/frm_filter_final_form
Hides the initial start page of a conversational form by injecting CSS styles.
```php
add_filter('frm_filter_final_form', 'skip_start_page', 15);
function skip_start_page( $form ) {
$form = str_replace(
'class="frm_active_chat_field frm_chat_start_page"',
'style="display: none;" class="frm_active_chat_field frm_chat_start_page"',
$form
);
return $form;
}
```
--------------------------------
### Configure registration link parameters
Source: https://formidableforms.com/knowledgebase/add-login-form-to-your-site
Customize the registration link visibility, label text, and CSS classes.
```shortcode
[frm-login register_link="1"]
```
```shortcode
[frm-login label_register="Sign up to register"]
```
```shortcode
[frm-login class_register="custom-css-class-name-here"]
```
--------------------------------
### Auto Increment ID with Custom Step and Start
Source: https://formidableforms.com/knowledgebase/using-dynamic-default-values-in-fields
Defines both the starting number and the interval for the auto-incrementing ID. The default step is 1.
```shortcode
[auto_id step=2 start=2]
```
--------------------------------
### Create WordPress Post via Formidable API
Source: https://formidableforms.com/knowledgebase/formidable-api
This example demonstrates how to configure a Formidable form action to create a WordPress post using the WordPress API. It specifies the API endpoint, method, and key/value pairs for post content.
```text
Keys| Values
---|---
title| [2018]
content| [2019]
status| draft
```
--------------------------------
### Add Euro Payments (SOFORT, iDEAL, Bancontact) for One-Time Payments
Source: https://formidableforms.com/knowledgebase/frm_stripe_payment_method_types
This example enables SOFORT, iDEAL, and Bancontact for one-time payments in Euros. Note that subscriptions are not supported with these methods.
```php
add_filter('frm_stripe_payment_method_types', 'add_sofort_ideal_bancontact');
function add_sofort_ideal_bancontact( $payment_method_types ) {
$payment_method_types = array( 'sofort', 'ideal', 'bancontact' );
return $payment_method_types;
}
```
--------------------------------
### GET /wp-json/frm/v2/forms/{id}
Source: https://formidableforms.com/knowledgebase/formidable-api
Retrieve a specific form by its ID. Use the return=html query parameter to get the rendered HTML of the form.
```APIDOC
## GET /wp-json/frm/v2/forms/{id}
### Description
Retrieves a form by its ID. Can return the form object or rendered HTML.
### Method
GET
### Endpoint
/wp-json/frm/v2/forms/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the form to retrieve.
#### Query Parameters
- **return** (string) - Optional - Set to 'html' to retrieve the rendered HTML of the form.
```
--------------------------------
### Allow File Switching Sitewide (PHP)
Source: https://formidableforms.com/knowledgebase/frm_stop_file_switching
Use this hook to allow file switching for all forms, even when file protection is enabled. This example ensures that file protection settings on individual forms are ignored.
```php
add_filter( 'frm_stop_file_switching', '__return_false' );
```
--------------------------------
### Add API character set options
Source: https://formidableforms.com/knowledgebase/frm_api_charset_options
Example showing how to append a custom character set, such as windows-1252, to the existing options array.
```php
add_filter( 'frm_api_charset_options', 'add_api_charset_options' );
function add_api_charset_options( $charset_options ) {
$charset_options[] = 'windows-1252';
return $charset_options;
}
```
--------------------------------
### Implement Dynamic Redirects After Login
Source: https://formidableforms.com/knowledgebase/add-login-form-to-your-site
To redirect users to a specific page after login based on their entry point, append the 'redirect_to' parameter to the login page URL. Set its value to the desired destination path.
```html
https://yoursite.com/login-page/?redirect_to=/special-page
```
--------------------------------
### Get a group of entries
Source: https://formidableforms.com/knowledgebase/formidable-api
This section describes how to retrieve a list of entries from a specific form using GET requests, with various parameters for filtering and pagination.
```APIDOC
## Get a group of entries
### Description
Retrieve a list of entries from a specific form using GET requests. Extra parameters are available for filtering and pagination.
### Method
GET
### Endpoint
`/wp-json/frm/v2/forms/{form_id}/entries`
### Query Parameters
- **order_by** (string) - Optional - Defaults to `id`. Specifies the field to order entries by.
- **order** (string) - Optional - Use `ASC` or `DESC`. Defaults to `ASC`. Specifies the order direction.
- **page** (integer) - Optional - Defaults to `1`. The page number to retrieve.
- **page_size** (integer) - Optional - Defaults to `25`. Changes the number of entries returned per page.
- **search** (string) - Optional - No default. Searches all fields in the entries for a specific value.
- **start_date** (string) - Optional - Filter by the date an entry was created. Any PHP string format is allowed (e.g., '7 days ago', '2020-03-01').
- **end_date** (string) - Optional - Filter by the date an entry was created. Any PHP string format is allowed (e.g., '7 days ago', '2020-03-01').
### Request Example
```
yoursite.com/wp-json/frm/v2/forms/25/entries?search=john@doe.com
```
### Response
#### Success Response (200)
- Returns a JSON object containing a list of entries that match the specified criteria.
#### Response Example
(Example response structure not provided in source text, but would typically include an array of entry objects.)
```
--------------------------------
### Implement In-Place Edit and Delete Functionality
Source: https://formidableforms.com/knowledgebase/set-up-front-end-editing
Wrap content in specific container IDs and use editlink and deletelink shortcodes to enable AJAX-based entry management.
```shortcode
get_price(); } add_shortcode( 'price', 'ff_get_price' ); ``` -------------------------------- ### Register frm_setup_new_form_vars filter Source: https://formidableforms.com/knowledgebase/frm_setup_new_form_vars Basic implementation to hook into the form setup process. ```php add_filter( 'frm_setup_new_form_vars', 'change_default_form' ); ``` -------------------------------- ### Get Post Author Email Source: https://formidableforms.com/knowledgebase/using-dynamic-default-values-in-fields Retrieves the email address of the author of the current post. ```shortcode [post_author_email] ``` -------------------------------- ### Configure x-axis title Source: https://formidableforms.com/knowledgebase/graphs Set the title, size, and color for the x-axis label. ```shortcode [frm-graph fields="x" x_title="X axis title"] ``` ```shortcode [frm-graph fields="x" x_title="X axis title" x_title_size="20"] ``` ```shortcode [frm-graph fields="x" x_title="X axis title" x_title_color="#666"] ``` -------------------------------- ### Perform an Action Source: https://formidableforms.com/knowledgebase/add-a-form-action This section explains how to trigger custom actions based on entry events (create, update, delete) using specific Formidable hooks. ```APIDOC ## Perform an action Now, you can do something after an entry is created, updated, or deleted. #### On create This hook is only fired when an entry is created: ```php add_action('frm_trigger_**my_action_name**_create_action', 'my_create_action_trigger', 10, 3); function my_create_action_trigger($action, $entry, $form) { // Do some magic } ``` Replace the**my_action_name** text with the name you have given to your action. This name is used in two other places and they must be identical. It is referenced in the first code block: $actions['my_action_name'] = 'MyActionClassName'; and the second code block: $this->FrmFormAction('my_action_name', __('My Action Name', 'formidable'), $action_ops); #### On update This hook is only fired when an entry is updated: ```php add_action('frm_trigger_**my_action_name**_update_action', 'my_update_action_trigger', 10, 3); function my_update_action_trigger($action, $entry, $form) { // Do some magic } ``` Replace the**my_action_name** text with the name you have given to your action. #### On delete This hook is only fired when an entry is deleted: ```php add_action('frm_trigger_**my_action_name**_delete_action', 'my_delete_action_trigger', 10, 3); function my_delete_action_trigger($action, $entry, $form) { // Do some magic } ``` Replace the**my_action_name** text with the name you have given to your action. ``` -------------------------------- ### Get User Last Name Source: https://formidableforms.com/knowledgebase/using-dynamic-default-values-in-fields Retrieves the last name of the currently logged-in user. ```shortcode [last_name] ``` -------------------------------- ### Customize global login message with a link Source: https://formidableforms.com/knowledgebase/frm_global_login_msg Advanced example that parses the login message for asterisks to inject a dynamic login URL link. ```php add_filter( 'frm_global_login_msg', 'custom_global_login_message' ); function custom_global_login_message( $message ) { $frm_settings = FrmAppHelper::get_settings(); $frm_login_msg = $frm_settings->login_msg; if ( substr_count( $frm_login_msg, '*' ) == 2 ) { $frm_login_msg_array = explode( "*", $frm_login_msg ); $current_url = home_url( add_query_arg( [], $GLOBALS['wp']->request ) ); // get_permalink() doesn't include query vars $frm_login_msg = $frm_login_msg_array[0]; $frm_login_msg .= ''; $frm_login_msg .= $frm_login_msg_array[1]; $frm_login_msg .= ''; $frm_login_msg .= $frm_login_msg_array[2]; } return $frm_login_msg; } ``` -------------------------------- ### Get a Group of Forms Source: https://formidableforms.com/knowledgebase/Formidable-api Retrieves a list of forms with various filtering and sorting options. ```APIDOC ## GET /wp-json/frm/v2/forms ### Description Retrieves a collection of forms with options for sorting, pagination, and filtering. ### Method GET ### Endpoint `yoursite.com/wp-json/frm/v2/forms/` ### Parameters #### Query Parameters - **order_by** (string) - Optional - Specifies the field to order forms by. Defaults to form creation date. - **order** (string) - Optional - The order of sorting. Use `ASC` or `DESC`. Defaults to `ASC`. - **page** (integer) - Optional - The page number of results to retrieve. Defaults to `1`. - **limit** (integer) - Optional - The number of forms to return per page. Defaults to `20`. - **search** (string) - Optional - A search term to filter forms by name and description. - **return** (string) - Optional - Determines the output format. Default is the form object, `html` returns the rendered HTML. - **exclude_script** (boolean) - Optional - If `return=html`, exclude specific scripts. - **exclude_style** (boolean) - Optional - If `return=html`, exclude specific styles. ``` -------------------------------- ### Add custom data to backend JS Source: https://formidableforms.com/knowledgebase/frm_acf_backend_js_data Example showing how to append custom strings and data to the JS data array. ```php add_filter('frm_acf_backend_js_data', 'acf_backend_js_data', 10, 2}; function acf_backend_js_data( $data, $args ) { $data['form_action_id'] = $args['form_action']->ID; $data['strings']['custom_string'] = 'Your custom string'; $data['custom_data'] = 'Your custom data'; return $data; } ```