福音堂主網站的各文章是不需登入即可發表回應的,但近來發現一般訪客若使用自訂的名字,則名字後方會被系統加上「未確認」的字樣,有點惱人,於是搜尋了一下解決方法,原來要在樣板程式中手動新增 phptemplate_username 的函式,再拿掉「not verified」的輸出即可。處理流程如下:
1. 在所使用的主題(theme)目錄下編輯 template.php
2. 加入以下程式碼:
<?php function phptemplate_username($object) {
if ($object->uid && $object->name) {
if (drupal_strlen($object->name) > 20) {
$name = drupal_substr($object->name, 0, 15) .'...';
}
else {
$name = $object->name;
}
if (user_access('access user profiles')) {
$output = l($name, 'user/'. $object->uid, array('title' => t('View user profile.')));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
if ($object->homepage) {
$output = l($object->name, $object->homepage);
}
else {
$output = check_plain($object->name);
}
//$output .= ' ('. t('not verified') .')';
//上方註解掉的程式就是「未確認」字樣的輸出,因此也可以將那行整個拿掉。
}
else {
$output = variable_get('anonymous', t('Anonymous'));
}
return $output;
}?>
3. 儲存後記得清除網頁快取。
參考資料:
http://www.mattfarina.com/2007/04/12/removing-not-verified-anonymous-users


最新回應
1 周 4 天前
3 周 1 天前
4 周 1 天前
4 周 2 天前
16 周 3 天前
16 周 4 天前
18 周 6 天前
18 周 6 天前
18 周 6 天前
19 周 10 小時前