aiwoo_shortcode_logout

The WooCommerce Menu Extension aiwoo shortcode logout function.

Description

aiwoo_shortcode_logout( $atts, (null) $content = null ); 

Parameters (2)

0. $atts
The atts.
1. $content — Optional. (null) => null
The content.

Usage

  1. if ( !function_exists( 'aiwoo_shortcode_logout' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-menu-extension/include/frontend.inc.php'; 
  3.  
  4. // The atts. 
  5. $atts = null; 
  6.  
  7. // The content. 
  8. $content = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = aiwoo_shortcode_logout($atts, $content); 
  12.  

Defined (1)

The function is defined in the following location(s).

/include/frontend.inc.php  
  1. function aiwoo_shortcode_logout( $atts, $content = null ) { 
  2. global $woocommerce; 
  3. extract(shortcode_atts(array( 
  4. "edit_tag" => "",  
  5. "redirect" => get_permalink( woocommerce_get_page_id( 'myaccount' ) ) 
  6. ), $atts ) ); 
  7. $href = wp_logout_url( $redirect ); 
  8. $edit_tag = esc_html( strip_tags( $edit_tag ) ); 
  9. $content = $content != '' ? $content : __( 'Logout' ); 
  10. if ( is_user_logged_in() ) { 
  11. $current_user = wp_get_current_user(); 
  12. return 'Hello ' . $current_user->user_login . ', <a href="' . esc_url( $href ) . '"' .$edit_tag . '>' . $content . '</a>';