| @@ -32,25 +32,31 @@ | ||
| 32 | 32 | if ( isset( $cache[ $viewer_id ] ) ) { |
| 33 | 33 | return $cache[ $viewer_id ]; |
| 34 | 34 | } |
| 35 | 35 | $cache[ $viewer_id ] = array( |
| 36 | - 'currentUserId' => $viewer_id, | |
| 36 | + 'currentUserId' => $viewer_id, | |
| 37 | 37 | // Capability flags — the UI hides actions the viewer can't |
| 38 | 38 | // perform; every action and route re-checks, so a tampered flag |
| 39 | 39 | // changes nothing. |
| 40 | - 'canEdit' => current_user_can( 'edit_users' ), | |
| 41 | - 'canPromote' => current_user_can( 'promote_users' ), | |
| 42 | - 'canCreate' => current_user_can( 'create_users' ), | |
| 43 | - 'canDelete' => is_multisite() ? current_user_can( 'remove_users' ) : current_user_can( 'delete_users' ), | |
| 44 | - 'isMultisite' => is_multisite(), | |
| 40 | + 'canEdit' => current_user_can( 'edit_users' ), | |
| 41 | + 'canPromote' => current_user_can( 'promote_users' ), | |
| 42 | + 'canCreate' => current_user_can( 'create_users' ), | |
| 43 | + 'canDelete' => is_multisite() ? current_user_can( 'remove_users' ) : current_user_can( 'delete_users' ), | |
| 44 | + // The sidebar's door to the activity footprint. The footprint | |
| 45 | + // renders inside WP Explorer and its REST route is gated by that | |
| 46 | + // module's own helper, so the flag mirrors the same gate: a site | |
| 47 | + // that narrows WP Explorer hides the door with it. The guard | |
| 48 | + // covers a host where the module never loaded. | |
| 49 | + 'canViewFootprint' => function_exists( 'openstation_my_wordpress_user_can_use' ) && openstation_my_wordpress_user_can_use(), | |
| 50 | + 'isMultisite' => is_multisite(), | |
| 45 | 51 | // Roles the viewer may assign — the dropdowns list only these, |
| 46 | 52 | // so a narrowed `editable_roles` never yields "pick a role, hit |
| 47 | 53 | // save, get rejected". `allRoles` is the label catalogue. |
| 48 | - 'assignableRoles' => openstation_users_window_role_label_map( $viewer_id ), | |
| 49 | - 'allRoles' => openstation_users_window_all_roles_map(), | |
| 50 | - 'locales' => openstation_users_window_locales_map(), | |
| 51 | - 'defaultRole' => (string) get_option( 'default_role', 'subscriber' ), | |
| 52 | - 'contactMethods' => (array) wp_get_user_contact_methods(), | |
| 53 | - 'colorSchemes' => openstation_user_edit_window_color_schemes(), | |
| 54 | + 'assignableRoles' => openstation_users_window_role_label_map( $viewer_id ), | |
| 55 | + 'allRoles' => openstation_users_window_all_roles_map(), | |
| 56 | + 'locales' => openstation_users_window_locales_map(), | |
| 57 | + 'defaultRole' => (string) get_option( 'default_role', 'subscriber' ), | |
| 58 | + 'contactMethods' => (array) wp_get_user_contact_methods(), | |
| 59 | + 'colorSchemes' => openstation_user_edit_window_color_schemes(), | |
| 54 | 60 | ); |
| 55 | 61 | return $cache[ $viewer_id ]; |
| 56 | 62 | } |