You haven’t posted any code so I won’t be able to precisely post an answer for you, but this it what you can do.
Find the page that is rendering the profiles, open it and add this piece of code in it:
<?php
$user_info = get_userdata($id);
$role = $user_info->roles;
if ($role =='corporates' && !is_user_logged_in()) {
wp_safe_redirect( site_url());
exit;
}
?>
Which $id
is the user id of the profile owner, not the visitor.
If you add more technical information about your problem I will update the answer for you.
Related Posts:
- How to allow an user role to create a new user under a role which lower than his level only?
- What the user_status column?
- How to customize wp_signon()
- Displaying different in-page content to cliente/admin
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to add default folders to Every registered User when registered in WordPress site?
- Condionally/limited emails from system (cantact-form, registration, passwd reset)With
- If the current user is an administrator or editor
- Editor can create any new user except administrator
- Remove Ability for Other Users to View Administrator in User List?
- Find out if logged in user is not subscriber
- How do I programmatically set default role for new users?
- Display user registration date
- Whats the best way to share user data across multiple WordPress websites?
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- Allowing users to edit only their page and nobody else’s
- alphabetically order role drop-down selection in dashboard
- WordPress auto login after registration not working
- Execute a function when admin changes the user role
- How to let contributors to create a new revision(draft) editing their published posts
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Hide Admin Menu for Specific User ID who has administrator Role
- Problem with Hebrew characters in username
- Remove email verification when new user register
- How to set up User email verification after Signup?
- How to let user set password on registration
- How to hide media uploads by other users in the Media menu?
- Show admin bar only for some USERS roles
- How to display custom user meta from registration in backend?
- Grouping users under parent user
- How to update user role without logout
- How to check user role without using current_user_can()
- Multi-steps WordPress registration : in 4 steps how to?
- Do not allow users to create new posts and pages
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- Force users to complete their profile after they register? How to
- How to enable the theme editor cap for an editor role?
- How to assign capabilities to user NOT to User Role
- Prevent user creating new users with specific roles
- How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
- How to stop a user from updating the post date
- How do i auto approve new user?
- BuddyPress | Check if user is in current group [closed]
- Copy a user from one WordPress site to another
- Return ID of authors who have at least one post
- Can I hook into the invite user process to verify their email address is from a certain domain?
- WordPress edit_user_profile_update update secondary role
- How to get user ID during registration and add it to a custom table
- How do I properly format the user_role array?
- How-to Delay The Capability To Publish Posts?
- Get user info outside WordPress
- Limit content by user registration date
- What is the best way to avoid spammers registering to my blog?
- ACF Upload Image in front-end with custom form
- Is there a simple way to manage capabilities per user?
- Is it possible to get a user with just the password field?
- How to get the Role Name of the current user? (WordPress)
- How Do I Prevent Junk Account Creation?
- Redirect after login based on user role (custom login page)
- set_role has no effect
- WP_User->add_role producing unexpected results
- How can I check if the admin bar is visible to the current user?
- Can I create users that have access to *some* other users posts instead of all other users posts?
- Set default page for user account in admin
- Can I bulk register contributors for a new blog
- New user notification doesn’t include activation link
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- WordPress to use Drupal users’ credentials
- Users roles, make a page belonging to multiple users
- Tagging users in WordPress
- Redirect after users complete profile form
- How do I list in the backend all users that were assigned to a custom role?
- Create not-activated user in code, wordpress
- Front End Registration Form Code – Password Field Not Saving
- How to add local users to wordpress without email password?
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- the_author_meta(‘user_url’, $author->ID) not working properly. how can I solve this?
- How can I verify users facebook ID that he provides during signup process
- Getting users by specific capability, not role
- add_cap not working with Shop Manager role
- Managing Users and Creating Groups [closed]
- Plugin for limiting user registration based on ip with expiry period?
- Restricted registrations or removing the ability to edit your password/email
- Creating user in Firebase after WordPress user registration
- How to disable a specific page for a specific user
- Can user login details be used for other applications?
- Are User Levels Still Currently Used?
- Error: How to allow the “contributor” to upload media in wordpress
- Users managed to register on website with no register button?
- Remove Capabilities from WP admin for specific user role
- Add value in user table when user is created
- Updating wp_user_level on user update
- wordpress user roles are not working
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Fix permissions for users role
- Can i add password field into my wp registration form?
- User capability for editing their own comments
- What are some best practices for user exit strategy?