Add WPML_User_Helper for managing translation capabilities without editor role requirement #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new
WPML_User_Helperclass that provides convenient methods for managing WPML translation capabilities without requiring users to have the editor role. This addresses the need for more granular permission management in multilingual WordPress setups.New Helper Class:
WPML_User_HelperThe helper provides four main methods for translation capability management:
Core Methods (as requested in issue)
Single User Management:
Bulk Role Management:
Additional Utility Methods
Key Features
WP_Userobjectsdo_action('wpml_tm_ate_synchronize_managers', $user_id)for proper ATE synchronizationfields => 'ID'for optimal performanceDocumentation
Comprehensive documentation added at
docs/Helpers/wpml-user-helper.mdincluding:Use Cases
This helper enables several important use cases:
Example Usage
The helper follows the same patterns as existing helpers (
WPML_Post_Helper,WPML_Language_Helper,WPML_Term_Helper) ensuring consistency across the codebase.Fixes #15.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c/usr/bin/php8.3 -n -c /tmp/1PMJm2 /usr/bin/composer install(http block)/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/18a95476797ed480b3f2598984bc6f7e1eecc9a8/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/composer/installers/zipball/12fb2dfe5e16183de69e784a7b84046c43d97e8e/usr/bin/php8.3 -n -c /tmp/1PMJm2 /usr/bin/composer install(http block)/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b/usr/bin/php8.3 -n -c /tmp/1PMJm2 /usr/bin/composer install(http block)/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c/usr/bin/php8.3 -n -c /tmp/1PMJm2 /usr/bin/composer install(http block)/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74/usr/bin/php8.3 -n -c /tmp/1PMJm2 /usr/bin/composer install(http block)/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)https://api.github.com/repos/phpstan/phpstan/zipball/89b5ef665716fa2a52ecd2633f21007a6a349053/usr/bin/php8.3 -n -c /tmp/Nn1jHb /usr/bin/composer install --dev --no-interaction(http block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.