settings(); $settings->add_tab( 'users', __( 'Users', 'all-in-one-utilities' ), __( 'Settings that affect how user accounts are managed.', 'all-in-one-utilities' ), 20 ); $settings->add_section( 'users', 'user_avatar', __( 'Custom User Avatar', 'all-in-one-utilities' ), __( 'Let users set a custom avatar instead of relying on Gravatar.', 'all-in-one-utilities' ), 30 ); $settings->add_field( 'users', 'user_avatar', new Field( id: 'enabled', label: __( 'Enable Custom User Avatar', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Add an avatar field to user profiles', 'all-in-one-utilities' ) ), doc: new Doc( title: __( 'Custom User Avatar', 'all-in-one-utilities' ), short: __( 'Lets a user pick an image from the Media Library as their avatar, shown everywhere WordPress displays one.', 'all-in-one-utilities' ), detailed: __( 'Uses the same modern WordPress hook (pre_get_avatar_data) that Gravatar itself resolves through, so it works everywhere core avatars appear -- comments, author boxes, the admin toolbar, user lists -- without any theme changes.', 'all-in-one-utilities' ) ), priority: 10 ) ); $settings->add_field( 'users', 'user_avatar', new Field( id: 'allow_all_users', label: __( 'Allow all users', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Let every logged-in user set their own avatar, not just those with Media Library access', 'all-in-one-utilities' ), 'depends_on' => 'enabled', ), doc: new Doc( title: __( 'Allow all users', 'all-in-one-utilities' ), short: __( 'Users without Media Library access (e.g. Subscribers) get a plain file-upload field instead of the Media Library picker.', 'all-in-one-utilities' ), detailed: __( 'The uploaded file is validated (image type and WordPress\'s own maximum upload size) and attached under that user\'s own account, the same as any other upload -- no extra capabilities are granted to any role.', 'all-in-one-utilities' ), warnings: array( __( 'Turn this off to restrict custom avatars to Authors and above.', 'all-in-one-utilities' ) ) ), priority: 20 ) ); $settings->add_field( 'users', 'user_avatar', new Field( id: 'disable_gravatar', label: __( 'Disable Gravatar fallback', 'all-in-one-utilities' ), type: 'checkbox', default: 0, args: array( 'toggle_label' => __( 'Never fall back to Gravatar for users without a custom avatar', 'all-in-one-utilities' ), 'depends_on' => 'enabled', ), doc: new Doc( title: __( 'Disable Gravatar fallback', 'all-in-one-utilities' ), short: __( 'Shows the fallback image below (or WordPress\'s built-in blank avatar) instead of checking Gravatar.', 'all-in-one-utilities' ), detailed: __( 'Unlike some similar plugins, this never makes a network request to gravatar.com to check whether a Gravatar exists -- disabling this setting is a purely local decision with no added latency or external data exposure.', 'all-in-one-utilities' ) ), priority: 30 ) ); $settings->add_field( 'users', 'user_avatar', new Field( id: 'default_avatar', label: __( 'Fallback avatar', 'all-in-one-utilities' ), type: 'media', default: 0, args: array( 'depends_on' => 'enabled' ), doc: new Doc( title: __( 'Fallback avatar', 'all-in-one-utilities' ), short: __( 'Used instead of Gravatar for any user without a custom avatar, when the setting above is on.', 'all-in-one-utilities' ) ), priority: 40 ) ); if ( $settings->get_value( 'users', 'user_avatar', 'enabled', 0 ) ) { ( new Feature() )->register(); } } }