Moodle: Display full names for logged in users

Here is a tiny hack to show full names for logged in users and first names only for guests. This setup, which is not available in Moodle config, allows the public to view some courses in our Moodle without getting too much information about student identities.

Modify function fullname at line 2301 of /lib/moodlelib.php

if (!isguest()) {return $user->firstname .' '. $user->lastname;} else {return $user->firstname;}

If you use a different fullname format (e.g., lastname, firstname), then you should modify a different line of that function.

Next, I would like to enable a “guest” option for registered users, so that they don’t have to enroll in a course in order to view its contents. Or, I could automatically enroll users in courses they select without asking, but that would not be as smooth.


  1. Stephen Rahn says:

    This is something I might need to try at some point. Thanks! Our Moodle experience here in GA is becoming more and more interesting.

  2. Ben says:

    Hi, Richard. I am using moodle for my students. I hope they can use their account individually. But I found they can log on the system at the same time using one account. Can do anything to moodle to avoid it?
    My mail is

    Thank you.

  3. rkassissieh says:


    In my experience, if you give students individual accounts and ask them to keep their passwords secure, they will log in with their individual accounts for the most part. Can Moodle prevent simultaneous logins? I don’t know, but you may find that in either Moodle or course settings.