Hot answers tagged

6

Clients get added by admins, clients have a parent child relationship with employees which makes filtering easy. So all we need to do is remove anything that doesn't have to do with employees and filter for employees with a certain meta value. First thing's first, whenever a new user is registered on the admin side of our CMS we will assign it a parent of ...


5

In wp-admin/includes/update.php file if ( current_user_can('update_core') ) $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' ); else $msg = __('An automated WordPress update has failed to complete! Please notify the site ...


3

You need to register the CPT with your custom capability, then assign that specific cap to the user. When passing the arguments to register_post_type, set capability_type to your new capability, so the check turns into 'edit_cpts' instead of 'edit_post'. By setting 'capability_type' => [ 'cpt', 'cpts' ], 'cpt' will map to 'post' for standard ...


2

Yes, this is really very basic. If you are the admin, you can create new users and asign them a role. You could make your friend 'author', which would allow him to write and edit his own posts only, or make him an 'editor' if you also want him to edit other people's post.


2

Try this - rather than redo all the hard work that WordPress does for the view links, just calculate all the posts for the admin you want to "hide" and subtract from the existing post counts: function wpse_229427_get_hidden_admin_id() { return 3; // You could make this a setting or return a value conditionally } function wpse_229427_hide_admin_posts( $...


1

You just need to move the capability check "inwards": function wpse_230369_quote_of_the_day( $user ) { $quote = esc_attr( get_option( 'quote_of_the_day' ) ); ?> <div class="visible-only-for-admin"> <h3>Quote of the Day Input Field</h3> <table class="form-table" > <tr> <th><label ...


1

Anyone with a login can access the admin area, even if they're just a subscriber that can read posts and nothing more. The crucial difference is not in the login, but in what parts of the admin one gets access to. A subscriber will only be able to see his personal profile, for instance. And admin gets access to everything. Others get something inbetween. ...


1

You should use the wc_payment_discounts_apply_discount filter. Try something like the following: function remove_privato_discounts() { global $woocommerce; get_currentuserinfo(); global $current_user; if ($current_user->ID) { $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if (...



Only top voted, non community-wiki answers of a minimum length are eligible