Delicious Brains


Managing Access to On-demand Media Actions

The on-demand media actions for WP Offload S3 are available to Administrators by default by requiring users to have the manage_options capability.

On-demand media actions

There are two options for changing this default behavior: filtering the minimum capability required, or by explicitly granting permission via a custom capability.

Filtering The Minimum Capability

The as3cfpro_media_actions_capability filter may be used to change the minimum required capability needed to use the on-demand actions.

add_filter( 'as3cfpro_media_actions_capability', function() {
    return 'edit_posts';
} );

The above example extends the permissions to Editors and any other user role which allows for editing posts.

Disabling Access By Default

Should you desire to disable these on-demand actions for all users by default, you may use the following filter:

add_filter( 'as3cfpro_media_actions_capability', function() {
    return 'do_not_allow';
} );

Granting Access Explicitly via Capability

As of version 1.4, there is now a dedicated capability which can be used to grant permission to use the on-demand actions.

Any user with the use_as3cf_media_actions capability will be allowed to use the on-demand actions. This gives admins much more flexibility in controlling who has the capability to perform these actions.

Note: The dedicated capability will grant access to these actions even if the filter above is used to disable access by default.

For examples as to how to add this capability to a specific user or role, see The Codex.