SHARE
TWEET

Enth inactivity notif fix

eldarian Apr 10th, 2016 (edited) 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1) open dashboard.php, around line 130, find this:
  2.  
  3.    $info = get_listing_info( $id );
  4.    $stats = get_listing_stats( $id );
  5.  
  6.    // now check $lastupdated -- if more than 8 weeks ago, notify!
  7.    $weeks = 0;
  8.  
  9. 2) under $weeks = 0;, add the following:
  10.  
  11.    $lastupdated = new DateTime($stats['lastupdated']);
  12.    $currentdate = new DateTime();
  13.  
  14. 3) a few lines below, find:
  15.  
  16.    if( $stats['lastupdated'] == '' || // no last updated date
  17.       $weeks >= 8 ){
  18.  
  19. 4) now replace:
  20.  
  21.       $weeks >= 2 ){
  22.  
  23. with:
  24.  
  25.       $lastupdated->diff($currentdate, true)->days > 55 ){
  26.  
  27. 5) save and upload, check how many (almost) inactive fanlistings you have, yikes.
  28.  
  29. P.S.: in the end, your code block should look something like:
  30.  
  31. <?php
  32. $owned = get_owned( 'current' );
  33. $header = true;
  34. foreach( $owned as $id ) {
  35.    $info = get_listing_info( $id );
  36.    $stats = get_listing_stats( $id );
  37.  
  38.    // now check $lastupdated -- if more than 8 weeks ago, notify!
  39.    $weeks = 0;
  40.    $lastupdated = new DateTime($stats['lastupdated']);
  41.    $currentdate = new DateTime();
  42.  
  43. /* // OLD LEGACY CODE
  44.    if( $stats['lastupdated'] && date( 'Y' ) != date( 'Y', strtotime( $stats['lastupdated'] ) ) ) {
  45.       $weeks = ( 52 - date( 'W', strtotime( $stats['lastupdated'] ) ) ) + date( 'W' );
  46.    } else if( $stats['lastupdated'] ) {
  47.       $weeks = date( 'W' ) - date( 'W', strtotime( $stats['lastupdated'] ) );
  48.    }
  49. */
  50.    if( $stats['lastupdated'] == '' || // no last updated date
  51.       $lastupdated->diff($currentdate, true)->days > 55 ){
  52.       if( $header ) {
  53. ?>
  54.          <h2>Neglected Listings Notification</h2>
  55.          <p>The following listings have gone on two months without a
  56.          newly-approved member or a new/updated affiliate!</p>
  57.          <ul>
RAW Paste Data
Top