Show IDnumber on profile but hide from students

Show IDnumber on profile but hide from students

by ben reynolds -
Number of replies: 3
Hi All,
Please move me if I'm in the wrong forum.

Our intent is to help teachers distinguish between many students with same last names whose first names may have been changed by the students.
Example:
Jinx Chen (really Alexander Chen)
Amy Chen (really Jocelyn A Chen)
1 Chen (really Sun Chen)

Our unique identifier is the IDnumber.

Courtesy of How can I show ID Number in the user profile form? we know how to put the idnumber on the profile, but, for security reasons, we don't want students to be able to view the idnumber. The IDnumber is identical to username in our system.

How can we limit viewing of IDnumber to teachers and administrators?
Average of ratings: -
In reply to ben reynolds

Re: Show IDnumber on profile but hide from students

by ben reynolds -
Never mind. We figured out how to do this.

Added at around line 252 in user/view.php

if ($user->idnumber) {
print_row(get_string("idnumber").":", "$user->idnumber");
}

to get the full modified form of
if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) {
if ($user->address) {
print_row(get_string("address").":", "$user->address");
}
if ($user->phone1) {
print_row(get_string("phone").":", "$user->phone1");
}
if ($user->phone2) {
print_row(get_string("phone2").":", "$user->phone2");
}
if ($user->idnumber) {
print_row(get_string("idnumber").":", "$user->idnumber");
}

}

In reply to ben reynolds

Re: Show IDnumber on profile but hide from students

by Jamie Tinley -

Hi Ben,

Thanks, that is exactly my situation too!  I'm hoping it will still work when we upgrade to 2.1 next year.  Thanks again

 

Jamie

In reply to Jamie Tinley

Re: Show IDnumber on profile but hide from students

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

MDL-26647, which should go into Moodle 2.2, may help with what you want.