Jump to content

Recommended Posts

Posted

Okay, I've decided to tackle Moodles inability to hide teachers first names.

I'll focus on Moodle 2 using LDAP Auth and that all students username's start with a number E.G 08Student

 

to simply hide everyone's name you can add to your config.php

$CFG->forcefirstname = " "; //The first name is replaced with a space

but this hides everyones first name and I want to replace only teachers with Mr/Mrs

 

In AD we have the title set, yet no option for moodle to import title but in LDAP setup page we can change an unused field to title. That way we can put for example if we use phone2(mobile)

$CFG->forcefirstname = "$user->phone2"; //The first name is replaced with the users title (because we set phone2 to title)

The problem with this is $user hasn't been processed in config.php so we need to put it somewhere after config but before the fullname function is processed.

 

Lib/moodlelib.php around line 3258 after " global $CFG, $SESSION;"

would be the best place to add it.

 

$unreplace = $user->username;
if (!is_numeric ("$unreplace[1]")) $CFG->forcefirstname = ' ';

what this does is If the username has no numbers at the start force the first name to be blank

 

--currently I've got this far I'll update this topic regularly

--I'm also working on a simple way to get timetables into moodle from sims.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...