- 2011-08-05 (金) 17:44
- Moodle
超小ネタ。Moodle のログインフォームブロックに 『ゲストとしてログインする』 ボタンを配置してみました。
blocks/login/block_login.php の get_content() に以下を追加。
if ($CFG->guestloginbutton and !isguestuser()) {
$this->content->text .= '<form class="loginform" action="'.$wwwroot.'/login/index.php" method="post" id="guestlogin">';
$this->content->text .= '<input type="hidden" name="username" value="guest" />';
$this->content->text .= '<input type="hidden" name="password" value="guest" />';
$this->content->text .= '<input type="hidden" name="testcookies" value="1" />';
$this->content->text .= '<div class="c1 btn"><input type="submit" value="' . get_string("loginguest") . '" /></div>';
$this->content->text .= '</form>';
}
NetBeans 7.0 の練習がてらに修正してみました。次はサイトトップのコース表示を「ゲストがログインできるもののみ表示する」という修正。(多分、次のエントリ)。
以下の関連(しているかもしれない)記事もどうぞ!
コメント:0
トラックバック:0
- このエントリーのトラックバックURL
- http://digitalbox.jp/happy-go-lucky-computing/moodle/adding-guest-login-button-on-sidebar/trackback/
- Listed below are links to weblogs that reference
- Moodle 小ネタ: ゲストログインボタンをログインフォームブロックに表示 from digitalbox
