<?php
$args = array(
'post_author' => $current_user->ID,
'number' => 10, // how many comments to retrieve
'status' => 'approve'
);
$comments = get_comments( $args );
if ( $comments )
{
$output.= "<ul>\n";
foreach ( $comments as $c )
{
$output.= '<li>';
// $output.= '<a href="'.get_comment_link( $c->comment_ID ).'">';
$output.= get_comment_text($c->comment_ID);
$output.= '</a>, Posted on: '. mysql2date('m/d/Y', $c->comment_date, $translate);
$output.= "</li>\n";
}
$output.= '</ul>';
echo $output;
} else { echo "No comments made";}
?>
function getUserRegDate() {
$current_user = wp_get_current_user();
$user_info = get_userdata($user_id);
if ( is_user_logged_in() ) { // Проверяем, залогинен ли пользователь
$user_reg = $current_user->user_registered;
}
$now = new DateTime ($user_reg);
echo $now ? date_i18n('F j, H:i', strtotime($now)) : '';
}
function getUserRegDate() {
$user = get_userdata(get_current_user_id());
$user_reg = $user->get('user_registered');
$datetime = new DateTime($user_reg);
$formatter = new IntlDateFormatter(
'ru_RU',
IntlDateFormatter::LONG,
IntlDateFormatter::LONG
);
$formatter->setPattern('d MMMM, yyyy');
echo $formatter->format($datetime);
}
/** Replace 'An account is already registered with your email address. Please log in.' **/
add_filter( 'woocommerce_registration_error_email_exists', function() {
return 'Este înregistrat deja un cont cu adresa ta de e-mail. <a href="#" class="showlogin">Te rugăm să te autentifici.</a>';
} );
if ( class_exists( 'WooCommerce' ) && is_account_page() ) {
get_header('shop');
} else {
// текущий код header.php
}
add_filter( 'woocommerce_thankyou', 'update_order_status', 10, 1 );
function update_order_status( $order_id ) {
if ( !$order_id ){
return;
}
$order = new WC_Order( $order_id );
if ( 'on-hold' == $order->status) {
$order->update_status( 'pending payment' );
}
return;
}
//отключение загрузки скриптов и стилей cf7mls
function deregister_cf7mls_scripts() {
if( ! is_page('apply') ){
wp_deregister_script('cf7mls');
}
}
add_action('wp_print_scripts', 'deregister_cf7mls_scripts', 100);
function deregister_cf7mls_styles() {
if( ! is_page('apply') ){
wp_deregister_style('cf7mls');
}
}
add_action('wp_print_styles', 'deregister_cf7mls_styles', 100);
//отключение загрузки скриптов и стилей cf7mls