Deutsch
Vor ein paar Monaten entdeckte ich Boxcar, und ich war sofort begeistert davon. Es waren jedoch nicht die eingebauten Features (wie z.B. das Pushen von Facebook- oder Twitternachrichten auf das iPhone), die meine Aufmerksamkeit erregten. Was mich faszinierte war die Möglichkeit, sich selbst über einen einfachen HTTP POST beliebige Push-Nachrichten zu schicken.
WP Comment Push ist ein Plugin für WordPress, das jeden neuen Kommentar als Push-Nachricht an den eingestellten Boxcar-Account versendet. Vor allem bei kleineren Blogs, auf denen nur wenige Kommentare zu jedem Beitrag geschrieben werden, ist das wesentlich sinnvoller und vor allem auch schneller, als die Kommentare z.B. als RSS-Feed zu abonnieren.
Vorraussetzungen
- Ein Boxcar Account
- Die Boxcar App, installiert auf einem iOS-Gerät, mit “Growl/API” aktiviert
- php_curl sollte auf dem Server installiert sein. Wenn das nicht der Fall ist: Mit dem Hoster sprechen (bei Hosting-Kunden) oder selbst installieren (bei eigenem Server)
Installation
- Das Plugin herunterladen
- Das zip Archiv entpacken
- Den enthaltenen Ordner nach wp-content/plugins kopieren
- Das Plugin in WordPress aktivieren und die Boxcar-Zugangsdaten eingeben
- Einen Kommentar hinterlassen
English
A few month ago, I discovered Boxcar and I immediately liked it. However, I was not really interested in the built-in features, like pushing your Facebook- and Twitter newsfeed. Instead, I was fascinated by the possibility to send yourself a push notification via simple HTTP POST methods.
WP Comment Push is a WordPress Plugin that sends every new comment on your blog to your Boxcar-Account, resulting in a Push notification on your iPhone or iPad. This is especially useful for smaller Blogs that only get a few comments. It is also much faster that subscribing to your Comments via RSS.
Requirements
- A Boxcar Account
- The Boxcar App, installed on an iOS-Device, with “Growl/API” enabled
- php_curl should be installed on your Server. If that’s not the case: Talk to your hoster (if you only have webhosting) or install it yourself (if you have your own Server)
Installation
- Download the plugin
- Extract the zip archive
- Copy the folder to wp-content/plugins
- Activate the plugin in WordPress and input your Boxcar username and password
- Leave a comment
Code
function wpcp_send($id) { $username = get_option('wpcp_username'); $password = get_option('wpcp_password'); $comment = get_comment($id); if($comment->comment_approved == 1) { $gravatar = 'http://www.gravatar.com/avatar/'.md5(strtolower($comment->comment_author_email)); if(!class_exists('WP_Http')) { include_once( ABSPATH . WPINC. '/class-http.php' ); } $body = array('notification[from_screen_name]' => get_bloginfo('name'), 'notification[message]' => $comment->comment_author.': "'.$comment->comment_content.'"', 'notification[icon_url]' => $gravatar); $headers = array( 'Authorization' => 'Basic '.base64_encode("$username:$password")); $request = new WP_Http; $result = $request->request('https://boxcar.io/notifications', array('method'=>'POST','body'=>$body,'headers'=>$headers)); } return $id; }