| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file displays a link for unauthorised users to logout and login with proper capabilities |
| 4 |
*/ |
| 5 |
if (!defined('UD_CENTRAL_DIR')) die('Security check'); |
| 6 |
|
| 7 |
_e('You are logged in, but your user account is not authorised to see this page.', 'updraftcentral'); |
| 8 |
|
| 9 |
if (function_exists('WC') && function_exists('woocommerce_login_form')) { |
| 10 |
|
| 11 |
if (!function_exists('updraftcentral_woocommerce_login_form_add_redirect_field')) { |
| 12 |
function updraftcentral_woocommerce_login_form_add_redirect_field() { |
| 13 |
echo '<input type="hidden" name="updraftcentral_redirect_on_wc_login" value="'.esc_attr(get_permalink()).'">'; |
| 14 |
} |
| 15 |
add_action('woocommerce_login_form', 'updraftcentral_woocommerce_login_form_add_redirect_field'); |
| 16 |
} |
| 17 |
|
| 18 |
echo do_shortcode('[woocommerce_my_account]'); |
| 19 |
} else { |
| 20 |
if (function_exists('WC') && false != ($myaccount_page_id = get_option('woocommerce_myaccount_page_id'))) { |
| 21 |
$login_url = get_permalink($myaccount_page_id); |
| 22 |
} else { |
| 23 |
$login_url = wp_login_url(get_permalink()); |
| 24 |
} |
| 25 |
?> |
| 26 |
<a href="<?php esc_attr_e($login_url);?>"><?php _e('Go here to log out and log in again.', 'updraftcentral');?></a> |
| 27 |
<?php |
| 28 |
} |
| 29 |
|