Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
2 posts Page 1 of 1
Recently I started using Push.co to receive notifications of my backup. Then I thought about modifying the Couch, so that every time someone comments on my website I receive a notification on my phone.

Receiving the notifications is relatively simple. Create an app on http://push.co/, then open the Developer tab to obtain the necessary keys.

Go now to your Couch files and open the functions.php.

Just above " KFuncs function ( ) { " paste this function:
Code: Select all
function push ( $ message ) {
              $ url = ' https://api.push.co/1.0/push ' ;
             
              $ key ='' ;
              $ secret ='' ;

              $ myvars = ' message = ' . $ message . '& api_key =' . $ key . '& api_secret =' . $ secret ;

              $ ch = curl_init ( $ url ) ;
              curl_setopt ( $ ch , CURLOPT_POST , 1 ) ;
              curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ myvars ) ;
              curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , 1 ) ;
              curl_setopt ( $ ch , CURLOPT_HEADER , 0 ) ;
              curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ;
              curl_exec ( $ ch ) ;
}


Enter in the fields, the keys of "Push.co". After this, go to the line in 2380 and below "$comment_id = $DB->last_insert_id;" insert this line:
Code: Select all
$this->push( $name.' - '.$data );

In this case, it sends me a notification with the name and message.

Image

Note: The app is only for iPhone. But will be released soon for Android

Hope this helps :)
Nice...good job!! I will give it a try
2 posts Page 1 of 1