Skip to main content
Anwer that was linked use current_user_can that does not fit this answer.
Source Link
gmazzap
  • 46.3k
  • 6
  • 95
  • 147

Can it be done?

Sure.

Inside author.php get the user id who viewed profile refers to, using get_queried_object_id() than check the roleget_queried_object_id() check the capability and finally conditionally display content based on that.

I said "check the capability" and not "check the role" because check roles is a meh thing, it's a lot better and recommended check for capabilities. Use user_can for the scope.

Can it be done?

Sure.

Inside author.php get the user id who viewed profile refers to, using get_queried_object_id() than check the role and finally conditionally display content based on that.

Can it be done?

Sure.

Inside author.php get the user id who viewed profile refers to, using get_queried_object_id() check the capability and finally conditionally display content based on that.

I said "check the capability" and not "check the role" because check roles is a meh thing, it's a lot better and recommended check for capabilities. Use user_can for the scope.

Source Link
gmazzap
  • 46.3k
  • 6
  • 95
  • 147

Can it be done?

Sure.

Inside author.php get the user id who viewed profile refers to, using get_queried_object_id() than check the role and finally conditionally display content based on that.