# desktop-mode/1.1.10/apps/user-edit/user-edit.os.php

OpenStation: Desktop Windows, Dock &amp; Virtual Desktops for WP Admin, version 1.1.10. 83 lines.

- Page: https://pluginprobe.com/plugins/desktop-mode/1.1.10/code/apps/user-edit/user-edit.os.php
- Raw: https://pluginprobe.com/plugins/desktop-mode/1.1.10/raw/apps/user-edit/user-edit.os.php
- Modified: 2026-09-04T15:30:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/desktop-mode/1.1.10/code/apps/user-edit/user-edit.os.php#L10-L20`.

```php
<?php
/**
 * User Edit — the profile editor, as an OpenStation app.
 *
 * Claims the FROZEN id `desktop-mode-user-edit` (see AGENTS.md). A
 * singleton that opens on the person carried in its open-time params
 * (`{ userId }` — the `user-edit.php?user_id=N` remap, a Users row,
 * WP Explorer, the agents roster; `0`, or none, is the viewer's own
 * profile, how `profile.php` opens). A live window asked to open on
 * someone else retargets through the `reopen` lifecycle. The body is
 * `user-edit.os.ts`: `<os-user-profile>` on the state's id, from the
 * companion bundle the Users app registers, fed this app's facts.
 *
 * (Header kept short on purpose: Plugin Check's direct-access scan
 * reads only the first 50 raw lines, and the guard below must land
 * inside that window.)
 *
 * @package OpenStation
 */

namespace OpenStation\Apps\UserEdit;

use OpenStation\App;
use OpenStation\App\Os;
use OpenStation\App\State;

// Direct access, unless a standalone host is booting on bare PHP.
if ( ! defined( 'ABSPATH' ) ) {
	defined( 'OPENSTATION_STANDALONE' ) || exit;
}

require_once __DIR__ . '/parts/permissions.php';
require_once __DIR__ . '/parts/account.php';
require_once __DIR__ . '/parts/insights.php';
// The facts (roles, locales, colour schemes, contact methods) and the
// profile bundle belong to the Users app; both windows share them.
require_once dirname( __DIR__ ) . '/users/parts/permissions.php';
require_once dirname( __DIR__ ) . '/users/parts/color-schemes.php';
require_once dirname( __DIR__ ) . '/users/parts/fields.php';
require_once dirname( __DIR__ ) . '/users/parts/facts.php';
require_once dirname( __DIR__ ) . '/users/parts/profile-script.php';

/**
 * Point the window at the person the params name, or at the viewer.
 *
 * @param State $state State.
 * @param Os    $os    Host handle.
 * @return void
 */
function retarget( State $state, Os $os ) {
	$user_id = (int) $os->param( 'userId', 0 );
	$state->set( 'userId', $user_id > 0 ? $user_id : (int) get_current_user_id() );
}

return App::define( 'desktop-mode-user-edit' )
	->title( __( 'Edit user', 'desktop-mode' ) )
	->icon( 'dashicons-admin-users' )
	->size( 1100, 760 )
	->min_size( 720, 520 )
	->placement( 'none' )
	// The profile surface is styled by the Users app's sheet — one set
	// of rules for the Profile tab and this window. Pointing here
	// registers the same file under this app's own handle, so the
	// window is dressed even when the Users window was never opened.
	->style( dirname( __DIR__ ) . '/users/users.css' )
	->can(
		static function () {
			return openstation_user_edit_window_user_can_register();
		}
	)
	// Resolved when the window registers, for the viewer registering it.
	->config( 'openstation_users_profile_facts' )
	->state( array( 'userId' => 0 ) )
	->mount( __NAMESPACE__ . '\retarget' )
	// The singleton reopened on someone else — the shell wrote the new
	// params, the runtime dispatched this.
	->action( 'reopen', __NAMESPACE__ . '\retarget' )
	->data(
		static function ( State $state ) {
			return array( 'userId' => (int) $state->get( 'userId' ) );
		}
	);

```
