Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
/userpix/ -> index.php (source)

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

   1  <?php
   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)
   7  
   8  
   9  require('../config.php');
  10  
  11  $PAGE->set_url('/userpix/index.php');
  12  
  13  require_login();
  14  
  15  /// Remove the following three lines if you want everyone to access it
  16  $syscontext = context_system::instance();
  17  require_capability('moodle/site:config', $syscontext);
  18  
  19  $title = get_string("users");
  20  $PAGE->set_context($syscontext);
  21  $PAGE->navbar->add($title);
  22  $PAGE->set_title($title);
  23  $PAGE->set_heading($title);
  24  echo $OUTPUT->header();
  25  
  26  $rs = $DB->get_recordset_select("user", "deleted = 0 AND picture > 0", array(), "lastaccess DESC",
  27          implode(',', \core_user\fields::get_picture_fields()));
  28  foreach ($rs as $user) {
  29      $fullname = s(fullname($user));
  30      echo "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=1\" ".
  31           "title=\"$fullname\">";
  32      echo $OUTPUT->user_picture($user);
  33      echo "</a> \n";
  34  }
  35  $rs->close();
  36  
  37  echo $OUTPUT->footer();