drupal: บันทึกแก้โมดูล switch theme
Submitted by wd on Sun, 2007-12-09 20:02
เพิ่งสังเกตุว่าโมดูล Switch Theme เขาไม่ยอมเปลี่ยนธีมสำหรับผู้ใช้ทั่วไป (anonymous users)
ลองค้นดู bug ของ switchtheme พบ patch แก้ปัญหาไว้แล้ว แต่ยังไม่มีสำหรับ Drupal-6
เลยทดลองแก้ไขดู ได้ความแพตช์ดังนี้ครับ
$ patch -u -p switchtheme.module
--- switchtheme.module 2007-08-31 21:56:14.000000000 +0700
+++ switchtheme.module 2007-12-09 19:46:14.000000000 +0700
@@ -148,11 +148,17 @@ function switchtheme_switch_form_submit(
// save the setting in the db for logged in users
// save the setting in the session for all others
if ($user->uid > 0) {
- variable_set('theme_default', $form_values['custom_theme']);
+ // FIX DEFAULT THEME CHANGED
+ //variable_set('theme_default', $form_values['custom_theme']);
if (user_save($user, array('theme' => $form_state['values']['custom_theme']))) {
$user->theme = $form_state['values']['custom_theme'];
}
}
+ // FIX ANONYMOUS SWITCH THEME
+ elseif (user_access('switch theme')) {
+ // save the setting in the variable for all others
+ $_SESSION['custom_theme'] = $form_state['values']['custom_theme'];
+ }
}
@@ -184,4 +190,4 @@ function switchtheme_select() {
}
asort($select);
return $select;
-}
\ No newline at end of file
+}
- Printer-friendly version
- Log in or register to post comments
- 5140 reads







Comments
go inter
go inter ซะแล้วอาจารย์เรา ...
