diff --git a/README.md b/README.md index 5e7223f9..3b5f2b23 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,30 @@ If you have a patch, or stumbled upon an issue with SCF core, you can contribute ## Translations If you're looking to translate SCF, please use [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/secure-custom-fields/stable/). + +## Local Development & Testing + +To test Secure Custom Fields locally with WordPress: + +1. Clone the repository into your WordPress plugins directory: wp-content/plugins/secure-custom-fields + +2. Activate the plugin from wp-admin. + +3. Recommended development setup: +- WordPress 6.9+ +- PHP 8.0+ +- LocalWP or wp-env + +4. After making changes: +- Test on post edit screen +- Test on user profile/edit screen +- Check browser console for JS errors + +### Pull Requests + +- Create feature branch from `trunk` +- Keep PR small and focused +- Include screenshots for UI fixes when relevant +- Reference related issue number (Fixes #xxx) + +Thank you for contributing \ No newline at end of file diff --git a/includes/forms/form-user.php b/includes/forms/form-user.php index 14531b58..85343312 100644 --- a/includes/forms/form-user.php +++ b/includes/forms/form-user.php @@ -28,6 +28,7 @@ function __construct() { // enqueue add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'login_form_register', array( $this, 'login_form_register' ) ); + add_action( 'admin_head', array( $this, 'scf_user_form_layout_fix' ), 20 ); // render add_action( 'show_user_profile', array( $this, 'render_edit' ) ); @@ -64,6 +65,82 @@ function admin_enqueue_scripts() { // enqueue acf_enqueue_scripts(); } + /** + * Fix SCF field layout on user profile/edit screens. + * + * SCF fields on user screens render inside WordPress `table.form-table` rows, + * so we apply scoped CSS only on profile.php and user-edit.php screens. + * + * @see https://github.com/WordPress/secure-custom-fields/issues/349 + */ + function scf_user_form_layout_fix() + { + + // Only run in wp-admin, and only on profile/edit user screens. + if (!is_admin()) { + return; + } + + $screen = function_exists('get_current_screen') ? get_current_screen() : null; + if (!$screen || !in_array($screen->base, array('profile', 'user-edit'), true)) { + return; + } + + ?> + +