GravityKit\GravityMigrate\Exporters\TargetCapability
Whether the current user may create a form in a destination plugin.
Reading Gravity Forms forms and writing new forms into another plugin are different privileges,
so gating an export on gravityforms_view_forms alone would let a Gravity Forms view-only role
create forms and posts in seven other plugins.
Its own class because two callers ask it: \Controller::validate_target_write_capability()
for the wizard, and wp gk migrate to for the terminal. A second copy of the switch would drift,
and the direction it drifts in is a command that quietly does more than the UI would.
Since: %ver%
Source: src/Exporters/TargetCapability.php:25
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Exporters
Methods
| Method | Description |
|---|---|
can_write() | Whether the current user may create a form in the destination plugin. |
Method Reference
can_write()
public static function can_write( string $provider ): bool
Whether the current user may create a form in the destination plugin.
Each destination is asked in its own vocabulary, and through its own function where it has one: WPForms and Forminator both resolve capabilities from their own settings, so a site that has narrowed them is only honoured by asking the plugin rather than a WordPress capability that stands in for it.
A slug that reaches no case is allowed here, exactly as it is in the wizard: what refuses an unknown destination is provider resolution, not this.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$provider | string | Destination provider slug. |
Returns
bool
Since: %ver%
Source: src/Exporters/TargetCapability.php:44