Try to do this:
<?php global $current_user;?>
<?php if(is_user_logged_in()) :?>
<?php get_currentuserinfo();?>
<?php if(is_array( $current_user->roles ) && in_array( 'map_user', $current_user->roles ) ) : ?>
<div id="mapContent">
<?php require("/mapping/".$current_user->user_login.".html/"); ?>
</div>
<?php endif; ?>
<?php endif; ?>
Source codex.wordpress.org
Related Posts:
- 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
- Allow a user or role to view drafts and previews, but not other admin privileges?
- Add another role to a user when they click a button?
- How to connect database table to each registered wordpress user.
- Get author meta of all writers
- Forbid certain users to access a specific page
- 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
- Remove update nags for non-admins [duplicate]
- Allow Editors to edit pending posts but not draft ones
- wp_insert_user role not working
- Create a global variable for use in all templates
- Add extra field to users
- How to target with css, admin elements according to user role level?
- Remove admin bar for subscribers
- Integrating WordPress to my website, while keeping my own authentication system
- Display user’s total comment count outside The Loop
- Changing user_nicename
- Editor role cannot save custom theme options
- How to auto login user again after change user_login
- What is the most efficient way to search users by their display name?
- Can i check if user is doing any ajax request?
- How do I create a WP user outside of WordPress and auto login?
- Network installation giving errors when viewing or adding a user
- Showing user ID on user main page from screen options
- wordpress separate registration for different roles
- Getting the Current User
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- How do I hide specific user profile fields?
- Reapproval for edits and deletion after post is published
- add_cap not working
- wordpress archive a user
- Best practice for show data to one specific user?
- Call to undefined function get_userdata() in plugin
- How do I find PHP file that contains content of my page?
- WordPress page content outside WordPress
- get_users meta_query: REGEXP not working for matching new lines
- Change CSS based on is_user_logged_in
- How to show a users bio on a page
- “operation successful” message
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Add post with approval by the admin
- php if username is role
- Is it possible to display a DIV to not logged in users and then change it for users who are logged in?
- How do you create two separate Register pages?
- How to keep the capability of users and disable Gutenberg editor in WordPress?
- Is it possible to create new user from external form using REST API?
- Foreach loop inside an array_merge
- Add User Role: Pre-saved in User-Meta [SOLVED]
- Show current user posts only
- Shortcode for Listing Users from Meta Value?
- Array to string conversion error in PHP 7.2 when returning user role as class
- Change page password every day (predictable password ;) )
- show something only when user comes from specific page at remote host?
- Get the users that my following users are following
- create front-end users post list by specific category
- How to turn each phone number within the $content to a telephone link?
- Noindex subscriber author page
- Display an image based on field value
- Show site content based on user role
- ‘pre_user_query’ interfering with user export
- Query for user roles
- php return username of currently viewed author profile
- WordPress Twenty Eleven PhP – forcing php code to skip first post on homepage?
- How to list users like an archive page 10 users on page and have navigations
- Redirect to current user page upon link click
- Use of antispambot with $curauth->email
- Uses for function: wp_update_user
- Plugin: Front-end Editor – User role specific editable content?
- search and add in wordpress content
- Display additional user fields
- Execute PHP code only with specific user role
- For some time, some of my pages do not display the content anymore. Any idea where this could be coming from?
- Edit and delete permissions pages and posts
- Generate a QR code when creating a new WordPress user
- How to Add a cutsom slug to my custom author role
- Execute function only for specific user roles
- Change wordpress’ database data using ajax – how to get current user id?
- Sort new column in Users wp-admin
- Sort column in Users admin Tab
- Woocommerce display orders with products from specific categories to specific admins
- Storing huge number of users in wordpress
- Admin Panel 404 Error after login
- How to block specific user id in custom login form?
- Get current user id in function php
- how to create a user rule that can only manage support tickets?
- Hide payment method based on user role AND minimum cart value
- How to count active users on a specific page
- how can I call a function when time expire
- Hide Approved status for certain users in users list
- Call WP Rest-Api to GET /users/me returned NOTHING in console
- Uploading/integrating custom user registration page
- Edit a function to take different actions based on user role
- If user has clicked link add class and store using PHP/WordPress
- Store data from JavaScript object to custom table in user account
- Export WordPress User Meta to CSV/Excel