Advertisements

get_lastcommentmodified

Definition:
function get_lastcommentmodified($timezone = 'server') {}

The date the last comment was modified.

Parameters

  • string $timezone: Which timezone to use in reference to ‘gmt’, ‘blog’, or ‘server’ locations.

Return values

returns:Last comment modified date.

Source code

function get_lastcommentmodified($timezone = 'server') {

	global $cache_lastcommentmodified, $wpdb;



	if ( isset($cache_lastcommentmodified[$timezone]) )

		return $cache_lastcommentmodified[$timezone];



	$add_seconds_server = date('Z');



	switch ( strtolower($timezone)) {

		case 'gmt':

			$lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");

			break;

		case 'blog':

			$lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");

			break;

		case 'server':

			$lastcommentmodified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server));

			break;

	}



	$cache_lastcommentmodified[$timezone] = $lastcommentmodified;



	return $lastcommentmodified;

}

1438

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: