Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_lastcommentmodified [ WordPress Function ]

get_lastcommentmodified ( $timezone = 'server' )
Parameters:
  • (string) $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations.
Uses:
  • $wpdb
Returns:
  • (string) Last comment modified date.
Defined at:



The date the last comment was modified.

Source


<?php
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;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics