This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('ure_edit_posts_access_id_list', 'ure_edit_posts_access_set_id_list'); | |
function ure_edit_posts_access_set_id_list($list) { | |
$list .= ',1584'; | |
return $list; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('map_meta_cap', 'not_edit_pending_for_review', 10, 4); | |
function not_edit_pending_for_review($caps, $cap, $user_id, $args) { | |
if ($cap!=='edit_post' && $cap!=='delete_post') { | |
return $caps; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions' ); | |
function exclude_posts_from_edit_restrictions( $post_type ) { | |
$restrict_it = $post_type; | |
$user = wp_get_current_user(); | |
if ( empty( $user) || !is_array( $user->roles ) ) { | |
return $restrict_it; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replace 'customer' role (WooCommerce use by default) with your own one. | |
**/ | |
add_filter('woocommerce_new_customer_data', 'wc_assign_custom_role', 10, 1); | |
function wc_assign_custom_role($args) { | |
$args['role'] = 'subscriber'; | |
return $args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function remove_product_editor() { | |
remove_post_type_support( 'product', 'editor' ); | |
} | |
add_action( 'init', 'remove_product_editor' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('bulk_actions-edit-comments', 'ure_remove_comments_actions'); | |
add_action('comment_row_actions', 'ure_remove_comments_actions'); | |
function ure_remove_comments_actions($actions) { | |
if (current_user_can('editor')) { | |
if (isset($actions['delete'])) { | |
unset($actions['delete']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('ure_role_additional_options', 'ure_add_block_admin_notices_option', 10, 1); | |
function ure_add_block_admin_notices_option($items) { | |
$item = URE_Role_Additional_Options::create_item('block_admin_notices', esc_html__('Block admin notices', 'user-role-editor'), 'admin_init', 'ure_block_admin_notices'); | |
$items[$item->id] = $item; | |
return $items; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Hide permalink 'Edit' button for 'author' role | |
*/ | |
add_action('edit_form_before_permalink', 'ure_block_edit_slug'); | |
function ure_block_edit_slug() { | |
if (!current_user_can('author')) { | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_duplicate_product_capability', 'my_woocommerce_duplicate_product_capability'); | |
function my_woocommerce_duplicate_product_capability($cap) { | |
return 'duplicate_products'; | |
} |