diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4ebf7bfd16..a2bf940a62 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -14,6 +14,7 @@ Changelog * Mention the importance of passing `request` and `current_site` to `get_url` on the [performance](performance) documentation page (Jake Howard) * Run Python tests with coverage and upload coverage data to codecov (Sage Abdullah) * Clean up duplicate JavaScript for the `escapeHtml` function (Jordan Rob) + * Add documentation for `register_user_listing_buttons` hook (LB (Ben Johnston)) * Fix: Make sure workflow timeline icons are visible in high-contrast mode (Loveth Omokaro) * Fix: Ensure authentication forms (login, password reset) have a visible border in Windows high-contrast mode (Loveth Omokaro) * Fix: Ensure visual consistency between buttons and links as buttons in Windows high-contrast mode (Albina Starykova) diff --git a/docs/reference/hooks.md b/docs/reference/hooks.md index 64137a49eb..0c4cb101cc 100644 --- a/docs/reference/hooks.md +++ b/docs/reference/hooks.md @@ -379,6 +379,24 @@ Return a QuerySet of `Permission` objects to be shown in the Groups administrati ]) ``` +(register_user_listing_buttons)= + +### `register_user_listing_buttons` + +Add buttons to the user list. This example will add a simple button to the listing: + +```python +from wagtail.users.widgets import UserListingButton + +@hooks.register("register_user_listing_buttons") +def user_listing_external_profile(context, user): + yield UserListingButton( + "Show profile", + f"/goes/to/a/url/{user.pk}", + priority=30, + ) +``` + (filter_form_submissions_for_user)= ### `filter_form_submissions_for_user` diff --git a/docs/releases/4.2.md b/docs/releases/4.2.md index 59c07ea90a..ccf4d2b6e4 100644 --- a/docs/releases/4.2.md +++ b/docs/releases/4.2.md @@ -24,6 +24,7 @@ depth: 1 * Mention the importance of passing `request` and `current_site` to `get_url` on the [performance](performance) documentation page (Jake Howard) * Run Python tests with coverage and upload coverage data to codecov (Sage Abdullah) * Clean up duplicate JavaScript for the `escapeHtml` function (Jordan Rob) + * Add documentation for [`register_user_listing_buttons`](register_user_listing_buttons) hook (LB (Ben Johnston)) ### Bug fixes