ユーザ情報は個人情報でもありますから、「表示する/しない」を選べなければいけません。
(ユーザ情報そのものを他者から見えなくする、なんてありふれたTipsはいまさら書きませんが、ミニ白扇のinclude/config.php で権限チェックするく方法なら、コアHackではなくなるので、今後のバージョンアップにも高い耐性がつきます)
ここでは、生誕年を隠してみましょう。チェックボックスの使い方の練習でもあります。(4)にも書いた通り、チェックボックスは、inputの中でも特殊ですから。
というわけで、いつもの手順です。
I. DB にALTER TABLE を発行する
ALTER TABLE (prefix)_users ADD display_birthyear tinyint not null default 0;
II. テンプレートを書き換える
minihaku_edituser.html (必要なら minihaku_register.html にも) に挿入
<input type="checkbox" name="display_birthyear" id="display_birthyear" <{if $display_birthyear}>checked="checked"<{/if}> /><label for="display_birthyear">生誕年を表示する</label>
$extra_fields = array(
'sex' => array(
'initval' => -1 ,
'options' => array( 0 => '男' , 1 => '女' ) ,
) ,
'birth' => array(
'initval' => '1950-01-01' ,
) ,
'display_birthyear' => array(
'initval' => false ,
) ,
) ;
if( empty( $minihaku_uid4whr ) ) {
foreach( $extra_fields as $key => $attribs ) {
$allowed_requests[$key] = $attribs['initval'] ;
}
} else {
$db =& Database::getInstance() ;
list( $allowed_requests['sex'] , $allowed_requests['birth'] , $allowed_requests['display_birthyear'] ) = $db->fetchRow( $db->query( "SELECT sex,birth,display_birthyear FROM ".$db->prefix("users")." WHERE uid=$minihaku_uid4whr" ) ) ;
$allowed_requests['sex'] = intval( $allowed_requests['sex'] ) ;
$allowed_requests['display_birthyear'] = (bool)$allowed_requests['display_birthyear'] ;
// for the plugin of modifier.minihaku_userinfo.php
$fields4html['sex'] = $extra_fields['sex']['options'][ $allowed_requests['sex'] ] ;
$fields4html['birth'] = str_replace( '-' , '/' , $allowed_requests['birth'] ) ;
if( ! $allowed_requests['display_birthyear'] ) $fields4html['birth'] = substr( $fields4html['birth'] , 5 ) ;
}