| 1 |
<?php |
| 2 |
/** |
| 3 |
* Update to 0.4 |
| 4 |
* - update license options. |
| 5 |
* |
| 6 |
* @version 0.4 |
| 7 |
* @package WCPOS\WooCommercePOS |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! \defined( 'ABSPATH' ) ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
// update capabilities. |
| 15 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Update script with file-scoped variables. |
| 16 |
// phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited -- Using $role as loop variable, not overriding WP global. |
| 17 |
$roles = array( 'administrator', 'shop_manager' ); |
| 18 |
$caps = array( 'manage_woocommerce_pos', 'access_woocommerce_pos' ); |
| 19 |
foreach ( $roles as $slug ) { |
| 20 |
$role = get_role( $slug ); |
| 21 |
if ( $role ) { |
| 22 |
foreach ( $caps as $cap ) { |
| 23 |
$role->add_cap( $cap ); |
| 24 |
} |
| 25 |
} |
| 26 |
} |
| 27 |
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 28 |
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited |
| 29 |
|