如何在 moodle 上获取首次访问日期?
how get First Access date on moodle?
我使用了一个插件:Course completion overview 但我还需要一个包含用户首次访问日期的列, sql 我需要什么?
要添加用户首次访问 Moodle,您必须编辑插件文件夹中的 index.php 文件并编辑此 MySQL 请求:
$compdatacoursesql = "SELECT u.id AS userid, c.id as courseid,
[...]
u.email,
[...]
通过添加:
u.firstaccess AS userfirstaccess,
所以它将是:
$compdatacoursesql = "SELECT u.id AS userid, c.id as courseid,
[...]
u.email,
u.firstaccess AS userfirstaccess,
[...]
然后在foreach中添加
$a[] = ($row->userfirstaccess? date('jS F Y H:i:s', ($row->userfirstaccess)) : 'Never connected');
PHP date() 函数使日期易于阅读