Using the Access Control settings in WPCode allows you to limit which features in the WPCode plugin users of your site can manage.
There are 2 main types of settings in the access control area: role-based feature access and site-wide PHP snippet control.
Please note: Access Control settings are only available to license levels Pro and Elite.
Role-based feature access
The main settings area of the Access Control panel enables you to control which user roles can manage different types of snippets based on the code type or access other features not snippet-based.
The first three settings allow you to choose which user roles are allowed to edit snippets based on their code type:
- Text/Blocks snippets: these are snippets that are text-based and no code is allowed except for basic HTML that you can use to format text like you would in a WordPress editor.
- HTML, JavaScript, CSS – these gives users access to edit any type of HTML and add scripts, by granting them this permission they also get access to the Global Header & Footer area. Since this capability grants them more access they also get access to Text/Blocks snippets editing.
- PHP Snippets – This grants users access to use PHP & Universal snippets along with all the other snippet types and also grants users access to the Snippet Library and the Snippet Generator.
The other two settings grant users access to the Conversion Pixels settings and using the File Editor as follows:
- Manage Conversion Pixels Settings – giving users this permission will allow them to manage all the Conversion Pixels settings for all the pixel types and create custom click events. Granting just this permission will not give them access to any other WPCode feature.
- Use the File Editor – this will enable users to access just the File Editor area in the WPCode plugin and update files like ads.txt, app-ads.txt, service-worker.js and robots.txt. Similar to the Conversion Pixels permission this will only allow users to access the File Editor area in the WPCode plugin.
None of the permissions mentioned above will allow other roles to manage the plugin settings or the connection to the WPCode Library.
Please note that granting access to PHP snippets with the library connected to your account, users will be able to also manage the snippets in your private library. If you want to prevent that, simply disconnect the plugin from the library in the plugin settings.
PHP Snippet Control
The 2nd setting available in the Access Control panel allows you as administrator to completely disable PHP snippets throughout the site. This means that nobody will be allowed to add or edit PHP snippets and existing PHP snippets will no longer be executed. This can be useful if you want to avoid using PHP snippets or simply debug disabling all the PHP snippets in a single place.
The PHP snippets can also be disabled site-wide using a PHP constant that you can add in the code of your site: WPCODE_DISABLE_PHP. Adding this constant to the wp-config.php file of your site will completely disable PHP snippets in WPCode and not even administrators will be able do disable it without access to wp-config.php.
define( 'WPCODE_DISABLE_PHP', true );
PHP-related settings in the Access Control panel will no longer be visible if PHP snippets are disabled.