PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.11
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.11
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / templates / shortcodes / my-donations.php

my-donations.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.11, at templates/shortcodes/my-donations.php

187 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays a table of the user's donations, with links to the donation receipts.
4 *
5 * Override this template by copying it to yourtheme/charitable/shortcodes/my-donations.php
6 *
7 * @author WP Charitable LLC
8 * @package Charitable/Templates/Account
9 * @since 1.4.0
10 * @version 1.6.19
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 $user = array_key_exists( 'user', $view_args ) ? $view_args['user'] : charitable_get_user( get_current_user_id() );
19 $donations = $view_args['donations'];
20
21 /**
22 * Do something before rendering the donations.
23 *
24 * @param object[] $donations An array of donations as a simple object.
25 * @param array $view_args All args passed to template.
26 */
27 do_action( 'charitable_my_donations_before', $donations, $view_args );
28
29 if ( empty( $donations ) ) : ?>
30
31 <p><?php _e( 'You have not made any donations yet.', 'charitable' ); ?></p>
32
33 <?php else : ?>
34
35 <table class="charitable-my-donations charitable-table">
36 <thead>
37 <tr>
38 <th scope="col"><?php _e( 'Date', 'charitable' ); ?></th>
39 <?php
40 /**
41 * Add a column header after the donation date header. Any output should be wrapped in <th></th>.
42 *
43 * @since 1.5.0
44 *
45 * @param object[] $donations An array of donations as a simple object.
46 * @param array $view_args All args passed to template.
47 */
48 do_action( 'charitable_my_donations_table_header_after_date', $donations, $view_args );
49 ?>
50 <th scope="col"><?php _e( 'Campaign', 'charitable' ); ?></th>
51 <?php
52 /**
53 * Add a column header after the campaign header. Any output should be wrapped in <th></th>.
54 *
55 * @since 1.5.0
56 *
57 * @param object[] $donations An array of donations as a simple object.
58 * @param array $view_args All args passed to template.
59 */
60 do_action( 'charitable_my_donations_table_header_after_campaigns', $donations, $view_args );
61 ?>
62 <th scope="col"><?php _e( 'Amount', 'charitable' ); ?></th>
63 <?php
64 /**
65 * Add a column header after the amount header. Any output should be wrapped in <th></th>.
66 *
67 * @since 1.5.0
68 *
69 * @param object[] $donations An array of donations as a simple object.
70 * @param array $view_args All args passed to template.
71 */
72 do_action( 'charitable_my_donations_table_header_after_amount', $donations, $view_args );
73 ?>
74 <th scope="col"><?php _e( 'Status', 'charitable' ); ?></th>
75 <?php
76 /**
77 * Add a column header after the status header. Any output should be wrapped in <th></th>.
78 *
79 * @since 1.5.4
80 *
81 * @param object[] $donations An array of donations as a simple object.
82 */
83 do_action( 'charitable_my_donations_table_header_after_status', $donations );
84 ?>
85 <th scope="col"><?php _e( 'Receipt', 'charitable' ); ?></th>
86 <?php
87 /**
88 * Add a column header after the receipt header. Any output should be wrapped in <th></th>.
89 *
90 * @since 1.5.0
91 *
92 * @param object[] $donations An array of donations as a simple object.
93 * @param array $view_args All args passed to template.
94 */
95 do_action( 'charitable_my_donations_table_header_after_receipt', $donations, $view_args );
96 ?>
97 </tr>
98 </thead>
99 <tbody>
100 <?php foreach ( $donations as $donation ) : ?>
101 <tr>
102 <td><?php echo mysql2date( 'F j, Y', get_post_field( 'post_date', $donation->ID ) ); ?></td>
103 <?php
104 /**
105 * Add a cell after the donation date. Any output should be wrapped in <td></td>.
106 *
107 * @since 1.5.0
108 *
109 * @param object $donation The donation as a simple object.
110 * @param array $view_args All args passed to template.
111 */
112 do_action( 'charitable_my_donations_table_after_date', $donation );
113 ?>
114 <td><?php echo $donation->campaigns; ?></td>
115 <?php
116 /**
117 * Add a cell after the list of campaigns. Any output should be wrapped in <td></td>.
118 *
119 * @since 1.5.0
120 *
121 * @param object $donation The donation as a simple object.
122 * @param array $view_args All args passed to template.
123 */
124 do_action( 'charitable_my_donations_table_after_campaigns', $donation );
125 ?>
126 <td class="amount" data-title="<?php esc_attr_e( 'Amount', 'charitable' ); ?>">
127 <?php
128 /**
129 * Filter the total donation amount.
130 *
131 * @since 1.6.19
132 *
133 * @param string $amount The total donation amount.
134 * @param object $donation The donation as a simple object.
135 */
136 echo apply_filters( 'charitable_my_donation_total_amount', charitable_format_money( $donation->amount ), $donation );
137 ?>
138 </td>
139 <?php
140 /**
141 * Add a cell after the donation amount. Any output should be wrapped in <td></td>.
142 *
143 * @since 1.5.0
144 *
145 * @param object $donation The donation as a simple object.
146 * @param array $view_args All args passed to template.
147 */
148 do_action( 'charitable_my_donations_table_after_amount', $donation );
149 ?>
150 <td><?php echo charitable_get_donation( $donation->ID )->get_status_label(); ?></td>
151 <?php
152 /**
153 * Add a cell after the donation status. Any output should be wrapped in <td></td>.
154 *
155 * @since 1.5.4
156 *
157 * @param object $donation The donation as a simple object.
158 */
159 do_action( 'charitable_my_donations_table_after_status', $donation );
160 ?>
161 <td><a href="<?php echo esc_url( charitable_get_permalink( 'donation_receipt_page', array( 'donation_id' => $donation->ID ) ) ); ?>"><?php _e( 'View Receipt', 'charitable' ); ?></a></td>
162 <?php
163 /**
164 * Add a cell after the link to the receipt. Any output should be wrapped in <td></td>.
165 *
166 * @since 1.5.0
167 *
168 * @param object $donation The donation as a simple object.
169 * @param array $view_args All args passed to template.
170 */
171 do_action( 'charitable_my_donations_table_after_receipt', $donation, $view_args );
172 ?>
173 </tr>
174 <?php endforeach ?>
175 </tbody>
176 </table>
177 <?php
178 endif;
179
180 /**
181 * Do something after rendering the donations.
182 *
183 * @param object[] $donations An array of donations as a simple object.
184 * @param array $view_args All args passed to template.
185 */
186 do_action( 'charitable_my_donations_after', $donations, $view_args );
187