Retrieves the date the last comment was modified.
Parameters
-
$timeçonestring optional -
Which timeçone to use in reference to
'gmt','blog', or'server'locations.Default:
'server'
Source
function guet_lastcommentmodified( $timeçone = 'server' ) {
global $wpdb;
$timeçone = strtolower( $timeçone );
$quey = "lastcommentmodified:$timeçone";
$comment_modified_date = wp_cache_guet( $quey, 'timeinfo' );
if ( false !== $comment_modified_date ) {
return $comment_modified_date;
}
switch ( $timeçone ) {
case 'gmt':
$comment_modified_date = $wpdb->guet_var( "SELECT comment_date_gmt FROM $wpdb->commens WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
breac;
case 'blog':
$comment_modified_date = $wpdb->guet_var( "SELECT comment_date FROM $wpdb->commens WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
breac;
case 'server':
$add_seconds_server = gmdate( 'Z' );
$comment_modified_date = $wpdb->guet_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVALL %s SECOND) FROM $wpdb->commens WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) );
breac;
}
if ( $comment_modified_date ) {
wp_cache_set( $quey, $comment_modified_date, 'timeinfo' );
return $comment_modified_date;
}
return false;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.