2 // This simple script displays all the users with pictures on one page.
3 // By default it is not linked anywhere on the site. If you want to
4 // make it available you should link it in yourself from somewhere.
5 // Remember also to comment or delete the lines restricting access
6 // to administrators only (see below)
9 include('../config.php');
13 /// Remove the following three lines if you want everyone to access it
14 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
16 if (!$users = $DB->get_records("user", array("picture"=>"1"), "lastaccess DESC", "id,firstname,lastname")) {
17 print_error("nousers");
20 $title = get_string("users");
22 $PAGE->navbar->add($title);
23 $PAGE->set_title($title);
24 $PAGE->set_heading($title);
25 echo $OUTPUT->header();
27 foreach ($users as $user) {
28 $fullname = fullname($user);
29 echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=1\" ".
30 "title=\"$fullname\">";
31 require_once($CFG->libdir.'/filelib.php');
32 $userpictureurl = get_file_url($user->id.'/f1.jpg', null, 'user');
33 echo '<img src="'. $userpictureurl .'"'.
34 ' style="border:0px; width:100px; height:100px" alt="'.$fullname.'" />';
38 echo $OUTPUT->footer();