How to change menu page capability
How to change menu page capability
How to change menu page capability
Locking Down WordPress Application Password Permissions / Capabilities
You set a custom url after rewrite from a login. A small example, usable in a template of the theme to login. <?php $redirect = esc_url( ‘your-url’ ); if ( ! is_user_logged_in() ) { $link = ‘<a href=”‘ . get_option( ‘siteurl’ ) . ‘/wp-login.php?redirect_to=’ . home_url( “https://wordpress.stackexchange.com/” ) . ‘”>’ . esc_attr__( ‘Login’, ‘documentation’ ) … Read more
As alternative to a cron job, you may use a “just in time” removal of the role. i.e. when an user logs in, you can check if it has the role(s) you want to expire, check current date with download date and update the user accordingly. This assumes that you are able to get the … Read more
You can set force a specific Admin Color Scheme pro user role through a function. Personally I would first take away the option to select the scheme from profile.php (Back-end Users/Your Profile) Below is just an example function which does set a specific color scheme for specific user roles. Please make first make a backup … Read more
Please try this code instead- add_filter( ‘body_class’, ‘wpse_268176_body_class’ ); function wpse_268176_body_class( $classes ) { $user = wp_get_current_user(); if ( in_array( ‘subscriber’, $user->roles ) ) { $classes[] = ‘class-name’; // your custom class name } return $classes; } Place this in your active theme’s functions.php file. [Thanks Dave Romsey for your suggestion.]
The read capability must be set to true, so they can access. Keep in mind, roles are saved to the database, when you run it on every init action, this is considered to be time consuming. The Codex suggests to run those actions in the register_activation_hook(). Since you are using this code in your theme, … Read more
You should set your address with the static method. For example: wp_localize_script( ‘jquery_login’, ‘ajax_object’, array( ‘ajax_url’ => admin_url(‘admin-ajax.php’), ‘redirecturl’ => get_bloginfo(‘url’) . ‘/user/dashboard’ // Your Address ) );
#Update: Wow, I feel like such a buffoon… haha. WP_Role::has_cap I can’t (role) my eyes hard enough. $caps = array( ‘cap_1’, ‘cap_2’, ‘cap_3’ ); $roles = array( ‘administrator’, ‘editor’ ); foreach( $roles as $role ) { if( $role_object = get_role( $role ) ) { foreach( $caps as $cap ) { if( !$role_object->has_cap( $cap ) ) … Read more
Here’s my approach. Bear in mind that it covers the basic needs you’ve described but could be easily expanded into more robust solution. Few steps to follow (all code goes to your functions.php): 1. Save company name as user meta The first thing we need to do is assigning a company name to a user … Read more