From 83ba5069fa089924527a4807feb9df7a630adb98 Mon Sep 17 00:00:00 2001
From: Tetrakern <26898880+Tetrakern@users.noreply.github.com>
Date: Wed, 30 Oct 2024 12:07:50 +0100
Subject: [PATCH] Add filter to profile support link fields
---
FILTERS.md | 19 ++++++++++++
includes/functions/users/_admin-profile.php | 34 +++++++++++----------
2 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/FILTERS.md b/FILTERS.md
index b2b4d21f..fa6733f1 100644
--- a/FILTERS.md
+++ b/FILTERS.md
@@ -1217,6 +1217,25 @@ Filters the CSS compiled from settings and theme options before it is minified a
---
+### `apply_filters( 'fictioneer_filter_profile_fields_support', $fields, $profile_user )`
+Filters the intermediate output array of support profile fields in `includes/functions/users/_admin-profile.php` before it is imploded with `'
'` and rendered. You can use the filter to remove or add fields, but be aware that they will not be saved without further custom code. See `fictioneer_update_my_user_profile()` in the same file.
+
+**Parameters:**
+* $fields (string[]) – Prepared HTML for each support field. The default keys are `'patreon'`, `'kofi'`, `'subscribestar'`, `'paypal'`, and `'donation'`.
+* $profile_user (WP_User) – The profile user object.
+
+**Example:**
+```php
+function child_add_custom_profile_support_field( $fields, $profile_user ) {
+ $fields['custom'] = '
Custom donation link
'; + + return $fields; +} +add_filter( 'fictioneer_filter_profile_fields_support', 'child_add_custom_profile_support_field', 10, 2 ); +``` + +--- + ### `apply_filters( 'fictioneer_filter_recommendations_card_args', $card_args, $args )` Filters the arguments passed to the `partials/_card-recommendation` template part in the `fictioneer_recommendations_list( $args )` function, normally added via the `fictioneer_recommendations_after_content` hook. diff --git a/includes/functions/users/_admin-profile.php b/includes/functions/users/_admin-profile.php index 8225e8ab..71d0e920 100644 --- a/includes/functions/users/_admin-profile.php +++ b/includes/functions/users/_admin-profile.php @@ -2011,22 +2011,24 @@ function fictioneer_admin_profile_author( $profile_user ) {