Plugin Directory

Changeset 488965


Ignore:
Timestamp:
01/12/2012 07:43:24 PM (14 years ago)
Author:
SpeakFeel
Message:

Fixes notificaiton call to not repeat on published posts after an edit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • joemobi/trunk/joemobi-api.php

    r488350 r488965  
    9696
    9797function joemobi_post_notification( $post ) {
    98     $context = stream_context_create(array(
    99       'http' => array(
    100           'header'=>'Connection: close',
    101           'timeout' => 3
    102       )
    103   ));
    104     @file_get_contents('http://api.joemobi.com/notify/?id=' . $post . '&url=' . urlencode(get_bloginfo('url')), false, $context);
     98    $p = get_post($post);
     99   
     100    // Don't notify on edits.
     101    // We're assuming here an "edit" is when the modification date is > the published date.
     102    if (@strtotime($p->post_date) >= @strtotime($p->post_modified)) {
     103        $context = stream_context_create(array(
     104          'http' => array(
     105              'header'=>'Connection: close',
     106              'timeout' => 3
     107          )
     108      ));
     109        @file_get_contents('http://api.joemobi.com/notify/?id=' . $post . '&url=' . urlencode(get_bloginfo('url')), false, $context);
     110    }
     111   
    105112}
    106113
Note: See TracChangeset for help on using the changeset viewer.