Skip to content

Instantly share code, notes, and snippets.

@Benunc
Last active July 29, 2022 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Benunc/920f8c2eb09b9403d5dda2f778dc3ffc to your computer and use it in GitHub Desktop.
Save Benunc/920f8c2eb09b9403d5dda2f778dc3ffc to your computer and use it in GitHub Desktop.
<?php
//if you are pasting this code into a snippet plugin, most of them don't require the opening PHP tag above
add_filter( 'admin_body_class', 'body_class_user_role' );
function body_class_user_role( $classes ) {
$current_user = get_current_user_id();
if( is_user_logged_in() && $current_user === 564) {
$classes .= 'give-accountant';
}
return $classes;
}
add_action('admin_head', 'my_custom_admin_style');
function my_custom_admin_style() {
echo '<style>
.give-accountant a[href*="post-new.php"],
.give-accountant a[href*="media-new.php"],
.give-accountant #give-stripe-opt-refund-wrap,
.give-accountant a[href="edit.php?post_type=give_forms&page=give-settings"] {
display: none!important;
}
</style>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment