Skip to content

Commit 06ff6c5

Browse files
committed
Add details filter
1 parent 8a8b2b9 commit 06ff6c5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

inc/admin/profile/namespace.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function render_profile_section( WP_User $user ) {
3939
<tbody>
4040
<?php
4141
foreach ( $tokens as $token ) {
42-
render_token_row( $token );
42+
render_token_row( $user, $token );
4343
}
4444
?>
4545
</tbody>
@@ -53,7 +53,7 @@ function render_profile_section( WP_User $user ) {
5353
/**
5454
* Render a single row.
5555
*/
56-
function render_token_row( Access_Token $token ) {
56+
function render_token_row( WP_User $user, Access_Token $token ) {
5757
$client = $token->get_client();
5858

5959
$details = [
@@ -63,6 +63,16 @@ function render_token_row( Access_Token $token ) {
6363
date( get_option( 'date_format' ), $token->get_creation_time() )
6464
),
6565
];
66+
67+
/**
68+
* Filter details shown for an access token on the profile screen.
69+
*
70+
* @param string[] $details List of HTML snippets to render in table.
71+
* @param Access_Token $token Token being displayed.
72+
* @param WP_User $user User whose profile is being rendered.
73+
*/
74+
$details = apply_filters( 'oauth2.admin.profile.render_token_row.details', $details, $token, $user );
75+
6676
$button_title = sprintf(
6777
/* translators: %s: app name */
6878
__( 'Revoke access for "%s"', 'oauth2' ),

0 commit comments

Comments
 (0)