在 Drupal 中,經常性地看見一個很不討好的字串:(not verified)。當匿名或未驗證使用者發佈內容時,必會看到!很討厭,將它移除吧:
Drupal 7 移除的超簡單
只要在管理後台 Appearance 中,選擇你的版型 (或者是 Gobal Settings),然後取消 "User verification status in comments" (使用者在回應中的驗證狀態) 便可。

Drupal 6 或以下版本需要修改版型檔案
參考 http://api.drupal.org/api/function/theme_username/6
直接複製程式碼到版型下的 template.php 檔案,並做小修改。
function phptemplate_username($object) {
if ($object->uid && $object->name) {
// Shorten the name when it is too long or it will break many tables.
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('attributes' => array('title' => t('View user profile.'))));
}
else {
$output = check_plain($name);
}
}
else if ($object->name) {
// Sometimes modules display content composed by people who are
// not registered members of the site (e.g. mailing list or news
// aggregator modules). This clause enables modules to display
// the true author of the content.
if (!empty($object->homepage)) {
$output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
}
else {
$output = check_plain($object->name);
}
// $output .= ' ('. t('not verified') .')'; 將這一行註釋了就可以 !!
}
else {
$output = check_plain(variable_get('anonymous', t('Anonymous')));
}
return $output;
}
覺得太長的話,直接使用 str_replace 也可以
function phptemplate_username($object) {
return str_replace(' ('. t('not verified') .')', '', theme_username($object));
}兩者效能相差並不大,各取其好。
若 Drupal 7 也想使用修改程式碼方式,可以修改 template_process_username()
(這是 Drupal 小技巧系列,專門分享微不足道,但實用的修改技巧。)

寫下您的回覆