Posts

如何幫 Facebook Connect 加權限

由於 Facebook Coonect 原本僅提供基本權限連 Facebook 如果你想要透過 Drupal 去發送訊息就需要 extended permission 找到 fbconnect.module 的 theme_fbconnect_login_button function perms="publish_stream,offline_access,user_birthday,email" 可將 perms 這段加入 <fb:login-button 後面 Facebook 權限設定可參考這邊

Fatal error: Call to undefined function invite_page_title() in /xxx/includes/menu.inc on line 504

最近把一個 Drupal 網站換到另外一個空間 登入網站後就發生了上面的錯誤訊息 原本以為是 invite 模組 在 menu 裡面沒有移除乾淨 但到 menu 的 table 裡面卻又沒看到 invite 字眼的資料 查了一下才發現這是 cache 的問題 登入後雖然會出現 error msg 但你還是可以到 /admin/settings/performance 去把 cache 給清掉 程式就會正常了 參考資料: Fatal Error | drupal.org

安裝 memcached

如何在 CentOS 5.5 Zend Server 5.0.3 下安裝 memcached 由於 Zend Server 也是用 apache 所以設定上大致相同 php pecl 同時有 memcache 跟 memcache d 兩個套件 建議安裝 memcache d 這個後續還有在維護的套件 1. 安裝所需套件 libevent-devel yum install libevent-devel 2. 下載 libmemcached http://download.tangent.org/libmemcached-0.44.tar.gz ./configure make && make install 3. 啟動 memcached /usr/local/bin/memcached -d -u root -m 512 -p 11211 4. 安裝 pecl memcached /usr/local/zend/bin/pecl install memcached 然後在 php.ini 加入設定 extension = memcached.so ;extension = /usr/local/zend/lib/php_extensions/memcached.so(請不要設定直接路徑,會抓不到,請以上面設定為主) 5. 重開後看看 phpinfo 裡面是否有 memcached

如何申請 Windows Live ID 的 Apps

用 Drupal 以來一直有個問題 第三方開發者開發的程式說明不足夠 對於這種菜鳥總是要花很多時間去找到底是哪邊出了問題 甚至還有模組把 function 寫好 功能頁面還要你自己去寫 orz... 這次是因為裝了 Windows Live ID Integration 到了 My Account 裡面有個 Windows Live Indentity, 點 Activate Windows Live ID 進去認證會導到 http://localhost/webauth/sample/webauth-handler.php 發現無法正常使用 或者是我沒發現開發者把申請 App ID 的資訊寫到哪邊 後來在網路上找到一篇 msdn 的文章 終於解開了我的迷惑~ 最主要要去下面申請 App,這邊需要 Windows Live ID 當作申請的帳號 Live Services Developer Portal 他會給你 Application ID、Domain(s)、Return URL、Secret Key 這幾個資訊 其中 Domain 跟 Ruturn URL 是你自己設定的,Ruturn URL 要設定 callback 的網址,通常跟 Domain 位置會不一樣,但如果你用 Drupal 應該是一樣的,但 Return URL 前面要加上 http:// ,並且後面要加上 winliveid/handler,如 http://example.com/winliveid/handler 然後把 Application ID 跟 Secret Key 拿去餵 Windows Live ID Integration 的 Application-Key.xml 就好了 使用 Windows Live ID Integration 的版本為 6.x-1.x-dev(2010-Jul-11) 參考資訊: Running the PHP QuickStart Sample

使用手機發 Facebook stream.publish

一般 Facebook 的 access token 取得方式僅能夠用在註冊的網站 如果你用在手機的話,他會噴下面訊息給你看 Invalid access token signature. 而且用手機發還需要有 uid 或 session key 這兩個其中一個參數 不然他會噴 parameters uid or session key required 整個傳送方式如下: step 1. 取得 code https://graph.facebook.com/oauth/authorize?client_id=175981222462&redirect_uri=http://otc.mymode.idv.tw&display=touch&scope=user_photos,email,user_birthday,user_online_presence,offline_access,publish_stream (2010-10-06 更新) step 2. 取得 token https://graph.facebook.com/oauth/access_token?client_id=your client id&redirect_uri=your uri&client_secret=your client secret&code=上面的 code= &type=client_cred step 3. 發送 stream.publish https://api.facebook.com/method/stream.publish?format=json&message=your message &uid=your uid &access_token=your token 參考網站: Error validating verification code.

Drupal : Fatal error: Call to undefined function oauth_common_authorization_levels() in...

這次輪到 Services OAuth 了! 錯誤訊息: Fatal error : Call to undefined function oauth_common_authorization_levels() in xxx \sites\default\modules\services_oauth\services_oauth.admin.inc on line 19 請先確認一下您裝得版本是否正確 NOTICE: The 6.x-2.x branch of services_oauth is not compatible with the 6.x-2.x branch of services. To use the 6.x-2.x branch you must use the 6.x-3.x branch of services. 如果您剛好 Services 是裝 6.x-2.2 版 而 Service OAuth 就只能裝 6.x-1.0-beta6 版 你應該在 admin/build/services/authentication 會遇到上面的錯誤畫面 請修改這兩支檔案 1. services_oauth.admin.inc 第 19 行請改成 foreach (oauth_common_context_load_all() as $name => $level) { 2. services_oauth.inc 第 79 行請改成 $autho_levels = oauth_common_context_load_all(); 這樣就功德圓滿了~

Druapl : user warning: Table 'drupal.services_keys' doesn't exist query: SELECT * FROM services_keys in...

如果您的 drupal 上面裝了很多 services server 那就有可能遇到這個問題 user warning: Table 'drupal.services_keys' doesn't exist query: SELECT * FROM services_keys in" 可以先把 services server 跟相關的 services 關掉 最後再把 services 給移除後重新安裝 然後 enable 後再把原本的 services 打開 應該就不會以上的錯誤訊息了 以下的 reference 還有人出 $50 解決這個問題咧 XD Reference: Will Pay $50 to have someone manually install database tables