Saturday, December 12, 2015

Fungsi require_login

Fungsi require_login di moodle digunakan untuk memastikan:
  • user login sebelum mengakses halaman/aktivitas tertentu
  • akses user terekam dalam log
Deklarasi fungsi:
function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $setwantsurltome = true, $preventredirect = false)
Penggunaan sederhana:
require_once(__DIR__ .'/../../config.php');
require_login(NULL,FALSE); // NULL: courseid, FALSE: autologinguest
$url = new moodle_url("/ftp/somefiles/index.php");
$PAGE->set_url($url);
[halaman html/php Anda]
@Moodle 2.9.x, ref: moodle dev > Access API

No comments:

Post a Comment