いつもお世話になっております。村上です。
Moodle3.8.1 でMoodleを利用しております。
ユーザから利用停止にしたアカウントも手動登録の
受講未登録ユーザに表示される仕様になっていると思いますが
利用停止にしたユーザを一覧に表示されない方法はありますでしょうか?
いつもお世話になっております。村上です。
Moodle3.8.1 でMoodleを利用しております。
ユーザから利用停止にしたアカウントも手動登録の
受講未登録ユーザに表示される仕様になっていると思いますが
利用停止にしたユーザを一覧に表示されない方法はありますでしょうか?
大変お手数ですが、ご質問内容に関しまして、以下の手順をお教え頂けませんでしょうか。
ありがとうございます。
Moodle Trackerでも以下のように利用停止ユーザを表示しないオプションが提案されているようですね。
[[MDL-35731] Hide (or option to hide) users with suspended enrolments in multiple areas - Moodle Tracker]
https://tracker.moodle.org/browse/MDL-35731
恐らく、以下のプログラム修正でご希望の動くに近くなるかと思います。
修正対象プログラム:
user/lib.php
修正箇所:
1477行目
[ 修正前 ]
if (!empty($additionalwhere)) {
$wheres[] = $additionalwhere;
$params = array_merge($params, $additionalparams);
}
$from = implode("\n", $joins);
if ($wheres) {
$where = 'WHERE ' . implode(' AND ', $wheres);
} else {
$where = '';
}
[ 修正後 ]
if (!empty($additionalwhere)) {
$wheres[] = $additionalwhere;
$params = array_merge($params, $additionalparams);
}
// exclude suspended users
$wheres[] = "u.suspended = 0";
$from = implode("\n", $joins);
if ($wheres) {
$where = 'WHERE ' . implode(' AND ', $wheres);
} else {
$where = '';
}
ありがとうございます。
早速修正を行いましたが、表示は変わらないですね。
教えていただいた箇所以外に修正する場所はありますでしょうか?
大変失礼しました。
以下のプログラム修正ではいかがでしょうか。
修正対象プログラム:
enrol/manual/locallib.php
修正箇所:
120行目
[ 修正前 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$sql = " FROM {user} u
JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition";
[ 修正後 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$wherecondition = "$wherecondition AND u.suspended = 0";
$sql = " FROM {user} u
JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition";
Yoshida様、ありがとうございます。
ソースを修正していました。
結果は以下の通りになりました。
1. student02とteacher02は利用停止にしているユーザですが、表示されています。
画面の4名を全員追加すると
2. 利用停止にしているstudent02とteacher02は表示されなくなりました。
動きとしては問題ないと思いますが、1.の時点で「受験未登録ユーザ」の段階で
利用停止ユーザを表示させないようにする事は難しいでしょうか?
具体的には退学・除籍などで既に学校にいないユーザになるため、既に学校にいない
ユーザがなぜ表示されているかという問い合わせが質問させていただいた発端となります。
可能であれば1の段階で表示されないようにするのは難しいでしょうか?
質問ばかりして申し訳ありませんが、宜しくお願い致します。
大変失礼しました。ユーザ検索の関数 (find_users()) が未登録ユーザ用 (Enrol candidates) と登録済みユーザ用 (Enrolled users) の2箇所にありました。
大変お手数ですが、以下のプログラム修正をお試しください。
修正対象プログラム:
enrol/manual/locallib.php
修正箇所:
55行目
[ 修正前 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$sql = " FROM {user} u
LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition
AND ue.id IS NULL";
[ 修正後 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$wherecondition = "$wherecondition AND u.suspended = 0";
$sql = " FROM {user} u
LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition
AND ue.id IS NULL";
------------------------------------------
修正箇所:
120行目
[ 修正前 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$sql = " FROM {user} u
JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition";
[ 修正後 ]
public function find_users($search) {
global $DB;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['enrolid'] = $this->enrolid;
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(1)';
$wherecondition = "$wherecondition AND u.suspended = 0";
$sql = " FROM {user} u
JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
WHERE $wherecondition";
Yoshida様、ありがとうございます。
今回の修正で受講未登録ユーザの方も利用停止アカウントは
非表示になりました。
本番サーバでも修正を行いたいと思います。
何度も対応していただき、ありがとうございました。
以上、宜しくお願い致します。