Home | Sitemap | Contact | RSS

Upgrade Wordpress to 2.9.1

February 12th, 2010

Upgraded แต่เจอปัญหาเดิมคือต้อง edit wp-db.php เรื่อง charset ไม่รู้ถ้า add ใน wp-config.php จะได้หรือเปล่า

Twitter Tools Tweet Prefix

March 21st, 2009

For Wordpress, you can change the Twitter Tools Tweet Prefix from default “New blog post” by editing the file twitter-tools.php in the wp-content/plugins directory and change the value of “tweet_prefix” to whatever you want

Drupal 6.2 and Disqus

June 15th, 2008

เพิ่ง upgrade จาก drupal 5.x เป็น 6.2 เสร็จ ราบรื่นดี ไม่มีปัญหาเรื่องภาษาไทย ไม่เหมือน wordpress ที่ต้องเข้าไป edit เรื่อง set NAME แต่ยุ่งกับ theme นิดหน่อยเพราะต้อง upgrade theme ด้วย ทำให้อะไรที่ customization ไว้ต้องมาคอยแก้ใหม่ นอกจากนี้ก็ทำการ enable search module ด้วยตอนแรกงงกับเรื่อง permission นิดหน่อย เพราะใน drupal จะมีการ set permission ว่า user แต่ละกลุ่มจะใช้งาน module ไหนอย่างไรได้บ้างทำให้ต้องเข้าไป set ตรงนั้นด้วย และก็ใน search settings ต้องมีการ run เพื่อทำ indexing ก่อนด้วยถึงจะ search ได้ จากนั้นก็ได้ลอง integrate กับ disquss เพราะเห็นล่าสุดมีคนทำเป็น modules สำหรับเอาไปลงได้ แต่ผมลองหลายรอบแล้วมันยังไม่ค่อย work จนไปได้คำแนะนำของ http://seanreiser.com/node/1336 เรื่องการ integrate ซึ่งผมลองแล้ว work เลยขออนุญาตเอามาเก็บไว้ในที่นี้ด้วย

# Goto Administer / Site building / Blocks / Add New Block
# Set the block description to ‘Disqus’
# Paste the HTML and JavaScript Code into the block body
# Select “Full HTML” as Input Format
# Goto Administer / Site building / Blocks / List
# Scroll down to the ‘Disqus’ block you just added and select configure
# Scroll down “Page specific visibility settings”
# Select “Show if the following PHP code returns TRUE (PHP-mode, experts only).”
# In the box labeled “Pages” Paste the following:

$match = FALSE;
$types = array('story' => 1, ‘page’ => 1, ‘blog’ => 1);
if (arg(0) == ‘node’ && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load(array(‘nid’ => $nid));
$type = $node->type;
if (isset($types[$type])) {
$match = TRUE;
}
}
return $match;
?>

# Scroll down to the ‘Disqus’ block you just added and select content from the dropdown.
# Scroll down to the comments modules and disable it.

Wordpress 2.5.1

June 6th, 2008

เพิ่ง upgrade จาก 2.0.2 เป็น 2.5.1 เสร็จหลังจากที่ไม่ได้ทำมานาน เจอปัญหาเดิมคือ เรื่อง UTF-8 กับ mysql 5.x.x. ภาษาไทยรวนหมด So just in case I have this problem in the future, what you have to do is add the following into wp-db.php

mysql_query(“SET NAMES ‘UTF8′”);

before this line

$this->select($dbname);

Comment Systems

June 5th, 2008

null

null

ปกติใน blogging tool ก็มักจะมี commenting tool มาให้ อย่างใน wordpress ที่ผมใช้อยู่ แต่ features อะไรต่างๆก็ไม่ค่อยเยอะเท่าไร และก็ต้องคอย manage พวก spam อยู่เรื่อยๆ ข้อเสียอีกอย่างหนึ่งคือ ถ้าเรากำหนดให้คนที่จะ comment ต้อง login ก่อนแล้วถึงจะ comment ได้ ก็มักจะเป็นการขอที่มากเกินไป โดยเฉพาะถ้าเป็น blog ที่ไม่ได้ต้องอ่านอยู่ประจำ ผมคิดว่า idea ของ third party comment systems อย่าง disqus หรือ intensedebate น่าจะไปได้ดี concept คือ แต่ละคนจะมี login ของ disqus หรือ intensedebate แล้วเวลาไปที่ blog ไหนที่ support comment systems พวกนี้ ก็สามารถจะทำการ comment โดยใช้ login ของ disqus หรือ intensedebate ได้เลย (แล้วแต่ว่า blog นั้นๆ support comment systems อันไหน) ดังนั้น ideally แล้วก็หมายความว่าถ้าทุก blog support disqus เหมือนกันหมด ผมแค่มี login ของ disqus อันเดียวผมก็สามารถไป comment ได้ทุกๆ blog ด้วย login id อันนี้ได้ และผมยังสามารถไปที่ web ของ disqus แล้วดูประวัติการ comment ของผมได้ หรือจะใช้ RSS Feed ก็ได้ และถ้าผมอยากจะติดตามการ comment ของใครที่น่าสนใจที่เขาไป comment ใน web อะไรก็ตามโดยใช้ disqus id อันนี้ผมก็สามารถติดตาม feed ของเขาได้ ซึ่งถ้าคิดๆไปก็เหมือนกับคนที่ comment นี้ มี blog ของตัวเองเหมือนกันนะครับคือเป็น blog ของ comment ที่ใครก็สามารถติดตามได้จาก RSS เป็น blog ในลักษณะ Horizontal across many webs

ปัญหาก็คือไอ้เจ้า comment systems นี้มันไม่ได้มีตัวเดียว แต่มีหลายตัวดังนั้นถ้าผมเลือกที่จะ support disqus ผมก็จะเสียคนที่เป็น user ของ intensedebate ไป และ vice versa นอกจากนี้ข้อดีอีกอย่างสำหรับคนที่ maintain blog ก็คือผมไม่ต้องมาคอย maintain users locally

เมื่อเปรียบเทียบระหว่าง disqus กับ intensedebate แล้ว disqus น่าจะมีคนใช้มากกว่าและมี settings ในเรื่องของ restrictions ดีกว่า เช่นต้อง force ให้ คน comment login เข้า disqus ก่อน ก่อนที่จะทำการ comment ในขณะที่ intensedebate ทำไม่ได้ในตอนนี้ (อาจจะเป็นความตั้งใจ เพื่อให้ทุกคน comment ได้ก่อนในช่วงแรกๆของ intensedebate ก็ได้ คือให้เป็นที่รู้จักก่อนๆที่จะ force ให้ต้อง login) แต่ผมชอบ intensedebate มากกว่า เพราะหน้าตามันสวยกว่า และสามารถ import previous comments ได้ (แต่ตอนนี้ยังมีปัญหาอยู่บ้าง ต่อไปน่าจะแก้ได้)

Send SMS From Web

April 14th, 2008

ผมชอบ idea ที่ทาง blognone เอา twitter มาใช้ โดยใช้ร่วมกับ twitterfeed เพื่อส่ง update ผ่าน RSS ให้ twitter/blognone แล้วคนที่ Follow blognone อยู่ก็จะได้รับข่าวโดยอัตโนมัติ จริงๆเรื่องการส่ง SMS ในลักษณะแบบของ twitter นี้น่าจะทำตลาดในบ้านเราได้โดยเฉพาะในกลุ่มเด็กและวัยรุ่น คิดๆจะทำเหมือนกัน เท่าที่ดูคนที่ให้บริการเรื่อง smsgateway ในบ้านเราก็มี sms.in.th thaiwebsms.com แล้วก็ applymail แต่ applymail เห็นคนบ่นว่าช้า ส่วน thaiwebsms.com ก็ปิดรับสมัครอยู่ ส่วนของต่างประเทศก็เห็นมี ipipi.com แต่ผมว่าถ้าจะทำในลักษณะ twitter เลยอาจจะต้อง deal กับค่ายมือถือโดยตรง

Get Login Page in Drupal

September 10th, 2007

ผมไปลองตั้งให้ User Login module ใน Drupal เห็นเฉพาะ authenticate user ทีนี้พอ logout ออกมาแล้วก็จะหาทาง login ไม่เจอจะเข้าไปเปลี่ยนอะไรอีกทีก็ไม่ได้ วิธีเอาหน้า login เข้ามาก็คือไปที่ ?q=user ดูง่ายๆแต่บางทีก็ลืมหรือนึกไม่ถึงเหมือนกัน ที่ต้อง disable login ก็เพราะ site ที่ทำอยู่ยังไม่จำเป็นต้องเปิดรับ user และยังมีปัญหานิดหน่อยกับ IE เรื่อง frameset ด้วย

ลองพยายาม set crontab ในสองสาม hosting ที่ใช้ทั้ง DirectAdmin และ Plesk แต่ไม่ work ทั้งแบบใช้ cron-curl.sh ของ drupal และ ใช้ /usr/bin/php /home/user/public_html/…/cron.php สุดท้ายก็มาใช้ poormanscron อย่างที่หลายๆคนแนะนำ ผมว่าดีกว่าอีกไม่ยุ่งดี และทุกอย่างอยู่ใน control ของเรา download ที่นี่ ครับ

ลองพยายามหาที่ setting ว่าให้ upload file นามสกุลอื่นได้ใน wordpress แต่ไม่เจอ ไปเจอ plugin ตัวนี้ของ Peter Westwood ที่ Peter Westwood Blog

ใช้ได้ดีครับผมเอามาไว้ที่นี่ด้วย pjw-mime-config.zip โดยให้เปลี่ยนนามสกุลหลัง download เป็น .php นะครับ ส่วนตัวอย่างการ set mime type ดูได้จากไฟล์นี้ครับ mime.txt

ผมใช้ Bytehoard ตั้งใจว่าจะใช้ manage files บน web แต่ปรากฎว่าเวลา upload files ขึ้นไปจะถูก set owner เป็น apache และ permission เป็น rw——- ซึ่งทำให้ใช้ plesk ลบไม่ได้และก็ download ไม่ได้ด้วย ผมว่าเป็นปัญหาที่เกิดจากสองส่วนด้วยกัน อันแรกคือตัว host เองซึ่ง run php เป็น module ทำให้เวลา spawn child process ออกมาจะมี user เป็น apache ซึ่งผมไม่รู้ว่ามีทาง config ให้ set user/group ให้เป็น user ที่ลูกค้าใช้ได้หรือเปล่า เพราะลองอ่านหนังสือ apache ดูเห็นมี directive AssignUserID สำหรับ Virtual Host อยู่ ไม่รู้ถ้าทาง hosting set อันนี้จะ OK หรือเปล่า อีกส่วนหนึ่งก็คงเป็นเพราะตัว script ของทาง Bytehoard เองที่ไม่รู้ทำไมไป set permission แบบนั้น อาจจะเป็นด้วยเหตุผลด้าน security แต่ก็ถือว่าทำไม่สมบูรณ์เพราะอย่างน้อยก็ทำให้ผม download file ที่ผม upload ขึ้นไปไม่ได้ คือได้ file มาแต่ size เป็น 0

workaround ที่ผมใช้ในการลบ files พวกนี้ก็คือเข้าไปใน plesk filemanager แล้วหา file ที่มี owner เป็น apache แล้วก็ทำการ edit เพื่อใส่ script unlink() กับ rmdir() เข้าไปแล้ว run script นี้ อย่าลืมว่าต้องใช้ absolute path เป็น parameter คือเริ่มตั้งแต่ /home/vhosts/…. (check ดูใน phpinfo())

directory cache กับ upload ของ wordpress ก็มี owner เป็น apache เหมือนกันแต่ดูเหมือน wordpress set permission ได้ถูกต้องจึงไม่มีปัญหาแต่อย่างใด

เพิ่มเติมตัวอย่าง php script ที่ใช้ จะมีทั้ง unlink, rmdir และ chmod ส่วน chown นั้นใช้ไม่ได้ เพราะต้องเป็น root เท่านั้น

echo unlink(“/home/httpd/vhosts/greatnote.com/httpdocs/..”)? “success” : “fail”;
echo rmdir(“/home/httpd/vhosts/greatnote.com/httpdocs/..”)? “success” : “fail”;
echo chmod(“/home/httpd/vhosts/greatnote.com/httpdocs/..”,0777)? “success” : “fail”;

สำหรับ chmod ต้องเป็นสี่หลักนะครับคือ 0777 ถ้าเป็น 777 จะไม่ได้