stephaneG-5
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Block completely backend access to a user role
Started by: stephaneG-5
in: Toolset Professional Support
Problem: I would like to completely restrict backend access from a specific User role. Solution: Here's a code example showing how to restrict users in a single role from the admin: add_action( 'admin_init', 'restrict_admin_with_redirect', 1 ); function restrict_admin_with_redirect() { $user = wp_get_current_user(); $roles = $user->roles; $role = array_shift($roles); if ( $role == 'hide-from-role-slug' && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { wp_redirect( site_url() ); exit; } } Replace hide-from-role-slug with the slug of the role you want to restrict. Then you'll probably want to hide the admin bar as well. I have an example here: add_filter('show_admin_bar', 'hide_for_roles_func'); function hide_for_roles_func(){ if( is_user_logged_in() ){ $user = wp_get_current_user(); $roles = $user->roles; $role = array_shift($roles); if( $role == 'hide-from-role-slug' ){ return false; } else { return user_can( $user, 'manage_options'); } } return false; } Replace 'hide-from-role-slug' with the slug of the role you want to restrict. |
2 | 5 | 5 years, 3 months ago | ||
With the form builder, I can't use apostrophe in a button label
Started by: stephaneG-5 in: Toolset Professional Support |
2 | 2 | 5 years, 3 months ago | ||
Side by side fields with form builder not working
Started by: stephaneG-5
in: Toolset Professional Support
Problem: I'm trying to create a Form that includes multiple fields in a single row, using a grid with columns. However, the fields always stack up vertically. Solution: To use the drag-and-drop Form builder effectively, you'll have to include the Bootstrap Library in Toolset > Settings > General. |
2 | 3 | 5 years, 3 months ago |