Skip to content

Instantly share code, notes, and snippets.

@aurenen
Created April 11, 2016 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aurenen/4f6fff9bccc138b897cde867835432a9 to your computer and use it in GitHub Desktop.
Save aurenen/4f6fff9bccc138b897cde867835432a9 to your computer and use it in GitHub Desktop.
Fix date check on dashboard.php for Enth3 inactive fanlistings
1) open dashboard.php, around line 130, find this:
$info = get_listing_info( $id );
$stats = get_listing_stats( $id );
// now check $lastupdated -- if more than 8 weeks ago, notify!
$weeks = 0;
2) under $weeks = 0;, add the following:
$lastupdated = new DateTime($stats['lastupdated']);
$currentdate = new DateTime();
3) a few lines below, find:
if( $stats['lastupdated'] == '' || // no last updated date
$weeks >= 8 ){
4) now replace:
$weeks >= 2 ){
with:
$lastupdated->diff($currentdate, true)->days > 55 ){
5) save and upload, check how many (almost) inactive fanlistings you have, yikes.
P.S.: in the end, your code block should look something like:
<?php
$owned = get_owned( 'current' );
$header = true;
foreach( $owned as $id ) {
$info = get_listing_info( $id );
$stats = get_listing_stats( $id );
// now check $lastupdated -- if more than 8 weeks ago, notify!
$weeks = 0;
$lastupdated = new DateTime($stats['lastupdated']);
$currentdate = new DateTime();
/* // OLD LEGACY CODE
if( $stats['lastupdated'] && date( 'Y' ) != date( 'Y', strtotime( $stats['lastupdated'] ) ) ) {
$weeks = ( 52 - date( 'W', strtotime( $stats['lastupdated'] ) ) ) + date( 'W' );
} else if( $stats['lastupdated'] ) {
$weeks = date( 'W' ) - date( 'W', strtotime( $stats['lastupdated'] ) );
}
*/
if( $stats['lastupdated'] == '' || // no last updated date
$lastupdated->diff($currentdate, true)->days > 55 ){
if( $header ) {
?>
<h2>Neglected Listings Notification</h2>
<p>The following listings have gone on two months without a
newly-approved member or a new/updated affiliate!</p>
<ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment