1212 * Bootstrap actions for the profile screen.
1313 */
1414function bootstrap () {
15- add_action ( 'personal_options ' , __NAMESPACE__ . '\\render_profile_section ' , 50 );
15+ add_action ( 'show_user_profile ' , __NAMESPACE__ . '\\render_profile_section ' );
16+ add_action ( 'edit_user_profile ' , __NAMESPACE__ . '\\render_profile_section ' );
1617 add_action ( 'all_admin_notices ' , __NAMESPACE__ . '\\output_profile_messages ' );
1718 add_action ( 'personal_options_update ' , __NAMESPACE__ . '\\handle_revocation ' , 10 , 1 );
1819 add_action ( 'edit_user_profile_update ' , __NAMESPACE__ . '\\handle_revocation ' , 10 , 1 );
@@ -26,34 +27,26 @@ function bootstrap() {
2627function render_profile_section ( WP_User $ user ) {
2728 $ tokens = Access_Token::get_for_user ( $ user );
2829 ?>
29- <table class="form-table">
30- <tbody>
30+ <h2><?php _e ( 'Authorized Applications ' , 'oauth2 ' ) ?> </h2>
31+ <?php if ( ! empty ( $ tokens ) ): ?>
32+ <table class="widefat">
33+ <thead>
3134 <tr>
32- <th scope="row"><?php _e ( 'Authorized Applications ' , 'oauth2 ' ) ?> </th>
33- <td>
34- <?php if ( ! empty ( $ tokens ) ): ?>
35- <table class="widefat">
36- <thead>
37- <tr>
38- <th style="padding-left:10px;"><?php esc_html_e ( 'Application Name ' , 'oauth2 ' ); ?> </th>
39- <th></th>
40- </tr>
41- </thead>
42- <tbody>
43- <?php
44- foreach ( $ tokens as $ token ) {
45- render_token_row ( $ token );
46- }
47- ?>
48- </tbody>
49- </table>
50- <?php else : ?>
51- <p class="description"><?php esc_html_e ( 'No applications authorized. ' , 'oauth2 ' ) ?> </p>
52- <?php endif ?>
53- </td>
35+ <th style="padding-left:10px;"><?php esc_html_e ( 'Application Name ' , 'oauth2 ' ); ?> </th>
36+ <th></th>
5437 </tr>
38+ </thead>
39+ <tbody>
40+ <?php
41+ foreach ( $ tokens as $ token ) {
42+ render_token_row ( $ token );
43+ }
44+ ?>
5545 </tbody>
5646 </table>
47+ <?php else : ?>
48+ <p class="description"><?php esc_html_e ( 'No applications authorized. ' , 'oauth2 ' ) ?> </p>
49+ <?php endif ?>
5750 <?php
5851}
5952
0 commit comments