On the profile page exists a global variable $profileuser
. The member $profileuser->roles
is an array of all roles for that user.
<?php # -*- coding: utf-8 -*-
// Plugin Name: personal_options
add_action( 'personal_options', 'print_user_roles');
function print_user_roles()
{
global $profileuser;
print '<pre>$profileuser->roles="
. htmlspecialchars(
var_export( $profileuser->roles, TRUE ), ENT_QUOTES, "utf-8', FALSE
)
. '</pre>';
}
Output:
$profileuser->roles = array (
0 => 'administrator',
1 => 'editor',
)
Use this list to compare the roles.
Related Posts:
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- How to target with css, admin elements according to user role level?
- Remove admin bar for subscribers
- Editor role cannot save custom theme options
- wordpress separate registration for different roles
- Conditional Statement – check if post has an attachment image
- Trying to use Ternary operators with WP Conditionals
- How to do conditional publishing?
- Display user role Name – not slug
- conditional statement for custom taxonomy
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Create a new usermeta field for users
- Redirect to a different page through registration, depending on page
- How to give new users two specific user role options upon WordPress user registration
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- What is the correct way to write this conditional statement?
- Reordering Buddy Press profile navigation [closed]
- Hiding div based on user role
- custom user role wordpress – grant guest access to edit.php without insert/update/delete
- Do not execute If User is login as Administrator or any Specific Role
- Is_front_page inside header.php is always returning true
- Advanced Custom Fields – display label and value only if value entered
- PHP conditional script issue
- How to check if the current page is at a specified path in the URL?
- Add post with approval by the admin
- Add class to DIV depending on page loaded
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Noindex subscriber author page
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- How to make a conditional statement within $output in shortcodes.php?
- Query for user roles
- Conditionally remove comments and post meta in functions.php
- How can I call a specific file (via php) by referencing the logged-in username?
- exclude custom post type from running a function
- include content within conditional statement?
- Plugin: Front-end Editor – User role specific editable content?
- Show label for value only when value exists, basic php
- Execute PHP code only with specific user role
- Edit and delete permissions pages and posts
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Allow a user or role to view drafts and previews, but not other admin privileges?
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- Conditional formatting on data fetched from MYSQL
- Edit a function to take different actions based on user role
- Find and print first entry from WordPress post in custom excerpt?
- Adding if statement
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- Change Login or Logout text based on status
- How to give custom roles the capability to edit one Menu instead of every Menu
- Add another role to a user when they click a button?
- Obtain wordpress user role
- How to properly create multiple conditions to redirect users roles to different pages
- Echo Option Value Based On WordPress User Role
- Role exception for a settings sub menu
- Allow BBPress participant role to trash topics
- Jetpack: Display Site Title when no Site Logo
- Custom user roles doesn’t apply changes
- If else statement based on referral URL
- Include administrator in author list
- If Month=Particular month display content [closed]
- How to connect database table to each registered wordpress user.
- Php conditional help needed
- Get author meta of all writers
- Custom Meta Box If Else Statement
- Hide a nav menu item based on get_user_meta results
- Switch-Case and user_role
- How do I reformat this to add php inside php?
- Forbid certain users to access a specific page
- Not able to see the error [closed]
- How to lock users account until approvation
- How to create a User Role and give permission to only use Web Stories plugin?
- How to create custom user role without plugin?
- Custom Admin Menu Report for Specific User ID
- How to add custom user role into wordpress
- Why include a composer.json file with my plugin?
- “comments.php” not available after edit in WP administration
- Thumbnails appear to be zoomed
- Upload non-featured image to image field
- WC_Customer delete function returns error
- Increment paged on WP_Query
- Adding “redirect” to a button
- Trying to split a query into sections of six
- Display div if category has a specific parent
- I want it to detect the duplicate comment and give a warning on the same page
- Inside Array – “unidentified index” error with “prepare was called incorrectly” despite not calling the prepared statement with wordpress [closed]
- How to identify which php file a plugin is using on page load?
- Permalinks and custom PHP application
- Updating meta_value in a custom key
- Custom post type single page return to listing page
- Using Nonce for my Form
- Transient Loop Not working as expected
- Shortcode working in page.php but not in category.php in wordpress