Skip to content

Commit

Permalink
Update calls to wc_print_messages() function
Browse files Browse the repository at this point in the history
  • Loading branch information
thenbrent committed Nov 13, 2013
1 parent e14e384 commit 2fcd615
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion includes/class-wc-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ public function process_checkout() {
if ( is_ajax() ) {

ob_start();
wc_print_messages();
wc_print_notices();
$messages = ob_get_clean();

echo '<!--WC_START-->' . json_encode(
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public static function product_page( $atts ) {
public static function shop_messages() {
ob_start();

wc_print_messages();
wc_print_notices();

return '<div class="woocommerce">' . ob_get_clean() . '</div>';
}
Expand Down
8 changes: 4 additions & 4 deletions includes/shortcodes/class-wc-shortcode-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static function order_pay( $order_id ) {

do_action( 'before_woocommerce_pay' );

wc_print_messages();
wc_print_notices();

$order_id = absint( $order_id );

Expand Down Expand Up @@ -168,7 +168,7 @@ private static function order_pay( $order_id ) {
wc_add_notice( __( 'Invalid order.', 'woocommerce' ), 'error' );
}

wc_print_messages();
wc_print_notices();

do_action( 'after_woocommerce_pay' );
}
Expand All @@ -179,7 +179,7 @@ private static function order_pay( $order_id ) {
private static function order_received( $order_id = 0 ) {
global $woocommerce;

wc_print_messages();
wc_print_notices();

$order = false;

Expand All @@ -206,7 +206,7 @@ private static function checkout() {
global $woocommerce;

// Show non-cart errors
wc_print_messages();
wc_print_notices();

// Check cart has contents
if ( sizeof( $woocommerce->cart->get_cart() ) == 0 )
Expand Down
4 changes: 2 additions & 2 deletions includes/wc-deprecated-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

function woocommerce_show_messages() {
_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_messages' );
wc_show_messages();
_deprecated_function( 'woocommerce_show_messages', '2.1', 'wc_print_notices' );
wc_print_notices();
}
function woocommerce_weekend_area_js() {
_deprecated_function( 'woocommerce_weekend_area_js', '2.1', '' );
Expand Down
12 changes: 9 additions & 3 deletions includes/wc-notice-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ function wc_clear_notices() {
*/
function wc_print_notices() {

foreach ( array( 'errors', 'messages', 'notices' ) as $notice_type ) {
if ( wc_notice_count( $notice_type ) > 0 ) {
$notice_types = array(
'wc_errors' => 'errors',
'wc_messages' => 'messages',
'wc_notices' => 'notices'
);

foreach ( $notice_types as $notice_key => $notice_type ) {
if ( wc_notice_count( $notice_key ) > 0 ) {
woocommerce_get_template( "shop/{$notice_type}.php", array(
$notice_type => WC()->session->get( "wc_{$notice_type}", array() )
$notice_type => WC()->session->get( $notice_key, array() )
) );
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/cart/cart-empty.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

wc_print_messages();
wc_print_notices();

?>

Expand Down
2 changes: 1 addition & 1 deletion templates/cart/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

global $woocommerce;

wc_print_messages();
wc_print_notices();

do_action( 'woocommerce_before_cart' ); ?>

Expand Down
2 changes: 1 addition & 1 deletion templates/checkout/cart-errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<p><?php _e( 'There are some issues with the items in your cart (shown above). Please go back to the cart page and resolve these issues before checking out.', 'woocommerce' ) ?></p>

Expand Down
2 changes: 1 addition & 1 deletion templates/checkout/form-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

global $woocommerce;

wc_print_messages();
wc_print_notices();

do_action( 'woocommerce_before_checkout_form', $checkout );

Expand Down
2 changes: 1 addition & 1 deletion templates/content-single-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* woocommerce_before_single_product hook
*
* @hooked wc_print_messages - 10
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/form-change-password.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
global $woocommerce;
?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<form action="<?php echo esc_url( get_permalink(woocommerce_get_page_id('change_password')) ); ?>" method="post">

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/form-edit-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
global $woocommerce;
?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<form action="" method="post">

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/form-edit-address.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
get_currentuserinfo();
?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<?php if ( ! $load_address ) : ?>

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/form-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

global $woocommerce; ?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<?php do_action('woocommerce_before_customer_login_form'); ?>

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/form-lost-password.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

?>

<?php wc_print_messages(); ?>
<?php wc_print_notices(); ?>

<form method="post" class="lost_reset_password">

Expand Down
2 changes: 1 addition & 1 deletion templates/myaccount/my-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

global $woocommerce;

wc_print_messages(); ?>
wc_print_notices(); ?>

<p class="myaccount_user">
<?php
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function woocommerce_ajax_apply_coupon() {
wc_add_notice( WC_Coupon::get_generic_coupon_error( WC_Coupon::E_WC_COUPON_PLEASE_ENTER ), 'error' );
}

wc_print_messages();
wc_print_notices();

die();
}
Expand Down
4 changes: 2 additions & 2 deletions woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ public function get_messages() {
* @deprecated 2.1.0 Access via the WC_Messages_Helper helper
*/
public function show_messages() {
_deprecated_function( 'Woocommerce->show_messages', '2.1', 'wc_print_messages()' );
wc_print_messages();
_deprecated_function( 'Woocommerce->show_messages', '2.1', 'wc_print_notices()' );
wc_print_notices();
}

/**
Expand Down

0 comments on commit 2fcd615

Please sign in to comment.