ミニ白扇の入力チェック例を考えてみまして、なんだか一見うまく動いているようなので、ご笑覧いただけたらとおもい。
die するんだったら config.php で完結するのかなーと思うんですが、せっかくなので、XOOPS の表示にあわせられないかなといじってみたんですが、僕のできるようにやろうとすると、registerhook.php をいじらずにはできませんでした
間抜けなことをしていたらごめんなさい。
■config.php(エラーを日本語で返すときは EUC で保存)
// request maintenances
$stop_reason_extra_fields = '';
if( ! empty( $_POST['do_register'] )){
if($_POST['code_a']==''){
$stop_reason_extra_fields .= "コードAは入力必須項目です。<br />";
}
if($_POST['code_b']==''){
$stop_reason_extra_fields .= "コードBは入力必須項目です。<br />";
}
}
■registerhook.php l53付近
if( ! empty( $_POST['do_register'] ) && ! ( $stop_reason = userCheck( $allowed_requests['uname'] , $email4check , $allowed_requests['pass'] , $allowed_requests['vpass'] ) ) && $stop_reason_extra_fields=='' ) {
■registerhook.php l161付近
include XOOPS_ROOT_PATH.'/header.php' ;
+ $stop_reason .= $stop_reason_extra_fields;
$xoopsOption['template_main'] = 'minihaku_register.html' ;
--追加です。
■edituserhook.php l86付近
アカウントの編集でも config で設定したエラーを表示する場合。
+ if (!$stop_reason_extra_fields == ''){
+ $errors[] = $stop_reason_extra_fields;
+ }
if (count($errors) > 0) {
--shamefull typoがあったので、こっそり修正(fieldsの綴り)。