Global Functions
FluentBoards CoreFluentBoards defines a small set of global PHP functions in app/Functions/helpers.php. They are loaded when the plugin boots, so they are available to any add-on code that runs on or after plugins_loaded. FluentBoards Pro does not add any global functions.
Always guard your code in case FluentBoards is not active:
if (function_exists('FluentBoardsApi')) {
$boards = FluentBoardsApi('boards')->getBoards();
}Quick reference
| Function | Returns | Purpose |
|---|---|---|
fluentBoards() | Application or a bound service | Access the plugin's app container |
FluentBoardsApi() | FBSApi proxy or the Api registry | Entry point to the PHP API (boards, stages, tasks) |
fluentBoardsDb() | Query builder / DB connection | Run raw queries against FluentBoards tables |
fluent_boards_get_option() | mixed | Read a FluentBoards option |
fluent_boards_update_option() | Meta model | Create or update a FluentBoards option |
fluent_boards_get_pref_settings() | array | Module preferences (time tracking, frontend portal, menu, recurring tasks) |
fluent_boards_get_features_config() | array | Feature flags (cloud storage) |
fluent_boards_page_url() | string | Base URL of the FluentBoards app |
fluent_boards_user_avatar() | string | Avatar URL for an email address |
fluent_boards_site_logo() | string | Site logo URL used in emails |
fluent_boards_sanitize_description() | string | Sanitize Markdown/HTML task descriptions |
fluent_boards_string_to_bool() | bool or original value | Convert 'yes'/'no'/'1'/'0' style values |
fluent_boards_is_rtl() | bool | Whether the UI renders right-to-left |
FluentBoardsAssetUrl() | string | URL of the plugin assets/ directory |
fluent_boards_mix() | string | Internal asset URL helper |
fluentboardsCsvMimes() | array | MIME types accepted for CSV import |
fluent_boards_get_upgrade_url() | string | Upgrade-to-Pro URL with UTM parameters |
fbsGetOption(), fbsUpdateOption(), fbsGetFeaturesConfig() | — | Deprecated aliases |
App and API access
fluentBoards()
Returns the FluentBoards application container, or a service bound in it.
fluentBoards($module = null)Parameters
$module(string|null): A container key such as'db','api','url.assets'or'path.app'. Omit it to get the container itself.
Return
FluentBoards\Framework\Foundation\Applicationwhen$moduleisnull, otherwise the resolved service or value.
Example
$app = fluentBoards();
$assetsUrl = fluentBoards('url.assets');FluentBoardsApi()
Entry point to the PHP API classes.
FluentBoardsApi($key = null)Parameters
$key(string|null):'boards','stages'or'tasks'. These keys are registered inapp/Api/config.php.
Return
- With a key: a
FluentBoards\App\Api\FBSApiproxy that forwards every method call to the matching class (Boards,StagesorTasksinFluentBoards\App\Api\Classes). - Without a key: the
FluentBoards\App\Api\Apiregistry. Read a module from it as a property, for exampleFluentBoardsApi()->boards. - An unknown key throws an
Exception("The 'x' doesn't exist in FluentBoardsApi.").
Example
$tasksApi = FluentBoardsApi('tasks');
$task = $tasksApi->getTask(42);
// Equivalent
$task = FluentBoardsApi()->tasks->getTask(42);See PHP API classes for how errors and permissions behave.
fluentBoardsDb()
Returns the database query builder bound to the container (fluentBoards('db')). Use it for queries that the models do not cover. Table names are passed without the WordPress prefix.
Return
- The WPFluent database connection / query builder. It is not the application instance.
Example
$openCount = fluentBoardsDb()->table('fbs_tasks')
->where('board_id', 12)
->where('status', 'open')
->whereNull('archived_at')
->count();Options and settings
fluent_boards_get_option()
Reads an option stored by FluentBoards. Options live in the fbs_metas table as rows with object_type = 'option', not in wp_options.
fluent_boards_get_option($key, $default = null)Parameters
$key(string): The option key.$default(mixed): Returned when the option does not exist. Defaultnull.
Return
mixed: The stored value (unserialized), or$default.
Example
$features = fluent_boards_get_option('_fbs_features', []);fluent_boards_update_option()
Creates or updates an option row in fbs_metas (object_type = 'option').
fluent_boards_update_option($key, $value)Parameters
$key(string): The option key.$value(mixed): The value. Arrays are serialized automatically.
Return
FluentBoards\App\Models\Meta: The saved meta row.
Example
fluent_boards_update_option('my_addon_settings', ['enabled' => 'yes']);fluent_boards_get_pref_settings()
Returns module preferences. They are read from the WordPress option fluent_boards_modules and merged with the defaults below. The result is cached in a static variable for the request.
fluent_boards_get_pref_settings($cached = true)Parameters
$cached(bool): Passfalseto re-read the option. Defaulttrue.
Return
arraywith these keys (defaults shown):
[
'timeTracking' => ['enabled' => 'no', 'all_boards' => 'yes', 'selected_boards' => []],
'frontend' => ['enabled' => 'no', 'slug' => 'projects', 'render_type' => 'standalone', 'page_id' => ''],
'menu_settings' => ['in_fluent_crm' => 'no', 'menu_position' => 3],
'recurring_task' => ['enabled' => 'no', 'all_boards' => 'yes', 'selected_boards' => []],
]Example
$prefs = fluent_boards_get_pref_settings();
if ($prefs['timeTracking']['enabled'] === 'yes') {
// Time tracking (Pro) is switched on
}fluent_boards_get_features_config()
Returns feature flags stored in the _fbs_features option and merged with the defaults. cloud_storage is forced to 'yes' when the FLUENT_BOARDS_CLOUD_STORAGE constant is defined and truthy.
Return
array, for example['cloud_storage' => 'no'].
Example
$features = fluent_boards_get_features_config();
$usesCloudStorage = $features['cloud_storage'] === 'yes';URLs and assets
fluent_boards_page_url()
Returns the base URL of the FluentBoards single-page app. The default is admin_url('admin.php?page=fluent-boards#/'). When the Pro frontend portal is active, the URL can point to the front end instead. Filter: fluent_boards/app_url.
Return
stringending in#/. Append a route such asboards/12to link to a board.
Example
$boardUrl = fluent_boards_page_url() . 'boards/12';
$taskUrl = fluent_boards_page_url() . 'boards/12/tasks/345';FluentBoardsAssetUrl()
Returns the URL of the plugin assets/ directory, optionally with a path appended.
FluentBoardsAssetUrl($path = null)Example
$icon = FluentBoardsAssetUrl('images/icon.svg');fluent_boards_mix()
Internal helper. It returns fluentBoards('url.assets') with $path appended (the leading / is trimmed). The $manifestDirectory argument is accepted for backward compatibility and is ignored.
fluent_boards_mix($path, $manifestDirectory = '')fluent_boards_get_upgrade_url()
Builds the https://fluentboards.com/pricing/ URL with UTM parameters. $utmContent is passed through sanitize_key() and added as utm_content.
fluent_boards_get_upgrade_url($utmContent = '')Users and branding
fluent_boards_user_avatar()
Returns an avatar URL for an email address. For a WordPress user it uses, in order: the FluentBoards profile photo meta, a wp_user_avatar attachment, then get_avatar_url(). For an unknown email it returns a Gravatar URL; when $name is given, it falls back to a ui-avatars.com image. Every result passes through the fluent_boards/get_avatar filter.
fluent_boards_user_avatar($email, $name = '')Parameters
$email(string): The email address.$name(string): Optional display name used for the fallback avatar.
Return
string: The avatar URL.
Example
$avatarUrl = fluent_boards_user_avatar('[email protected]', 'John Doe');fluent_boards_site_logo()
Returns the URL of the theme's custom logo, or an empty string if none is set. Filter: fluent_boards/site_logo.
Example
$logoUrl = fluent_boards_site_logo();fluent_boards_is_rtl()
Returns true when the FluentBoards UI should render right-to-left. It currently wraps WordPress is_rtl().
Data helpers
fluent_boards_sanitize_description()
Sanitizes a task or board description that may contain Markdown and HTML. It converts <https://…> and <email@…> autolinks into Markdown links, runs wp_kses_post(), and keeps Markdown > quote prefixes intact.
fluent_boards_sanitize_description($description): stringExample
$clean = fluent_boards_sanitize_description($_POST['description'] ?? '');fluent_boards_string_to_bool()
Converts common string flags to booleans: 'yes', 'true', '1' become true, and 'no', 'false', '0' become false. Input is trimmed and lower-cased first, and arrays are converted recursively. Unrecognized values are returned unchanged. Filter the map with fluent_boards/true_false_convert.
fluent_boards_string_to_bool($value)Example
fluent_boards_string_to_bool('Yes'); // true
fluent_boards_string_to_bool(['1', 'no']); // [true, false]
fluent_boards_string_to_bool('maybe'); // 'maybe'fluentboardsCsvMimes()
Returns the MIME types accepted when importing a board from CSV. Filter: fluent_boards_csv_mimes (note the underscore, not a slash).
Deprecated functions
These aliases still work, but they trigger _deprecated_function() notices. They were deprecated in version 1.90.
| Deprecated | Use instead |
|---|---|
fbsGetOption($key, $default = null) | fluent_boards_get_option() |
fbsUpdateOption($key, $value) | fluent_boards_update_option() |
fbsGetFeaturesConfig() | fluent_boards_get_features_config() |
PHP API classes
FluentBoardsApi() exposes three classes. Each one has its own reference page:
| Key | Class | Reference |
|---|---|---|
boards | FluentBoards\App\Api\Classes\Boards | Boards API |
stages | FluentBoards\App\Api\Classes\Stages | Stages API |
tasks | FluentBoards\App\Api\Classes\Tasks | Tasks API |
Behavior shared by all three classes:
- Get the object through the function. Call
FluentBoardsApi('tasks')each time, or store the returned object. Do not instantiate the classes directly. There is nogetInstance()method, and the classes do not expose the underlying model. For raw queries, use the models directly. - Permissions use the current user. Read methods require read access to the board and write methods require write access. The check is
PermissionManager::userHasBoardPermission()against the board the item belongs to. When the check fails, most methods returnfalse. In WP-CLI, cron or REST callbacks without a logged-in user, callwp_set_current_user()first. - Exceptions become
null. TheFBSApiproxy catches any\Exceptionthrown inside a method, including "Method … does not exist" for unknown methods and model-not-found errors fromfindOrFail(). In those cases you getnull. Check results withif (!$result)rather than=== false. PHPErrors (for example, calling a Pro class when Pro is inactive) are not caught. - Pro-only methods (
createTaskAttachment,deleteTaskAttachment,createSubtask,updateSubtask,deleteSubtask) returnfalseunless FluentBoards Pro is active (FLUENT_BOARDS_PRO_VERSIONis defined).