diff --git a/docs/Client/configuration.md b/docs/Client/configuration.md index c22734c..2c6624e 100644 --- a/docs/Client/configuration.md +++ b/docs/Client/configuration.md @@ -39,6 +39,8 @@ try { } ``` +## All configuration options {#all-options} + | Key | Type | Description | Default | Required? | |-------------------------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:| | `auth/api_key` | `string` | The TrustedLogin key for the vendor, found in "API Keys" on https://app.trustedlogin.com. | `null` | ✅ | diff --git a/docs/Client/customization.md b/docs/Client/customization.md new file mode 100644 index 0000000..8523d1d --- /dev/null +++ b/docs/Client/customization.md @@ -0,0 +1,243 @@ +--- +title: Template Customization +sidebar: auto +--- + +# Customizing the TrustedLogin Template + +The TrustedLogin template is designed to be easily customized to match your brand. This guide will walk you through the steps to customize the template. + +[Reference the hooks](hooks#trustedloginnamespacetemplateauth) doc for more information on how to customize the template using hooks. + +:::tip +By removing placeholders you don't need, or replacing the placeholders with your preferred HTML, you can customize all output generated by the TrustedLogin Client. +::: + +## The Grant Support Access Template + +You can modify the Grant Support Access auth form by using the [`trustedlogin/{{ns}}/template/auth` filter](hooks#trustedloginnamespacetemplateauth). + +This is the default HTML structure of the Grant Support Access form: + +```html +
This will allow {{name}} to:
+{{reference_text}}
+ Terms of Service +
+{{secured_by_trustedlogin}}
+``` + +### `{{admin_debug}}` placeholder + +The admin debug output. Only displayed if the user has `manage_options` capability and `$_GET['debug']` is set. + +- TrustedLogin Status: `Online` or `Offline` +- API Key: The API key used to authenticate with the TrustedLogin API +- License Key: If a license key is set, it will be displayed here +- Log URL: A link to download the log file +- Log Level: The log level set in the TrustedLogin settings +- Webhook URL: The URL to the webhook endpoint, if set. `Empty` if not set. +- Vendor Public Key: The public encryption key of the vendor, with a link to verify the key + +## Examples of Customization + +### Customizing the Grant Support Access Form + +To customize the Grant Support Access form, you can use the `trustedlogin/{{ns}}/template/auth` filter. + +Here is an example of how to customize the Grant Support Access form: + +```php +// Replace `{{ns}}` with the namespace of your configuration. +add_filter( 'trustedlogin/{{ns}}/template/auth', 'RENAME_THIS_FUNCTION_remove_header', 10 ); + +/** + * Remove the header, including the logo, from the Grant Support Access form. + * + * This is an example function name! Replace `RENAME_THIS_FUNCTION_remove_header` with a unique function name. + * + * @param string $auth_screen_template The HTML template of the Grant Support Access form. + * @return string + */ +function RENAME_THIS_FUNCTION_remove_header( $auth_screen_template ) { + return str_replace( '{{header}}', '', $auth_screen_template ); +} +``` diff --git a/docs/Client/hooks.md b/docs/Client/hooks.md index 2fc59ef..c0f77ce 100644 --- a/docs/Client/hooks.md +++ b/docs/Client/hooks.md @@ -119,33 +119,6 @@ Override the structure of the auth form HTML. |-------------------------|----------|------------------------------------|----------------------------------------------------------| | `$auth_screen_template` | `string` | HTML with placeholders (see below) | The structure for the auth form HTML, with placeholders. | -```html - -