0

Profile field groups allow you to create distinct collections of profile fields. Is there a way to set permissions on one of those field groups so that even the user requires a certain level of access to view or modify their own? Perhaps there's something set up for metadata?


I run an online tutoring service and would like my tutors to keep a running synopsis of each student. While not legally sensitive, it would be poor form to share this with the student. A similar question was asked before but left unanswered. I asked something similar but this was about restricting editing privileges for a specific profile field that the user could see, which is different.

1 Answer 1

1

You can wrap the fields in an if statement that checks the logged in users capabilities. Assuming the tutors have the Editor role and the student don't, you could:

if( current_user_can('editor') ) {
    // list fields hidden from student here
}

You could pick out any role or capability to use in that function as long as the tutors have it and the students don't. Review a full list of roles and capabilities. If you wanted to go further you could setup a custom role or capability if there isn't one already.

2
  • Would that go so far as to prevent the user from ever seeing that this field exists? Commented Sep 13, 2016 at 17:06
  • Yes, when they view their profile they wouldn't ever see the fields. You would probably have to do something similar when saving the profiles so that the contents weren't updated to blank when the student makes an update.
    – Fencer04
    Commented Sep 13, 2016 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.