| 1 |
<?php |
| 2 |
/** |
| 3 |
* Displays the notice to say that the user cannot access the donation receipt. |
| 4 |
* |
| 5 |
* Override this template by copying it to yourtheme/charitable/donation-receipt/not-authorized.php |
| 6 |
* |
| 7 |
* @author WP Charitable LLC |
| 8 |
* @package Charitable/Templates/Donation Receipt |
| 9 |
* @since 1.1.2 |
| 10 |
* @version 1.6.27 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
$content = $view_args['content']; |
| 19 |
|
| 20 |
if ( is_user_logged_in() ) : ?> |
| 21 |
<div class="charitable-notice"> |
| 22 |
<?php _e( 'You do not have access to this donation receipt.', 'charitable' ); ?> |
| 23 |
</div> |
| 24 |
<?php else : ?> |
| 25 |
<div class="charitable-notice"> |
| 26 |
<?php |
| 27 |
_e( 'You must be logged in to access your donation receipt.', 'charitable' ); |
| 28 |
|
| 29 |
/* Display any other notices. */ |
| 30 |
charitable_template( 'form-fields/notices.php', array( 'notices' => charitable_get_notices()->get_notices() ) ); |
| 31 |
|
| 32 |
/** |
| 33 |
* Unhook the default template notices function from showing, as it would |
| 34 |
* result in another <noscript> element being created inside of this one. |
| 35 |
* |
| 36 |
* @see https://github.com/Charitable/Charitable/issues/715 |
| 37 |
*/ |
| 38 |
remove_action( 'charitable_login_form_before', 'charitable_template_notices', 10, 0 ); |
| 39 |
?> |
| 40 |
</div> |
| 41 |
<?php |
| 42 |
echo Charitable_Login_Shortcode::display( array( 'redirect' => charitable_get_current_url() ) ); |
| 43 |
|
| 44 |
/* Turn the login form notices hook back on. */ |
| 45 |
add_action( 'charitable_login_form_before', 'charitable_template_notices', 10, 0 ); |
| 46 |
endif; |
| 47 |
|